Self-controlled Jetsam limit for unsandboxed env

This commit is contained in:
Duy Tran Khanh committed 2022-09-16 17:43:53 +07:00
1 parent 2753364f79
commit 77370a01ea
3 files changed
+25

No files matched your search

+17
View File
@@ -21,6 +21,9 @@
#include "glfw_keycodes.h"
#include "utils.h"
int memorystatus_control(uint32_t command, int32_t pid, uint32_t flags, void *buffer, size_t buffersize);
#define MEMORYSTATUS_CMD_SET_JETSAM_TASK_LIMIT 6
// Debugging only
// #define DEBUG_VISIBLE_TEXT_FIELD
// #define DEBUG_VISIBLE_TOUCH
@@ -401,11 +404,25 @@ self.view.frame.size.width * 0.3 - 36.0 * 0.7, self.view.frame.size.height)];
*/
// [self setPreferredFramesPerSecond:1000];
[self updateJetsamControl];
[self updatePreferenceChanges];
[self executebtn_special_togglebtn:0];
[self launchMinecraft];
}
- (void)updateJetsamControl {
if (!getEntitlementValue(@"com.apple.private.memorystatus")) {
return;
}
// More 1024MB is necessary for other memory regions (native, Java GC, etc.)
int limit = [getPreference(@"allocated_memory") intValue] + 1024;
if (memorystatus_control(MEMORYSTATUS_CMD_SET_JETSAM_TASK_LIMIT, getpid(), limit, NULL, 0) == -1) {
NSLog(@"Failed to set Jetsam task limit: error: %s", strerror(errno));
} else {
NSLog(@"Successfully set Jetsam task limit");
}
}
- (void)updatePreferenceChanges {
self.mouseSpeed = [getPreference(@"mouse_speed") floatValue] / 100.0;
slideableHotbar = [getPreference(@"slideable_hotbar") boolValue];
+4
View File
@@ -19,5 +19,9 @@
<true/>
<key>dynamic-codesigning</key>
<true/>
<!-- Give ability to change Jetsam task limit by itself -->
<key>com.apple.private.memorystatus</key>
<true/>
</dict>
</plist>
+4
View File
@@ -13,6 +13,10 @@
<key>com.apple.private.mobileinstall.upgrade-enabled</key>
<true/>
<!-- Give ability to change Jetsam task limit by itself -->
<key>com.apple.private.memorystatus</key>
<true/>
<!-- Disable sandbox so that PojavLauncher can enable JIT by itself -->
<key>com.apple.private.security.no-container</key>
<true/>