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
This commit is contained in:
Luke Street 2022-06-02 01:52:58 -04:00
parent 80eb125631
commit d47d5661c6
3 changed files with 9 additions and 31 deletions

View File

@ -312,8 +312,6 @@
"macos-default-relwithdebinfo" "macos-default-relwithdebinfo"
], ],
"cacheVariables": { "cacheVariables": {
"CMAKE_C_COMPILER_LAUNCHER": "buildcache",
"CMAKE_CXX_COMPILER_LAUNCHER": "buildcache",
"CMAKE_OSX_ARCHITECTURES": "arm64;x86_64", "CMAKE_OSX_ARCHITECTURES": "arm64;x86_64",
"IMGUI_USE_FREETYPE": { "IMGUI_USE_FREETYPE": {
"type": "BOOL", "type": "BOOL",

View File

@ -343,6 +343,7 @@ public:
void onAppExiting() noexcept override { void onAppExiting() noexcept override {
m_imGuiConsole.Shutdown(); m_imGuiConsole.Shutdown();
if (m_voiceEngine) { if (m_voiceEngine) {
m_voiceEngine->unlockPump();
m_voiceEngine->stopPump(); m_voiceEngine->stopPump();
} }
if (g_mainMP1) { if (g_mainMP1) {
@ -488,6 +489,11 @@ public:
} // namespace metaforce } // namespace metaforce
static void SetupBasics(bool logging) { static void SetupBasics(bool logging) {
#if _WIN32
if (logging && GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == FILE_TYPE_UNKNOWN)
logvisor::CreateWin32Console();
#endif
auto result = zeus::validateCPU(); auto result = zeus::validateCPU();
if (!result.first) { if (!result.first) {
#if _WIN32 && !WINDOWS_STORE #if _WIN32 && !WINDOWS_STORE
@ -524,6 +530,7 @@ static bool IsClientLoggingEnabled(int argc, char** argv) {
#if !WINDOWS_STORE #if !WINDOWS_STORE
int main(int argc, char** argv) { int main(int argc, char** argv) {
// TODO: This seems to fix a lot of weird issues with rounding // TODO: This seems to fix a lot of weird issues with rounding
// but breaks animations, need to research why this is the case // but breaks animations, need to research why this is the case
// for now it's disabled // for now it's disabled
@ -564,30 +571,3 @@ int main(int argc, char** argv) {
return 0; return 0;
} }
#endif #endif
#if WINDOWS_STORE
#include "boo/UWPViewProvider.hpp"
using namespace Windows::ApplicationModel::Core;
[Platform::MTAThread] int WINAPIV main(Platform::Array<Platform::String ^> ^ 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 <shellapi.h>
#include <nowide/args.hpp>
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

View File

@ -153,11 +153,11 @@ set(DISCORD_RPC_LIBRARY "")
if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS) if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS)
set(DISCORD_RPC_LIBRARY "discord-rpc") set(DISCORD_RPC_LIBRARY "discord-rpc")
endif() 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 boo # TODO move audiodev
${DISCORD_RPC_LIBRARY} ${DISCORD_RPC_LIBRARY}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
SDL2main SDL2::SDL2-static SDL2::SDL2main
) )
add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A}) add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A})