From 98360ce94d4e42e959007b16b5bf67a9637cbc1f Mon Sep 17 00:00:00 2001 From: RusJJ Date: Thu, 30 Nov 2023 22:54:14 +0300 Subject: [PATCH] Small fixes --- ARMPatch | 2 +- curl | 2 +- main.cpp | 2 +- mod/amlmod.h | 2 ++ mod/config.cpp | 2 +- modslist.cpp | 2 +- signal.cpp | 83 +++++++++++++++++++++-------------------------- vtable_hooker.cpp | 2 +- wolfssl | 2 +- zlib | 2 +- 10 files changed, 47 insertions(+), 54 deletions(-) diff --git a/ARMPatch b/ARMPatch index e7f449e..00b45fd 160000 --- a/ARMPatch +++ b/ARMPatch @@ -1 +1 @@ -Subproject commit e7f449e420ccd6d8edcb674b74ee58b81c349849 +Subproject commit 00b45fdc4a0f8a195e678e1a55858fcbe64dd87e diff --git a/curl b/curl index 9fb6cc5..d1c2bb3 160000 --- a/curl +++ b/curl @@ -1 +1 @@ -Subproject commit 9fb6cc54c59760bee23c730f668653895e713a25 +Subproject commit d1c2bb3d8d9c68395de815b8217ffb7d2dc795c5 diff --git a/main.cpp b/main.cpp index 932e840..8abfa3e 100644 --- a/main.cpp +++ b/main.cpp @@ -217,7 +217,7 @@ JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) } /* Must Have for mods */ - modlist->AddMod(amlmodinfo, 0, NULL); + modlist->AddMod(amlmodinfo, 0, "localpath (core)"); interfaces->Register("AMLInterface", aml); interfaces->Register("AMLConfig", icfg); InitCURL(); diff --git a/mod/amlmod.h b/mod/amlmod.h index 0361d1e..421f8e4 100644 --- a/mod/amlmod.h +++ b/mod/amlmod.h @@ -10,8 +10,10 @@ #ifdef __arm__ #define AML32 + #define BYBIT(__32val, __64val) (__32val) #elif defined __aarch64__ #define AML64 + #define BYBIT(__32val, __64val) (__64val) #else #error This lib is supposed to work on ARM only! #endif diff --git a/mod/config.cpp b/mod/config.cpp index a79e882..6761856 100644 --- a/mod/config.cpp +++ b/mod/config.cpp @@ -349,7 +349,7 @@ bool Config::GetBool(const char* szKey, bool bDefaultValue, const char* szSectio rgba_t Config::GetColor(const char* szKey, rgba_t clr, const char* szSection) { - if(!m_bInitialized) return NULL; + if(!m_bInitialized) return rgba_t {0,0,0,0}; ConfigEntry entry; ConfigEntry* pRet = &entry; pRet->m_pBoundCfg = this; strxcpy(pRet->m_szMySection, szSection, sizeof(pRet->m_szMySection)); diff --git a/modslist.cpp b/modslist.cpp index 6d15bbd..a297e39 100644 --- a/modslist.cpp +++ b/modslist.cpp @@ -332,7 +332,7 @@ void ModsList::PrintModsList(std::ofstream& logfile) desc = item->pModDesc; logfile << info->Name() << " (" << info->Author() << ", version " << info->VersionString() << ")\n"; - logfile << " - GUID: " << info->GUID() << " | Path: " << desc->m_szLibPath << "\n"; + logfile << " - GUID: " << info->GUID() << " | Base: 0x" << std::hex << std::uppercase << (uintptr_t)desc->m_pHandle << " | Path: " << desc->m_szLibPath << "\n"; } } diff --git a/signal.cpp b/signal.cpp index e4e5d62..8b84a9a 100644 --- a/signal.cpp +++ b/signal.cpp @@ -6,23 +6,11 @@ #include #include "xunwind.h" -#ifdef __arm__ - #define AML32 -#elif defined __aarch64__ - #define AML64 -#else - #error This lib is supposed to work on ARM only! -#endif - #define STACKDUMP_SIZE 1024 std::ofstream g_pLogFile; struct sigaction newSigaction[7]; struct sigaction oldSigaction[7]; -#ifdef IO_GITHUB_HEXHACKING_XUNWIND - static uintptr_t g_frames[128]; - static size_t g_frames_sz = 0; -#endif extern bool g_bSimplerCrashLog, g_bNoSPInLog, g_bNoModsInLog; int SignalInnerId(int code) @@ -202,7 +190,7 @@ void Handler(int sig, siginfo_t *si, void *ptr) char path[320], pathText[320]; sprintf(path, "%s/aml_crashlog.txt", aml->GetAndroidDataRootPath()); - sprintf(pathText, "Application has been crashed!\n\nCrashlog has been saved in %s", path); + sprintf(pathText, "Application has been crashed!\n\nCrashlog should be saved in %s", path); g_pLogFile.open(path, std::ios::out | std::ios::trunc); // Java doesnt work here and so crashing again and again? @@ -215,7 +203,7 @@ void Handler(int sig, siginfo_t *si, void *ptr) g_pLogFile << "Exception Signal " << sig << " - " << SignalEnum(sig) << " (" << CodeEnum(sig, si->si_code) << ")" << std::endl; g_pLogFile << "Fault address: 0x" << std::hex << std::uppercase << faultAddr << std::nouppercase << std::endl; - g_pLogFile << "An overall reason of the crash: "; + g_pLogFile << "An overall reason of the crash:\n- "; switch(sig) { case SIGABRT: @@ -273,36 +261,36 @@ void Handler(int sig, siginfo_t *si, void *ptr) g_pLogFile << std::endl; } - g_pLogFile << std::endl << "Registers:" << std::endl; + g_pLogFile << "\n----------------------------------------------------\nRegisters:" << std::endl; #ifdef AML32 - g_pLogFile << "R0: " << std::dec << mcontext->arm_r0 << " 0x" << std::hex << std::uppercase << mcontext->arm_r0 << std::endl; - g_pLogFile << "R1: " << std::dec << mcontext->arm_r1 << " 0x" << std::hex << std::uppercase << mcontext->arm_r1 << std::endl; - g_pLogFile << "R2: " << std::dec << mcontext->arm_r2 << " 0x" << std::hex << std::uppercase << mcontext->arm_r2 << std::endl; - g_pLogFile << "R3: " << std::dec << mcontext->arm_r3 << " 0x" << std::hex << std::uppercase << mcontext->arm_r3 << std::endl; - g_pLogFile << "R4: " << std::dec << mcontext->arm_r4 << " 0x" << std::hex << std::uppercase << mcontext->arm_r4 << std::endl; - g_pLogFile << "R5: " << std::dec << mcontext->arm_r5 << " 0x" << std::hex << std::uppercase << mcontext->arm_r5 << std::endl; - g_pLogFile << "R6: " << std::dec << mcontext->arm_r6 << " 0x" << std::hex << std::uppercase << mcontext->arm_r6 << std::endl; - g_pLogFile << "R7: " << std::dec << mcontext->arm_r7 << " 0x" << std::hex << std::uppercase << mcontext->arm_r7 << std::endl; - g_pLogFile << "R8: " << std::dec << mcontext->arm_r8 << " 0x" << std::hex << std::uppercase << mcontext->arm_r8 << std::endl; - g_pLogFile << "R9: " << std::dec << mcontext->arm_r9 << " 0x" << std::hex << std::uppercase << mcontext->arm_r9 << std::endl; - g_pLogFile << "R10: " << std::dec << mcontext->arm_r10 << " 0x" << std::hex << std::uppercase << mcontext->arm_r10 << std::endl; - g_pLogFile << "R11: " << std::dec << mcontext->arm_fp << " 0x" << std::hex << std::uppercase << mcontext->arm_fp << std::endl; - g_pLogFile << "R12: " << std::dec << mcontext->arm_ip << " 0x" << std::hex << std::uppercase << mcontext->arm_ip << std::endl; - g_pLogFile << "SP: " << std::dec << mcontext->arm_sp << " 0x" << std::hex << std::uppercase << mcontext->arm_sp << std::endl; - g_pLogFile << "LR: " << std::dec << mcontext->arm_lr << " 0x" << std::hex << std::uppercase << mcontext->arm_lr << std::endl; - g_pLogFile << "PC: " << std::dec << mcontext->arm_pc << " 0x" << std::hex << std::uppercase << mcontext->arm_pc << std::endl; + g_pLogFile << "R0: " << std::dec << mcontext->arm_r0 << " 0x" << std::hex << std::uppercase << mcontext->arm_r0 << std::endl; + g_pLogFile << "R1: " << std::dec << mcontext->arm_r1 << " 0x" << std::hex << std::uppercase << mcontext->arm_r1 << std::endl; + g_pLogFile << "R2: " << std::dec << mcontext->arm_r2 << " 0x" << std::hex << std::uppercase << mcontext->arm_r2 << std::endl; + g_pLogFile << "R3: " << std::dec << mcontext->arm_r3 << " 0x" << std::hex << std::uppercase << mcontext->arm_r3 << std::endl; + g_pLogFile << "R4: " << std::dec << mcontext->arm_r4 << " 0x" << std::hex << std::uppercase << mcontext->arm_r4 << std::endl; + g_pLogFile << "R5: " << std::dec << mcontext->arm_r5 << " 0x" << std::hex << std::uppercase << mcontext->arm_r5 << std::endl; + g_pLogFile << "R6: " << std::dec << mcontext->arm_r6 << " 0x" << std::hex << std::uppercase << mcontext->arm_r6 << std::endl; + g_pLogFile << "R7: " << std::dec << mcontext->arm_r7 << " 0x" << std::hex << std::uppercase << mcontext->arm_r7 << std::endl; + g_pLogFile << "R8: " << std::dec << mcontext->arm_r8 << " 0x" << std::hex << std::uppercase << mcontext->arm_r8 << std::endl; + g_pLogFile << "R9: " << std::dec << mcontext->arm_r9 << " 0x" << std::hex << std::uppercase << mcontext->arm_r9 << std::endl; + g_pLogFile << "R10: " << std::dec << mcontext->arm_r10 << " 0x" << std::hex << std::uppercase << mcontext->arm_r10 << std::endl; + g_pLogFile << "R11: " << std::dec << mcontext->arm_fp << " 0x" << std::hex << std::uppercase << mcontext->arm_fp << std::endl; + g_pLogFile << "R12: " << std::dec << mcontext->arm_ip << " 0x" << std::hex << std::uppercase << mcontext->arm_ip << std::endl; + g_pLogFile << "SP: " << std::dec << mcontext->arm_sp << " 0x" << std::hex << std::uppercase << mcontext->arm_sp << std::endl; + g_pLogFile << "LR: " << std::dec << mcontext->arm_lr << " 0x" << std::hex << std::uppercase << mcontext->arm_lr << std::endl; + g_pLogFile << "PC: " << std::dec << mcontext->arm_pc << " 0x" << std::hex << std::uppercase << mcontext->arm_pc << std::endl; g_pLogFile << "CPSR: " << std::dec << mcontext->arm_cpsr << " 0x" << std::hex << std::uppercase << mcontext->arm_cpsr << std::endl; #else - g_pLogFile << "X0: " << std::dec << mcontext->regs[0] << " 0x" << std::hex << std::uppercase << mcontext->regs[0] << std::endl; - g_pLogFile << "X1: " << std::dec << mcontext->regs[1] << " 0x" << std::hex << std::uppercase << mcontext->regs[1] << std::endl; - g_pLogFile << "X2: " << std::dec << mcontext->regs[2] << " 0x" << std::hex << std::uppercase << mcontext->regs[2] << std::endl; - g_pLogFile << "X3: " << std::dec << mcontext->regs[3] << " 0x" << std::hex << std::uppercase << mcontext->regs[3] << std::endl; - g_pLogFile << "X4: " << std::dec << mcontext->regs[4] << " 0x" << std::hex << std::uppercase << mcontext->regs[4] << std::endl; - g_pLogFile << "X5: " << std::dec << mcontext->regs[5] << " 0x" << std::hex << std::uppercase << mcontext->regs[5] << std::endl; - g_pLogFile << "X6: " << std::dec << mcontext->regs[6] << " 0x" << std::hex << std::uppercase << mcontext->regs[6] << std::endl; - g_pLogFile << "X7: " << std::dec << mcontext->regs[7] << " 0x" << std::hex << std::uppercase << mcontext->regs[7] << std::endl; - g_pLogFile << "X8: " << std::dec << mcontext->regs[8] << " 0x" << std::hex << std::uppercase << mcontext->regs[8] << std::endl; - g_pLogFile << "X9: " << std::dec << mcontext->regs[9] << " 0x" << std::hex << std::uppercase << mcontext->regs[9] << std::endl; + g_pLogFile << "X0: " << std::dec << mcontext->regs[0] << " 0x" << std::hex << std::uppercase << mcontext->regs[0] << std::endl; + g_pLogFile << "X1: " << std::dec << mcontext->regs[1] << " 0x" << std::hex << std::uppercase << mcontext->regs[1] << std::endl; + g_pLogFile << "X2: " << std::dec << mcontext->regs[2] << " 0x" << std::hex << std::uppercase << mcontext->regs[2] << std::endl; + g_pLogFile << "X3: " << std::dec << mcontext->regs[3] << " 0x" << std::hex << std::uppercase << mcontext->regs[3] << std::endl; + g_pLogFile << "X4: " << std::dec << mcontext->regs[4] << " 0x" << std::hex << std::uppercase << mcontext->regs[4] << std::endl; + g_pLogFile << "X5: " << std::dec << mcontext->regs[5] << " 0x" << std::hex << std::uppercase << mcontext->regs[5] << std::endl; + g_pLogFile << "X6: " << std::dec << mcontext->regs[6] << " 0x" << std::hex << std::uppercase << mcontext->regs[6] << std::endl; + g_pLogFile << "X7: " << std::dec << mcontext->regs[7] << " 0x" << std::hex << std::uppercase << mcontext->regs[7] << std::endl; + g_pLogFile << "X8: " << std::dec << mcontext->regs[8] << " 0x" << std::hex << std::uppercase << mcontext->regs[8] << std::endl; + g_pLogFile << "X9: " << std::dec << mcontext->regs[9] << " 0x" << std::hex << std::uppercase << mcontext->regs[9] << std::endl; g_pLogFile << "X10: " << std::dec << mcontext->regs[10] << " 0x" << std::hex << std::uppercase << mcontext->regs[10] << std::endl; g_pLogFile << "X11: " << std::dec << mcontext->regs[11] << " 0x" << std::hex << std::uppercase << mcontext->regs[11] << std::endl; g_pLogFile << "X12: " << std::dec << mcontext->regs[12] << " 0x" << std::hex << std::uppercase << mcontext->regs[12] << std::endl; @@ -324,9 +312,9 @@ void Handler(int sig, siginfo_t *si, void *ptr) g_pLogFile << "X28: " << std::dec << mcontext->regs[28] << " 0x" << std::hex << std::uppercase << mcontext->regs[28] << std::endl; g_pLogFile << "X29: " << std::dec << mcontext->regs[29] << " 0x" << std::hex << std::uppercase << mcontext->regs[29] << std::endl; g_pLogFile << "X30: " << std::dec << mcontext->regs[30] << " 0x" << std::hex << std::uppercase << mcontext->regs[30] << std::endl; - g_pLogFile << "SP: " << std::dec << mcontext->sp << " 0x" << std::hex << std::uppercase << mcontext->sp << std::endl; - g_pLogFile << "PC: " << std::dec << mcontext->pc << " 0x" << std::hex << std::uppercase << mcontext->pc << std::endl; - g_pLogFile << "CPSR: " << std::dec << mcontext->pstate << " 0x" << std::hex << std::uppercase << mcontext->pstate << std::endl; + g_pLogFile << "SP: " << std::dec << mcontext->sp << " 0x" << std::hex << std::uppercase << mcontext->sp << std::endl; + g_pLogFile << "PC: " << std::dec << mcontext->pc << " 0x" << std::hex << std::uppercase << mcontext->pc << std::endl; + g_pLogFile << "CPSR: " << std::dec << mcontext->pstate << " 0x" << std::hex << std::uppercase << mcontext->pstate << std::endl; #endif #ifdef AML32 @@ -337,14 +325,14 @@ void Handler(int sig, siginfo_t *si, void *ptr) if(!g_bNoSPInLog) { - g_pLogFile << "\nPrinting " << std::dec << STACKDUMP_SIZE << " bytes of stack:" << std::endl; + g_pLogFile << "\n----------------------------------------------------\nPrinting " << std::dec << STACKDUMP_SIZE << " bytes of stack:" << std::endl; g_pLogFile << std::hex << std::uppercase; for(int i = 1; i <= STACKDUMP_SIZE; ++i) { g_pLogFile << " " << std::setfill('0') << std::setw(2) << (int)(stack[i - 1]); if(i % 16 == 0) { - g_pLogFile << " (SP+0x" << 16 * ((i / 16) - 1) << ") ["; + g_pLogFile << " (SP+0x" << std::setfill('0') << std::setw(3) << 16 * ((i / 16) - 1) << ") ["; int endv = i; for(int j = i-16; j < endv && j < STACKDUMP_SIZE; ++j) { @@ -370,6 +358,9 @@ void Handler(int sig, siginfo_t *si, void *ptr) } #endif + g_pLogFile << "\n----------------------------------------------------\n\t\tEND OF REPORT\n----------------------------------------------------\n\n"; + g_pLogFile << "If you`re having problems using official mods, please report about this problem on our OFFICIAL server:\n\t\thttps://discord.gg/2MY7W39kBg\nPlease follow the rules and head to the #help section!"; + skip_logging: logger->Info("Notifying mods about the crash..."); modlist->ProcessCrash(dlInfo.dli_fname ? GetFilenamePart(dlInfo.dli_fname) : "", sig, si->si_code, (uintptr_t)dlInfo.dli_fbase, mcontext); diff --git a/vtable_hooker.cpp b/vtable_hooker.cpp index b8010d0..def995c 100644 --- a/vtable_hooker.cpp +++ b/vtable_hooker.cpp @@ -8,7 +8,7 @@ void* vtablez[MAX_VTABLE_FUNCS] = {NULL}; int vtablez_offset = 0; -// This function is not gonna work correctly if vtable has "holes" +// This function is not gonna work correctly if vtable has "holes" (incomplete virtual class) void HookVtableFunc(void* ptr, unsigned int funcNum, void* func, void** original, bool instantiate) { if(!ptr || !func || funcNum < 0) return; diff --git a/wolfssl b/wolfssl index 2b1c61a..cbe8309 160000 --- a/wolfssl +++ b/wolfssl @@ -1 +1 @@ -Subproject commit 2b1c61a013a2f583160decca97540c5cd3be9abb +Subproject commit cbe8309b3b75f5e0029ce37546989a4aaf4f2eeb diff --git a/zlib b/zlib index 15c45ad..643e17b 160000 --- a/zlib +++ b/zlib @@ -1 +1 @@ -Subproject commit 15c45adb76e81a7e3a8a9e17b2a56eb90f668f44 +Subproject commit 643e17b7498d12ab8d15565662880579692f769d