Skip to content

Commit

Permalink
Move WriteDataToFile and OpenPath to FileSystem namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla committed Oct 12, 2023
1 parent 5e49642 commit 2500b69
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

u32 g_LastFileSize;

u8 *OpenPath(char *filepath, int isExternalResource)
u8 *FileSystem::OpenPath(char *filepath, int isExternalResource)
{
// char *slashPos;
u8 *buf;
Expand Down Expand Up @@ -87,7 +87,7 @@ u8 *OpenPath(char *filepath, int isExternalResource)
return buf;
}

int WriteDataToFile(char *path, void *data, size_t size)
int FileSystem::WriteDataToFile(char *path, void *data, size_t size)
{
FILE *f;

Expand Down
3 changes: 3 additions & 0 deletions src/FileSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

#include "inttypes.hpp"

namespace FileSystem
{
u8 *OpenPath(char *filepath, int isExternalResource);
int WriteDataToFile(char *path, void *data, size_t size);
} // namespace FileSystem

extern u32 g_LastFileSize;
4 changes: 2 additions & 2 deletions src/GameContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ i32 GameContext::Parse(char *path)

memset(&g_GameContext.cfg, 0, sizeof(GameConfiguration));
g_GameContext.cfg.opts = g_GameContext.cfg.opts | USE_D3D_HW_TEXTURE_BLENDING;
data = OpenPath(path, 1);
data = FileSystem::OpenPath(path, 1);
if (data == NULL)
{
g_GameContext.cfg.lifeCount = 2;
Expand Down Expand Up @@ -145,7 +145,7 @@ i32 GameContext::Parse(char *path)
{
GameErrorContextLog(&g_GameErrorContext, TH_ERR_DO_NOT_USE_DIRECTINPUT);
}
if (WriteDataToFile(path, &g_GameContext.cfg, sizeof(GameConfiguration)) == 0)
if (FileSystem::WriteDataToFile(path, &g_GameContext.cfg, sizeof(GameConfiguration)) == 0)
{
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
}
else
{
WriteDataToFile(TH_CONFIG_FILE, &g_GameContext.cfg, sizeof(g_GameContext.cfg));
FileSystem::WriteDataToFile(TH_CONFIG_FILE, &g_GameContext.cfg, sizeof(g_GameContext.cfg));
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, g_ScreenSaveActive, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETLOWPOWERACTIVE, g_LowPowerActive, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETPOWEROFFACTIVE, g_PowerOffActive, NULL, SPIF_SENDCHANGE);
Expand Down

0 comments on commit 2500b69

Please sign in to comment.