diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e7310f5..2485243c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,7 @@ target_compile_options(hydra_warnings INTERFACE -Wno-vla-extension -Wno-gnu-case-range -Wno-gnu-zero-variadic-macro-arguments + -Wno-missing-designated-field-initializers ) include_directories(externals/metal-cpp externals/dynarmic externals/stb) diff --git a/externals/dynarmic b/externals/dynarmic index a41c3802..ef8380ae 160000 --- a/externals/dynarmic +++ b/externals/dynarmic @@ -1 +1 @@ -Subproject commit a41c380246d3d9f9874f0f792d234dc0cc17c180 +Subproject commit ef8380aef149fe39b2913c4a1678470db2eac1d4 diff --git a/externals/hatch b/externals/hatch index 4ec92a20..f009ffc1 160000 --- a/externals/hatch +++ b/externals/hatch @@ -1 +1 @@ -Subproject commit 4ec92a20f7df5b70679b69e0bdb2ac22ed1d754d +Subproject commit f009ffc14d17e2d07935028d0df6f18920e55219 diff --git a/src/common/filesystem.hpp b/src/common/filesystem.hpp index 99147a5e..431f25c1 100644 --- a/src/common/filesystem.hpp +++ b/src/common/filesystem.hpp @@ -2,7 +2,9 @@ #include +#ifdef PLATFORM_APPLE #include +#endif #include "common/log.hpp" #include "common/platform.hpp" diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 12cf65e9..cf348fad 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -599,38 +599,6 @@ add_library(hydra-core hw/tegra_x1/gpu/renderer/null/texture.hpp hw/tegra_x1/gpu/renderer/null/renderer.cpp hw/tegra_x1/gpu/renderer/null/renderer.hpp - hw/tegra_x1/gpu/renderer/metal/const.hpp - hw/tegra_x1/gpu/renderer/metal/maxwell_to_mtl.cpp - hw/tegra_x1/gpu/renderer/metal/maxwell_to_mtl.hpp - hw/tegra_x1/gpu/renderer/metal/impl.cpp - hw/tegra_x1/gpu/renderer/metal/command_buffer.cpp - hw/tegra_x1/gpu/renderer/metal/command_buffer.hpp - hw/tegra_x1/gpu/renderer/metal/surface_compositor.cpp - hw/tegra_x1/gpu/renderer/metal/surface_compositor.hpp - hw/tegra_x1/gpu/renderer/metal/buffer.cpp - hw/tegra_x1/gpu/renderer/metal/buffer.hpp - hw/tegra_x1/gpu/renderer/metal/texture.cpp - hw/tegra_x1/gpu/renderer/metal/texture.hpp - hw/tegra_x1/gpu/renderer/metal/texture_view.cpp - hw/tegra_x1/gpu/renderer/metal/texture_view.hpp - hw/tegra_x1/gpu/renderer/metal/sampler.cpp - hw/tegra_x1/gpu/renderer/metal/sampler.hpp - hw/tegra_x1/gpu/renderer/metal/render_pass.cpp - hw/tegra_x1/gpu/renderer/metal/render_pass.hpp - hw/tegra_x1/gpu/renderer/metal/shader.cpp - hw/tegra_x1/gpu/renderer/metal/shader.hpp - hw/tegra_x1/gpu/renderer/metal/pipeline.cpp - hw/tegra_x1/gpu/renderer/metal/pipeline.hpp - hw/tegra_x1/gpu/renderer/metal/depth_stencil_state_cache.cpp - hw/tegra_x1/gpu/renderer/metal/depth_stencil_state_cache.hpp - hw/tegra_x1/gpu/renderer/metal/blit_pipeline_cache.cpp - hw/tegra_x1/gpu/renderer/metal/blit_pipeline_cache.hpp - hw/tegra_x1/gpu/renderer/metal/clear_color_pipeline_cache.cpp - hw/tegra_x1/gpu/renderer/metal/clear_color_pipeline_cache.hpp - hw/tegra_x1/gpu/renderer/metal/clear_depth_pipeline_cache.cpp - hw/tegra_x1/gpu/renderer/metal/clear_depth_pipeline_cache.hpp - hw/tegra_x1/gpu/renderer/metal/renderer.cpp - hw/tegra_x1/gpu/renderer/metal/renderer.hpp input/const.hpp input/state.hpp input/device.hpp @@ -642,12 +610,6 @@ add_library(hydra-core input/device_list.hpp input/device_manager.cpp input/device_manager.hpp - input/apple_gc/keyboard.mm - input/apple_gc/keyboard.hpp - input/apple_gc/controller.mm - input/apple_gc/controller.hpp - input/apple_gc/device_list.mm - input/apple_gc/device_list.hpp # TODO: only build the debugger on debug builds debugger/const.hpp debugger/gdb_server.cpp @@ -663,6 +625,49 @@ add_library(hydra-core c_api.h ) +if (APPLE) + target_sources(hydra-core PRIVATE + hw/tegra_x1/gpu/renderer/metal/const.hpp + hw/tegra_x1/gpu/renderer/metal/maxwell_to_mtl.cpp + hw/tegra_x1/gpu/renderer/metal/maxwell_to_mtl.hpp + hw/tegra_x1/gpu/renderer/metal/impl.cpp + hw/tegra_x1/gpu/renderer/metal/command_buffer.cpp + hw/tegra_x1/gpu/renderer/metal/command_buffer.hpp + hw/tegra_x1/gpu/renderer/metal/surface_compositor.cpp + hw/tegra_x1/gpu/renderer/metal/surface_compositor.hpp + hw/tegra_x1/gpu/renderer/metal/buffer.cpp + hw/tegra_x1/gpu/renderer/metal/buffer.hpp + hw/tegra_x1/gpu/renderer/metal/texture.cpp + hw/tegra_x1/gpu/renderer/metal/texture.hpp + hw/tegra_x1/gpu/renderer/metal/texture_view.cpp + hw/tegra_x1/gpu/renderer/metal/texture_view.hpp + hw/tegra_x1/gpu/renderer/metal/sampler.cpp + hw/tegra_x1/gpu/renderer/metal/sampler.hpp + hw/tegra_x1/gpu/renderer/metal/render_pass.cpp + hw/tegra_x1/gpu/renderer/metal/render_pass.hpp + hw/tegra_x1/gpu/renderer/metal/shader.cpp + hw/tegra_x1/gpu/renderer/metal/shader.hpp + hw/tegra_x1/gpu/renderer/metal/pipeline.cpp + hw/tegra_x1/gpu/renderer/metal/pipeline.hpp + hw/tegra_x1/gpu/renderer/metal/depth_stencil_state_cache.cpp + hw/tegra_x1/gpu/renderer/metal/depth_stencil_state_cache.hpp + hw/tegra_x1/gpu/renderer/metal/blit_pipeline_cache.cpp + hw/tegra_x1/gpu/renderer/metal/blit_pipeline_cache.hpp + hw/tegra_x1/gpu/renderer/metal/clear_color_pipeline_cache.cpp + hw/tegra_x1/gpu/renderer/metal/clear_color_pipeline_cache.hpp + hw/tegra_x1/gpu/renderer/metal/clear_depth_pipeline_cache.cpp + hw/tegra_x1/gpu/renderer/metal/clear_depth_pipeline_cache.hpp + hw/tegra_x1/gpu/renderer/metal/renderer.cpp + hw/tegra_x1/gpu/renderer/metal/renderer.hpp + input/apple_gc/keyboard.mm + input/apple_gc/keyboard.hpp + input/apple_gc/controller.mm + input/apple_gc/controller.hpp + input/apple_gc/device_list.mm + input/apple_gc/device_list.hpp + ) +endif () + if (HYPERVISOR_ENABLED) target_sources(hydra-core PRIVATE hw/tegra_x1/cpu/hypervisor/const.hpp @@ -702,11 +707,17 @@ if (SDL_ENABLED) endif () target_include_directories(hydra-core PRIVATE ${CMAKE_SOURCE_DIR}/externals/libyaz0/include) -# TODO: only link Apple frameworks if Apple -target_link_libraries(hydra-core PRIVATE hydra_warnings "-framework Foundation" "-framework Metal" "-framework QuartzCore" "-framework GameController" dynarmic hatch libyaz0 nx2elf date::date date::date-tz hydra-common) +target_link_libraries(hydra-core PRIVATE hydra_warnings dynarmic hatch libyaz0 nx2elf date::date date::date-tz hydra-common) -if (HYPERVISOR_ENABLED) - target_link_libraries(hydra-core PRIVATE "-framework Hypervisor") +if (LINUX) + target_link_libraries(hydra-core PRIVATE atomic) +endif () + +if (APPLE) + target_link_libraries(hydra-core PRIVATE hydra_warnings "-framework Foundation" "-framework Metal" "-framework QuartzCore" "-framework GameController") + if (HYPERVISOR_ENABLED) + target_link_libraries(hydra-core PRIVATE "-framework Hypervisor") + endif () endif () if (CUBEB_ENABLED) diff --git a/src/core/debugger/gdb_server.cpp b/src/core/debugger/gdb_server.cpp index 2689c805..8e50ad08 100644 --- a/src/core/debugger/gdb_server.cpp +++ b/src/core/debugger/gdb_server.cpp @@ -3,6 +3,10 @@ #include #include #include +#ifdef PLATFORM_LINUX +#include +#include +#endif #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" diff --git a/src/core/horizon/display/binder.hpp b/src/core/horizon/display/binder.hpp index 866cd86c..9f16aeda 100644 --- a/src/core/horizon/display/binder.hpp +++ b/src/core/horizon/display/binder.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "core/horizon/kernel/kernel.hpp" #include "core/hw/tegra_x1/gpu/const.hpp" diff --git a/src/core/horizon/filesystem/disk_file.hpp b/src/core/horizon/filesystem/disk_file.hpp index 4679d9d5..1075685a 100644 --- a/src/core/horizon/filesystem/disk_file.hpp +++ b/src/core/horizon/filesystem/disk_file.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "core/horizon/filesystem/file.hpp" #define LOG_FS_ACCESS(host_path, f, ...) \ @@ -16,7 +18,7 @@ class DiskStream : public io::IostreamStream { // as a path DiskStream(const std::string_view path, std::ios::openmode flags) : io::IostreamStream(stream), stream(std::string(path), flags) { - LOG_FS_ACCESS(path, "file opened (flags: {})", flags); + LOG_FS_ACCESS(path, "file opened (flags: {})", static_cast(flags)); } ~DiskStream() override { stream.close(); diff --git a/src/core/horizon/filesystem/romfs/builder.cpp b/src/core/horizon/filesystem/romfs/builder.cpp index 24227bb4..dc580477 100644 --- a/src/core/horizon/filesystem/romfs/builder.cpp +++ b/src/core/horizon/filesystem/romfs/builder.cpp @@ -115,7 +115,7 @@ std::vector Builder::Build() { // Assign file offsets u32 entry_offset = 0; for (auto& file : files) { - data_size = align(data_size, 16ull); + data_size = align(data_size, 16ull); file->offset = data_size; data_size += file->size; file->entry_offset = entry_offset; @@ -166,7 +166,7 @@ std::vector Builder::Build() { Header header{}; header.header_size = sizeof(Header); header.data_offset = DATA_OFFSET; - header.directory_hash = {align(header.data_offset + data_size, 4ull), + header.directory_hash = {align(header.data_offset + data_size, 4ull), dir_hash_table_size}; header.directory_meta = {header.directory_hash.offset + header.directory_hash.size, diff --git a/src/core/horizon/kernel/thread.hpp b/src/core/horizon/kernel/thread.hpp index 7811d109..d5017326 100644 --- a/src/core/horizon/kernel/thread.hpp +++ b/src/core/horizon/kernel/thread.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "core/horizon/kernel/synchronization_object.hpp" namespace hydra::horizon::kernel { diff --git a/src/core/horizon/services/account/internal/user_manager.cpp b/src/core/horizon/services/account/internal/user_manager.cpp index 710e6997..26406c0d 100644 --- a/src/core/horizon/services/account/internal/user_manager.cpp +++ b/src/core/horizon/services/account/internal/user_manager.cpp @@ -92,7 +92,10 @@ uuid_t UserManager::CreateUser() { return user_id; } -void UserManager::LoadSystemAvatars(filesystem::Filesystem& fs) { +void UserManager::LoadSystemAvatars( + [[maybe_unused]] filesystem::Filesystem& fs) { +// TODO: other platforms +#ifdef PLATFORM_APPLE // Default avatar const auto default_image_path = get_bundle_resource_path("default_avatar_image.png"); @@ -135,6 +138,7 @@ void UserManager::LoadSystemAvatars(filesystem::Filesystem& fs) { avatars[fmt::format(SYSTEM_AVATARS_PATH "/{}", name)] = { static_cast(entry)}; } +#endif } const std::vector& UserManager::LoadAvatarImage(std::string_view path, diff --git a/src/core/horizon/services/audio/audio_renderer_manager.cpp b/src/core/horizon/services/audio/audio_renderer_manager.cpp index 3ea0f6fd..0e59aec0 100644 --- a/src/core/horizon/services/audio/audio_renderer_manager.cpp +++ b/src/core/horizon/services/audio/audio_renderer_manager.cpp @@ -49,7 +49,7 @@ IAudioRendererManager::GetWorkBufferSize(AudioRendererParameters params, edge_matrix_buffer_sz = node_count / 8; } buffer_sz += - align(node_state_buffer_sz + edge_matrix_buffer_sz, 0x10ull); + align(node_state_buffer_sz + edge_matrix_buffer_sz, 0x10ull); } buffer_sz += 0x20 * (params.effect_count + 4 * params.voice_count) + 0x50; @@ -59,7 +59,7 @@ IAudioRendererManager::GetWorkBufferSize(AudioRendererParameters params, buffer_sz += 0x20 * params.splitter_count; buffer_sz += align(4 * params._unknown_x2c, 0x10u); } - buffer_sz = align(buffer_sz, 0x40ull) + 0x170 * params.sink_count; + buffer_sz = align(buffer_sz, 0x40ull) + 0x170 * params.sink_count; u64 output_sz = buffer_sz + 0x280 * params.sink_count + 0x4B0 * params.effect_count + ((params.voice_count * 256) | 0x40); @@ -73,7 +73,7 @@ IAudioRendererManager::GetWorkBufferSize(AudioRendererParameters params, 0x40u) + output_sz; } - output_sz = align(output_sz + 0x1807e, 0x1000ull); + output_sz = align(output_sz + 0x1807e, 0x1000ull); *out_size = output_sz; LOG_INFO(Services, "Audio renderer work buffer size: 0x{:x}", *out_size); diff --git a/src/core/horizon/services/hid/internal/shared_memory.hpp b/src/core/horizon/services/hid/internal/shared_memory.hpp index be0d927b..832a6266 100644 --- a/src/core/horizon/services/hid/internal/shared_memory.hpp +++ b/src/core/horizon/services/hid/internal/shared_memory.hpp @@ -12,8 +12,8 @@ struct RingLifo { }; void Clear() { - atomic_store(&index, 0ull); - atomic_store(&count, 0ull); + atomic_store(&index, 0ull); + atomic_store(&count, 0ull); } T& GetCurrentStorage() { return GetCurrentAtomicStorage().data; } @@ -26,7 +26,7 @@ struct RingLifo { // TODO: why? // TODO: should be max_entries - 1 if (ReadCount() < 1) { - atomic_fetch_add(&count, 1ull); + atomic_fetch_add(&count, 1ull); } } @@ -68,7 +68,7 @@ struct RingLifo { AtomicStorage& GetCurrentAtomicStorage() { const auto count_ = - std::min(ReadCount(), 1ull); // TODO: why limit to 1? + std::min(ReadCount(), 1ull); // TODO: why limit to 1? if (count_ == 0) { throw Error::NoStorage; // TODO: what to do? } diff --git a/src/core/horizon/services/service.cpp b/src/core/horizon/services/service.cpp index e3164653..209e7682 100644 --- a/src/core/horizon/services/service.cpp +++ b/src/core/horizon/services/service.cpp @@ -86,7 +86,7 @@ void IService::HandleRequest(System& system, kernel::Process* caller_process, if (should_respond) { // HIPC header #define GET_ARRAY_SIZE(stream) \ - static_cast(align(streams.stream.GetSeek(), 4ull) / sizeof(u32)) + static_cast(align(streams.stream.GetSeek(), 4ull) / sizeof(u32)) #define WRITE_ARRAY(stream, ptr) \ if (ptr) { \ diff --git a/src/core/horizon/services/timesrv/internal/time_zone_manager.cpp b/src/core/horizon/services/timesrv/internal/time_zone_manager.cpp index 0496f661..dcd32527 100644 --- a/src/core/horizon/services/timesrv/internal/time_zone_manager.cpp +++ b/src/core/horizon/services/timesrv/internal/time_zone_manager.cpp @@ -92,6 +92,8 @@ void TimeZoneManager::LoadRule(std::string_view location_name, TimeZoneRule& out_rule) const { LOG_DEBUG(Services, "Location name: {}", location_name); + out_rule = {}; + // NCA filesystem::IFile* time_zone_archive_file; auto res = filesystem.GetFile(FS_FIRMWARE_PATH "/TimeZoneBinary", diff --git a/src/core/horizon/services/timesrv/time_zone_service.cpp b/src/core/horizon/services/timesrv/time_zone_service.cpp index 2ce4f859..eae85477 100644 --- a/src/core/horizon/services/timesrv/time_zone_service.cpp +++ b/src/core/horizon/services/timesrv/time_zone_service.cpp @@ -99,6 +99,9 @@ result_t ITimeZoneService::ToCalendarTimeImpl( // Get time zone name const char* tz_name = rule.chars + info.abbreviation_list_index; + if (tz_name == nullptr) { + tz_name = "UTC"; + } // Output out_time = { diff --git a/src/core/hw/tegra_x1/cpu/dynarmic/thread.cpp b/src/core/hw/tegra_x1/cpu/dynarmic/thread.cpp index e1061f50..349a22a0 100644 --- a/src/core/hw/tegra_x1/cpu/dynarmic/thread.cpp +++ b/src/core/hw/tegra_x1/cpu/dynarmic/thread.cpp @@ -1,7 +1,5 @@ #include "core/hw/tegra_x1/cpu/dynarmic/thread.hpp" -#include - #include #include "core/hw/tegra_x1/cpu/dynarmic/mmu.hpp" diff --git a/src/core/hw/tegra_x1/gpu/engines/3d.hpp b/src/core/hw/tegra_x1/gpu/engines/3d.hpp index 7049675d..0618647a 100644 --- a/src/core/hw/tegra_x1/gpu/engines/3d.hpp +++ b/src/core/hw/tegra_x1/gpu/engines/3d.hpp @@ -544,7 +544,7 @@ struct Regs3D { // 0xd00 u32 mme_scratch[0x80]; -} PACKED; +}; class ThreeD : public EngineWithRegsBase, public InlineBase { public: diff --git a/src/core/hw/tegra_x1/gpu/pfifo.hpp b/src/core/hw/tegra_x1/gpu/pfifo.hpp index 10d2167b..3dacea1c 100644 --- a/src/core/hw/tegra_x1/gpu/pfifo.hpp +++ b/src/core/hw/tegra_x1/gpu/pfifo.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "core/hw/tegra_x1/gpu/const.hpp" #include "core/hw/tegra_x1/gpu/gmmu.hpp" diff --git a/src/core/hw/tegra_x1/gpu/renderer/texture_cache.cpp b/src/core/hw/tegra_x1/gpu/renderer/texture_cache.cpp index a119e882..4d08c2ba 100644 --- a/src/core/hw/tegra_x1/gpu/renderer/texture_cache.cpp +++ b/src/core/hw/tegra_x1/gpu/renderer/texture_cache.cpp @@ -563,7 +563,7 @@ u32 TextureCache::GetDataHash(const ITexture* texture) { const auto& descriptor = texture->GetDescriptor(); u64 mem_range = descriptor.size; - u64 mem_step = std::max(mem_range / SAMPLE_COUNT, 1ull); + u64 mem_step = std::max(mem_range / SAMPLE_COUNT, 1ull); HashCode hash; for (u64 offset = 0; offset < mem_range; offset += mem_step) diff --git a/src/core/system.cpp b/src/core/system.cpp index 57515744..2ce41610 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -99,6 +99,8 @@ System::System(horizon::ui::IHandler& ui_handler_) System::~System() { // TODO: set this elsewhere LOGGER_INSTANCE.SetOutput(LogOutput::StdOut); + + ForceStop(); } void System::LoadAndStart(horizon::loader::LoaderBase* loader) { diff --git a/src/frontend/CMakeLists.txt b/src/frontend/CMakeLists.txt index 32cb09b6..cbcf863a 100644 --- a/src/frontend/CMakeLists.txt +++ b/src/frontend/CMakeLists.txt @@ -1,8 +1,10 @@ # TODO: set based on platform -set(NATIVE_SOURCE_FILES - native/cocoa/native.hpp - native/cocoa/native.mm -) +if (APPLE) + set(NATIVE_SOURCE_FILES + native/cocoa/native.hpp + native/cocoa/native.mm + ) +endif () if (FRONTEND STREQUAL "SDL3") message(STATUS "Using SDL3 frontend") @@ -20,7 +22,11 @@ if (FRONTEND STREQUAL "SDL3") sdl3/window.hpp ) - target_link_libraries(hydra PRIVATE hydra_warnings SDL3::SDL3 "-framework Cocoa") + target_link_libraries(hydra PRIVATE hydra_warnings SDL3::SDL3) + + if (APPLE) + target_link_libraries(hydra PRIVATE "-framework Cocoa") + endif () elseif (FRONTEND STREQUAL "SwiftUI") message(STATUS "Using SwiftUI frontend") diff --git a/src/frontend/sdl3/window.cpp b/src/frontend/sdl3/window.cpp index 4cb002c3..f04daa84 100644 --- a/src/frontend/sdl3/window.cpp +++ b/src/frontend/sdl3/window.cpp @@ -15,7 +15,9 @@ Context::~Context() { SDL_Quit(); } Window::Window(int argc, const char* argv[]) : system(*this) { // Window and renderer +#ifdef PLATFORM_APPLE SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal"); +#endif SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1"); if (!SDL_CreateWindowAndRenderer(APP_NAME, 1280, 720, SDL_WINDOW_RESIZABLE, @@ -72,7 +74,9 @@ void Window::Run() { break; } default: - cursor.Poll(e); + if (cursor != nullptr) { + cursor->Poll(e); + } break; } } @@ -113,20 +117,25 @@ void Window::ShowMessageDialog(const horizon::ui::MessageDialogType type, } horizon::applets::software_keyboard::SoftwareKeyboardResult -Window::ShowSoftwareKeyboard(const std::string& header_text, - const std::string& sub_text, - const std::string& guide_text, - std::string& out_text) { +Window::ShowSoftwareKeyboard([[maybe_unused]] const std::string& header_text, + [[maybe_unused]] const std::string& sub_text, + [[maybe_unused]] const std::string& guide_text, + [[maybe_unused]] std::string& out_text) { +#ifdef PLATFORM_APPLE return native.ShowInputTextDialog(header_text, sub_text, guide_text, out_text) ? horizon::applets::software_keyboard::SoftwareKeyboardResult::OK : horizon::applets::software_keyboard::SoftwareKeyboardResult:: Cancel; +#else + return horizon::applets::software_keyboard::SoftwareKeyboardResult::Cancel; +#endif } void Window::BeginEmulation(const std::string& path) { // Connect cursor as a touch screen device - system.GetInputDeviceManager().ConnectTouchScreenDevice("cursor", &cursor); + cursor = new Cursor{}; + system.GetInputDeviceManager().ConnectTouchScreenDevice("cursor", cursor); system.SetSurface(SDL_GetRenderMetalLayer(renderer)); // TODO: support loading applets from firmware diff --git a/src/frontend/sdl3/window.hpp b/src/frontend/sdl3/window.hpp index 211e2c20..3d2f4b19 100644 --- a/src/frontend/sdl3/window.hpp +++ b/src/frontend/sdl3/window.hpp @@ -4,9 +4,12 @@ #include "core/system.hpp" #include "frontend/sdl3/cursor.hpp" -// TODO: if macOS +#ifdef PLATFORM_APPLE #include "frontend/native/cocoa/native.hpp" using Native = hydra::frontend::native::cocoa::Native; +#else +using Native = std::monostate; +#endif namespace hydra::frontend::sdl3 { @@ -39,8 +42,8 @@ class Window : public horizon::ui::IHandler { SDL_Window* window; SDL_Renderer* renderer; - Native native; - Cursor cursor; + [[maybe_unused]] Native native; + Cursor* cursor{nullptr}; System system; u64 title_id;