Skip to content

Commit

Permalink
Fix warnings, drop 1GB devices
Browse files Browse the repository at this point in the history
  • Loading branch information
crystall1nedev committed Dec 18, 2022
1 parent 7d2948b commit 37b479b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Natives/JavaLauncher.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int launchJVM(NSString *username, id launchTarget, int width, int height, int mi
int allocmem;
if ([getPreference(@"auto_ram") boolValue]) {
CGFloat autoRatio = getEntitlementValue(@"com.apple.private.memorystatus") ? 0.4 : 0.25;
allocmem = roundf(([[NSProcessInfo processInfo] physicalMemory] / 1048576) * autoRatio);
allocmem = roundf((NSProcessInfo.processInfo.physicalMemory / 1048576) * autoRatio);
} else {
allocmem = [getPreference(@"allocated_memory") intValue];
}
Expand Down
35 changes: 35 additions & 0 deletions Natives/LauncherNewsViewController.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import <WebKit/WebKit.h>
#import "LauncherNewsViewController.h"
#import "LauncherPreferences.h"
#import "utils.h"

@interface LauncherNewsViewController()<WKNavigationDelegate>
Expand All @@ -16,6 +17,9 @@ - (NSString *)imageName {
- (void)viewDidLoad
{
[super viewDidLoad];

BOOL goodiOS = UIDevice.currentDevice.systemVersion.floatValue >= 14;

CGSize size = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
insets = UIApplication.sharedApplication.windows.firstObject.safeAreaInsets;

Expand All @@ -35,6 +39,37 @@ - (void)viewDidLoad
[webView.scrollView setShowsHorizontalScrollIndicator:NO];
[webView loadRequest:request];
[self.view addSubview:webView];

if(roundf(NSProcessInfo.processInfo.physicalMemory / 1048576) < 1900 && ![getPreference(@"force_unsupported_launch") boolValue]) {
UIAlertController *RAMAlert = [UIAlertController alertControllerWithTitle:localize(@"login.warn.title.a7", nil) message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:localize(@"OK", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
exit(0);
}];
[self presentViewController:RAMAlert animated:YES completion:nil];
[RAMAlert addAction:ok];
}

if(!goodiOS && ([getPreference(@"unsupported_warn_counter") intValue] == 0)) {
UIAlertController *verAlert = [UIAlertController alertControllerWithTitle:localize(@"login.warn.title.iosver", nil) message:localize(@"login.warn.message.iosver", nil) preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:localize(@"OK", nil) style:UIAlertActionStyleCancel handler:nil];
[self presentViewController:verAlert animated:YES completion:nil];
[verAlert addAction:ok];
}

int launchNum = [getPreference(@"unsupported_warn_counter") intValue];
if(launchNum > 0) {
setPreference(@"unsupported_warn_counter", @(launchNum - 1));
} else {
setPreference(@"unsupported_warn_counter", @(30));
}

if(!getenv("POJAV_DETECTEDJB") && [getPreference(@"ram_unjb_warn") boolValue] == YES && [getPreference(@"auto_ram") boolValue] == NO) {
UIAlertController *ramalert = [UIAlertController alertControllerWithTitle:localize(@"login.warn.title.ram_unjb", nil) message:localize(@"login.warn.message.ram_unjb", nil) preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:localize(@"OK", nil) style:UIAlertActionStyleCancel handler:nil];
[self presentViewController:ramalert animated:YES completion:nil];
[ramalert addAction:ok];
setPreference(@"ram_unjb_warn", @NO);
}
}


Expand Down
4 changes: 2 additions & 2 deletions Natives/LauncherPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void loadPreferences(BOOL reset) {
setDefaultValueForPref(envPrefDict, @"default_ctrl", @"default.json");
setDefaultValueForPref(envPrefDict, @"game_directory", @"default");
setDefaultValueForPref(envPrefDict, @"java_args", @"");
setDefaultValueForPref(envPrefDict, @"allocated_memory", [NSNumber numberWithFloat:roundf(([[NSProcessInfo processInfo] physicalMemory] / 1048576) * 0.25)]);
setDefaultValueForPref(envPrefDict, @"allocated_memory", [NSNumber numberWithFloat:roundf((NSProcessInfo.processInfo.physicalMemory / 1048576) * 0.25)]);
setDefaultValueForPref(envPrefDict, @"jitstreamer_server", @"69.69.0.1");
setDefaultValueForPref(prefDict, @"appicon", @"AppIcon-Light");
setDefaultValueForPref(prefDict, @"debug_logging", @(CONFIG_RELEASE != 1));
Expand All @@ -133,7 +133,7 @@ void loadPreferences(BOOL reset) {
setDefaultValueForPref(envPrefDict, @"renderer", @"auto");
setDefaultValueForPref(envPrefDict, @"fullscreen_airplay", @YES);
fillDefaultWarningDict();
setDefaultValueForPref(prefDict, @"a7_allow", @NO);
setDefaultValueForPref(prefDict, @"force_unsupported_launch", @NO);
setDefaultValueForPref(prefDict, @"slideable_hotbar", @NO);
setDefaultValueForPref(prefDict, @"virtmouse_enable", @NO);
setDefaultValueForPref(prefDict, @"check_sha", @YES);
Expand Down
22 changes: 0 additions & 22 deletions Natives/LauncherSplitViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,6 @@ - (void)viewDidLoad {
detailVc.toolbarHidden = NO;

self.viewControllers = @[[[UINavigationController alloc] initWithRootViewController:masterVc], detailVc];

if(roundf([[NSProcessInfo processInfo] physicalMemory] / 1048576) < 1900 && [getPreference(@"unsupported_warn_counter") intValue] == 0) {
UIAlertController *RAMAlert = [UIAlertController alertControllerWithTitle:localize(@"login.warn.title.a7", nil) message:localize(@"login.warn.message.a7", nil) preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:localize(@"OK", nil) style:UIAlertActionStyleCancel handler:nil];
[self presentViewController:RAMAlert animated:YES completion:nil];
[RAMAlert addAction:ok];
}

int launchNum = [getPreference(@"unsupported_warn_counter") intValue];
if(launchNum > 0) {
setPreference(@"unsupported_warn_counter", @(launchNum - 1));
} else {
setPreference(@"unsupported_warn_counter", @(30));
}

if(!getenv("POJAV_DETECTEDJB") && [getPreference(@"ram_unjb_warn") boolValue] == YES && [getPreference(@"auto_ram") boolValue] == NO) {
UIAlertController *ramalert = [UIAlertController alertControllerWithTitle:localize(@"login.warn.title.ram_unjb", nil) message:localize(@"login.warn.message.ram_unjb", nil) preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:localize(@"OK", nil) style:UIAlertActionStyleCancel handler:nil];
[self presentViewController:ramalert animated:YES completion:nil];
[ramalert addAction:ok];
setPreference(@"ram_unjb_warn", @NO);
}
}

- (void)splitViewController:(UISplitViewController *)svc willChangeToDisplayMode:(UISplitViewControllerDisplayMode)displayMode {
Expand Down
3 changes: 1 addition & 2 deletions Natives/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
"login.warn.title.ram_unjb" = "Memory slider is enabled";
"login.warn.message.ram_unjb" = "Be aware that changing this setting can cause game instability or break the ability to play at all.";

"login.warn.title.a7" = "This is the last update for this device.";
"login.warn.message.a7" = "PojavLauncher 2.2 will not support this device, due to hardware and software limitations.";
"login.warn.title.a7" = "PojavLauncher 2.2 is not supported on this device.";

"login.warn.title.iosver" = "This is the last update for this iOS version.";
"login.warn.message.iosver" = "A future version of PojavLauncher will not support iOS 12 or 13, due to feature inconsistencies and development hurdles.";
Expand Down
Binary file modified Natives/resources/Assets.car
Binary file not shown.

0 comments on commit 37b479b

Please sign in to comment.