From c6254811e443a70969fc267d571312a9e601d76f Mon Sep 17 00:00:00 2001 From: Nezarn Date: Tue, 30 Jun 2020 11:07:57 +0200 Subject: [PATCH] - Fix Chaos Code (Nesica) running from D:\ - Fix Chaos Code (Nesica) running from D:\, also saves\loads test menu fine --- .../Functions/Games/Nesica/NesicaGeneric.cpp | 12 +++++++ .../src/Functions/Nesica_Libs/RfidEmu.cpp | 31 +++++++++++++++++++ OpenParrot/src/Utility/GameDetect.cpp | 4 +-- OpenParrot/src/Utility/GameID.h | 3 +- 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/OpenParrot/src/Functions/Games/Nesica/NesicaGeneric.cpp b/OpenParrot/src/Functions/Games/Nesica/NesicaGeneric.cpp index 16997d9..92ab9cb 100644 --- a/OpenParrot/src/Functions/Games/Nesica/NesicaGeneric.cpp +++ b/OpenParrot/src/Functions/Games/Nesica/NesicaGeneric.cpp @@ -297,6 +297,18 @@ static InitFunction initFunction_VampireSavior([]() #endif }, GameID::VampireSavior); +static InitFunction initFunction_ChaosCode([]() +{ + init_FastIoEmu(); + init_RfidEmu(); + init_RegHooks(); + if (GameDetect::enableNesysEmu) + init_NesysEmu(); +#if _M_IX86 + init_CryptoPipe(GameDetect::NesicaKey); +#endif +}, GameID::ChaosCode); + static InitFunction initFunction_Theatrhythm([]() { uintptr_t imageBase = (uintptr_t)GetModuleHandleA(0); diff --git a/OpenParrot/src/Functions/Nesica_Libs/RfidEmu.cpp b/OpenParrot/src/Functions/Nesica_Libs/RfidEmu.cpp index a9a4d62..838006b 100644 --- a/OpenParrot/src/Functions/Nesica_Libs/RfidEmu.cpp +++ b/OpenParrot/src/Functions/Nesica_Libs/RfidEmu.cpp @@ -891,6 +891,22 @@ LPCSTR ParseFileNamesA(LPCSTR lpFileName) return lpFileName; } + if (GameDetect::currentGame == GameID::ChaosCode) + { + if (!strncmp(lpFileName, "D:/ChaosCode/save/TYPEX2_RECORD.rcd", 35) || !strncmp(lpFileName, "D:/ChaosCode/save/TYPEX2_SETTING.rcd", 36) || !strncmp(lpFileName, "D:/ChaosCode/save/", 18) || !strncmp(lpFileName, "D:/ChaosCode/", 14)) + { + memset(moveBuf, 0, 256); + if (lpFileName[2] == '\\' || lpFileName[2] == '/') + { + sprintf(moveBuf, ".\\OpenParrot\\%s", lpFileName + 3); + } + + return moveBuf; + } + + return lpFileName; + } + if (!strncmp(lpFileName, "D:", 2) || !strncmp(lpFileName, "d:", 2)) { memset(moveBuf, 0, 256); @@ -1028,6 +1044,21 @@ LPCWSTR ParseFileNamesW(LPCWSTR lpFileName) return lpFileName; } + if (GameDetect::currentGame == GameID::ChaosCode) + { + if (!wcsncmp(lpFileName, L"D:/ChaosCode/save/TYPEX2_RECORD.rcd", 35) || !wcsncmp(lpFileName, L"D:/ChaosCode/save/TYPEX2_SETTING.rcd", 36) || !wcsncmp(lpFileName, L"D:/ChaosCode/save/TYPEX2_SETTING.rcd", 36) || !wcsncmp(lpFileName, L"D:/ChaosCode/save/", 18) || !wcsncmp(lpFileName, L"D:/ChaosCode/", 14)) + { + memset(moveBufW, 0, 256); + if (lpFileName[2] == '\\' || lpFileName[2] == '/') + { + swprintf(moveBufW, L".\\OpenParrot\\%s", lpFileName + 3); + } + return moveBufW; + } + + return lpFileName; + } + if (!wcsncmp(lpFileName, L"D:", 2) || !wcsncmp(lpFileName, L"d:", 2)) { memset(moveBufW, 0, 256); diff --git a/OpenParrot/src/Utility/GameDetect.cpp b/OpenParrot/src/Utility/GameDetect.cpp index eab1866..7a4761f 100644 --- a/OpenParrot/src/Utility/GameDetect.cpp +++ b/OpenParrot/src/Utility/GameDetect.cpp @@ -490,12 +490,12 @@ void GameDetect::DetectCurrentGame() isNesica = true; break; case 0xac86efec: //Chaos Code v1.03 - currentGame = GameID::Nesica; + currentGame = GameID::ChaosCode; NesicaKey = NesicaKey::None; isNesica = true; break; case 0xa742a607: //Chaos Code v2.11 - currentGame = GameID::Nesica; + currentGame = GameID::ChaosCode; NesicaKey = NesicaKey::None; isNesica = true; break; diff --git a/OpenParrot/src/Utility/GameID.h b/OpenParrot/src/Utility/GameID.h index fa9115f..53c95e6 100644 --- a/OpenParrot/src/Utility/GameID.h +++ b/OpenParrot/src/Utility/GameID.h @@ -79,5 +79,6 @@ enum class GameID StreetFighter3rdStrike, RumbleFish2, KOF98Nesica, - VampireSavior + VampireSavior, + ChaosCode }; \ No newline at end of file