Skip to content

Commit

Permalink
GameSwitcher: Faster pause/resume + save menu (press START) (#1747)
Browse files Browse the repository at this point in the history
## Changes

- Improved startup time for GameSwitcher (<1 second)
- Improved "time to resume" for GameSwitcher (instant, when going back
to RetroArch)
- Added save menu (press <kbd>START</kbd> to activate)
- Resume: Resumes the game (same as pressing <kbd>A</kbd> in normal
view)
  - Save: Creates a save state for the next save slot
- Load: Select a state by pressing <kbd>LEFT</kbd>/<kbd>RIGHT</kbd>,
press <kbd>A</kbd> to load, or <kbd>X</kbd> to delete
- Exit to menu: quits the game and returns you to MainUI (same as
pressing <kbd>B</kbd> in normal view)

## Preview


![GameSwitcher_003](https://github.com/user-attachments/assets/5ab495d0-aa6f-4a79-a238-c8fc11377214)

See the performance improvement in the below video (left is before,
right is after).


https://github.com/user-attachments/assets/65c87841-b502-4797-a806-a38f6b9adaba
  • Loading branch information
Aemiii91 authored Jan 15, 2025
1 parent 31cbd83 commit 13cebdf
Show file tree
Hide file tree
Showing 57 changed files with 3,225 additions and 1,276 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

TARGET=Onion
VERSION=4.4.0
RA_SUBVERSION=1.19.1-2
RA_SUBVERSION=1.19.1-3

###########################################################

Expand Down
4 changes: 2 additions & 2 deletions src/batmon/batmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(int argc, char *argv[])
signal(SIGCONT, sigHandler);
signal(SIGUSR1, sigHandler);

display_init();
display_init(true);
int ticks = CHECK_BATTERY_TIMEOUT_S;

bool is_charging = false;
Expand Down Expand Up @@ -483,7 +483,7 @@ static void *batteryWarning_thread(void *param)
if (temp_flag_get("hasBatteryDisplay"))
break;
if (display_getBrightnessRaw() != 0) {
display_drawBatteryIcon(0x00FF0000, 15, RENDER_HEIGHT - 30, 10,
display_drawBatteryIcon(0x00FF0000, 15, g_display.height - 30, 10,
0x00FF0000); // draw red battery icon
}
usleep(0x4000);
Expand Down
2 changes: 1 addition & 1 deletion src/bootScreen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ INCLUDE_SHMVAR=1
include ../common/config.mk

TARGET = bootScreen
LDFLAGS := $(LDFLAGS) -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer
LDFLAGS := $(LDFLAGS) -lSDL -lSDL_image -lSDL_ttf -lSDL_rotozoom

include ../common/commands.mk
include ../common/recipes.mk
24 changes: 13 additions & 11 deletions src/bootScreen/bootScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@
#include "utils/file.h"
#include "utils/flags.h"
#include "utils/log.h"
#include "utils/sdl_direct_fb.h"

int main(int argc, char *argv[])
{
// Boot : Loading screen
// End_Save : Ending screen with save
// End : Ending screen without save

SDL_Init(SDL_INIT_VIDEO);
init(INIT_PNG);

if (argc > 1 && strcmp(argv[1], "clear") == 0) {
SDL_FillRect(screen, NULL, 0);
render();
return EXIT_SUCCESS;
}

char theme_path[STR_MAX];
theme_getPath(theme_path);

SDL_Surface *video = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
SDL_Surface *screen = SDL_CreateRGBSurface(SDL_HWSURFACE, 640, 480, 32, 0, 0, 0, 0);

SDL_Surface *background;
bool show_battery = false;
bool show_version = true;
Expand Down Expand Up @@ -95,10 +99,8 @@ int main(int argc, char *argv[])
}

// Blit twice, to clear the video buffer
SDL_BlitSurface(screen, NULL, video, NULL);
SDL_Flip(video);
SDL_BlitSurface(screen, NULL, video, NULL);
SDL_Flip(video);
render();
render();

if (argc > 1 && strcmp(argv[1], "Boot") != 0)
temp_flag_set(".offOrder", false);
Expand All @@ -108,9 +110,9 @@ int main(int argc, char *argv[])
#endif

TTF_CloseFont(font);
SDL_FreeSurface(screen);
SDL_FreeSurface(video);
SDL_Quit();
TTF_Quit();

deinit();

return EXIT_SUCCESS;
}
11 changes: 10 additions & 1 deletion src/common/components/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <string.h>
#include <strings.h>

#include "system/lang.h"
#include "utils/str.h"

#define MAX_NUM_VALUES 100
Expand Down Expand Up @@ -40,7 +41,7 @@ typedef struct ListItem {
int _reset_value;
void *icon_ptr;
void *preview_ptr;
char preview_path[STR_MAX];
char preview_path[4096];
char sticky_note[STR_MAX];
char info_note[STR_MAX];
} ListItem;
Expand Down Expand Up @@ -155,6 +156,14 @@ ListItem *list_addItemWithInfoNote(List *list, ListItem item, const char *info_n
return _item;
}

ListItem *list_addItemWithLang(List *list, ListItem item, const lang_hash key)
{
ListItem *_item = list_addItem(list, item);
if (lang_list && lang_list[key])
strcpy(_item->label, lang_list[key]);
return _item;
}

ListItem *list_currentItem(List *list)
{
if (list->active_pos >= list->item_count)
Expand Down
Loading

0 comments on commit 13cebdf

Please sign in to comment.