Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal ED64 support #44

Open
wants to merge 96 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
f094168
Minimal ED64 support
networkfusion Aug 21, 2023
0ea8334
Merge branch 'main' into ed64-basic
networkfusion Aug 28, 2023
7abb7e6
Merge remote-tracking branch 'upstream/main' into ed64-basic
networkfusion Oct 10, 2023
d3c5eab
Fix expected save type
networkfusion Oct 10, 2023
fbe387e
Add required changes before merge
networkfusion Oct 10, 2023
23b371a
Merge remote-tracking branch 'upstream/main' into ed64-basic
networkfusion Oct 10, 2023
17132dd
Fix saves for real
ariahiro64 Oct 10, 2023
7de97a4
Fix loading.
networkfusion Oct 10, 2023
0ba36f5
Merge remote-tracking branch 'networkfusion/ed64-basic' into ed64-basic
ariahiro64 Oct 10, 2023
13756a9
Further improve ROM loading ability.
networkfusion Oct 10, 2023
0342335
Fix saves on ED64 (#7)
ariahiro64 Oct 10, 2023
8b3d092
Add fixme notes for save restore
networkfusion Oct 10, 2023
5f55eec
Merge remote-tracking branch 'networkfusion/ed64-basic' into HEAD
ariahiro64 Oct 13, 2023
37f32bd
really rough prototype code
ariahiro64 Oct 13, 2023
db7809d
Add settings (not used yet).
networkfusion Oct 14, 2023
72773a4
Merge remote-tracking branch 'upstream/main' into ed64-basic
networkfusion Oct 14, 2023
ef99dce
bump
ariahiro64 Oct 15, 2023
5099642
unless path hardcodded not working
ariahiro64 Oct 15, 2023
3036513
fix warnings
ariahiro64 Oct 15, 2023
a2b3003
account for games that dont save
ariahiro64 Oct 15, 2023
1505c1e
working but hardcodded
ariahiro64 Oct 15, 2023
df3baa3
working but needs testing
ariahiro64 Oct 15, 2023
01b802e
fully working
ariahiro64 Oct 15, 2023
346371a
cleaned up code slightly
ariahiro64 Oct 16, 2023
64762bb
remove types.h
ariahiro64 Oct 17, 2023
dfc0a92
remove bloat
ariahiro64 Oct 17, 2023
075a204
fix
ariahiro64 Oct 17, 2023
35e4727
flash ram fixed
ariahiro64 Oct 17, 2023
3d61ed8
use libdragon io
ariahiro64 Oct 17, 2023
66668aa
Update src/menu/cart_load.c
ariahiro64 Oct 19, 2023
e76e11d
Update src/flashcart/ed64/ed64.c
ariahiro64 Oct 19, 2023
8f8b9ad
Update src/flashcart/ed64/ed64.c
ariahiro64 Oct 19, 2023
c30fc87
Update src/flashcart/ed64/ed64.c
ariahiro64 Oct 19, 2023
f49f7a4
fixed sram 128 and added suggested changes
ariahiro64 Oct 19, 2023
ef8d86b
dinosaur planet working
ariahiro64 Oct 20, 2023
9ef2f2d
hotfix
ariahiro64 Oct 20, 2023
11d90fd
Improve code style
networkfusion Oct 20, 2023
f75a26a
Move sd timings
networkfusion Oct 20, 2023
d0875e4
Remove un-necessary header
networkfusion Oct 20, 2023
0f17c61
Code style
networkfusion Oct 20, 2023
7b4a675
Add state ini (not used yet)
networkfusion Oct 20, 2023
ff218da
Move to struct for reset and fram state.
networkfusion Oct 20, 2023
1daa664
Minor comment improvements
networkfusion Oct 21, 2023
d677712
Finish state conversion
networkfusion Oct 21, 2023
a5d9f7d
Improve error conditions
networkfusion Oct 21, 2023
9bcffac
Merge pull request #1 from networkfusion/aria-pr-improvemnets
ariahiro64 Oct 21, 2023
3c2daf7
fix large saves
ariahiro64 Oct 21, 2023
eb9fecb
calculate fram size without seperate function
ariahiro64 Oct 21, 2023
ea1c7db
fix other saves
ariahiro64 Oct 21, 2023
ff9b961
Dinosaur planet 100% working
ariahiro64 Oct 21, 2023
811c9e3
fix other saves 2
ariahiro64 Oct 21, 2023
a88e1f0
get rid of unneded function
ariahiro64 Oct 21, 2023
620a9e9
make sure sram128 and fram are 128kb
ariahiro64 Oct 21, 2023
7163cf7
dino fix (cubavore still crashes)
ariahiro64 Oct 22, 2023
d6534bd
Merge pull request #8 from ariahiro64/ed64-basic
networkfusion Oct 23, 2023
411be73
Merge branch 'main' into ed64-basic
networkfusion Oct 23, 2023
667a11c
Update README.md
networkfusion Oct 23, 2023
e6149cd
one last commit
ariahiro64 Oct 23, 2023
08f1cc6
Merge pull request #10 from ariahiro64/ed64-basic
networkfusion Oct 23, 2023
d9cfeaa
Add SAVE_TYPE_DD64_CART_PORT
networkfusion Oct 23, 2023
b792ec6
Update libdragon
networkfusion Oct 23, 2023
f8401e6
Merge remote-tracking branch 'upstream/main' into ed64-basic
networkfusion Nov 1, 2023
e36b591
Update submodules
networkfusion Nov 1, 2023
8e3a1f0
Revert "Update submodules"
networkfusion Nov 1, 2023
9ef0adc
Fix ed64_state save in minic
networkfusion Nov 1, 2023
ddd644f
Merge branch 'main' into ed64-basic
networkfusion Nov 10, 2023
dba02e9
Update settings.c
networkfusion Nov 10, 2023
79a3deb
Update settings.c
networkfusion Nov 10, 2023
4010aa5
Update settings.h
networkfusion Nov 10, 2023
1a42d69
Update settings.c
networkfusion Nov 10, 2023
93ba181
Merge branch 'Polprzewodnikowy:main' into ed64-basic
networkfusion Nov 12, 2023
f052cb1
Add save fixes
networkfusion Nov 14, 2023
589df29
Minor improvements
networkfusion Nov 14, 2023
7347de9
Merge branch 'main' into ed64-basic
networkfusion Dec 20, 2023
4796c52
Merge branch 'main' into ed64-basic
networkfusion Dec 22, 2023
321d1e0
Merge branch 'main' into ed64-basic
networkfusion Dec 22, 2023
e4480a1
Use libdragon function for sleep
networkfusion Dec 22, 2023
c080026
Merge branch 'main' into ed64-basic
networkfusion Dec 23, 2023
d5a18c5
Improve readme
networkfusion Dec 24, 2023
bc7a931
Ignore whole tools dir
networkfusion Dec 24, 2023
a0a5b34
fix ability to load ROMs
networkfusion Dec 29, 2023
1566fe9
Merge branch 'main' into ed64-basic
networkfusion Apr 27, 2024
ed6bc2a
Update ed64.c
networkfusion Apr 27, 2024
f646b50
Update ed64.c
networkfusion Apr 27, 2024
93797f5
Update ed64.c
networkfusion May 1, 2024
8188a24
Fix hidden ED dirs
networkfusion May 1, 2024
7e2b503
Improve state file path
networkfusion May 1, 2024
57dba3d
Minor comment improvements and fixes
networkfusion May 1, 2024
8fd4196
Merge remote-tracking branch 'upstream/main' into ed64-basic
networkfusion May 5, 2024
417f66c
Add commented out code for ed64x
networkfusion May 5, 2024
1cafa8c
Merge remote-tracking branch 'upstream/main' into ed64-basic
networkfusion May 19, 2024
ada023a
Merge branch 'develop' into ed64-basic
networkfusion Jun 8, 2024
8ced966
Merge branch 'develop' into ed64-basic
networkfusion Aug 4, 2024
717db39
Update ed64.c
networkfusion Aug 4, 2024
e7a6141
Update ed64_ll.h
networkfusion Aug 4, 2024
fd5bea7
Merge branch 'develop' into ed64-basic
networkfusion Aug 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ SRCS = \
flashcart/flashcart.c \
flashcart/sc64/sc64_ll.c \
flashcart/sc64/sc64.c \
flashcart/ed64/ed64_ll.c \
flashcart/ed64/ed64_state.c \
flashcart/ed64/ed64.c \
libs/libspng/spng/spng.c \
libs/mini.c/src/mini.c \
libs/miniz/miniz_tdef.c \
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ 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
Currently not supported, but work is in progress (See [PR's](https://github.com/Polprzewodnikowy/N64FlashcartMenu/pulls)).
### ED64
#### ED64 (V or X series)
Download the `OS64.v64` ROM from the latest action run assets and place it in the `/ED64` folder.

The aim is to replace [Altra64](https://github.com/networkfusion/altra64) and [ED64-UnofficialOS](https://github.com/n64-tools/ED64-UnofficialOS-binaries).
#### ED64 (P clone)
Download the `OS64P.v64` ROM from the latest action run assets and place it in the `/ED64P` folder.


# Open source software and licenses used
Expand Down
1 change: 1 addition & 0 deletions src/flashcart/ed64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder allows support for the ED64(P) flashcart when using V series hardware.
322 changes: 322 additions & 0 deletions src/flashcart/ed64/ed64.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#include <fatfs/ff.h>
#include <libdragon.h>
#include <libcart/cart.h>

#include "utils/fs.h"
#include "utils/utils.h"

#include "../flashcart_utils.h"
#include "ed64_ll.h"
#include "ed64.h"
#include "ed64_state.h"

#define ED64_STATE_FILE "ed64_state.ini"

#ifndef ED64_OS_DIRECTORY
#define ED64_OS_DIRECTORY "/ED64"
#endif

static ed64_pseudo_writeback_t current_state;

extern int ed_exit (void);

static flashcart_err_t ed64_init (void) {

// TODO: partly already done, see https://github.com/DragonMinded/libdragon/blob/4ec469d26b6dc4e308caf3d5b86c2b340b708bbd/src/libcart/cart.c#L1064

// FIXME: Update firmware if needed.
// FIXME: Enable RTC if available.

// older everdrives cannot save during gameplay so we need to the reset method.
// works by checking if a file exists.

// FIXME: should put the file in the OS dir (ED64_OS_DIRECTORY), but different if a clone (ED64P).
char *state_path = "sd:/menu/"ED64_STATE_FILE;
ed64_state_init(state_path);
ed64_state_load(&current_state);

if (current_state.is_expecting_save_writeback == true) {

// make sure next boot does not trigger the check changing its state.
current_state.is_expecting_save_writeback = false;
ed64_state_save(&current_state);

// Now save the content back to the SD card!
FIL fil;
UINT bw;
uint8_t cartsave_data[KiB(128)];

// find the path to last save
if (file_exists(strip_fs_prefix(current_state.last_save_path))) {

int save_size = file_get_size(current_state.last_save_path);

if ((f_open(&fil, strip_fs_prefix(current_state.last_save_path), FA_CREATE_ALWAYS | FA_WRITE)) != FR_OK) {
return FLASHCART_ERR_LOAD;
}

// everdrive doesn't care about the save type other than flash sram and eeprom
// so minus flashram we can just check the size
if (current_state.is_fram_save_type == true) { // flashram is bugged atm
ed64_ll_get_fram(cartsave_data, save_size);
// deletes flag
current_state.is_fram_save_type = false;
ed64_state_save(&current_state);
}
else if (save_size > KiB(2)) { // sram
ed64_ll_get_sram(cartsave_data, save_size);
}
else { // eeprom
ed64_ll_get_eeprom(cartsave_data, save_size);
}

if (f_write(&fil, cartsave_data, save_size, &bw) != FR_OK) {
return FLASHCART_ERR_LOAD;
}

if (f_close(&fil) != FR_OK) {
return FLASHCART_ERR_LOAD;
}
}
else {
current_state.is_expecting_save_writeback = false;
current_state.is_fram_save_type = false;
current_state.last_save_path = "";
ed64_state_save(&current_state);
}
}
return FLASHCART_OK;
}
Comment on lines +27 to +93
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address TODO and FIXME comments.

The function contains several TODO and FIXME comments indicating incomplete implementation.

Do you want me to address these TODO and FIXME comments or open a GitHub issue to track these tasks?


static flashcart_err_t ed64_deinit (void) {

// save the state file.
ed64_state_save(&current_state);
// For the moment, just use libCart exit.
ed_exit();

return FLASHCART_OK;
}

static bool ed64_has_feature (flashcart_features_t feature) {
switch (feature) {
case FLASHCART_FEATURE_64DD:
// FIXME: this is not valid for the V3, as does contain them:
case FLASHCART_FEATURE_RTC:
case FLASHCART_FEATURE_USB:
return false;
default:
return false;
}
}
Comment on lines +105 to +115
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address FIXME comment.

The function contains a FIXME comment indicating invalid feature checks for V3.

Do you want me to address this FIXME comment or open a GitHub issue to track this task?


static flashcart_err_t ed64_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);

// FIXME: if the cart is not V3 or X5 or X7, we need probably need to - 128KiB for save compatibility.
// Or somehow warn that certain ROM's will have corruption due to the address space being used for saves.
// Conker's Bad Fur Day doesn't have this issue because eeprom data is at a fixed address in pif ram.
if (rom_size > MiB(64)) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}

// FIXME: is this actually needed?
/*
if (rom_size == MiB(64)) {
ed64_save_type_t type = ed64_ll_get_save_type();
switch (type) {
case SAVE_TYPE_SRAM:
rom_size -= KiB(32);
break;
case SAVE_TYPE_SRAM_128K:
case SAVE_TYPE_FLASHRAM:
rom_size -= KiB(128);
break;
case SAVE_TYPE_DD64_CART_PORT:
break;
default:
break;
}
}
*/

size_t sdram_size = rom_size;

size_t chunk_size = MiB(1);
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_close(&fil) != FR_OK) {
return FLASHCART_ERR_LOAD;
}

return FLASHCART_OK;
Comment on lines +117 to +177
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address FIXME comments.

The function contains several FIXME comments indicating incomplete implementation.

Do you want me to address these FIXME comments or open a GitHub issue to track these tasks?

}

