[v0.1.0-beta.5] Fixed get version function

This commit is contained in:
sup39 2023-07-26 18:22:34 +09:00
parent 3a4ba11520
commit 58b75ce398
No known key found for this signature in database
GPG key ID: 14D2E0D21140D260
5 changed files with 19 additions and 14 deletions

View file

@ -1,4 +1,7 @@
# Changelog
## v0.1.0-beta.5 (2023/07/26)
- Fixed get version function
## v0.1.0-beta.4 (2023/07/26)
- Added validity check on MEM1 of DolphinProcessMemory
- Fixed write memory API

View file

@ -1,6 +1,6 @@
[package]
name = "sup-smsac"
version = "0.1.0-beta.4"
version = "0.1.0-beta.5"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["sup39 <sms@sup39.dev>"]

View file

@ -45,9 +45,9 @@ impl_decode_be_for_int!(i128, 16);
impl_decode_be_for_float!(f32, u32, 4);
impl_decode_be_for_float!(f64, u64, 8);
impl<const N: usize> DecodeBE for &[u8; N] {
impl<const N: usize> DecodeBE for [u8; N] {
const PACKED_SIZE: usize = N;
unsafe fn decode_be(ptr: *const u8) -> Self {
&*(ptr as *const [u8; N])
*(ptr as *const [u8; N])
}
}

View file

@ -38,16 +38,18 @@ impl SMSDolphin {
}
pub fn from_dolphin_memory(d: DolphinMemory, pid: PidType) -> Result<SMSDolphin, Option<[u8; 8]>> {
match d.read::<&[u8; 8]>(Addr(0x80000000)) {
None => Err(None),
Some(rver) => match rver {
b"GMSJ01\x00\x00" => Ok(SMSVersion::GMSJ01),
b"GMSE01\x00\x30" => Ok(SMSVersion::GMSE01),
b"GMSP01\x00\x00" => Ok(SMSVersion::GMSP01),
b"GMSJ01\x00\x01" => Ok(SMSVersion::GMSJ0A),
_ => Err(Some(rver.to_owned())),
}.map(|ver| SMSDolphin {d, ver, pid}),
}
unsafe {
d.read_memory_unchecked(DolphinMemAddr::MEM1(0), 8, |ptr| {
match &*(ptr as *const [u8; 8]) {
b"GMSJ01\x00\x00" => Ok(SMSVersion::GMSJ01),
b"GMSE01\x00\x30" => Ok(SMSVersion::GMSE01),
b"GMSP01\x00\x00" => Ok(SMSVersion::GMSP01),
b"GMSJ01\x00\x01" => Ok(SMSVersion::GMSJ0A),
rver => Err(Some(rver.to_owned())),
}
})
} .unwrap_or(Err(None))
.map(|ver| SMSDolphin {d, ver, pid})
}
pub fn get_class(&self, addr: Addr) -> Option<&'static str> {
vt::get_class(self.ver, addr)

View file

@ -8,7 +8,7 @@
<script src="index.js"></script>
</head>
<body>
<h1>SMS Web Object Viewer (v0.1.0-beta.4) (2023/07/26)</h1>
<h1>SMS Web Object Viewer (v0.1.0-beta.5) (2023/07/26)</h1>
<header>
<div id="msg"></div>
<details>