feat: port game switcher from NextUI with preview path fix#68
feat: port game switcher from NextUI with preview path fix#68charveey wants to merge 1 commit intoTurro75:mainfrom
Conversation
Port game switcher feature from NextUI by @frysee with modifications to properly build preview_path for save state display. Original work: LoveRetro#27 Changes from original: - Fix preview_path building in readyResumePath() to support switcher - Build state path and preview path based on selected slot number - Set has_preview flag when preview file exists - Use getStatePath() to determine correct preview location
There was a problem hiding this comment.
My modifications
The original NextUI code didn't build preview_path properly, causing previews not to display. I added this to readyResumePath() function:
// Build the state path for preview
char state_path[256];
getStatePath(path, state_path);
// Build preview_path based on the slot
if (last_selected_slot > 0) {
sprintf(preview_path, "%s/%s.state%d.png", state_path, rom_file, last_selected_slot);
} else {
sprintf(preview_path, "%s/%s.state.png", state_path, rom_file);
}
has_preview = exists(preview_path);This ensures preview_path is properly set so the switcher can actually load and display the preview images.
Testing
So far the code has only been tested on MM+ :
- Tested with games that have save states
- Tested with games without save states
- Verified LEFT/RIGHT navigation and wraparound
- Confirmed Y button removes games from recents
- Verified A button launches selected game
|
Thanks for Your contribute, I tested it Yesterday, in minui it shows the preview of the original scale and rotation ignoring the view at the time of exiting from the game, since minarch actually blit on the screen the frame rotated according to the real screen orientation I use this snippet in minarch to get the current snapshot: menu.bitmap = rotozoomSurface(screengame, (4-gamerotate)*90.0, 1.0, 1); SDL_Surface* backing = SDL_CreateRGBSurface(SDL_SWSURFACE,DEVICE_WIDTH,DEVICE_HEIGHT,FIXED_DEPTH,RGBA_MASK_565); // SDL_BlitSurface(menu.bitmap, NULL, backing, NULL); SDL_BlitScaled(menu.bitmap, NULL, backing, NULL); I don't like the removal of the item from recent, I would prefer creating a new savestate at every game exit (i.e. in slot 0) then coloring the selection dot or the frame around preview in red to make the user aware that the selected preview is the one created at last exit. |
|
It is suggested to use a method that does not occupy the user's selected storage location to save game switching points. I think this is more reasonable. |
Port game switcher feature from NextUI by @frysee with modifications
to properly build preview_path for save state display. See #44
Original work: LoveRetro#27
Changes from original: