From ab3d41432a4b9c46ce2ee8c38269b341ac07bab3 Mon Sep 17 00:00:00 2001 From: oleg238948234 <155594697+oleg238948234@users.noreply.github.com> Date: Tue, 30 Dec 2025 13:26:47 +0500 Subject: [PATCH] gitadora: (arena model) F: drive fix (#484) ## Link to GitHub Issue, if one exists N/A ## Description of change prevents the game from creating folders on F: drive ## Testing tested with M32-007-2025092400 --- src/spice2x/games/gitadora/gitadora.cpp | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/spice2x/games/gitadora/gitadora.cpp b/src/spice2x/games/gitadora/gitadora.cpp index 9cb982b..24f180f 100644 --- a/src/spice2x/games/gitadora/gitadora.cpp +++ b/src/spice2x/games/gitadora/gitadora.cpp @@ -18,6 +18,32 @@ namespace games::gitadora { bool TWOCHANNEL = false; std::optional CAB_TYPE = std::nullopt; + /* + * Prevent GitaDora from creating folders on F drive + */ + +#ifdef SPICE64 + static DWORD WINAPI GetLogicalDrives_hook() { + return GetLogicalDrives() | 0x20; + } + + static UINT WINAPI GetDriveTypeA_hook(LPCSTR lpRootPathName) { + if (!strcmp(lpRootPathName, "F:\\")) { + return DRIVE_FIXED; + } + + return GetDriveTypeA(lpRootPathName); + } + + static BOOL WINAPI CreateDirectoryA_hook(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes) { + if (!strncmp(lpPathName, "F:/", 3)) { + return TRUE; + } + + return CreateDirectoryA(lpPathName, lpSecurityAttributes); + } +#endif + /* * GitaDora checks if the IP address has changed, and if it has it throws 5-1506-0000 like jubeat. * We don't want this so we patch it out. @@ -238,6 +264,11 @@ namespace games::gitadora { // test/service/coin buttons bi2x_hook_init(); + // f: drive hook + detour::iat_try("GetLogicalDrives", GetLogicalDrives_hook, avs::game::DLL_INSTANCE); + detour::iat_try("GetDriveTypeA", GetDriveTypeA_hook, avs::game::DLL_INSTANCE); + detour::iat_try("CreateDirectoryA", CreateDirectoryA_hook, avs::game::DLL_INSTANCE); + // volume change prevention hooks::audio::mme::init(avs::game::DLL_INSTANCE); return;