Merge branch 'develop' into cpak-management

This commit is contained in:
Robin Jones 2024-06-05 19:05:07 +01:00 committed by GitHub
commit 20ee708658
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 66 additions and 38 deletions

View File

@ -11,6 +11,9 @@ on:
jobs: jobs:
build-menu: build-menu:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -68,14 +71,6 @@ jobs:
name: SC64 name: SC64
path: ./output/sc64menu.n64 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 - name: Upload rolling release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
@ -91,6 +86,22 @@ jobs:
./output/sc64menu.n64 ./output/sc64menu.n64
continue-on-error: true 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: generate-docs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:

View File

@ -41,7 +41,7 @@ An open source menu for N64 flashcarts.
## Getting started ## 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 ### Save files
By default, all save files (whether `FlashRam`, `SRAM` or `EEPROM`) use the `.sav` extension and match the filename of the ROM. By default, all save files (whether `FlashRam`, `SRAM` or `EEPROM`) use the `.sav` extension and match the filename of the ROM.

View File

@ -51,7 +51,7 @@ bool fatfs_get_file_sectors (char *path, uint32_t *address, address_type_t type,
uint32_t cluster = fil.clust; uint32_t cluster = fil.clust;
if (cluster >= fs->n_fatent) { if ((cluster < 2) || (cluster >= fs->n_fatent)) {
error = true; error = true;
break; break;
} }

View File

@ -118,7 +118,8 @@ void component_messagebox_draw (char *fmt, ...) {
.height = VISIBLE_AREA_HEIGHT, .height = VISIBLE_AREA_HEIGHT,
.align = ALIGN_CENTER, .align = ALIGN_CENTER,
.valign = VALIGN_CENTER, .valign = VALIGN_CENTER,
.wrap = WRAP_WORD .wrap = WRAP_WORD,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
}, FNT_DEFAULT, formatted, &paragraph_nbytes); }, FNT_DEFAULT, formatted, &paragraph_nbytes);
if (formatted != buffer) { if (formatted != buffer) {
@ -151,10 +152,11 @@ void component_main_text_draw (rdpq_align_t align, rdpq_valign_t valign, char *f
.align = align, .align = align,
.valign = valign, .valign = valign,
.wrap = WRAP_ELLIPSES, .wrap = WRAP_ELLIPSES,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
}, },
FNT_DEFAULT, FNT_DEFAULT,
VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL, VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL,
VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL, VISIBLE_AREA_Y0 + TEXT_MARGIN_VERTICAL + TEXT_OFFSET_VERTICAL,
formatted, formatted,
nbytes nbytes
); );
@ -180,10 +182,11 @@ void component_actions_bar_text_draw (rdpq_align_t align, rdpq_valign_t valign,
.align = align, .align = align,
.valign = valign, .valign = valign,
.wrap = WRAP_ELLIPSES, .wrap = WRAP_ELLIPSES,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
}, },
FNT_DEFAULT, FNT_DEFAULT,
VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL, 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, formatted,
nbytes nbytes
); );

View File

@ -65,7 +65,9 @@
#define MESSAGEBOX_MARGIN (32) #define MESSAGEBOX_MARGIN (32)
#define TEXT_MARGIN_HORIZONTAL (10) #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. */ /** @brief The boxart picture width. */
#define BOXART_WIDTH (158) #define BOXART_WIDTH (158)
@ -86,7 +88,7 @@
#define LIST_SCROLLBAR_Y (VISIBLE_AREA_Y0) #define LIST_SCROLLBAR_Y (VISIBLE_AREA_Y0)
/** @brief The maximum amount of file list entries. */ /** @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. */ /** @brief The maximum width available for a file list entry. */
#define FILE_LIST_MAX_WIDTH (480) #define FILE_LIST_MAX_WIDTH (480)
#define FILE_LIST_HIGHLIGHT_WIDTH (VISIBLE_AREA_X1 - VISIBLE_AREA_X0 - LIST_SCROLLBAR_WIDTH) #define FILE_LIST_HIGHLIGHT_WIDTH (VISIBLE_AREA_X1 - VISIBLE_AREA_X0 - LIST_SCROLLBAR_WIDTH)

View File

@ -81,6 +81,7 @@ void component_context_menu_draw (component_context_menu_t *cm) {
.height = VISIBLE_AREA_HEIGHT, .height = VISIBLE_AREA_HEIGHT,
.align = ALIGN_CENTER, .align = ALIGN_CENTER,
.valign = VALIGN_CENTER, .valign = VALIGN_CENTER,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
}, },
FNT_DEFAULT, FNT_DEFAULT,
NULL NULL

View File

@ -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), .width = FILE_LIST_MAX_WIDTH - (TEXT_MARGIN_HORIZONTAL * 2),
.height = LAYOUT_ACTIONS_SEPARATOR_Y - VISIBLE_AREA_Y0 - (TEXT_MARGIN_VERTICAL * 2), .height = LAYOUT_ACTIONS_SEPARATOR_Y - VISIBLE_AREA_Y0 - (TEXT_MARGIN_VERTICAL * 2),
.wrap = WRAP_ELLIPSES, .wrap = WRAP_ELLIPSES,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
}, },
FNT_DEFAULT, FNT_DEFAULT,
file_list_layout file_list_layout
@ -114,7 +115,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
layout = rdpq_paragraph_builder_end(); layout = rdpq_paragraph_builder_end();
int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines; 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( component_box_draw(
FILE_LIST_HIGHLIGHT_X, FILE_LIST_HIGHLIGHT_X,
@ -127,7 +128,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
rdpq_paragraph_render( rdpq_paragraph_render(
layout, layout,
VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL, 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); 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), .height = LAYOUT_ACTIONS_SEPARATOR_Y - VISIBLE_AREA_Y0 - (TEXT_MARGIN_VERTICAL * 2),
.align = ALIGN_RIGHT, .align = ALIGN_RIGHT,
.wrap = WRAP_ELLIPSES, .wrap = WRAP_ELLIPSES,
.line_spacing = TEXT_LINE_SPACING_ADJUST,
}, },
FNT_DEFAULT, FNT_DEFAULT,
NULL NULL
@ -164,7 +166,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected) {
rdpq_paragraph_render( rdpq_paragraph_render(
layout, layout,
VISIBLE_AREA_X0 + TEXT_MARGIN_HORIZONTAL, 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); rdpq_paragraph_free(layout);

View File

@ -1,3 +1,4 @@
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -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)); mini_t *ini = mini_try_load(path_get(overrides_path));
if (!ini) { if (!ini) {
return ROM_ERR_IO; return ROM_ERR_SAVE_IO;
} }
int mini_err;
if (value == default_value) { if (value == default_value) {
mini_delete_value(ini, NULL, id); mini_err = mini_delete_value(ini, NULL, id);
} else { } 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); 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) { if (mini_save(ini, MINI_FLAGS_NONE) != MINI_OK) {
path_free(overrides_path); path_free(overrides_path);
mini_free(ini); mini_free(ini);
return ROM_ERR_IO; return ROM_ERR_SAVE_IO;
} }
} }
mini_free(ini); mini_free(ini);
if (empty) { if (empty) {
if (remove(path_get(overrides_path))) { if (remove(path_get(overrides_path)) && (errno != ENOENT)) {
path_free(overrides_path); 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); setbuf(f, NULL);
if (fread(&rom_header, sizeof(rom_header), 1, f) != 1) { if (fread(&rom_header, sizeof(rom_header), 1, f) != 1) {
fclose(f); fclose(f);
return ROM_ERR_IO; return ROM_ERR_LOAD_IO;
} }
if (fclose(f)) { if (fclose(f)) {
return ROM_ERR_IO; return ROM_ERR_LOAD_IO;
} }
fix_rom_header_endianness(&rom_header, rom_info); fix_rom_header_endianness(&rom_header, rom_info);

View File

@ -18,7 +18,8 @@
/** @brief ROM error enumeration. */ /** @brief ROM error enumeration. */
typedef enum { typedef enum {
ROM_OK, ROM_OK,
ROM_ERR_IO, ROM_ERR_LOAD_IO,
ROM_ERR_SAVE_IO,
ROM_ERR_NO_FILE, ROM_ERR_NO_FILE,
} rom_err_t; } rom_err_t;

View File

@ -1,6 +1,6 @@
#include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/errno.h>
#include <time.h> #include <time.h>
#include "../fonts.h" #include "../fonts.h"
@ -22,8 +22,8 @@ static const char *hidden_paths[] = {
"/menu.bin", "/menu.bin",
"/menu", "/menu",
"/N64FlashcartMenu.n64", "/N64FlashcartMenu.n64",
"/OS64.v64", "/ED64",
"/OS64P.v64", "/ED64P",
"/sc64menu.n64", "/sc64menu.n64",
"/System Volume Information", "/System Volume Information",
NULL, NULL,

View File

@ -10,7 +10,8 @@ static component_boxart_t *boxart;
static char *convert_error_message (rom_err_t err) { static char *convert_error_message (rom_err_t err) {
switch (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"; case ROM_ERR_NO_FILE: return "Couldn't open ROM file";
default: return "Unknown ROM info load error"; default: return "Unknown ROM info load error";
} }
@ -236,8 +237,6 @@ static void draw (menu_t *menu, surface_t *d) {
" Save type: %s\n" " Save type: %s\n"
" TV type: %s\n" " TV type: %s\n"
" Expansion PAK: %s\n" " Expansion PAK: %s\n"
"\n"
" Extra information:\n"
" CIC: %s\n" " CIC: %s\n"
" Boot address: 0x%08lX\n" " Boot address: 0x%08lX\n"
" SDK version: %.1f%c\n" " SDK version: %.1f%c\n"

View File

@ -1,7 +1,7 @@
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "fs.h" #include "fs.h"