Merge branch 'develop' into cpak-management

This commit is contained in:
Robin Jones 2024-11-11 15:58:34 +00:00 committed by GitHub
commit ef4ee1b63a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 300 additions and 29 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
# Ignore generated files in the libdragon FS
/filesystem/FiraMonoBold.font64
/filesystem/*.wav64
/filesystem/*.sprite
# Ignore external development tools
/tools/*

View File

@ -29,6 +29,7 @@ SRCS = \
flashcart/64drive/64drive_ll.c \
flashcart/64drive/64drive.c \
flashcart/flashcart_utils.c \
flashcart/ed64/ed64_vseries.c \
flashcart/flashcart.c \
flashcart/sc64/sc64_ll.c \
flashcart/sc64/sc64.c \
@ -86,6 +87,30 @@ SOUNDS = \
error.wav \
settings.wav
JOYPAD_IMAGES = \
joypad_a.png \
joypad_b.png \
joypad_c_down.png \
joypad_c_left.png \
joypad_c_right.png \
joypad_c_up.png \
joypad_d_down.png \
joypad_d_left.png \
joypad_d_right.png \
joypad_d_up.png \
joypad_l.png \
joypad_r.png \
joypad_start.png \
joypad_z.png
# joypad_j_east.png \
# joypad_j_north.png \
# joypad_j_northeast.png \
# joypad_j_northwest.png \
# joypad_j_south.png \
# joypad_j_southeast.png \
# joypad_j_southwest.png \
# joypad_j_west.png \
OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o,$(basename $(SRCS))))
MINIZ_OBJS = $(filter $(BUILD_DIR)/libs/miniz/%.o,$(OBJS))
SPNG_OBJS = $(filter $(BUILD_DIR)/libs/libspng/%.o,$(OBJS))
@ -93,7 +118,8 @@ DEPS = $(OBJS:.o=.d)
FILESYSTEM = \
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(FONTS:%.ttf=%.font64))) \
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(SOUNDS:%.wav=%.wav64)))
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(SOUNDS:%.wav=%.wav64))) \
$(addprefix $(FILESYSTEM_DIR)/, $(notdir $(JOYPAD_IMAGES:%.png=%.sprite)))
$(MINIZ_OBJS): N64_CFLAGS+=-DMINIZ_NO_TIME -fcompare-debug-second
$(SPNG_OBJS): N64_CFLAGS+=-isystem $(SOURCE_DIR)/libs/miniz -DSPNG_USE_MINIZ -fcompare-debug-second
@ -102,14 +128,18 @@ $(FILESYSTEM_DIR)/%.wav64: AUDIOCONV_FLAGS=--wav-compress 1
$(@info $(shell mkdir -p ./$(FILESYSTEM_DIR) &> /dev/null))
$(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/%.ttf
$(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/fonts/%.ttf
@echo " [FONT] $@"
@$(N64_MKFONT) $(MKFONT_FLAGS) -o $(FILESYSTEM_DIR) "$<"
$(FILESYSTEM_DIR)/%.wav64: $(ASSETS_DIR)/%.wav
$(FILESYSTEM_DIR)/%.wav64: $(ASSETS_DIR)/sounds/%.wav
@echo " [AUDIO] $@"
@$(N64_AUDIOCONV) $(AUDIOCONV_FLAGS) -o $(FILESYSTEM_DIR) "$<"
$(FILESYSTEM_DIR)/%.sprite: $(ASSETS_DIR)/images/joypad/%.png
@echo " [SPRITE] $@"
@$(N64_MKSPRITE) $(MKSPRITE_FLAGS) -o $(dir $@) "$<"
$(BUILD_DIR)/$(PROJECT_NAME).dfs: $(FILESYSTEM)
$(BUILD_DIR)/menu/views/credits.o: .FORCE

View File

@ -114,10 +114,20 @@ If required, you can manually adjust the file on the SD card using your computer
* Download the latest `menu.bin` file from the [releases](https://github.com/Polprzewodnikowy/N64FlashcartMenu/releases/) page, then put it in the root directory of your SD card.
### ED64 & ED64P
### ED64 - WIP - UNTESTED AND UNSUPPORTED - USE AT OWN RISK
Currently not supported, but work is in progress (See [PR's](https://github.com/Polprzewodnikowy/N64FlashcartMenu/pulls)).
NOTE: The menu may be able to load ROM's but not perform saves and may break existing ones..
The aim is to replace [Altra64](https://github.com/networkfusion/altra64) and [ED64-UnofficialOS](https://github.com/n64-tools/ED64-UnofficialOS-binaries).
#### ED64 (Vseries)
The aim is to reach feature parity with [ED64-UnofficialOS](https://github.com/n64-tools/ED64-UnofficialOS-binaries) / [ED64-OfficialOS](https://krikzz.com/pub/support/everdrive-64/v2x-v3x/os-bin/).
Download the `OS64.v64` ROM from the latest [action run - assets] and place it in the `/ED64` folder.
#### ED64 (X series)
X Series support is currently awaiting fixes, in the meantime use the official [OS](https://krikzz.com/pub/support/everdrive-64/x-series/OS/) instead.
#### ED64 (P clone)
Download the `OS64P.v64` ROM from the latest [action run - assets] and place it in the `/ED64P` folder.
The aim is to reach feature parity with [Altra64](https://github.com/networkfusion/altra64)
# Open source software and licenses used

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

@ -1 +1 @@
Subproject commit 5295016230d657cd6c7fce5b6ed4a342538e09f5
Subproject commit 0c4e388851cabab52f421bff5e75e9dc3ab36c72

View File

@ -0,0 +1,155 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <fatfs/ff.h>
#include <libdragon.h>
#include "utils/fs.h"
#include "utils/utils.h"
#include "../flashcart_utils.h"
#include "ed64_vseries.h"
typedef enum {
ED64_V1_0 = 110,
ED64_V2_0 = 320,
ED64_V2_5 = 325,
ED64_V3_0 = 330,
} ed64_vseries_device_variant_t;
/* ED64 save location base address */
#define SRAM_ADDRESS (0xA8000000)
/* ED64 ROM location base address */
#define ROM_ADDRESS (0xB0000000)
static flashcart_err_t ed64_vseries_init (void) {
return FLASHCART_OK;
}
static flashcart_err_t ed64_vseries_deinit (void) {
return FLASHCART_OK;
}
static ed64_vseries_device_variant_t get_cart_model() {
ed64_vseries_device_variant_t variant = ED64_V1_0; // FIXME: check cart model from ll for better feature handling.
return variant;
}
static bool ed64_vseries_has_feature (flashcart_features_t feature) {
bool is_model_v3 = (get_cart_model() == ED64_V3_0);
switch (feature) {
case FLASHCART_FEATURE_RTC: return is_model_v3 ? true : false;
case FLASHCART_FEATURE_USB: return is_model_v3 ? true : false;
case FLASHCART_FEATURE_AUTO_CIC: return is_model_v3 ? true : false;
default: return false;
}
}
static flashcart_err_t ed64_vseries_load_rom (char *rom_path, flashcart_progress_callback_t *progress) {
FIL fil;
UINT br;
if (f_open(&fil, strip_fs_prefix(rom_path), FA_READ) != FR_OK) {
return FLASHCART_ERR_LOAD;
}
fatfs_fix_file_size(&fil);
size_t rom_size = f_size(&fil);
if (rom_size > MiB(64)) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}
size_t sdram_size = MiB(64);
size_t chunk_size = KiB(128);
for (int offset = 0; offset < sdram_size; offset += chunk_size) {
size_t block_size = MIN(sdram_size - offset, chunk_size);
if (f_read(&fil, (void *) (ROM_ADDRESS + offset), block_size, &br) != FR_OK) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}
if (progress) {
progress(f_tell(&fil) / (float) (f_size(&fil)));
}
}
if (f_tell(&fil) != rom_size) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}
if (f_close(&fil) != FR_OK) {
return FLASHCART_ERR_LOAD;
}
return FLASHCART_OK;
}
static flashcart_err_t ed64_vseries_load_file (char *file_path, uint32_t rom_offset, uint32_t file_offset) {
FIL fil;
UINT br;
if (f_open(&fil, strip_fs_prefix(file_path), FA_READ) != FR_OK) {
return FLASHCART_ERR_LOAD;
}
fatfs_fix_file_size(&fil);
size_t file_size = f_size(&fil) - file_offset;
if (file_size > (MiB(64) - rom_offset)) {
f_close(&fil);
return FLASHCART_ERR_ARGS;
}
if (f_lseek(&fil, file_offset) != FR_OK) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}
if (f_read(&fil, (void *) (ROM_ADDRESS + rom_offset), file_size, &br) != FR_OK) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}
if (br != file_size) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}
if (f_close(&fil) != FR_OK) {
return FLASHCART_ERR_LOAD;
}
return FLASHCART_OK;
}
static flashcart_err_t ed64_vseries_load_save (char *save_path) {
// FIXME: the savetype will be none.
return FLASHCART_OK;
}
static flashcart_err_t ed64_vseries_set_save_type (flashcart_save_type_t save_type) {
// FIXME: the savetype will be none.
return FLASHCART_OK;
}
static flashcart_t flashcart_ed64_vseries = {
.init = ed64_vseries_init,
.deinit = ed64_vseries_deinit,
.has_feature = ed64_vseries_has_feature,
.load_rom = ed64_vseries_load_rom,
.load_file = ed64_vseries_load_file,
.load_save = ed64_vseries_load_save,
.load_64dd_ipl = NULL,
.load_64dd_disk = NULL,
.set_save_type = ed64_vseries_set_save_type,
.set_save_writeback = NULL,
};
flashcart_t *ed64_vseries_get_flashcart (void) {
return &flashcart_ed64_vseries;
}

