jpd002 / Play-

Play! - PlayStation2 Emulator
http://purei.org
Other
2.03k stars 249 forks source link

Don't scan /private/var/mobile #1337

Closed CastanaEddd closed 2 months ago

CastanaEddd commented 4 months ago

Results in large loading times on jailbroken devices and causes some devices to hang. Probably something that shouldn't be done on launch, maybe have this as a manual button/toggle inside the app? Fixes https://github.com/jpd002/Play-/issues/1227

CastanaEddd commented 4 months ago

Before: https://files.catbox.moe/9qpdyp.mp4

After: https://github.com/jpd002/Play-/assets/128545778/4a67606c-51e1-4aa2-8c9b-1e1ae68f5c53

jonahdecker commented 4 months ago

Before: https://files.catbox.moe/9qpdyp.mp4

After: https://github.com/jpd002/Play-/assets/128545778/4a67606c-51e1-4aa2-8c9b-1e1ae68f5c53

How did you change that so it only scans the Play! folder? I am trying to patch Play! to work on iOS 17 with TrollStore, but I keep running into lagging issues unless I am using iPhone Pro model. I have successfully enabled JIT and my app runs un-sandboxed, but there is something wrong with the emulator that causes it to lag.

CastanaEddd commented 3 months ago

Sorry for the delayed response this never showed up in my inbox for some reason. Also I'm not quite sure what you're asking about... You can view the changes I've made with this pull request in the "files changed" section of this page.

If you're confused on what's happening, basically on launch Play! will attempt to scan /private/var/mobile if an "active directory?" isn't specified (default behavior) or if a full device scan is forced (done when you scan through the settings page). For some reason this causes a bit of lag and results in the device being stuck on "Building Collection" indefinitely. What this pull request does is it changes it so that it only does that scan when a full device scan is forced.

This normally isn't a problem unless given permission to, something that's done on jailbroken installs and probably trollstore too when ran unsandboxed.

A compiled ipa with this change can be found in the github actions page of this fork.

jonahdecker commented 3 months ago

Thank you! I think you are right about the scan being indefinite because I have been trying to patch Play! to work with TrollStore on iOS 17 with no luck. It runs, but the lag in game is really bad and CocoaTop lists the Play.app process around 100 times and used nearly all of my CPU. These processes never end, so I think you are right. I will test out your IPA and see if it works.

Looks like TrollStoreJitEnabler, which is what I inject into Play! to enable JIT via TrollStore, is the problem. The app will crash unless I inject flotsam as well (makes iOS not kill your processes).

CastanaEddd commented 3 months ago

Hmm seems like the issue you're facing might be unrelated to what this patch is trying to address, but I'm glad to hear you got it working :)

Also on an unrelated note trollstore recently got native support for launching apps with JIT. With the new update you can open trollstore then launch Play! with JIT from there. Combined with the custom URL-scheme you could create a shortcut to automatically enable and launch the app with JIT. Might possibly be a better alternative to whatever tweak you're trying to inject to into it.

jonahdecker commented 3 months ago

I heard about that. However, I wanted to get the apps to have JIT enabled natively without any shortcuts or going through TrollStore. I was actually able to fix the bug in TrollStoreJitEnabler that was causing memory issues by changing one line of code. Now I have Play! patched correctly and JIT works natively. If you use the dylib from my fork and sign with the required_entitlements.plist file it will work.

It can be used to enable JIT without having to launch TrollStore for any app you want.

jpd002 commented 2 months ago

I've been super out of the loop with iOS stuff, sorry about that. Since everyone seems to agree this is a good change, I'll merge it in. Thanks!

jonahdecker commented 2 months ago

I've been super out of the loop with iOS stuff, sorry about that. Since everyone seems to agree this is a good change, I'll merge it in. Thanks!

Great addition.