From c54356e6f4d29014ad11bb0f7901d2fcd873f06f Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Thu, 9 Jan 2025 21:10:03 +0100 Subject: [PATCH] Fix VRU demo encoding (#120) --- src/device/vru.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/device/vru.rs b/src/device/vru.rs index 7bc14c6..5f738a0 100644 --- a/src/device/vru.rs +++ b/src/device/vru.rs @@ -117,21 +117,12 @@ pub fn process(device: &mut device::Device, channel: usize) { for i in 0..length { data.extend(device.vru.word_buffer[offset + i as usize].to_be_bytes()); } - if device.cart.rom[0x3E] == /* Japan */ 0x4A { - let (res, _enc, errors) = encoding_rs::SHIFT_JIS.decode(&data); - if errors { - panic!("Failed to decode Japanese word {:X?}", data); - } else { - device.vru.words.push(res.to_string()); - } + + let (res, _enc, errors) = encoding_rs::SHIFT_JIS.decode(&data); + if errors { + panic!("Failed to decode Japanese word {:X?}", data); } else { - let decoded: Result = - String::from_utf8(data); - if let Ok(result) = decoded { - device.vru.words.push(result) - } else { - panic!("Could not decode VRU word") - } + device.vru.words.push(res.to_string()); } } else { offset += 1;