From 9f06f31c0d8d7c10f13d49db56189c8fb730f86b Mon Sep 17 00:00:00 2001 From: KadDarem Date: Thu, 13 Feb 2025 00:41:29 +0100 Subject: [PATCH] feat(extra-native-rdr3): GET_MINIMAP_TYPE Update HudNatives.cpp --- .../extra-natives-rdr3/src/HudNatives.cpp | 11 +++++++++++ ext/native-decls/GetMinimapType.md | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 ext/native-decls/GetMinimapType.md diff --git a/code/components/extra-natives-rdr3/src/HudNatives.cpp b/code/components/extra-natives-rdr3/src/HudNatives.cpp index 634173ec1e..6945b5cb63 100644 --- a/code/components/extra-natives-rdr3/src/HudNatives.cpp +++ b/code/components/extra-natives-rdr3/src/HudNatives.cpp @@ -11,6 +11,11 @@ static hook::cdecl_stub g_uiMinimap_SetType([]() return hook::get_pattern("48 81 EC ? ? ? ? 8B F2 48 8B E9 E8", -16); }); +static hook::cdecl_stub g_uiMinimap_GetType([]() +{ + return hook::get_call(hook::get_pattern("E8 ? ? ? ? 83 F8 ? 74 ? 48 8D 15")); +}); + static HookFunction hookFunction([]() { { @@ -29,6 +34,12 @@ static HookFunction hookFunction([]() g_uiMinimap_SetType(g_uiMinimap, minimapType); }); + fx::ScriptEngine::RegisterNativeHandler("GET_MINIMAP_TYPE", [](fx::ScriptContext& context) + { + uint32_t minimapType = g_uiMinimap_GetType(g_uiMinimap); + context.SetResult(minimapType); + }); + /* { char* location = hook::get_pattern("48 81 C1 ? ? ? ? 33 D2 E8 ? ? ? ? 83 FE 02", 3); diff --git a/ext/native-decls/GetMinimapType.md b/ext/native-decls/GetMinimapType.md new file mode 100644 index 0000000000..b14300f930 --- /dev/null +++ b/ext/native-decls/GetMinimapType.md @@ -0,0 +1,18 @@ +--- +ns: CFX +apiset: client +game: rdr3 +--- +## GET_MINIMAP_TYPE + +```c +int GET_MINIMAP_TYPE(); +``` + +Get the minimap type: +``` +0 = Off, +1 = Regular, +2 = Expanded, +3 = Simple, +``` \ No newline at end of file