Files
SatyandClaude Opus 5.5 b76f1b443a Port packs w3-w5: objects/vehicles, LCD stack, ComSat voice chat, map dtors, misc missing functions
- Object/vehicle/spell-visual/world/MapObj functions from pack w3
- Logitech LCD stack (CLCDBase..CLCDConnection, CLCDText/Bitmap/Page, CEzLcd, CEzLcdPage, CLCDUtils) and CGLCD
- ComSat client: voice start/stop, mute, sound group fade, tick, event dispatch; s_comsatCallbacks is a growable array
- ShipPath pause/offset, Transport state progress, vehicle bone anim/passenger removal, NetClient redirect
- Map class destructors (CMapArea/Chunk/DoodadDef/Entity/ObjDefGroup), CMapChunk +0xB4 is a TSLink
- Character rename/customize, ClientServices login/survey wrappers, glue Lua scripts, DayNight light overrides
- Template instance and deleting-dtor OFFSETs

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-03 03:16:42 +02:00

181 lines
4.4 KiB
C++

#include <cstdarg>
#include <cstdint>
#include <cstring>
#include "Engine/Source/Base/Status.h"
#include "Engine/Source/Storm/H/storm.h"
// STATIC: 0x00AC0CE4
static CStatus s_errorList;
// INLINED
CStatus::STATUSENTRY::~STATUSENTRY() {
if (this->m_text) {
SMemFree(this->m_text, __FILE__, __LINE__, 0);
}
}
// INLINED
CStatus::CStatus() {
this->m_highestSeverity = STATUS_INFO;
}
// INLINED
void CStatus::Clear() {
this->m_statusList.Clear();
this->m_highestSeverity = STATUS_INFO;
}
// VERIFY: d83a4f5e auto
// OFFSET: 0x0047C090
CStatus& GetGlobalStatusObj() {
return s_errorList;
}
// VERIFY: 8cc1593d manual
// OFFSET: 0x0047C0A0
void CStatus::Add(const CStatus& source) {
CStatus& src = const_cast<CStatus&>(source);
for (STATUSENTRY* entry = src.m_statusList.Head(); entry; entry = src.m_statusList.Next(entry)) {
this->Add(entry->m_severity, entry->m_text);
}
}
// VERIFY: d9203a7f manual
// OFFSET: 0x0047C0F0
int32_t CStatus::IsEmpty() {
return this->m_statusList.Head() == nullptr;
}
// VERIFY: d68224ab manual
// OFFSET: 0x0047C110
char* CStatus::GetErrorStr(char* buffer, size_t bufchars, STATUS_TYPE minSeverity, const char* separator) {
char* curr = buffer;
*curr = 0;
size_t separatorchars = separator && *separator ? SStrLen(separator) : 0;
for (STATUSENTRY* entry = this->m_statusList.Head(); entry; entry = this->m_statusList.Next(entry)) {
if (entry->m_severity < minSeverity) {
continue;
}
size_t textchars = SStrLen(entry->m_text);
if (textchars + separatorchars >= bufchars) {
return buffer;
}
SStrCopy(curr, entry->m_text, bufchars);
curr += textchars;
bufchars -= textchars;
if (separatorchars) {
SStrPack(curr, separator, bufchars);
bufchars -= separatorchars;
curr += separatorchars;
}
}
return buffer;
}
// VERIFY: 2dc1dd20 manual
// OFFSET: 0x0047C1D0
uint32_t CStatus::GetErrorStrLen(STATUS_TYPE minSeverity, const char* separator) {
size_t separatorchars = 0;
uint32_t length = 0;
if (separator && *separator) {
separatorchars = SStrLen(separator);
}
for (STATUSENTRY* entry = this->m_statusList.Head(); entry; entry = this->m_statusList.Next(entry)) {
if (entry->m_severity >= minSeverity) {
length += SStrLen(entry->m_text) + separatorchars;
}
}
return length;
}
// VERIFY: ccc312bc manual
// OFFSET: 0x0047C240
char* CStatus::GetErrorStrAlloc(STATUS_TYPE minSeverity, const char* separator) {
size_t bufchars = this->GetErrorStrLen(minSeverity, separator) + 1;
char* buffer = static_cast<char*>(SMemAlloc(bufchars, __FILE__, __LINE__, 0));
if (buffer) {
this->GetErrorStr(buffer, bufchars, minSeverity, separator);
}
return buffer;
}
// VERIFY: c97894d9 manual
// OFFSET: 0x0047C290
void CStatus::Prepend(STATUS_TYPE severity, const char* format, ...) {
char buffer[256];
memset(buffer, 0, sizeof(buffer));
if (!format) {
DebugValidate("format");
SErrSetLastError(STORM_ERROR_INVALID_PARAMETER);
return;
}
va_list args;
va_start(args, format);
SStrVPrintf(buffer, sizeof(buffer), format, args);
if (!buffer[0]) {
return;
}
STATUSENTRY* entry = this->m_statusList.NewNode(1, 0, 0);
entry->m_text = SStrDupA(buffer, __FILE__, __LINE__);
entry->m_severity = severity;
if (severity > this->m_highestSeverity) {
this->m_highestSeverity = severity;
}
}
// VERIFY: 29d4c2bf manual
// OFFSET: 0x0047C360
void CStatus::Add(STATUS_TYPE severity, const char* format, ...) {
char buffer[256];
memset(buffer, 0, sizeof(buffer));
if (!format) {
DebugValidate("format");
SErrSetLastError(STORM_ERROR_INVALID_PARAMETER);
return;
}
va_list args;
va_start(args, format);
SStrVPrintf(buffer, sizeof(buffer), format, args);
if (!buffer[0]) {
return;
}
STATUSENTRY* entry = this->m_statusList.NewNode(2, 0, 0);
entry->m_text = SStrDupA(buffer, __FILE__, __LINE__);
entry->m_severity = severity;
if (severity > this->m_highestSeverity) {
this->m_highestSeverity = severity;
}
}
// VERIFY: 25d08b32 manual
// OFFSET: [0x0047C500, 0x0055F830]
CStatus::~CStatus() {
this->Clear();
}
void CStatus::Display() {
}