Storm moves under Engine/Source with its inner layout unchanged. All includes use Engine/Source/Storm/..., Storm's include guards follow the new path, and the top-level CMakeLists adds Engine/Source/Storm. SFile.cpp (SFile::CreateOverlapped/DestroyOverlapped) moves to Engine/Source/BlizzardCore. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
164 lines
4.0 KiB
C++
164 lines
4.0 KiB
C++
#include <cstdarg>
|
|
#include <cstdint>
|
|
#include <cstring>
|
|
#include <windows.h>
|
|
#include "Engine/Source/Base/Status.h"
|
|
#include "Engine/Source/Storm/H/storm.h"
|
|
|
|
// STATIC: 0x00AC0CE4
|
|
static CStatus s_errorList;
|
|
|
|
// 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: 4e511dd5 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(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: 8906e022 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(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
|
|
CStatus::~CStatus() {
|
|
this->Clear();
|
|
}
|
|
|
|
void CStatus::Display() {
|
|
}
|