diff --git a/Common/System/System.h b/Common/System/System.h index 9652c0d32a..1032411069 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -182,6 +182,8 @@ enum SystemProperty { SYSPROP_KEYBOARD_LAYOUT, SYSPROP_SKIP_UI, + + SYSPROP_USER_DOCUMENTS_DIR, }; enum class SystemNotification { diff --git a/Core/Config.cpp b/Core/Config.cpp index 2bffb81763..8494abb539 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -149,6 +149,7 @@ static bool DefaultCodeGen() { static bool DefaultVSync() { #if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(UWP) + ERROR_LOG(SYSTEM, "Default vsync true"); // Previously we didn't allow turning off vsync/FIFO on Android. Let's set the default accordingly. return true; #else @@ -1225,7 +1226,7 @@ bool Config::Save(const char *saveReason) { CleanRecent(); IniFile iniFile; if (!iniFile.Load(iniFilename_)) { - ERROR_LOG(LOADER, "Error saving config - can't read ini '%s'", iniFilename_.c_str()); + WARN_LOG(LOADER, "Likely saving config for first time - couldn't read ini '%s'", iniFilename_.c_str()); } // Need to do this somewhere... diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 86bd191316..3bc1bb9692 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -465,6 +465,11 @@ std::string System_GetProperty(SystemProperty prop) { } case SYSPROP_BUILD_VERSION: return PPSSPP_GIT_VERSION; + case SYSPROP_USER_DOCUMENTS_DIR: + { + const char *home = getenv("HOME"); + return home ? std::string(home) : "/"; + } default: return ""; } diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index db5e44fb03..29a1c392c1 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -431,10 +431,10 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch #endif g_VFS.Register("", new DirectoryReader(Path(savegame_dir))); -#if !PPSSPP_PLATFORM(WINDOWS) - g_Config.defaultCurrentDirectory = Path("/"); +#if PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(MAC) + g_Config.defaultCurrentDirectory = Path(System_GetProperty(SYSPROP_USER_DOCUMENTS_DIR)); #else - g_Config.defaultCurrentDirectory = GetSysDirectory(DIRECTORY_GAME); + g_Config.defaultCurrentDirectory = Path("/"); #endif #if !PPSSPP_PLATFORM(UWP) @@ -482,7 +482,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch // Attempt to create directories after reading the path. if (!System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) { - CreateDirectoriesAndroid(); + CreateSysDirectories(); } #elif PPSSPP_PLATFORM(UWP) && !defined(__LIBRETRO__) Path memstickDirFile = g_Config.internalDataDirectory / "memstick_dir.txt"; @@ -510,7 +510,6 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch g_Config.memStickDirectory = DarwinFileSystemServices::appropriateMemoryStickDirectoryToUse(); g_Config.flash0Directory = Path(std::string(external_dir)) / "flash0"; #elif PPSSPP_PLATFORM(MAC) - g_Config.defaultCurrentDirectory = Path(getenv("HOME")); g_Config.memStickDirectory = DarwinFileSystemServices::appropriateMemoryStickDirectoryToUse(); g_Config.flash0Directory = Path(std::string(external_dir)) / "flash0"; #elif PPSSPP_PLATFORM(SWITCH) @@ -805,6 +804,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch std::string sysName = System_GetProperty(SYSPROP_NAME); isOuya = KeyMap::IsOuya(sysName); + ERROR_LOG(G3D, "Backend: %d", g_Config.iGPUBackend); + // We do this here, instead of in NativeInitGraphics, because the display may be reset. // When it's reset we don't want to forget all our managed things. CheckFailedGPUBackends(); @@ -1213,15 +1214,12 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) { Core_SetPowerSaving(value != "false"); } else if (msg == "permission_granted" && value == "storage") { -#if PPSSPP_PLATFORM(ANDROID) - CreateDirectoriesAndroid(); -#endif + CreateSysDirectories(); // We must have failed to load the config before, so load it now to avoid overwriting the old config // with a freshly generated one. // NOTE: If graphics backend isn't what's in the config (due to error fallback, or not matching the default // and then getting permission), it will get out of sync. So we save and restore g_Config.iGPUBackend. - // Ideally we should simply reinitialize graphics to the mode from the config, but there are potential issues - // and I can't risk it before 1.9.0. + // Ideally we should simply reinitialize graphics to the mode from the config, but there are potential issues. int gpuBackend = g_Config.iGPUBackend; INFO_LOG(IO, "Reloading config after storage permission grant."); g_Config.Reload(); diff --git a/Windows/main.cpp b/Windows/main.cpp index 930fa40e6b..45007fa1f9 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -243,6 +243,8 @@ std::string System_GetProperty(SystemProperty prop) { return gpuDriverVersion; case SYSPROP_BUILD_VERSION: return PPSSPP_GIT_VERSION; + case SYSPROP_USER_DOCUMENTS_DIR: + return Path(W32Util::UserDocumentsPath()).ToString(); // this'll reverse the slashes. default: return ""; }