Fixes
Makefile: fix path Moved GameSurfaceView to a separate class Renamed MinecraftDownloader to MinecraftResourceUtils Fix: Some versions fails because GLFW_CLIENT_API is not set
This commit is contained in:
1 parent
12ebf2686a
commit
ee2c68fb98
15 files changed
+191
-173
No files matched your search
@@ -997,7 +997,9 @@ public class GLFW
|
||||
nglfwSetShowingWindow(mGLFWWindowMap.size() == 0 ? 0 : mGLFWWindowMap.keyAt(mGLFWWindowMap.size() - 1));
|
||||
}
|
||||
|
||||
public static void glfwDefaultWindowHints() {}
|
||||
public static void glfwDefaultWindowHints() {
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
|
||||
}
|
||||
|
||||
public static void glfwGetWindowSize(long window, IntBuffer width, IntBuffer height) {
|
||||
if (width != null) width.put(internalGetWindow(window).width);
|
||||
|
||||
@@ -146,9 +146,10 @@ DEPLOY = \
|
||||
ln -sf libawt_xawt.dylib libawt_headless.dylib && \
|
||||
chown -R 501:501 $(1)/Applications/PojavLauncher.app/*"; \
|
||||
else \
|
||||
sudo rm -rf $(1)/Applications/PojavLauncher.app/Frameworks/libOSMesaOverride.dylib.framework; \
|
||||
sudo mv $(WORKINGDIR)/libawt_xawt.dylib $(1)/Applications/PojavLauncher.app/Frameworks/libawt_xawt.dylib; \
|
||||
sudo mv $(WORKINGDIR)/libOSMesaOverride.dylib.framework $(1)/Applications/PojavLauncher.app/Frameworks/libOSMesaOverride.dylib.framework; \
|
||||
sudo mv $(WORKINGDIR)/PojavLauncher $(1)/Applications/PojavLauncher.app/PojavLauncher; \
|
||||
sudo mv $(WORKINGDIR)/libOSMesaOverride.dylib.framework $(1)/Applications/PojavLauncher.app/Frameworks/; \
|
||||
sudo mv $(WORKINGDIR)/PojavLauncher.app/PojavLauncher $(1)/Applications/PojavLauncher.app/PojavLauncher; \
|
||||
sudo mv $(WORKINGDIR)/*.jar $(1)/Applications/PojavLauncher.app/libs/; \
|
||||
cd $(1)/Applications/PojavLauncher.app/Frameworks; \
|
||||
sudo ln -sf libawt_xawt.dylib libawt_headless.dylib; \
|
||||
@@ -378,7 +379,8 @@ install: deb
|
||||
fi
|
||||
@echo 'Building PojavLauncher $(VERSION) - INSTALL - End'
|
||||
|
||||
deploy: deb
|
||||
# deb
|
||||
deploy:
|
||||
@echo 'Building PojavLauncher $(VERSION) - DEPLOY - Start'
|
||||
@if [ '$(DEVICE_IP)' != '' ]; then \
|
||||
if [ '$(ROOTLESS)' = '1' ]; then \
|
||||
|
||||
+10
-6
@@ -70,11 +70,20 @@ add_executable(PojavLauncher
|
||||
authenticator/BaseAuthenticator.m
|
||||
authenticator/LocalAuthenticator.m
|
||||
authenticator/MicrosoftAuthenticator.m
|
||||
|
||||
customcontrols/ControlButton.m
|
||||
customcontrols/ControlDrawer.m
|
||||
customcontrols/ControlSubButton.m
|
||||
customcontrols/CustomControlsUtils.m
|
||||
|
||||
external/DBNumberedSlider/Classes/DBNumberedSlider.m
|
||||
|
||||
AboutLauncherViewController.m
|
||||
AccountListViewController.m
|
||||
AppDelegate.m
|
||||
CustomControlsViewController.m
|
||||
FileListViewController.m
|
||||
GameSurfaceView.m
|
||||
JavaGUIViewController.m
|
||||
KeyboardInput.m
|
||||
LauncherFAQViewController.m
|
||||
@@ -82,16 +91,11 @@ add_executable(PojavLauncher
|
||||
LauncherPreferencesViewController.m
|
||||
LauncherViewController.m
|
||||
LoginViewController.m
|
||||
MinecraftDownloader.m
|
||||
MinecraftResourceUtils.m
|
||||
SceneDelegate.m
|
||||
SurfaceViewController.m
|
||||
UpdateHistoryViewController.m
|
||||
customcontrols/ControlButton.m
|
||||
customcontrols/ControlDrawer.m
|
||||
customcontrols/ControlSubButton.m
|
||||
customcontrols/CustomControlsUtils.m
|
||||
egl_bridge.m
|
||||
external/DBNumberedSlider/Classes/DBNumberedSlider.m
|
||||
input_bridge_v3.m
|
||||
ios_uikit_bridge.m
|
||||
log.m
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface GameSurfaceView : UIView
|
||||
{
|
||||
CALayer* layer;
|
||||
CGColorSpaceRef colorSpace;
|
||||
CGDataProviderDirectCallbacks callbacks;
|
||||
}
|
||||
|
||||
- (void)displayLayer;
|
||||
@end
|
||||
@@ -0,0 +1,46 @@
|
||||
#import "GameSurfaceView.h"
|
||||
#import "LauncherPreferences.h"
|
||||
#import "utils.h"
|
||||
|
||||
@implementation GameSurfaceView
|
||||
const void * _CGDataProviderGetBytePointerCallbackOSMESA(void *info) {
|
||||
return gbuffer;
|
||||
}
|
||||
|
||||
- (void)displayLayer {
|
||||
CGDataProviderRef bitmapProvider = CGDataProviderCreateDirect(NULL, savedWidth * savedHeight * 4, &callbacks);
|
||||
CGImageRef bitmap = CGImageCreate(savedWidth, savedHeight, 8, 32, 4 * savedWidth, colorSpace, kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder16Little, bitmapProvider, NULL, FALSE, kCGRenderingIntentDefault);
|
||||
|
||||
self.layer.contents = (__bridge id) bitmap;
|
||||
CGImageRelease(bitmap);
|
||||
CGDataProviderRelease(bitmapProvider);
|
||||
// CGColorSpaceRelease(colorSpace);
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
|
||||
if ([getPreference(@"renderer") hasPrefix:@"libOSMesaOverride"]) {
|
||||
self.layer.opaque = YES;
|
||||
|
||||
colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
|
||||
callbacks.version = 0;
|
||||
callbacks.getBytePointer = _CGDataProviderGetBytePointerCallbackOSMESA;
|
||||
callbacks.releaseBytePointer = _CGDataProviderReleaseBytePointerCallback;
|
||||
callbacks.getBytesAtPosition = NULL;
|
||||
callbacks.releaseInfo = NULL;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (Class)layerClass {
|
||||
if ([getPreference(@"renderer") hasPrefix:@"libOSMesa"]) {
|
||||
return CALayer.class;
|
||||
} else {
|
||||
return CAMetalLayer.class;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -126,13 +126,15 @@ int tempIndex;
|
||||
};
|
||||
|
||||
scrollView = [[UIScrollView alloc] initWithFrame:self.view.frame];
|
||||
scrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive;
|
||||
[self.view addSubview:scrollView];
|
||||
scrollView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
||||
|
||||
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width + 20, 0)];
|
||||
[scrollView addSubview:tableView];
|
||||
|
||||
|
||||
[self registerForKeyboardNotifications];
|
||||
|
||||
|
||||
blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];
|
||||
blurView = [[UIVisualEffectView alloc] initWithEffect:blur];
|
||||
|
||||
@@ -594,7 +596,8 @@ int tempIndex;
|
||||
CGRect aRect = self.view.frame;
|
||||
aRect.size.height -= kbSize.height;
|
||||
if (!CGRectContainsPoint(aRect, activeField.frame.origin) ) {
|
||||
[scrollView scrollRectToVisible:activeField.frame animated:YES];
|
||||
CGPoint scrollPoint = CGPointMake(0.0, activeField.frame.origin.y-kbSize.height);
|
||||
[scrollView setContentOffset:scrollPoint animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#import "LauncherPreferences.h"
|
||||
#import "LauncherPreferencesViewController.h"
|
||||
#import "LauncherViewController.h"
|
||||
#import "MinecraftDownloader.h"
|
||||
#import "MinecraftResourceUtils.h"
|
||||
#import "ios_uikit_bridge.h"
|
||||
|
||||
#include "utils.h"
|
||||
@@ -272,7 +272,7 @@ int versionSelectedAt = 0;
|
||||
|
||||
NSObject *object = [versionList objectAtIndex:[versionPickerView selectedRowInComponent:0]];
|
||||
|
||||
[MinecraftDownloader start:object callback:^(NSString *stage, NSProgress *mainProgress, NSProgress *progress) {
|
||||
[MinecraftResourceUtils downloadVersion:object callback:^(NSString *stage, NSProgress *mainProgress, NSProgress *progress) {
|
||||
if (progress == nil && stage != nil) {
|
||||
NSLog(@"[MCDL] %@", stage);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
typedef void (^MDCallback)(NSString *stage, NSProgress *mainProgress, NSProgress *progress);
|
||||
|
||||
@interface MinecraftDownloader : NSObject
|
||||
@interface MinecraftResourceUtils : NSObject
|
||||
|
||||
+ (void)downloadClientJson:(NSObject *)version progress:(NSProgress *)mainProgress callback:(MDCallback)callback success:(void (^)(NSMutableDictionary *json))success;
|
||||
+ (void)start:(NSObject *)version callback:(void (^)(NSString *stage, NSProgress *mainProgress, NSProgress *progress))callback;
|
||||
+ (void)downloadVersion:(NSObject *)version callback:(void (^)(NSString *stage, NSProgress *mainProgress, NSProgress *progress))callback;
|
||||
|
||||
+ (void)processJVMArgs:(NSMutableDictionary *)json;
|
||||
|
||||
@end
|
||||
@@ -4,7 +4,7 @@
|
||||
#import "AFNetworking.h"
|
||||
#import "LauncherPreferences.h"
|
||||
#import "LauncherViewController.h"
|
||||
#import "MinecraftDownloader.h"
|
||||
#import "MinecraftResourceUtils.h"
|
||||
#import "ios_uikit_bridge.h"
|
||||
#import "utils.h"
|
||||
|
||||
@@ -32,7 +32,7 @@ todo for now - might change anytime
|
||||
+ old structure (mapped)
|
||||
*/
|
||||
|
||||
@implementation MinecraftDownloader
|
||||
@implementation MinecraftResourceUtils
|
||||
|
||||
static AFURLSessionManager* manager;
|
||||
|
||||
@@ -393,16 +393,19 @@ static AFURLSessionManager* manager;
|
||||
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
|
||||
}
|
||||
|
||||
NSString *hash = assets[@"objects"][name][@"hash"];
|
||||
NSString *pathname = [NSString stringWithFormat:@"%@/%@", [hash substringToIndex:2], hash];
|
||||
|
||||
/* Special case for 1.19+
|
||||
* Since 1.19-pre1, setting the window icon on macOS goes through ObjC.
|
||||
* However, if an IOException occurrs, it won't try to set.
|
||||
* We skip downloading the icon file to trigger this. */
|
||||
if ([name isEqualToString:@"icons/minecraft.icns"]) continue;
|
||||
if ([name hasSuffix:@"icons/minecraft.icns"]) {
|
||||
[NSFileManager.defaultManager removeItemAtPath:pathname error:nil];
|
||||
}
|
||||
|
||||
--jobsAvailable;
|
||||
dispatch_group_enter(group);
|
||||
NSString *hash = assets[@"objects"][name][@"hash"];
|
||||
NSString *pathname = [NSString stringWithFormat:@"%@/%@", [hash substringToIndex:2], hash];
|
||||
NSString *path;
|
||||
if ([assets[@"map_to_resources"] boolValue]) {
|
||||
path = [NSString stringWithFormat:@"%s/resources/%@", getenv("POJAV_GAME_DIR"), name];
|
||||
@@ -465,7 +468,7 @@ static AFURLSessionManager* manager;
|
||||
return jobsAvailable != -1;
|
||||
}
|
||||
|
||||
+ (void)start:(NSObject *)version callback:(MDCallback)callback {
|
||||
+ (void)downloadVersion:(NSObject *)version callback:(MDCallback)callback {
|
||||
manager = [[AFURLSessionManager alloc] init];
|
||||
NSProgress *mainProgress = [NSProgress progressWithTotalUnitCount:0];
|
||||
[self downloadClientJson:version progress:mainProgress callback:callback success:^(NSMutableDictionary *json) {
|
||||
@@ -495,4 +498,29 @@ static AFURLSessionManager* manager;
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)processJVMArgs:(NSMutableDictionary *)json {
|
||||
// Parse Forge 1.17+ additional JVM Arguments
|
||||
if (json[@"inheritsFrom"] == nil || json[@"arguments"][@"jvm"] == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
json[@"arguments"][@"jvm_processed"] = [[NSMutableArray alloc] init];
|
||||
|
||||
NSDictionary *varArgMap = @{
|
||||
@"${classpath_separator}": @":",
|
||||
@"${library_directory}": [NSString stringWithFormat:@"%s/libraries", getenv("POJAV_GAME_DIR")],
|
||||
@"${version_name}": json[@"id"]
|
||||
};
|
||||
|
||||
for (id arg in json[@"arguments"][@"jvm"]) {
|
||||
if ([arg isKindOfClass:NSString.class]) {
|
||||
NSString *argStr = arg;
|
||||
for (NSString *key in varArgMap.allKeys) {
|
||||
argStr = [argStr stringByReplacingOccurrencesOfString:key withString:varArgMap[key]];
|
||||
}
|
||||
[json[@"arguments"][@"jvm_processed"] addObject:argStr];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,19 +1,10 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#import "MGLKit.h"
|
||||
|
||||
#import "GameSurfaceView.h"
|
||||
|
||||
CGRect virtualMouseFrame;
|
||||
CGPoint lastVirtualMousePoint;
|
||||
|
||||
@interface GameSurfaceView : UIView
|
||||
{
|
||||
CALayer* layer;
|
||||
CGColorSpaceRef colorSpace;
|
||||
CGDataProviderDirectCallbacks callbacks;
|
||||
}
|
||||
|
||||
- (void)displayLayer;
|
||||
@end
|
||||
|
||||
@interface SurfaceViewController : UIViewController
|
||||
|
||||
|
||||
+61
-122
@@ -1,19 +1,18 @@
|
||||
#import <GameController/GameController.h>
|
||||
|
||||
#import "JavaLauncher.h"
|
||||
#import "LauncherPreferences.h"
|
||||
#import "MinecraftDownloader.h"
|
||||
#import "SurfaceViewController.h"
|
||||
#import "egl_bridge.h"
|
||||
#import "ios_uikit_bridge.h"
|
||||
|
||||
#import "authenticator/BaseAuthenticator.h"
|
||||
#import "customcontrols/ControlButton.h"
|
||||
#import "customcontrols/ControlDrawer.h"
|
||||
#import "customcontrols/ControlSubButton.h"
|
||||
#import "customcontrols/CustomControlsUtils.h"
|
||||
|
||||
#import "JavaLauncher.h"
|
||||
#import "KeyboardInput.h"
|
||||
#import "LauncherPreferences.h"
|
||||
#import "MinecraftResourceUtils.h"
|
||||
#import "SurfaceViewController.h"
|
||||
|
||||
#import "ios_uikit_bridge.h"
|
||||
|
||||
#include "glfw_keycodes.h"
|
||||
#include "utils.h"
|
||||
@@ -41,50 +40,6 @@ BOOL slideableHotbar;
|
||||
|
||||
// TODO: key modifiers impl
|
||||
|
||||
#pragma mark Class GameSurfaceView
|
||||
@implementation GameSurfaceView
|
||||
const void * _CGDataProviderGetBytePointerCallbackOSMESA(void *info) {
|
||||
return gbuffer;
|
||||
}
|
||||
|
||||
- (void)displayLayer {
|
||||
CGDataProviderRef bitmapProvider = CGDataProviderCreateDirect(NULL, savedWidth * savedHeight * 4, &callbacks);
|
||||
CGImageRef bitmap = CGImageCreate(savedWidth, savedHeight, 8, 32, 4 * savedWidth, colorSpace, kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder16Little, bitmapProvider, NULL, FALSE, kCGRenderingIntentDefault);
|
||||
|
||||
self.layer.contents = (__bridge id) bitmap;
|
||||
CGImageRelease(bitmap);
|
||||
CGDataProviderRelease(bitmapProvider);
|
||||
// CGColorSpaceRelease(colorSpace);
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
|
||||
if ([getPreference(@"renderer") hasPrefix:@"libOSMesaOverride"]) {
|
||||
self.layer.opaque = YES;
|
||||
|
||||
colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
|
||||
callbacks.version = 0;
|
||||
callbacks.getBytePointer = _CGDataProviderGetBytePointerCallbackOSMESA;
|
||||
callbacks.releaseBytePointer = _CGDataProviderReleaseBytePointerCallback;
|
||||
callbacks.getBytesAtPosition = NULL;
|
||||
callbacks.releaseInfo = NULL;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (Class)layerClass {
|
||||
if ([getPreference(@"renderer") hasPrefix:@"libOSMesa"]) {
|
||||
return CALayer.class;
|
||||
} else {
|
||||
return CAMetalLayer.class;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma mark Class TrackedTextField
|
||||
@interface TrackedTextField : UITextField
|
||||
@@ -121,12 +76,15 @@ const void * _CGDataProviderGetBytePointerCallbackOSMESA(void *info) {
|
||||
@property UITableView *menuView;
|
||||
|
||||
@property UIView *rootView;
|
||||
|
||||
@property TrackedTextField *inputView;
|
||||
@property(nonatomic, strong) NSMutableDictionary* cc_dictionary;
|
||||
@property(nonatomic, strong) NSMutableArray* swipeableButtons;
|
||||
@property(nonatomic, strong) NSMutableArray* togglableVisibleButtons;
|
||||
@property ControlButton* swipingButton;
|
||||
@property UITouch *primaryTouch, *hotbarTouch;
|
||||
|
||||
@property UIView *logOutputView;
|
||||
|
||||
@property id mouseConnectCallback, mouseDisconnectCallback;
|
||||
|
||||
@property CGRect clickRange;
|
||||
@@ -187,7 +145,7 @@ const void * _CGDataProviderGetBytePointerCallbackOSMESA(void *info) {
|
||||
[menuSwipeView addSubview:menuSwipeLineView];
|
||||
[self.rootView addSubview:menuSwipeView];
|
||||
|
||||
self.menuArray = @[@"game.menu.forceClose", @"game.menu.logOutput"];
|
||||
self.menuArray = @[@"game.menu.forceClose" /*, @"game.menu.logOutput" */];
|
||||
|
||||
self.menuView = [[UITableView alloc] initWithFrame:CGRectMake(self.view.frame.size.width + 30.0, 0,
|
||||
self.view.frame.size.width * 0.3 - 36.0 * 0.7, self.view.frame.size.height)];
|
||||
@@ -283,49 +241,34 @@ self.view.frame.size.width * 0.3 - 36.0 * 0.7, self.view.frame.size.height)];
|
||||
|
||||
NSString *controlFilePath = [NSString stringWithFormat:@"%s/controlmap/%@", getenv("POJAV_HOME"), (NSString *)getPreference(@"default_ctrl")];
|
||||
|
||||
NSError *cc_error;
|
||||
NSString *cc_data = [NSString stringWithContentsOfFile:controlFilePath encoding:NSUTF8StringEncoding error:&cc_error];
|
||||
|
||||
self.swipeableButtons = [[NSMutableArray alloc] init];
|
||||
self.togglableVisibleButtons = [[NSMutableArray alloc] init];
|
||||
if (cc_error) {
|
||||
NSLog(@"Error: could not read %@: %@", controlFilePath, cc_error.localizedDescription);
|
||||
showDialog(self, @"Error", [NSString stringWithFormat:@"Could not read %@: %@", controlFilePath, cc_error.localizedDescription]);
|
||||
|
||||
self.cc_dictionary = parseJSONFromFile(controlFilePath);
|
||||
if (self.cc_dictionary[@"error"] != nil) {
|
||||
showDialog(self, @"Error", [NSString stringWithFormat:@"Could not open %@: %@", controlFilePath, [self.cc_dictionary[@"error"] localizedDescription]]);
|
||||
} else {
|
||||
NSData* cc_objc_data = [cc_data dataUsingEncoding:NSUTF8StringEncoding];
|
||||
self.cc_dictionary = [NSJSONSerialization JSONObjectWithData:cc_objc_data options:NSJSONReadingMutableContainers error:&cc_error];
|
||||
if (cc_error != nil) {
|
||||
showDialog(self, @"Error parsing JSON", cc_error.localizedDescription);
|
||||
} else {
|
||||
CGFloat currentScale = [self.cc_dictionary[@"scaledAt"] floatValue];
|
||||
CGFloat savedScale = [getPreference(@"button_scale") floatValue];
|
||||
loadControlObject(self.rootView, self.cc_dictionary, ^void(ControlButton* button) {
|
||||
BOOL isSwipeable = [button.properties[@"isSwipeable"] boolValue];
|
||||
CGFloat currentScale = [self.cc_dictionary[@"scaledAt"] floatValue];
|
||||
CGFloat savedScale = [getPreference(@"button_scale") floatValue];
|
||||
loadControlObject(self.rootView, self.cc_dictionary, ^void(ControlButton* button) {
|
||||
BOOL isSwipeable = [button.properties[@"isSwipeable"] boolValue];
|
||||
|
||||
BOOL isToggleCtrlBtn = NO;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int keycodeInt = [button.properties[@"keycodes"][i] intValue];
|
||||
if (keycodeInt == SPECIALBTN_TOGGLECTRL) {
|
||||
isToggleCtrlBtn = YES;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int keycodeInt = [button.properties[@"keycodes"][i] intValue];
|
||||
button.canBeHidden = keycodeInt == SPECIALBTN_TOGGLECTRL;
|
||||
}
|
||||
|
||||
[button addTarget:self action:@selector(executebtn_down:) forControlEvents:UIControlEventTouchDown];
|
||||
[button addTarget:self action:@selector(executebtn_up:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside];
|
||||
[button addTarget:self action:@selector(executebtn_down:) forControlEvents:UIControlEventTouchDown];
|
||||
[button addTarget:self action:@selector(executebtn_up:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside];
|
||||
|
||||
if (isSwipeable) {
|
||||
UIPanGestureRecognizer *panRecognizerButton = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(executebtn_swipe:)];
|
||||
panRecognizerButton.delegate = self;
|
||||
[button addGestureRecognizer:panRecognizerButton];
|
||||
[self.swipeableButtons addObject:button];
|
||||
}
|
||||
if (!isToggleCtrlBtn) {
|
||||
[self.togglableVisibleButtons addObject:button];
|
||||
}
|
||||
});
|
||||
if (isSwipeable) {
|
||||
UIPanGestureRecognizer *panRecognizerButton = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(executebtn_swipe:)];
|
||||
panRecognizerButton.delegate = self;
|
||||
[button addGestureRecognizer:panRecognizerButton];
|
||||
[self.swipeableButtons addObject:button];
|
||||
}
|
||||
});
|
||||
|
||||
self.cc_dictionary[@"scaledAt"] = @(savedScale);
|
||||
}
|
||||
self.cc_dictionary[@"scaledAt"] = @(savedScale);
|
||||
}
|
||||
|
||||
[KeyboardInput initKeycodeTable];
|
||||
@@ -352,42 +295,28 @@ self.view.frame.size.width * 0.3 - 36.0 * 0.7, self.view.frame.size.height)];
|
||||
|
||||
[self.rootView addSubview:self.inputView];
|
||||
|
||||
[self executebtn_special_togglebtn:0];
|
||||
/*
|
||||
self.logOutputView = [[UIView alloc] initWithFrame:self.view.frame];
|
||||
self.logOutputView.hidden = YES;
|
||||
[self.rootView addSubview:self.logOutputView];
|
||||
|
||||
UINavigationBar *logNavbar = [[UINavigationBar alloc] init];
|
||||
[logNavbar
|
||||
NSLog(@"NavBar %@", logNavbar);
|
||||
//logNavbar.title = NSLocalizedString(self.menuArray[1], nil);
|
||||
[logNavbar sizeToFit];
|
||||
[self.logOutputView addSubview:logNavbar];
|
||||
*/
|
||||
|
||||
// [self setPreferredFramesPerSecond:1000];
|
||||
|
||||
[self executebtn_special_togglebtn:0];
|
||||
[self launchMinecraft];
|
||||
}
|
||||
|
||||
- (void)processMinecraftJVMArgs:(NSMutableDictionary *)json {
|
||||
// Parse Forge 1.17+ additional JVM Arguments
|
||||
if (json[@"inheritsFrom"] == nil || json[@"arguments"][@"jvm"] == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
json[@"arguments"][@"jvm_processed"] = [[NSMutableArray alloc] init];
|
||||
|
||||
NSDictionary *varArgMap = @{
|
||||
@"${classpath_separator}": @":",
|
||||
@"${library_directory}": [NSString stringWithFormat:@"%s/libraries", getenv("POJAV_GAME_DIR")],
|
||||
@"${version_name}": json[@"id"]
|
||||
};
|
||||
|
||||
for (id arg in json[@"arguments"][@"jvm"]) {
|
||||
if ([arg isKindOfClass:NSString.class]) {
|
||||
NSString *argStr = arg;
|
||||
for (NSString *key in varArgMap.allKeys) {
|
||||
argStr = [argStr stringByReplacingOccurrencesOfString:key withString:varArgMap[key]];
|
||||
}
|
||||
[json[@"arguments"][@"jvm_processed"] addObject:argStr];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)launchMinecraft {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[MinecraftDownloader downloadClientJson:getPreference(@"selected_version") progress:nil callback:nil success:^(NSMutableDictionary *json) {
|
||||
[self processMinecraftJVMArgs:json];
|
||||
[MinecraftResourceUtils downloadClientJson:getPreference(@"selected_version") progress:nil callback:nil success:^(NSMutableDictionary *json) {
|
||||
[MinecraftResourceUtils processJVMArgs:json];
|
||||
launchJVM(
|
||||
BaseAuthenticator.current.authData[@"username"],
|
||||
json,
|
||||
@@ -466,7 +395,7 @@ CGPoint lastCenterPoint;
|
||||
[alert addAction:cancelAction];
|
||||
|
||||
UIAlertAction* okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) {
|
||||
[UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
||||
[UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
||||
self.rootView.center = CGPointMake(self.rootView.bounds.size.width/-2, self.rootView.center.y);
|
||||
self.menuView.frame = CGRectMake(self.view.frame.size.width, 0, 0, 0);
|
||||
} completion:^(BOOL finished) {
|
||||
@@ -478,6 +407,11 @@ CGPoint lastCenterPoint;
|
||||
[viewController presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)actionToggleLogOutput {
|
||||
self.logOutputView.hidden = !self.logOutputView.hidden;
|
||||
// TODO impl log enable/disable
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.menuArray.count;
|
||||
}
|
||||
@@ -505,6 +439,9 @@ CGPoint lastCenterPoint;
|
||||
case 0:
|
||||
[self actionForceClose];
|
||||
break;
|
||||
case 1:
|
||||
[self actionToggleLogOutput];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -986,8 +923,10 @@ CallbackBridge_nativeSendKey(keycode, 0, held, 0);
|
||||
- (void)executebtn_special_togglebtn:(int)held {
|
||||
if (held == 0) {
|
||||
currentVisibility = !currentVisibility;
|
||||
for (ControlButton *button in self.togglableVisibleButtons) {
|
||||
if (!currentVisibility && ![button isKindOfClass:[ControlSubButton class]]) {
|
||||
for (UIView *view in self.rootView.subviews) {
|
||||
if (![view isKindOfClass:[ControlButton class]]) continue;
|
||||
ControlButton *button = (ControlButton *)view;
|
||||
if (button.canBeHidden && !currentVisibility && ![button isKindOfClass:[ControlSubButton class]]) {
|
||||
button.hidden = currentVisibility;
|
||||
if ([button isKindOfClass:[ControlDrawer class]]) {
|
||||
[(ControlDrawer *)button restoreButtonVisibility];
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
@interface ControlButton : UIButton {
|
||||
}
|
||||
|
||||
@property BOOL canBeHidden;
|
||||
@property(nonatomic, strong) NSMutableDictionary* properties;
|
||||
|
||||
+ (id)buttonWithProperties:(NSMutableDictionary *)propArray willUpdate:(BOOL)update;
|
||||
|
||||
@@ -186,12 +186,7 @@
|
||||
// Update other properties
|
||||
self.frame = CGRectMake(propX + insets.left, propY, propW, propH);
|
||||
self.alpha = [self.properties[@"opacity"] floatValue];
|
||||
if (self.alpha < 0.02) {
|
||||
self.alpha = 0.02;
|
||||
}
|
||||
if (isControlModifiable && self.alpha < 0.1) {
|
||||
self.alpha = 0.1;
|
||||
}
|
||||
self.alpha = MAX(self.alpha, isControlModifiable ? 0.1 : 0.01);
|
||||
self.backgroundColor = convertARGB2UIColor(propBackgroundColor);
|
||||
|
||||
self.layer.borderColor = [convertARGB2UIColor(propStrokeColor) CGColor];
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef USE_EGL
|
||||
|
||||
#import "SurfaceViewController.h"
|
||||
#include "jni.h"
|
||||
|
||||
MGLContext *glContext;
|
||||
|
||||
#endif
|
||||
@@ -1,3 +1,5 @@
|
||||
#import "SurfaceViewController.h"
|
||||
|
||||
#include "jni.h"
|
||||
#include <assert.h>
|
||||
#include <dlfcn.h>
|
||||
@@ -13,7 +15,6 @@
|
||||
#include "GL/osmesa.h"
|
||||
#include "GLES2/gl2.h"
|
||||
|
||||
#include "egl_bridge.h"
|
||||
#include "glfw_keycodes.h"
|
||||
#include "osmesa_internal.h"
|
||||
|
||||
@@ -225,6 +226,8 @@ int pojavInit() {
|
||||
}
|
||||
|
||||
jboolean pojavInit_OpenGL() {
|
||||
if (config_renderer) return JNI_TRUE;
|
||||
|
||||
NSString *renderer = @(getenv("POJAV_RENDERER"));
|
||||
if ([renderer isEqualToString:@"libOSMesa.8.dylib"]) {
|
||||
config_renderer = RENDERER_VIRGL;
|
||||
|
||||
Reference in new issue
Block a user