From 72b4d5a7fc8bcff2e1df377afc4fbe7e64fd7b0d Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 8 Feb 2022 03:42:59 -0500 Subject: [PATCH] macOS fixes; call onAppWindowResized after launch --- CMakeLists.txt | 5 ++++- Graphics/src/lib.rs | 5 +++++ Runtime/CMain.cpp | 21 --------------------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 792620ff3..a8be72c1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,10 @@ if(DEFINED ENV{GITHUB_ENV}) endif() message(STATUS "Metaforce version set to ${METAFORCE_WC_DESCRIBE}") message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") -project(metaforce LANGUAGES C CXX ASM VERSION ${METAFORCE_VERSION_STRING}) +if(APPLE) + set(EXTRA_LANGUAGES OBJC) +endif() +project(metaforce LANGUAGES C CXX ASM ${EXTRA_LANGUAGES} VERSION ${METAFORCE_VERSION_STRING}) string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ATHENA_ARCH) string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ATHENA_HOST_ARCH) diff --git a/Graphics/src/lib.rs b/Graphics/src/lib.rs index b9e42f624..7e32385c0 100644 --- a/Graphics/src/lib.rs +++ b/Graphics/src/lib.rs @@ -266,9 +266,14 @@ fn app_run(mut delegate: cxx::UniquePtr, icon: ffi::Icon) { sdl_controller_sys: controller, sdl_open_controllers: Default::default(), }; + let window_size = WindowSize { + width: app.gpu.surface_config.width, + height: app.gpu.surface_config.height, + }; unsafe { APP.replace(app); ffi::App_onAppLaunched(delegate.as_mut().unwrap()); + ffi::App_onAppWindowResized(delegate.as_mut().unwrap_unchecked(), &window_size); }; let mut last_frame: Option = None; event_loop.run(move |event, _, control_flow| { diff --git a/Runtime/CMain.cpp b/Runtime/CMain.cpp index 8be2c5c54..aef94ae1f 100644 --- a/Runtime/CMain.cpp +++ b/Runtime/CMain.cpp @@ -285,14 +285,8 @@ public: m_voiceEngine->setVolume(0.7f); m_amuseAllocWrapper.emplace(*m_voiceEngine); -// hecl::ProjectPath projectPath; for (const auto& str : aurora::get_args()) { auto arg = static_cast(str); -// hecl::Sstat theStat; -// if (hecl::Stat((arg + "/out").c_str(), &theStat) == 0 && S_ISDIR(theStat.st_mode)) { -// hecl::ProjectRootPath rootPath(arg); -// hecl::Database::Project tmp(rootPath); // Force project creation -// } if (m_deferredProject.empty() && !arg.starts_with('-') && !arg.starts_with('+')) m_deferredProject = arg; if (arg == "--no-shader-warmup") @@ -300,16 +294,6 @@ public: else if (arg == "--no-sound") m_voiceEngine->setVolume(0.f); } - -// if (m_deferredProject.empty()) { -// /* Default behavior - search upwards for packaged project containing the program */ -// if (hecl::ProjectRootPath projRoot = hecl::SearchForProject(ExeDir)) { -// std::string rootPath(projRoot.getAbsolutePath()); -// hecl::Sstat theStat; -// if (hecl::Stat((rootPath + "/out/files/MP1/Metroid1.upak").c_str(), &theStat) == 0 && S_ISREG(theStat.st_mode)) -// m_deferredProject = rootPath + "/out"; -// } -// } } void initialize() { @@ -401,11 +385,6 @@ public: m_imGuiConsole.ShowAboutWindow(false, m_errorString); } -// { -// OPTICK_EVENT("Flush"); -// CGraphics::SetCommitResourcesAsLazy(false); -// } - return true; }