iNDS
iNDS copied to clipboard
JIT support
I'm sorry if I'm rushing the development of this project
But adding JIT support could really help with emulation like 200% Just like we see inside PPSSPP all the amazing performance is because of JIT
And thanks in advance
There is JIT support, but only for 32bit devices :/
There was a discussion earlier today related to a year old post by qwertyoruiop on Reddit regarding a release of a library which brings JIT support in iOS 9 and later. Might be worth checking out in the future: https://www.reddit.com/r/jailbreak/comments/5qy2x0/beta_jitsupport_kernelless_jit_support_for_ios_9/
There is further discussion from RetroArch here: https://github.com/libretro/RetroArch/issues/3468
The appropriate syscall and flags are documented if you scroll further down in the issue that I linked.
@FrederickGeek8 To me it looks like @WilliamLCobb has already implemented the syscall and flags but newer iOS versions have broken things. Additionally, iNDS uses 4096 sized pages and I am pretty sure that is not the case for 64bit devices.
I did some quick checks into how PPSPP implemented JIT. The implementation is in https://github.com/hrydgard/ppsspp/blob/master/Common/MemoryUtil.cpp and the iOS checks are done by calling PlatformIsWXExclusive
. I took a look at the history of the file and there was a fix iOS here:
https://github.com/hrydgard/ppsspp/commit/193b5f309490bac0c5a5d5d178c5274252c9a610#diff-2b8fbb5b62261b971fe141ef565cdbaf
hrydgard also explains a bit more of the fixes here, https://github.com/hrydgard/ppsspp/issues/9232 Hopefully this helps.
@kprinssu Thanks for that. I've been looking at the same thing. ~~It's starting to look like it shouldn't be as difficult as I originally expected it to be given the preexisting literature.~~ This is going to be a long and difficult project IMO. The deeper I dig, the harder it looks.
I was just trying to decide whether I should look into qwertyoruiop's library (despite it not supporting non-jailbroken devices) since in the comments it seemed like people had some problems with PPSPP's implementation. I just tweeted at qwertyoruiop about whether his JITSupport library is still maintained but I doubt I will receive a reply (alas, he is popular and probably has flooded mentions).
EDIT (while I was writing this): from @ qwertyoruiop on Twitter
i haven't been maintaining it much as it appeared like there was no interest when it was released, but AFAIK it should still work.. I think it was on the http://yalu.qwertyoruiop.com repo. You can freely rehost it if you so wish.
@kprinssu If you think you have a good grasp on this, feel free to submit a PR. I'm going away this weekend (without my computer), so I might not be able to put anything out before then. If you do decide to take it up, I'll be available on Gitter if you have any questions.
AsmJIT has an arm backend currently being worked on. Since DeSmuME uses AsmJIT for JIT, getting JIT support for ARM/64 shouldn't be too hard. Otherwise, updating Lightning JIT to 2.1.2 (we are currently on 1.2, which was released over 10 years ago) should prove to be useful too.
@WilliamLCobb Remember that issue with the JIT hack to allow it to run on jailed devices? https://github.com/WilliamLCobb/iNDS/issues/44#issuecomment-220731803
PPSSPP just received a pull request and was merged that fixes the issue. https://github.com/hrydgard/ppsspp/pull/12421
@Dulslingr This will make JIT possible, someone just needs to write the library to do it
Honestly our best is waiting for someone to write ARM64 JIT for a Nintendo Switch port of DeSmuME or MelonDS. Once that happens we can easily port it to iOS
Sadly it seems the fix is broken for non jailbreak. some workaround is still needed for non jailbreak still.
@FrederickGeek8 @WilliamLCobb Just as a heads-up: but melonDS now has working ARM64 JIT for the Nintendo Switch, which has been merged into the project's official JIT branch (not sure if it's in master yet). Reportedly, the Switch can play most games now at full speed, which bodes well for newer iOS devices given how much weaker its CPU is than Apple's recent chips.
Actually, given the rate of melonDS's progress, I wonder how much of a headache it would be to port the core over to iOS, using the iNDS UI as a front-end. Partly-working DS WiFi emulation on iOS devices would be pretty slick, as would its OpenGL internal upscaling with minimal performance cost!
Apologies if I'm reviving an old thread, but in light of the recent news that iOS 14.2 now supports JIT, could we now hope for full JIT support in NDS?
@m4rkd7 That's great news! I suppose implementing it is possible, but I can't give a timeline at this time. I'll have to look into how JIT works on iOS 14.2. Any help is welcomed :)
An update (for those who don't already know) from that I posted in #222
Regarding JIT: We already have a thread open about this #16. Unfortunately (and I'm going to post this on the thread now), it looks like JIT was removed in 14.4 and therefore it doesn't really make sense to support it at this point. It was a dream come true during 14.2, but alas it looks like that was just a dream too.