mirror of
https://github.com/gopher64/gopher64.git
synced 2026-11-12 09:09:01 +01:00
don't include word_mappings in state (#1381)
This commit is contained in:
1 parent
f6b9fcd3d2
commit
a7a140d3f6
2 files changed
+7
-9
No files matched your search
@@ -561,7 +561,6 @@ impl Device {
|
||||
word_buffer: [0; 40],
|
||||
words: Vec::new(),
|
||||
talking: false,
|
||||
word_mappings: rustc_hash::FxHashMap::default(),
|
||||
},
|
||||
rng: set_rng(),
|
||||
transferpaks: [
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::device;
|
||||
use crate::savestates;
|
||||
#[cfg(all(feature = "gui", not(target_os = "android")))]
|
||||
use crate::ui;
|
||||
|
||||
@@ -18,6 +17,9 @@ const VOICE_STATUS_BUSY: u8 = 0x05;
|
||||
const JDT_VRU: u16 = 0x0100; /* VRU */
|
||||
const CONT_FLAVOR: u16 = JDT_VRU;
|
||||
|
||||
static WORD_MAPPINGS: std::sync::LazyLock<rustc_hash::FxHashMap<String, String>> =
|
||||
std::sync::LazyLock::new(create_word_mappings);
|
||||
|
||||
#[derive(Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct Vru {
|
||||
pub status: u8,
|
||||
@@ -28,13 +30,10 @@ pub struct Vru {
|
||||
pub word_buffer: [u16; 40],
|
||||
pub words: Vec<String>,
|
||||
pub talking: bool,
|
||||
#[serde(serialize_with = "savestates::serialize_sorted_map")]
|
||||
pub word_mappings: rustc_hash::FxHashMap<String, String>,
|
||||
}
|
||||
|
||||
pub fn init(device: &mut device::Device) {
|
||||
reset_vru(device);
|
||||
create_word_mappings(device);
|
||||
}
|
||||
|
||||
fn reset_vru(device: &mut device::Device) {
|
||||
@@ -135,7 +134,7 @@ pub fn process(device: &mut device::Device, channel: usize) {
|
||||
device.vru.word_buffer[offset + i as usize]
|
||||
))
|
||||
}
|
||||
let word = device.vru.word_mappings.get(&data);
|
||||
let word = WORD_MAPPINGS.get(&data);
|
||||
if let Some(result) = word {
|
||||
device.vru.words.push(result.clone());
|
||||
} else {
|
||||
@@ -247,8 +246,8 @@ pub fn vru_talking_event(device: &mut device::Device) {
|
||||
device.vru.talking = false
|
||||
}
|
||||
|
||||
fn create_word_mappings(device: &mut device::Device) {
|
||||
device.vru.word_mappings = rustc_hash::FxHashMap::from_iter([
|
||||
fn create_word_mappings() -> rustc_hash::FxHashMap<String, String> {
|
||||
rustc_hash::FxHashMap::from_iter([
|
||||
(
|
||||
String::from("03A50024000303CF00A80003036000EA"),
|
||||
String::from("pikachu"),
|
||||
@@ -2740,5 +2739,5 @@ fn create_word_mappings(device: &mut device::Device) {
|
||||
String::from("03BA019203C9036C0087000303C6"),
|
||||
String::from("take-that"),
|
||||
),
|
||||
]);
|
||||
])
|
||||
}
|
||||
Reference in new issue
Block a user