diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 170726a9..9838cd8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,9 @@ on: jobs: build-menu: runs-on: ubuntu-latest + permissions: + contents: write + packages: write steps: - uses: actions/checkout@v4 @@ -68,14 +71,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 +86,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: 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. 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; } 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/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 ad9e3eac..ccd540d9 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" @@ -22,8 +22,8 @@ static const char *hidden_paths[] = { "/menu.bin", "/menu", "/N64FlashcartMenu.n64", - "/OS64.v64", - "/OS64P.v64", + "/ED64", + "/ED64P", "/sc64menu.n64", "/System Volume Information", NULL, diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index 1d4f41be..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"; } @@ -236,12 +237,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], 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"