Skip to content

Commit

Permalink
Add draw load queue option
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Jul 31, 2022
1 parent 87b69c5 commit dbed259
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Hooking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,19 @@ void __cdecl Font__Flush()
auto level = *(Level**)(GAMETRACKER + 8);
auto drawSettings = Hooking::GetInstance().GetMenu()->m_drawSettings;

// prints queued file requests
if (drawSettings.printFileRequests && g_pDiskFS)
{
SetCursor(15.f, 15.f);

auto queue = g_pDiskFS->m_queue;
for (auto request = queue; request != nullptr; request = request->m_next)
{
FONT_Print("%s (%d/%d)\n", request->m_pFileName, request->m_bytesRead, request->m_size);
}
}

// draws collision mesh
if (drawSettings.drawCollision && level)
{
auto terrain = (Terrain*)level->terrain;
Expand Down Expand Up @@ -309,6 +322,7 @@ void __cdecl Font__Flush()
}
}

// draws signal mesh
if (level && drawSettings.drawSignals)
{
auto terrain = (Terrain*)level->terrain;
Expand Down Expand Up @@ -336,6 +350,7 @@ void __cdecl Font__Flush()
}
}

// draws portals
if (drawSettings.drawPortals && level)
{
auto terrain = *(Terrain*)level->terrain;
Expand Down
2 changes: 2 additions & 0 deletions Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ void Menu::Draw()
{
*(int*)(GAMETRACKER + 0x18) /*debugFlags2*/ |= 0x100;
}

ImGui::Checkbox("Show load queue", &m_drawSettings.printFileRequests);
#endif

#if TRAE
Expand Down
1 change: 1 addition & 0 deletions Menu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct DrawSettings
bool drawCollision = false;
bool drawPortals = false;
bool drawSignals = false;
bool printFileRequests = false;

// "DrawSettings"
bool noRespawn = false;
Expand Down
24 changes: 24 additions & 0 deletions game/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,31 @@ namespace cdc
virtual bool IsSuspended() = 0;
#endif
};

struct MSFileSystem
{
struct Request
{
char pad1[20];
char m_pFileName[128];
char pad2[20];
unsigned int m_bytesRead;
unsigned int m_bytesProcessed;
int m_readState;
unsigned int m_offset;
unsigned int m_size;
Request* m_next;
};

char pad[1099812];
Request* m_queue;
Request* m_free;
unsigned int m_numUsedRequests;
};
}

#define g_pDiskFS VAR_U_(DISKFS, cdc::MSFileSystem*)
#define g_pFS VAR_U_(ARCHIVEFS, cdc::MSFileSystem*)

cdc::FileSystem* GetFS();
cdc::FileSystem* CreateHookFileSystem(cdc::FileSystem* pFS, cdc::FileSystem* pDiskFS);

0 comments on commit dbed259

Please sign in to comment.