libretro-mirrors / libretro-arb

For proposed improvements to libretro API.
8 stars 2 forks source link

signal a shutdown is imminent #3

Closed andres-asm closed 10 years ago

andres-asm commented 10 years ago

It could be useful to have an environment callback that tells the core that a shutdown is imminent so it can cleanup, save data if it's the case, etc.

Should be called within retro_run, then the core could perform any task it needs before unload occurs.

Alcaro commented 10 years ago

Power state change signals would reasonably be delivered to the frontend, where they should translate to the same sequence of actions as closing it in any other way - save SRAM, call retro_deinit, maybe save a savestate first. None of that requires a libretro addition. Or if you mean that the user tells the core that it's close time (while the front only sees RETRO_DEVICE_ID_JOYPAD_B), that would be RETRO_ENVIRONMENT_SHUTDOWN. Do you have anything else in mind, or are those satisfactory?

Alcaro commented 10 years ago

No reply, and I'm pretty sure this was an attempt to work around threading issues in PPSSPP; I made proper fixes for a few issues around there. I'll assume this one is no longer needed.

andres-asm commented 10 years ago

Yeah it was about PPSSPP but I think it could be useful for game cores. For example an online multiplayer game. If you exit via the frontend it would shut-down uncleanly. It's like when a PC game force quits, the other players get client timed-out after a few minutes. If the frontend could signal the core to shutdown it could at least force a disconnection and the other players would get a player left the game message.

It might seem an unimportant thing but depending on the game server a player that exited the game unclenaly can stay there for quite a bit of time before the server forcefully disconnects him, and he could be carrying the flag or something resulting in a bad experience for everyone.

Anyway maybe I was thinking to far ahead.

Alcaro commented 10 years ago

Let's take care of netplay issues once someone creates a netplay proposal; no need to preemptively create a feature that may be useful in the future.