Provenance-Emu / Provenance

iOS & tvOS multi-emulator frontend, supporting various Atari, Bandai, NEC, Nintendo, Sega, SNK and Sony console systems… Get Started: https://wiki.provenance-emu.com |
https://provenance-emu.com
Other
5.92k stars 686 forks source link

[Feature] Add auto JIT #2118

Open JoeMatt opened 1 year ago

JoeMatt commented 1 year ago

See:

alexchandel commented 1 year ago

Here's a kit that allows you to automatically enable JIT. Usage is dead-simple:

import AltKit

ServerManager.shared.startDiscovering()

ServerManager.shared.autoconnect { result in
    switch result
    {
    case .failure(let error): print("Could not auto-connect to server.", error)
    case .success(let connection):
        connection.enableUnsignedCodeExecution { result in
            switch result
            {
            case .failure(let error): print("Could not enable JIT compilation.", error)
            case .success: 
                print("Successfully enabled JIT compilation!")
                ServerManager.shared.stopDiscovering()
            }

            connection.disconnect()
        }
    }
}
alexchandel commented 1 year ago

Since implementation is so simple, you could easily support several ways of enabling JIT, and just use whichever succeeds in connecting.