Skip to content

Commit

Permalink
Merge branch 'develop' into rom-autoload-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
networkfusion authored Oct 25, 2024
2 parents 8a80c97 + f65b345 commit beb1aac
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
- uses: actions/checkout@v4

- name: Run Doxygen
uses: mattnotmitt/doxygen-action@1.9.5
uses: mattnotmitt/doxygen-action@v1
with:
doxyfile-path: './Doxyfile'

Expand Down
1 change: 1 addition & 0 deletions src/flashcart/64drive/64drive.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ static bool d64_has_feature (flashcart_features_t feature) {
case FLASHCART_FEATURE_USB: return true;
case FLASHCART_FEATURE_AUTO_CIC: return true;
case FLASHCART_FEATURE_AUTO_REGION: return true;
case FLASHCART_FEATURE_SAVE_WRITEBACK: return true;
default: return false;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/flashcart/flashcart.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ typedef enum {
FLASHCART_FEATURE_USB,
FLASHCART_FEATURE_AUTO_CIC,
FLASHCART_FEATURE_AUTO_REGION,
FLASHCART_FEATURE_DIAGNOSTIC_DATA,
FLASHCART_FEATURE_BIOS_UPDATE_FROM_MENU,
FLASHCART_FEATURE_SAVE_WRITEBACK
} flashcart_features_t;

/** @brief Flashcart save type enumeration */
Expand Down
2 changes: 2 additions & 0 deletions src/flashcart/sc64/sc64.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ static bool sc64_has_feature (flashcart_features_t feature) {
case FLASHCART_FEATURE_USB: return true;
case FLASHCART_FEATURE_AUTO_CIC: return true;
case FLASHCART_FEATURE_AUTO_REGION: return true;
case FLASHCART_FEATURE_DIAGNOSTIC_DATA: return true;
case FLASHCART_FEATURE_SAVE_WRITEBACK: return true;
default: return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/miniz
Submodule miniz updated 4 files
+31 −23 CMakeLists.txt
+5 −4 miniz_zip.c
+2 −1 miniz_zip.h
+31 −1 tests/main.cpp
4 changes: 2 additions & 2 deletions src/menu/components.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ void component_background_draw (void);
void component_file_list_draw (entry_t *list, int entries, int selected);

typedef struct component_context_menu {
int count;
int selected;
int row_count;
int row_selected;
bool hide_pending;
struct component_context_menu *parent;
struct component_context_menu *submenu;
Expand Down
40 changes: 20 additions & 20 deletions src/menu/components/context_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ static component_context_menu_t *get_current_submenu (component_context_menu_t *


void component_context_menu_init (component_context_menu_t *cm) {
cm->selected = -1;
cm->count = 0;
cm->row_selected = -1;
cm->row_count = 0;
cm->hide_pending = false;
cm->parent = NULL;
for (int i = 0; (cm->list[i].text) != NULL; i++) {
cm->count += 1;
cm->row_count += 1;
}
}

void component_context_menu_show (component_context_menu_t *cm) {
cm->selected = 0;
cm->row_selected = 0;
cm->submenu = NULL;
}

bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm) {
if (!cm || (cm->selected < 0)) {
if (!cm || (cm->row_selected < 0)) {
return false;
}

Expand All @@ -44,26 +44,26 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm)
}
sound_play_effect(SFX_EXIT);
} else if (menu->actions.enter) {
if (cm->list[cm->selected].submenu) {
cm->submenu = cm->list[cm->selected].submenu;
if (cm->list[cm->row_selected].submenu) {
cm->submenu = cm->list[cm->row_selected].submenu;
component_context_menu_init(cm->submenu);
cm->submenu->selected = 0;
cm->submenu->row_selected = 0;
cm->submenu->parent = cm;
} else if (cm->list[cm->selected].action) {
cm->list[cm->selected].action(menu, cm->list[cm->selected].arg);
} else if (cm->list[cm->row_selected].action) {
cm->list[cm->row_selected].action(menu, cm->list[cm->row_selected].arg);
top->hide_pending = true;
}
sound_play_effect(SFX_ENTER);
} else if (menu->actions.go_up) {
cm->selected -= 1;
if (cm->selected < 0) {
cm->selected = 0;
cm->row_selected -= 1;
if (cm->row_selected < 0) {
cm->row_selected = 0;
}
sound_play_effect(SFX_CURSOR);
} else if (menu->actions.go_down) {
cm->selected += 1;
if (cm->selected >= cm->count) {
cm->selected = (cm->count - 1);
cm->row_selected += 1;
if (cm->row_selected >= cm->row_count) {
cm->row_selected = (cm->row_count - 1);
}
sound_play_effect(SFX_CURSOR);
}
Expand All @@ -72,7 +72,7 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm)
}

void component_context_menu_draw (component_context_menu_t *cm) {
if (!cm || (cm->selected < 0)) {
if (!cm || (cm->row_selected < 0)) {
return;
}

Expand All @@ -92,7 +92,7 @@ void component_context_menu_draw (component_context_menu_t *cm) {
NULL
);

for (int i = 0; i < cm->count; i++) {
for (int i = 0; i < cm->row_count; i++) {
const char *text = cm->list[i].text;
rdpq_paragraph_builder_span(text, strlen(text));
if (cm->list[i + 1].text != NULL) {
Expand All @@ -110,7 +110,7 @@ void component_context_menu_draw (component_context_menu_t *cm) {
int highlight_x0 = DISPLAY_CENTER_X - (width / 2);
int highlight_x1 = DISPLAY_CENTER_X + (width / 2);
int highlight_height = (layout->bbox.y1 - layout->bbox.y0) / layout->nlines;
int highlight_y = VISIBLE_AREA_Y0 + layout->bbox.y0 + ((cm->selected) * highlight_height);
int highlight_y = VISIBLE_AREA_Y0 + layout->bbox.y0 + ((cm->row_selected) * highlight_height);

component_box_draw(
highlight_x0,
Expand All @@ -126,6 +126,6 @@ void component_context_menu_draw (component_context_menu_t *cm) {

if (top->hide_pending) {
top->hide_pending = false;
top->selected = -1;
top->row_selected = -1;
}
}
11 changes: 6 additions & 5 deletions src/menu/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ static bool sfx_enabled = false;

static void sound_reconfigure (int frequency) {
if ((frequency > 0) && (audio_get_frequency() != frequency)) {
sound_deinit();
if (sound_initialized) {
mixer_close();
audio_close();
}
audio_init(frequency, NUM_BUFFERS);
mixer_init(NUM_CHANNELS);
mp3player_mixer_init();
Expand Down Expand Up @@ -97,9 +100,7 @@ void sound_deinit (void) {
}

void sound_poll (void) {
if (sound_initialized && audio_can_write()) {
short *audio_buffer = audio_write_begin();
mixer_poll(audio_buffer, audio_get_buffer_length());
audio_write_end();
if (sound_initialized) {
mixer_try_play();
}
}
2 changes: 1 addition & 1 deletion src/menu/views/credits.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

static void process (menu_t *menu) {
if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/menu/views/file_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ static char *format_file_type (char *name, bool is_directory) {

static void process (menu_t *menu) {
if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
}
}

Expand Down Expand Up @@ -84,7 +84,7 @@ static void draw (menu_t *menu, surface_t *d) {
S_ISDIR(st.st_mode) ? "Directory" : "File",
st.st_mode & S_IWUSR ? "" : "(Read only)",
format_file_type(menu->browser.entry->name, S_ISDIR(st.st_mode)),
ctime(&st.st_mtim.tv_sec)
ctime(&st.st_mtime)
);

component_actions_bar_text_draw(
Expand Down
51 changes: 36 additions & 15 deletions src/menu/views/flashcart_info.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
#include "views.h"
#include "../sound.h"
#include <libcart/cart.h>


static inline const char *format_boolean_type (bool bool_value) {
return bool_value ? "Supported" : "Unsupported";
}

static const char *format_cart_type () {
switch (cart_type) {
case CART_CI:
return "64drive";

case CART_EDX:
return "Series X EverDrive-64";

case CART_ED:
return "Series V EverDrive-64";

case CART_SC:
return "SummerCart64";

default: // Probably emulator
return "Emulator?";
}
}

static void process (menu_t *menu) {
if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
}
}

Expand Down Expand Up @@ -39,23 +59,24 @@ static void draw (menu_t *menu, surface_t *d) {
" Virtual 64DD: %s.\n"
" Real Time Clock: %s.\n"
" USB Debugging: %s.\n"
" CIC Detection: %s.\n"
" Automatic CIC: %s.\n"
" Region Detection: %s.\n"
" Save Writeback: %s.\n"
" Update from menu: %s.\n"
"\n\n",
"SummerCart64",
"V?.?.?",
format_boolean_type(true),
format_boolean_type(true),
format_boolean_type(true),
format_boolean_type(true),
format_boolean_type(true)
);

// FIXME: Display:
// * cart_type
// * Firmware version
// * supported features (flashcart_features_t)
format_cart_type(),
"Not Available", // TODO get cart firmware version(s).
format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_64DD)),
format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_RTC)),
format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_USB)),
format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_AUTO_CIC)),
format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_AUTO_REGION)),
format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_SAVE_WRITEBACK)),
format_boolean_type(flashcart_has_feature(FLASHCART_FEATURE_BIOS_UPDATE_FROM_MENU))

//TODO: display the battery and temperature information (if available).
//format_diagnostic_data(flashcart_has_feature(FLASHCART_FEATURE_DIAGNOSTIC_DATA))
);

component_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
Expand Down
2 changes: 1 addition & 1 deletion src/menu/views/load_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ static void process (menu_t *menu) {
load_rom = true;
sound_play_effect(SFX_SETTING);
} else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/menu/views/load_emulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ static void process (menu_t *menu) {
if (menu->actions.enter) {
load_pending = true;
} else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/menu/views/load_rom.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ static void process (menu_t *menu) {
if (menu->actions.enter) {
menu->rom_load_pending = true;
} else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
} else if (menu->actions.options) {
component_context_menu_show(&options_context_menu);
sound_play_effect(SFX_SETTING);
Expand Down
2 changes: 1 addition & 1 deletion src/menu/views/music_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ static void process (menu_t *menu) {
if (err != MP3PLAYER_OK) {
menu_show_error(menu, convert_error_message(err));
} else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
} else if (menu->actions.enter) {
err = mp3player_toggle();
if (err != MP3PLAYER_OK) {
Expand Down
2 changes: 1 addition & 1 deletion src/menu/views/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

static void process (menu_t *menu) {
if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/menu/views/settings_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ static void process (menu_t *menu) {
component_context_menu_show(&options_context_menu);
sound_play_effect(SFX_SETTING);
} else if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
}
}

Expand Down Expand Up @@ -146,8 +146,9 @@ static void draw (menu_t *menu, surface_t *d) {
" Background Music : %s\n"
" Rumble Feedback : %s\n"
#endif
"Note: Certain settings have the following caveats:\n\n"
"* Requires a flashcart reboot.\n",
"\n\n"
"Note: Certain settings have the following caveats:\n"
"* Requires rebooting the N64 Console.\n",
menu->settings.default_directory,
format_switch(menu->settings.rom_autoload_enabled),
format_switch(menu->settings.pal60_enabled),
Expand Down
2 changes: 1 addition & 1 deletion src/menu/views/system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ static void process (menu_t *menu) {
}

if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/menu/views/text_viewer.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ static void perform_vertical_scroll (int lines) {

static void process (menu_t *menu) {
if (menu->actions.back) {
menu->next_mode = MENU_MODE_BROWSER;
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
} else if (text) {
if (menu->actions.go_up) {
perform_vertical_scroll(menu->actions.go_fast ? -10 : -1);
Expand Down

0 comments on commit beb1aac

Please sign in to comment.