From cc4975a4f9d606936d88d1aa48fe5d757bcbd8f4 Mon Sep 17 00:00:00 2001 From: Primekick Date: Tue, 14 Jan 2025 12:28:55 +0100 Subject: [PATCH] Add encrypted 2k3MP to unsupported engines --- .../player/game_browser/ProjectType.java | 3 +- src/filefinder.cpp | 52 ++++---- src/filefinder.h | 121 +++++++++--------- 3 files changed, 92 insertions(+), 84 deletions(-) diff --git a/builds/android/app/src/main/java/org/easyrpg/player/game_browser/ProjectType.java b/builds/android/app/src/main/java/org/easyrpg/player/game_browser/ProjectType.java index f45f418768..28b73005f9 100644 --- a/builds/android/app/src/main/java/org/easyrpg/player/game_browser/ProjectType.java +++ b/builds/android/app/src/main/java/org/easyrpg/player/game_browser/ProjectType.java @@ -11,7 +11,8 @@ public enum ProjectType { , RPG_MAKER_VX("RPG Maker VX") , RPG_MAKER_VX_ACE("RPG Maker VX Ace") , RPG_MAKER_MV_MZ("RPG Maker MV/MZ") - , WOLF_RPG_EDITOR("Wolf RPG Editor"); + , WOLF_RPG_EDITOR("Wolf RPG Editor") + , ENCRYPTED_2K3_MANIACS("Encrypted 2k3 (Maniacs Patch)"); private final String label; diff --git a/src/filefinder.cpp b/src/filefinder.cpp index 1701fdca32..d8f65f499f 100644 --- a/src/filefinder.cpp +++ b/src/filefinder.cpp @@ -313,31 +313,35 @@ bool FileFinder::IsRPG2kProjectWithRenames(const FilesystemView& fs) { } FileFinder::ProjectType FileFinder::GetProjectType(const FilesystemView &fs) { - if (IsValidProject(fs)) { - return FileFinder::ProjectType::Supported; - } + if (IsValidProject(fs)) { + return FileFinder::ProjectType::Supported; + } - if (!fs.FindFile("RGSS10??.dll").empty()) { - return FileFinder::ProjectType::RpgMakerXp; - } + if (!fs.FindFile("RGSS10??.dll").empty()) { + return FileFinder::ProjectType::RpgMakerXp; + } - if (!fs.FindFile("RGSS20??.dll").empty()) { - return FileFinder::ProjectType::RpgMakerVx; - } + if (!fs.FindFile("RGSS20??.dll").empty()) { + return FileFinder::ProjectType::RpgMakerVx; + } + + if (!fs.FindFile("System", "RGSS30?.dll").empty()) { + return FileFinder::ProjectType::RpgMakerVxAce; + } - if (!fs.FindFile("System", "RGSS30?.dll").empty()) { - return FileFinder::ProjectType::RpgMakerVxAce; - } + if (!fs.FindFile("nw.dll").empty()) { + return FileFinder::ProjectType::RpgMakerMvMz; + } - if (!fs.FindFile("nw.dll").empty()) { - return FileFinder::ProjectType::RpgMakerMvMz; - } + if (!fs.FindFile("GuruGuruSMF4.dll").empty()) { + return FileFinder::ProjectType::WolfRpgEditor; + } - if (!fs.FindFile("GuruGuruSMF4.dll").empty()) { - return FileFinder::ProjectType::WolfRpgEditor; - } + if (!fs.FindFile("RPG_RT.rs1").empty()) { + return FileFinder::ProjectType::Encrypted2k3Maniacs; + } - return FileFinder::ProjectType::Unknown; + return FileFinder::ProjectType::Unknown; } bool FileFinder::OpenViewToEasyRpgFile(FilesystemView& fs) { @@ -569,11 +573,11 @@ std::vector FileFinder::FindGames(FilesystemView fs, int return; } - auto project_type = GetProjectType(subfs); - if (project_type != ProjectType::Unknown) { - games.push_back({ subfs, project_type }); - return; - } + auto project_type = GetProjectType(subfs); + if (project_type != ProjectType::Unknown) { + games.push_back({ subfs, project_type }); + return; + } auto entries = subfs.ListDirectory(); diff --git a/src/filefinder.h b/src/filefinder.h index 25c68c5dfc..204ba9b3c8 100644 --- a/src/filefinder.h +++ b/src/filefinder.h @@ -45,34 +45,35 @@ namespace FileFinder { constexpr const auto FONTS_TYPES = Utils::MakeSvArray(".fon", ".fnt", ".bdf", ".ttf", ".ttc", ".otf", ".woff2", ".woff"); constexpr const auto TEXT_TYPES = Utils::MakeSvArray(".txt", ".csv", ""); // "" = Complete Filename (incl. extension) provided by the user - /** - * Type of the project. Used to differentiate between supported games (2kX or EasyRPG) - * and known but unsupported (i.e. newer RPG Makers). - */ - enum ProjectType { - Unknown, - // 2kX or EasyRPG - Supported, - // Known unsupported engines - RpgMakerXp, - RpgMakerVx, - RpgMakerVxAce, - RpgMakerMvMz, - WolfRpgEditor, - }; - - /** - * Helper struct combining the project's directory and its type. - */ - struct GameEntry { - FilesystemView fs; - ProjectType type; - }; - - /** @return Human readable project type label */ - static const char* GetProjectTypeLabel(ProjectType pt); - - /** + /** + * Type of the project. Used to differentiate between supported games (2kX or EasyRPG) + * and known but unsupported (i.e. newer RPG Makers). + */ + enum ProjectType { + Unknown, + // 2kX or EasyRPG + Supported, + // Known unsupported engines + RpgMakerXp, + RpgMakerVx, + RpgMakerVxAce, + RpgMakerMvMz, + WolfRpgEditor, + Encrypted2k3Maniacs, + }; + + /** + * Helper struct combining the project's directory and its type. + */ + struct GameEntry { + FilesystemView fs; + ProjectType type; + }; + + /** @return Human readable project type label */ + static const char* GetProjectTypeLabel(ProjectType pt); + + /** * Quits FileFinder. */ void Quit(); @@ -314,11 +315,11 @@ namespace FileFinder { */ bool IsRPG2kProjectWithRenames(const FilesystemView& fs); - /** - * @param p fs Tree to check - * @return Project type whether the tree contains a supported project type, known but unsupported engines, or something unknown - */ - ProjectType GetProjectType(const FilesystemView& fs); + /** + * @param p fs Tree to check + * @return Project type whether the tree contains a supported project type, known but unsupported engines, or something unknown + */ + ProjectType GetProjectType(const FilesystemView& fs); /** * Determines if the directory contains a single file/directory ending in ".easyrpg" for use in the @@ -355,18 +356,18 @@ namespace FileFinder { bool IsMajorUpdatedTree(); /** RPG_RT.exe file size thresholds - * - * 2k v1.51 (Japanese) : 746496 - * 2k v1.50 (Japanese) : 745984 - * -- threshold (2k) -- : 735000 - * 2k v1.10 (Japanese) : 726016 - * - * 2k3 v1.09a (Japanese) : 950784 - * 2k3 v1.06 (Japanese) : 949248 - * 2k3 v1.05 (Japanese) : unknown - * -- threshold (2k3) -- : 927000 - * 2k3 v1.04 (Japanese) : 913408 - */ + * + * 2k v1.51 (Japanese) : 746496 + * 2k v1.50 (Japanese) : 745984 + * -- threshold (2k) -- : 735000 + * 2k v1.10 (Japanese) : 726016 + * + * 2k3 v1.09a (Japanese) : 950784 + * 2k3 v1.06 (Japanese) : 949248 + * 2k3 v1.05 (Japanese) : unknown + * -- threshold (2k3) -- : 927000 + * 2k3 v1.04 (Japanese) : 913408 + */ enum RpgrtMajorUpdateThreshold { RPG2K = 735000, RPG2K3 = 927000, @@ -408,22 +409,24 @@ std::string FileFinder::MakePath(lcf::Span components) { } static inline const char* FileFinder::GetProjectTypeLabel(ProjectType pt) { - switch (pt) { - case Supported: - return "Supported"; - case RpgMakerXp: - return "RPG Maker XP"; - case RpgMakerVx: - return "RPG Maker VX"; - case RpgMakerVxAce: - return "RPG Maker VX Ace"; - case RpgMakerMvMz: - return "RPG Maker MV/MZ"; - case WolfRpgEditor: - return "Wolf RPG Editor"; + switch (pt) { + case Supported: + return "Supported"; + case RpgMakerXp: + return "RPG Maker XP"; + case RpgMakerVx: + return "RPG Maker VX"; + case RpgMakerVxAce: + return "RPG Maker VX Ace"; + case RpgMakerMvMz: + return "RPG Maker MV/MZ"; + case WolfRpgEditor: + return "Wolf RPG Editor"; + case Encrypted2k3Maniacs: + return "Encrypted 2k3MP"; default: return "Unknown"; - } + } } #endif