mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-22 14:09:16 +01:00
Added support for SRAM 1M save type
This commit is contained in:
parent
009f41d87f
commit
d2eaa38df0
@ -59,7 +59,8 @@ typedef enum {
|
|||||||
SAVE_TYPE_EEPROM_16K = 2,
|
SAVE_TYPE_EEPROM_16K = 2,
|
||||||
SAVE_TYPE_SRAM = 3,
|
SAVE_TYPE_SRAM = 3,
|
||||||
SAVE_TYPE_FLASHRAM = 4,
|
SAVE_TYPE_FLASHRAM = 4,
|
||||||
SAVE_TYPE_SRAM_BANKED = 5
|
SAVE_TYPE_SRAM_BANKED = 5,
|
||||||
|
SAVE_TYPE_SRAM_1M = 6
|
||||||
} sc64_save_type_t;
|
} sc64_save_type_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -210,6 +210,9 @@ static bool cfg_set_save_type (save_type_t save_type) {
|
|||||||
case SAVE_TYPE_SRAM_BANKED:
|
case SAVE_TYPE_SRAM_BANKED:
|
||||||
cfg_change_scr_bits(CFG_SCR_SRAM_BANKED | CFG_SCR_SRAM_ENABLED, true);
|
cfg_change_scr_bits(CFG_SCR_SRAM_BANKED | CFG_SCR_SRAM_ENABLED, true);
|
||||||
break;
|
break;
|
||||||
|
case SAVE_TYPE_SRAM_1M:
|
||||||
|
cfg_change_scr_bits(CFG_SCR_SRAM_ENABLED, true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
save_type = SAVE_TYPE_NONE;
|
save_type = SAVE_TYPE_NONE;
|
||||||
break;
|
break;
|
||||||
|
@ -12,7 +12,8 @@ typedef enum {
|
|||||||
SAVE_TYPE_EEPROM_16K = 2,
|
SAVE_TYPE_EEPROM_16K = 2,
|
||||||
SAVE_TYPE_SRAM = 3,
|
SAVE_TYPE_SRAM = 3,
|
||||||
SAVE_TYPE_FLASHRAM = 4,
|
SAVE_TYPE_FLASHRAM = 4,
|
||||||
SAVE_TYPE_SRAM_BANKED = 5
|
SAVE_TYPE_SRAM_BANKED = 5,
|
||||||
|
SAVE_TYPE_SRAM_1M = 6,
|
||||||
} save_type_t;
|
} save_type_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#define SRAM_LENGTH (32 * 1024)
|
#define SRAM_LENGTH (32 * 1024)
|
||||||
#define FLASHRAM_LENGTH (128 * 1024)
|
#define FLASHRAM_LENGTH (128 * 1024)
|
||||||
#define SRAM_BANKED_LENGTH (3 * 32 * 1024)
|
#define SRAM_BANKED_LENGTH (3 * 32 * 1024)
|
||||||
|
#define SRAM_1M_LENGTH (128 * 1024)
|
||||||
#define WRITEBACK_DELAY_TICKS (100)
|
#define WRITEBACK_DELAY_TICKS (100)
|
||||||
|
|
||||||
|
|
||||||
@ -53,6 +54,10 @@ static save_type_t writeback_get_address_length (uint32_t *address, uint32_t *le
|
|||||||
*address = SRAM_FLASHRAM_ADDRESS;
|
*address = SRAM_FLASHRAM_ADDRESS;
|
||||||
*length = SRAM_BANKED_LENGTH;
|
*length = SRAM_BANKED_LENGTH;
|
||||||
break;
|
break;
|
||||||
|
case SAVE_TYPE_SRAM_1M:
|
||||||
|
*address = SRAM_FLASHRAM_ADDRESS;
|
||||||
|
*length = SRAM_1M_LENGTH;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
*address = 0;
|
*address = 0;
|
||||||
*length = 0;
|
*length = 0;
|
||||||
|
@ -7,6 +7,7 @@ use std::{
|
|||||||
io::{stdin, ErrorKind, Read, Write},
|
io::{stdin, ErrorKind, Read, Write},
|
||||||
net::{TcpListener, TcpStream},
|
net::{TcpListener, TcpStream},
|
||||||
panic,
|
panic,
|
||||||
|
path::PathBuf,
|
||||||
sync::mpsc::{channel, Receiver, Sender},
|
sync::mpsc::{channel, Receiver, Sender},
|
||||||
thread::{sleep, spawn},
|
thread::{sleep, spawn},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
@ -285,7 +286,9 @@ impl Handler {
|
|||||||
"save",
|
"save",
|
||||||
match save_writeback.save {
|
match save_writeback.save {
|
||||||
sc64::SaveType::Eeprom4k | sc64::SaveType::Eeprom16k => "eep",
|
sc64::SaveType::Eeprom4k | sc64::SaveType::Eeprom16k => "eep",
|
||||||
sc64::SaveType::Sram | sc64::SaveType::SramBanked => "srm",
|
sc64::SaveType::Sram | sc64::SaveType::SramBanked | sc64::SaveType::Sram1m => {
|
||||||
|
"srm"
|
||||||
|
}
|
||||||
sc64::SaveType::Flashram => "fla",
|
sc64::SaveType::Flashram => "fla",
|
||||||
_ => "sav",
|
_ => "sav",
|
||||||
},
|
},
|
||||||
|
@ -217,6 +217,7 @@ enum SaveType {
|
|||||||
Eeprom16k,
|
Eeprom16k,
|
||||||
Sram,
|
Sram,
|
||||||
SramBanked,
|
SramBanked,
|
||||||
|
Sram1m,
|
||||||
Flashram,
|
Flashram,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,8 +229,8 @@ impl From<n64::SaveType> for SaveType {
|
|||||||
n64::SaveType::Eeprom16k => Self::Eeprom16k,
|
n64::SaveType::Eeprom16k => Self::Eeprom16k,
|
||||||
n64::SaveType::Sram => Self::Sram,
|
n64::SaveType::Sram => Self::Sram,
|
||||||
n64::SaveType::SramBanked => Self::SramBanked,
|
n64::SaveType::SramBanked => Self::SramBanked,
|
||||||
|
n64::SaveType::Sram1m => Self::Sram1m,
|
||||||
n64::SaveType::Flashram => Self::Flashram,
|
n64::SaveType::Flashram => Self::Flashram,
|
||||||
n64::SaveType::Sram128kB => Self::Sram,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,6 +243,7 @@ impl From<SaveType> for sc64::SaveType {
|
|||||||
SaveType::Eeprom16k => Self::Eeprom16k,
|
SaveType::Eeprom16k => Self::Eeprom16k,
|
||||||
SaveType::Sram => Self::Sram,
|
SaveType::Sram => Self::Sram,
|
||||||
SaveType::SramBanked => Self::SramBanked,
|
SaveType::SramBanked => Self::SramBanked,
|
||||||
|
SaveType::Sram1m => Self::Sram1m,
|
||||||
SaveType::Flashram => Self::Flashram,
|
SaveType::Flashram => Self::Flashram,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ pub enum SaveType {
|
|||||||
Sram,
|
Sram,
|
||||||
SramBanked,
|
SramBanked,
|
||||||
Flashram,
|
Flashram,
|
||||||
Sram128kB,
|
Sram1m,
|
||||||
}
|
}
|
||||||
|
|
||||||
const HASH_CHUNK_LENGTH: usize = 1 * 1024 * 1024;
|
const HASH_CHUNK_LENGTH: usize = 1 * 1024 * 1024;
|
||||||
@ -31,7 +31,7 @@ pub fn guess_save_type<T: Read + Seek>(
|
|||||||
3 => SaveType::Sram,
|
3 => SaveType::Sram,
|
||||||
4 => SaveType::SramBanked,
|
4 => SaveType::SramBanked,
|
||||||
5 => SaveType::Flashram,
|
5 => SaveType::Flashram,
|
||||||
6 => SaveType::Sram128kB,
|
6 => SaveType::Sram1m,
|
||||||
_ => SaveType::None,
|
_ => SaveType::None,
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
|
@ -3,8 +3,8 @@ mod error;
|
|||||||
pub mod firmware;
|
pub mod firmware;
|
||||||
mod link;
|
mod link;
|
||||||
mod server;
|
mod server;
|
||||||
|
mod time;
|
||||||
mod types;
|
mod types;
|
||||||
mod utils;
|
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
error::Error,
|
error::Error,
|
||||||
@ -20,10 +20,10 @@ pub use self::{
|
|||||||
use self::{
|
use self::{
|
||||||
cic::{calculate_ipl3_checksum, guess_ipl3_seed, IPL3_LENGTH, IPL3_OFFSET},
|
cic::{calculate_ipl3_checksum, guess_ipl3_seed, IPL3_LENGTH, IPL3_OFFSET},
|
||||||
link::{Command, Link},
|
link::{Command, Link},
|
||||||
|
time::{convert_from_datetime, convert_to_datetime},
|
||||||
types::{
|
types::{
|
||||||
get_config, get_setting, Config, ConfigId, FirmwareStatus, Setting, SettingId, UpdateStatus,
|
get_config, get_setting, Config, ConfigId, FirmwareStatus, Setting, SettingId, UpdateStatus,
|
||||||
},
|
},
|
||||||
utils::{convert_from_datetime, convert_to_datetime},
|
|
||||||
};
|
};
|
||||||
use chrono::{DateTime, Local};
|
use chrono::{DateTime, Local};
|
||||||
use std::{
|
use std::{
|
||||||
@ -83,8 +83,9 @@ const EEPROM_ADDRESS: u32 = 0x0500_2000;
|
|||||||
const EEPROM_4K_LENGTH: usize = 512;
|
const EEPROM_4K_LENGTH: usize = 512;
|
||||||
const EEPROM_16K_LENGTH: usize = 2 * 1024;
|
const EEPROM_16K_LENGTH: usize = 2 * 1024;
|
||||||
const SRAM_LENGTH: usize = 32 * 1024;
|
const SRAM_LENGTH: usize = 32 * 1024;
|
||||||
const SRAM_BANKED_LENGTH: usize = 3 * 32 * 1024;
|
|
||||||
const FLASHRAM_LENGTH: usize = 128 * 1024;
|
const FLASHRAM_LENGTH: usize = 128 * 1024;
|
||||||
|
const SRAM_BANKED_LENGTH: usize = 3 * 32 * 1024;
|
||||||
|
const SRAM_1M_LENGTH: usize = 128 * 1024;
|
||||||
|
|
||||||
const BOOTLOADER_ADDRESS: u32 = 0x04E0_0000;
|
const BOOTLOADER_ADDRESS: u32 = 0x04E0_0000;
|
||||||
|
|
||||||
@ -450,8 +451,9 @@ impl SC64 {
|
|||||||
SaveType::Eeprom4k => (EEPROM_ADDRESS, EEPROM_4K_LENGTH),
|
SaveType::Eeprom4k => (EEPROM_ADDRESS, EEPROM_4K_LENGTH),
|
||||||
SaveType::Eeprom16k => (EEPROM_ADDRESS, EEPROM_16K_LENGTH),
|
SaveType::Eeprom16k => (EEPROM_ADDRESS, EEPROM_16K_LENGTH),
|
||||||
SaveType::Sram => (SAVE_ADDRESS, SRAM_LENGTH),
|
SaveType::Sram => (SAVE_ADDRESS, SRAM_LENGTH),
|
||||||
SaveType::SramBanked => (SAVE_ADDRESS, SRAM_BANKED_LENGTH),
|
|
||||||
SaveType::Flashram => (SAVE_ADDRESS, FLASHRAM_LENGTH),
|
SaveType::Flashram => (SAVE_ADDRESS, FLASHRAM_LENGTH),
|
||||||
|
SaveType::SramBanked => (SAVE_ADDRESS, SRAM_BANKED_LENGTH),
|
||||||
|
SaveType::Sram1m => (SAVE_ADDRESS, SRAM_1M_LENGTH),
|
||||||
};
|
};
|
||||||
|
|
||||||
if length != save_length {
|
if length != save_length {
|
||||||
@ -473,8 +475,9 @@ impl SC64 {
|
|||||||
SaveType::Eeprom4k => (EEPROM_ADDRESS, EEPROM_4K_LENGTH),
|
SaveType::Eeprom4k => (EEPROM_ADDRESS, EEPROM_4K_LENGTH),
|
||||||
SaveType::Eeprom16k => (EEPROM_ADDRESS, EEPROM_16K_LENGTH),
|
SaveType::Eeprom16k => (EEPROM_ADDRESS, EEPROM_16K_LENGTH),
|
||||||
SaveType::Sram => (SAVE_ADDRESS, SRAM_LENGTH),
|
SaveType::Sram => (SAVE_ADDRESS, SRAM_LENGTH),
|
||||||
SaveType::SramBanked => (SAVE_ADDRESS, SRAM_BANKED_LENGTH),
|
|
||||||
SaveType::Flashram => (SAVE_ADDRESS, FLASHRAM_LENGTH),
|
SaveType::Flashram => (SAVE_ADDRESS, FLASHRAM_LENGTH),
|
||||||
|
SaveType::SramBanked => (SAVE_ADDRESS, SRAM_BANKED_LENGTH),
|
||||||
|
SaveType::Sram1m => (SAVE_ADDRESS, SRAM_1M_LENGTH),
|
||||||
};
|
};
|
||||||
|
|
||||||
self.memory_read_chunked(writer, address, save_length)
|
self.memory_read_chunked(writer, address, save_length)
|
||||||
|
@ -253,6 +253,7 @@ pub enum SaveType {
|
|||||||
Sram,
|
Sram,
|
||||||
Flashram,
|
Flashram,
|
||||||
SramBanked,
|
SramBanked,
|
||||||
|
Sram1m,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for SaveType {
|
impl Display for SaveType {
|
||||||
@ -261,9 +262,10 @@ impl Display for SaveType {
|
|||||||
Self::None => "None",
|
Self::None => "None",
|
||||||
Self::Eeprom4k => "EEPROM 4k",
|
Self::Eeprom4k => "EEPROM 4k",
|
||||||
Self::Eeprom16k => "EEPROM 16k",
|
Self::Eeprom16k => "EEPROM 16k",
|
||||||
Self::Sram => "SRAM",
|
Self::Sram => "SRAM 256k",
|
||||||
Self::SramBanked => "SRAM banked",
|
Self::SramBanked => "SRAM 768k",
|
||||||
Self::Flashram => "FlashRAM",
|
Self::Flashram => "FlashRAM 1M",
|
||||||
|
Self::Sram1m => "SRAM 1M",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,6 +280,7 @@ impl TryFrom<u32> for SaveType {
|
|||||||
3 => Self::Sram,
|
3 => Self::Sram,
|
||||||
4 => Self::Flashram,
|
4 => Self::Flashram,
|
||||||
5 => Self::SramBanked,
|
5 => Self::SramBanked,
|
||||||
|
6 => Self::Sram1m,
|
||||||
_ => return Err(Error::new("Unknown save type code")),
|
_ => return Err(Error::new("Unknown save type code")),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -292,6 +295,7 @@ impl From<SaveType> for u32 {
|
|||||||
SaveType::Sram => 3,
|
SaveType::Sram => 3,
|
||||||
SaveType::Flashram => 4,
|
SaveType::Flashram => 4,
|
||||||
SaveType::SramBanked => 5,
|
SaveType::SramBanked => 5,
|
||||||
|
SaveType::Sram1m => 6,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user