View File

@ -0,0 +1,24 @@
/**
* @file ed64_vseries.h
* @brief ED64 Vseries flashcart support
* @ingroup flashcart
*/
#ifndef FLASHCART_ED64_VSERIES_H__
#define FLASHCART_ED64_VSERIES_H__
#include "../flashcart.h"
/**
* @addtogroup ED64_Vseries
* @{
*/
flashcart_t *ed64_vseries_get_flashcart (void);
/** @} */ /* ED64_Vseries */
#endif

View File

@ -0,0 +1,24 @@
/**
* @file ed64xseries.h
* @brief ED64 Xseries flashcart support
* @ingroup flashcart
*/
#ifndef FLASHCART_ED64XSERIES_H__
#define FLASHCART_ED64XSERIES_H__
#include "../flashcart.h"
/**
* @addtogroup ED64_Xseries
* @{
*/
flashcart_t *ed64xseries_get_flashcart (void);
/** @} */ /* ED64_Xseries */
#endif

View File

@ -10,6 +10,7 @@
#include "flashcart.h"
#include "flashcart_utils.h"
#include "ed64/ed64_vseries.h"
#include "64drive/64drive.h"
#include "sc64/sc64.h"
@ -108,10 +109,13 @@ flashcart_err_t flashcart_init (const char **storage_prefix) {
flashcart = d64_get_flashcart();
break;
case CART_EDX: // Series X EverDrive-64
break;
// FIXME: this is commented out awaiting a fix from libcart.
// case CART_EDX: // Series X EverDrive-64
// flashcart = ed64_xseries_get_flashcart();
// break;
case CART_ED: // Original EverDrive-64
case CART_ED: // Series V EverDrive-64 or clone
flashcart = ed64_vseries_get_flashcart();
break;
case CART_SC: // SummerCart64

View File

@ -119,7 +119,7 @@ static void process (menu_t *menu) {
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
}
else if (menu->actions.enter && !is_editing_mode) {
else if (menu->actions.enter && !is_editing_mode && menu->current_time >= 0) {
rtc_tm = *gmtime(&menu->current_time);
is_editing_mode = true;
}
@ -169,6 +169,9 @@ static void draw (menu_t *menu, surface_t *d) {
component_layout_draw();
if (!is_editing_mode) {
if( menu->current_time >= 0 ) {
component_main_text_draw(
ALIGN_CENTER, VALIGN_TOP,
"ADJUST REAL TIME CLOCK\n"
@ -183,13 +186,33 @@ static void draw (menu_t *menu, surface_t *d) {
menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown"
);
if (!is_editing_mode) {
component_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"A: Change\n"
"B: Back"
);
}
else {
component_main_text_draw(
ALIGN_CENTER, VALIGN_TOP,
"ADJUST REAL TIME CLOCK\n"
"\n"
"\n"
"This cart does not support a real time clock."
"\n"
"Current date & time: %s\n"
"\n",
menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown"
);
component_actions_bar_text_draw(
ALIGN_LEFT, VALIGN_TOP,
"\n"
"B: Back"
);
}
}
else {
component_actions_bar_text_draw(
ALIGN_RIGHT, VALIGN_TOP,