From 689e3703dc786f363b3f4198f0e4d14079ed2a42 Mon Sep 17 00:00:00 2001 From: GameParrot <85067619+GameParrot@users.noreply.github.com> Date: Sun, 21 May 2023 15:35:08 -0400 Subject: [PATCH 1/4] Add new modding api functions `mcpelauncher_ismouselocked` and `mcpelauncher_pattern` --- include/mcpelauncher/minecraft_utils.h | 2 ++ src/minecraft_utils.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/mcpelauncher/minecraft_utils.h b/include/mcpelauncher/minecraft_utils.h index f570279..62c1385 100644 --- a/include/mcpelauncher/minecraft_utils.h +++ b/include/mcpelauncher/minecraft_utils.h @@ -38,4 +38,6 @@ class MinecraftUtils { static void setupGLES2Symbols(void* (*resolver)(const char*)); + static bool mosueHidden; + }; diff --git a/src/minecraft_utils.cpp b/src/minecraft_utils.cpp index 871784b..01a788a 100644 --- a/src/minecraft_utils.cpp +++ b/src/minecraft_utils.cpp @@ -21,6 +21,7 @@ #include #endif +bool MinecraftUtils::mosueHidden = false; void MinecraftUtils::workaroundLocaleBug() { setenv("LC_ALL", "C", 1); // HACK: Force set locale to one recognized by MCPE so that the outdated C++ standard library MCPE uses doesn't fail to find one } @@ -93,7 +94,6 @@ void MinecraftUtils::setupHybris() { std::unordered_map MinecraftUtils::getApi() { std::unordered_map syms; - // Deprecated use android liblog #if !(defined(__APPLE__) && defined(__aarch64__)) syms["mcpelauncher_log"] = (void*) Log::log; syms["mcpelauncher_vlog"] = (void*) Log::vlog; @@ -155,6 +155,12 @@ std::unordered_map MinecraftUtils::getApi() { syms["mcpelauncher_host_dlopen"] = (void *) dlopen; syms["mcpelauncher_host_dlsym"] = (void *) dlsym; syms["mcpelauncher_host_dlclose"] = (void *) dlclose; + syms["mcpelauncher_pattern"] = (void *)+ [](void* handle, const char *pattern) -> void* { + return PatchUtils::patternSearch(handle, pattern); + }; + syms["mcpelauncher_ismouselocked"] = (void *)+ []() -> bool { + return mosueHidden; + }; return syms; } From c8f0f585c059244a08c1c9b10d584b1e94302606 Mon Sep 17 00:00:00 2001 From: GameParrot <85067619+GameParrot@users.noreply.github.com> Date: Sun, 21 May 2023 15:37:23 -0400 Subject: [PATCH 2/4] fix typo --- src/minecraft_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/minecraft_utils.cpp b/src/minecraft_utils.cpp index 01a788a..a5f248a 100644 --- a/src/minecraft_utils.cpp +++ b/src/minecraft_utils.cpp @@ -21,7 +21,7 @@ #include #endif -bool MinecraftUtils::mosueHidden = false; +bool MinecraftUtils::mouseHidden = false; void MinecraftUtils::workaroundLocaleBug() { setenv("LC_ALL", "C", 1); // HACK: Force set locale to one recognized by MCPE so that the outdated C++ standard library MCPE uses doesn't fail to find one } @@ -159,7 +159,7 @@ std::unordered_map MinecraftUtils::getApi() { return PatchUtils::patternSearch(handle, pattern); }; syms["mcpelauncher_ismouselocked"] = (void *)+ []() -> bool { - return mosueHidden; + return mouseHidden; }; return syms; } From 6b28b28b2bf9409e2dddbd494ba44ac8156f6d85 Mon Sep 17 00:00:00 2001 From: GameParrot <85067619+GameParrot@users.noreply.github.com> Date: Sun, 21 May 2023 15:37:40 -0400 Subject: [PATCH 3/4] fix typo --- include/mcpelauncher/minecraft_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mcpelauncher/minecraft_utils.h b/include/mcpelauncher/minecraft_utils.h index 62c1385..8073e9d 100644 --- a/include/mcpelauncher/minecraft_utils.h +++ b/include/mcpelauncher/minecraft_utils.h @@ -38,6 +38,6 @@ class MinecraftUtils { static void setupGLES2Symbols(void* (*resolver)(const char*)); - static bool mosueHidden; + static bool mouseHidden; }; From 922317bf0b5779d2e9112d2af1535f021c503402 Mon Sep 17 00:00:00 2001 From: GameParrot <85067619+GameParrot@users.noreply.github.com> Date: Sun, 21 May 2023 15:46:02 -0400 Subject: [PATCH 4/4] Update minecraft_utils.cpp --- src/minecraft_utils.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/minecraft_utils.cpp b/src/minecraft_utils.cpp index a5f248a..1dd77a4 100644 --- a/src/minecraft_utils.cpp +++ b/src/minecraft_utils.cpp @@ -94,6 +94,7 @@ void MinecraftUtils::setupHybris() { std::unordered_map MinecraftUtils::getApi() { std::unordered_map syms; + // Deprecated use android liblog #if !(defined(__APPLE__) && defined(__aarch64__)) syms["mcpelauncher_log"] = (void*) Log::log; syms["mcpelauncher_vlog"] = (void*) Log::vlog;