static flashcart_err_t ed64_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;

// FIXME: if the cart is not V3 or X5 or X7, we need probably need to - 128KiB for save compatibility.
// Or somehow warn that certain ROM's will have corruption due to the address space being used for saves.

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;
Comment on lines +180 to +219
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address FIXME comment.

The function contains a FIXME comment indicating incomplete implementation.

Do you want me to address this FIXME comment or open a GitHub issue to track this task?

}

static flashcart_err_t ed64_load_save (char *save_path) {

FIL fil;
UINT br;

if (f_open(&fil, strip_fs_prefix(save_path), FA_READ) != FR_OK) {
return FLASHCART_ERR_LOAD;
}

size_t save_size = file_get_size(save_path);
uint8_t cartsave_data[save_size];

if (f_read(&fil, cartsave_data, save_size, &br) != FR_OK) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}

if (br != save_size) {
return FLASHCART_ERR_LOAD;
}

networkfusion marked this conversation as resolved.
Show resolved Hide resolved
current_state.is_fram_save_type = false;

ed64_save_type_t type = ed64_ll_get_save_type();
switch (type) {
case SAVE_TYPE_EEPROM_4K:
case SAVE_TYPE_EEPROM_16K:
ed64_ll_set_eeprom(cartsave_data, save_size);
break;
case SAVE_TYPE_SRAM:
case SAVE_TYPE_SRAM_128K:
ed64_ll_set_sram(cartsave_data, save_size);
break;
case SAVE_TYPE_FLASHRAM:
ed64_ll_set_fram(cartsave_data, save_size);
// a cold and warm boot has no way of seeing save types and most types can be determined by size
// this tells the cart to use flash instead of sram 128 since they are the same size
current_state.is_fram_save_type = true;
ed64_state_save(&current_state);
break;
default:
break;
}


