diff --git a/parallel-rdp/interface.cpp b/parallel-rdp/interface.cpp index 5930ec2..f6bbd31 100644 --- a/parallel-rdp/interface.cpp +++ b/parallel-rdp/interface.cpp @@ -245,8 +245,8 @@ void rdp_close() static void calculate_viewport(float *x, float *y, float *width, float *height) { - const int32_t display_width = 320; - const int32_t display_height = 240; + const int32_t display_width = gfx_info.PAL ? 360 : 320; + const int32_t display_height = gfx_info.PAL ? 288 : 240; int w, h; SDL_GetWindowSize(window, &w, &h); diff --git a/parallel-rdp/interface.hpp b/parallel-rdp/interface.hpp index 7c8a51b..00fcd9c 100644 --- a/parallel-rdp/interface.hpp +++ b/parallel-rdp/interface.hpp @@ -16,6 +16,7 @@ extern "C" uint32_t *DPC_START_REG; uint32_t *DPC_END_REG; uint32_t *DPC_STATUS_REG; + bool PAL; } GFX_INFO; typedef struct diff --git a/src/ui/video.rs b/src/ui/video.rs index 067afd6..6138f3f 100644 --- a/src/ui/video.rs +++ b/src/ui/video.rs @@ -15,8 +15,15 @@ pub fn init(device: &mut device::Device) { flags |= sdl3_sys::video::SDL_WINDOW_RESIZABLE; } - device.ui.window = - unsafe { sdl3_sys::video::SDL_CreateWindow(title.as_ptr(), 640, 480, flags) }; + let mut window_width = 640; + let mut window_height = 480; + if device.cart.pal { + window_width = 720; + window_height = 576; + } + device.ui.window = unsafe { + sdl3_sys::video::SDL_CreateWindow(title.as_ptr(), window_width, window_height, flags) + }; if device.ui.window.is_null() { panic!("Could not create window"); } @@ -32,6 +39,7 @@ pub fn init(device: &mut device::Device) { DPC_START_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_START_REG as usize], DPC_END_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_END_REG as usize], DPC_STATUS_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_STATUS_REG as usize], + PAL: device.cart.pal, }; unsafe { @@ -66,6 +74,7 @@ pub fn load_state(device: &mut device::Device) { DPC_START_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_START_REG as usize], DPC_END_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_END_REG as usize], DPC_STATUS_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_STATUS_REG as usize], + PAL: device.cart.pal, }; unsafe { rdp_new_processor(gfx_info, device.ui.config.video.upscale);