Skip to content

Commit

Permalink
Make the TTS patch dependant on one symbol less
Browse files Browse the repository at this point in the history
  • Loading branch information
MCMrARM committed Oct 30, 2019
1 parent a9ca551 commit c735370
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

static std::unique_ptr<ClientAppPlatform> appPlatform;

static size_t base;

void printVersionInfo();

int main(int argc, char *argv[]) {
Expand Down Expand Up @@ -96,6 +98,7 @@ int main(int argc, char *argv[]) {
void* handle = MinecraftUtils::loadMinecraftLib();
Log::info("Launcher", "Loaded Minecraft library");
Log::debug("Launcher", "Minecraft is at offset 0x%x", MinecraftUtils::getLibraryBase(handle));
base = MinecraftUtils::getLibraryBase(handle);

Log::trace("Launcher", "Initializing vtables");
MinecraftUtils::initSymbolBindings(handle);
Expand Down
3 changes: 2 additions & 1 deletion src/tts_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

#include <mcpelauncher/patch_utils.h>
#include <mcpelauncher/minecraft_version.h>
#include <hybris/dlfcn.h>

void TTSPatch::install(void* handle) {
if (!MinecraftVersion::isAtLeast(1, 8))
return;
void* sym = minecraft_dlsym(handle, "_ZN18TextToSpeechSystem15createTTSClientEb");
void* sym = hybris_dlsym(handle, "_ZN26TextToSpeechSystem_android16_createTTSClientEv");
PatchUtils::patchCallInstruction(sym, (void*) &TTSPatch::createTTSClient, true);
}

Expand Down

0 comments on commit c735370

Please sign in to comment.