Skip to content

Commit

Permalink
add freespace command for debugging
Browse files Browse the repository at this point in the history
this util still isn't working
  • Loading branch information
wootguy committed Nov 10, 2024
1 parent 3e4f48a commit 3e36cdd
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,24 @@ void update_plugins() {
}
}

void freespace_command() {
std::string path = CMD_ARGC() > 1 ? CMD_ARGS() : "";

if (path.empty()) {
static char gameDir[MAX_PATH];
GET_GAME_DIR(gameDir);

path = gameDir;
}

uint64_t bytes = getFreeSpace(path);
uint32_t gb = bytes / (1024ULL * 1024ULL * 1024ULL);

ALERT(at_console, "Free space at %s is %.2f GB\n", path.c_str(), (float)gb);
}

void test_command() {

}

void cfg_exec_finished() {
Expand All @@ -273,8 +290,9 @@ void GameDLLInit( void )
g_engfuncs.pfnAddServerCommand("reloadplugin", reload_plugin);
g_engfuncs.pfnAddServerCommand("updateplugin", update_plugin);
g_engfuncs.pfnAddServerCommand("updateplugins", update_plugins);
g_engfuncs.pfnAddServerCommand("freespace", freespace_command);

// Register cvars here:

g_psv_gravity = CVAR_GET_POINTER( "sv_gravity" );
g_psv_aim = CVAR_GET_POINTER( "sv_aim" );
g_psv_allow_autoaim = CVAR_GET_POINTER("sv_allow_autoaim");
Expand Down

0 comments on commit 3e36cdd

Please sign in to comment.