mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-24 00:29:57 +00:00
Allow Win32 to store its saves, config files, etc., elsewhere.
If installed.txt exists(or the executable directory is read-only), use the user's My Documents(XP) or Documents(7/8/8.1) directory to search for everything. If it doesn't, or we can't determine the directory for some reason, use the old behaviour.
This commit is contained in:
parent
dbe50b0c9b
commit
b3018eb37f
@ -17,7 +17,7 @@ void trim2(std::string& str);
|
||||
|
||||
void __CheatInit() {
|
||||
gameTitle = g_paramSFO.GetValueString("DISC_ID");
|
||||
#if defined(ANDROID) || defined(__SYMBIAN32__)
|
||||
#if defined(ANDROID) || defined(__SYMBIAN32__) || defined(_WIN32)
|
||||
activeCheatFile = g_Config.memCardDirectory + "PSP/Cheats/" + gameTitle + ".ini";
|
||||
#else
|
||||
activeCheatFile = CHEATS_DIR + "/" + gameTitle + ".ini";
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Common/CommonWindows.h"
|
||||
#include <ShlObj.h>
|
||||
#endif
|
||||
|
||||
#include "native/thread/thread.h"
|
||||
@ -364,18 +365,37 @@ void GetSysDirectories(std::string &memstickpath, std::string &flash0path) {
|
||||
char drive[_MAX_DRIVE] ,dir[_MAX_DIR], file[_MAX_FNAME], ext[_MAX_EXT];
|
||||
char memstickpath_buf[_MAX_PATH];
|
||||
char flash0path_buf[_MAX_PATH];
|
||||
|
||||
GetModuleFileName(NULL, path_buffer, ARRAY_SIZE(path_buffer));
|
||||
|
||||
std::string path = ConvertWStringToUTF8(path_buffer);
|
||||
|
||||
_splitpath_s(path.c_str(), drive, dir, file, ext );
|
||||
|
||||
// Mount a couple of filesystems
|
||||
sprintf(memstickpath_buf, "%s%smemstick\\", drive, dir);
|
||||
sprintf(flash0path_buf, "%s%sflash0\\", drive, dir);
|
||||
std::string previousCurrentDir = g_Config.currentDirectory;
|
||||
|
||||
memstickpath = memstickpath_buf;
|
||||
g_Config.currentDirectory = File::GetExeDirectory();
|
||||
|
||||
// Detect the "My Documents"(XP) or "Documents"(on Vista/7/8) folder.
|
||||
wchar_t myDocumentsPath[MAX_PATH];
|
||||
HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, myDocumentsPath);
|
||||
|
||||
bool installed = File::Exists(g_Config.currentDirectory + "/installed.txt");
|
||||
std::string testFile = g_Config.currentDirectory + "/_writable_test.$$$";
|
||||
|
||||
// If installed.txt exists(and we can determine the Documents directory) or directory is read-only
|
||||
if ((installed && result == S_OK) || !File::CreateEmptyFile(testFile)) {
|
||||
memstickpath = ConvertWStringToUTF8(myDocumentsPath) + "/PPSSPP/";
|
||||
} else {
|
||||
sprintf(memstickpath_buf, "%s%smemstick\\", drive, dir);
|
||||
memstickpath = memstickpath_buf;
|
||||
}
|
||||
|
||||
File::Delete(testFile);
|
||||
|
||||
g_Config.currentDirectory = previousCurrentDir;
|
||||
|
||||
// Mount a filesystem
|
||||
sprintf(flash0path_buf, "%s%sflash0\\", drive, dir);
|
||||
flash0path = flash0path_buf;
|
||||
#else
|
||||
// TODO
|
||||
|
@ -153,7 +153,7 @@ UI::EventReturn CwCheatScreen::OnImportCheat(UI::EventParams ¶ms)
|
||||
std::vector<std::string> title;
|
||||
bool finished = false, skip = false;
|
||||
std::vector<std::string> newList;
|
||||
#if defined(ANDROID) || defined(__SYMBIAN32__) || defined(BLACKBERRY)
|
||||
#if defined(ANDROID) || defined(__SYMBIAN32__) || defined(BLACKBERRY) || defined(_WIN32)
|
||||
std::string cheatDir = g_Config.memCardDirectory + "PSP/Cheats/cheat.db";
|
||||
is.open(cheatDir.c_str());
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user