64dd & Japanese covers (#126)

<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->

This adds in the 64DD disk load menu to visualize the game box.
I also created a European and 64DD boxart packs

## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Improves boxart image support.

## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Tested on a local SC64

## Screenshots
<!-- (if appropriate): -->


## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.

<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
- Enhanced instructions in the README for boxart dimensions and
resources.
- Improved handling of box art rendering for various formats in the
menu.
- New functionality for displaying box art during disk loading in the
menu interface, including resource management for cleanup.

- **Bug Fixes**
- Resolved issues with rendering dimensions for specific types of box
art, improving visual consistency.

- **Documentation**
- Updated README to clarify the boxart requirements and provide multiple
download links for different regions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Robin Jones <networkfusion@users.noreply.github.com>
This commit is contained in:
Suprapote 2024-08-06 14:20:41 +02:00 committed by GitHub
parent a8830c01ab
commit 68cab6d40e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 59 additions and 12 deletions

View File

@ -50,11 +50,21 @@ An open source menu for N64 flashcarts.
These features are subject to change: These features are subject to change:
### ROM Boxart ### ROM Boxart
To use boxart, you need to place png files of size 158x112 in the folder `/menu/boxart` on the SD card. To use boxart, place PNG files in the `/menu/boxart` folder on the SD card with the following dimensions:
* Standard covers: 158x112
* 64DD covers: 129x112
* Japanese covers: 112x158
Each file must be named according to the 2 letter ROM ID, or 3 letter ROM ID including media type. Each file must be named according to the 2 letter ROM ID, or 3 letter ROM ID including media type.
i.e. for GoldenEye 2 letters, this would be `GE.png`. i.e. for GoldenEye 2 letters, this would be `GE.png`.
i.e. for GoldenEye 3 letters, this would be `NGE.png`. i.e. for GoldenEye 3 letters, this would be `NGE.png`.
A known set of PNG files using 2 letter ID's can be downloaded [here](https://mega.nz/file/6cNGwSqI#8X5ukb65n3YMlGaUtSOGXkKo9HxVnnMOgqn94Epcr7w). You can download these boxart packs:
[American Boxart](https://mega.nz/file/6cNGwSqI#8X5ukb65n3YMlGaUtSOGXkKo9HxVnnMOgqn94Epcr7w)
[European Boxart](https://mega.nz/file/O7AjDbRJ#VnVU10dq8HQvBUQptppI6PAcQMb8-Zembqav8WtAQ_M)
[64DD Boxart](https://mega.nz/file/O3JzwD7B#BYl1aV-pbrJ-MxWUbM_K0yGVIRbmSoxJJZqQInRzZyM)
### Menu Settings ### Menu Settings

View File

@ -31,7 +31,7 @@ component_boxart_t *component_boxart_init (const char *storage_prefix, char *gam
sprintf(file_name, "%.3s.png", game_code); sprintf(file_name, "%.3s.png", game_code);
path_push(path, file_name); path_push(path, file_name);
if (png_decoder_start(path_get(path), BOXART_WIDTH, BOXART_HEIGHT, 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;
} }
@ -40,7 +40,7 @@ component_boxart_t *component_boxart_init (const char *storage_prefix, char *gam
// TODO: This is bad, we should only check for 3 letter codes // TODO: This is bad, we should only check for 3 letter codes
sprintf(file_name, "%.2s.png", game_code + 1); sprintf(file_name, "%.2s.png", game_code + 1);
path_push(path, file_name); path_push(path, file_name);
if (png_decoder_start(path_get(path), BOXART_WIDTH, BOXART_HEIGHT, 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;
} }
@ -65,15 +65,20 @@ void component_boxart_free (component_boxart_t *b) {
} }
void component_boxart_draw (component_boxart_t *b) { void component_boxart_draw (component_boxart_t *b) {
if (b && b->image && b->image->width == BOXART_WIDTH && b->image->height == BOXART_HEIGHT) { int box_x = BOXART_X;
int box_y = BOXART_Y;
if (b && b->image && b->image->width <= BOXART_WIDTH_MAX && b->image->height <= BOXART_HEIGHT_MAX) {
rdpq_mode_push(); rdpq_mode_push();
rdpq_set_mode_copy(false); rdpq_set_mode_copy(false);
rdpq_tex_blit( if (b->image->height == BOXART_HEIGHT_MAX) {
b->image, box_x = BOXART_X_JP;
BOXART_X, box_y = BOXART_Y_JP;
BOXART_Y, } else if (b->image->width == BOXART_WIDTH_DD && b->image->height == BOXART_HEIGHT_DD) {
NULL box_x = BOXART_X_DD;
); box_y = BOXART_Y_DD;
}
rdpq_tex_blit(b->image, box_x, box_y, NULL);
rdpq_mode_pop(); rdpq_mode_pop();
} else { } else {
component_box_draw( component_box_draw(

View File

@ -73,10 +73,30 @@
#define BOXART_WIDTH (158) #define BOXART_WIDTH (158)
/** @brief The boxart picture height. */ /** @brief The boxart picture height. */
#define BOXART_HEIGHT (112) #define BOXART_HEIGHT (112)
/** @brief The boxart picture width (64DD). */
#define BOXART_WIDTH_DD (129)
/** @brief The boxart picture height. */
#define BOXART_HEIGHT_DD (112)
/** @brief The boxart picture maximum width. */
#define BOXART_WIDTH_MAX (158)
/** @brief The boxart picture maximum height. */
#define BOXART_HEIGHT_MAX (158)
/** @brief The box art position on the X axis. */ /** @brief The box art position on the X axis. */
#define BOXART_X (VISIBLE_AREA_X1 - BOXART_WIDTH - 24) #define BOXART_X (VISIBLE_AREA_X1 - BOXART_WIDTH - 24)
/** @brief The box art position on the Y axis. */ /** @brief The box art position on the Y axis. */
#define BOXART_Y (LAYOUT_ACTIONS_SEPARATOR_Y - BOXART_HEIGHT - 24) #define BOXART_Y (LAYOUT_ACTIONS_SEPARATOR_Y - BOXART_HEIGHT - 24)
/** @brief The box art position on the X axis for japanese caratules.*/
#define BOXART_X_JP (VISIBLE_AREA_X1 - BOXART_WIDTH_MAX + 21)
/** @brief The box art position on the Y axis for japanese caratules. */
#define BOXART_Y_JP (LAYOUT_ACTIONS_SEPARATOR_Y - BOXART_HEIGHT_MAX - 24)
/** @brief The box art position on the X axis for 64DD caratules.*/
#define BOXART_X_DD (VISIBLE_AREA_X1 - BOXART_WIDTH_DD - 23)
/** @brief The box art position on the Y axis for 64DD caratules. */
#define BOXART_Y_DD (LAYOUT_ACTIONS_SEPARATOR_Y - BOXART_HEIGHT_DD - 24)
/** @brief The scroll bar width. */ /** @brief The scroll bar width. */
#define LIST_SCROLLBAR_WIDTH (12) #define LIST_SCROLLBAR_WIDTH (12)

View File

@ -7,6 +7,7 @@
static bool load_pending; static bool load_pending;
static bool load_rom; static bool load_rom;
static component_boxart_t *boxart;
static char *convert_error_message (disk_err_t err) { static char *convert_error_message (disk_err_t err) {
@ -92,6 +93,8 @@ static void draw (menu_t *menu, surface_t *d) {
"R: Load with ROM" "R: Load with ROM"
); );
} }
component_boxart_draw(boxart);
} }
rdpq_detach_show(); rdpq_detach_show();
@ -148,6 +151,9 @@ static void load (menu_t *menu) {
} }
} }
static void deinit (void) {
component_boxart_free(boxart);
}
void view_load_disk_init (menu_t *menu) { void view_load_disk_init (menu_t *menu) {
if (menu->load.disk_path) { if (menu->load.disk_path) {
@ -163,6 +169,8 @@ void view_load_disk_init (menu_t *menu) {
if (err != DISK_OK) { if (err != DISK_OK) {
menu_show_error(menu, convert_error_message(err)); menu_show_error(menu, convert_error_message(err));
} }
boxart = component_boxart_init(menu->storage_prefix, menu->load.disk_info.id);
} }
void view_load_disk_display (menu_t *menu, surface_t *display) { void view_load_disk_display (menu_t *menu, surface_t *display) {
@ -174,4 +182,8 @@ void view_load_disk_display (menu_t *menu, surface_t *display) {
load_pending = false; load_pending = false;
load(menu); load(menu);
} }
if (menu->next_mode != MENU_MODE_LOAD_DISK) {
deinit();
}
} }