Improve boxart

Minor fixes for:
* menu error SFX
* RTC text
This commit is contained in:
Robin Jones 2024-10-23 13:46:29 +01:00
parent f01fb77db3
commit 9020445c17
5 changed files with 25 additions and 13 deletions

View File

@ -40,20 +40,28 @@ component_boxart_t *component_boxart_init (const char *storage_prefix, char *gam
switch (current_image_view) { switch (current_image_view) {
case IMAGE_GAMEPAK_FRONT: case IMAGE_GAMEPAK_FRONT:
path_push(path, "gamepak_front.png"); path_push(path, "gamepak_front.png");
break;
case IMAGE_GAMEPAK_BACK: case IMAGE_GAMEPAK_BACK:
path_push(path, "gamepak_back.png"); path_push(path, "gamepak_back.png");
break;
case IMAGE_BOXART_BACK: case IMAGE_BOXART_BACK:
path_push(path, "boxart_back.png"); path_push(path, "boxart_back.png");
break;
case IMAGE_BOXART_LEFT: case IMAGE_BOXART_LEFT:
path_push(path, "boxart_left.png"); path_push(path, "boxart_left.png");
break;
case IMAGE_BOXART_RIGHT: case IMAGE_BOXART_RIGHT:
path_push(path, "boxart_right.png"); path_push(path, "boxart_right.png");
break;
case IMAGE_BOXART_BOTTOM: case IMAGE_BOXART_BOTTOM:
path_push(path, "boxart_bottom.png"); path_push(path, "boxart_bottom.png");
break;
case IMAGE_BOXART_TOP: case IMAGE_BOXART_TOP:
path_push(path, "boxart_top.png"); path_push(path, "boxart_top.png");
break;
default: default:
path_push(path, "boxart_front.png"); path_push(path, "boxart_front.png");
break;
} }
if (file_exists(path_get(path))) { if (file_exists(path_get(path))) {
@ -65,12 +73,13 @@ component_boxart_t *component_boxart_init (const char *storage_prefix, char *gam
} }
else { // compatibility mode else { // compatibility mode
char file_name[8]; char file_name[9];
// reset the directory path used for boxart. // reset the directory path used for boxart.
path_free(path);
path = path_init(storage_prefix, BOXART_DIRECTORY); path = path_init(storage_prefix, BOXART_DIRECTORY);
sprintf(file_name, "%c%c%c%c.png", game_code[0], game_code[1], game_code[2], game_code[3]); snprintf(file_name, sizeof(file_name), "%c%c%c%c.png", game_code[0], game_code[1], game_code[2], game_code[3]);
path_push(path, file_name); path_push(path, file_name);
if (file_exists(path_get(path))) { if (file_exists(path_get(path))) {
@ -81,21 +90,19 @@ component_boxart_t *component_boxart_init (const char *storage_prefix, char *gam
} }
path_pop(path); path_pop(path);
sprintf(file_name, "%c%c%c.png", game_code[0], game_code[1], game_code[2]); snprintf(file_name, sizeof(file_name), "%c%c%c.png", game_code[0], game_code[1], game_code[2]);
path_push(path, file_name); path_push(path, file_name);
if (file_exists(path_get(path))) {
if (file_exists(path_get(path))) { if (file_exists(path_get(path))) {
if (png_decoder_start(path_get(path), BOXART_WIDTH_MAX, BOXART_HEIGHT_MAX, png_decoder_callback, b) == PNG_OK) { if (png_decoder_start(path_get(path), BOXART_WIDTH_MAX, BOXART_HEIGHT_MAX, png_decoder_callback, b) == PNG_OK) {
path_free(path); path_free(path);
return b; return b;
} }
} }
}
else { else {
path_pop(path); path_pop(path);
sprintf(file_name, "%c%c.png", game_code[1], game_code[2]); snprintf(file_name, sizeof(file_name), "%c%c.png", game_code[1], game_code[2]);
path_push(path, file_name); path_push(path, file_name);
if (file_exists(path_get(path))) { if (file_exists(path_get(path))) {
if (png_decoder_start(path_get(path), BOXART_WIDTH_MAX, BOXART_HEIGHT_MAX, png_decoder_callback, b) == PNG_OK) { if (png_decoder_start(path_get(path), BOXART_WIDTH_MAX, BOXART_HEIGHT_MAX, png_decoder_callback, b) == PNG_OK) {

View File

@ -4,8 +4,8 @@
static void process (menu_t *menu) { static void process (menu_t *menu) {
if (menu->actions.back) { if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT); sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
} }
} }

View File

@ -94,8 +94,10 @@ static void draw (menu_t *menu, surface_t *d) {
); );
} }
if (boxart != NULL) {
component_boxart_draw(boxart); component_boxart_draw(boxart);
} }
}
rdpq_detach_show(); rdpq_detach_show();
} }

View File

@ -262,7 +262,9 @@ static void draw (menu_t *menu, surface_t *d) {
"R: Options" "R: Options"
); );
if (boxart != NULL) {
component_boxart_draw(boxart); component_boxart_draw(boxart);
}
if (show_extra_info_message) { if (show_extra_info_message) {
component_messagebox_draw( component_messagebox_draw(
@ -335,6 +337,7 @@ static void load (menu_t *menu) {
static void deinit (void) { static void deinit (void) {
component_boxart_free(boxart); component_boxart_free(boxart);
boxart = NULL;
} }

View File

@ -36,7 +36,7 @@ static void draw (menu_t *menu, surface_t *d) {
"\n" "\n"
"\n" "\n"
"To set the date and time, please use the PC terminal\n" "To set the date and time, please use the PC terminal\n"
"application and set via USB or a game that uses it.\n\n" "application and set via USB,\n or a N64 game with RTC support.\n\n"
"Current date & time: %s\n", "Current date & time: %s\n",
menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown\n" menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown\n"
); );