make some of the code prettier
This commit is contained in:
parent
e668fd23f8
commit
ab94cc51a2
@ -4,4 +4,8 @@ class ExtendedCertificate {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static mcpe::string (*ExtendedCertificate_getIdentityName)(ExtendedCertificate*);
|
static mcpe::string (*ExtendedCertificate_getIdentityName)(ExtendedCertificate*);
|
||||||
|
|
||||||
|
static mcpe::string getIdentityName(ExtendedCertificate* cert) {
|
||||||
|
return ExtendedCertificate_getIdentityName(cert);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace {
|
namespace mce {
|
||||||
|
|
||||||
inline uint64_t fnv1a_64(const std::string& s) {
|
inline uint64_t fnv1a_64(const std::string& s) {
|
||||||
uint64_t hash = 14695981039346656037ULL;
|
uint64_t hash = 14695981039346656037ULL;
|
||||||
@ -16,10 +16,6 @@ inline uint64_t fnv1a_64(const std::string& s) {
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace mce {
|
|
||||||
|
|
||||||
class UUID {
|
class UUID {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -15,21 +14,23 @@ extern "C" {
|
|||||||
#include "../hybris/include/hybris/dlfcn.h"
|
#include "../hybris/include/hybris/dlfcn.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string rootPath = "";
|
static std::string g_rootPath;
|
||||||
|
|
||||||
std::string getRootPath() {
|
std::string getRootPath() {
|
||||||
char resolved[PATH_MAX];
|
if (g_rootPath.empty())
|
||||||
const char* input = rootPath.empty() ? "." : rootPath.c_str();
|
setRootPath("");
|
||||||
|
if (!g_rootPath.empty() && g_rootPath.back() != '/')
|
||||||
if (realpath(input, resolved) == nullptr) {
|
g_rootPath += '/';
|
||||||
getcwd(resolved, PATH_MAX);
|
return g_rootPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string result(resolved);
|
void setRootPath(const std::string& path) {
|
||||||
if (!result.empty() && result.back() != '/')
|
char buf[PATH_MAX] = {0};
|
||||||
result += '/';
|
if (path.empty()) {
|
||||||
|
g_rootPath = getcwd(buf, sizeof(buf)) ? buf : ".";
|
||||||
return result;
|
} else {
|
||||||
|
g_rootPath = realpath(path.c_str(), buf) ? buf : path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loadLibrary(std::string path) {
|
bool loadLibrary(std::string path) {
|
||||||
|
|||||||
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
extern std::string rootPath;
|
|
||||||
|
|
||||||
std::string getRootPath();
|
std::string getRootPath();
|
||||||
|
void setRootPath(const std::string& path);
|
||||||
bool loadLibrary(std::string path);
|
bool loadLibrary(std::string path);
|
||||||
void* loadLibraryOS(std::string path, const char** symbols);
|
void* loadLibraryOS(std::string path, const char** symbols);
|
||||||
void* loadMod(std::string path);
|
void* loadMod(std::string path);
|
||||||
|
|||||||
43
src/main.cpp
43
src/main.cpp
@ -1,14 +1,15 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <cstring>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <codecvt>
|
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
#include <codecvt>
|
||||||
|
#include <cstring>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include "gles_symbols.h"
|
#include "gles_symbols.h"
|
||||||
#include "android_symbols.h"
|
#include "android_symbols.h"
|
||||||
#include "egl_symbols.h"
|
#include "egl_symbols.h"
|
||||||
@ -34,12 +35,15 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
#include <eglut.h>
|
#include <eglut.h>
|
||||||
|
|
||||||
#include "../hybris/include/hybris/dlfcn.h"
|
#include "../hybris/include/hybris/dlfcn.h"
|
||||||
#include "../hybris/include/hybris/hook.h"
|
#include "../hybris/include/hybris/hook.h"
|
||||||
#include "../hybris/src/jb/linker.h"
|
#include "../hybris/src/jb/linker.h"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
void androidStub() {
|
void androidStub() {
|
||||||
std::cout << "warn: android call\n";
|
std::cout << "warn: android call\n";
|
||||||
}
|
}
|
||||||
@ -82,7 +86,6 @@ void abortLinuxHttpRequestInternal(LinuxHttpRequestInternal* requestInternal) {
|
|||||||
// TODO: Implement it
|
// TODO: Implement it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static MinecraftGame* client;
|
static MinecraftGame* client;
|
||||||
|
|
||||||
int winId = 0;
|
int winId = 0;
|
||||||
@ -209,13 +212,13 @@ void pshufb_xmm4_xmm0();
|
|||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
bool enableStackTracePrinting = true;
|
bool enableStackTracePrinting = true;
|
||||||
bool workaroundAMD = false;
|
bool workaroundAMD = false;
|
||||||
|
|
||||||
int windowWidth = 720;
|
int windowWidth = 720;
|
||||||
int windowHeight = 480;
|
int windowHeight = 480;
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
if (strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--scale") == 0) {
|
if (strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--scale") == 0) {
|
||||||
i++;
|
i++;
|
||||||
@ -226,9 +229,9 @@ int main(int argc, char *argv[]) {
|
|||||||
} else if (strcmp(argv[i], "-sw") == 0 || strcmp(argv[i], "--width") == 0) {
|
} else if (strcmp(argv[i], "-sw") == 0 || strcmp(argv[i], "--width") == 0) {
|
||||||
i++;
|
i++;
|
||||||
windowWidth = std::stoi(argv[i]);
|
windowWidth = std::stoi(argv[i]);
|
||||||
} else if (strcmp(argv[i], "-r") == 0 || strcmp(argv[i], "--root-path") == 0) {
|
} else if (strcmp(argv[i], "-r") == 0 || strcmp(argv[i], "--root-dir") == 0) {
|
||||||
i++;
|
i++;
|
||||||
rootPath = argv[i];
|
setRootPath(argv[i]);
|
||||||
} else if (strcmp(argv[i], "-ns") == 0 || strcmp(argv[i], "--no-stacktrace") == 0) {
|
} else if (strcmp(argv[i], "-ns") == 0 || strcmp(argv[i], "--no-stacktrace") == 0) {
|
||||||
enableStackTracePrinting = false;
|
enableStackTracePrinting = false;
|
||||||
} else if (strcmp(argv[i], "--pocket-guis") == 0) {
|
} else if (strcmp(argv[i], "--pocket-guis") == 0) {
|
||||||
@ -239,7 +242,7 @@ int main(int argc, char *argv[]) {
|
|||||||
} else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
|
} else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
|
||||||
std::cout << "Help\n";
|
std::cout << "Help\n";
|
||||||
std::cout << "--help Shows this help information\n";
|
std::cout << "--help Shows this help information\n";
|
||||||
std::cout << "--root-path Sets the root path for game data\n";
|
std::cout << "--root-dir Sets the root path for game data\n";
|
||||||
std::cout << "--scale <scale> Sets the pixel scale\n";
|
std::cout << "--scale <scale> Sets the pixel scale\n";
|
||||||
std::cout << "--width <width> Sets the window width\n";
|
std::cout << "--width <width> Sets the window width\n";
|
||||||
std::cout << "--height <height> Sets the window height\n";
|
std::cout << "--height <height> Sets the window height\n";
|
||||||
@ -277,11 +280,11 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
if (!loadLibrary("libc.so") || !loadLibrary("libstdc++.so") || !loadLibrary("libm.so") || !loadLibrary("libz.so"))
|
if (!loadLibrary("libc.so") || !loadLibrary("libstdc++.so") || !loadLibrary("libm.so") || !loadLibrary("libz.so"))
|
||||||
return -1;
|
return -1;
|
||||||
// load stub libraries
|
|
||||||
if (!loadLibrary("libandroid.so") || !loadLibrary("liblog.so") || !loadLibrary("libEGL.so") || !loadLibrary("libGLESv2.so") || !loadLibrary("libOpenSLES.so") || !loadLibrary("libfmod.so") || !loadLibrary("libGLESv1_CM.so"))
|
if (!loadLibrary("libandroid.so") || !loadLibrary("liblog.so") || !loadLibrary("libEGL.so") || !loadLibrary("libGLESv2.so") || !loadLibrary("libOpenSLES.so") || !loadLibrary("libfmod.so") || !loadLibrary("libGLESv1_CM.so"))
|
||||||
return -1;
|
return -1;
|
||||||
if (!loadLibrary("libmcpelauncher_mod.so"))
|
if (!loadLibrary("libmcpelauncher_mod.so"))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
std::cout << "loading MCPE\n";
|
std::cout << "loading MCPE\n";
|
||||||
std::string mcpePath = getRootPath() + "libs/libminecraftpe.so";
|
std::string mcpePath = getRootPath() + "libs/libminecraftpe.so";
|
||||||
void* handle = hybris_dlopen(mcpePath.c_str(), RTLD_LAZY);
|
void* handle = hybris_dlopen(mcpePath.c_str(), RTLD_LAZY);
|
||||||
@ -319,19 +322,6 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
std::cout << "apply patches\n";
|
std::cout << "apply patches\n";
|
||||||
|
|
||||||
/*
|
|
||||||
unsigned int patchOff = (unsigned int) hybris_dlsym(handle, "_ZN12StoreFactory11createStoreER13StoreListener") + 66;
|
|
||||||
patchCallInstruction((void*) patchOff, (void*) &createStoreHookFunc, false);
|
|
||||||
|
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN11HTTPRequestC2ERKSs") + 154;
|
|
||||||
patchCallInstruction((void*) patchOff, (void*) &constructLinuxHttpRequestInternal, false);
|
|
||||||
|
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN11HTTPRequest4sendEv") + 26;
|
|
||||||
patchCallInstruction((void*) patchOff, (void*) &sendLinuxHttpRequestInternal, false);
|
|
||||||
|
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN11HTTPRequest5abortEv") + 26;
|
|
||||||
patchCallInstruction((void*) patchOff, (void*) &abortLinuxHttpRequestInternal, false);
|
|
||||||
*/
|
|
||||||
unsigned int patchOff = (unsigned int) hybris_dlsym(handle, "_ZN12AndroidStore21createGooglePlayStoreERKSsR13StoreListener");
|
unsigned int patchOff = (unsigned int) hybris_dlsym(handle, "_ZN12AndroidStore21createGooglePlayStoreERKSsR13StoreListener");
|
||||||
patchCallInstruction((void*) patchOff, (void*) &createStoreHookFunc, true);
|
patchCallInstruction((void*) patchOff, (void*) &createStoreHookFunc, true);
|
||||||
|
|
||||||
@ -369,11 +359,7 @@ int main(int argc, char *argv[]) {
|
|||||||
linuxHttpRequestInternalVtable[0] = (void*) &LinuxHttpRequestInternal::destroy;
|
linuxHttpRequestInternalVtable[0] = (void*) &LinuxHttpRequestInternal::destroy;
|
||||||
linuxHttpRequestInternalVtable[1] = (void*) &LinuxHttpRequestInternal::destroy;
|
linuxHttpRequestInternalVtable[1] = (void*) &LinuxHttpRequestInternal::destroy;
|
||||||
|
|
||||||
if (workaroundAMD) {/*
|
if (workaroundAMD) {
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN21BlockTessallatorCache5resetER11BlockSourceRK8BlockPos") +
|
|
||||||
(0x40AD97 - 0x40ACD0);
|
|
||||||
for (unsigned int i = 0; i < 0x40ADA0 - 0x40AD97; i++)
|
|
||||||
((char *) (void *) patchOff)[i] = 0x90;*/
|
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN21BlockTessallatorCache5resetER11BlockSourceRK8BlockPos") + (0x40AD9B - 0x40ACD0);
|
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN21BlockTessallatorCache5resetER11BlockSourceRK8BlockPos") + (0x40AD9B - 0x40ACD0);
|
||||||
patchCallInstruction((void*) patchOff, (void*) &pshufb_xmm4_xmm0, false);
|
patchCallInstruction((void*) patchOff, (void*) &pshufb_xmm4_xmm0, false);
|
||||||
}
|
}
|
||||||
@ -460,7 +446,6 @@ int main(int argc, char *argv[]) {
|
|||||||
std::cout << "initialized display\n";
|
std::cout << "initialized display\n";
|
||||||
|
|
||||||
// init
|
// init
|
||||||
//(*AppPlatform::_singleton)->_fireAppFocusGained();
|
|
||||||
client->setRenderingSize(windowWidth, windowHeight);
|
client->setRenderingSize(windowWidth, windowHeight);
|
||||||
client->setUISizeAndScale(windowWidth, windowHeight, pixelSize);
|
client->setUISizeAndScale(windowWidth, windowHeight, pixelSize);
|
||||||
eglutMainLoop();
|
eglutMainLoop();
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <chrono>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <memory>
|
||||||
|
#include <chrono>
|
||||||
|
#include <cstring>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include "gles_symbols.h"
|
#include "gles_symbols.h"
|
||||||
#include "android_symbols.h"
|
#include "android_symbols.h"
|
||||||
#include "egl_symbols.h"
|
#include "egl_symbols.h"
|
||||||
@ -34,59 +35,54 @@
|
|||||||
#include "../mcpe/ExtendedCertificate.h"
|
#include "../mcpe/ExtendedCertificate.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
#include "../hybris/include/hybris/dlfcn.h"
|
#include "../hybris/include/hybris/dlfcn.h"
|
||||||
#include "../hybris/include/hybris/hook.h"
|
#include "../hybris/include/hybris/hook.h"
|
||||||
#include "../hybris/src/jb/linker.h"
|
#include "../hybris/src/jb/linker.h"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
void stubFunc() {}
|
void stubFunc() {}
|
||||||
|
|
||||||
void detachFromJavaStub() {
|
|
||||||
std::cout << "detach from java\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
void* getJVMEnvStub() {
|
void* getJVMEnvStub() {
|
||||||
std::cout << "getjvmenv\n";
|
std::cout << "getjvmenv\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getDifficultyStub() {
|
int getDifficulty() {
|
||||||
return ServerProperties::instance().getInt("difficulty", 0);
|
return ServerProperties::instance().getInt("difficulty", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getGameTypeStub() {
|
int getGameMode() {
|
||||||
return ServerProperties::instance().getInt("gamemode", 0);
|
return ServerProperties::instance().getInt("gamemode", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleTextPacketStub() {
|
void suppressChatHandling() {
|
||||||
std::cout << "chat message\n";
|
std::cout << "chat message\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
mce::UUID getIdentityStub(ExtendedCertificate* cert) {
|
mce::UUID getOfflineIdentity(ExtendedCertificate* cert) {
|
||||||
mcpe::string name = ExtendedCertificate::ExtendedCertificate_getIdentityName(cert);
|
mcpe::string name = ExtendedCertificate::getIdentityName(cert);
|
||||||
return mce::UUID::fromText(std::string(name.c_str()));
|
return mce::UUID::fromText(std::string(name.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
if ((strcmp(argv[i], "-r") == 0 || strcmp(argv[i], "--root-path") == 0) && i + 1 < argc) {
|
if ((strcmp(argv[i], "-r") == 0 || strcmp(argv[i], "--root-dir") == 0) && i + 1 < argc) {
|
||||||
rootPath = argv[i + 1];
|
setRootPath(argv[i+1]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rootPath.empty()) {
|
|
||||||
|
if (getRootPath().empty()) {
|
||||||
std::cout << "[*] No root path set, the current directory will be used to store game data\n";
|
std::cout << "[*] No root path set, the current directory will be used to store game data\n";
|
||||||
std::cout << "[*] It is recommended to set one by using the `--root-path` argument\n";
|
std::cout << "[*] It is recommended to set one by using the `--root-dir` argument\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// load properties
|
// load properties
|
||||||
std::ifstream propertiesFile(getRootPath() + "server.properties");
|
std::ifstream properties(getRootPath() + "server.properties");
|
||||||
if (propertiesFile) {
|
if (properties) {
|
||||||
ServerProperties::instance().load(propertiesFile);
|
ServerProperties::instance().load(properties);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "[!] No server.properties file found, cannot continue\n";
|
std::cerr << "[!] No server.properties file found, cannot continue\n";
|
||||||
return 1;
|
return 1;
|
||||||
@ -111,11 +107,11 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
if (!loadLibrary("libc.so") || !loadLibrary("libstdc++.so") || !loadLibrary("libm.so") || !loadLibrary("libz.so"))
|
if (!loadLibrary("libc.so") || !loadLibrary("libstdc++.so") || !loadLibrary("libm.so") || !loadLibrary("libz.so"))
|
||||||
return -1;
|
return -1;
|
||||||
// load stub libraries
|
|
||||||
if (!loadLibrary("libandroid.so") || !loadLibrary("liblog.so") || !loadLibrary("libEGL.so") || !loadLibrary("libGLESv2.so") || !loadLibrary("libOpenSLES.so") || !loadLibrary("libfmod.so") || !loadLibrary("libGLESv1_CM.so"))
|
if (!loadLibrary("libandroid.so") || !loadLibrary("liblog.so") || !loadLibrary("libEGL.so") || !loadLibrary("libGLESv2.so") || !loadLibrary("libOpenSLES.so") || !loadLibrary("libfmod.so") || !loadLibrary("libGLESv1_CM.so"))
|
||||||
return -1;
|
return -1;
|
||||||
if (!loadLibrary("libmcpelauncher_mod.so"))
|
if (!loadLibrary("libmcpelauncher_mod.so"))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
std::cout << "loading MCPE\n";
|
std::cout << "loading MCPE\n";
|
||||||
std::string mcpePath = getRootPath() + "libs/libminecraftpe.so";
|
std::string mcpePath = getRootPath() + "libs/libminecraftpe.so";
|
||||||
void* handle = hybris_dlopen(mcpePath.c_str(), RTLD_LAZY);
|
void* handle = hybris_dlopen(mcpePath.c_str(), RTLD_LAZY);
|
||||||
@ -127,11 +123,10 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
unsigned int libBase = ((soinfo*) handle)->base;
|
unsigned int libBase = ((soinfo*) handle)->base;
|
||||||
std::cout << "loaded MCPE (at " << libBase << ")\n";
|
std::cout << "loaded MCPE (at " << libBase << ")\n";
|
||||||
|
|
||||||
std::cout << "apply patches\n";
|
std::cout << "apply patches\n";
|
||||||
|
|
||||||
unsigned int patchOff = (unsigned int) hybris_dlsym(handle, "_ZN9crossplat10threadpool16detach_from_javaEPv");
|
unsigned int patchOff = (unsigned int) hybris_dlsym(handle, "_ZN9crossplat10threadpool16detach_from_javaEPv");
|
||||||
patchCallInstruction((void*) patchOff, (void*) &detachFromJavaStub, true);
|
patchCallInstruction((void*) patchOff, (void*) &stubFunc, true);
|
||||||
|
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN9crossplat11get_jvm_envEv");
|
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN9crossplat11get_jvm_envEv");
|
||||||
patchCallInstruction((void*) patchOff, (void*) &getJVMEnvStub, true);
|
patchCallInstruction((void*) patchOff, (void*) &getJVMEnvStub, true);
|
||||||
@ -141,13 +136,13 @@ int main(int argc, char *argv[]) {
|
|||||||
// at this point it's easier to just do this than spend 3 more days debugging
|
// at this point it's easier to just do this than spend 3 more days debugging
|
||||||
|
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZNK5Level13getDifficultyEv");
|
patchOff = (unsigned int) hybris_dlsym(handle, "_ZNK5Level13getDifficultyEv");
|
||||||
patchCallInstruction((void*) patchOff, (void*) &getDifficultyStub, true);
|
patchCallInstruction((void*) patchOff, (void*) &getDifficulty, true);
|
||||||
|
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZNK9LevelData11getGameTypeEv");
|
patchOff = (unsigned int) hybris_dlsym(handle, "_ZNK9LevelData11getGameTypeEv");
|
||||||
patchCallInstruction((void*) patchOff, (void*) &getGameTypeStub, true);
|
patchCallInstruction((void*) patchOff, (void*) &getGameMode, true);
|
||||||
|
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN20ServerNetworkHandler6handleERK17NetworkIdentifierRK10TextPacket");
|
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN20ServerNetworkHandler6handleERK17NetworkIdentifierRK10TextPacket");
|
||||||
patchCallInstruction((void*) patchOff, (void*) &handleTextPacketStub, true);
|
patchCallInstruction((void*) patchOff, (void*) &suppressChatHandling, true);
|
||||||
|
|
||||||
// murdle: this is a patch to make player data save via your username
|
// murdle: this is a patch to make player data save via your username
|
||||||
// this makes it easy to just switch devices and have the same inventory and position
|
// this makes it easy to just switch devices and have the same inventory and position
|
||||||
@ -155,7 +150,7 @@ int main(int argc, char *argv[]) {
|
|||||||
bool onlineMode = ServerProperties::instance().getBool("online-mode", false);
|
bool onlineMode = ServerProperties::instance().getBool("online-mode", false);
|
||||||
if (!onlineMode) {
|
if (!onlineMode) {
|
||||||
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN19ExtendedCertificate11getIdentityERK11Certificate");
|
patchOff = (unsigned int) hybris_dlsym(handle, "_ZN19ExtendedCertificate11getIdentityERK11Certificate");
|
||||||
patchCallInstruction((void*) patchOff, (void*) &getIdentityStub, true);
|
patchCallInstruction((void*) patchOff, (void*) &getOfflineIdentity, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
mcpe::string::empty = (mcpe::string*) hybris_dlsym(handle, "_ZN4Util12EMPTY_STRINGE");
|
mcpe::string::empty = (mcpe::string*) hybris_dlsym(handle, "_ZN4Util12EMPTY_STRINGE");
|
||||||
@ -198,26 +193,28 @@ int main(int argc, char *argv[]) {
|
|||||||
((void*&) AppResourceLoader::AppResourceLoader_construct) = hybris_dlsym(handle, "_ZN17AppResourceLoaderC2ESt8functionIFSsvEE");
|
((void*&) AppResourceLoader::AppResourceLoader_construct) = hybris_dlsym(handle, "_ZN17AppResourceLoaderC2ESt8functionIFSsvEE");
|
||||||
|
|
||||||
((void*&) PackManifestFactory::PackManifestFactory_construct) = hybris_dlsym(handle, "_ZN19PackManifestFactoryC2ER17MinecraftEventing");
|
((void*&) PackManifestFactory::PackManifestFactory_construct) = hybris_dlsym(handle, "_ZN19PackManifestFactoryC2ER17MinecraftEventing");
|
||||||
|
|
||||||
((void*&) ResourcePackManager::ResourcePackManager_construct) = hybris_dlsym(handle, "_ZN19ResourcePackManagerC2ESt8functionIFSsvEE");
|
((void*&) ResourcePackManager::ResourcePackManager_construct) = hybris_dlsym(handle, "_ZN19ResourcePackManagerC2ESt8functionIFSsvEE");
|
||||||
((void*&) ResourcePackManager::ResourcePackManager_setStack) = hybris_dlsym(handle, "_ZN19ResourcePackManager8setStackESt10unique_ptrI17ResourcePackStackSt14default_deleteIS1_EE21ResourcePackStackTypeb");
|
((void*&) ResourcePackManager::ResourcePackManager_setStack) = hybris_dlsym(handle, "_ZN19ResourcePackManager8setStackESt10unique_ptrI17ResourcePackStackSt14default_deleteIS1_EE21ResourcePackStackTypeb");
|
||||||
|
|
||||||
((void*&) ResourcePackStack::vtable_sym) = hybris_dlsym(handle, "_ZTV17ResourcePackStack");
|
|
||||||
((void*&) ResourcePackStack::ResourcePackStack_add) = hybris_dlsym(handle, "_ZN17ResourcePackStack3addEP12ResourcePackRK22ResourcePackRepositoryb");
|
|
||||||
((void*&) ResourcePackRepository::ResourcePackRepository_construct) = hybris_dlsym(handle, "_ZN22ResourcePackRepositoryC2ER17MinecraftEventingR19PackManifestFactoryP18EntitlementManagerP15FilePathManager");
|
((void*&) ResourcePackRepository::ResourcePackRepository_construct) = hybris_dlsym(handle, "_ZN22ResourcePackRepositoryC2ER17MinecraftEventingR19PackManifestFactoryP18EntitlementManagerP15FilePathManager");
|
||||||
|
|
||||||
|
((void*&) ResourcePackStack::ResourcePackStack_add) = hybris_dlsym(handle, "_ZN17ResourcePackStack3addEP12ResourcePackRK22ResourcePackRepositoryb");
|
||||||
|
((void*&) ResourcePackStack::vtable_sym) = hybris_dlsym(handle, "_ZTV17ResourcePackStack");
|
||||||
|
|
||||||
((void*&) ServerInstance::ServerInstance_construct) = hybris_dlsym(handle, "_ZN14ServerInstanceC2ER13IMinecraftAppRK9WhitelistRK7OpsListP15FilePathManagerNSt6chrono8durationIxSt5ratioILx1ELx1EEEESsSsSsSsSs13LevelSettingsRN9minecraft3api3ApiEibiiibRKSt6vectorISsSaISsEESsbRKN3mce4UUIDER17MinecraftEventingR22ResourcePackRepositoryR19ResourcePackManagerPSX_");
|
((void*&) ServerInstance::ServerInstance_construct) = hybris_dlsym(handle, "_ZN14ServerInstanceC2ER13IMinecraftAppRK9WhitelistRK7OpsListP15FilePathManagerNSt6chrono8durationIxSt5ratioILx1ELx1EEEESsSsSsSsSs13LevelSettingsRN9minecraft3api3ApiEibiiibRKSt6vectorISsSaISsEESsbRKN3mce4UUIDER17MinecraftEventingR22ResourcePackRepositoryR19ResourcePackManagerPSX_");
|
||||||
((void*&) ServerInstance::ServerInstance_update) = hybris_dlsym(handle, "_ZN14ServerInstance6updateEv");
|
((void*&) ServerInstance::ServerInstance_update) = hybris_dlsym(handle, "_ZN14ServerInstance6updateEv");
|
||||||
|
|
||||||
((void*&) Scheduler::singleton) = hybris_dlsym(handle, "_ZN9Scheduler9singletonEv");
|
|
||||||
((void*&) Scheduler::Scheduler_processCoroutines) = hybris_dlsym(handle, "_ZN9Scheduler17processCoroutinesEd");
|
((void*&) Scheduler::Scheduler_processCoroutines) = hybris_dlsym(handle, "_ZN9Scheduler17processCoroutinesEd");
|
||||||
|
((void*&) Scheduler::singleton) = hybris_dlsym(handle, "_ZN9Scheduler9singletonEv");
|
||||||
|
|
||||||
std::cout << "init app platform vtable\n";
|
std::cout << "init app platform vtable\n";
|
||||||
LinuxAppPlatform::initVtable(handle);
|
LinuxAppPlatform::initVtable(handle);
|
||||||
|
|
||||||
std::cout << "init app platform\n";
|
std::cout << "init app platform\n";
|
||||||
LinuxAppPlatform* platform = new LinuxAppPlatform();
|
LinuxAppPlatform* platform = new LinuxAppPlatform();
|
||||||
std::cout << "app platform initialized\n";
|
|
||||||
|
|
||||||
platform->initialize();
|
platform->initialize();
|
||||||
|
std::cout << "app platform initialized\n";
|
||||||
|
|
||||||
Whitelist whitelist;
|
Whitelist whitelist;
|
||||||
OpsList ops;
|
OpsList ops;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user