mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-25 03:56:54 +01:00
Merge pull request #1 from networkfusion/aria-pr-improvemnets
Improve code style
This commit is contained in:
commit
9bcfface78
1
Makefile
1
Makefile
@ -24,6 +24,7 @@ SRCS = \
|
|||||||
flashcart/sc64/sc64_ll.c \
|
flashcart/sc64/sc64_ll.c \
|
||||||
flashcart/sc64/sc64.c \
|
flashcart/sc64/sc64.c \
|
||||||
flashcart/ed64/ed64_ll.c \
|
flashcart/ed64/ed64_ll.c \
|
||||||
|
flashcart/ed64/ed64_state.c \
|
||||||
flashcart/ed64/ed64.c \
|
flashcart/ed64/ed64.c \
|
||||||
libs/libspng/spng/spng.c \
|
libs/libspng/spng/spng.c \
|
||||||
libs/mini.c/src/mini.c \
|
libs/mini.c/src/mini.c \
|
||||||
|
@ -12,111 +12,79 @@
|
|||||||
#include "../flashcart_utils.h"
|
#include "../flashcart_utils.h"
|
||||||
#include "ed64_ll.h"
|
#include "ed64_ll.h"
|
||||||
#include "ed64.h"
|
#include "ed64.h"
|
||||||
|
#include "ed64_state.h"
|
||||||
|
|
||||||
// #include "../menu/settings.h"
|
|
||||||
|
|
||||||
// This is a trial hack before using the settings API.
|
static ed64_pseudo_writeback_t current_state;
|
||||||
#ifndef LAST_SAVE_FILE_PATH
|
|
||||||
#define LAST_SAVE_FILE_PATH "/menu/last_rom.txt"
|
|
||||||
#endif
|
|
||||||
#ifndef RESET_CHECK_FILE_PATH
|
|
||||||
#define RESET_CHECK_FILE_PATH "/menu/RESET"
|
|
||||||
#endif
|
|
||||||
#ifndef FLASHRAM_CHECK_FILE_PATH
|
|
||||||
#define FLASHRAM_CHECK_FILE_PATH "/menu/FLASHRAM"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int ed_exit(void);
|
extern int ed_exit (void);
|
||||||
|
|
||||||
|
static flashcart_err_t ed64_init (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
|
// TODO: partly already done, see https://github.com/DragonMinded/libdragon/blob/4ec469d26b6dc4e308caf3d5b86c2b340b708bbd/src/libcart/cart.c#L1064
|
||||||
|
|
||||||
// FIXME: Update firmware if needed.
|
// FIXME: Update firmware if needed.
|
||||||
// FIXME: Enable RTC if available.
|
// FIXME: Enable RTC if available.
|
||||||
|
|
||||||
// older everdrives cant save during gameplay so we need to the reset method.
|
// older everdrives cannot save during gameplay so we need to the reset method.
|
||||||
// works by checking if a file exists.
|
// works by checking if a file exists.
|
||||||
|
|
||||||
if (file_exists(strip_sd_prefix(RESET_CHECK_FILE_PATH)))
|
ed64_state_load(¤t_state);
|
||||||
{
|
|
||||||
|
|
||||||
// make sure next boot doesnt trigger the check by deleting the reset file
|
if (current_state.is_expecting_save_writeback == true) {
|
||||||
f_unlink(strip_sd_prefix(RESET_CHECK_FILE_PATH));
|
|
||||||
|
|
||||||
// finds the last save location
|
// make sure next boot doesnt trigger the check changing its state.
|
||||||
FIL lrp_fil;
|
current_state.is_expecting_save_writeback = false;
|
||||||
UINT lrp_br;
|
ed64_state_save(¤t_state);
|
||||||
|
|
||||||
if (f_open(&lrp_fil, strip_sd_prefix(LAST_SAVE_FILE_PATH), FA_READ) != FR_OK)
|
// Now save the content back to the SD card!
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lrp_size = f_size(&lrp_fil);
|
|
||||||
|
|
||||||
TCHAR lrp_path[lrp_size++];
|
|
||||||
|
|
||||||
if (f_read(&lrp_fil, lrp_path, lrp_size, &lrp_br) != FR_OK)
|
|
||||||
{
|
|
||||||
f_close(&lrp_fil);
|
|
||||||
return FLASHCART_ERR_LOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f_close(&lrp_fil) != FR_OK)
|
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now save the content back to the SD!
|
|
||||||
FIL fil;
|
FIL fil;
|
||||||
UINT br;
|
UINT bw;
|
||||||
uint8_t cartsave_data[KiB(128)];
|
uint8_t cartsave_data[KiB(128)];
|
||||||
|
|
||||||
// find the path to last save
|
// find the path to last save
|
||||||
if (file_exists(strip_sd_prefix(lrp_path)))
|
if (file_exists(strip_sd_prefix(current_state.last_save_path))) {
|
||||||
{
|
|
||||||
|
|
||||||
int save_size = file_get_size(strip_sd_prefix(lrp_path));
|
int save_size = file_get_size(strip_sd_prefix(current_state.last_save_path));
|
||||||
|
|
||||||
if ((f_open(&fil, strip_sd_prefix(lrp_path), FA_CREATE_ALWAYS | FA_READ | FA_WRITE)) != FR_OK)
|
if ((f_open(&fil, strip_sd_prefix(current_state.last_save_path), FA_CREATE_ALWAYS | FA_READ | FA_WRITE)) != FR_OK) {
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
// everdrive doesn't care about the save type other than flash sram and eeprom
|
// everdrive doesn't care about the save type other than flash sram and eeprom
|
||||||
// so minus flashram we can just check the size
|
// so minus flashram we can just check the size
|
||||||
if (file_exists(strip_sd_prefix(FLASHRAM_CHECK_FILE_PATH)))
|
if (current_state.is_fram_save_type == true) { // flashram is bugged atm
|
||||||
{ // flashram is bugged atm
|
ed64_ll_get_fram(cartsave_data, save_size);
|
||||||
getFlashRAM(cartsave_data, save_size);
|
|
||||||
// deletes flag
|
// deletes flag
|
||||||
f_unlink(strip_sd_prefix(FLASHRAM_CHECK_FILE_PATH));
|
current_state.is_fram_save_type = false;
|
||||||
|
ed64_state_save(¤t_state);
|
||||||
}
|
}
|
||||||
else if (save_size > KiB(2))
|
else if (save_size > KiB(2)) { // sram
|
||||||
{ // sram
|
ed64_ll_get_sram(cartsave_data, save_size);
|
||||||
getSRAM(cartsave_data, save_size);
|
|
||||||
}
|
}
|
||||||
else
|
else { // eeprom
|
||||||
{ // eeprom
|
ed64_ll_get_eeprom(cartsave_data, save_size);
|
||||||
getEeprom(cartsave_data, save_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_write(&fil, cartsave_data, save_size, &br) != FR_OK)
|
if (f_write(&fil, cartsave_data, save_size, &bw) != FR_OK) {
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_close(&fil) != FR_OK)
|
if (f_close(&fil) != FR_OK) {
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
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(¤t_state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return FLASHCART_OK;
|
return FLASHCART_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static flashcart_err_t ed64_deinit(void)
|
static flashcart_err_t ed64_deinit (void) {
|
||||||
{
|
|
||||||
|
|
||||||
// For the moment, just use libCart exit.
|
// For the moment, just use libCart exit.
|
||||||
ed_exit();
|
ed_exit();
|
||||||
@ -124,10 +92,8 @@ static flashcart_err_t ed64_deinit(void)
|
|||||||
return FLASHCART_OK;
|
return FLASHCART_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ed64_has_feature(flashcart_features_t feature)
|
static bool ed64_has_feature (flashcart_features_t feature) {
|
||||||
{
|
switch (feature) {
|
||||||
switch (feature)
|
|
||||||
{
|
|
||||||
case FLASHCART_FEATURE_64DD:
|
case FLASHCART_FEATURE_64DD:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
@ -135,13 +101,12 @@ static bool ed64_has_feature(flashcart_features_t feature)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static flashcart_err_t ed64_load_rom(char *rom_path, flashcart_progress_callback_t *progress)
|
static flashcart_err_t ed64_load_rom (char *rom_path, flashcart_progress_callback_t *progress) {
|
||||||
{
|
|
||||||
FIL fil;
|
FIL fil;
|
||||||
UINT br;
|
UINT br;
|
||||||
|
|
||||||
if (f_open(&fil, strip_sd_prefix(rom_path), FA_READ) != FR_OK)
|
if (f_open(&fil, strip_sd_prefix(rom_path), FA_READ) != FR_OK) {
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,14 +117,12 @@ static flashcart_err_t ed64_load_rom(char *rom_path, flashcart_progress_callback
|
|||||||
// FIXME: if the cart is not V3 or X5 or X7, we need probably need to - 128KiB for save compatibility.
|
// 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.
|
// 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.
|
// 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))
|
if (rom_size > MiB(64)) {
|
||||||
{
|
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rom_size == MiB(64))
|
if (rom_size == MiB(64)) {
|
||||||
{
|
|
||||||
rom_size -= KiB(128);
|
rom_size -= KiB(128);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,37 +132,32 @@ static flashcart_err_t ed64_load_rom(char *rom_path, flashcart_progress_callback
|
|||||||
for (int offset = 0; offset < sdram_size; offset += chunk_size)
|
for (int offset = 0; offset < sdram_size; offset += chunk_size)
|
||||||
{
|
{
|
||||||
size_t block_size = MIN(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)
|
if (f_read(&fil, (void *)(ROM_ADDRESS + offset), block_size, &br) != FR_OK) {
|
||||||
{
|
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
if (progress)
|
if (progress) {
|
||||||
{
|
|
||||||
progress(f_tell(&fil) / (float)(f_size(&fil)));
|
progress(f_tell(&fil) / (float)(f_size(&fil)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*if (f_tell(&fil) != sdram_size)
|
/*if (f_tell(&fil) != sdram_size) {
|
||||||
{
|
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (f_close(&fil) != FR_OK)
|
if (f_close(&fil) != FR_OK) {
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FLASHCART_OK;
|
return FLASHCART_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static flashcart_err_t ed64_load_file(char *file_path, uint32_t rom_offset, uint32_t file_offset)
|
static flashcart_err_t ed64_load_file (char *file_path, uint32_t rom_offset, uint32_t file_offset)
|
||||||
{
|
{
|
||||||
FIL fil;
|
FIL fil;
|
||||||
UINT br;
|
UINT br;
|
||||||
|
|
||||||
if (f_open(&fil, strip_sd_prefix(file_path), FA_READ) != FR_OK)
|
if (f_open(&fil, strip_sd_prefix(file_path), FA_READ) != FR_OK) {
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,45 +168,38 @@ static flashcart_err_t ed64_load_file(char *file_path, uint32_t rom_offset, uint
|
|||||||
// FIXME: if the cart is not V3 or X5 or X7, we need probably need to - 128KiB for save compatibility.
|
// 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.
|
// 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))
|
if (file_size > (MiB(64) - rom_offset)) {
|
||||||
{
|
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return FLASHCART_ERR_ARGS;
|
return FLASHCART_ERR_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_lseek(&fil, file_offset) != FR_OK)
|
if (f_lseek(&fil, file_offset) != FR_OK) {
|
||||||
{
|
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_read(&fil, (void *)(ROM_ADDRESS + rom_offset), file_size, &br) != FR_OK)
|
if (f_read(&fil, (void *)(ROM_ADDRESS + rom_offset), file_size, &br) != FR_OK) {
|
||||||
{
|
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
if (br != file_size)
|
if (br != file_size) {
|
||||||
{
|
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_close(&fil) != FR_OK)
|
if (f_close(&fil) != FR_OK) {
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FLASHCART_OK;
|
return FLASHCART_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static flashcart_err_t ed64_load_save(char *save_path)
|
static flashcart_err_t ed64_load_save (char *save_path) {
|
||||||
{
|
|
||||||
|
|
||||||
FIL fil;
|
FIL fil;
|
||||||
UINT br;
|
UINT br;
|
||||||
|
|
||||||
if (f_open(&fil, strip_sd_prefix(save_path), FA_READ) != FR_OK)
|
if (f_open(&fil, strip_sd_prefix(save_path), FA_READ) != FR_OK) {
|
||||||
{
|
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
@ -256,91 +207,50 @@ static flashcart_err_t ed64_load_save(char *save_path)
|
|||||||
size_t save_size = file_get_size(strip_sd_prefix(save_path));
|
size_t save_size = file_get_size(strip_sd_prefix(save_path));
|
||||||
uint8_t cartsave_data[save_size];
|
uint8_t cartsave_data[save_size];
|
||||||
|
|
||||||
if (f_read(&fil, cartsave_data, save_size, &br) != FR_OK)
|
if (f_read(&fil, cartsave_data, save_size, &br) != FR_OK) {
|
||||||
{
|
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_close(&fil) != FR_OK)
|
if (f_close(&fil) != FR_OK) {
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
current_state.is_fram_save_type = false;
|
||||||
|
|
||||||
ed64_save_type_t type = ed64_ll_get_save_type();
|
ed64_save_type_t type = ed64_ll_get_save_type();
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case SAVE_TYPE_EEPROM_4K:
|
case SAVE_TYPE_EEPROM_4K:
|
||||||
case SAVE_TYPE_EEPROM_16K:
|
case SAVE_TYPE_EEPROM_16K:
|
||||||
setEeprom(cartsave_data, save_size);
|
ed64_ll_set_eeprom(cartsave_data, save_size);
|
||||||
break;
|
break;
|
||||||
case SAVE_TYPE_SRAM:
|
case SAVE_TYPE_SRAM:
|
||||||
case SAVE_TYPE_SRAM_128K:
|
case SAVE_TYPE_SRAM_128K:
|
||||||
setSRAM(cartsave_data, save_size);
|
ed64_ll_set_sram(cartsave_data, save_size);
|
||||||
break;
|
break;
|
||||||
case SAVE_TYPE_FLASHRAM:
|
case SAVE_TYPE_FLASHRAM:
|
||||||
setFlashRAM(cartsave_data, save_size);
|
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
|
// 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
|
// this tells the cart to use flash instead of sram 128 since they are the same size
|
||||||
FIL flashfil;
|
current_state.is_fram_save_type = true;
|
||||||
if (f_open(&flashfil, strip_sd_prefix(FLASHRAM_CHECK_FILE_PATH), FA_CREATE_ALWAYS) != FR_OK)
|
ed64_state_save(¤t_state);
|
||||||
{
|
|
||||||
f_close(&flashfil);
|
|
||||||
return FLASHCART_ERR_LOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f_close(&flashfil) != FR_OK)
|
|
||||||
{
|
|
||||||
return FLASHCART_OK;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FIL lsp_fil;
|
current_state.last_save_path = save_path;
|
||||||
UINT lsp_bw;
|
current_state.is_expecting_save_writeback = true;
|
||||||
|
ed64_state_save(¤t_state);
|
||||||
if (f_open(&lsp_fil, strip_sd_prefix(LAST_SAVE_FILE_PATH), FA_WRITE | FA_CREATE_ALWAYS) != FR_OK)
|
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
|
||||||
}
|
|
||||||
if (f_write(&lsp_fil, strip_sd_prefix(save_path), strlen(save_path), &lsp_bw) != FR_OK)
|
|
||||||
{
|
|
||||||
f_close(&lsp_fil);
|
|
||||||
return FLASHCART_ERR_LOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f_close(&lsp_fil) != FR_OK)
|
|
||||||
{
|
|
||||||
return FLASHCART_ERR_LOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
FIL rsfil;
|
|
||||||
|
|
||||||
// simulate a unix touch command to create a file as it only needs to exist to detect a reset
|
|
||||||
|
|
||||||
if (f_open(&rsfil, strip_sd_prefix(RESET_CHECK_FILE_PATH), FA_CREATE_ALWAYS) != FR_OK)
|
|
||||||
{
|
|
||||||
f_close(&rsfil);
|
|
||||||
return FLASHCART_ERR_LOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f_close(&rsfil) != FR_OK)
|
|
||||||
{
|
|
||||||
return FLASHCART_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FLASHCART_OK;
|
return FLASHCART_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static flashcart_err_t ed64_set_save_type(flashcart_save_type_t save_type)
|
static flashcart_err_t ed64_set_save_type (flashcart_save_type_t save_type) {
|
||||||
{
|
|
||||||
ed64_save_type_t type;
|
ed64_save_type_t type;
|
||||||
|
|
||||||
switch (save_type)
|
switch (save_type) {
|
||||||
{
|
|
||||||
case FLASHCART_SAVE_TYPE_NONE:
|
case FLASHCART_SAVE_TYPE_NONE:
|
||||||
type = SAVE_TYPE_NONE;
|
type = SAVE_TYPE_NONE;
|
||||||
break;
|
break;
|
||||||
@ -383,7 +293,6 @@ static flashcart_t flashcart_ed64 = {
|
|||||||
.set_save_writeback = NULL,
|
.set_save_writeback = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
flashcart_t *ed64_get_flashcart(void)
|
flashcart_t *ed64_get_flashcart (void) {
|
||||||
{
|
|
||||||
return &flashcart_ed64;
|
return &flashcart_ed64;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,16 @@ typedef enum {
|
|||||||
|
|
||||||
} ed64_registers_t;
|
} ed64_registers_t;
|
||||||
|
|
||||||
|
void pi_initialize (void);
|
||||||
|
void pi_initialize_sram (void);
|
||||||
|
void pi_dma_from_cart (void* dest, void* src, unsigned long size);
|
||||||
|
void pi_dma_to_cart (void* dest, void* src, unsigned long size);
|
||||||
|
void pi_dma_from_sram (void *dest, unsigned long offset, unsigned long size);
|
||||||
|
void pi_dma_to_sram (void* src, unsigned long offset, unsigned long size);
|
||||||
|
void pi_dma_from_cart_safe (void *dest, void *src, unsigned long size);
|
||||||
|
|
||||||
|
void ed64_ll_set_sdcard_timing (void);
|
||||||
|
|
||||||
|
|
||||||
#define SAV_EEP_ON 1
|
#define SAV_EEP_ON 1
|
||||||
#define SAV_SRM_ON 2
|
#define SAV_SRM_ON 2
|
||||||
@ -33,20 +43,21 @@ typedef enum {
|
|||||||
#define SAV_RAM_BANK 128
|
#define SAV_RAM_BANK 128
|
||||||
#define SAV_RAM_BANK_APPLY 32768
|
#define SAV_RAM_BANK_APPLY 32768
|
||||||
|
|
||||||
uint32_t ed64_ll_reg_read(uint32_t reg);
|
uint32_t ed64_ll_reg_read (uint32_t reg);
|
||||||
void ed64_ll_reg_write(uint32_t reg, uint32_t data);
|
void ed64_ll_reg_write (uint32_t reg, uint32_t data);
|
||||||
|
|
||||||
uint8_t ed64_ll_sram_bank;
|
uint8_t ed64_ll_sram_bank;
|
||||||
ed64_save_type_t ed64_ll_save_type;
|
ed64_save_type_t ed64_ll_save_type;
|
||||||
|
|
||||||
|
|
||||||
uint32_t ed64_ll_reg_read(uint32_t reg) {
|
uint32_t ed64_ll_reg_read (uint32_t reg) {
|
||||||
|
|
||||||
*(volatile uint32_t *) (ED64_CONFIG_REGS_BASE);
|
*(volatile uint32_t *) (ED64_CONFIG_REGS_BASE);
|
||||||
return *(volatile uint32_t *) (ED64_CONFIG_REGS_BASE + reg * 4);
|
return *(volatile uint32_t *) (ED64_CONFIG_REGS_BASE + reg * 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ed64_ll_reg_write(uint32_t reg, uint32_t data) {
|
void ed64_ll_reg_write (uint32_t reg, uint32_t data) {
|
||||||
|
|
||||||
*(volatile uint32_t *) (ED64_CONFIG_REGS_BASE);
|
*(volatile uint32_t *) (ED64_CONFIG_REGS_BASE);
|
||||||
*(volatile uint32_t *) (ED64_CONFIG_REGS_BASE + reg * 4) = data;
|
*(volatile uint32_t *) (ED64_CONFIG_REGS_BASE + reg * 4) = data;
|
||||||
@ -55,12 +66,13 @@ void ed64_ll_reg_write(uint32_t reg, uint32_t data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ed64_save_type_t ed64_ll_get_save_type() {
|
ed64_save_type_t ed64_ll_get_save_type (void) {
|
||||||
|
|
||||||
return ed64_ll_save_type;
|
return ed64_ll_save_type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ed64_ll_set_save_type(ed64_save_type_t type) {
|
void ed64_ll_set_save_type (ed64_save_type_t type) {
|
||||||
|
|
||||||
uint16_t save_cfg;
|
uint16_t save_cfg;
|
||||||
uint8_t eeprom_on, sram_on, eeprom_size, sram_size, ram_bank;
|
uint8_t eeprom_on, sram_on, eeprom_size, sram_size, ram_bank;
|
||||||
@ -109,20 +121,22 @@ void ed64_ll_set_save_type(ed64_save_type_t type) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ed64_ll_set_sram_bank(uint8_t bank) {
|
void ed64_ll_set_sram_bank (uint8_t bank) {
|
||||||
|
|
||||||
ed64_ll_sram_bank = bank == 0 ? 0 : 1;
|
ed64_ll_sram_bank = bank == 0 ? 0 : 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PI_Init(void) {
|
void pi_initialize (void) {
|
||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
io_write(PI_STATUS_REG, 0x03);
|
io_write(PI_STATUS_REG, 0x03);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inits PI for sram transfer
|
// Inits PI for sram transfer
|
||||||
void PI_Init_SRAM(void) {
|
void pi_initialize_sram (void) {
|
||||||
|
|
||||||
io_write(PI_BSD_DOM2_LAT_REG, 0x05);
|
io_write(PI_BSD_DOM2_LAT_REG, 0x05);
|
||||||
io_write(PI_BSD_DOM2_PWD_REG, 0x0C);
|
io_write(PI_BSD_DOM2_PWD_REG, 0x0C);
|
||||||
@ -131,8 +145,7 @@ void PI_Init_SRAM(void) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PI_DMAFromSRAM(void *dest, unsigned long offset, unsigned long size) {
|
void pi_dma_from_sram (void *dest, unsigned long offset, unsigned long size) {
|
||||||
|
|
||||||
|
|
||||||
io_write(PI_DRAM_ADDR_REG, K1_TO_PHYS(dest));
|
io_write(PI_DRAM_ADDR_REG, K1_TO_PHYS(dest));
|
||||||
io_write(PI_CART_ADDR_REG, (0xA8000000 + offset));
|
io_write(PI_CART_ADDR_REG, (0xA8000000 + offset));
|
||||||
@ -143,37 +156,44 @@ void PI_DMAFromSRAM(void *dest, unsigned long offset, unsigned long size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PI_DMAToSRAM(void *src, unsigned long offset, unsigned long size) { //void*
|
void pi_dma_to_sram (void *src, unsigned long offset, unsigned long size) {
|
||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
io_write(PI_STATUS_REG, 2);
|
io_write(PI_STATUS_REG, 2);
|
||||||
io_write(PI_DRAM_ADDR_REG, K1_TO_PHYS(src));
|
io_write(PI_DRAM_ADDR_REG, K1_TO_PHYS(src));
|
||||||
io_write(PI_CART_ADDR_REG, (0xA8000000 + offset));
|
io_write(PI_CART_ADDR_REG, (0xA8000000 + offset));
|
||||||
io_write(PI_RD_LEN_REG, (size - 1));
|
io_write(PI_RD_LEN_REG, (size - 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PI_DMAFromCart(void* dest, void* src, unsigned long size) {
|
void pi_dma_from_cart (void* dest, void* src, unsigned long size) {
|
||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
io_write(PI_STATUS_REG, 0x03);
|
io_write(PI_STATUS_REG, 0x03);
|
||||||
io_write(PI_DRAM_ADDR_REG, K1_TO_PHYS(dest));
|
io_write(PI_DRAM_ADDR_REG, K1_TO_PHYS(dest));
|
||||||
io_write(PI_CART_ADDR_REG, K0_TO_PHYS(src));
|
io_write(PI_CART_ADDR_REG, K0_TO_PHYS(src));
|
||||||
io_write(PI_WR_LEN_REG, (size - 1));
|
io_write(PI_WR_LEN_REG, (size - 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PI_DMAToCart(void* dest, void* src, unsigned long size) {
|
void pi_dma_to_cart (void* dest, void* src, unsigned long size) {
|
||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
io_write(PI_STATUS_REG, 0x02);
|
io_write(PI_STATUS_REG, 0x02);
|
||||||
io_write(PI_DRAM_ADDR_REG, K1_TO_PHYS(src));
|
io_write(PI_DRAM_ADDR_REG, K1_TO_PHYS(src));
|
||||||
io_write(PI_CART_ADDR_REG, K0_TO_PHYS(dest));
|
io_write(PI_CART_ADDR_REG, K0_TO_PHYS(dest));
|
||||||
io_write(PI_RD_LEN_REG, (size - 1));
|
io_write(PI_RD_LEN_REG, (size - 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Wrapper to support unaligned access to memory
|
// Wrapper to support unaligned access to memory
|
||||||
void PI_SafeDMAFromCart(void *dest, void *src, unsigned long size) {
|
void pi_dma_from_cart_safe (void *dest, void *src, unsigned long size) {
|
||||||
|
|
||||||
if (!dest || !src || !size) return;
|
if (!dest || !src || !size) return;
|
||||||
|
|
||||||
unsigned long unalignedSrc = ((unsigned long)src) % 2;
|
unsigned long unalignedSrc = ((unsigned long)src) % 2;
|
||||||
@ -181,7 +201,7 @@ void PI_SafeDMAFromCart(void *dest, void *src, unsigned long size) {
|
|||||||
|
|
||||||
//FIXME: Do i really need to check if size is 16bit aligned?
|
//FIXME: Do i really need to check if size is 16bit aligned?
|
||||||
if (!unalignedDest && !unalignedSrc && !(size % 2)) {
|
if (!unalignedDest && !unalignedSrc && !(size % 2)) {
|
||||||
PI_DMAFromCart(dest, src, size);
|
pi_dma_from_cart(dest, src, size);
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -191,16 +211,18 @@ void PI_SafeDMAFromCart(void *dest, void *src, unsigned long size) {
|
|||||||
unsigned long newSize = (size + unalignedSrc) + ((size + unalignedSrc) % 2);
|
unsigned long newSize = (size + unalignedSrc) + ((size + unalignedSrc) % 2);
|
||||||
|
|
||||||
unsigned char *buffer = memalign(8, newSize);
|
unsigned char *buffer = memalign(8, newSize);
|
||||||
PI_DMAFromCart(buffer, newSrc, newSize);
|
pi_dma_from_cart(buffer, newSrc, newSize);
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
memcpy(dest, (buffer + unalignedSrc), size);
|
memcpy(dest, (buffer + unalignedSrc), size);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getSRAM( uint8_t *buffer, int size){
|
int ed64_ll_get_sram (uint8_t *buffer, int size) {
|
||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
io_write(PI_BSD_DOM2_LAT_REG, 0x05);
|
io_write(PI_BSD_DOM2_LAT_REG, 0x05);
|
||||||
@ -210,11 +232,11 @@ int getSRAM( uint8_t *buffer, int size){
|
|||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
PI_Init();
|
pi_initialize();
|
||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
PI_DMAFromSRAM(buffer, 0, size) ;
|
pi_dma_from_sram(buffer, 0, size) ;
|
||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
@ -224,82 +246,93 @@ int getSRAM( uint8_t *buffer, int size){
|
|||||||
io_write(PI_BSD_DOM2_RLS_REG, 0x03);
|
io_write(PI_BSD_DOM2_RLS_REG, 0x03);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getEeprom( uint8_t *buffer, int size){
|
int ed64_ll_get_eeprom (uint8_t *buffer, int size) {
|
||||||
|
|
||||||
int blocks=size/8;
|
int blocks=size/8;
|
||||||
for( int b = 0; b < blocks; b++ ) {
|
for( int b = 0; b < blocks; b++ ) {
|
||||||
eeprom_read( b, &buffer[b * 8] );
|
eeprom_read( b, &buffer[b * 8] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getFlashRAM( uint8_t *buffer, int size){
|
int ed64_ll_get_fram (uint8_t *buffer, int size) {
|
||||||
|
|
||||||
ed64_ll_set_save_type(SAVE_TYPE_SRAM_128K); //2
|
ed64_ll_set_save_type(SAVE_TYPE_SRAM_128K); //2
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
getSRAM(buffer, size);
|
ed64_ll_get_sram(buffer, size);
|
||||||
data_cache_hit_writeback_invalidate(buffer, size);
|
data_cache_hit_writeback_invalidate(buffer, size);
|
||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
ed64_ll_set_save_type(SAVE_TYPE_FLASHRAM);
|
ed64_ll_set_save_type(SAVE_TYPE_FLASHRAM);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sram upload
|
sram upload
|
||||||
*/
|
*/
|
||||||
int setSRAM( uint8_t *buffer, int size){
|
int ed64_ll_set_sram (uint8_t *buffer, int size) {
|
||||||
//half working
|
|
||||||
|
//half working
|
||||||
dma_wait();
|
dma_wait();
|
||||||
//Timing
|
//Timing
|
||||||
PI_Init_SRAM();
|
pi_initialize_sram();
|
||||||
|
|
||||||
//Readmode
|
//Readmode
|
||||||
PI_Init();
|
pi_initialize();
|
||||||
|
|
||||||
data_cache_hit_writeback_invalidate(buffer,size);
|
data_cache_hit_writeback_invalidate(buffer,size);
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
PI_DMAToSRAM(buffer, 0, size);
|
pi_dma_to_sram(buffer, 0, size);
|
||||||
data_cache_hit_writeback_invalidate(buffer,size);
|
data_cache_hit_writeback_invalidate(buffer,size);
|
||||||
|
|
||||||
//Wait
|
//Wait
|
||||||
dma_wait();
|
dma_wait();
|
||||||
//Restore evd Timing
|
//Restore evd Timing
|
||||||
setSDTiming();
|
ed64_ll_set_sdcard_timing();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int setEeprom(uint8_t *buffer, int size){
|
int ed64_ll_set_eeprom (uint8_t *buffer, int size) {
|
||||||
|
|
||||||
int blocks=size/8;
|
int blocks=size/8;
|
||||||
for( int b = 0; b < blocks; b++ ) {
|
for( int b = 0; b < blocks; b++ ) {
|
||||||
eeprom_write( b, &buffer[b * 8] );
|
eeprom_write( b, &buffer[b * 8] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int setFlashRAM(uint8_t *buffer, int size){
|
int ed64_ll_set_fram (uint8_t *buffer, int size) {
|
||||||
|
|
||||||
ed64_ll_set_save_type(SAVE_TYPE_SRAM_128K);
|
ed64_ll_set_save_type(SAVE_TYPE_SRAM_128K);
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
|
||||||
setSRAM(buffer, size);
|
ed64_ll_set_sram(buffer, size);
|
||||||
data_cache_hit_writeback_invalidate(buffer, size);
|
data_cache_hit_writeback_invalidate(buffer, size);
|
||||||
|
|
||||||
dma_wait();
|
dma_wait();
|
||||||
ed64_ll_set_save_type(SAVE_TYPE_FLASHRAM);
|
ed64_ll_set_save_type(SAVE_TYPE_FLASHRAM);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setSDTiming(void){
|
void ed64_ll_set_sdcard_timing (void) {
|
||||||
|
|
||||||
io_write(PI_BSD_DOM1_LAT_REG, 0x40);
|
io_write(PI_BSD_DOM1_LAT_REG, 0x40);
|
||||||
io_write(PI_BSD_DOM1_PWD_REG, 0x12);
|
io_write(PI_BSD_DOM1_PWD_REG, 0x12);
|
||||||
@ -310,4 +343,5 @@ void setSDTiming(void){
|
|||||||
io_write(PI_BSD_DOM2_PWD_REG, 0x12);
|
io_write(PI_BSD_DOM2_PWD_REG, 0x12);
|
||||||
io_write(PI_BSD_DOM2_PGS_REG, 0x07);
|
io_write(PI_BSD_DOM2_PGS_REG, 0x07);
|
||||||
io_write(PI_BSD_DOM2_RLS_REG, 0x03);
|
io_write(PI_BSD_DOM2_RLS_REG, 0x03);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,35 +65,17 @@ typedef enum {
|
|||||||
#define ROM_ADDRESS (0xB0000000)
|
#define ROM_ADDRESS (0xB0000000)
|
||||||
|
|
||||||
/* Save functions */
|
/* Save functions */
|
||||||
void ed64_ll_set_ram_bank(uint8_t bank);
|
void ed64_ll_set_sram_bank (uint8_t bank);
|
||||||
ed64_save_type_t ed64_ll_get_save_type();
|
ed64_save_type_t ed64_ll_get_save_type ();
|
||||||
void ed64_ll_set_save_type(ed64_save_type_t type);
|
void ed64_ll_set_save_type (ed64_save_type_t type);
|
||||||
|
|
||||||
|
int ed64_ll_get_sram (uint8_t *buffer, int size);
|
||||||
|
int ed64_ll_get_eeprom (uint8_t *buffer, int size);
|
||||||
|
int ed64_ll_get_fram (uint8_t *buffer, int size);
|
||||||
|
|
||||||
|
int ed64_ll_set_sram (uint8_t *buffer, int size);
|
||||||
|
int ed64_ll_set_eeprom (uint8_t *buffer, int size);
|
||||||
|
int ed64_ll_set_fram (uint8_t *buffer, int size);
|
||||||
|
|
||||||
/** @} */ /* ed64 */
|
/** @} */ /* ed64 */
|
||||||
|
|
||||||
void data_cache_hit_writeback_invalidate(volatile void *, unsigned long);
|
|
||||||
unsigned int CRC_Calculate(unsigned int crc, unsigned char* buf, unsigned int len);
|
|
||||||
void dma_write_sram(void* src, unsigned long offset, unsigned long size);
|
|
||||||
void dma_read_sram(void *dest, unsigned long offset, unsigned long size);
|
|
||||||
void dma_write_s(void * ram_address, unsigned long pi_address, unsigned long len);
|
|
||||||
void dma_read_s(void * ram_address, unsigned long pi_address, unsigned long len);
|
|
||||||
int writeSram(void* src, unsigned long size);
|
|
||||||
void setSDTiming(void);
|
|
||||||
|
|
||||||
|
|
||||||
void PI_Init(void);
|
|
||||||
void PI_Init_SRAM(void);
|
|
||||||
void PI_DMAFromCart(void* dest, void* src, unsigned long size);
|
|
||||||
void PI_DMAToCart(void* dest, void* src, unsigned long size);
|
|
||||||
void PI_DMAFromSRAM(void *dest, unsigned long offset, unsigned long size);
|
|
||||||
void PI_DMAToSRAM(void* src, unsigned long offset, unsigned long size);
|
|
||||||
void PI_SafeDMAFromCart(void *dest, void *src, unsigned long size);
|
|
||||||
int getSRAM( uint8_t *buffer, int size);
|
|
||||||
int getEeprom( uint8_t *buffer, int size);
|
|
||||||
int getFlashRAM( uint8_t *buffer, int size);
|
|
||||||
int setSRAM( uint8_t *buffer, int size);
|
|
||||||
int setEeprom( uint8_t *buffer, int size);
|
|
||||||
int setFlashRAM( uint8_t *buffer, int size);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
42
src/flashcart/ed64/ed64_state.c
Normal file
42
src/flashcart/ed64/ed64_state.c
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <libdragon.h>
|
||||||
|
#include <mini.c/src/mini.h>
|
||||||
|
|
||||||
|
#include "ed64_state.h"
|
||||||
|
#include "utils/fs.h"
|
||||||
|
|
||||||
|
#ifndef ED64_STATE_FILE_PATH
|
||||||
|
#define ED64_STATE_FILE_PATH "sd:/menu/ed64_state.ini"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static ed64_pseudo_writeback_t init = {
|
||||||
|
.is_expecting_save_writeback = false,
|
||||||
|
.is_fram_save_type = false,
|
||||||
|
.last_save_path = ""
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void ed64_state_load (ed64_pseudo_writeback_t *state) {
|
||||||
|
if (!file_exists(ED64_STATE_FILE_PATH)) {
|
||||||
|
ed64_state_save(&init);
|
||||||
|
}
|
||||||
|
|
||||||
|
mini_t *ini = mini_try_load(ED64_STATE_FILE_PATH);
|
||||||
|
|
||||||
|
state->is_expecting_save_writeback = mini_get_bool(ini, "ed64", "is_expecting_save_writeback", init.is_expecting_save_writeback);
|
||||||
|
state->is_fram_save_type = mini_get_bool(ini, "ed64", "is_fram_save_type", init.is_fram_save_type);
|
||||||
|
state->last_save_path = strdup(mini_get_string(ini, "ed64", "last_save_path", init.last_save_path));
|
||||||
|
|
||||||
|
mini_free(ini);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ed64_state_save (ed64_pseudo_writeback_t *state) {
|
||||||
|
mini_t *ini = mini_create(ED64_STATE_FILE_PATH);
|
||||||
|
|
||||||
|
mini_set_bool(ini, "ed64", "is_expecting_save_writeback", state->is_expecting_save_writeback);
|
||||||
|
mini_set_bool(ini, "ed64", "is_fram_save_type", state->is_fram_save_type);
|
||||||
|
mini_set_string(ini, "ed64", "last_save_path", state->last_save_path);
|
||||||
|
|
||||||
|
mini_save(ini);
|
||||||
|
|
||||||
|
mini_free(ini);
|
||||||
|
}
|
24
src/flashcart/ed64/ed64_state.h
Normal file
24
src/flashcart/ed64/ed64_state.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* @file e664_state.h
|
||||||
|
* @brief ED64 state
|
||||||
|
* @ingroup flashcart
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FLASHCART_ED64_STATE_H__
|
||||||
|
#define FLASHCART_ED64_STATE_H__
|
||||||
|
|
||||||
|
/** @brief ED64 Pseudo Writeback Structure */
|
||||||
|
typedef struct {
|
||||||
|
/** @brief The reset button was used */
|
||||||
|
bool is_expecting_save_writeback;
|
||||||
|
/** @brief The last save type was flash ram */
|
||||||
|
bool is_fram_save_type;
|
||||||
|
/** @brief The path to the last loaded ROM */
|
||||||
|
char *last_save_path;
|
||||||
|
} ed64_pseudo_writeback_t;
|
||||||
|
|
||||||
|
void ed64_state_load (ed64_pseudo_writeback_t *state);
|
||||||
|
void ed64_state_save (ed64_pseudo_writeback_t *state);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -1,6 +1,5 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <libcart/cart.h>
|
|
||||||
#include <libdragon.h>
|
#include <libdragon.h>
|
||||||
|
|
||||||
#include "cart_load.h"
|
#include "cart_load.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user