From 4f48baf914c1bad536d76449fc4ac6317ede83fb Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 19:44:21 +0000 Subject: [PATCH] Decompile 2 functions in Source/Client/ModeTransitions.cpp, Source/Client/Mode/ActiveGameMode.h Batch #1610 by eAthena: 0 byte-identical, 2 confirmed by peer review. - fn_17845 CWorld::Quit: logic confirmed by peer review - fn_17851 CWorld::Switch: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/Client/ModeTransitions.cpp --- Source/Client/Mode/ActiveGameMode.h | 6 +++++- Source/Client/ModeTransitions.cpp | 27 +++++++++++++++++++++++++++ data/compile.json | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 Source/Client/ModeTransitions.cpp diff --git a/Source/Client/Mode/ActiveGameMode.h b/Source/Client/Mode/ActiveGameMode.h index d4c37aa..88e767b 100644 --- a/Source/Client/Mode/ActiveGameMode.h +++ b/Source/Client/Mode/ActiveGameMode.h @@ -6,10 +6,14 @@ struct CWorld { /* 0000 */ int running; /* 0004 */ CMode* gameMode; - /* 0008 */ unsigned char unknown_0008[0x50]; + /* 0008 */ unsigned char unknown_0008[0x28]; + /* 0030 */ char nextModeName[0x28]; /* 0058 */ int state; + /* 005C */ int nextState; CMode* ActiveGameMode(); + void Quit(); + void Switch(int mode, const char* name); }; extern CWorld g_world; diff --git a/Source/Client/ModeTransitions.cpp b/Source/Client/ModeTransitions.cpp new file mode 100644 index 0000000..019e889 --- /dev/null +++ b/Source/Client/ModeTransitions.cpp @@ -0,0 +1,27 @@ +#include "Client/Application/ApplicationWindow.h" +#include "Client/Mode/ActiveGameMode.h" +#include "Contents/Configuration/ServiceConfiguration.h" + +#include +#include + +// OFFSET: 0x00AD67E0 +// FUNCTION: fn_17845 +void CWorld::Quit() { + if (this->gameMode) { + this->gameMode->running = 0; + } + + if (g_serviceType == 11) { + ShellExecuteA(hWnd, "open", "http://www.ragnarok.co.in/index.php", nullptr, nullptr, SW_SHOWNORMAL); + } + this->running = 0; +} + +// OFFSET: 0x00AD7620 +// FUNCTION: fn_17851 +void CWorld::Switch(int mode, const char* name) { + this->gameMode->running = 0; + std::strcpy(this->nextModeName, name); + this->nextState = mode; +} diff --git a/data/compile.json b/data/compile.json index affd49c..fad499c 100644 --- a/data/compile.json +++ b/data/compile.json @@ -260,6 +260,7 @@ "Source/Client/ModeBaseEvents.cpp": 0, "Source/Client/ModeFade.cpp": 0, "Source/Client/ModeFadeOut.cpp": 0, + "Source/Client/ModeTransitions.cpp": 0, "Source/Client/Registry.cpp": 0, "Source/Client/Replay.cpp": 0, "Source/Client/ReplayControl.cpp": 0,