win32: Wire imgui up to OpenGL and Vulkan.

This commit is contained in:
BearOso 2023-05-04 17:36:36 -05:00
parent 03ac459bb1
commit bad8cfc209
10 changed files with 128 additions and 12 deletions

View File

@ -1790,8 +1790,7 @@ static void VariableDisplayChar(int x, int y, uint8 c, bool monospace = false, i
} }
} }
static void S9xVariableDisplayString(const char* string, int linesFromBottom, void S9xVariableDisplayString(const char* string, int linesFromBottom, int pixelsFromLeft, bool allowWrap, int type)
int pixelsFromLeft, bool allowWrap, int type)
{ {
bool monospace = true; bool monospace = true;
if (type == S9X_NO_INFO) if (type == S9X_NO_INFO)

1
gfx.h
View File

@ -221,5 +221,6 @@ void S9xSyncSpeed (void);
// called instead of S9xDisplayString if set to non-NULL // called instead of S9xDisplayString if set to non-NULL
extern void (*S9xCustomDisplayString) (const char *, int, int, bool, int type); extern void (*S9xCustomDisplayString) (const char *, int, int, bool, int type);
void S9xVariableDisplayString(const char* string, int linesFromBottom, int pixelsFromLeft, bool allowWrap, int type);
#endif #endif

View File

@ -15,6 +15,8 @@
#include "../filter/hq2x.h" #include "../filter/hq2x.h"
#include "../filter/2xsai.h" #include "../filter/2xsai.h"
#include "snes9x_imgui.h"
#include "imgui_impl_opengl3.h"
COpenGL::COpenGL(void) COpenGL::COpenGL(void)
{ {
@ -133,6 +135,16 @@ bool COpenGL::Initialize(HWND hWnd)
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
SwapBuffers(hDC); SwapBuffers(hDC);
if (ogl_GetMajorVersion() >= 3 && !Settings.AutoDisplayMessages)
{
auto defaults = S9xImGuiGetDefaults();
defaults.font_size = GUI.OSDSize;
defaults.spacing = defaults.font_size / 2.4;
S9xImGuiInit(&defaults);
ImGui_ImplOpenGL3_Init();
Settings.DisplayIndicators = true;
}
initDone = true; initDone = true;
return true; return true;
} }
@ -140,6 +152,11 @@ bool COpenGL::Initialize(HWND hWnd)
void COpenGL::DeInitialize() void COpenGL::DeInitialize()
{ {
initDone = false; initDone = false;
if (S9xImGuiRunning())
{
ImGui_ImplOpenGL3_Shutdown();
S9xImGuiDeinit();
}
SetShaders(NULL); SetShaders(NULL);
DestroyDrawSurface(); DestroyDrawSurface();
wglMakeCurrent(NULL,NULL); wglMakeCurrent(NULL,NULL);
@ -366,6 +383,16 @@ void COpenGL::Render(SSurface Src)
glFlush(); glFlush();
if (S9xImGuiRunning())
{
ImGui_ImplOpenGL3_NewFrame();
if (S9xImGuiDraw(windowSize.right, windowSize.bottom))
{
auto* draw_data = ImGui::GetDrawData();
ImGui_ImplOpenGL3_RenderDrawData(draw_data);
}
}
WinThrottleFramerate(); WinThrottleFramerate();
SwapBuffers(hDC); SwapBuffers(hDC);

View File

@ -6,6 +6,52 @@
#include "../filter/hq2x.h" #include "../filter/hq2x.h"
#include "../filter/2xsai.h" #include "../filter/2xsai.h"
#include "snes9x_imgui.h"
#include "imgui_impl_vulkan.h"
bool CVulkan::InitImGui()
{
auto defaults = S9xImGuiGetDefaults();
defaults.font_size = GUI.OSDSize;
defaults.spacing = defaults.font_size / 2.4;
S9xImGuiInit(&defaults);
ImGui_ImplVulkan_LoadFunctions([](const char* function, void* instance) {
return VULKAN_HPP_DEFAULT_DISPATCHER.vkGetInstanceProcAddr(*((VkInstance*)instance), function);
}, &context->instance.get());
vk::DescriptorPoolSize pool_sizes[] =
{
{ vk::DescriptorType::eCombinedImageSampler, 1000 },
{ vk::DescriptorType::eUniformBuffer, 1000 }
};
auto descriptor_pool_create_info = vk::DescriptorPoolCreateInfo{}
.setPoolSizes(pool_sizes)
.setMaxSets(1000)
.setFlags(vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet);
imgui_descriptor_pool = context->device.createDescriptorPoolUnique(descriptor_pool_create_info);
ImGui_ImplVulkan_InitInfo init_info{};
init_info.Instance = context->instance.get();
init_info.PhysicalDevice = context->physical_device;
init_info.Device = context->device;;
init_info.QueueFamily = context->graphics_queue_family_index;
init_info.Queue = context->queue;
init_info.DescriptorPool = imgui_descriptor_pool.get();
init_info.Subpass = 0;
init_info.MinImageCount = context->swapchain->get_num_frames();
init_info.ImageCount = context->swapchain->get_num_frames();
init_info.MSAASamples = VK_SAMPLE_COUNT_1_BIT;
ImGui_ImplVulkan_Init(&init_info, context->swapchain->get_render_pass());
auto cmd = context->begin_cmd_buffer();
ImGui_ImplVulkan_CreateFontsTexture(cmd);
context->end_cmd_buffer();
context->wait_idle();
return true;
}
bool CVulkan::Initialize(HWND hWnd) bool CVulkan::Initialize(HWND hWnd)
{ {
this->hWnd = hWnd; this->hWnd = hWnd;
@ -24,6 +70,12 @@ bool CVulkan::Initialize(HWND hWnd)
return false; return false;
} }
if (!Settings.AutoDisplayMessages)
{
Settings.DisplayIndicators = true;
InitImGui();
}
if (GUI.shaderEnabled && GUI.OGLshaderFileName && GUI.OGLshaderFileName[0]) if (GUI.shaderEnabled && GUI.OGLshaderFileName && GUI.OGLshaderFileName[0])
{ {
shaderchain = std::make_unique<Vulkan::ShaderChain>(context.get()); shaderchain = std::make_unique<Vulkan::ShaderChain>(context.get());
@ -49,7 +101,15 @@ void CVulkan::DeInitialize()
current_shadername = ""; current_shadername = "";
if (context) if (context)
{
context->wait_idle(); context->wait_idle();
if (ImGui::GetCurrentContext())
{
imgui_descriptor_pool.reset();
ImGui_ImplVulkan_Shutdown();
ImGui::DestroyContext();
}
}
shaderchain.reset(); shaderchain.reset();
simple_output.reset(); simple_output.reset();
filtered_image.clear(); filtered_image.clear();
@ -81,6 +141,15 @@ void CVulkan::Render(SSurface Src)
bool result; bool result;
if (S9xImGuiDraw(windowSize.right, windowSize.bottom))
{
ImDrawData* draw_data = ImGui::GetDrawData();
context->swapchain->on_render_pass_end([&, draw_data] {
ImGui_ImplVulkan_RenderDrawData(draw_data, context->swapchain->get_cmd());
});
}
if (shaderchain) if (shaderchain)
{ {
result = shaderchain->do_frame_without_swap(Dst.Surface, Dst.Width, Dst.Height, Dst.Pitch, vk::Format::eR5G6B5UnormPack16, displayRect.left, displayRect.top, displayRect.right - displayRect.left, displayRect.bottom - displayRect.top); result = shaderchain->do_frame_without_swap(Dst.Surface, Dst.Width, Dst.Height, Dst.Pitch, vk::Format::eR5G6B5UnormPack16, displayRect.left, displayRect.top, displayRect.right - displayRect.left, displayRect.bottom - displayRect.top);

View File

@ -16,11 +16,14 @@ class CVulkan : public IS9xDisplayOutput
std::string current_shadername; std::string current_shadername;
std::unique_ptr<Vulkan::SimpleOutput> simple_output; std::unique_ptr<Vulkan::SimpleOutput> simple_output;
vk::UniqueDescriptorPool imgui_descriptor_pool;
int current_width; int current_width;
int current_height; int current_height;
public: public:
bool Initialize(HWND hWnd) override; bool InitImGui();
bool Initialize(HWND hWnd) override;
void DeInitialize() override; void DeInitialize() override;
void Render(SSurface Src) override; void Render(SSurface Src) override;
bool ChangeRenderSize(unsigned int newWidth, unsigned int newHeight) override; bool ChangeRenderSize(unsigned int newWidth, unsigned int newHeight) override;

View File

@ -117,7 +117,7 @@
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include;$(ProjectDir)..\external\imgui</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment> <StructMemberAlignment>Default</StructMemberAlignment>
@ -168,7 +168,7 @@
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include;$(ProjectDir)..\external\imgui</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment> <StructMemberAlignment>Default</StructMemberAlignment>
@ -224,7 +224,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include;$(ProjectDir)..\external\imgui</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -279,7 +279,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include;$(ProjectDir)..\external\imgui</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>

View File

@ -826,7 +826,7 @@ void InitSnes9x( void)
// generate_offsets_h (0, NULL); // generate_offsets_h (0, NULL);
// fclose (offsets_h); // fclose (offsets_h);
//#endif //#endif
S9xCustomDisplayString = S9xWinDisplayString;
Memory.Init(); Memory.Init();
extern void S9xPostRomInit(); extern void S9xPostRomInit();

View File

@ -888,3 +888,12 @@ void ConvertDepth (SSurface *src, SSurface *dst, RECT *srect)
} }
/* Depth conversion functions end */ /* Depth conversion functions end */
#include "snes9x_imgui.h"
void S9xWinDisplayString(const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap, int type)
{
if (S9xImGuiRunning() && !Settings.AutoDisplayMessages)
{
return;
}
S9xVariableDisplayString(string, linesFromBottom, pixelsFromLeft, allowWrap, type);
}

View File

@ -36,6 +36,7 @@ void ConvertDepth (SSurface *src, SSurface *dst, RECT *srect);
char *ReadShaderFileContents(const TCHAR *filename); char *ReadShaderFileContents(const TCHAR *filename);
void ReduceToPath(TCHAR *filename); void ReduceToPath(TCHAR *filename);
double WinGetRefreshRate(); double WinGetRefreshRate();
void S9xWinDisplayString(const char*, int, int, bool, int);
int WinGetAutomaticInputRate(); int WinGetAutomaticInputRate();
void WinThrottleFramerate(); void WinThrottleFramerate();
std::vector<ShaderParam> *WinGetShaderParameters(); std::vector<ShaderParam> *WinGetShaderParameters();

View File

@ -7922,12 +7922,22 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
Settings.Transparency = IsDlgButtonChecked(hDlg, IDC_TRANS); Settings.Transparency = IsDlgButtonChecked(hDlg, IDC_TRANS);
Settings.BilinearFilter = (bool)(IsDlgButtonChecked(hDlg,IDC_BILINEAR)==BST_CHECKED); Settings.BilinearFilter = (bool)(IsDlgButtonChecked(hDlg,IDC_BILINEAR)==BST_CHECKED);
Settings.ShowOverscan = IsDlgButtonChecked(hDlg, IDC_HEIGHT_EXTEND)!=0; Settings.ShowOverscan = IsDlgButtonChecked(hDlg, IDC_HEIGHT_EXTEND)!=0;
Settings.AutoDisplayMessages = IsDlgButtonChecked(hDlg, IDC_MESSAGES_IN_IMAGE);
GUI.DoubleBuffered = (bool)(IsDlgButtonChecked(hDlg, IDC_DBLBUFFER)==BST_CHECKED); GUI.DoubleBuffered = (bool)(IsDlgButtonChecked(hDlg, IDC_DBLBUFFER)==BST_CHECKED);
GUI.ReduceInputLag = (bool)(IsDlgButtonChecked(hDlg, IDC_REDUCEINPUTLAG) == BST_CHECKED); GUI.ReduceInputLag = (bool)(IsDlgButtonChecked(hDlg, IDC_REDUCEINPUTLAG) == BST_CHECKED);
GUI.Vsync = (bool)(IsDlgButtonChecked(hDlg, IDC_VSYNC GUI.Vsync = (bool)(IsDlgButtonChecked(hDlg, IDC_VSYNC
)==BST_CHECKED); )==BST_CHECKED);
{
int newOSDSize = SendDlgItemMessage(hDlg, IDC_SPIN_OSD_SIZE, UDM_GETPOS, 0, 0);
bool need_reset = (Settings.AutoDisplayMessages != prevAutoDisplayMessages || newOSDSize != GUI.OSDSize);
GUI.OSDSize = newOSDSize;
if (need_reset)
{
WinDisplayReset();
WinRefreshDisplay();
UpdateWindow(GUI.hWnd);
}
}
if(IsDlgButtonChecked(hDlg, IDC_AUTOFRAME)) if(IsDlgButtonChecked(hDlg, IDC_AUTOFRAME))
{ {
Settings.SkipFrames=AUTO_FRAMERATE; Settings.SkipFrames=AUTO_FRAMERATE;
@ -7983,11 +7993,8 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
ToggleFullScreen(); ToggleFullScreen();
} }
return false; return false;
case IDCANCEL: case IDCANCEL:
SelectOutputMethodInVideoDropdown(hDlg, prevOutputMethod); SelectOutputMethodInVideoDropdown(hDlg, prevOutputMethod);
SendMessage(hDlg,WM_COMMAND,MAKEWPARAM(IDC_OUTPUTMETHOD,CBN_SELCHANGE),0); SendMessage(hDlg,WM_COMMAND,MAKEWPARAM(IDC_OUTPUTMETHOD,CBN_SELCHANGE),0);