From 0688325a887ddfc24f5904204a4635af66d85444 Mon Sep 17 00:00:00 2001 From: neonloop Date: Mon, 22 Mar 2021 15:11:21 +0000 Subject: Adds per-game config when loading a game from args Per-game config can only be loaded after the CD image is loaded, which has to happen after plugins are initialized, which has to happen after the config is loaded. This change loads the global config first, and tries to load per-game config after the CD is loaded. This may not work 100% of the time, but works better than it does right now. --- frontend/main.c | 1 + frontend/menu.c | 2 +- frontend/menu.h | 1 + frontend/plat_trimui.c | 56 +++++++++++++++++++++++++------------------------- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/frontend/main.c b/frontend/main.c index e2b00d6..c1f1cc4 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -633,6 +633,7 @@ int main(int argc, char *argv[]) SysPrintf(_("Could not load CD-ROM!\n")); return -1; } + menu_load_config(1); emu_on_new_cd(!loadst); ready_to_go = 1; } diff --git a/frontend/menu.c b/frontend/menu.c index 2196258..fc95294 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -595,7 +595,7 @@ static void parse_str_val(char *cval, const char *src) static void keys_load_all(const char *cfg); -static int menu_load_config(int is_game) +int menu_load_config(int is_game) { char cfgfile[MAXPATHLEN]; int i, ret = -1; diff --git a/frontend/menu.h b/frontend/menu.h index 8f5acda..db9b665 100644 --- a/frontend/menu.h +++ b/frontend/menu.h @@ -2,6 +2,7 @@ #define __MENU_H__ void menu_init(void); +int menu_load_config(int is_game); void menu_prepare_emu(void); void menu_loop(void); void menu_finish(void); diff --git a/frontend/plat_trimui.c b/frontend/plat_trimui.c index 907a03a..6b1038a 100644 --- a/frontend/plat_trimui.c +++ b/frontend/plat_trimui.c @@ -176,34 +176,34 @@ void plat_minimize(void) { } -#define make_flip_func(name, scale, blitfunc) \ -static void name(int doffs, const void *vram_, int w, int h, int sstride, int bgr24) \ -{ \ - const unsigned short *vram = vram_; \ - unsigned char *conv = (unsigned char *)cspace_buf; \ - unsigned char *dst = (unsigned char *)screen->pixels + \ - (fb_offset_y * 320 + fb_offset_x) * sizeof(uint16_t); \ - int dst_stride = 640; \ - int len = psx_src_width * psx_bpp / 8; \ - int i; \ - void (*convertfunc)(void *dst, const void *src, int bytes); \ - convertfunc = psx_bpp == 24 ? bgr888_to_rgb565 : bgr555_to_rgb565; \ - \ - SDL_LockSurface(screen); \ - vram += psx_offset_y * 1024 + psx_offset_x; \ - for (i = psx_src_height; i > 0; i--, \ - vram += psx_step * 1024, \ - dst += dst_stride, \ - conv += dst_stride) { \ - if (scale) { \ - convertfunc(conv, vram, len); \ - blitfunc(dst, conv, dst_stride); \ - } else { \ - convertfunc(dst, vram, len); \ - } \ - } \ - SDL_UnlockSurface(screen); \ -} +#define make_flip_func(name, scale, blitfunc) \ + static void name(int doffs, const void *vram_, int w, int h, int sstride, int bgr24) \ + { \ + const unsigned short *vram = vram_; \ + unsigned char *conv = (unsigned char *)cspace_buf; \ + unsigned char *dst = (unsigned char *)screen->pixels + \ + (fb_offset_y * 320 + fb_offset_x) * sizeof(uint16_t); \ + int dst_stride = 640; \ + int len = psx_src_width * psx_bpp / 8; \ + int i; \ + void (*convertfunc)(void *dst, const void *src, int bytes); \ + convertfunc = psx_bpp == 24 ? bgr888_to_rgb565 : bgr555_to_rgb565; \ + \ + SDL_LockSurface(screen); \ + vram += psx_offset_y * 1024 + psx_offset_x; \ + for (i = psx_src_height; i > 0; i--, \ + vram += psx_step * 1024, \ + dst += dst_stride, \ + conv += dst_stride) { \ + if (scale) { \ + convertfunc(conv, vram, len); \ + blitfunc(dst, conv, dst_stride); \ + } else { \ + convertfunc(dst, vram, len); \ + } \ + } \ + SDL_UnlockSurface(screen); \ + } make_flip_func(raw_blit_soft, false, memcpy) make_flip_func(raw_blit_soft_368, true, blit320_368) -- cgit v1.2.3