fix PAL aspect ratio (#241)

This commit is contained in:
Logan McNaughton
2025-02-12 09:19:39 +01:00
committed by GitHub
parent bda50f8d9d
commit b67268ff62
3 changed files with 14 additions and 4 deletions
+2 -2
View File
@@ -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);
+1
View File
@@ -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
+11 -2
View File
@@ -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);