Add cli flag for widescreen (#1152)

* Add cli flag for widescreen and enable config fallback

* Fix else statement brace spacing and trailing whitespace

* Fix trailing whitespace within args.widescreen else statement
This commit is contained in:
PolygonPrincess
2026-07-06 08:54:51 -04:00
committed by GitHub
parent f7ad6a4b0d
commit e8a7abffe3
3 changed files with 14 additions and 3 deletions
+9
View File
@@ -22,6 +22,8 @@ pub struct Args {
#[arg(short, long)] #[arg(short, long)]
pub fullscreen: bool, pub fullscreen: bool,
#[arg(long)] #[arg(long)]
pub widescreen: bool,
#[arg(long)]
pub overclock: Option<bool>, pub overclock: Option<bool>,
#[arg(long)] #[arg(long)]
pub disable_expansion_pak: Option<bool>, pub disable_expansion_pak: Option<bool>,
@@ -170,6 +172,13 @@ pub fn run(args: Args, arg_count: usize) -> std::io::Result<()> {
} else { } else {
device.ui.video.fullscreen = device.ui.config.video.fullscreen; device.ui.video.fullscreen = device.ui.config.video.fullscreen;
} }
if args.widescreen {
device.ui.video.widescreen = true;
} else {
device.ui.video.widescreen = device.ui.config.video.widescreen;
}
let overclock = args let overclock = args
.overclock .overclock
.unwrap_or(device.ui.config.emulation.overclock); .unwrap_or(device.ui.config.emulation.overclock);
+2
View File
@@ -68,6 +68,7 @@ pub struct Storage {
pub struct Video { pub struct Video {
pub window: *mut sdl3_sys::video::SDL_Window, pub window: *mut sdl3_sys::video::SDL_Window,
pub fullscreen: bool, pub fullscreen: bool,
pub widescreen: bool,
pub fps_tx: Option<tokio::sync::mpsc::UnboundedSender<bool>>, pub fps_tx: Option<tokio::sync::mpsc::UnboundedSender<bool>>,
pub fps_rx: Option<tokio::sync::mpsc::UnboundedReceiver<bool>>, pub fps_rx: Option<tokio::sync::mpsc::UnboundedReceiver<bool>>,
pub vis_tx: Option<tokio::sync::mpsc::UnboundedSender<bool>>, pub vis_tx: Option<tokio::sync::mpsc::UnboundedSender<bool>>,
@@ -267,6 +268,7 @@ impl Ui {
video: Video { video: Video {
window: std::ptr::null_mut(), window: std::ptr::null_mut(),
fullscreen: false, fullscreen: false,
widescreen: false,
fps_tx: Some(fps_tx), fps_tx: Some(fps_tx),
fps_rx: Some(fps_rx), fps_rx: Some(fps_rx),
vis_tx: Some(vis_tx), vis_tx: Some(vis_tx),
+3 -3
View File
@@ -20,8 +20,8 @@ fn build_gfx_info(device: &mut device::Device, netplay: bool) -> GFX_INFO {
DPC_END_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_END_REG], DPC_END_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_END_REG],
DPC_STATUS_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_STATUS_REG], DPC_STATUS_REG: &mut device.rdp.regs_dpc[device::rdp::DPC_STATUS_REG],
PAL: device.cart.pal, PAL: device.cart.pal,
widescreen: device.ui.config.video.widescreen,
fullscreen: device.ui.video.fullscreen, fullscreen: device.ui.video.fullscreen,
widescreen: device.ui.video.widescreen,
vsync: if !netplay { vsync: if !netplay {
device.ui.config.video.vsync device.ui.config.video.vsync
} else { } else {
@@ -56,14 +56,14 @@ pub fn init(device: &mut device::Device, netplay: bool) {
2 2
}; };
if device.cart.pal { if device.cart.pal {
window_width = if device.ui.config.video.widescreen { window_width = if device.ui.video.widescreen {
PAL_WIDESCREEN_WIDTH * scale PAL_WIDESCREEN_WIDTH * scale
} else { } else {
PAL_STANDARD_WIDTH * scale PAL_STANDARD_WIDTH * scale
}; };
window_height = PAL_HEIGHT * scale; window_height = PAL_HEIGHT * scale;
} else { } else {
window_width = if device.ui.config.video.widescreen { window_width = if device.ui.video.widescreen {
NTSC_WIDESCREEN_WIDTH * scale NTSC_WIDESCREEN_WIDTH * scale
} else { } else {
NTSC_STANDARD_WIDTH * scale NTSC_STANDARD_WIDTH * scale