Remove RootDirectoryPath and save registry at startup

This commit is contained in:
Sajid 2025-01-28 17:22:14 +06:00
parent b4ed5fc9bf
commit d15a6655eb
5 changed files with 3 additions and 12 deletions

View file

@ -35,6 +35,7 @@ PPC_FUNC(sub_824EB490)
App::s_isInit = true;
App::s_isMissingDLC = !Installer::checkAllDLC(GetGamePath());
App::s_language = Config::Language;
Registry::Save();
__imp__sub_824EB490(ctx, base);
}

View file

@ -152,14 +152,6 @@ int main(int argc, char *argv[])
os::logger::Init();
Registry::Load();
if (!Registry::RootDirectoryPath.empty())
{
if (!os::process::SetWorkingDirectory(std::filesystem::path(Registry::RootDirectoryPath)))
LOGFN_ERROR("Failed to set working directory from registry");
}
bool forceInstaller = false;
bool forceDLCInstaller = false;
const char *sdlVideoDriver = nullptr;

View file

@ -22,7 +22,7 @@ inline std::filesystem::path GetSavePath(bool checkForMods)
if (checkForMods && !ModLoader::s_saveFilePath.empty())
return ModLoader::s_saveFilePath.parent_path();
else
return BuildUserPath() / "save";
return GetUserPath() / "save";
}
// Returned file name may not necessarily be

View file

@ -5,7 +5,7 @@
void Registry::Load()
{
os::registry::ReadValue(STR(RootDirectoryPath), RootDirectoryPath);
}
void Registry::Save()

View file

@ -3,8 +3,6 @@
class Registry
{
public:
inline static std::filesystem::path RootDirectoryPath;
static void Load();
static void Save();
};