3 ms·
I'm not an expert in emulation but I am curious if one could recompile ROMs AOT such that JIT is not required by the emulator? Say, statically recompile the RO
by apatheticonion 3y ago
I'm not an expert in emulation but I am curious if one could recompile ROMs AOT such that JIT is not required by the emulator?
Say, statically recompile the ROM on your PC then move the emulator-specific binary to the iOS device.
Would such an approach be permissible by Apple? Is it possible to do so while sharing the source code for the JIT layer?
I suppose the binary format must itself be natively compatible by iOS otherwise you'd need to have a JIT layer for your binary format - right?
- wmf 3y agoIIRC Apple also doesn't allow apps to load binary code at runtime. Redistributing derivatives of ROMs also sounds like a copyright problem.
- apatheticonion 3y agoCould you recompile a ROM and embed it with a universal "emulator" game engine? (in the same way the OpenGoal project that recompiled Jak) I guess that would be illegal because you'd then need to distribute the game code. Perhaps a toolkit that allows users to compile the emulator+rom themselves? But then I guess Apple doesn't let users run their own unsigned binaries so that's not possible :/
- danielheath 3y agoYou could do Rosetta style conversion up front of the complete binary to get around the JIT ban, but that’s still loading code at runtime.
- avianlyric 3y agoHistorically the justification for limiting the use of JIT compilers is for security reasons, which does actually stack up. JIT compilers are one of few use cases where an application absolutely needs the ability to write data to memory, mark that memory region as executable, and then execute the op codes in that memory region. On iOS, other than Safari, no application, either built in or installed via the App Store is allowed to change memory permissions from writable to executable, and that acts as a cornerstone in iOS application sandboxing. Now there’s perfectly good argument that the security argument doesn’t really stack up anymore, given that sandboxing technologies have progressed a lot, and it should be possible to properly sandbox a JIT compiler or similar. But there’s no denying the fact that removing the ability for an application to execute arbitrary created op codes is a very good way to completely eradication a huge surface area for exploits. Especially when such restrictions are paired with static scanning of binaries before signing (which happens when any binary is produced for iOS, via Apples signing service). All of that is to say, there is a possible world where ROM are transpiled for iOS devices (using something like Rosetta), and loaded as signed binaries via emulation wrappers. But at point you’re basically having to create your own App Store, and sign a new app for each transpiled ROM. In short, it doesn’t seem likely we’ll see JIT powered emulators on iOS anytime soon, and, at least in this specific instance, Apple has a legitimate security reason for restricting their usage.
- apatheticonion 3y agoIf Apple is compelled to allow users to run unsigned binaries (like Android) - would that allow for JIT emulators to run or is there something fundamentally blocking the execution of JIT code in iOS that prevents this?
- phire 3y agoThere is no technical limitation, there is even an API for doing so. It's just that apple block any submissions using that API from the app store.
- avianlyric 3y agoiOS itself almost certainly also blocks usages of that API as well, unless the binary is signed with the correct entitlements. But if Apple was forced to allow any binary to execute, and utilise any entitlement/API, then yeah there’s nothing stopping a JIT emulator running on iOS. But I think it’s very unlikely the EU would go that far, I don’t think such actions are needed for the EU to achieve their aims (liberalisation of app economy and markets).
- Wowfunhappy 3y ago> Say, statically recompile the ROM on your PC Basically impossible. https://andrewkelley.me/post/jamulator.html https://andrewkelley.me/post/jamulator.html