I'm writing a multi-emulator frontend for use with joystick-only setups (eg arcade cabinets and HTPCs). Most emulators require a keyboard input of some sort to exit the program, usually ALT-F4 or ESC, and I've had to solve this in a joystick-friendly way.
My frontend allows the user to select a ROM and an emulator to play it with, boots up the emulator, and sits in the background waiting for a certain multi-button "escape sequence" on the joystick/gamepad. When this sequence is entered, I close down the emulator process and return focus to the frontend, allowing the user to select a new ROM and emulator, and so on.
My first attempt at this functionality used the Win32 API method TerminateProcess. This shuts down the emulator rather abruptly, and in the case of some emulators can cause data loss - I've noticed ZSNES doesn't finish writing to (and presumably close the file handle of) SRM save data files until it successfully exits. So the user might use the escape sequence, kill ZSNES and lose a few hours of progress in Super Metroid :(((
This wouldn't do, so I implemented the more "polite" way of closing down the process: sending a WM_CLOSE message to the emulator's main window. Most emulators respond well to this, finishing up writes they have to do and closing down nicely. ZSNES doesn't seem to respond to the WM_CLOSE, however, and the only way to shut it down is via TerminateProcess.
So my question for the developers is, is this intentional? Is it perhaps something that can be changed, something not fundamental to ZSNES's (slim, speedy, optimized) architecture? Do you know of any other frontends that provide this sort of functionality, and if so how do they pull it off with ZSNES?
Closing ZSNES from another process? (ie frontends)
Moderator: ZSNES Mods
No, it's more like: press specific button, then you can use the stick to navigate the gui and use buttons to activate functions. You can find this under Misc/Gui Options. I realize this is probably not what you want unless the joypad you use has at least 7 buttons - 6 for SNES buttons and one to enter the GUI.
-
- Locksmith of Hyrule
- Posts: 3634
- Joined: Sun Aug 08, 2004 7:49 am
- Location: 255.255.255.255
- Contact:
Hyos: 9 buttons buddy...
A, B, X, Y, Select, Start, L, R, then one for the UI.

A, B, X, Y, Select, Start, L, R, then one for the UI.

<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
NSRT here.