mirror of
https://github.com/gopher64/gopher64.git
synced 2026-07-11 01:25:20 +02:00
add vsync option (#776)
This commit is contained in:
@@ -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 = {};
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user