-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V1.8.0 on iOS #11905
Comments
Your interest is very welcome. It should be a matter of building it, mainly. There are instructions here: https://github.com/hrydgard/ppsspp/wiki/Build-instructions#building-for-ios-cmake There are some issues that only affect iOS. One (I wouldn't suggest trying to tackle this, just making you aware) is that since Apple doesn't allow applications to use jit by default, we use a workaround that enables jit on some OS versions / some jailbreak versions: Line 152 in aa927e0
However, this same workaround (although it makes it faster) has the downside of not working on newer iOS versions (afaik) and also causing the app to hang when closed by the task switcher. -[Unknown] |
Before compiling your build, maybe you can apply this fix and maybe it can solve issues #9186 (comment) |
Above code enables W^X JIT. However newer iOS SDK seems to inject some assertion code dynamically when build PPSSPP. Those code seems to assert code signature validity of dynamically compiled code. I could see log:
So iOS seems to kill PPSSPP few second after JIT has began. I think It's not runtime restriction. When I build it with old SDK, It runs well on iOS 12.2 beta device also with W^X JIT. |
According to this issue: #11881, commenting out syscall(SYS_ptrace, 0 /PTRACE_TRACEME/, 0, 0, 0); solved the problem |
I assume you mean solved the exit problem, not actually allowing jit. Or do you mean that you're able to use jit without this in some iOS version? It sounds like from @jeeeyul's comment that this isn't likely.
This makes sense, and probably explains why some users have said it's still working while others say it doesn't. Thanks for checking into this. Are we already targeting the old SDK by default in CMake or do we need to make that more explicit? I realize that eventually it won't be supported anymore. -[Unknown] |
I'd LOVE for 1.8 to make it's way to ios, @thorieo please keep us posted! |
At least, I could launch PPSSPP 1.7.1 with W^X JIT on my iOS 12.2 beta device.
I will test with latest PPSSPP later and I will tell more. |
The unwelcome friend who injects unwanted code that disables JIT comes with iOS12.1 SDK. NOT iOS itself. AppStore will force 12.1 or above SDK from 27 March. |
Sorry fo noob question. |
There's no such thing as X^Y jit, there's normal jit (fastest, used when we can map pages as Read, Write, eXecutable) and W^X jit (where Write and eXecute are mutually exclusive, that is, only one can be enabled at a time for a page of code, requiring special handling). |
Sorry for typo. @hrydgard is correct. |
Any hopes or updates on this? |
Thank you so much for clarification. |
For me even with IR interpretor, PPSSPP runs perfectly on my iPhone X R. There is one game that hangs after character and stage selection, Soul Calibur, Broken Destiny, but all other games I've tried, Mortal Kombat Unchained, Dissidia Final Fantasy and Duodecim, Tekken 6, all run perfectly. I know GIT will help older devices, but it may not be as big of a need. |
Well yeah, those Apple CPUs are becoming ridiculously fast so for the latest ones the IR interpreter is a decent option. |
Really hoping this can be figured out soon and someone compiles the latest versions. Would really love to have 1.8 on both iOS and Mac OS. It seems crazy with a high quality project like this to not have versions compiled for both iOS and Mac OS every time a big update number is released. The PPSSPP community is huge, I'm sure there is someone who can figure this out. |
@DrConflict It would help a lot with motivation if Apple didn't ban emulators fully from their stores. I prefer to support platforms where emulators are officially allowed, Apple will always be an afterthought. |
@hrydgard |
I hope that once 1.8.0 is built, the Build Store will be able to update their version.
… On Mar 24, 2019, at 2:39 PM, DrConflict ***@***.***> wrote:
@hrydgard <https://github.com/hrydgard>
I totally understand your point, and I agree with you. It's just sad that the iOS and Mac community has to miss out because of it though. PPSSPP still has an active Cydia repo as well which makes things a bit confusing. I assumed those were latest builds until I figured out the project was at 1.8.0 haha. I do appreciate all the work though, I'll be using 1.6.3 for now which works great anyway. Cheers
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#11905 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AOjJzmgGft10CeVh-3aDty72f-65WTyZks5vZ9SEgaJpZM4b4TTt>.
|
@DrConflict Sad or not it's what it is until Apple changes their mind. And I understand the confusion, the official Cydia repo was maintained by a volunteer who has mostly disappeared. Need to do something about that (not the disappearance, the repo). |
I could build and run PPSSPP 1.8.0 on iOS 12.2 with W^X JIT just now. All the things that I did:
main.mm // main.mm boilerplate
#import <UIKit/UIKit.h>
#import <string>
#import <stdio.h>
#import <stdlib.h>
#import <sys/syscall.h>
#import <AudioToolbox/AudioToolbox.h>
#import "AppDelegate.h"
#import "PPSSPPUIApplication.h"
#import "ViewController.h"
#include "base/NativeApp.h"
#include "profiler/profiler.h"
std::string System_GetProperty(SystemProperty prop) {
switch (prop) {
case SYSPROP_NAME:
return "iOS:";
case SYSPROP_LANGREGION:
return "en_US";
default:
return "";
}
}
int System_GetPropertyInt(SystemProperty prop) {
switch (prop) {
case SYSPROP_AUDIO_SAMPLE_RATE:
return 44100;
case SYSPROP_DISPLAY_REFRESH_RATE:
return 60000;
case SYSPROP_DEVICE_TYPE:
return DEVICE_TYPE_MOBILE;
default:
return -1;
}
}
bool System_GetPropertyBool(SystemProperty prop) {
switch (prop) {
case SYSPROP_HAS_BACK_BUTTON:
return false;
case SYSPROP_APP_GOLD:
#ifdef GOLD
return true;
#else
return false;
#endif
default:
return false;
}
}
void System_SendMessage(const char *command, const char *parameter) {
if (!strcmp(command, "finish")) {
exit(0);
}
}
void System_AskForPermission(SystemPermission permission) {}
PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; }
FOUNDATION_EXTERN void AudioServicesPlaySystemSoundWithVibration(unsigned long, objc_object*, NSDictionary*);
BOOL SupportsTaptic()
{
// we're on an iOS version that cannot instantiate UISelectionFeedbackGenerator, so no.
if(!NSClassFromString(@"UISelectionFeedbackGenerator"))
{
return NO;
}
// http://www.mikitamanko.com/blog/2017/01/29/haptic-feedback-with-uifeedbackgenerator/
// use private API against UIDevice to determine the haptic stepping
// 2 - iPhone 7 or above, full taptic feedback
// 1 - iPhone 6S, limited taptic feedback
// 0 - iPhone 6 or below, no taptic feedback
NSNumber* val = (NSNumber*)[[UIDevice currentDevice] valueForKey:@"feedbackSupportLevel"];
return [val intValue] >= 2;
}
void Vibrate(int mode) {
if(SupportsTaptic())
{
PPSSPPUIApplication* app = (PPSSPPUIApplication*)[UIApplication sharedApplication];
if(app.feedbackGenerator == nil)
{
app.feedbackGenerator = [[UISelectionFeedbackGenerator alloc] init];
[app.feedbackGenerator prepare];
}
[app.feedbackGenerator selectionChanged];
}
else
{
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
NSArray *pattern = @[@YES, @30, @NO, @2];
dictionary[@"VibePattern"] = pattern;
dictionary[@"Intensity"] = @2;
AudioServicesPlaySystemSoundWithVibration(kSystemSoundID_Vibrate, nil, dictionary);
}
}
int main(int argc, char *argv[])
{
// Simulates a debugger. Makes it possible to use JIT (though only W^X)
syscall(SYS_ptrace, 0 /*PTRACE_TRACEME*/, 0, 0, 0);
PROFILE_INIT();
@autoreleasepool {
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/assets/"];
NativeInit(argc, (const char**)argv, documentsPath.UTF8String, bundlePath.UTF8String, NULL);
return UIApplicationMain(argc, argv, NSStringFromClass([PPSSPPUIApplication class]), NSStringFromClass([AppDelegate class]));
}
} ViewController.mm -(UIRectEdge)preferredScreenEdgesDeferringSystemGestures
{
return UIRectEdgeAll;
} iOS 12.1 SDK seems to inject some assertion code when build just like ARC mechanism. This assertion cause killing the app when JIT code runs. So we have to use iOS12.0 SDK or below. I'v done with iOS 11.4SDK (ships with Xcode 9.4) In my inference, X^W JIT works on iOS because iOS think it's currently debugging by Xcode, PTRACE makes this available. (Debugging feature needs dynamic code evaluation to provide expression debugging - likes Calling PTRACE seems to play a role in deceiving iOS. However, Some context, iOS waits signals from Xcode forever, I think this makes freezing. This may explain why PPSSPP works and terminate well when it attached with Xcode debugger. All of these information are just came from my pure inference. If anyone find some error, please correct this. |
By the way, Apple will not change their mind. Even Apple allows emulators on AppStore, Allowing unsigned code running is too dangerous for normal users. All the problems related with JIT will remain. The only official way to run dynamic code is using ScriptKit. |
Are you planning to compile an IPA for 1.8.0 and post it here? I would be happy to test it for you |
@andyroid1023 I’ve already post everything those are needed to run PPSSPP1.8.0 on iOS 12.2. I wonder what you need to test. |
@jeeeyul Can you upload the 1.8.0 PPSSPP iOS .ipa file so people can start testing it please?! I don't understand why you would not post the actual .ipa as well if you said you got it working. Thanks in advance. |
On the iOS 11 & 12 Electra jailbreaks, it isn't required to call syscall 26 (and I recommend you don't, otherwise iOS will keep the process hung rather than exit it when you try and exit PPSSPP). Electra already disables codesigning completely in PPSSPP; so just don't run the syscall and everything will continue working fine. You can detect if it's bring run under Electra using csops: #define CS_OPS_STATUS 0 /* return status */
#define CS_DEBUGGED 0x10000000 /* process is currently or has previously been debugged and allowed to run with invalid pages */
int csops(pid_t pid, unsigned int ops, void * useraddr, size_t usersize);
uint32_t flags;
csops(getpid(), CS_OPS_STATUS, &flags, 0);
if (flags & CS_DEBUGGED){
//being run either under a debugger or under Electra already
} |
That makes sense. Want to send a PR wrapping the ptrace in that? Also, @jeeeyul - I'm guessing the animatedExit isn't a big loss, might be good to PR that if it makes Exit more stable too. -[Unknown] |
@coolstar @unknownbrackets I made a PR #11942 for this discussion. |
I wrote a simple ppsspp build tool. :P |
hey, I have found a way to exit ppsspp without it hanging. works every time. ppsspp version that I have on device: Maybe this will guide you to some great workaround to be able to quit ppsspp and still use jit. |
@Halo-Michael Having a separate builder and using Xcode to change the default version (and then change it back) is not necessary. All that needs to be done is the following:
You should have an updated PPSSPP version, built on iOS 11 SDK (that should help with crashes)! PS: If this should belong in the wiki as an aside, I don't mind writing this up in a more helpful, friendly way for others to use. :) EDIT: Tweaked some things, fixed some stuff, clarified items, etc. ;) |
@mariolopjr Yeah, that should be in the wiki. I could just copy-paste what you wrote above, but if you want to rewrite it or something first, be my guest :) |
@hrydgard Yeah, let me get something that makes a little more sense. It's a bit involved in comparison to the default instructions. I can say tho, it works extremely well. I really appreciate the work you've done with PPSSPP, it's absolutely amazing (and brings me back to my middle school days!). It's a shame Apple doesn't allow emulators on the store, I am sure with your bank of $$$$, they can figure out how to allow arbitrary code execution with JIT in a sandboxed app. Thanks again! |
@mariolopjr I'm just gonna copy it to the wiki as-is - ping me if you write a better version :) |
@hrydgard thanks that’s a good idea! I got a little busy and now dealing with the incoming hurricane haha. I will take a look and iterate on the instructions if they seem too difficult or if others have suggestions! |
With the release of Altstore, perhaps PPSSPP could have a more permanent, and updatable, home for iOS? The repo with created IPA's for PPSSPP is gone now though, and the IPA creator tool fails to run with Xcode 11, and MacOS Mojave: |
I 100% agree. |
@devinprater what tool? I was able to build PPSSPP with XCode 11 with sdk 13 targeting iOS 13 on Catalina. @unknownbrackets The hanging you described for closing ppsspp with task switch applies whether jit is used or not. I switched to the IR Interpreter and the issue is still present. Tested on PPSSPP_0v1.9.2-23-g349e64fe3 iPad OS 13.1.2 Compiled with XCode 11 SDK 13 and deployed for iOS 13. Signed with Cydia Impactor and it runs. Jit works as well. Heres a link to the build if anyone wants to try it. Make sure to close PPSSPP with the Exit button on the main menu instead of using task switcher otherwise PPSSPP will not work again until you reboot. I did target iOS 13 when building this so I am pretty sure it will only run on iOS 13. |
I don't know anything about Altstore, it seems like it's not documented how to add apps to it yet. Seems like a good idea, although it won't be able to run jit. The hack that makes it possible to use jit causes the hanging, whether or not you actually decide to use jit or not. It's not use of jit that causes the hanging. -[Unknown] |
@unknownbrackets Actually I just tested the beta Altstore with my build of PPSSPP and Jit does indeed work. Altstore is basically like Cydia Impactor after all. |
Whether the JIT itself works depends only on whether the system allows you to enable JIT, not how you compile (non-jailbreak mode). iOS11 and 13 seems allowed JIT work but 12 is not. |
The conversation earlier in this thread indicates the opposite and that SDK 12.1 at least injected code that prevented the use of Jit. Also remember that there is code in place to trick the device into thinking the app is being debugged which allows Jit to work at all on iOS. So the OS allowing it doesn't even make any sense. |
This tool is what I’m talking about:
https://github.com/Halo-Michael/ppsspp-builder <https://github.com/Halo-Michael/ppsspp-builder>
I get these errors in the output file attached.
… On Oct 6, 2019, at 1:12 AM, DuIslingr ***@***.***> wrote:
@devinprater <https://github.com/devinprater> what tool? I was able to build PPSSPP with XCode 11 with sdk 13 targeting iOS 13 on Catalina.
@unknownbrackets <https://github.com/unknownbrackets> The hanging you described for closing ppsspp with task switch applies whether jit is used or not. I switched to the IR Interpreter and the issue is still present.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#11905?email_source=notifications&email_token=ADUMTTWLEFEAYG4C5QCO7ETQNF6V7A5CNFSM4G7BGTW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAOCLSA#issuecomment-538715592>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ADUMTTSVPNHZ2UWFKN7VNU3QNF6V7ANCNFSM4G7BGTWQ>.
|
I think it should work, and I can’t view your error. |
Sorry, I’ll paste it below:
sh quick-make-ipa.sh
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- broken
-- Configuring incomplete, errors occurred!
See also "/Users/devinprater/ppsspp-builder/ppsspp/build-ios/CMakeFiles/CMakeOutput.log".
See also "/Users/devinprater/ppsspp-builder/ppsspp/build-ios/CMakeFiles/CMakeError.log".
Build settings from command line:
CODE_SIGN_IDENTITY =
CODE_SIGNING_REQUIRED = NO
PRODUCT_BUNDLE_IDENTIFIER = org.ppsspp.ppsspp
SDKROOT = iphoneos13.0
zip warning: name not matched: Payload/PPSSPP.app
zip error: Nothing to do! (try: zip -r9 ../../PPSSPP_0v1.9.2-17-g6a1676413.ipa . -i Payload/PPSSPP.app)
Done, you should get the ipa now :)
Hope this helps.
… On Oct 7, 2019, at 11:01 AM, Halo-Michael ***@***.***> wrote:
This tool is what I’m talking about: https://github.com/Halo-Michael/ppsspp-builder <https://github.com/Halo-Michael/ppsspp-builder> https://github.com/Halo-Michael/ppsspp-builder <https://github.com/Halo-Michael/ppsspp-builder> I get these errors in the output file attached.
… <x-msg://18/#>
On Oct 6, 2019, at 1:12 AM, DuIslingr @.***> wrote: @devinprater <https://github.com/devinprater> https://github.com/devinprater <https://github.com/devinprater> what tool? I was able to build PPSSPP with XCode 11 with sdk 13 targeting iOS 13 on Catalina. @unknownbrackets <https://github.com/unknownbrackets> https://github.com/unknownbrackets <https://github.com/unknownbrackets> The hanging you described for closing ppsspp with task switch applies whether jit is used or not. I switched to the IR Interpreter and the issue is still present. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#11905 <#11905>?email_source=notifications&email_token=ADUMTTWLEFEAYG4C5QCO7ETQNF6V7A5CNFSM4G7BGTW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAOCLSA#issuecomment-538715592>, or mute the thread https://github.com/notifications/unsubscribe-auth/ADUMTTSVPNHZ2UWFKN7VNU3QNF6V7ANCNFSM4G7BGTWQ <https://github.com/notifications/unsubscribe-auth/ADUMTTSVPNHZ2UWFKN7VNU3QNF6V7ANCNFSM4G7BGTWQ>.
I think it should work, and I can’t view your error.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#11905?email_source=notifications&email_token=ADUMTTR7HSYGMZNTKQWIFALQNNMO5A5CNFSM4G7BGTW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAQ4NFA#issuecomment-539084436>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ADUMTTVKXZNJHF7N3OJX3ODQNNMO5ANCNFSM4G7BGTWQ>.
|
@hrydgard @unknownbrackets @mariolopjr With my pull request (#12398 ) edit I am able to generate the project just fine with XCode 11 and SDK 13.1 and it builds fine. So the whole thing about having to download XCode 9.4.1 is unnecessary with this release. I modified the provided command to point to xcode 11.1 and sdk 13.1 and it generates without issue. |
After merge the pull request #12421 from sbingner, issue #12140 (#12140) can basically be confirmed as a complete fix. Even if you run PPSSPP on non jailbroken device, or if CS_DEBUGGED is not turned on, it will no longer freeze on exit. |
@Halo-Michael hey, is there any way you can re-upload the .ipa file again? Those links are expired/broken. Thanks |
See download ipas. :) |
Thanks, are these the ones that still exit at start of game when signed through Altstore?
… On Nov 17, 2019, at 8:55 AM, Benjamin Benda Gates ***@***.***> wrote:
See download ipas. :)
https://halo-michael.github.io/en_US/ <https://halo-michael.github.io/en_US/>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#11905?email_source=notifications&email_token=ADUMTTXLPCM57YOZVNY3443QUFLOPA5CNFSM4G7BGTW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEINZKI#issuecomment-554753193>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADUMTTQWXNZHTQCC3GYDZZLQUFLOPANCNFSM4G7BGTWQ>.
|
Sounds like compiling is working, and we have #12575 for the Altstore path, which seems like the right way forward. We still need a hero to take over maintaining the iOS port of PPSSPP and making sure Altstore is updated, etc. If anyone wants to volunteer, you're sure to make people happy. I'm going to close this though as the original issue is resolved and builds are working - I know Cydia isn't being updated, but I think #12575 is the right issue for that. -[Unknown] |
I’d love to help out in porting 1.8 or a 1.9 build to iOS. I’m gonna be honest I have no experience building apps or emulators but I’m basically proficient in most areas of Xcode and Opendev so if anyone can point me along or who I can help out I’d love you forever
The text was updated successfully, but these errors were encountered: