From be87588b85278e66a606736e5d3aeceac39a73ca Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Fri, 22 Dec 2023 17:28:23 +0000 Subject: [PATCH 1/3] Update some GH actions to latest. --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55aa39a2..50e5a4f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,12 +13,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -97,7 +97,7 @@ jobs: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run Doxygen uses: mattnotmitt/doxygen-action@1.9.5 From 70675d085c338c95e1e7c11ca692747e2f8bdbbb Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Fri, 22 Dec 2023 20:50:54 +0000 Subject: [PATCH 2/3] Minor improvements for maintainability (#77) ## Description * Update SC64 F/W version. * Update build actions. * Improve credits (use my name rather than twitter pseudonym). * Improve function name for bool conversion. * Use arg for SC64 tools version in dockerfile. ## Motivation and Context Improves code maintainability. ## How Has This Been Tested? Works on my local devcontainer, cart and fork. ## Screenshots ## Types of changes - [x] 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 --- .devcontainer/Dockerfile | 7 ++++--- .github/workflows/build.yml | 10 +++++----- README.md | 6 +++--- src/menu/components/boxart.c | 3 ++- src/menu/views/credits.c | 2 +- src/menu/views/settings_editor.c | 14 +++++++------- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ccf500d3..116f0cb9 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,14 +1,15 @@ FROM debian:bookworm-slim +ARG SC64_DEPLOYER_VERSION=v2.18.0 RUN apt-get update && \ apt-get upgrade -y && \ apt-get install build-essential doxygen git python3 wget -y && \ wget https://github.com/DragonMinded/libdragon/releases/download/toolchain-continuous-prerelease/gcc-toolchain-mips64-x86_64.deb && \ dpkg -i gcc-toolchain-mips64-x86_64.deb && \ rm gcc-toolchain-mips64-x86_64.deb && \ - wget https://github.com/Polprzewodnikowy/SummerCart64/releases/download/v2.17.0/sc64-deployer-linux-v2.17.0.tar.gz && \ - tar -xf sc64-deployer-linux-v2.17.0.tar.gz -C /usr/local/bin && \ - rm sc64-deployer-linux-v2.17.0.tar.gz && \ + wget https://github.com/Polprzewodnikowy/SummerCart64/releases/download/$SC64_DEPLOYER_VERSION/sc64-deployer-linux-$SC64_DEPLOYER_VERSION.tar.gz && \ + tar -xf sc64-deployer-linux-$SC64_DEPLOYER_VERSION.tar.gz -C /usr/local/bin && \ + rm sc64-deployer-linux-$SC64_DEPLOYER_VERSION.tar.gz && \ git config --global --add safe.directory "*" && \ SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" && \ echo "$SNIPPET" >> "/root/.bashrc" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50e5a4f2..d0d2703c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: FLAGS: -DNDEBUG - name: Upload artifact (Standard ROM) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: N64FlashcartMenu path: | @@ -45,25 +45,25 @@ jobs: ./build/N64FlashcartMenu.elf - name: Upload artifact (64drive version) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: 64drive path: ./output/menu.bin - name: Upload artifact (ED64 version) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ED64 path: ./output/OS64.v64 - name: Upload artifact (ED64P version) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ED64P path: ./output/OS64P.v64 - name: Upload artifact (SC64 version) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: SC64 path: ./output/sc64menu.n64 diff --git a/README.md b/README.md index ed7417e3..f6670732 100644 --- a/README.md +++ b/README.md @@ -88,11 +88,11 @@ You can use a dev container in VSCode to ease development. ## To deploy: ### SC64 -* Download the deployer [here](https://github.com/Polprzewodnikowy/SummerCart64/releases/download/v2.17.0/sc64-deployer-windows-v2.17.0.zip) +* Download the deployer [here](https://github.com/Polprzewodnikowy/SummerCart64/releases/download/v2.18.0/sc64-deployer-windows-v2.18.0.zip) * Extract and place `sc64deployer.exe` in the `tools/sc64` directory. -Make sure that your firmware is compatible (currently v2.17.0+) -See: [here](https://github.com/Polprzewodnikowy/SummerCart64/blob/v2.17.0/docs/00_quick_startup_guide.md#firmware-backupupdate) +Make sure that your firmware is compatible (currently v2.18.0+) +See: [here](https://github.com/Polprzewodnikowy/SummerCart64/blob/v2.18.0/docs/00_quick_startup_guide.md#firmware-backupupdate) #### From the devcontainer diff --git a/src/menu/components/boxart.c b/src/menu/components/boxart.c index 90b23ccd..6ed3826a 100644 --- a/src/menu/components/boxart.c +++ b/src/menu/components/boxart.c @@ -6,8 +6,9 @@ #include "constants.h" #include "utils/fs.h" - +#ifndef BOXART_DIRECTORY #define BOXART_DIRECTORY "sd:/menu/boxart" +#endif static void png_decoder_callback (png_err_t err, surface_t *decoded_image, void *callback_data) { diff --git a/src/menu/views/credits.c b/src/menu/views/credits.c index 5228390a..a6e42a9a 100644 --- a/src/menu/views/credits.c +++ b/src/menu/views/credits.c @@ -33,7 +33,7 @@ static void draw (menu_t *menu, surface_t *d) { "Github:\n" " https://github.com/Polprzewodnikowy/N64FlashcartMenu\n" "Authors:\n" - " JonesAlmighty / NetworkFusion\n" + " Robin Jones / NetworkFusion\n" " Mateusz Faderewski / Polprzewodnikowy\n" "Credits:\n" " N64Brew / libdragon contributors\n" diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 39801f99..5538a98e 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -1,6 +1,6 @@ #include "views.h" -static char *convert_boolean (int state) { +static char *format_boolean_type (int state) { switch (state) { case 0: return "Off"; case 1: return "On"; @@ -38,13 +38,13 @@ static void draw (menu_t *menu, surface_t *d) { "bgm_enabled: %s\n" "sound_enabled: %s\n" "rumble_enabled: %s\n", - convert_boolean(menu->settings.pal60_enabled), - convert_boolean(menu->settings.hidden_files_enabled), + format_boolean_type(menu->settings.pal60_enabled), + format_boolean_type(menu->settings.hidden_files_enabled), menu->settings.default_directory, - convert_boolean(menu->settings.use_saves_folder), - convert_boolean(menu->settings.bgm_enabled), - convert_boolean(menu->settings.sound_enabled), - convert_boolean(menu->settings.rumble_enabled) + format_boolean_type(menu->settings.use_saves_folder), + format_boolean_type(menu->settings.bgm_enabled), + format_boolean_type(menu->settings.sound_enabled), + format_boolean_type(menu->settings.rumble_enabled) ); From c4a6d1515de663d80651e9a1666b85426d525c5d Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Fri, 22 Dec 2023 20:53:38 +0000 Subject: [PATCH 3/3] Rtc context menu (#78) ## Description Add basic RTC context menu. ## Motivation and Context Improves user experience. ## 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 --- Makefile | 1 + src/menu/menu.c | 1 + src/menu/menu_state.h | 1 + src/menu/views/browser.c | 5 +++ src/menu/views/rtc.c | 66 ++++++++++++++++++++++++++++++++++++++++ src/menu/views/views.h | 3 ++ 6 files changed, 77 insertions(+) create mode 100644 src/menu/views/rtc.c diff --git a/Makefile b/Makefile index a7caab37..2cc28f62 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,7 @@ SRCS = \ menu/views/startup.c \ menu/views/system_info.c \ menu/views/settings_editor.c \ + menu/views/rtc.c \ utils/fs.c FONTS = \ diff --git a/src/menu/menu.c b/src/menu/menu.c index 5f555831..3e695f0d 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -148,6 +148,7 @@ static struct views_s { { view_music_player_init, view_music_player_display }, // MENU_MODE_MUSIC_PLAYER { view_credits_init, view_credits_display }, // MENU_MODE_CREDITS { view_settings_init, view_settings_display }, // MENU_MODE_SETTINGS_EDITOR + { view_rtc_init, view_rtc_display }, // MENU_MODE_RTC { view_load_rom_init, view_load_rom_display }, // MENU_MODE_LOAD_ROM { view_load_disk_init, view_load_disk_display }, // MENU_MODE_LOAD_DISK { view_load_emulator_init, view_load_emulator_display }, // MENU_MODE_LOAD_EMULATOR diff --git a/src/menu/menu_state.h b/src/menu/menu_state.h index 7c0c5f10..d29573d4 100644 --- a/src/menu/menu_state.h +++ b/src/menu/menu_state.h @@ -32,6 +32,7 @@ typedef enum { MENU_MODE_MUSIC_PLAYER, MENU_MODE_CREDITS, MENU_MODE_SETTINGS_EDITOR, + MENU_MODE_RTC, MENU_MODE_LOAD_ROM, MENU_MODE_LOAD_DISK, MENU_MODE_LOAD_EMULATOR, diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index ecc3ac2b..75ab0a4a 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -240,11 +240,16 @@ static void show_credits (menu_t *menu) { menu->next_mode = MENU_MODE_CREDITS; } +static void edit_rtc (menu_t *menu) { + menu->next_mode = MENU_MODE_RTC; +} + static component_context_menu_t settings_context_menu = { .list = { { .text = "Edit settings", .action = edit_settings }, { .text = "Show system info", .action = show_system_info }, { .text = "Show credits", .action = show_credits }, + { .text = "Adjust RTC", .action = edit_rtc }, COMPONENT_CONTEXT_MENU_LIST_END, } }; diff --git a/src/menu/views/rtc.c b/src/menu/views/rtc.c new file mode 100644 index 00000000..caeb9305 --- /dev/null +++ b/src/menu/views/rtc.c @@ -0,0 +1,66 @@ +#include +#include "views.h" + +// FIXME: add implementation! +// struct { +// uint16_t seconds; +// uint16_t minutes; +// uint16_t hours; +// uint16_t day; +// uint16_t month; +// uint16_t year; +// } adjusted_datetime; + +// static void save_adjusted_datetime () { + +// } + +static void process (menu_t *menu) { + if (menu->actions.back) { + menu->next_mode = MENU_MODE_BROWSER; + } +} + +static void draw (menu_t *menu, surface_t *d) { + rdpq_attach(d, NULL); + + component_background_draw(); + + component_layout_draw(); + + component_main_text_draw( + ALIGN_CENTER, VALIGN_TOP, + "ADJUST REAL TIME CLOCK\n" + "\n" + "\n" + "To set the date and time, please use the PC terminal\n" + "application and set via USB.\n\n" + "Current date & time: %s\n", + menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown\n" + ); + + component_main_text_draw( + ALIGN_LEFT, VALIGN_TOP, + "\n" + "\n" + ); + + + component_actions_bar_text_draw( + ALIGN_LEFT, VALIGN_TOP, + "\n" // "A: Save\n" + "B: Back" + ); + + rdpq_detach_show(); +} + + +void view_rtc_init (menu_t *menu) { + // Nothing to initialize (yet) +} + +void view_rtc_display (menu_t *menu, surface_t *display) { + process(menu); + draw(menu, display); +} diff --git a/src/menu/views/views.h b/src/menu/views/views.h index 58c610d3..2b7e0660 100644 --- a/src/menu/views/views.h +++ b/src/menu/views/views.h @@ -47,6 +47,9 @@ void view_load_disk_display (menu_t *menu, surface_t *display); void view_settings_init (menu_t *menu); void view_settings_display (menu_t *menu, surface_t *display); +void view_rtc_init (menu_t *menu); +void view_rtc_display (menu_t *menu, surface_t *display); + void view_load_emulator_init (menu_t *menu); void view_load_emulator_display (menu_t *menu, surface_t *display);