Decompile 4 functions in Source/Contents/NavigationRoute.cpp, Source/Contents/NavigationManager.h, ...

Batch #1397 by Yommy: 0 byte-identical, 4 confirmed by peer review.

- fn_19376 NavigationManager::FindObject: logic confirmed by peer review
- fn_19434 NavigationObject::HasName: logic confirmed by peer review
- fn_19613 NavigationManager::LoadSettings: logic confirmed by peer review
- fn_19618 NavigationManager::FitToSquare: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
Adds to the build: Source/Contents/NavigationRoute.cpp
This commit is contained in:
ragnarok-clanker 2026-10-28 12:35:52 +00:00
commit e8a6a7d816
4 changed files with 83 additions and 2 deletions

View file

@ -3,8 +3,15 @@
#include <cstddef>
#include <string>
#include <vector>
class NavigationObject;
class NavigationObject {
public:
bool HasName(const char* name) const;
/* 0000 */ unsigned char unknown_0000[8];
/* 0008 */ std::string name;
};
struct NavigationTarget {
/* 0000 */ int type;
@ -20,14 +27,22 @@ public:
NavigationTarget GetSavedTarget() const;
int GetCurrentTargetType() const;
int SaveCurrentTarget();
NavigationObject* FindObject(const char* name) const;
float FitToSquare(int* offsetX, int* offsetY, int width, int height, float size) const;
void LoadSettings();
/* 0000 */ unsigned char unknown_0000[0x10FC];
/* 0000 */ std::vector<NavigationObject*> objects;
/* 000C */ unsigned char unknown_000C[0x10F0];
/* 10FC */ NavigationTarget currentTarget;
/* 1124 */ NavigationTarget savedTarget;
/* 114C */ unsigned char unknown_114C[0x1F8];
/* 1344 */ int viewIcon;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(offsetof(NavigationObject, name) == 0x8);
static_assert(offsetof(NavigationManager, savedTarget) == 0x1124);
static_assert(offsetof(NavigationManager, viewIcon) == 0x1344);
#endif
#endif

View file

@ -0,0 +1,57 @@
#include "Contents/NavigationManager.h"
#include "Client/Registry.h"
#include "Utility/RegistryKey.h"
#include <cstring>
// OFFSET: 0x00B88800
// FUNCTION: fn_19376
NavigationObject* NavigationManager::FindObject(const char* name) const {
for (NavigationObject* object : this->objects) {
if (object->HasName(name)) {
return object;
}
}
return nullptr;
}
// OFFSET: 0x00B8D270
// FUNCTION: fn_19434
bool NavigationObject::HasName(const char* name) const {
return std::strcmp(this->name.c_str(), name) == 0;
}
// OFFSET: 0x00B996D0
// FUNCTION: fn_19613
void NavigationManager::LoadSettings() {
RegistryKey key;
std::string subKey(g_subKey);
subKey += "\Navigation";
if (key.Open(HKEY_LOCAL_MACHINE, subKey.c_str())) {
DWORD viewIcon = 0;
if (key.Query("ViewIcon", REG_DWORD, reinterpret_cast<BYTE*>(&viewIcon), sizeof(viewIcon))) {
this->viewIcon = viewIcon;
}
}
}
// OFFSET: 0x00B9C020
// FUNCTION: fn_19618
float NavigationManager::FitToSquare(int* offsetX, int* offsetY, int width, int height, float size) const {
float scale;
if (width > height) {
scale = size / width;
*offsetY = static_cast<int>((width - height) * 0.5f * scale);
*offsetX = 0;
} else if (width < height) {
scale = size / height;
*offsetX = static_cast<int>((height - width) * 0.5f * scale);
*offsetY = 0;
} else {
*offsetY = 0;
scale = size / width;
*offsetX = 0;
}
return scale;
}

View file

@ -5,6 +5,14 @@
class RegistryKey {
public:
RegistryKey() : handle(nullptr) {}
~RegistryKey() {
if (this->handle != nullptr) {
RegCloseKey(this->handle);
}
this->handle = nullptr;
}
/* 0000 */ HKEY handle;
bool Create(HKEY parent, const char* subKey);