From 62521b221f8e28c3da0fd7cb49f382f36f9a2da7 Mon Sep 17 00:00:00 2001 From: Meta-link Date: Sat, 20 Aug 2022 02:22:31 +0200 Subject: [PATCH] 2022052400 support --- jubeat-hook/dllmain.cpp | 47 ++++++++++++++++++++++++++++++--------- jubeat-hook/jubeat-hook.h | 1 + 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/jubeat-hook/dllmain.cpp b/jubeat-hook/dllmain.cpp index 0c0d085..0e948d8 100644 --- a/jubeat-hook/dllmain.cpp +++ b/jubeat-hook/dllmain.cpp @@ -51,7 +51,7 @@ void printDebug(auto str) void ChartDump() { - printf(" === TUNE %i ===\n", currentSong - 1); + printf(" === TUNE %i ===\n", currentSong + 1); printf("Song ID = %i\n", chart->ChartId); printf("Song difficulty = %s\n", Difficulty[chart->ChartDifficulty]); printf("Song level = %i.%i\n", chart->ChartLevel, chart->ChartDecimal); @@ -203,15 +203,21 @@ void ProcessScore() try { KamaiResponse = json::parse(r.text); - r = cpr::Get(cpr::Url{ KamaiResponse["body"]["url"] }); - - KamaiResponse = json::parse(r.text); - printDebug(KamaiResponse["description"]); - - if (!KamaiResponse["body"]["import"]["errors"].empty()) + if (KamaiResponse["success"] == true) + { + r = cpr::Get(cpr::Url{ KamaiResponse["body"]["url"] }); + KamaiResponse = json::parse(r.text); + printDebug(KamaiResponse["description"]); + + if (!KamaiResponse["body"]["import"]["errors"].empty()) + { + printDebug("Error :"); + printDebug(KamaiResponse["body"]["import"]["errors"][0]["message"]); + } + } + else { - printDebug("Error :"); - printDebug(KamaiResponse["body"]["import"]["errors"][0]["message"]); + printDebug(KamaiResponse["description"]); } } catch (json::parse_error& e) @@ -248,7 +254,28 @@ DWORD WINAPI InitHook(LPVOID dllInstance) XMLDocument doc; doc.LoadFile("prop/ea3-config.xml"); - const char* dateCode = doc.FirstChildElement("ea3")->FirstChildElement("soft")->FirstChildElement("ext")->GetText(); + + const char* dateCode; + printDebug("Parsing ea3-config.xml to find datecode"); + if (doc.FirstChildElement("ea3")->FirstChildElement("soft") != NULL) + { + dateCode = doc.FirstChildElement("ea3")->FirstChildElement("soft")->FirstChildElement("ext")->GetText(); + } + else + { + printDebug("Parsing ea3-ident.xml to find datecode"); + doc.LoadFile("prop/ea3-ident.xml"); + if (doc.FirstChildElement("ea3_conf") != NULL) + { + dateCode = doc.FirstChildElement("ea3_conf")->FirstChildElement("soft")->FirstChildElement("ext")->GetText(); + } + else + { + printDebug("No valid XML to parse, exiting now ..."); + return EXIT_FAILURE; + } + } + printDebug("Datecode : " + (string)dateCode); for (int i = 0; i < sizeof(GameAdresses) / sizeof(GameAdresses[0]); i++) diff --git a/jubeat-hook/jubeat-hook.h b/jubeat-hook/jubeat-hook.h index c92e05c..60339c5 100644 --- a/jubeat-hook/jubeat-hook.h +++ b/jubeat-hook/jubeat-hook.h @@ -32,6 +32,7 @@ struct Adresses GameAdresses[] = { {"2018070901", 0xBDF8B6C, 0xBDC0F5F, 0xBDB4E18, 0xBDDF5B4, 0xBDC2730, clan}, //festo {"2018112702", 0x1074F860, 0xF50A6C, 0x11C5E60, 0x122C104, 0xF579C0, festo}, + {"2022052400", 0x107752C0, 0xF93084, 0x120D190, 0x124EC64, 0xF9A6C0, festo}, }; const int32_t ScoreSize = 0xA0;