current_state.last_save_path = save_path;
current_state.is_expecting_save_writeback = true;
ed64_state_save(&current_state);

Comment on lines +222 to +270
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid variable length arrays.

The variable cartsave_data is declared with a variable length, which is not standard C. Use dynamic memory allocation instead.

-    uint8_t cartsave_data[save_size];
+    uint8_t *cartsave_data = malloc(save_size);
+    if (cartsave_data == NULL) {
+        f_close(&fil);
+        return FLASHCART_ERR_LOAD;
+    }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
static flashcart_err_t ed64_load_save (char *save_path) {
FIL fil;
UINT br;
if (f_open(&fil, strip_fs_prefix(save_path), FA_READ) != FR_OK) {
return FLASHCART_ERR_LOAD;
}
size_t save_size = file_get_size(save_path);
uint8_t cartsave_data[save_size];
if (f_read(&fil, cartsave_data, save_size, &br) != FR_OK) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}
if (br != save_size) {
return FLASHCART_ERR_LOAD;
}
current_state.is_fram_save_type = false;
ed64_save_type_t type = ed64_ll_get_save_type();
switch (type) {
case SAVE_TYPE_EEPROM_4K:
case SAVE_TYPE_EEPROM_16K:
ed64_ll_set_eeprom(cartsave_data, save_size);
break;
case SAVE_TYPE_SRAM:
case SAVE_TYPE_SRAM_128K:
ed64_ll_set_sram(cartsave_data, save_size);
break;
case SAVE_TYPE_FLASHRAM:
ed64_ll_set_fram(cartsave_data, save_size);
// a cold and warm boot has no way of seeing save types and most types can be determined by size
// this tells the cart to use flash instead of sram 128 since they are the same size
current_state.is_fram_save_type = true;
ed64_state_save(&current_state);
break;
default:
break;
}
current_state.last_save_path = save_path;
current_state.is_expecting_save_writeback = true;
ed64_state_save(&current_state);
static flashcart_err_t ed64_load_save (char *save_path) {
FIL fil;
UINT br;
if (f_open(&fil, strip_fs_prefix(save_path), FA_READ) != FR_OK) {
return FLASHCART_ERR_LOAD;
}
size_t save_size = file_get_size(save_path);
uint8_t *cartsave_data = malloc(save_size);
if (cartsave_data == NULL) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}
if (f_read(&fil, cartsave_data, save_size, &br) != FR_OK) {
f_close(&fil);
return FLASHCART_ERR_LOAD;
}
if (br != save_size) {
return FLASHCART_ERR_LOAD;
}
current_state.is_fram_save_type = false;
ed64_save_type_t type = ed64_ll_get_save_type();
switch (type) {
case SAVE_TYPE_EEPROM_4K:
case SAVE_TYPE_EEPROM_16K:
ed64_ll_set_eeprom(cartsave_data, save_size);
break;
case SAVE_TYPE_SRAM:
case SAVE_TYPE_SRAM_128K:
ed64_ll_set_sram(cartsave_data, save_size);
break;
case SAVE_TYPE_FLASHRAM:
ed64_ll_set_fram(cartsave_data, save_size);
// a cold and warm boot has no way of seeing save types and most types can be determined by size
// this tells the cart to use flash instead of sram 128 since they are the same size
current_state.is_fram_save_type = true;
ed64_state_save(&current_state);
break;
default:
break;
}
current_state.last_save_path = save_path;
current_state.is_expecting_save_writeback = true;
ed64_state_save(&current_state);

