From 43c55f062d43b0f1ff20ff3ca935e43932e348cc Mon Sep 17 00:00:00 2001 From: "Robin C. Ladiges" Date: Wed, 15 May 2024 21:59:28 +0200 Subject: [PATCH] [debug menu] change: client & gamemode heaps on one line - Show how much is used instead of how much is free. - Double precision, because of observable inaccuracies otherwise. - Divide by 1024 instead of by 1000 to display KiB instead of KB. - Show only one fractional digit. - (The max is exactly 320 KiB, so need to show a fractional digit for it.) --- source/main.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index 2ab620f..8546a13 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -87,7 +87,7 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: Time::calcTime(); // this needs to be ran every frame, so running it here works - if(!debugMode) { + if (!debugMode) { al::executeDraw(curSequence->mLytKit, "2Dバック(メイン画面)"); return; } @@ -110,11 +110,15 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: gTextWriter->setScaleFromFontHeight(20.f); sead::Heap* clientHeap = Client::getClientHeap(); - sead::Heap *gmHeap = GameModeManager::instance()->getHeap(); - if (clientHeap) { - gTextWriter->printf("Client Heap Free Size: %f/%f\n", clientHeap->getFreeSize() * 0.001f, clientHeap->getSize() * 0.001f); - gTextWriter->printf("Gamemode Heap Free Size: %f/%f\n", gmHeap->getFreeSize() * 0.001f, gmHeap->getSize()* 0.001f); + sead::Heap *gmHeap = GameModeManager::instance()->getHeap(); + gTextWriter->printf( + "Heap Use: %.1f/%.0f (Client) %.1f/%.0f (Gmode)\n", + 0.0009765625 * (clientHeap->getSize() - clientHeap->getFreeSize()), + 0.0009765625 * clientHeap->getSize(), + 0.0009765625 * (gmHeap->getSize() - gmHeap->getFreeSize()), + 0.0009765625 * gmHeap->getSize() + ); } gTextWriter->printf("Client Socket Connection Status: %s\n", Client::instance()->mSocket->getStateChar()); @@ -127,8 +131,7 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: al::Scene *curScene = curSequence->curScene; - if(curScene && isInGame) { - + if (curScene && isInGame) { sead::LookAtCamera *cam = al::getLookAtCamera(curScene, 0); sead::Projection* projection = al::getProjectionSead(curScene, 0); @@ -137,7 +140,6 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: PuppetActor* curPuppet = Client::getPuppet(debugPuppetIndex); PuppetActor *debugPuppet = Client::getDebugPuppet(); - if (debugPuppet) { curPuppet = debugPuppet; } @@ -152,7 +154,6 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: { case 0: { - // PuppetActor *curPuppet = Client::getDebugPuppet(); if(curPuppet) { @@ -161,8 +162,6 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: PuppetInfo* curPupInfo = curPuppet->getInfo(); if (curModel && curPupInfo) { - // al::LiveActor *curCapture = curPuppet->getCapture(debugCaptureIndex); - gTextWriter->printf("Puppet Index: %d\n", debugPuppetIndex); gTextWriter->printf("Player Name: %s\n", curPupInfo->puppetName); gTextWriter->printf("Connection Status: %s\n", curPupInfo->isConnected ? "Online" : "Offline"); @@ -171,11 +170,6 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: gTextWriter->printf("Puppet Stage: %s\n", curPupInfo->stageName); gTextWriter->printf("Puppet Scenario: %u\n", curPupInfo->scenarioNo); gTextWriter->printf("Puppet Costume: H: %s B: %s\n", curPupInfo->costumeHead, curPupInfo->costumeBody); - //gTextWriter->printf("Packet Coords:\nX: %f\nY: %f\nZ: %f\n", curPupInfo->playerPos.x, curPupInfo->playerPos.y, curPupInfo->playerPos.z); - // if (curModel) { - // sead::Vector3f* pupPos = al::getTrans(curModel); - // gTextWriter->printf("In-Game Coords:\nX: %f\nY: %f\nZ: %f\n", pupPos->x, pupPos->y, pupPos->z); - // } if(curPupInfo->isCaptured) { gTextWriter->printf("Current Capture: %s\n", curPupInfo->curHack);