diff --git a/build.rs b/build.rs index 89f3ead1..90d8632f 100644 --- a/build.rs +++ b/build.rs @@ -206,6 +206,7 @@ fn main() { .allowlist_function("rdp_state_size") .allowlist_function("rdp_save_state") .allowlist_function("rdp_load_state") + .allowlist_function("rdp_idle") .allowlist_function("rdp_set_fps") .allowlist_function("get_joystick_event") .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) diff --git a/parallel-rdp/interface.cpp b/parallel-rdp/interface.cpp index 1cc9eddf..1a0bee23 100644 --- a/parallel-rdp/interface.cpp +++ b/parallel-rdp/interface.cpp @@ -298,6 +298,12 @@ JoystickEvent get_joystick_event() { return joystick_event; } +void rdp_idle() { + processor->idle(); + sync_signal = 0; + rdram_dirty.assign(gfx_info.RDRAM_SIZE >> 3, false); +} + static void rdp_new_processor() { RDP::CommandProcessorFlags flags = RDP::COMMAND_PROCESSOR_FLAG_HOST_VISIBLE_HIDDEN_RDRAM_BIT | @@ -327,6 +333,9 @@ static void rdp_new_processor() { if (!g_hidden_rdram) { printf("Failed to get hidden_rdram\n"); } + + sync_signal = 0; + rdram_dirty.assign(gfx_info.RDRAM_SIZE >> 3, false); } static ImageHandle create_message_image(Vulkan::Device &device, int width, @@ -429,9 +438,6 @@ void rdp_init(void *_window, GFX_INFO _gfx_info, const void *font, achievement_progress_indicator_image = Vulkan::ImageHandle(); fps_image = Vulkan::ImageHandle(); display_fps = false; - - sync_signal = 0; - rdram_dirty.assign(gfx_info.RDRAM_SIZE >> 3, false); } void rdp_close() { diff --git a/parallel-rdp/interface.hpp b/parallel-rdp/interface.hpp index 7de41daa..9d8d23fe 100644 --- a/parallel-rdp/interface.hpp +++ b/parallel-rdp/interface.hpp @@ -58,6 +58,7 @@ void rdp_update_screen(); void rdp_render_frame(); CALL_BACK rdp_check_callback(); uint64_t rdp_process_commands(); +void rdp_idle(); void rdp_onscreen_message(const char *message, MESSAGE_LENGTH milliseconds); void rdp_check_framebuffers(uint32_t address, uint32_t length); size_t rdp_state_size(); diff --git a/src/savestates.rs b/src/savestates.rs index 70f45f63..294d8803 100644 --- a/src/savestates.rs +++ b/src/savestates.rs @@ -113,7 +113,7 @@ pub fn process_savestates(device: &mut device::Device) { pub fn create_savestate(device: &mut device::Device, rewind: bool, rewind_frame: Option) { if !rewind { - ui::video::check_framebuffers(0, device.rdram.size); + ui::video::idle(); } let mut rdp_state: Vec = vec![0; ui::video::state_size()]; @@ -264,7 +264,7 @@ pub fn load_savestate(device: &mut device::Device, rewind: bool, rewind_frame: O && device.rdram.size == state.device.rdram.size { if device.netplay.is_none() { - ui::video::check_framebuffers(0, device.rdram.size); + ui::video::idle(); } device.savestate.last_rewind_saved = state.device.vi.elapsed_time; diff --git a/src/ui/video.rs b/src/ui/video.rs index b5159f19..5c08a0bc 100644 --- a/src/ui/video.rs +++ b/src/ui/video.rs @@ -165,6 +165,10 @@ pub fn save_state(rdp_state: *mut u8) { unsafe { rdp_save_state(rdp_state) } } +pub fn idle() { + unsafe { rdp_idle() } +} + pub fn load_state(device: &mut device::Device, rdp_state: *const u8) { let gfx_info = build_gfx_info(device); unsafe {