Skip to content

Commit a8bfde7

Browse files
committed
Add ability to show loads
1 parent 046e815 commit a8bfde7

File tree

17 files changed

+135
-37
lines changed

17 files changed

+135
-37
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ set(SOURCE_FILES
3131
src/include/rstl/rstl.h
3232
src/include/rstl/vector.h
3333
src/include/rstl/auto_ptr.h
34+
src/include/rstl/list.h
3435
src/include/dvd.h
3536
src/include/types.h
3637
src/include/os.h
@@ -79,6 +80,7 @@ set(SOURCE_FILES
7980
src/include/prime/CGameCamera.hpp
8081
src/include/prime/CFirstPersonCamera.hpp
8182
src/include/prime/CBallCamera.hpp
83+
src/include/prime/CResFactory.hpp
8284
src/include/STriggerRenderConfig.hpp
8385
src/include/NewPauseScreen.hpp
8486
src/include/GetField.hpp

PrimeAPI2/PrimeAPI.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ set(CMAKE_PRIME_C_FLAGS_LIST
1212
-nostdlib
1313
-nostdinc
1414
-ffreestanding
15-
-isystem "${DEVKITPPC}/lib/gcc/powerpc-eabi/11.1.0/include"
16-
-isystem "${DEVKITPPC}/lib/gcc/powerpc-eabi/11.1.0/include-fixed"
15+
-isystem "${DEVKITPPC}/lib/gcc/powerpc-eabi/11.2.0/include"
16+
-isystem "${DEVKITPPC}/lib/gcc/powerpc-eabi/11.2.0/include-fixed"
1717
-isystem "${DEVKITPPC}/powerpc-eabi/include"
1818
-fno-function-sections
1919
-fno-data-sections
@@ -61,7 +61,7 @@ macro(add_prime_binary name symbol_list base_dol)
6161
"${CMAKE_PRIME_LINK_FLAGS} -Map ${CMAKE_CURRENT_BINARY_DIR}/${name}.map"
6262
)
6363

64-
target_link_libraries(${name} "${DEVKITPPC}/lib/gcc/powerpc-eabi/11.1.0/libgcc.a")
64+
target_link_libraries(${name} "${DEVKITPPC}/lib/gcc/powerpc-eabi/11.2.0/libgcc.a")
6565

6666
# Create the dol_symbols.o
6767
get_filename_component(absolute_symbol_list "${symbol_list}" REALPATH)

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ Youtube video on macOS (Linux is similar): [https://www.youtube.com/watch?v=fyz6
6767

6868
## Changelog
6969

70+
### 2.4.0
71+
- New option to show current loads in bottom left
72+
7073
### 2.3.4
7174
- Floaty jump added to menu
7275
- Split out warp from load pos

src/UI/MonitorWindow.cpp

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace GUI {
2323
void drawRotationalVelocity();
2424
void drawIGT();
2525
void drawRoomTime();
26+
void drawLoads();
2627

2728
void drawMonitorWindow(CFinalInput *inputs) {
2829
if (!SETTINGS.OSD_show) {
@@ -68,14 +69,67 @@ namespace GUI {
6869
ImGui::End();
6970
}
7071

72+
if (SETTINGS.OSD_showLoads) {
73+
drawLoads();
74+
}
75+
7176
if (SETTINGS.OSD_showInput) {
7277
drawInput(inputs);
7378
}
7479
}
7580

81+
void drawLoads() {
82+
CGameGlobalObjects *globals = ((CGameGlobalObjects *) 0x80457798);
83+
CResFactory *resFactory = globals->getResFactory();
84+
auto list = resFactory->getLoadList();
85+
86+
u32 count = list->size;
87+
if (count > 0) {
88+
// actually draw
89+
ImGui::SetNextWindowPos(ImVec2(10, 450), ImGuiCond_None, ImVec2(0, 1));
90+
ImGui::Begin(
91+
"Loads", nullptr,
92+
ImGuiWindowFlags_NoResize |
93+
ImGuiWindowFlags_AlwaysAutoResize |
94+
ImGuiWindowFlags_NoTitleBar |
95+
ImGuiWindowFlags_NoInputs |
96+
ImGuiWindowFlags_NoNavInputs |
97+
ImGuiWindowFlags_NoNavFocus |
98+
ImGuiWindowFlags_NoNav |
99+
ImGuiWindowFlags_NoFocusOnAppearing |
100+
ImGuiWindowFlags_NoMove |
101+
ImGuiWindowFlags_NoDecoration |
102+
// ImGuiWindowFlags_NoBackground |
103+
ImGuiFocusedFlags_None // just for conveneint commenting in/out
104+
);
105+
106+
char sObjTagBuff[14];
107+
108+
int shown = 0;
109+
auto end = list->end;
110+
auto current = list->first;
111+
112+
u32 totalSize = 0;
113+
while (end != current) {
114+
u32 size = current->item.getResLen();
115+
totalSize += size;
116+
if (shown < 5) {
117+
current->item.getTag()->writeToString(sObjTagBuff);
118+
ImGui::Text("%s %d", sObjTagBuff, size);
119+
shown++;
120+
}
121+
current = current->next;
122+
}
123+
ImGui::Text("%d/%dkb left", count, totalSize / 1024);
124+
125+
ImGui::End();
126+
}
127+
128+
}
129+
76130
void drawIGT() {
77131
CGameGlobalObjects *globals = ((CGameGlobalObjects *) 0x80457798);
78-
CGameState *gameState = globals->x134_gameState;
132+
CGameState *gameState = globals->getGameState();
79133
if (gameState) {
80134
double time = gameState->PlayTime();
81135
int ms = (int) (time * 1000.0) % 1000;
@@ -92,7 +146,7 @@ namespace GUI {
92146

93147
void drawRoomTime() {
94148
CGameGlobalObjects *globals = ((CGameGlobalObjects *) 0x80457798);
95-
CGameState *gameState = globals->x134_gameState;
149+
CGameState *gameState = globals->getGameState();
96150
CStateManager *stateManager = ((CStateManager *) 0x8045A1A8);
97151
const CWorld *world = stateManager->GetWorld();
98152

src/UI/PlayerMenu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace GUI {
2323
CPlayerState *playerState = stateManager->GetPlayerState();
2424

2525
CGameGlobalObjects *globals = ((CGameGlobalObjects *) 0x80457798);
26-
CGameState *gameState = globals->x134_gameState;
26+
CGameState *gameState = globals->getGameState();
2727

2828
u32 currentWorldAssetID = gameState->MLVL();
2929
u32 currentAreaAssetID = 0;
@@ -132,7 +132,7 @@ namespace GUI {
132132
CPlayer *player = stateManager->Player();
133133

134134
CGameGlobalObjects *globals = ((CGameGlobalObjects *) 0x80457798);
135-
CGameState *gameState = globals->x134_gameState;
135+
CGameState *gameState = globals->getGameState();
136136

137137

138138
u32 currentWorldAssetID = gameState->MLVL();

src/UI/SettingsMenu.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace GUI {
2323
BITFIELD_CHECKBOX("Memory info", SETTINGS.OSD_showMemoryInfo);
2424
ImGui::SameLine();
2525
BITFIELD_CHECKBOX("Memory graph", SETTINGS.OSD_showMemoryGraph);
26+
BITFIELD_CHECKBOX("Loads", SETTINGS.OSD_showLoads);
2627

2728
// end in-game display
2829
ImGui::TreePop();

src/include/PrimeAPI.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef PRIMEAPI_H
2-
#define PRIMEAPI_H
1+
#pragma once
32

43
#include <gccore.h>
54

@@ -58,5 +57,3 @@ inline void operator delete[](void * ptr, size_t) {
5857
//#define new new("", "")
5958

6059
#endif
61-
62-
#endif

src/include/prime/CActor.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef PRIME_PRACTICE_NATIVE_CACTOR_HPP
2-
#define PRIME_PRACTICE_NATIVE_CACTOR_HPP
1+
#pragma once
32

43
#include "PrimeAPI.h"
54
#include "prime/CEntity.hpp"
@@ -15,5 +14,3 @@ class CActor : public CEntity {
1514
}
1615

1716
};
18-
19-
#endif //PRIME_PRACTICE_NATIVE_CACTOR_HPP

src/include/prime/CGameCamera.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include "CActor.hpp"
4+
35
class CGameCamera : public CActor {
46
public:
57

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
#ifndef PRIME_PRACTICE_CGAMEGLOBALOBJECTS_HPP
2-
#define PRIME_PRACTICE_CGAMEGLOBALOBJECTS_HPP
1+
#pragma once
32

43
#include "prime/CStateManager.hpp"
4+
#include "prime/CResFactory.hpp"
5+
#include "CSimplePool.hpp"
56

67
class CGameGlobalObjects {
78
public:
8-
PADDING(0x134);
9-
CGameState *x134_gameState;
9+
inline CResFactory *getResFactory() { return GetField<CResFactory>(this, 0x4); }
10+
inline CSimplePool *getMainPool() { return GetField<CSimplePool>(this, 0xCC); }
11+
inline CGameState *getGameState() { return *GetField<CGameState*>(this, 0x134); }
1012
};
11-
12-
13-
#endif //PRIME_PRACTICE_CGAMEGLOBALOBJECTS_HPP

0 commit comments

Comments
 (0)