From 91f2e02d346085ce4d6b426e74ceb77b55f69962 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 21 May 2024 17:02:16 +0100 Subject: [PATCH 1/8] Add Dev rolling prerelease (#104) ## Description Adds a pre-release (dev) release and branch. ## Motivation and Context Ensures testing before release to main. ## How Has This Been Tested? ## Screenshots ## Types of changes - [ ] Improvement (non-breaking change that adds a new feature) - [ ] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [x] Config and build (change in the configuration and build system, has no impact on code or features) ## Checklist: - [ ] 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. Signed-off-by: GITHUB_USER --- .github/workflows/build.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 170726a9..cb12b29b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,8 @@ on: jobs: build-menu: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 @@ -68,14 +70,6 @@ jobs: name: SC64 path: ./output/sc64menu.n64 - # - name: Delete rolling-release tag and release - # uses: dev-drprasad/delete-tag-and-release@v1.0 - # if: github.ref == 'refs/heads/main' - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # tag_name: rolling-release - # continue-on-error: true - - name: Upload rolling release uses: softprops/action-gh-release@v2 if: github.ref == 'refs/heads/main' @@ -91,6 +85,22 @@ jobs: ./output/sc64menu.n64 continue-on-error: true + - name: Upload dev rolling release + uses: softprops/action-gh-release@v2 + if: github.ref == 'refs/heads/develop' + with: + name: 'Rolling dev release-V${{ github.run_id }}' + body: Rolling dev prerelease built from latest commit on `develop` branch. + tag_name: prerelease-dev + prerelease: true + files: | + ./output/N64FlashcartMenu.n64 + ./output/menu.bin + ./output/OS64.v64 + ./output/OS64P.v64 + ./output/sc64menu.n64 + continue-on-error: true + generate-docs: runs-on: ubuntu-latest permissions: From 7670ffe6babb473757d5f7a35a1c0650db24c332 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Tue, 21 May 2024 18:06:33 +0200 Subject: [PATCH 2/8] Fix issues with new font rendering in libdragon --- src/menu/components/common.c | 9 ++++++--- src/menu/components/constants.h | 6 ++++-- src/menu/components/context_menu.c | 1 + src/menu/components/file_list.c | 8 +++++--- src/menu/views/load_rom.c | 10 ++++------ 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/menu/components/common.c b/src/menu/components/common.c index 6bf708f8..d0fce75f 100644 --- a/src/menu/components/common.c +++ b/src/menu/components/common.c @@ -118,7 +118,8 @@ void component_messagebox_draw (char *fmt, ...) { .height = VISIBLE_AREA_HEIGHT, .align = ALIGN_CENTER, .valign = VALIGN_CENTER, - .wrap = WRAP_WORD + .wrap = WRAP_WORD, + .line_spacing = TEXT_LINE_SPACING_ADJUST, }, FNT_DEFAULT, formatted, ¶graph_nbytes); if (formatted != buffer) { @@ -151,10 +152,11 @@ void component_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *f .align = align, .valign = valign, .wrap = WRAP_ELLIPSES, + .line_spacing = TEXT_LINE_SPACING_ADJUST, }, FNT_DEFAULT, VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL, - VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL, + VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL, formatted, nbytes ); @@ -180,10 +182,11 @@ void component_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign, .align = align, .valign = valign, .wrap = WRAP_ELLIPSES, + .line_spacing = TEXT_LINE_SPACING_ADJUST, }, FNT_DEFAULT, VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL, - LAYOUT_ACTIONS_SEPARATOR_Y + BORDER_THICKNESS + TEXT_MARGIN_VERTICAL, + LAYOUT_ACTIONS_SEPARATOR_Y + BORDER_THICKNESS + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL, formatted, nbytes ); diff --git a/src/menu/components/constants.h b/src/menu/components/constants.h index f3eb3e39..e4d3eb51 100644 --- a/src/menu/components/constants.h +++ b/src/menu/components/constants.h @@ -65,7 +65,9 @@ #define MESSAGEBOX_MARGIN (32) #define TEXT_MARGIN_HORIZONTAL (10) -#define TEXT_MARGIN_VERTICAL (7) +#define TEXT_MARGIN_VERTICAL (6) +#define TEXT_OFFSET_VERTICAL (1) +#define TEXT_LINE_SPACING_ADJUST (0) /** @brief The boxart picture width. */ #define BOXART_WIDTH (158) @@ -86,7 +88,7 @@ #define LIST_SCROLLBAR_Y (VISIBLE_AREA_Y0) /** @brief The maximum amount of file list entries. */ -#define LIST_ENTRIES (20) +#define LIST_ENTRIES (19) /** @brief The maximum width available for a file list entry. */ #define FILE_LIST_MAX_WIDTH (480) #define FILE_LIST_HIGHLIGHT_WIDTH (VISIBLE_AREA_X1 - VISIBLE_AREA_X0 - LIST_SCROLLBAR_WIDTH) diff --git a/src/menu/components/context_menu.c b/src/menu/components/context_menu.c index f2e32c42..ff6db4db 100644 --- a/src/menu/components/context_menu.c +++ b/src/menu/components/context_menu.c @@ -81,6 +81,7 @@ void component_context_menu_draw (component_context_menu_t *cm) { .height = VISIBLE_AREA_HEIGHT, .align = ALIGN_CENTER, .valign = VALIGN_CENTER, + .line_spacing = TEXT_LINE_SPACING_ADJUST, }, FNT_DEFAULT, NULL diff --git a/src/menu/components/file_list.c b/src/menu/components/file_list.c index b00ef329..7a9835ce 100644 --- a/src/menu/components/file_list.c +++ b/src/menu/components/file_list.c @@ -71,6 +71,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) { .width = FILE_LIST_MAX_WIDTH - (TEXT_MARGIN_HORIZONTAL * 2), .height = LAYOUT_ACTIONS_SEPARATOR_Y - VISIBLE_AREA_Y0 - (TEXT_MARGIN_VERTICAL * 2), .wrap = WRAP_ELLIPSES, + .line_spacing = TEXT_LINE_SPACING_ADJUST, }, FNT_DEFAULT, file_list_layout @@ -114,7 +115,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) { layout = rdpq_paragraph_builder_end(); int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines; - int highlight_y = VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + ((selected - starting_position) * highlight_height); + int highlight_y = VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL + ((selected - starting_position) * highlight_height); component_box_draw( FILE_LIST_HIGHLIGHT_X, @@ -127,7 +128,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) { rdpq_paragraph_render( layout, VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL, - VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL ); rdpq_paragraph_free(layout); @@ -138,6 +139,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) { .height = LAYOUT_ACTIONS_SEPARATOR_Y - VISIBLE_AREA_Y0 - (TEXT_MARGIN_VERTICAL * 2), .align = ALIGN_RIGHT, .wrap = WRAP_ELLIPSES, + .line_spacing = TEXT_LINE_SPACING_ADJUST, }, FNT_DEFAULT, NULL @@ -164,7 +166,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) { rdpq_paragraph_render( layout, VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL, - VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL ); rdpq_paragraph_free(layout); diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index 1d4f41be..e6d8e531 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -236,12 +236,10 @@ static void draw (menu_t *menu, surface_t *d) { " Save type: %s\n" " TV type: %s\n" " Expansion PAK: %s\n" - "\n" - " Extra information:\n" - " CIC: %s\n" - " Boot address: 0x%08lX\n" - " SDK version: %.1f%c\n" - " Clock Rate: %.2fMHz\n", + " CIC: %s\n" + " Boot address: 0x%08lX\n" + " SDK version: %.1f%c\n" + " Clock Rate: %.2fMHz\n", format_rom_endianness(menu->load.rom_info.endianness), menu->load.rom_info.title, menu->load.rom_info.game_code[0], menu->load.rom_info.game_code[1], menu->load.rom_info.game_code[2], menu->load.rom_info.game_code[3], From 2dc83c49edc6612195376551e64a1296670d4afb Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Tue, 21 May 2024 18:06:57 +0200 Subject: [PATCH 3/8] Add additional check in fatfs_get_file_sectors --- src/flashcart/flashcart_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flashcart/flashcart_utils.c b/src/flashcart/flashcart_utils.c index 3eb13605..cfc714da 100644 --- a/src/flashcart/flashcart_utils.c +++ b/src/flashcart/flashcart_utils.c @@ -51,7 +51,7 @@ bool fatfs_get_file_sectors (char *path, uint32_t *address, address_type_t type, uint32_t cluster = fil.clust; - if (cluster >= fs->n_fatent) { + if ((cluster < 2) || (cluster >= fs->n_fatent)) { error = true; break; } From 66466804dea4d708390c0bcc4b74262033470871 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Tue, 21 May 2024 18:11:43 +0200 Subject: [PATCH 4/8] Fix github action build --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb12b29b..0d451921 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: build-menu: runs-on: ubuntu-latest permissions: - contents: write + packages: write steps: - uses: actions/checkout@v4 From c920fe953dfc1c99e250d5eb79fef78128e09cf6 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Tue, 21 May 2024 18:20:12 +0200 Subject: [PATCH 5/8] Fix github action build --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d451921..9838cd8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,7 @@ jobs: build-menu: runs-on: ubuntu-latest permissions: + contents: write packages: write steps: From 386906d38f482c05c183588cfa4594275443c2ac Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 21 May 2024 23:06:07 +0100 Subject: [PATCH 6/8] Correct hidden paths (#105) ## Description For ED64 based carts ## Motivation and Context The ROMs are not based in the root path. ## How Has This Been Tested? ## Screenshots ## Types of changes - [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: - [ ] 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. Signed-off-by: GITHUB_USER --- src/menu/views/browser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index c8481f4a..bb514b1b 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -21,8 +21,8 @@ static const char *hidden_paths[] = { "/menu.bin", "/menu", "/N64FlashcartMenu.n64", - "/OS64.v64", - "/OS64P.v64", + "/ED64", + "/ED64P", "/sc64menu.n64", "/System Volume Information", NULL, From 184d84872cbd83c781478667a9a2dcbc2aae677a Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 30 May 2024 12:35:47 +0100 Subject: [PATCH 7/8] Update README.md Add note about EXFAT support --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b331bb24..288b4941 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ An open source menu for N64 flashcarts. ## Getting started -Using your PC, insert the SD card and ensure it is formatted for compatibility (We recommend FAT32 in most instances). +Using your PC, insert the SD card and ensure it is formatted for compatibility (We recommend FAT32 in most instances, though EXFAT is fully supported on the SummerCart64). ### Save files By default, all save files (whether `FlashRam`, `SRAM` or `EEPROM`) use the `.sav` extension and match the filename of the ROM. From 7fa60f4253c638cf5cf4cdf4b904e1bd17e5a658 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Sun, 2 Jun 2024 19:24:36 +0200 Subject: [PATCH 8/8] Fixed unnecessary error message when resulting ROM override config file was already empty --- src/menu/rom_info.c | 25 +++++++++++++++++-------- src/menu/rom_info.h | 3 ++- src/menu/views/browser.c | 2 +- src/menu/views/load_rom.c | 3 ++- src/utils/fs.c | 2 +- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/menu/rom_info.c b/src/menu/rom_info.c index 14026ee9..a2f50cf1 100644 --- a/src/menu/rom_info.c +++ b/src/menu/rom_info.c @@ -1,3 +1,4 @@ +#include #include #include @@ -832,13 +833,21 @@ static rom_err_t save_override (path_t *path, const char *id, int value, int def mini_t *ini = mini_try_load(path_get(overrides_path)); if (!ini) { - return ROM_ERR_IO; + return ROM_ERR_SAVE_IO; } + int mini_err; + if (value == default_value) { - mini_delete_value(ini, NULL, id); + mini_err = mini_delete_value(ini, NULL, id); } else { - mini_set_int(ini, NULL, id, value); + mini_err = mini_set_int(ini, NULL, id, value); + } + + if ((mini_err != MINI_OK) && (mini_err != MINI_VALUE_NOT_FOUND)) { + path_free(overrides_path); + mini_free(ini); + return ROM_ERR_SAVE_IO; } bool empty = mini_empty(ini); @@ -847,16 +856,16 @@ static rom_err_t save_override (path_t *path, const char *id, int value, int def if (mini_save(ini, MINI_FLAGS_NONE) != MINI_OK) { path_free(overrides_path); mini_free(ini); - return ROM_ERR_IO; + return ROM_ERR_SAVE_IO; } } mini_free(ini); if (empty) { - if (remove(path_get(overrides_path))) { + if (remove(path_get(overrides_path)) && (errno != ENOENT)) { path_free(overrides_path); - return ROM_ERR_IO; + return ROM_ERR_SAVE_IO; } } @@ -946,10 +955,10 @@ rom_err_t rom_info_load (path_t *path, rom_info_t *rom_info) { setbuf(f, NULL); if (fread(&rom_header, sizeof(rom_header), 1, f) != 1) { fclose(f); - return ROM_ERR_IO; + return ROM_ERR_LOAD_IO; } if (fclose(f)) { - return ROM_ERR_IO; + return ROM_ERR_LOAD_IO; } fix_rom_header_endianness(&rom_header, rom_info); diff --git a/src/menu/rom_info.h b/src/menu/rom_info.h index cb241a2e..0308cfc9 100644 --- a/src/menu/rom_info.h +++ b/src/menu/rom_info.h @@ -18,7 +18,8 @@ /** @brief ROM error enumeration. */ typedef enum { ROM_OK, - ROM_ERR_IO, + ROM_ERR_LOAD_IO, + ROM_ERR_SAVE_IO, ROM_ERR_NO_FILE, } rom_err_t; diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index bb514b1b..75c45a15 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -1,6 +1,6 @@ +#include #include #include -#include #include #include "../fonts.h" diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index e6d8e531..9695bbc4 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -10,7 +10,8 @@ static component_boxart_t *boxart; static char *convert_error_message (rom_err_t err) { switch (err) { - case ROM_ERR_IO: return "I/O error during loading/storing ROM information"; + case ROM_ERR_LOAD_IO: return "I/O error during loading ROM information and/or options"; + case ROM_ERR_SAVE_IO: return "I/O error during storing ROM options"; case ROM_ERR_NO_FILE: return "Couldn't open ROM file"; default: return "Unknown ROM info load error"; } diff --git a/src/utils/fs.c b/src/utils/fs.c index 41b69c48..b02b2e2c 100644 --- a/src/utils/fs.c +++ b/src/utils/fs.c @@ -1,7 +1,7 @@ +#include #include #include #include -#include #include #include "fs.h"