Skip to content
Permalink
Browse files

Added vsync and exclusive window options (Zilmar plugin only)

  • Loading branch information...
ata4 committed Apr 22, 2019
1 parent 93c0ddd commit 422a7d80dae62c6c1fd5a20a932f129416c4e0b1
@@ -179,6 +179,8 @@ void n64video_config_defaults(struct n64video_config* config)
config->vi.mode = VI_MODE_NORMAL;
config->vi.widescreen = false;
config->vi.hide_overscan = false;
config->vi.exclusive = false;
config->vi.vsync = true;
}

void rdp_init_worker(uint32_t worker_id)
@@ -60,6 +60,8 @@ struct n64video_config
enum vi_interp interp;
bool widescreen;
bool hide_overscan;
bool vsync;
bool exclusive;
} vi;
bool parallel;
uint32_t num_workers;
@@ -23,6 +23,10 @@

#define CONFIG_FILE_NAME CORE_SIMPLE_NAME "-config.ini"

#define CONFIG_DLG_INIT_CHECKBOX(id, var, config) \
var = GetDlgItem(hwnd, id); \
SendMessage(var, BM_SETCHECK, (WPARAM)config, 0);

static HINSTANCE inst;
static struct n64video_config config;
static bool config_stale;
@@ -34,6 +38,8 @@ static HWND dlg_check_trace;
static HWND dlg_check_multithread;
static HWND dlg_check_vi_widescreen;
static HWND dlg_check_vi_overscan;
static HWND dlg_check_vi_exclusive;
static HWND dlg_check_vi_vsync;
static HWND dlg_spin_workers;
static HWND dlg_edit_workers;

@@ -87,14 +93,11 @@ INT_PTR CALLBACK config_dialog_proc(HWND hwnd, UINT iMessage, WPARAM wParam, LPA
dlg_combo_vi_interp = GetDlgItem(hwnd, IDC_COMBO_VI_INTERP);
config_dialog_fill_combo(dlg_combo_vi_interp, vi_interp_strings, VI_INTERP_NUM, config.vi.interp);

dlg_check_multithread = GetDlgItem(hwnd, IDC_CHECK_MULTITHREAD);
SendMessage(dlg_check_multithread, BM_SETCHECK, (WPARAM)config.parallel, 0);

dlg_check_vi_widescreen = GetDlgItem(hwnd, IDC_CHECK_VI_WIDESCREEN);
SendMessage(dlg_check_vi_widescreen, BM_SETCHECK, (WPARAM)config.vi.widescreen, 0);

dlg_check_vi_overscan = GetDlgItem(hwnd, IDC_CHECK_VI_OVERSCAN);
SendMessage(dlg_check_vi_overscan, BM_SETCHECK, (WPARAM)config.vi.hide_overscan, 0);
CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_MULTITHREAD, dlg_check_multithread, config.parallel);
CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_VI_WIDESCREEN, dlg_check_vi_widescreen, config.vi.widescreen);
CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_VI_OVERSCAN, dlg_check_vi_overscan, config.vi.hide_overscan);
CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_VI_EXCLUSIVE, dlg_check_vi_exclusive, config.vi.exclusive);
CONFIG_DLG_INIT_CHECKBOX(IDC_CHECK_VI_VSYNC, dlg_check_vi_vsync, config.vi.vsync);

dlg_edit_workers = GetDlgItem(hwnd, IDC_EDIT_WORKERS);
SetDlgItemInt(hwnd, IDC_EDIT_WORKERS, config.num_workers, FALSE);
@@ -133,6 +136,8 @@ INT_PTR CALLBACK config_dialog_proc(HWND hwnd, UINT iMessage, WPARAM wParam, LPA
config.vi.interp = SendMessage(dlg_combo_vi_interp, CB_GETCURSEL, 0, 0);
config.vi.widescreen = SendMessage(dlg_check_vi_widescreen, BM_GETCHECK, 0, 0);
config.vi.hide_overscan = SendMessage(dlg_check_vi_overscan, BM_GETCHECK, 0, 0);
config.vi.exclusive = SendMessage(dlg_check_vi_exclusive, BM_GETCHECK, 0, 0);
config.vi.vsync = SendMessage(dlg_check_vi_vsync, BM_GETCHECK, 0, 0);
config.parallel = SendMessage(dlg_check_multithread, BM_GETCHECK, 0, 0);
config.num_workers = GetDlgItemInt(hwnd, IDC_EDIT_WORKERS, FALSE, FALSE);
config_stale = true;
BIN +454 Bytes (110%) src/plugin/zilmar/config.rc
Binary file not shown.
BIN +276 Bytes (110%) src/plugin/zilmar/resource.h
Binary file not shown.
@@ -25,6 +25,9 @@ static HGLRC glrc;
static HGLRC glrc_core;
static bool fullscreen;

// config states
static bool exclusive;

// Win32 helpers
void win32_client_resize(HWND hWnd, HWND hStatus, int32_t nWidth, int32_t nHeight)
{
@@ -72,6 +75,8 @@ void* IntGetProcAddress(const char *name)

void screen_init(struct n64video_config* config)
{
exclusive = config->vi.exclusive;

// reset windowed size state
window_width = 0;
window_height = 0;
@@ -142,8 +147,10 @@ void screen_init(struct n64video_config* config)
msg_warning("Can't create OpenGL 3.3 core context.");
}

// enable vsync
wglSwapIntervalEXT(1);
if (config->vi.vsync) {
// enable vsync
wglSwapIntervalEXT(1);
}

gl_screen_init(config);
}
@@ -250,7 +257,11 @@ void screen_set_fullscreen(bool _fullscreen)
// disable all styles to get a borderless window and save it to restore
// it later
old_style = GetWindowLong(gfx.hWnd, GWL_STYLE);
SetWindowLong(gfx.hWnd, GWL_STYLE, WS_VISIBLE);
LONG style = WS_VISIBLE;
if (exclusive) {
style |= WS_POPUP;
}
SetWindowLong(gfx.hWnd, GWL_STYLE, style);

// resize window so it covers the entire virtual screen
SetWindowPos(gfx.hWnd, HWND_TOP, 0, 0, vs_width, vs_height, SWP_SHOWWINDOW);

0 comments on commit 422a7d8

Please sign in to comment.
You can’t perform that action at this time.