#pragma once #import #include #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 "libOSMesa.8.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 debugLogEnabled, isJailbroken; //__weak UIViewController *viewController; #define CS_DEBUGGED 0x10000000 int csops(pid_t pid, unsigned int ops, void *useraddr, size_t usersize); BOOL isJITEnabled(BOOL checkCSOps); // 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 _CGDataProviderReleaseBytePointerCallback(void *info,const void *pointer); jboolean attachThread(bool isAndroid, JNIEnv** secondJNIEnvPtr); void sendData(short type, int i1, int i2, short i3, short i4); void sendDataFloat(short type, float i1, float 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_pauseGameIfNeed();