mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 02:29:51 +01:00
Merge branch 'master' into TemporaryHackishBranch
# Conflicts: # Core/SaveState.cpp # UI/ControlMappingScreen.cpp # UI/CwCheatScreen.cpp # UI/GameSettingsScreen.cpp # UI/PauseScreen.cpp # android/assets/ppge_atlas.zim # android/assets/ppge_atlas_luna.meta # android/assets/ui_atlas.zim # android/assets/ui_atlas_luna.meta # android/res/drawable-hdpi/ic_launcher.png # android/res/drawable-ldpi/ic_launcher.png # android/res/drawable-mdpi/ic_launcher.png # android/res/drawable-xhdpi/ic_launcher.png # android/res/drawable-xhdpi/tv_banner.png # android/res/drawable-xxhdpi/ic_launcher.png # android/res/drawable/ic_banner.png # assets/ppge_atlas.zim # assets/ppge_atlas_luna.meta # assets/ui_atlas.zim # assets/ui_atlas_luna.meta
This commit is contained in:
commit
0ee43104e4
598 files changed
+50337
-26888
No files matched your search
+65
-69
@@ -144,7 +144,6 @@ std::string config_filename;
|
||||
|
||||
// Really need to clean this mess of globals up... but instead I add more :P
|
||||
bool g_TakeScreenshot;
|
||||
bool g_ShaderNameListChanged = false;
|
||||
static bool isOuya;
|
||||
static bool resized = false;
|
||||
static bool restarting = false;
|
||||
@@ -208,7 +207,7 @@ int Win32Mix(short *buffer, int numSamples, int bits, int rate, int channels) {
|
||||
|
||||
// globals
|
||||
static LogListener *logger = nullptr;
|
||||
std::string boot_filename = "";
|
||||
Path boot_filename;
|
||||
|
||||
void NativeHost::InitSound() {
|
||||
#if PPSSPP_PLATFORM(IOS)
|
||||
@@ -322,9 +321,9 @@ static void PostLoadConfig() {
|
||||
#ifndef _WIN32
|
||||
if (g_Config.currentDirectory.empty()) {
|
||||
#if defined(__ANDROID__)
|
||||
g_Config.currentDirectory = g_Config.externalDirectory;
|
||||
g_Config.currentDirectory = g_Config.externalDirectory.ToString();
|
||||
#elif PPSSPP_PLATFORM(IOS)
|
||||
g_Config.currentDirectory = g_Config.internalDataDirectory;
|
||||
g_Config.currentDirectory = g_Config.internalDataDirectory.ToString();
|
||||
#elif PPSSPP_PLATFORM(SWITCH)
|
||||
g_Config.currentDirectory = "/";
|
||||
#else
|
||||
@@ -338,7 +337,7 @@ static void PostLoadConfig() {
|
||||
|
||||
// Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to
|
||||
// test new languages without recompiling the entire app, which is a hassle).
|
||||
const std::string langOverridePath = GetSysDirectory(DIRECTORY_SYSTEM) + "lang/";
|
||||
const Path langOverridePath = GetSysDirectory(DIRECTORY_SYSTEM) / "lang";
|
||||
|
||||
// If we run into the unlikely case that "lang" is actually a file, just use the built-in translations.
|
||||
if (!File::Exists(langOverridePath) || !File::IsDirectory(langOverridePath))
|
||||
@@ -350,8 +349,8 @@ static void PostLoadConfig() {
|
||||
void CreateDirectoriesAndroid() {
|
||||
// On Android, create a PSP directory tree in the external_dir,
|
||||
// to hopefully reduce confusion a bit.
|
||||
INFO_LOG(IO, "Creating %s", (g_Config.memStickDirectory + "PSP").c_str());
|
||||
File::CreateFullPath(g_Config.memStickDirectory + "PSP");
|
||||
INFO_LOG(IO, "Creating %s", (g_Config.memStickDirectory / "PSP").c_str());
|
||||
File::CreateFullPath(g_Config.memStickDirectory / "PSP");
|
||||
File::CreateFullPath(GetSysDirectory(DIRECTORY_SAVEDATA));
|
||||
File::CreateFullPath(GetSysDirectory(DIRECTORY_SAVESTATE));
|
||||
File::CreateFullPath(GetSysDirectory(DIRECTORY_GAME));
|
||||
@@ -361,11 +360,11 @@ void CreateDirectoriesAndroid() {
|
||||
|
||||
// Avoid media scanners in PPSSPP_STATE and SAVEDATA directories,
|
||||
// and in the root PSP directory as well.
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_SAVESTATE) + ".nomedia");
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_SAVEDATA) + ".nomedia");
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_SYSTEM) + ".nomedia");
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_TEXTURES) + ".nomedia");
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_PLUGINS) + ".nomedia");
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_SAVESTATE) / ".nomedia");
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_SAVEDATA) / ".nomedia");
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_SYSTEM) / ".nomedia");
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_TEXTURES) / ".nomedia");
|
||||
File::CreateEmptyFile(GetSysDirectory(DIRECTORY_PLUGINS) / ".nomedia");
|
||||
}
|
||||
|
||||
static void CheckFailedGPUBackends() {
|
||||
@@ -383,11 +382,11 @@ static void CheckFailedGPUBackends() {
|
||||
}
|
||||
lastBackend = g_Config.iGPUBackend;
|
||||
|
||||
std::string cache = GetSysDirectory(DIRECTORY_APP_CACHE) + "/FailedGraphicsBackends.txt";
|
||||
Path cache = GetSysDirectory(DIRECTORY_APP_CACHE) / "FailedGraphicsBackends.txt";
|
||||
|
||||
if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) {
|
||||
std::string data;
|
||||
if (readFileToString(true, cache.c_str(), data))
|
||||
if (File::ReadFileToString(true, cache, data))
|
||||
g_Config.sFailedGPUBackends = data;
|
||||
}
|
||||
|
||||
@@ -415,7 +414,7 @@ static void CheckFailedGPUBackends() {
|
||||
// Let's try to create, in case it doesn't exist.
|
||||
if (!File::Exists(GetSysDirectory(DIRECTORY_APP_CACHE)))
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_APP_CACHE));
|
||||
writeStringToFile(true, g_Config.sFailedGPUBackends, cache.c_str());
|
||||
File::WriteStringToFile(true, g_Config.sFailedGPUBackends, cache);
|
||||
} else {
|
||||
// Just save immediately, since we have storage.
|
||||
g_Config.Save("got storage permission");
|
||||
@@ -430,7 +429,7 @@ static void ClearFailedGPUBackends() {
|
||||
// In case they update drivers and have totally different problems much later, clear the failed list.
|
||||
g_Config.sFailedGPUBackends.clear();
|
||||
if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) {
|
||||
File::Delete(GetSysDirectory(DIRECTORY_APP_CACHE) + "/FailedGraphicsBackends.txt");
|
||||
File::Delete(GetSysDirectory(DIRECTORY_APP_CACHE) / "FailedGraphicsBackends.txt");
|
||||
} else {
|
||||
g_Config.Save("clearFailedGPUBackends");
|
||||
}
|
||||
@@ -461,26 +460,26 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
// We want this to be FIRST.
|
||||
#if PPSSPP_PLATFORM(IOS)
|
||||
// Packed assets are included in app
|
||||
VFSRegister("", new DirectoryAssetReader(external_dir));
|
||||
VFSRegister("", new DirectoryAssetReader(Path(external_dir)));
|
||||
#endif
|
||||
#if defined(ASSETS_DIR)
|
||||
VFSRegister("", new DirectoryAssetReader(ASSETS_DIR));
|
||||
VFSRegister("", new DirectoryAssetReader(Path(ASSETS_DIR)));
|
||||
#endif
|
||||
#if !defined(MOBILE_DEVICE) && !defined(_WIN32) && !PPSSPP_PLATFORM(SWITCH)
|
||||
VFSRegister("", new DirectoryAssetReader((File::GetExeDirectory() + "assets/").c_str()));
|
||||
VFSRegister("", new DirectoryAssetReader((File::GetExeDirectory()).c_str()));
|
||||
VFSRegister("", new DirectoryAssetReader("/usr/local/share/ppsspp/assets/"));
|
||||
VFSRegister("", new DirectoryAssetReader("/usr/local/share/games/ppsspp/assets/"));
|
||||
VFSRegister("", new DirectoryAssetReader("/usr/share/ppsspp/assets/"));
|
||||
VFSRegister("", new DirectoryAssetReader("/usr/share/games/ppsspp/assets/"));
|
||||
VFSRegister("", new DirectoryAssetReader(File::GetExeDirectory() / "assets"));
|
||||
VFSRegister("", new DirectoryAssetReader(File::GetExeDirectory()));
|
||||
VFSRegister("", new DirectoryAssetReader(Path("/usr/local/share/ppsspp/assets")));
|
||||
VFSRegister("", new DirectoryAssetReader(Path("/usr/local/share/games/ppsspp/assets")));
|
||||
VFSRegister("", new DirectoryAssetReader(Path("/usr/share/ppsspp/assets")));
|
||||
VFSRegister("", new DirectoryAssetReader(Path("/usr/share/games/ppsspp/assets")));
|
||||
#endif
|
||||
#if PPSSPP_PLATFORM(SWITCH)
|
||||
std::string assetPath = user_data_path + "assets/";
|
||||
VFSRegister("", new DirectoryAssetReader(assetPath.c_str()));
|
||||
Path assetPath = Path(user_data_path) / "assets";
|
||||
VFSRegister("", new DirectoryAssetReader(assetPath));
|
||||
#else
|
||||
VFSRegister("", new DirectoryAssetReader("assets/"));
|
||||
VFSRegister("", new DirectoryAssetReader(Path("assets")));
|
||||
#endif
|
||||
VFSRegister("", new DirectoryAssetReader(savegame_dir));
|
||||
VFSRegister("", new DirectoryAssetReader(Path(savegame_dir)));
|
||||
|
||||
#if (defined(MOBILE_DEVICE) || !defined(USING_QT_UI)) && !PPSSPP_PLATFORM(UWP)
|
||||
if (host == nullptr) {
|
||||
@@ -488,8 +487,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
}
|
||||
#endif
|
||||
|
||||
g_Config.internalDataDirectory = savegame_dir;
|
||||
g_Config.externalDirectory = external_dir;
|
||||
g_Config.internalDataDirectory = Path(savegame_dir);
|
||||
g_Config.externalDirectory = Path(external_dir);
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
// TODO: This needs to change in Android 12.
|
||||
@@ -497,24 +496,27 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
// Maybe there should be an option to use internal memory instead, but I think
|
||||
// that for most people, using external memory (SDCard/USB Storage) makes the
|
||||
// most sense.
|
||||
g_Config.memStickDirectory = std::string(external_dir) + "/";
|
||||
g_Config.flash0Directory = std::string(external_dir) + "/flash0/";
|
||||
g_Config.memStickDirectory = Path(external_dir);
|
||||
g_Config.flash0Directory = Path(external_dir) / "flash0";
|
||||
|
||||
std::string memstickDirFile = g_Config.internalDataDirectory + "/memstick_dir.txt";
|
||||
Path memstickDirFile = g_Config.internalDataDirectory / "memstick_dir.txt";
|
||||
if (File::Exists(memstickDirFile)) {
|
||||
std::string memstickDir;
|
||||
readFileToString(true, memstickDirFile.c_str(), memstickDir);
|
||||
if (!memstickDir.empty() && File::Exists(memstickDir)) {
|
||||
g_Config.memStickDirectory = memstickDir + "/";
|
||||
File::ReadFileToString(true, memstickDirFile, memstickDir);
|
||||
Path memstickPath(memstickDir);
|
||||
if (!memstickPath.empty() && File::Exists(memstickPath)) {
|
||||
g_Config.memStickDirectory = memstickPath;
|
||||
} else {
|
||||
ERROR_LOG(SYSTEM, "Couldn't read directory '%s' specified by memstick_dir.txt.", memstickDir.c_str());
|
||||
}
|
||||
}
|
||||
#elif PPSSPP_PLATFORM(IOS)
|
||||
g_Config.memStickDirectory = user_data_path;
|
||||
g_Config.flash0Directory = std::string(external_dir) + "/flash0/";
|
||||
g_Config.memStickDirectory = Path(user_data_path);
|
||||
g_Config.flash0Directory = Path(std::string(external_dir)) / "flash0";
|
||||
#elif PPSSPP_PLATFORM(SWITCH)
|
||||
g_Config.memStickDirectory = g_Config.internalDataDirectory + "config/ppsspp/";
|
||||
g_Config.flash0Directory = g_Config.internalDataDirectory + "assets/flash0/";
|
||||
#elif !defined(_WIN32)
|
||||
g_Config.memStickDirectory = g_Config.internalDataDirectory / "config/ppsspp";
|
||||
g_Config.flash0Directory = g_Config.internalDataDirectory / "assets/flash0";
|
||||
#elif !PPSSPP_PLATFORM(WINDOWS)
|
||||
std::string config;
|
||||
if (getenv("XDG_CONFIG_HOME") != NULL)
|
||||
config = getenv("XDG_CONFIG_HOME");
|
||||
@@ -523,20 +525,20 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
else // Just in case
|
||||
config = "./config";
|
||||
|
||||
g_Config.memStickDirectory = config + "/ppsspp/";
|
||||
g_Config.flash0Directory = File::GetExeDirectory() + "/assets/flash0/";
|
||||
g_Config.memStickDirectory = Path(config) / "ppsspp";
|
||||
g_Config.flash0Directory = File::GetExeDirectory() / "assets/flash0";
|
||||
#endif
|
||||
|
||||
if (cache_dir && strlen(cache_dir)) {
|
||||
DiskCachingFileLoaderCache::SetCacheDir(cache_dir);
|
||||
g_Config.appCacheDirectory = cache_dir;
|
||||
g_Config.appCacheDirectory = Path(cache_dir);
|
||||
DiskCachingFileLoaderCache::SetCacheDir(g_Config.appCacheDirectory);
|
||||
}
|
||||
|
||||
if (!LogManager::GetInstance())
|
||||
LogManager::Init(&g_Config.bEnableLogging);
|
||||
|
||||
#ifndef _WIN32
|
||||
g_Config.AddSearchPath(user_data_path);
|
||||
#if !PPSSPP_PLATFORM(WINDOWS)
|
||||
g_Config.AddSearchPath(Path(user_data_path));
|
||||
g_Config.AddSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
g_Config.SetDefaultPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
|
||||
@@ -546,18 +548,18 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
#endif
|
||||
LogManager *logman = LogManager::GetInstance();
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
// On early versions of Android we don't need to ask permission.
|
||||
CreateDirectoriesAndroid();
|
||||
#endif
|
||||
|
||||
const char *fileToLog = 0;
|
||||
const char *stateToLoad = 0;
|
||||
Path stateToLoad;
|
||||
|
||||
bool gotBootFilename = false;
|
||||
bool gotoGameSettings = false;
|
||||
bool gotoTouchScreenTest = false;
|
||||
boot_filename = "";
|
||||
boot_filename.clear();
|
||||
|
||||
// Parse command line
|
||||
LogTypes::LOG_LEVELS logLevel = LogTypes::LINFO;
|
||||
@@ -598,7 +600,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
if (!strncmp(argv[i], "--log=", strlen("--log=")) && strlen(argv[i]) > strlen("--log="))
|
||||
fileToLog = argv[i] + strlen("--log=");
|
||||
if (!strncmp(argv[i], "--state=", strlen("--state=")) && strlen(argv[i]) > strlen("--state="))
|
||||
stateToLoad = argv[i] + strlen("--state=");
|
||||
stateToLoad = Path(std::string(argv[i] + strlen("--state=")));
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
if (!strncmp(argv[i], "--escape-exit", strlen("--escape-exit")))
|
||||
g_Config.bPauseExitsEmulator = true;
|
||||
@@ -642,10 +644,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
}
|
||||
}
|
||||
if (okToLoad) {
|
||||
boot_filename = argv[i];
|
||||
#ifdef _WIN32
|
||||
boot_filename = ReplaceAll(boot_filename, "\\", "/");
|
||||
#endif
|
||||
boot_filename = Path(std::string(argv[i]));
|
||||
skipLogo = true;
|
||||
}
|
||||
if (okToLoad && okToCheck) {
|
||||
@@ -741,7 +740,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
// TODO: Load these in the background instead of synchronously.
|
||||
g_BackgroundAudio.LoadSamples();
|
||||
|
||||
if (!boot_filename.empty() && stateToLoad != NULL) {
|
||||
if (!boot_filename.empty() && stateToLoad.Valid()) {
|
||||
SaveState::Load(stateToLoad, -1, [](SaveState::Status status, const std::string &message, void *) {
|
||||
if (!message.empty() && (!g_Config.bDumpFrames || !g_Config.bDumpVideoOutput)) {
|
||||
osm.Show(message, status == SaveState::Status::SUCCESS ? 2.0 : 5.0);
|
||||
@@ -1005,10 +1004,7 @@ void NativeShutdownGraphics() {
|
||||
void TakeScreenshot() {
|
||||
g_TakeScreenshot = false;
|
||||
|
||||
std::string path = GetSysDirectory(DIRECTORY_SCREENSHOT);
|
||||
while (path.length() > 0 && path.back() == '/') {
|
||||
path.resize(path.size() - 1);
|
||||
}
|
||||
Path path = GetSysDirectory(DIRECTORY_SCREENSHOT);
|
||||
if (!File::Exists(path)) {
|
||||
File::CreateDir(path);
|
||||
}
|
||||
@@ -1018,21 +1014,21 @@ void TakeScreenshot() {
|
||||
|
||||
std::string gameId = g_paramSFO.GetDiscID();
|
||||
|
||||
char filename[2048];
|
||||
Path filename;
|
||||
while (i < 10000){
|
||||
if (g_Config.bScreenshotsAsPNG)
|
||||
snprintf(filename, sizeof(filename), "%s/%s_%05d.png", path.c_str(), gameId.c_str(), i);
|
||||
filename = path / StringFromFormat("%s_%05d.png", path.c_str(), gameId.c_str(), i);
|
||||
else
|
||||
snprintf(filename, sizeof(filename), "%s/%s_%05d.jpg", path.c_str(), gameId.c_str(), i);
|
||||
FileInfo info;
|
||||
if (!getFileInfo(filename, &info))
|
||||
filename = path / StringFromFormat("%s_%05d.jpg", path.c_str(), gameId.c_str(), i);
|
||||
File::FileInfo info;
|
||||
if (!File::Exists(filename))
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
|
||||
bool success = TakeGameScreenshot(filename, g_Config.bScreenshotsAsPNG ? ScreenshotFormat::PNG : ScreenshotFormat::JPG, g_Config.bScreenshotsAtRenderRes ? SCREENSHOT_DISPLAY : SCREENSHOT_OUTPUT);
|
||||
if (success) {
|
||||
osm.Show(filename);
|
||||
osm.Show(filename.ToVisualString());
|
||||
} else {
|
||||
auto err = GetI18NCategory("Error");
|
||||
osm.Show(err->T("Could not save screenshot file"));
|
||||
@@ -1167,11 +1163,11 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
|
||||
}
|
||||
if (msg == "bgImage_updated") {
|
||||
if (!value.empty()) {
|
||||
std::string dest = GetSysDirectory(DIRECTORY_SYSTEM) + (endsWithNoCase(value, ".jpg") ? "background.jpg" : "background.png");
|
||||
File::Copy(value, dest);
|
||||
Path dest = GetSysDirectory(DIRECTORY_SYSTEM) / (endsWithNoCase(value, ".jpg") ? "background.jpg" : "background.png");
|
||||
File::Copy(Path(value), dest);
|
||||
}
|
||||
UIBackgroundShutdown();
|
||||
UIBackgroundInit(*uiContext);
|
||||
// It will init again automatically. We can't init outside a frame on Vulkan.
|
||||
}
|
||||
if (msg == "savestate_displayslot") {
|
||||
auto sy = GetI18NCategory("System");
|
||||
|
||||
Reference in new issue
Block a user