mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-25 00:04:49 +02:00
Path code cleanup, move some UI code (#21037)
* Move a bunch of path logic into Core/Util/PathUtil.cpp/h . * Move GameImageView out from SaveDataScreen * More cleanup, add a translation string
This commit is contained in:
@@ -774,105 +774,6 @@ void PSP_RunLoopFor(int cycles) {
|
||||
Core_RunLoopUntil(CoreTiming::GetTicks() + cycles);
|
||||
}
|
||||
|
||||
Path GetSysDirectory(PSPDirectories directoryType) {
|
||||
const Path &memStickDirectory = g_Config.memStickDirectory;
|
||||
Path pspDirectory;
|
||||
if (!strcasecmp(memStickDirectory.GetFilename().c_str(), "PSP")) {
|
||||
// Let's strip this off, to easily allow choosing a root directory named "PSP" on Android.
|
||||
pspDirectory = memStickDirectory;
|
||||
} else {
|
||||
pspDirectory = memStickDirectory / "PSP";
|
||||
}
|
||||
|
||||
switch (directoryType) {
|
||||
case DIRECTORY_PSP:
|
||||
return pspDirectory;
|
||||
case DIRECTORY_CHEATS:
|
||||
return pspDirectory / "Cheats";
|
||||
case DIRECTORY_GAME:
|
||||
return pspDirectory / "GAME";
|
||||
case DIRECTORY_SAVEDATA:
|
||||
return pspDirectory / "SAVEDATA";
|
||||
case DIRECTORY_SCREENSHOT:
|
||||
return pspDirectory / "SCREENSHOT";
|
||||
case DIRECTORY_SYSTEM:
|
||||
return pspDirectory / "SYSTEM";
|
||||
case DIRECTORY_PAUTH:
|
||||
return memStickDirectory / "PAUTH"; // This one's at the root...
|
||||
case DIRECTORY_EXDATA:
|
||||
return memStickDirectory / "EXDATA"; // This one's traditionally at the root...
|
||||
case DIRECTORY_DUMP:
|
||||
return pspDirectory / "SYSTEM/DUMP";
|
||||
case DIRECTORY_SAVESTATE:
|
||||
return pspDirectory / "PPSSPP_STATE";
|
||||
case DIRECTORY_CACHE:
|
||||
return pspDirectory / "SYSTEM/CACHE";
|
||||
case DIRECTORY_TEXTURES:
|
||||
return pspDirectory / "TEXTURES";
|
||||
case DIRECTORY_PLUGINS:
|
||||
return pspDirectory / "PLUGINS";
|
||||
case DIRECTORY_APP_CACHE:
|
||||
if (!g_Config.appCacheDirectory.empty()) {
|
||||
return g_Config.appCacheDirectory;
|
||||
}
|
||||
return pspDirectory / "SYSTEM/CACHE";
|
||||
case DIRECTORY_VIDEO:
|
||||
return pspDirectory / "VIDEO";
|
||||
case DIRECTORY_AUDIO:
|
||||
return pspDirectory / "AUDIO";
|
||||
case DIRECTORY_CUSTOM_SHADERS:
|
||||
return pspDirectory / "shaders";
|
||||
case DIRECTORY_CUSTOM_THEMES:
|
||||
return pspDirectory / "themes";
|
||||
|
||||
case DIRECTORY_MEMSTICK_ROOT:
|
||||
return g_Config.memStickDirectory;
|
||||
// Just return the memory stick root if we run into some sort of problem.
|
||||
default:
|
||||
ERROR_LOG(Log::FileSystem, "Unknown directory type.");
|
||||
return g_Config.memStickDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
bool CreateSysDirectories() {
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
const bool createNoMedia = true;
|
||||
#else
|
||||
const bool createNoMedia = false;
|
||||
#endif
|
||||
|
||||
Path pspDir = GetSysDirectory(DIRECTORY_PSP);
|
||||
INFO_LOG(Log::IO, "Creating '%s' and subdirs:", pspDir.c_str());
|
||||
File::CreateFullPath(pspDir);
|
||||
if (!File::Exists(pspDir)) {
|
||||
INFO_LOG(Log::IO, "Not a workable memstick directory. Giving up");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the default directories that a real PSP creates. Good for homebrew so they can
|
||||
// expect a standard environment. Skipping THEME though, that's pointless.
|
||||
static const PSPDirectories sysDirs[] = {
|
||||
DIRECTORY_CHEATS,
|
||||
DIRECTORY_SAVEDATA,
|
||||
DIRECTORY_SAVESTATE,
|
||||
DIRECTORY_GAME,
|
||||
DIRECTORY_SYSTEM,
|
||||
DIRECTORY_TEXTURES,
|
||||
DIRECTORY_PLUGINS,
|
||||
DIRECTORY_CACHE,
|
||||
};
|
||||
|
||||
for (auto dir : sysDirs) {
|
||||
Path path = GetSysDirectory(dir);
|
||||
File::CreateFullPath(path);
|
||||
if (createNoMedia) {
|
||||
// Create a nomedia file in each specified subdirectory.
|
||||
File::CreateEmptyFile(path / ".nomedia");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *DumpFileTypeToString(DumpFileType type) {
|
||||
switch (type) {
|
||||
case DumpFileType::EBOOT: return "EBOOT";
|
||||
|
||||
Reference in New Issue
Block a user