mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-25 03:56:54 +01:00
fix other saves 2
This commit is contained in:
parent
ff9b961cd3
commit
811c9e3a32
@ -59,6 +59,9 @@ static flashcart_err_t ed64_init (void) {
|
||||
current_state.is_fram_save_type = false;
|
||||
ed64_state_save(¤t_state);
|
||||
}
|
||||
else if (save_size > KiB(32)) { // sram 128
|
||||
ed64_ll_get_sram(cartsave_data, save_size);
|
||||
}
|
||||
else if (save_size > KiB(2)) { // sram
|
||||
ed64_ll_get_sram(cartsave_data, save_size);
|
||||
}
|
||||
@ -237,8 +240,9 @@ static flashcart_err_t ed64_load_save (char *save_path) {
|
||||
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);
|
||||
case SAVE_TYPE_SRAM_128K:
|
||||
ed64_ll_set_sram_128(cartsave_data, save_size);
|
||||
break;
|
||||
case SAVE_TYPE_FLASHRAM:
|
||||
ed64_ll_set_fram(cartsave_data, save_size);
|
||||
|
@ -222,7 +222,7 @@ void pi_dma_from_cart_safe (void *dest, void *src, unsigned long size) {
|
||||
}
|
||||
|
||||
|
||||
int ed64_ll_get_sram (uint8_t *buffer, int size) {
|
||||
int ed64_ll_get_sram_128 (uint8_t *buffer, int size) {
|
||||
|
||||
dma_wait();
|
||||
|
||||
@ -250,6 +250,35 @@ int ed64_ll_get_sram (uint8_t *buffer, int size) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
int ed64_ll_get_sram (uint8_t *buffer, int size) {
|
||||
|
||||
dma_wait();
|
||||
|
||||
io_write(PI_BSD_DOM2_LAT_REG, 0x05);
|
||||
io_write(PI_BSD_DOM2_PWD_REG, 0x0C);
|
||||
io_write(PI_BSD_DOM2_PGS_REG, 0x0D);
|
||||
io_write(PI_BSD_DOM2_RLS_REG, 0x02);
|
||||
|
||||
dma_wait();
|
||||
|
||||
pi_initialize();
|
||||
|
||||
dma_wait();
|
||||
|
||||
pi_dma_from_sram(buffer, 0, size) ;
|
||||
|
||||
dma_wait();
|
||||
|
||||
io_write(PI_BSD_DOM2_LAT_REG, 0x40);
|
||||
io_write(PI_BSD_DOM2_PWD_REG, 0x12);
|
||||
io_write(PI_BSD_DOM2_PGS_REG, 0x07);
|
||||
io_write(PI_BSD_DOM2_RLS_REG, 0x03);
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
int ed64_ll_get_eeprom (uint8_t *buffer, int size) {
|
||||
|
||||
int blocks=size/8;
|
||||
@ -267,7 +296,7 @@ int ed64_ll_get_fram (uint8_t *buffer, int size) {
|
||||
ed64_ll_set_save_type(SAVE_TYPE_SRAM_128K); //2
|
||||
dma_wait();
|
||||
|
||||
ed64_ll_get_sram(buffer, size);
|
||||
ed64_ll_get_sram_128(buffer, size);
|
||||
data_cache_hit_writeback_invalidate(buffer, size);
|
||||
|
||||
dma_wait();
|
||||
@ -282,6 +311,32 @@ sram upload
|
||||
*/
|
||||
|
||||
|
||||
int ed64_ll_set_sram_128 (uint8_t *buffer, int size) {
|
||||
|
||||
//half working
|
||||
dma_wait();
|
||||
//Timing
|
||||
pi_initialize_sram();
|
||||
|
||||
//Readmode
|
||||
pi_initialize();
|
||||
|
||||
data_cache_hit_writeback_invalidate(buffer,size);
|
||||
dma_wait();
|
||||
|
||||
pi_dma_to_sram(buffer, 0 - (KiB(64) - size), size);
|
||||
data_cache_hit_writeback_invalidate(buffer,size);
|
||||
|
||||
//Wait
|
||||
dma_wait();
|
||||
//Restore evd Timing
|
||||
ed64_ll_set_sdcard_timing();
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int ed64_ll_set_sram (uint8_t *buffer, int size) {
|
||||
|
||||
//half working
|
||||
@ -295,7 +350,7 @@ int ed64_ll_set_sram (uint8_t *buffer, int size) {
|
||||
data_cache_hit_writeback_invalidate(buffer,size);
|
||||
dma_wait();
|
||||
|
||||
pi_dma_to_sram(buffer, 0 - (KiB(64) - size), size);
|
||||
pi_dma_to_sram(buffer, 0, size);
|
||||
data_cache_hit_writeback_invalidate(buffer,size);
|
||||
|
||||
//Wait
|
||||
@ -324,7 +379,7 @@ int ed64_ll_set_fram (uint8_t *buffer, int size) {
|
||||
ed64_ll_set_save_type(SAVE_TYPE_SRAM_128K);
|
||||
dma_wait();
|
||||
|
||||
ed64_ll_set_sram(buffer, size);
|
||||
ed64_ll_set_sram_128(buffer, size);
|
||||
data_cache_hit_writeback_invalidate(buffer, size);
|
||||
|
||||
dma_wait();
|
||||
|
@ -69,10 +69,12 @@ void ed64_ll_set_sram_bank (uint8_t bank);
|
||||
ed64_save_type_t ed64_ll_get_save_type ();
|
||||
void ed64_ll_set_save_type (ed64_save_type_t type);
|
||||
|
||||
int ed64_ll_get_sram_128 (uint8_t *buffer, int size);
|
||||
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_128 (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);
|
||||
|
Loading…
Reference in New Issue
Block a user