Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSP: Throw SDL_Quit event upon exit #10551

Merged
merged 1 commit into from
Aug 18, 2024

Conversation

sharkwouter
Copy link
Collaborator

Description

At the moment closing an SDL2 based application on the Playstation Portable using the home button will forcefully exit. This makes the application unable to make sure that everything exited out fine.

With this change, the user can handle the home button close in a way that makes sense for them. They will be forced to do so, though, as otherwise the application will freeze when trying to exit. I don't see this as different from how SDL2 based applications which do not handle the close button being pressed on PC not exiting, though. I think this is acceptable.

Existing Issue(s)

@@ -28,7 +30,9 @@ PSP_MAIN_THREAD_ATTR(THREAD_ATTR_VFPU | THREAD_ATTR_USER);

int sdl_psp_exit_callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
SDL_Event exit_event;
exit_event.quit = (SDL_QuitEvent) {SDL_QUIT, SDL_GetTicks()};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please zero the event and fill out the members individually, like the other places we sent SDL_QUIT.

Also, can you target main with new PRs? In this case the event name changed, so it's fine to have this and a separate PR for main, but in general our workflow is making changes in main and then cherry-picking to the SDL2 branches.

Thanks!

Copy link
Collaborator Author

@sharkwouter sharkwouter Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, my bad. I fixed it now. I will create the PR for SDL3.

@sharkwouter sharkwouter force-pushed the psp-fix-home-button-handling branch from 3f0c4d3 to ef8fa91 Compare August 18, 2024 11:25
@sharkwouter sharkwouter requested a review from slouken August 18, 2024 11:26
@slouken slouken merged commit e52e68d into libsdl-org:SDL2 Aug 18, 2024
40 checks passed
@slouken
Copy link
Collaborator

slouken commented Aug 18, 2024

Merged, thanks!

@slouken
Copy link
Collaborator

slouken commented Aug 18, 2024

It turns out there's already a function for this, so I switched your change to use that instead.

@sharkwouter
Copy link
Collaborator Author

Oh that is useful, I wasn't aware of that. Thanks for making the change!

@sharkwouter sharkwouter deleted the psp-fix-home-button-handling branch August 18, 2024 18:11
@slouken
Copy link
Collaborator

slouken commented Aug 18, 2024

You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants