mirror of
https://github.com/gopher64/gopher64.git
synced 2026-07-11 01:25:20 +02:00
use idle (#1039)
This commit is contained in:
@@ -206,6 +206,7 @@ fn main() {
|
|||||||
.allowlist_function("rdp_state_size")
|
.allowlist_function("rdp_state_size")
|
||||||
.allowlist_function("rdp_save_state")
|
.allowlist_function("rdp_save_state")
|
||||||
.allowlist_function("rdp_load_state")
|
.allowlist_function("rdp_load_state")
|
||||||
|
.allowlist_function("rdp_idle")
|
||||||
.allowlist_function("rdp_set_fps")
|
.allowlist_function("rdp_set_fps")
|
||||||
.allowlist_function("get_joystick_event")
|
.allowlist_function("get_joystick_event")
|
||||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||||
|
|||||||
@@ -298,6 +298,12 @@ JoystickEvent get_joystick_event() {
|
|||||||
return 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() {
|
static void rdp_new_processor() {
|
||||||
RDP::CommandProcessorFlags flags =
|
RDP::CommandProcessorFlags flags =
|
||||||
RDP::COMMAND_PROCESSOR_FLAG_HOST_VISIBLE_HIDDEN_RDRAM_BIT |
|
RDP::COMMAND_PROCESSOR_FLAG_HOST_VISIBLE_HIDDEN_RDRAM_BIT |
|
||||||
@@ -327,6 +333,9 @@ static void rdp_new_processor() {
|
|||||||
if (!g_hidden_rdram) {
|
if (!g_hidden_rdram) {
|
||||||
printf("Failed to get hidden_rdram\n");
|
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,
|
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();
|
achievement_progress_indicator_image = Vulkan::ImageHandle();
|
||||||
fps_image = Vulkan::ImageHandle();
|
fps_image = Vulkan::ImageHandle();
|
||||||
display_fps = false;
|
display_fps = false;
|
||||||
|
|
||||||
sync_signal = 0;
|
|
||||||
rdram_dirty.assign(gfx_info.RDRAM_SIZE >> 3, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rdp_close() {
|
void rdp_close() {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ void rdp_update_screen();
|
|||||||
void rdp_render_frame();
|
void rdp_render_frame();
|
||||||
CALL_BACK rdp_check_callback();
|
CALL_BACK rdp_check_callback();
|
||||||
uint64_t rdp_process_commands();
|
uint64_t rdp_process_commands();
|
||||||
|
void rdp_idle();
|
||||||
void rdp_onscreen_message(const char *message, MESSAGE_LENGTH milliseconds);
|
void rdp_onscreen_message(const char *message, MESSAGE_LENGTH milliseconds);
|
||||||
void rdp_check_framebuffers(uint32_t address, uint32_t length);
|
void rdp_check_framebuffers(uint32_t address, uint32_t length);
|
||||||
size_t rdp_state_size();
|
size_t rdp_state_size();
|
||||||
|
|||||||
+2
-2
@@ -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<i32>) {
|
pub fn create_savestate(device: &mut device::Device, rewind: bool, rewind_frame: Option<i32>) {
|
||||||
if !rewind {
|
if !rewind {
|
||||||
ui::video::check_framebuffers(0, device.rdram.size);
|
ui::video::idle();
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut rdp_state: Vec<u8> = vec![0; ui::video::state_size()];
|
let mut rdp_state: Vec<u8> = 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
|
&& device.rdram.size == state.device.rdram.size
|
||||||
{
|
{
|
||||||
if device.netplay.is_none() {
|
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;
|
device.savestate.last_rewind_saved = state.device.vi.elapsed_time;
|
||||||
|
|||||||
@@ -165,6 +165,10 @@ pub fn save_state(rdp_state: *mut u8) {
|
|||||||
unsafe { rdp_save_state(rdp_state) }
|
unsafe { rdp_save_state(rdp_state) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn idle() {
|
||||||
|
unsafe { rdp_idle() }
|
||||||
|
}
|
||||||
|
|
||||||
pub fn load_state(device: &mut device::Device, rdp_state: *const u8) {
|
pub fn load_state(device: &mut device::Device, rdp_state: *const u8) {
|
||||||
let gfx_info = build_gfx_info(device);
|
let gfx_info = build_gfx_info(device);
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|||||||
Reference in New Issue
Block a user