* Feat: external runtime manager Currently missing: mmap hook * we're past this ui todo * feat: Bypass Library Validation (untested) This bypass works because of JIT enabled, so the process can patch anything loaded in the memory. Unsigned dylib works with JIT too. * Fix `could not get real path` on iOS 14.x iOS 15+ is untested, it may need patching in dyld instead of libSystem * Make redirectFunction syscall-friendly Replaced builtin_mprotect and vm_protect with a simple syscall to _kernelrpc_mach_vm_protect_trap * Add dyld hook back for iOS 15+, auto symlink xawt lib * Cleanup Tools.java:showError+comments Use System.exit(1) to drop to Game Exited screen instead of presenting alert dialog on exception handled. * Patch both to bypass codesigning at best * Proper way of ignoring SIGBUS during patch Turns out other background thread might also be calling inside dirty page, so let's SIG_IGN them all until page permission is back to RX. * Feat(install jar): auto detect java version Rename Default version to Preferred version to match the behavior or Install .jar detection: only override if selected version > required version. Add UnzipKit just to check jar file Refactor(showDialog): remove viewController parameter, now use its own ViewController to present. * Feat: update LWJGL to 3.3.1 (tinygl4angle) add alias for GL_KHR_debug functions Include nanovg for OneConfig mod Move all LWJGLX classes to lwjgl3 repo Set org.lwjgl.util.NoChecks=true to improve performance * Fix: Forge 1.20 crashes (wrong artifact path) Now use json-provided artifact path instead of generating one Make lwjgl fat jar again * Fix: handle null library artifact * Fix: fatal glfw callback cleanup * Build: fix copying LWJGL libraries * Perf: set default settings * Fix: incorrect SolClient useStackQueue check * Feat: builtin runtime installer Refactor parts of LauncherNavigationController.m Workaround(LogView): disable animation on update to mitigate overload * Fix: random game directory failures This is caused by having current working directory unchanged after re-making symlink. * Fixes: TL-style artifact, update arc_dns_injector Change pojavInit names * Fix: 1.13+ isUseStackQueueCall check * Build: update liblwjgl.dylib in attempt to fix ffi_closure_alloc * Fix and improvements to the logger - Dynamically get stdout/stderr fileno instead of fixed value - Improve file migration logging - Improve dyld bypass logging * Fix(pickers): file permission issue --------- Co-authored-by: Duy Tran Khanh <[email protected]>
108 lines
3.8 KiB
Objective-C
108 lines
3.8 KiB
Objective-C
#pragma once
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#include <stdbool.h>
|
|
#include "environ.h"
|
|
#include "jni.h"
|
|
|
|
// Remove date + time from NSLog, unneeded
|
|
#define NSLog(args...) customNSLog(__FILE__,__LINE__,__PRETTY_FUNCTION__,args);
|
|
|
|
// Control button actions
|
|
#define ACTION_DOWN 0
|
|
#define ACTION_UP 1
|
|
#define ACTION_MOVE 2
|
|
#define ACTION_MOVE_MOTION 3
|
|
|
|
#define BUTTON1_DOWN_MASK 1 << 10 // left btn
|
|
#define BUTTON2_DOWN_MASK 1 << 11 // mid btn
|
|
#define BUTTON3_DOWN_MASK 1 << 12 // right btn
|
|
|
|
// GLFW event types
|
|
#define EVENT_TYPE_CHAR 1000
|
|
#define EVENT_TYPE_CHAR_MODS 1001
|
|
#define EVENT_TYPE_CURSOR_ENTER 1002
|
|
#define EVENT_TYPE_CURSOR_POS 1003
|
|
#define EVENT_TYPE_FRAMEBUFFER_SIZE 1004
|
|
#define EVENT_TYPE_KEY 1005
|
|
#define EVENT_TYPE_MOUSE_BUTTON 1006
|
|
#define EVENT_TYPE_SCROLL 1007
|
|
#define EVENT_TYPE_WINDOW_POS 1008
|
|
#define EVENT_TYPE_WINDOW_SIZE 1009
|
|
|
|
#define GLFW_FOCUSED 0x00020001
|
|
#define GLFW_VISIBLE 0x00020004
|
|
|
|
#define RENDERER_NAME_GL4ES "libgl4es_114.dylib"
|
|
#define RENDERER_NAME_MTL_ANGLE "libtinygl4angle.dylib"
|
|
#define RENDERER_NAME_VK_ZINK "libOSMesaOverride.dylib"
|
|
|
|
#define SPECIALBTN_KEYBOARD -1
|
|
#define SPECIALBTN_TOGGLECTRL -2
|
|
#define SPECIALBTN_MOUSEPRI -3
|
|
#define SPECIALBTN_MOUSESEC -4
|
|
#define SPECIALBTN_VIRTUALMOUSE -5
|
|
#define SPECIALBTN_MOUSEMID -6
|
|
#define SPECIALBTN_SCROLLUP -7
|
|
#define SPECIALBTN_SCROLLDOWN -8
|
|
#define SPECIALBTN_MENU -9
|
|
|
|
#define NSDebugLog(...) if (debugLogEnabled) { NSLog(__VA_ARGS__); }
|
|
BOOL debugBoundsEnabled, debugLogEnabled;
|
|
|
|
//__weak UIViewController *viewController;
|
|
|
|
#define CS_DEBUGGED 0x10000000
|
|
int csops(pid_t pid, unsigned int ops, void *useraddr, size_t usersize);
|
|
BOOL isJITEnabled(BOOL checkCSOps);
|
|
|
|
void* gbuffer; // OSMesa framebuffer
|
|
|
|
// Init functions
|
|
void init_bypassDyldLibValidation();
|
|
void init_hookFunctions();
|
|
void init_hookUIKitConstructor();
|
|
void init_setupMultiDir();
|
|
|
|
UIWindow* currentWindow();
|
|
UIWindow* currentWindowInScene(BOOL external);
|
|
UIViewController* currentVC();
|
|
void openLink(UIViewController* sender, NSURL* link);
|
|
|
|
NSString* localize(NSString* key, NSString* comment);
|
|
NSMutableDictionary* parseJSONFromFile(NSString *path);
|
|
NSError* saveJSONToFile(NSDictionary *dict, NSString *path);
|
|
void customNSLog(const char *file, int lineNumber, const char *functionName, NSString *format, ...);
|
|
|
|
static inline CGFloat clamp(CGFloat x, CGFloat lower, CGFloat upper) {
|
|
return fmin(upper, fmax(x, lower));
|
|
}
|
|
CGFloat MathUtils_dist(CGFloat x1, CGFloat y1, CGFloat x2, CGFloat y2);
|
|
CGFloat MathUtils_map(CGFloat x, CGFloat in_min, CGFloat in_max, CGFloat out_min, CGFloat out_max);
|
|
CGFloat dpToPx(CGFloat dp);
|
|
CGFloat pxToDp(CGFloat px);
|
|
void setButtonPointerInteraction(UIButton *button);
|
|
void setViewBackgroundColor(UIView* view);
|
|
void _CGDataProviderReleaseBytePointerCallback(void *info,const void *pointer);
|
|
|
|
jboolean attachThread(bool isAndroid, JNIEnv** secondJNIEnvPtr);
|
|
|
|
void sendData(short type, short i1, short i2, short i3, short i4);
|
|
|
|
void closeGLFWWindow();
|
|
void callback_LauncherViewController_installMinecraft();
|
|
void callback_SurfaceViewController_launchMinecraft(int width, int height);
|
|
int callback_SurfaceViewController_touchHotbar(CGFloat x, CGFloat y);
|
|
|
|
void CallbackBridge_nativeSetInputReady(BOOL inputReady);
|
|
BOOL CallbackBridge_nativeSendChar(jchar codepoint /* jint codepoint */);
|
|
BOOL CallbackBridge_nativeSendCharMods(jchar codepoint, int mods);
|
|
void CallbackBridge_nativeSendCursorPos(char event, CGFloat x, CGFloat y);
|
|
void CallbackBridge_nativeSendKey(int key, int scancode, int action, int mods);
|
|
void CallbackBridge_nativeSendMouseButton(int button, int action, int mods);
|
|
void CallbackBridge_nativeSendScreenSize(int width, int height);
|
|
void CallbackBridge_nativeSendScroll(CGFloat xoffset, CGFloat yoffset);
|
|
void CallbackBridge_sendKeycode(int keycode, jchar keychar, int scancode, int modifiers, BOOL isDown);
|
|
void CallbackBridge_setWindowAttrib(int attrib, int value);
|