mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-22 02:29:19 +01:00
Add ability for 3 letter ID for boxart (#47)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Allows boxart to be 3 letters by checking the "media type" if required.
It continues to be compatible with 2 letters.
Also update sodium64 rom address (changed in
d006af4870
).
## 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 -->
Fixes an issue for at least `DZ` which shares the same ID between
Dezaemon 3D for the 64DD and Duke Nukem: Zero Hour Cartridge.
## 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. -->
## 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! -->
- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [x] 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 commit is contained in:
parent
fc2f3aa42c
commit
c36bd4197e
@ -40,8 +40,10 @@ The aim is to replace [Altra64](https://github.com/networkfusion/altra64) and [E
|
|||||||
|
|
||||||
#### 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, you need to place png files of size 158x112 in the folder `/menu/boxart` on the SD card.
|
||||||
Each file must be named according to the 2 letter ROM ID. e.g. for goldeneye, this would be `GE.png`.
|
Each file must be named according to the 2 letter ROM ID, or 3 letter ROM ID including media type.
|
||||||
A known set of PNG files can be downloaded [here](https://mega.nz/file/6cNGwSqI#8X5ukb65n3YMlGaUtSOGXkKo9HxVnnMOgqn94Epcr7w).
|
i.e. for GoldenEye 2 letters, this would be `GE.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).
|
||||||
|
|
||||||
#### Emulator support
|
#### Emulator support
|
||||||
Emulators should be added to the `/emulators` directory on the SD card.
|
Emulators should be added to the `/emulators` directory on the SD card.
|
||||||
|
@ -91,7 +91,6 @@ cart_load_err_t cart_load_emulator (menu_t *menu, cart_load_emu_type_t emu_type,
|
|||||||
case CART_LOAD_EMU_TYPE_SNES:
|
case CART_LOAD_EMU_TYPE_SNES:
|
||||||
path_push(path, "sodium64.z64");
|
path_push(path, "sodium64.z64");
|
||||||
save_type = FLASHCART_SAVE_TYPE_SRAM;
|
save_type = FLASHCART_SAVE_TYPE_SRAM;
|
||||||
emulated_rom_offset = 0x104000;
|
|
||||||
break;
|
break;
|
||||||
case CART_LOAD_EMU_TYPE_GAMEBOY:
|
case CART_LOAD_EMU_TYPE_GAMEBOY:
|
||||||
path_push(path, "gb.v64");
|
path_push(path, "gb.v64");
|
||||||
@ -124,6 +123,7 @@ cart_load_err_t cart_load_emulator (menu_t *menu, cart_load_emu_type_t emu_type,
|
|||||||
|
|
||||||
switch (emu_type) {
|
switch (emu_type) {
|
||||||
case CART_LOAD_EMU_TYPE_SNES:
|
case CART_LOAD_EMU_TYPE_SNES:
|
||||||
|
// The emulator expects the header to be removed from the ROM being uploaded.
|
||||||
emulated_file_offset = ((file_get_size(path_get(path)) & 0x3FF) == 0x200) ? 0x200 : 0;
|
emulated_file_offset = ((file_get_size(path_get(path)) & 0x3FF) == 0x200) ? 0x200 : 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -59,7 +59,7 @@ typedef struct {
|
|||||||
surface_t *image;
|
surface_t *image;
|
||||||
} component_boxart_t;
|
} component_boxart_t;
|
||||||
|
|
||||||
component_boxart_t *component_boxart_init (uint16_t id);
|
component_boxart_t *component_boxart_init (uint8_t media_type, uint16_t id);
|
||||||
void component_boxart_free (component_boxart_t *b);
|
void component_boxart_free (component_boxart_t *b);
|
||||||
void component_boxart_draw (component_boxart_t *b);
|
void component_boxart_draw (component_boxart_t *b);
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../path.h"
|
#include "../path.h"
|
||||||
#include "../png_decoder.h"
|
#include "../png_decoder.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
|
#include "utils/fs.h"
|
||||||
|
|
||||||
|
|
||||||
#define BOXART_DIRECTORY "sd:/menu/boxart"
|
#define BOXART_DIRECTORY "sd:/menu/boxart"
|
||||||
@ -16,14 +17,18 @@ static void png_decoder_callback (png_err_t err, surface_t *decoded_image, void
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
component_boxart_t *component_boxart_init (uint16_t id) {
|
component_boxart_t *component_boxart_init (uint8_t media_type, uint16_t id) {
|
||||||
component_boxart_t *b = calloc(1, sizeof(component_boxart_t));
|
component_boxart_t *b = calloc(1, sizeof(component_boxart_t));
|
||||||
|
|
||||||
if (b) {
|
if (b) {
|
||||||
b->loading = true;
|
b->loading = true;
|
||||||
|
char *path = alloca(strlen(BOXART_DIRECTORY) + 1 + 7 + 1); // allocate for the largest path.
|
||||||
|
sprintf(path, "%s/%c%c%c.png", BOXART_DIRECTORY, (media_type & 0xFF), ((id >> 8) & 0xFF), (id & 0xFF));
|
||||||
|
|
||||||
char *path = alloca(strlen(BOXART_DIRECTORY) + 1 + 6 + 1);
|
// if the file does not exist, also check for just the id.
|
||||||
sprintf(path, "%s/%c%c.png", BOXART_DIRECTORY, ((id >> 8) & 0xFF), (id & 0xFF));
|
if (!file_exists(path)) {
|
||||||
|
sprintf(path, "%s/%c%c.png", BOXART_DIRECTORY, ((id >> 8) & 0xFF), (id & 0xFF));
|
||||||
|
}
|
||||||
|
|
||||||
if (png_decoder_start(path, BOXART_WIDTH, BOXART_HEIGHT, png_decoder_callback, b) != PNG_OK) {
|
if (png_decoder_start(path, BOXART_WIDTH, BOXART_HEIGHT, png_decoder_callback, b) != PNG_OK) {
|
||||||
free(b);
|
free(b);
|
||||||
|
@ -250,7 +250,7 @@ void view_load_rom_init (menu_t *menu) {
|
|||||||
|
|
||||||
rom_header = file_read_rom_header(path_get(path));
|
rom_header = file_read_rom_header(path_get(path));
|
||||||
|
|
||||||
boxart = component_boxart_init(rom_header.metadata.unique_identifier);
|
boxart = component_boxart_init(rom_header.metadata.media_type, rom_header.metadata.unique_identifier);
|
||||||
|
|
||||||
path_free(path);
|
path_free(path);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user