From d47d5661c60834d86037c5e43373c6c2b0d1db7c Mon Sep 17 00:00:00 2001 From: Luke Street Date: Thu, 2 Jun 2022 01:52:58 -0400 Subject: [PATCH] Various fixes - Unlock audio pump on exit - Remove WinMain from CMain (handled by SDL_main) - Use SDL2:: namespace in CMake - Disable buildcache on macOS CI for now --- CMakePresets.json | 2 -- Runtime/CMain.cpp | 34 +++++++--------------------------- Runtime/CMakeLists.txt | 4 ++-- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 66d5ad8a8..931e05007 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -312,8 +312,6 @@ "macos-default-relwithdebinfo" ], "cacheVariables": { - "CMAKE_C_COMPILER_LAUNCHER": "buildcache", - "CMAKE_CXX_COMPILER_LAUNCHER": "buildcache", "CMAKE_OSX_ARCHITECTURES": "arm64;x86_64", "IMGUI_USE_FREETYPE": { "type": "BOOL", diff --git a/Runtime/CMain.cpp b/Runtime/CMain.cpp index 2cd8e23c3..bd3c7ae12 100644 --- a/Runtime/CMain.cpp +++ b/Runtime/CMain.cpp @@ -343,6 +343,7 @@ public: void onAppExiting() noexcept override { m_imGuiConsole.Shutdown(); if (m_voiceEngine) { + m_voiceEngine->unlockPump(); m_voiceEngine->stopPump(); } if (g_mainMP1) { @@ -488,6 +489,11 @@ public: } // namespace metaforce static void SetupBasics(bool logging) { +#if _WIN32 + if (logging && GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == FILE_TYPE_UNKNOWN) + logvisor::CreateWin32Console(); +#endif + auto result = zeus::validateCPU(); if (!result.first) { #if _WIN32 && !WINDOWS_STORE @@ -524,6 +530,7 @@ static bool IsClientLoggingEnabled(int argc, char** argv) { #if !WINDOWS_STORE int main(int argc, char** argv) { + // TODO: This seems to fix a lot of weird issues with rounding // but breaks animations, need to research why this is the case // for now it's disabled @@ -564,30 +571,3 @@ int main(int argc, char** argv) { return 0; } #endif - -#if WINDOWS_STORE -#include "boo/UWPViewProvider.hpp" -using namespace Windows::ApplicationModel::Core; - -[Platform::MTAThread] int WINAPIV main(Platform::Array ^ params) { - SetupBasics(false); - metaforce::Application appCb; - auto viewProvider = ref new boo::ViewProvider(appCb, "metaforce", "Metaforce", "metaforce", params, false); - CoreApplication::Run(viewProvider); - return 0; -} - -#elif _WIN32 -#include -#include - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int) { - int argc = 0; - char** argv = nullptr; - nowide::args _(argc, argv); - const DWORD outType = GetFileType(GetStdHandle(STD_ERROR_HANDLE)); - if (IsClientLoggingEnabled(argc, argv) && outType == FILE_TYPE_UNKNOWN) - logvisor::CreateWin32Console(); - return main(argc, argv); -} -#endif diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 3419318c4..445bef2fd 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -153,11 +153,11 @@ set(DISCORD_RPC_LIBRARY "") if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS) set(DISCORD_RPC_LIBRARY "discord-rpc") endif() -set(RUNTIME_LIBRARIES amuse zeus nod NESEmulator libjpeg-turbo jbus kabufuda logvisor OptickCore imgui aurora SDL2-static +set(RUNTIME_LIBRARIES amuse zeus nod NESEmulator libjpeg-turbo jbus kabufuda logvisor OptickCore imgui aurora boo # TODO move audiodev ${DISCORD_RPC_LIBRARY} ${ZLIB_LIBRARIES} - SDL2main + SDL2::SDL2-static SDL2::SDL2main ) add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A})