Merge remote-tracking branch 'origin/main' into wip-new-pref-ui

This commit is contained in:
Eilionoir Tunnicliff committed 2022-09-03 19:29:14 -04:00
commit cbc7c569fa
7 files changed
+188 -48

No files matched your search

+2
View File
@@ -8,3 +8,5 @@
.DS_Store
/pojavlauncher.xcodeproj
/depends
/Natives/resources/[email protected]
/Natives/resources/AppIcon76x76@2x~ipad.png
+26 -23
View File
@@ -164,11 +164,11 @@ DEPLOY = \
fi
# Make sure everything is already available for use. Error if they require something
ifeq ($(call HAS_COMMAND,cmake --version),1)
ifneq ($(call DEPCHECK,cmake --version),1)
$(error You need to install cmake)
endif
ifeq ($(call HAS_COMMAND,$(BOOTJDK)/javac -version),1)
ifneq ($(call DEPCHECK,$(BOOTJDK)/javac -version),1)
$(error You need to install JDK 8)
endif
@@ -178,26 +178,26 @@ $(error You need to install JDK 8)
endif
endif
ifeq ($(call HAS_COMMAND,ldid),1)
ifneq ($(call DEPCHECK,ldid),1)
$(error You need to install ldid)
endif
ifeq ($(call HAS_COMMAND,fakeroot -v),1)
ifneq ($(call DEPCHECK,fakeroot -v),1)
$(error You need to install fakeroot)
endif
ifeq ($(call HAS_COMMAND,dpkg-deb --version),1)
ifneq ($(call DEPCHECK,dpkg-deb --version),1)
$(error You need to install dpkg-dev)
endif
ifeq ($(DETECTPLAT),Linux)
ifeq ($(call HAS_COMMAND,lld),1)
ifneq ($(call DEPCHECK,lld),1)
$(error You need to install lld)
endif
endif
ifeq ($(call HAS_COMMAND,nproc --version),1)
ifeq ($(call HAS_COMMAND,gnproc --version),1)
ifneq ($(call DEPCHECK,nproc --version),1)
ifneq ($(call DEPCHECK,gnproc --version),1)
$(warning Unable to determine number of threads, defaulting to 2.)
JOBS ?= 2
else
@@ -217,12 +217,13 @@ endif
# native - Builds the Objective-C code.
# java - Builds the Java code.
# extras - Builds the Assets and Storyboard.
# deb - Builds the Debian package.
# deb - Builds the Debian package. Will be removed in 2.2.
# ipa - Builds the application package.
# install - runs deb + installs to jailbroken device.
# deploy - runs native and java + installs to jailbroken device.
# install - runs deb + installs to jailbroken device. Will be removed in 2.2.
# deploy - runs native and java + installs to jailbroken device. Will be removed in 2.2.
# dsym - Generates debug symbol files
all: clean native java extras deb
all: clean native java extras deb dsym ipa
check:
@printf '\nDumping all Makefile variables.\n'
@@ -313,7 +314,7 @@ deb: native java extras
else \
$(call PACKAGING,development); \
fi
@echo 'Building PojavLauncher $(VERSION) - DEB - Start'
@echo 'Building PojavLauncher $(VERSION) - DEB - End'
dsym: deb
@echo 'Building PojavLauncher $(VERSION) - DSYM - Start'
@@ -324,25 +325,26 @@ dsym: deb
ipa: dsym
echo 'Building PojavLauncher $(VERSION) - IPA - Start'
mkdir -p $(SOURCEDIR)/depends; \
@mkdir -p $(SOURCEDIR)/depends; \
cd $(SOURCEDIR)/depends; \
if [ ! -f "java-8-openjdk/bin/java" ] && [ ! -f "$(ls ../jre8-*.tar.xz)" ]; then \
if [ "$(RUNNER)" != "1" ]; then \
wget 'https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/releases/download/jre8-40df388/jre8-arm64-20220811-release.tar.xz'; \
wget 'https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/releases/download/jre8-40df388/jre8-arm64-20220811-release.tar.xz' -q --show-progress; \
fi; \
mkdir java-8-openjdk && cd java-8-openjdk; \
tar xvf ../jre8-*.tar.xz; \
rm ../jre8-*.tar.xz; \
fi; \
cd ..; \
cd $(SOURCEDIR)/depends; \
if [ ! -f "java-17-openjdk/bin/java" ] && [ ! -f "$(ls ../jre17-*.tar.xz)" ]; then \
if [ "$(RUNNER)" != "1" ]; then \
wget 'https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/releases/download/jre17-ca01427/jre17-arm64-20220817-release.tar.xz'; \
wget 'https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/releases/download/jre17-ca01427/jre17-arm64-20220817-release.tar.xz' -q --show-progress; \
fi; \
mkdir java-17-openjdk && cd java-17-openjdk; \
tar xvf ../jre17-*.tar.xz; \
rm ../jre17-*.tar.xz; \
fi; \
cd ..; \
mkdir -p $(OUTPUTDIR); \
cd $(OUTPUTDIR); \
$(call DIRCHECK,$(OUTPUTDIR)/Payload); \
@@ -417,13 +419,14 @@ help:
@echo ''
@echo 'Usage:'
@echo ' make Makes everything under all'
@echo ' make all Builds natives, javaapp, extras, and package'
@echo ' make all Builds the entire app'
@echo ' make native Builds the native app'
@echo ' make java Builds the Java app'
@echo ' make deb Builds deb of PojavLauncher'
# @echo ' make ipa Builds ipa of PojavLauncher'
@echo ' make install Copy package to local iDevice'
@echo ' make deploy Copy package to local iDevice'
@echo ' make deb (DEPRECATED) Builds deb of PojavLauncher'
@echo ' make ipa Builds ipa of PojavLauncher'
@echo ' make install (DEPRECATED) Copy package to local iDevice'
@echo ' make deploy (DEPRECATED) Copy package to local iDevice'
@echo ' make dsym Generate debug symbol files'
@echo ' make clean Cleans build directories'
.PHONY: all clean native java extras deb ipa install deploy
.PHONY: all clean native java extras deb ipa install deploy dsym
+1
View File
@@ -18,6 +18,7 @@ include_directories(
"external/TOInsetGroupedTableView/TOInsetGroupedTableView"
"external/fishhook"
"external/mesa"
"external/Apple"
)
# For cacio support library
+1 -1
View File
@@ -756,7 +756,7 @@ int tempIndex;
title = @"Allocated RAM";
if(getenv("POJAV_DETECTEDJB")) {
message = @"This option allows you to change the amount of memory used by the game. The minimum is 25% (default) and the maximum is 85%. To be safe, any value over 40% will require a tool like jetsamctl to prevent memory crashes.";
} else if (!(getenv("POJAV_DETECTEDJB") && ![getPreference(@"disable_home_symlink") boolValue] == YES)){
} else if (!(getenv("POJAV_DETECTEDJB") && ![getPreference(@"ram_unjb_enable") boolValue] == NO)){
message = @"This option allows you to change the amount of memory used by the game. This option is disabled by default on unjailbroken devices due to potential instability of the launcher.";
} else {
message = @"This option allows you to change the amount of memory used by the game. The minimum is 25% (default) and the maximum is 85%. Use this at your own risk while unjailbroken, as it can cause instability or break launching the game entirely.";
+65
View File
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _SYS_CODESIGN_H_
#define _SYS_CODESIGN_H_
#include <sys/types.h>
/* code signing attributes of a process */
#define CS_VALID 0x0001 /* dynamically valid */
#define CS_HARD 0x0100 /* don't load invalid pages */
#define CS_KILL 0x0200 /* kill process if it becomes invalid */
#define CS_EXEC_SET_HARD 0x1000 /* set CS_HARD on any exec'ed process */
#define CS_EXEC_SET_KILL 0x2000 /* set CS_KILL on any exec'ed process */
#define CS_KILLED 0x10000 /* was killed by kernel for invalidity */
#define CS_RESTRICT 0x20000 /* tell dyld to treat restricted */
/* csops operations */
#define CS_OPS_STATUS 0 /* return status */
#define CS_OPS_MARKINVALID 1 /* invalidate process */
#define CS_OPS_MARKHARD 2 /* set HARD flag */
#define CS_OPS_MARKKILL 3 /* set KILL flag (sticky) */
#define CS_OPS_PIDPATH 4 /* get executable's pathname */
#define CS_OPS_CDHASH 5 /* get code directory hash */
#define CS_OPS_PIDOFFSET 6 /* get offset of active Mach-o slice */
#define CS_OPS_ENTITLEMENTS_BLOB 7 /* get entitlements blob */
#define CS_OPS_MARKRESTRICT 8 /* set RESTRICT flag (sticky) */
#ifndef KERNEL
__BEGIN_DECLS
/* code sign operations */
int csops(pid_t pid, unsigned int ops, void * useraddr, size_t usersize);
__END_DECLS
#endif /* ! KERNEL */
#endif /* _SYS_CODESIGN_H_ */
+93 -24
View File
@@ -1,3 +1,7 @@
#import <mach-o/dyld.h>
#import <mach/mach.h>
#import <mach/mach_host.h>
#import <sys/sysctl.h>
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@@ -18,6 +22,9 @@
#include "JavaLauncher.h"
#include "log.h"
#include "utils.h"
#include "codesign.h"
#define CS_PLATFORM_BINARY 0x4000000
#if CONFIG_RELEASE == 1
# define CONFIG_TYPE "release"
@@ -32,38 +39,91 @@
#define fm NSFileManager.defaultManager
void printEntitlementAvailability(NSString *key) {
NSLog(@"- %@: %@", key, getEntitlementValue(key) ? @"YES" : @"NO");
NSLog(@"[Pre-Init] - %@: %@", key, getEntitlementValue(key) ? @"YES" : @"NO");
}
bool init_checkForsubstrated() {
// Please kindly tell pwn20wnd that he sucks
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0};
size_t miblen = 4;
size_t size;
int st = sysctl(mib, miblen, NULL, &size, NULL, 0);
struct kinfo_proc * process = NULL;
struct kinfo_proc * newprocess = NULL;
do {
size += size / 10;
newprocess = realloc(process, size);
if (!newprocess){
if (process){
free(process);
}
return nil;
}
process = newprocess;
st = sysctl(mib, miblen, process, &size, NULL, 0);
} while (st == -1 && errno == ENOMEM);
if (st == 0){
if (size % sizeof(struct kinfo_proc) == 0){
int nprocess = size / sizeof(struct kinfo_proc);
if (nprocess){
for (int i = nprocess - 1; i >= 0; i--){
if(strcmp(process[i].kp_proc.p_comm,"substrated") == 0) {
return true;
}
}
}
}
}
return false;
}
void init_checkForJailbreak() {
bool jbDyld = false;
bool jbFlag = true;
bool jbProc = init_checkForsubstrated();
int imageCount = _dyld_image_count();
uint32_t flags = CS_PLATFORM_BINARY;
for (int i=0; i < imageCount; i++) {
if (strcmp(_dyld_get_image_name(i),"/usr/lib/pspawn_payload-stg2.dylib") == 0) {
jbDyld = true;
} else {
jbDyld = false;
}
}
if (csops(0, CS_OPS_STATUS, &flags, sizeof(flags)) != -1) {
if ((flags & CS_PLATFORM_BINARY) == 0) {
jbFlag = false;
} else {
jbFlag = true;
}
}
if (jbDyld || jbFlag || jbProc) {
setenv("POJAV_DETECTEDJB", "1", 1);
}
}
void init_logDeviceAndVer(char *argument) {
// Hardware + Software
struct utsname systemInfo;
uname(&systemInfo);
// Hardware + software
const char *deviceHardware = systemInfo.machine;
const char *deviceSoftware = [[[UIDevice currentDevice] systemVersion] cStringUsingEncoding:NSUTF8StringEncoding];
// Jailbreak
const char *jbStrap;
if (strncmp(argument, "/Applications", 13) == 0) {
if ([[NSFileManager defaultManager] fileExistsAtPath:@"/.procursus_strapped"]) {
jbStrap = "Procursus";
} else {
jbStrap = "Other";
}
regLog("[Pre-Init] %s with iOS %s (%s)", deviceHardware, deviceSoftware, jbStrap);
} else {
regLog("[Pre-Init] %s with iOS %s (sideloaded)", deviceHardware, deviceSoftware);
}
// PojavLauncher version
regLog("[Pre-Init] PojavLauncher version: %s - %s", CONFIG_TYPE, CONFIG_COMMIT);
setenv("POJAV_DETECTEDHW", deviceHardware, 1);
setenv("POJAV_DETECTEDSW", deviceSoftware, 1);
if (strncmp(argument, "/Applications", 13) == 0) {
setenv("POJAV_DETECTEDJB", jbStrap, 1);
if (getenv("POJAV_DETECTEDJB")) {
regLog("[Pre-Init] %s with iOS %s (Jailbroken)", deviceHardware, deviceSoftware);
} else {
regLog("[Pre-Init] %s with iOS %s (Unjailbroken)", deviceHardware, deviceSoftware);
}
regLog("[Pre-init] Entitlements availability:");
printEntitlementAvailability(@"com.apple.developer.kernel.extended-virtual-addressing");
printEntitlementAvailability(@"com.apple.developer.kernel.increased-memory-limit");
@@ -71,6 +131,7 @@ void init_logDeviceAndVer(char *argument) {
}
void init_migrateDirIfNecessary() {
// TODO: Rewrite to migrate from /usr/share -> new Docs in 2.2
NSString *completeFile = @"/var/mobile/Documents/.pojavlauncher/migration_complete";
NSString *oldDir = @"/var/mobile/Documents/.pojavlauncher";
if ([fm fileExistsAtPath:oldDir] && ![fm fileExistsAtPath:completeFile]) {
@@ -232,15 +293,23 @@ int main(int argc, char * argv[]) {
JNI_TRUE, JNI_FALSE, JNI_TRUE);
}
init_checkForJailbreak();
init_migrateDirIfNecessary();
setenv("BUNDLE_PATH", dirname(argv[0]), 1);
// Are we running on a jailbroken environment?
if (strncmp(argv[0], "/Applications", 13) == 0) {
setenv("HOME", "/usr/share", 1);
setenv("OLD_POJAV_HOME", "/var/mobile/Documents/.pojavlauncher", 1);
setenv("POJAV_HOME", "/usr/share/pojavlauncher", 1);
if (getenv("POJAV_DETECTEDJB")) {
// TODO: Set to new Docs for both jben and unjben in 2.2
if (0 == access("/usr/share/pojavlauncher", F_OK)) {
// If /usr/share/pojavlauncher isnt already available
// this code will crash the app on launch
setenv("HOME", "/usr/share", 1);
setenv("OLD_POJAV_HOME", "/var/mobile/Documents/.pojavlauncher", 1);
setenv("POJAV_HOME", "/usr/share/pojavlauncher", 1);
} else {
setenv("POJAV_HOME", [NSString stringWithFormat:@"%s/Documents", getenv("HOME")].UTF8String, 1);
}
} else {
setenv("POJAV_HOME", [NSString stringWithFormat:@"%s/Documents", getenv("HOME")].UTF8String, 1);
}
Binary file not shown.