- Stand-in client reaches the glue screens (intro movie, EULA/TOS accept, login screen) at 16:9; stand-ins are report-only on x64 - Ports on the startup/idle path: GlueScriptEvents/CharacterSelection/ CharacterCreation/RealmList/AccountMsg/VideoOptions _Scripts, CGlueMgr (Initialize/Resume/Idle/Accept*/Shutdown), ClientServices, NetClient/ WowConnection, DBCache + instances, WorldParam/World/Map/Liquid/Weather/ shadow, InputControl, Scrn, ConsoleClient, SysMessage, LoadingScreen, SystemRegisterFunctions, CGameTime, Screen::GetAspectRatio - Shutdown chain: BeginCloseGame, DestroyEngineCallback, DBCache save/ destroy, SpellVisuals/Effect/World/Glue teardown - Logitech LCD no-device path in Ui/UILCD/Windows (Windows-only dir); lgLcd is a stub library in ThirdParty/lgLcd - CVar and console commands split into <Module>_CVar.cpp / _Console.cpp - DivxDecoder.dll (Win32, original) and XvidDecoder.dll (x64, port with vendored xvidcore) both copied to the build folder - Warden: Win32 faithful port, Win64 stub - x64 fixes: lua_newstate gcusage/gctime init, pointer render states reset with nullptr, g_rndSeed defined - 37 class/struct forward-declaration mismatches fixed (false stand-ins) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
74 lines
2.9 KiB
C++
74 lines
2.9 KiB
C++
#include <cstddef>
|
|
#include <cstdint>
|
|
#include "WoW/Source/ObjectAlloc/HeapUsage.h"
|
|
#include "Engine/Source/ConsoleBase/ConsoleCommand.h"
|
|
#include "Engine/Source/ConsoleBase/ConsoleVar.h"
|
|
#include "Engine/Source/ConsoleBase/IConsole.h"
|
|
#include "Engine/Source/Storm/H/storm.h"
|
|
#include "WoW/Source/ObjectAlloc/ObjectAlloc.h"
|
|
|
|
// VERIFY: ac858bec manual
|
|
// OFFSET: 0x004D27E0
|
|
static int32_t HeapUsage(const char* command, const char* arguments) {
|
|
char buffer[50000];
|
|
char line[2048];
|
|
|
|
OBJALLOCGLOBALS* globals = GetObjAllocGlobals();
|
|
uint32_t count = globals->objects.Count();
|
|
uint32_t objectBytes = 0;
|
|
uint32_t heapBytes = 0;
|
|
char* str = buffer + SStrPrintf(buffer, sizeof(buffer), "%u Heaps in use:\n", count);
|
|
|
|
for (uint32_t i = 0; i < count; i++) {
|
|
CObjectHeapList& list = globals->objects[i];
|
|
list.TotalHeaps();
|
|
|
|
uint32_t numAllocs = list.m_numAllocs >= 0xFFFFFFFF ? 0xFFFFFFFF : static_cast<uint32_t>(list.m_numAllocs);
|
|
uint32_t totalBytes = list.TotalHeaps() * list.m_objSize * list.m_objsPerBlock;
|
|
uint32_t usedBytes = list.BlocksAllocated() * list.m_objSize;
|
|
|
|
str += SStrPrintf(str, line - str, " \"%24s\" %3u blocks, %5u objs per block (%6u bytes per obj): %6u objs allocated (%3d%%) - Total bytes: %8.3fMb (%8.3fMb), Total Allocs: %d\n", list.m_heapName, list.TotalHeaps(), list.m_objsPerBlock, list.m_objSize, list.BlocksAllocated(), list.PercentUsed(), usedBytes * 0.00000095367432f, totalBytes * 0.00000095367432f, numAllocs);
|
|
|
|
objectBytes += globals->objects[i].m_objSize * globals->objects[i].BlocksAllocated();
|
|
heapBytes += globals->objects[i].TotalHeaps() * globals->objects[i].m_objSize * globals->objects[i].m_objsPerBlock;
|
|
}
|
|
|
|
SStrPrintf(str, line - str, "%4.3fMb total object bytes used, %4.3fMb bytes allocated for heaps\n", objectBytes * 0.00000095367432f, heapBytes * 0.00000095367432f);
|
|
ReleaseObjAllocGlobals();
|
|
|
|
char* dest = line;
|
|
|
|
for (const char* src = buffer; *src; src++) {
|
|
if (*src == '\n') {
|
|
*dest = '\0';
|
|
ConsoleWrite(line, DEFAULT_COLOR);
|
|
dest = line;
|
|
} else if (dest < line + sizeof(line) - 1) {
|
|
*dest++ = *src;
|
|
}
|
|
}
|
|
|
|
if (dest != line) {
|
|
ConsoleWrite(line, DEFAULT_COLOR);
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
static int32_t MemUsage(const char* command, const char* arguments) {
|
|
return 1;
|
|
}
|
|
|
|
static int32_t HeapUsage2(const char* command, const char* arguments) {
|
|
return 1;
|
|
}
|
|
|
|
// VERIFY: 267b1512 auto
|
|
// OFFSET: 0x004D2A30
|
|
void HeapUsageInitialize() {
|
|
ConsoleCommandRegister("HeapUsage", HeapUsage, CATEGORY_GAME, nullptr);
|
|
ConsoleCommandRegister("MemUsage", MemUsage, CATEGORY_GAME, nullptr);
|
|
ConsoleCommandRegister("HeapUsage2", HeapUsage2, CATEGORY_GAME, nullptr);
|
|
s_cvHeapAllocTracking = CVar::Register("heapAllocTracking", "Enables/disables allocation tracking & dumping in SMemMalloc", 0, "1", ChangeHeapAllocTracking, CATEGORY_GAME, false, nullptr, false);
|
|
}
|