return FLASHCART_OK;
}

static flashcart_err_t ed64_set_save_type (flashcart_save_type_t save_type) {
ed64_save_type_t type;

switch (save_type) {
case FLASHCART_SAVE_TYPE_NONE:
type = SAVE_TYPE_NONE;
break;
case FLASHCART_SAVE_TYPE_EEPROM_4KBIT:
type = SAVE_TYPE_EEPROM_4K;
break;
case FLASHCART_SAVE_TYPE_EEPROM_16KBIT:
type = SAVE_TYPE_EEPROM_16K;
break;
case FLASHCART_SAVE_TYPE_SRAM_256KBIT:
type = SAVE_TYPE_SRAM;
break;
case FLASHCART_SAVE_TYPE_SRAM_BANKED:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add "SRAM banked" support to the has_feature function as this is very wrong and won't work with this flashcart. ED64 registers occupy last bank of this save type and that could lead to some undesired behavior. I don't really know right now if we should block loading such save types or just show a warning that this save isn't supported and let user load ROM regardless.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check more fully, but the carts would support it, since a) this menu does not write to it. b) if it did, we should store in the pseudo region for flashram.

case FLASHCART_SAVE_TYPE_SRAM_1MBIT:
type = SAVE_TYPE_SRAM_128K;
break;
case FLASHCART_SAVE_TYPE_FLASHRAM_PKST2:
case FLASHCART_SAVE_TYPE_FLASHRAM_1MBIT:
type = SAVE_TYPE_FLASHRAM;
break;
default:
return FLASHCART_ERR_ARGS;
}

ed64_ll_set_save_type(type);

return FLASHCART_OK;
}

static flashcart_t flashcart_ed64 = {
.init = ed64_init,
.deinit = ed64_deinit,
.has_feature = ed64_has_feature,
.load_rom = ed64_load_rom,
.load_file = ed64_load_file,
.load_save = ed64_load_save,
.load_64dd_ipl = NULL,
.load_64dd_disk = NULL,
.set_save_type = ed64_set_save_type,
.set_save_writeback = NULL,
};

flashcart_t *ed64_get_flashcart (void) {
return &flashcart_ed64;
}
24 changes: 24 additions & 0 deletions src/flashcart/ed64/ed64.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @file flashcart.h
* @brief ED64 Flashcart Utilities
* @ingroup flashcart
*/

#ifndef FLASHCART_ED64_H__
#define FLASHCART_ED64_H__


#include "../flashcart.h"


/**
* @addtogroup ed64
* @{
*/

flashcart_t *ed64_get_flashcart (void);

/** @} */ /* ed64 */


#endif
Loading