x86 msvc build fix. Build 32bit SDL. Force renderer type at startup

This commit is contained in:
flyinghead 2021-03-01 12:49:41 +01:00
parent 72a61786f4
commit 8259b8ba02
4 changed files with 18 additions and 21 deletions

View File

@ -127,11 +127,15 @@ if(WIN32)
execute_process(COMMAND git apply -p1 ${CMAKE_CURRENT_SOURCE_DIR}/core/deps/patches/SDL.patch
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/core/deps/SDL)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/core/deps/SDL")
if(MSVC)
set(SDL_CMAKE_ARCH_ARG -A ${CMAKE_GENERATOR_PLATFORM})
endif()
execute_process(COMMAND ${CMAKE_COMMAND}
"-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/core/deps/SDL"
-DLIBC=ON
-DBUILD_SHARED_LIBS=OFF
-G "${CMAKE_GENERATOR}"
$<$<BOOL:MSVC>:-A ${CMAKE_GENERATOR_PLATFORM}>
${SDL_CMAKE_ARCH_ARG}
"${CMAKE_CURRENT_SOURCE_DIR}/core/deps/SDL"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/core/deps/SDL")
execute_process(COMMAND ${CMAKE_COMMAND} --build "${CMAKE_CURRENT_BINARY_DIR}/core/deps/SDL" --config Release --target install)
@ -142,7 +146,7 @@ if(MINGW)
endif()
if(NOT ANDROID)
find_package(SDL2 QUIET HINTS "${CMAKE_CURRENT_BINARY_DIR}/core/deps/SDL")
find_package(SDL2 HINTS "${CMAKE_CURRENT_BINARY_DIR}/core/deps/SDL")
endif()
if(SDL2_FOUND)
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_SDL USE_SDL_AUDIO)

View File

@ -405,6 +405,9 @@ int reicast_init(int argc, char* argv[])
LogManager::Init();
config::Settings::instance().load(false);
}
// Force the renderer type now since we're not switching
if (renderer_changed != -1)
config::RendererType = (RenderType)renderer_changed;
os_CreateWindow();
os_SetupInput();

View File

@ -716,7 +716,7 @@ bool VulkanContext::Init()
VkSurfaceKHR surface;
if (SDL_Vulkan_CreateSurface((SDL_Window *)window, (VkInstance)*instance, &surface) == 0)
return false;
this->surface.reset(surface);
this->surface.reset(vk::SurfaceKHR(surface));
#elif defined(_WIN32)
vk::Win32SurfaceCreateInfoKHR createInfo(vk::Win32SurfaceCreateFlagsKHR(), GetModuleHandle(NULL), (HWND)window);
surface = instance->createWin32SurfaceKHRUnique(createInfo);
@ -935,7 +935,7 @@ void VulkanContext::Term()
#ifndef USE_SDL
surface.reset();
#else
::vkDestroySurfaceKHR(*instance, surface.release(), nullptr);
::vkDestroySurfaceKHR((VkInstance)*instance, (VkSurfaceKHR)surface.release(), nullptr);
#endif
pipelineCache.reset();
device.reset();

View File

@ -735,27 +735,17 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
#else
SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)&ExeptionHandler);
#endif
#ifndef __GNUC__
__try
if (reicast_init(argc, argv) != 0)
die("Flycast initialization failed");
#ifdef _WIN64
setup_seh();
#endif
{
if (reicast_init(argc, argv) != 0)
die("Flycast initialization failed");
#ifdef _WIN64
setup_seh();
#endif
mainui_loop();
mainui_loop();
dc_term();
dc_term();
}
#ifndef __GNUC__
__except( ExeptionHandler(GetExceptionInformation()) )
{
ERROR_LOG(COMMON, "Unhandled exception - UI thread halted...");
}
#endif
SetUnhandledExceptionFilter(0);
#ifdef USE_SDL
sdl_window_destroy();