add vsync option (#776)

This commit is contained in:
Logan McNaughton
2026-04-19 10:25:36 -06:00
committed by GitHub
parent 805bcba249
commit 73d895a64a
8 changed files with 33 additions and 12 deletions
+5 -6
View File
@@ -265,8 +265,7 @@ static ImageHandle create_message_image(Vulkan::Device &device, int width,
}
void rdp_init(void *_window, GFX_INFO _gfx_info, const void *font,
size_t font_size, uint32_t save_state_slot,
bool netplay_enabled) {
size_t font_size, uint32_t save_state_slot) {
memset(&rdp_device, 0, sizeof(RDP_DEVICE));
window = (SDL_Window *)_window;
@@ -291,12 +290,12 @@ void rdp_init(void *_window, GFX_INFO _gfx_info, const void *font,
wsi_platform = new SDL_WSIPlatform;
wsi_platform->set_window(window);
wsi->set_platform(wsi_platform);
if (netplay_enabled) {
// VK_PRESENT_MODE_MAILBOX_KHR, fallback to VK_PRESENT_MODE_IMMEDIATE_KHR
wsi->set_present_mode(PresentMode::UnlockedMaybeTear);
} else {
if (gfx_info.vsync) {
// VK_PRESENT_MODE_MAILBOX_KHR, fallback to VK_PRESENT_MODE_FIFO_KHR
wsi->set_present_mode(PresentMode::UnlockedNoTearing);
} else {
// VK_PRESENT_MODE_MAILBOX_KHR, fallback to VK_PRESENT_MODE_IMMEDIATE_KHR
wsi->set_present_mode(PresentMode::UnlockedMaybeTear);
}
wsi->set_backbuffer_srgb(false);
Context::SystemHandles handles = {};
+2 -1
View File
@@ -18,6 +18,7 @@ typedef struct {
bool PAL;
bool widescreen;
bool fullscreen;
bool vsync;
bool integer_scaling;
uint32_t upscale;
bool crt;
@@ -37,7 +38,7 @@ typedef struct {
} CALL_BACK;
void rdp_init(void *_window, GFX_INFO _gfx_info, const void *font,
size_t font_size, uint32_t save_state_slot, bool netplay_enabled);
size_t font_size, uint32_t save_state_slot);
void rdp_close();
void rdp_set_vi_register(uint32_t reg, uint32_t value);
void rdp_update_screen();
+2
View File
@@ -50,6 +50,7 @@ pub struct Video {
pub integer_scaling: bool,
pub fullscreen: bool,
pub widescreen: bool,
pub vsync: bool,
pub crt: bool,
}
@@ -151,6 +152,7 @@ impl Config {
integer_scaling: false,
fullscreen: false,
widescreen: false,
vsync: true,
crt: false,
},
emulation: Emulation {
+2
View File
@@ -92,6 +92,7 @@ fn settings_window(app: &AppWindow, config: &ui::config::Config) {
app.set_integer_scaling(config.video.integer_scaling);
app.set_fullscreen(config.video.fullscreen);
app.set_widescreen(config.video.widescreen);
app.set_vsync(config.video.vsync);
app.set_apply_crt_shader(config.video.crt);
app.set_overclock_n64_cpu(config.emulation.overclock);
app.set_disable_expansion_pak(config.emulation.disable_expansion_pak);
@@ -296,6 +297,7 @@ pub fn save_settings(app: &AppWindow, controller_paths: &[Option<String>]) {
config.video.integer_scaling = app.get_integer_scaling();
config.video.fullscreen = app.get_fullscreen();
config.video.widescreen = app.get_widescreen();
config.video.vsync = app.get_vsync();
config.video.crt = app.get_apply_crt_shader();
config.emulation.overclock = app.get_overclock_n64_cpu();
config.emulation.disable_expansion_pak = app.get_disable_expansion_pak();
+1
View File
@@ -54,6 +54,7 @@ export component AppWindow inherits Window {
in-out property integer_scaling <=> SettingsData.integer_scaling;
in-out property fullscreen <=> SettingsData.fullscreen;
in-out property widescreen <=> SettingsData.widescreen;
in-out property vsync <=> SettingsData.vsync;
in-out property apply_crt_shader <=> SettingsData.apply_crt_shader;
in-out property overclock_n64_cpu <=> SettingsData.overclock_n64_cpu;
in-out property disable_expansion_pak <=> SettingsData.disable_expansion_pak;
+4 -4
View File
@@ -26,7 +26,7 @@ export component RetroAchievements inherits Page {
VerticalBox {
alignment: start;
HorizontalBox {
alignment: center;
alignment: start;
CheckBox {
text: @tr("Enabled");
checked: RAData.enabled;
@@ -44,7 +44,7 @@ export component RetroAchievements inherits Page {
}
}
HorizontalBox {
alignment: center;
alignment: start;
CheckBox {
text: @tr("Hardcore mode");
checked: RAData.hardcore;
@@ -56,7 +56,7 @@ export component RetroAchievements inherits Page {
}
}
HorizontalBox {
alignment: center;
alignment: start;
CheckBox {
text: @tr("Challenge Indicators");
checked: RAData.challenge;
@@ -68,7 +68,7 @@ export component RetroAchievements inherits Page {
}
}
HorizontalBox {
alignment: center;
alignment: start;
CheckBox {
text: @tr("Leaderboard Trackers");
checked: RAData.leaderboard;
+12
View File
@@ -8,6 +8,7 @@ export global SettingsData {
in-out property <bool> integer_scaling;
in-out property <bool> fullscreen;
in-out property <bool> widescreen;
in-out property <bool> vsync;
in-out property <bool> apply_crt_shader;
in-out property <bool> overclock_n64_cpu;
in-out property <bool> disable_expansion_pak;
@@ -70,6 +71,17 @@ export component Settings inherits Page {
}
}
HorizontalBox {
alignment: start;
CheckBox {
text: @tr("VSync");
checked: SettingsData.vsync;
toggled => {
SettingsData.vsync = self.checked;
}
}
}
HorizontalBox {
alignment: start;
CheckBox {
+5 -1
View File
@@ -21,6 +21,11 @@ fn build_gfx_info(device: &mut device::Device) -> GFX_INFO {
PAL: device.cart.pal,
widescreen: device.ui.config.video.widescreen,
fullscreen: device.ui.video.fullscreen,
vsync: if device.netplay.is_none() {
device.ui.config.video.vsync
} else {
false
},
integer_scaling: device.ui.config.video.integer_scaling,
upscale: device.ui.config.video.upscale,
crt: device.ui.config.video.crt,
@@ -99,7 +104,6 @@ pub fn init(device: &mut device::Device) {
font_bytes.as_ptr() as *const std::ffi::c_void,
font_bytes.len(),
device.ui.storage.save_state_slot,
device.netplay.is_some(),
)
}