Remove need for abiproxy
This commit is contained in:
parent
66fb104858
commit
4ec638c579
|
@ -65,16 +65,6 @@ target_link_libraries(${TARGET_NAME} PRIVATE dobby)
|
|||
target_link_libraries(${TARGET_NAME} PRIVATE nlohmann_json::nlohmann_json)
|
||||
|
||||
|
||||
if (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/abiproxy/build/armeabi-v7a/libabiproxy.so)
|
||||
message(STATUS "Linking for armeabi-v7a")
|
||||
endif (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
|
||||
|
||||
if (CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a")
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/abiproxy/build/arm64-v8a/libabiproxy.so)
|
||||
message(STATUS "Linking for arm64-v8a")
|
||||
endif (CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a")
|
||||
|
||||
macro(SET_OPTION option value)
|
||||
set(${option} ${value} CACHE INTERNAL "" FORCE)
|
||||
endmacro()
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
# CMakeList.txt : CMake project for AbiProxy, include source and define
|
||||
# project specific logic here.
|
||||
#
|
||||
#set(CMAKE_CXX_STANDARD 11)
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
|
||||
project ("AbiProxy")
|
||||
set(TARGET_NAME abiproxy)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fvisibility=hidden -fvisibility-inlines-hidden -g0 -O3 -ffunction-sections -fdata-sections")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=hidden -fvisibility-inlines-hidden -g0 -O3 -ffunction-sections -fdata-sections")
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../lib/cocos
|
||||
)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
link_libraries("-Wl,--strip-all")
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
|
||||
add_library( # Sets the name of the library.
|
||||
${TARGET_NAME}
|
||||
# Sets the library as a shared library.
|
||||
SHARED
|
||||
|
||||
# Provides a relative path to your source file(s).
|
||||
"src/magia/StringsProxy.cc"
|
||||
"src/magia/DialogueBox.cc")
|
||||
|
||||
find_library(ANDROID_LOG_LIB log)
|
||||
target_link_libraries(${TARGET_NAME} ${ANDROID_LOG_LIB})
|
||||
|
||||
macro(SET_OPTION option value)
|
||||
set(${option} ${value} CACHE INTERNAL "" FORCE)
|
||||
endmacro()
|
|
@ -1,40 +0,0 @@
|
|||
@echo off
|
||||
|
||||
:start
|
||||
set ndk="C:/Android/android-ndk-r21d/"
|
||||
set /p ndk="Enter ndk Location [C:/Android/android-ndk-r21d/]: "
|
||||
|
||||
if not exist %~dp0\build mkdir %~dp0\build
|
||||
|
||||
:build
|
||||
echo Building libraries.
|
||||
|
||||
rmdir /S /Q %~dp0\build\armeabi-v7a\
|
||||
rmdir /S /Q %~dp0\build\arm64-v8a\
|
||||
mkdir %~dp0\build\armeabi-v7a
|
||||
mkdir %~dp0\build\arm64-v8a
|
||||
|
||||
echo Running cmake armeabi-v7a...
|
||||
|
||||
cd %~dp0\build\armeabi-v7a
|
||||
call "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G Ninja -DANDROID_ABI="armeabi-v7a" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="%~dp0\build\armeabi-v7a" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="%ndk%/build/cmake/android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM:FILEPATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "-DANDROID_PLATFORM=21" "-DCMAKE_SYSTEM_NAME=Android" "-DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a" "-DCMAKE_ANDROID_NDK=%ndk%" "-DCMAKE_SYSTEM_VERSION=16" "-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang" "%~dp0\"
|
||||
if errorlevel 1 goto errorexit
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe"
|
||||
if errorlevel 1 goto errorexit
|
||||
|
||||
echo Running cmake arm64-v8a...
|
||||
cd %~dp0\build\arm64-v8a
|
||||
call "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G Ninja -DANDROID_ABI="arm64-v8a" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="%~dp0\build\arm64-v8a" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="%ndk%/build/cmake/android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM:FILEPATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "-DANDROID_PLATFORM=21" "-DCMAKE_SYSTEM_NAME=Android" "-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a" "-DCMAKE_ANDROID_NDK=%ndk%" "-DCMAKE_SYSTEM_VERSION=16" "-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang" "%~dp0\"
|
||||
if errorlevel 1 goto errorexit
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe"
|
||||
if errorlevel 1 goto errorexit
|
||||
|
||||
echo Successful.
|
||||
goto :exit
|
||||
|
||||
:errorexit
|
||||
echo An error has occurred, exiting.
|
||||
goto exit
|
||||
|
||||
:exit
|
||||
pause
|
|
@ -1,40 +0,0 @@
|
|||
@echo off
|
||||
|
||||
:start
|
||||
set ndk="C:/Android/android-ndk-r21d/"
|
||||
set /p ndk="Enter ndk Location [C:/Android/android-ndk-r21d/]: "
|
||||
|
||||
if not exist %~dp0\build mkdir %~dp0\build
|
||||
|
||||
:build
|
||||
echo Building libraries.
|
||||
|
||||
rmdir /S /Q %~dp0\build\armeabi-v7a\
|
||||
rmdir /S /Q %~dp0\build\arm64-v8a\
|
||||
mkdir %~dp0\build\armeabi-v7a
|
||||
mkdir %~dp0\build\arm64-v8a
|
||||
|
||||
echo Running cmake armeabi-v7a...
|
||||
|
||||
cd %~dp0\build\armeabi-v7a
|
||||
call "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G Ninja -DANDROID_ABI="armeabi-v7a" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_INSTALL_PREFIX:PATH="%~dp0\build\armeabi-v7a" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="%ndk%/build/cmake/android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM:FILEPATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "-DANDROID_PLATFORM=21" "-DCMAKE_SYSTEM_NAME=Android" "-DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a" "-DCMAKE_ANDROID_NDK=%ndk%" "-DCMAKE_SYSTEM_VERSION=16" "-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang" "%~dp0\"
|
||||
if errorlevel 1 goto errorexit
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe"
|
||||
if errorlevel 1 goto errorexit
|
||||
|
||||
echo Running cmake arm64-v8a...
|
||||
cd %~dp0\build\arm64-v8a
|
||||
call "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G Ninja -DANDROID_ABI="arm64-v8a" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_INSTALL_PREFIX:PATH="%~dp0\build\arm64-v8a" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="%ndk%/build/cmake/android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM:FILEPATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "-DANDROID_PLATFORM=21" "-DCMAKE_SYSTEM_NAME=Android" "-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a" "-DCMAKE_ANDROID_NDK=%ndk%" "-DCMAKE_SYSTEM_VERSION=16" "-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang" "%~dp0\"
|
||||
if errorlevel 1 goto errorexit
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe"
|
||||
if errorlevel 1 goto errorexit
|
||||
|
||||
echo Successful.
|
||||
goto :exit
|
||||
|
||||
:errorexit
|
||||
echo An error has occurred, exiting.
|
||||
goto exit
|
||||
|
||||
:exit
|
||||
pause
|
|
@ -1,68 +0,0 @@
|
|||
#!/bin/bash
|
||||
BASEDIR="$(realpath "$(dirname "${0}")")"
|
||||
|
||||
# env-based
|
||||
CMAKE="${MT_CMAKE:-cmake}" # /usr/bin/cmake
|
||||
NINJA="${MT_NINJA:-ninja}" # /usr/bin/ninja
|
||||
|
||||
# arg-based
|
||||
NDK="${3:-${BASEDIR}/ndk/android-ndk-r21e}"
|
||||
TARCHS="${2:-"armeabi-v7a arm64-v8a"}"
|
||||
|
||||
_start() {
|
||||
[ -d "${NDK}" ] || _errorexit 6 "NDK directory does not exist! Tried path: ${NDK}"
|
||||
NDK=$(realpath "${NDK}")
|
||||
echo "Found ndk directory ${NDK}"
|
||||
|
||||
[ -f "${NDK}/build/cmake/android.toolchain.cmake" ] || _errorexit 7 "NDK is missing! Unpack it into ${NDK}"
|
||||
|
||||
mkdir -p "${BASEDIR}/build"
|
||||
_build
|
||||
}
|
||||
|
||||
_build() {
|
||||
echo "Building libraries."
|
||||
|
||||
for tarch in ${TARCHS}
|
||||
do
|
||||
rm -rf "${BASEDIR}/build/${tarch}"
|
||||
mkdir -p "${BASEDIR}/build/${tarch}"
|
||||
|
||||
echo "Running cmake ${tarch}..."
|
||||
cd "${BASEDIR}"
|
||||
${CMAKE} -G Ninja \
|
||||
-DANDROID_ABI="${tarch}" \
|
||||
-DCMAKE_BUILD_TYPE:STRING="Release" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="${BASEDIR}/build/${tarch}" \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH="${NDK}/build/cmake/android.toolchain.cmake" \
|
||||
-DCMAKE_MAKE_PROGRAM:FILEPATH="${NINJA}" \
|
||||
-DANDROID_PLATFORM="21" \
|
||||
-DCMAKE_SYSTEM_NAME="Android" \
|
||||
-DCMAKE_ANDROID_ARCH_ABI="${tarch}" \
|
||||
-DCMAKE_ANDROID_NDK="${NDK}" \
|
||||
-DCMAKE_SYSTEM_VERSION="16" \
|
||||
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION="clang" \
|
||||
"${BASEDIR}/"
|
||||
[ "$?" -ne "0" ] && _errorexit 1 "cmake failed for ${tarch}"
|
||||
${NINJA}
|
||||
[ "$?" -ne "0" ] && _errorexit 2 "ninja failed for ${tarch}"
|
||||
|
||||
[ -f "${BASEDIR}/libabiproxy.so" ] || _errorexit 3 "libabiproxy was not cmade for ${tarch}!"
|
||||
mv "${BASEDIR}/libabiproxy.so" "${BASEDIR}/build/${tarch}/libabiproxy.so"
|
||||
done
|
||||
|
||||
_exit
|
||||
}
|
||||
|
||||
_errorexit() {
|
||||
[ ! -z "$2" ] && echo "$2"
|
||||
echo "An error has occurred, exiting."
|
||||
exit ${1}
|
||||
}
|
||||
|
||||
_exit() {
|
||||
echo "Successful."
|
||||
exit 0
|
||||
}
|
||||
|
||||
_start
|
|
@ -1,39 +0,0 @@
|
|||
#include <cstdint>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <functional>
|
||||
#include "cocos/base/CCRef.h"
|
||||
#include "cocos2d.h"
|
||||
#include <android/log.h>
|
||||
#include "DialogueBox.h"
|
||||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, "MagiaHook", __VA_ARGS__)
|
||||
|
||||
typedef std::function<void(cocos2d::Ref*)> ccMenuCallback;
|
||||
typedef int *(*openMessageBoxType)(char const* title, char const* body, char const* button, const ccMenuCallback& callback, bool xButton);
|
||||
|
||||
__attribute__((visibility("default")))
|
||||
void DialogueBoxProxy::DialogueBox(void* dialogueBoxPointer) {
|
||||
LOGI("Called extern dialogue box");
|
||||
auto openMessageBoxFunc = reinterpret_cast<openMessageBoxType>(dialogueBoxPointer);
|
||||
|
||||
auto dontDisappear = std::bind(&DialogueBoxProxy::testCallback, this, std::placeholders::_1);
|
||||
|
||||
openMessageBoxFunc("Update required", "An update for Magia Translate is strongly recommended! 2", "OK",
|
||||
dontDisappear, false);
|
||||
//sleep(100);
|
||||
}
|
||||
|
||||
//void DialogueBoxProxy::motdBox(void * dialogueboxPointer, void * loadContinuePointer);
|
||||
|
||||
void DialogueBoxProxy::testCallback(cocos2d::Ref* sender) {
|
||||
LOGI("Recalled VALUE");
|
||||
}
|
||||
|
||||
__attribute__((visibility("default")))
|
||||
DialogueBoxProxy::DialogueBoxProxy() {
|
||||
|
||||
}
|
||||
__attribute__((visibility("default")))
|
||||
DialogueBoxProxy::~DialogueBoxProxy() {
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef __DIALOGUEBOX_H__
|
||||
#define __DIALOGUEBOX_H__
|
||||
#include <cstdint>
|
||||
#include "cocos/base/CCRef.h"
|
||||
|
||||
class DialogueBoxProxy {
|
||||
public:
|
||||
DialogueBoxProxy();
|
||||
virtual ~DialogueBoxProxy();
|
||||
virtual void DialogueBox(void* dialogueBoxPointer);
|
||||
virtual void testCallback(cocos2d::Ref* sender);
|
||||
private:
|
||||
std::function<void(cocos2d::Ref*)> dialogueCallback;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,39 +0,0 @@
|
|||
#include "StringsProxy.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*extern "C" StringsProxy* create_object(uintptr_t str)
|
||||
{
|
||||
return new StringsProxy(str);
|
||||
}
|
||||
extern "C" StringsProxy* create_object(const char* str)
|
||||
{
|
||||
return new StringsProxy(str);
|
||||
}
|
||||
|
||||
extern "C" void destroy_object( StringsProxy* object )
|
||||
{
|
||||
delete object;
|
||||
}*/
|
||||
__attribute__((visibility("default")))
|
||||
extern "C" StringsProxy::StringsProxy(const char* contents)
|
||||
{
|
||||
set_string = std::string(contents);
|
||||
}
|
||||
__attribute__((visibility("default")))
|
||||
extern "C" StringsProxy::StringsProxy(uintptr_t str) {
|
||||
set_string = *reinterpret_cast<proxy_string*>(str);
|
||||
}
|
||||
__attribute__((visibility("default")))
|
||||
extern "C" const char* StringsProxy::c_str() {
|
||||
return set_string.c_str();
|
||||
}
|
||||
__attribute__((visibility("default")))
|
||||
extern "C" const uintptr_t* StringsProxy::ptr() {
|
||||
return reinterpret_cast<uintptr_t *>(&set_string);
|
||||
}
|
||||
__attribute__((visibility("default")))
|
||||
extern "C" StringsProxy::~StringsProxy() {
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef __STRINGSPROXY_H__
|
||||
#define __STRINGSPROXY_H__
|
||||
#include <string>
|
||||
|
||||
typedef std::basic_string<char> proxy_string;
|
||||
|
||||
class StringsProxy
|
||||
{
|
||||
public:
|
||||
/* Initialize StringsProxy with a pointer to an existing string */
|
||||
|
||||
StringsProxy(uintptr_t str);
|
||||
/* Initialize StringsProxy with a new string */
|
||||
|
||||
StringsProxy(const char* str);
|
||||
/* Get C string */
|
||||
|
||||
virtual const char* c_str();
|
||||
/* Get pointer to string for injection */
|
||||
|
||||
const virtual uintptr_t* ptr();
|
||||
|
||||
virtual ~StringsProxy();
|
||||
private:
|
||||
proxy_string set_string;
|
||||
};
|
||||
#endif
|
|
@ -87,9 +87,7 @@ if errorlevel 1 goto errorexit
|
|||
|
||||
echo Copying libraries...
|
||||
call copy /Y %~dp0\build\armeabi-v7a\libuwasa.so %~dp0\build\app\lib\armeabi-v7a\libuwasa.so
|
||||
call copy /Y %~dp0\abiproxy\build\armeabi-v7a\libabiproxy.so %~dp0\build\app\lib\armeabi-v7a\libabiproxy.so
|
||||
call copy /Y %~dp0\build\arm64-v8a\libuwasa.so %~dp0\build\app\lib\arm64-v8a\libuwasa.so
|
||||
call copy /Y %~dp0\abiproxy\build\arm64-v8a\libabiproxy.so %~dp0\build\app\lib\arm64-v8a\libabiproxy.so
|
||||
|
||||
echo Rebuilding APK...
|
||||
call java -jar %~dp0\build\apktool_2.4.1.jar b %~dp0\build\app\ -o %~dp0\build\magia_patched.apk
|
||||
|
|
|
@ -87,9 +87,7 @@ if errorlevel 1 goto errorexit
|
|||
|
||||
echo Copying libraries...
|
||||
call copy /Y %~dp0\build\armeabi-v7a\libuwasa.so %~dp0\build\app\lib\armeabi-v7a\libuwasa.so
|
||||
call copy /Y %~dp0\abiproxy\build\armeabi-v7a\libabiproxy.so %~dp0\build\app\lib\armeabi-v7a\libabiproxy.so
|
||||
call copy /Y %~dp0\build\arm64-v8a\libuwasa.so %~dp0\build\app\lib\arm64-v8a\libuwasa.so
|
||||
call copy /Y %~dp0\abiproxy\build\arm64-v8a\libabiproxy.so %~dp0\build\app\lib\arm64-v8a\libabiproxy.so
|
||||
|
||||
echo Rebuilding APK...
|
||||
call java -jar %~dp0\build\apktool_2.4.1.jar b %~dp0\build\app\ -o %~dp0\build\magia_patched.apk
|
||||
|
|
|
@ -125,7 +125,6 @@ _build() {
|
|||
|
||||
echo "Copying libraries for ${tarch}..."
|
||||
cp "${BASEDIR}/build/${tarch}/libuwasa.so" "${BASEDIR}/build/app/lib/${tarch}/libuwasa.so"
|
||||
cp "${BASEDIR}/abiproxy/build/${tarch}/libabiproxy.so" "${BASEDIR}/build/app/lib/${tarch}/libabiproxy.so"
|
||||
done
|
||||
|
||||
echo "Rebuilding APK..."
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#include "Config.h"
|
||||
#include <cocos2d.h>
|
||||
#include "libmadomagi.h"
|
||||
#include "magia/StringsProxy.h"
|
||||
#include "magia/DialogueBox.h"
|
||||
#include "rest/MagiaRest.h"
|
||||
|
||||
const char* libName = "libmadomagi_native.so";
|
||||
|
@ -51,9 +49,9 @@ bool initialized = false;
|
|||
const std::string assetBase = "/magica/resource";
|
||||
const std::string assetTrunk = "/download/asset/master";
|
||||
const std::string assetScenario = "/resource/scenario";
|
||||
void* urlEndpoints[] = {nullptr, nullptr, nullptr};
|
||||
std::vector<std::string> urlEndpoints(3);
|
||||
|
||||
StringsProxy* koruriFont = new StringsProxy("fonts/koruri-semibold.ttf");
|
||||
const std::string koruriFont("fonts/koruri-semibold.ttf");
|
||||
|
||||
typedef int *(*setUrlType)(int *);
|
||||
typedef int *(*setResourceType)(int *, unsigned int *);
|
||||
|
@ -64,7 +62,7 @@ void *(*setPositionHooked)(uintptr_t label, cocos2d::Vec2 const& position);
|
|||
void *(*setMaxLineWidthHooked)(uintptr_t label, float length);
|
||||
void *(*setDimensionsHooked)(uintptr_t label, float width, float a3);
|
||||
|
||||
void *(*urlConfigResourceHooked)(void* a1, UrlConfigResourceType type); // There is also api, chat, web, etc for other endpoints
|
||||
std::string (*urlConfigResourceHooked)(void* a1, UrlConfigResourceType type); // There is also api, chat, web, etc for other endpoints
|
||||
|
||||
//void* urlConfig_ImplObj = nullptr;
|
||||
|
||||
|
@ -165,16 +163,15 @@ int *sceneLayerManagerCreateSceneLayer(uintptr_t *sceneLayerManager, BaseSceneLa
|
|||
const std::string assetNameFull = endpointUrl + assetBase + assetTrunk;
|
||||
const std::string assetNameScript = endpointUrl + assetBase + assetTrunk + assetScenario;
|
||||
|
||||
// new keyword to stop freeing
|
||||
StringsProxy* assetNameBaseProxy = new StringsProxy(assetNameBase.c_str());
|
||||
StringsProxy* assetNameFullProxy = new StringsProxy(assetNameFull.c_str());
|
||||
StringsProxy* assetNameScriptProxy = new StringsProxy(assetNameScript.c_str());
|
||||
//std::string assetNameBaseProxy(assetNameBase.c_str());
|
||||
//std::string assetNameFullProxy(assetNameFull.c_str());
|
||||
//std::string assetNameScriptProxy(assetNameScript.c_str());
|
||||
|
||||
LOGD("Setting endpoint URLs.");
|
||||
|
||||
urlEndpoints[UrlConfigResourceType::BaseUrl] = (void*)assetNameBaseProxy->ptr();
|
||||
urlEndpoints[UrlConfigResourceType::TrunkUrl] = (void*)assetNameFullProxy->ptr();
|
||||
urlEndpoints[UrlConfigResourceType::ScenarioUrl] = (void*)assetNameScriptProxy->ptr();
|
||||
urlEndpoints.at(UrlConfigResourceType::BaseUrl) = assetNameBase;
|
||||
urlEndpoints.at(UrlConfigResourceType::TrunkUrl) = assetNameFull;
|
||||
urlEndpoints.at(UrlConfigResourceType::ScenarioUrl) = assetNameScript;
|
||||
LOGD("Finished setting endpoint URLs.");
|
||||
break;
|
||||
}
|
||||
|
@ -190,22 +187,27 @@ int *sceneLayerManagerCreateSceneLayer(uintptr_t *sceneLayerManager, BaseSceneLa
|
|||
}
|
||||
|
||||
// Change function to fetch resource URLs
|
||||
void* urlConfigResource(void* a1, UrlConfigResourceType type) {
|
||||
std::string urlConfigResource(void* a1, UrlConfigResourceType type) {
|
||||
LOGD("Fetching URL config resource %d", (int)type);
|
||||
if (type < UrlConfigResourceType::UrlConfigResourceTypeMaxValue) {
|
||||
if (urlEndpoints[type] != nullptr) {
|
||||
return (void *)urlEndpoints[type];
|
||||
try {
|
||||
if (!urlEndpoints.at(type).empty()) {
|
||||
return urlEndpoints.at(type);
|
||||
}
|
||||
else {
|
||||
LOGW("Empty endpoint found for endpoint type %d!", (int)type);
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOGW("Nullptr endpoint found for endpoint type %d!", (int)type);
|
||||
catch (std::out_of_range const& exc) {
|
||||
LOGW("Out of range for endpoint type %d!", (int)type);
|
||||
}
|
||||
}
|
||||
return urlConfigResourceHooked(a1, type);
|
||||
}
|
||||
|
||||
|
||||
void* (*cocosCreateLabelHooked)(const uintptr_t* textPtr, const uintptr_t* fontPtr, float textSize, cocos2d::Size const& cocosSize, cocos2d::TextHAlignment hAlign, cocos2d::TextVAlignment vAlign);
|
||||
void* cocosCreateLabel(const uintptr_t* textPtr, const uintptr_t* fontPtr, float textSize, cocos2d::Size const& cocosSize, cocos2d::TextHAlignment hAlign, cocos2d::TextVAlignment vAlign) {
|
||||
void* (*cocosCreateLabelHooked)(const uintptr_t* textPtr, const std::string &fontPtr, float textSize, cocos2d::Size const& cocosSize, cocos2d::TextHAlignment hAlign, cocos2d::TextVAlignment vAlign);
|
||||
void* cocosCreateLabel(const uintptr_t* textPtr, const std::string &fontPtr, float textSize, cocos2d::Size const& cocosSize, cocos2d::TextHAlignment hAlign, cocos2d::TextVAlignment vAlign) {
|
||||
uintptr_t addr = reinterpret_cast<uintptr_t>(__builtin_extract_return_addr(__builtin_return_address(0)));
|
||||
LOGD("Label created at %p (%p), size %.1f.", (void*) addr, (void*)(addr - libBase), textSize);
|
||||
if (storyMessageUnitCreateMessageAreaOffset != 0 && addr >= storyMessageUnitCreateMessageAreaOffset) {
|
||||
|
@ -215,7 +217,7 @@ void* cocosCreateLabel(const uintptr_t* textPtr, const uintptr_t* fontPtr, float
|
|||
if (textSize == 27.0) {
|
||||
textSize = 30.0;
|
||||
}
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont->ptr(), textSize, cocosSize, hAlign, vAlign);
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont, textSize, cocosSize, hAlign, vAlign);
|
||||
}
|
||||
}
|
||||
if (storyNarrationUnitCreateLabelOffset != 0 && addr >= storyNarrationUnitCreateLabelOffset) {
|
||||
|
@ -223,7 +225,7 @@ void* cocosCreateLabel(const uintptr_t* textPtr, const uintptr_t* fontPtr, float
|
|||
|
||||
if (difference <= 0x200) { // 0x8e
|
||||
LOGD("Setting new narration text font. Difference: %p", (void*)difference);
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont->ptr(), textSize, cocosSize, hAlign, vAlign);
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont, textSize, cocosSize, hAlign, vAlign);
|
||||
}
|
||||
}
|
||||
if (initCenterWidthOutline != 0 && addr >= initCenterWidthOutline) {
|
||||
|
@ -232,7 +234,7 @@ void* cocosCreateLabel(const uintptr_t* textPtr, const uintptr_t* fontPtr, float
|
|||
if (difference <= 0x200) {
|
||||
LOGD("Setting new home text font and size.");
|
||||
textSize = textSize * 0.85;
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont->ptr(), textSize, cocosSize, hAlign, vAlign);
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont, textSize, cocosSize, hAlign, vAlign);
|
||||
}
|
||||
}
|
||||
if (storyLogUnitAddMessageOffset != 0 && addr >= storyLogUnitAddMessageOffset) {
|
||||
|
@ -240,14 +242,14 @@ void* cocosCreateLabel(const uintptr_t* textPtr, const uintptr_t* fontPtr, float
|
|||
|
||||
if (difference <= 0x640) { // 0xec, 0x54e
|
||||
LOGD("Setting new log text font. Difference: %p", (void*)difference);
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont->ptr(), textSize, cocosSize, hAlign, vAlign);
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont, textSize, cocosSize, hAlign, vAlign);
|
||||
}
|
||||
}
|
||||
if (storyLogUnitAddNarrationOffset != 0 && addr >= storyLogUnitAddNarrationOffset) {
|
||||
uintptr_t difference = addr - storyLogUnitAddNarrationOffset;
|
||||
if (difference <= 0x640) { // 0x43e, 0x5b0
|
||||
LOGD("Setting new log text font (narration). Difference: %p", (void*)difference);
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont->ptr(), textSize, cocosSize, hAlign, vAlign);
|
||||
return cocosCreateLabelHooked(textPtr, koruriFont, textSize, cocosSize, hAlign, vAlign);
|
||||
}
|
||||
}
|
||||
return cocosCreateLabelHooked(textPtr, fontPtr, textSize, cocosSize, hAlign, vAlign);
|
||||
|
@ -433,12 +435,11 @@ cocos2d::Size lbGetViewPositionNew(float x, float y) {
|
|||
}
|
||||
|
||||
|
||||
pthread_mutex_t *(*setUriDebugOld)(uintptr_t a1, uintptr_t st);
|
||||
pthread_mutex_t *setUriDebug(uintptr_t a1, uintptr_t stri) {
|
||||
pthread_mutex_t *(*setUriDebugOld)(uintptr_t a1, const std::string &st);
|
||||
pthread_mutex_t *setUriDebug(uintptr_t a1, const std::string &stri) {
|
||||
auto mut = setUriDebugOld(a1, stri);
|
||||
|
||||
auto y = StringsProxy(stri);
|
||||
auto outstr = y.c_str();
|
||||
auto outstr = stri.c_str();
|
||||
LOGI("Uri base set: %s", outstr);
|
||||
return mut;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue