diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b7765f..da6fcb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ include("${VITASDK}/share/vita.cmake" REQUIRED) set(VITA_APP_NAME "Launcher") set(VITA_TITLEID "SMLA00001") -set(VITA_VERSION "03.30") +set(VITA_VERSION "03.40") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") diff --git a/src/config.h b/src/config.h index 35df7a3..5e24cac 100644 --- a/src/config.h +++ b/src/config.h @@ -18,7 +18,7 @@ #define PSP_EBOOT_PATH "ux0:pspemu/PSP/GAME" #define CONFIG_PSPEMU_PATH "pspemu_location" #define DEFAULT_PSPEMU_PATH "ux0:pspemu" -#define PSP_ISO_CACHE_PATH "ux0:pspemu/ISO/_cache" +#define PSP_ISO_CACHE_PATH "ux0:pspemu/ISO" #define PSP_EBOOT_CACHE_PATH "ux0:pspemu/PSP/GAME/_cache" #define CONFIG_VIEW_MODE "view_mode" diff --git a/src/fs.cpp b/src/fs.cpp index 4ef338f..fc07f3e 100644 --- a/src/fs.cpp +++ b/src/fs.cpp @@ -35,6 +35,11 @@ namespace FS { int err = sceIoRemove(file.c_str()); } + void RmDir(const std::string& path) + { + sceIoRmdir(path.c_str()); + } + int64_t GetSize(const std::string& path) { SceIoStat stat; diff --git a/src/game.cpp b/src/game.cpp index 1f50fdf..83e4978 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -276,7 +276,7 @@ namespace GAME { { game_index++; int index = files[j].find_last_of("."); - if (index != std::string::npos && IsRomExtension(files[j].substr(index), psp_iso_extensions) && files[j].find_first_of("_cache/") != 0) + if (index != std::string::npos && IsRomExtension(files[j].substr(index), psp_iso_extensions) && files[j].find_first_of("cache_") != 0) { Game game; try @@ -648,7 +648,8 @@ namespace GAME { { if (game->type == TYPE_PSP_ISO) { - sprintf(rom_path_temp, "%s%s", PSP_ISO_CACHE_PATH, rom_path.substr(rom_path.find_last_of("/")).c_str()); + rom_path = std::string(PSP_ISO_CACHE_PATH) + "/cache_" + rom_path.substr(rom_path.find_last_of("/")+1); + sprintf(rom_path_temp, "%s", rom_path.c_str()); } else { @@ -1767,7 +1768,7 @@ namespace GAME { else if (game->type == TYPE_PSP_ISO) { std::string game_path = std::string(game->rom_path); - game->cache_state = FS::FileExists(std::string(PSP_ISO_CACHE_PATH) + game_path.substr(game_path.find_last_of("/"))); + game->cache_state = FS::FileExists(std::string(PSP_ISO_CACHE_PATH) + "/cache_" + game_path.substr(game_path.find_last_of("/")+1)); return game->cache_state; } else if (game->type == TYPE_EBOOT) @@ -1867,7 +1868,7 @@ namespace GAME { { FS::MkDirs(PSP_ISO_CACHE_PATH); } - std::string output_file = std::string(PSP_ISO_CACHE_PATH) + path.substr(path.find_last_of("/")); + std::string output_file = std::string(PSP_ISO_CACHE_PATH) + "/cache_" + path.substr(path.find_last_of("/")+1); path = path.substr(5); if (ftpclient->Size(path.c_str(), &bytes_to_download, FtpClient::image) > 0) { @@ -2006,4 +2007,28 @@ namespace GAME { bytes_transfered = xfered; return 1; } + + void MigratePSPCache() + { + std::string old_cache_path = std::string(PSP_ISO_PATH) + "/_cache"; + if (FS::FolderExists(old_cache_path)) + { + std::vector files = GetRomFiles(old_cache_path); + for (int i=0; i GetFilesFromCueFile(char *path); static int DownloadGameCallback(int64_t xfered, void* arg); static int LoadScePaf(); diff --git a/src/launcher.cpp b/src/launcher.cpp index 31d8bc0..6da28d7 100644 --- a/src/launcher.cpp +++ b/src/launcher.cpp @@ -2606,7 +2606,7 @@ namespace Windows { it!=new_files.end(); ) { int index = it->find_last_of("."); - if (index != std::string::npos && GAME::IsRomExtension(it->substr(index), psp_iso_extensions) && it->find_first_of("_cache/") != 0) + if (index != std::string::npos && GAME::IsRomExtension(it->substr(index), psp_iso_extensions) && it->find_first_of("cache_") != 0) { games_on_filesystem.push_back(rom_path_prefix + "/" + *it); } diff --git a/src/main.cpp b/src/main.cpp index ce9719d..14aa173 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -151,6 +151,7 @@ int main(int, char **) GAME::Init(); GAME::StartScanGamesThread(); GAME::StartGetCacheStateThread(); + GAME::MigratePSPCache(); GUI::RenderLoop();