iOS and tvOS support

This commit is contained in:
Luke Street 2022-05-27 15:52:16 -04:00
parent fe65258d91
commit 4048492279
38 changed files with 1549 additions and 158 deletions

View File

@ -46,7 +46,7 @@ jobs:
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
sudo apt-get -y install ninja-build clang lld libcurl4-openssl-dev intel-oneapi-ipp-devel \
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev qt5-default libfreetype-dev \
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev libfreetype-dev \
libxinerama-dev libxcursor-dev python3-markupsafe libgtk-3-dev
yarn global add @sentry/cli
@ -90,7 +90,6 @@ jobs:
runs-on: macos-11
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.192
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
@ -104,14 +103,8 @@ jobs:
run: |
brew update
brew upgrade --formula
brew install ninja graphicsmagick imagemagick
yarn global add create-dmg
pip3 install markupsafe==2.0.1
# universal qt5 from macports
curl -LSfs https://axiodl.com/files/qt-$Qt_VERSION.mpkg -o /tmp/qt-$Qt_VERSION.mpkg
sudo installer -pkg /tmp/qt-$Qt_VERSION.mpkg -target /
echo /opt/local/libexec/qt5/bin >> $GITHUB_PATH
brew install ninja
pip3 install markupsafe
# setup buildcache
curl -LSfs https://github.com/encounter/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip
@ -145,6 +138,52 @@ jobs:
- name: Print buildcache stats
run: buildcache -s
build-ios:
name: Build iOS
runs-on: macos-11
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
brew update
brew upgrade --formula
brew install ninja
pip3 install markupsafe
- name: Configure CMake
run: cmake --preset ios-default
- name: Build
run: cmake --build --preset ios-default
build-tvos:
name: Build tvOS
runs-on: macos-11
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
brew update
brew upgrade --formula
brew install ninja
pip3 install markupsafe
- name: Configure CMake
run: cmake --preset tvos-default
- name: Build
run: cmake --build --preset tvos-default
build-windows:
name: Build Windows (${{matrix.name}} x86_64)
runs-on: windows-2019
@ -192,7 +231,7 @@ jobs:
- name: Install dependencies
run: |
choco install ninja vulkan-sdk
pip install markupsafe==2.0.1
pip install markupsafe
# set up buildcache
$TempDir = "$env:RUNNER_WORKSPACE\temp"

View File

@ -50,7 +50,7 @@ endif ()
if (METAFORCE_WC_DESCRIBE)
string(REGEX REPLACE "v([0-9]+)\.([0-9]+)\.([0-9]+)\-([0-9]+).*" "\\1.\\2.\\3.\\4" METAFORCE_VERSION_STRING "${METAFORCE_WC_DESCRIBE}")
string(REGEX REPLACE "v([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1.\\2.\\3" METAFORCE_VERSION_STRING "${METAFORCE_VERSION_STRING}")
string(REGEX REPLACE "v([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1.\\2.\\3" METAFORCE_SHORT_VERSION_STRING "${METAFORCE_WC_DESCRIBE}")
else ()
set(METAFORCE_WC_DESCRIBE "UNKNOWN-VERSION")
set(METAFORCE_VERSION_STRING "0.0.0")
@ -68,19 +68,29 @@ if(APPLE)
set(EXTRA_LANGUAGES OBJC)
endif()
project(metaforce LANGUAGES C CXX ASM ${EXTRA_LANGUAGES} VERSION ${METAFORCE_VERSION_STRING})
if (APPLE AND NOT TVOS AND CMAKE_SYSTEM_NAME STREQUAL tvOS)
# ios.toolchain.cmake hack for SDL
set(TVOS ON)
set(IOS OFF)
endif ()
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ATHENA_ARCH)
string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ATHENA_HOST_ARCH)
string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" HOST_PLATFORM_NAME)
string(TOLOWER "${CMAKE_SYSTEM_NAME}" PLATFORM_NAME)
set(ATHENA_EXTENSION "tar.gz")
if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(PLATFORM_NAME macos)
if (CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
set(HOST_PLATFORM_NAME macos)
set(ATHENA_ARCH universal)
set(ATHENA_HOST_ARCH universal)
elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
set(HOST_PLATFORM_NAME win32)
set(ATHENA_EXTENSION ".7z")
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(PLATFORM_NAME macos)
elseif (CMAKE_SYSTEM_NAME STREQUAL Windows)
set(PLATFORM_NAME win32)
set(ATHENA_EXTENSION ".7z")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(PLATFORM_NAME linux)
endif ()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)

View File

@ -219,6 +219,52 @@
"macos-default"
]
},
{
"name": "ios-default",
"displayName": "iOS",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "ios.toolchain.cmake",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install",
"PLATFORM": "OS64",
"DEPLOYMENT_TARGET": "13.0",
"ENABLE_BITCODE": {
"type": "BOOL",
"value": false
}
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [
"macOS"
]
}
}
},
{
"name": "tvos-default",
"displayName": "tvOS",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "ios.toolchain.cmake",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install",
"PLATFORM": "TVOS",
"DEPLOYMENT_TARGET": "14.5",
"ENABLE_BITCODE": {
"type": "BOOL",
"value": false
}
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [
"macOS"
]
}
}
},
{
"name": "x-linux-ci",
"hidden": true,
@ -260,7 +306,11 @@
"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": {
"type": "BOOL",
"value": false
}
}
},
{
@ -345,6 +395,24 @@
"description": "macOS release build with debug info",
"displayName": "macOS RelWithDebInfo"
},
{
"name": "ios-default",
"configurePreset": "ios-default",
"description": "iOS release build with debug info",
"displayName": "iOS RelWithDebInfo",
"targets": [
"metaforce"
]
},
{
"name": "tvos-default",
"configurePreset": "tvos-default",
"description": "tvOS release build with debug info",
"displayName": "tvOS RelWithDebInfo",
"targets": [
"metaforce"
]
},
{
"name": "windows-msvc-debug",
"configurePreset": "windows-msvc-debug",

View File

@ -28,6 +28,7 @@
//#include <fenv.h>
//#pragma STDC FENV_ACCESS ON
#include <SDL_main.h>
#include <aurora/aurora.hpp>
using namespace std::literals;
@ -183,6 +184,9 @@ public:
m_voiceEngine->setVolume(0.7f);
m_amuseAllocWrapper.emplace(*m_voiceEngine);
#if TARGET_OS_IOS || TARGET_OS_TV
m_deferredProject = std::string{m_fileMgr.getStoreRoot()} + "game.iso";
#else
for (const auto& str : aurora::get_args()) {
auto arg = static_cast<std::string>(str);
if (m_deferredProject.empty() && !arg.starts_with('-') && !arg.starts_with('+'))
@ -190,6 +194,7 @@ public:
else if (arg == "--no-sound")
m_voiceEngine->setVolume(0.f);
}
#endif
}
void initialize() {
@ -210,14 +215,6 @@ public:
/* Ping the watchdog to let it know we're still alive */
CInfiniteLoopDetector::UpdateWatchDog(std::chrono::system_clock::now());
#endif
if (auto* input = g_InputGenerator) {
if (!m_deferredControllers.empty()) {
for (const auto which : m_deferredControllers) {
//input->controllerAdded(which);
}
m_deferredControllers.clear();
}
}
if (!m_projectInitialized && !m_deferredProject.empty()) {
if (CDvdFile::Initialize(m_deferredProject)) {
@ -327,31 +324,13 @@ public:
void onAppDisplayScaleChanged(float scale) noexcept override { ImGuiEngine_Initialize(scale); }
void onControllerButton(uint32_t idx, aurora::ControllerButton button, bool pressed) noexcept override {
if (auto* input = g_InputGenerator) {
//input->controllerButton(idx, button, pressed);
}
}
void onControllerButton(uint32_t idx, aurora::ControllerButton button, bool pressed) noexcept override {}
void onControllerAxis(uint32_t idx, aurora::ControllerAxis axis, int16_t value) noexcept override {
if (auto* input = g_InputGenerator) {
//input->controllerAxis(idx, axis, value);
}
}
void onControllerAxis(uint32_t idx, aurora::ControllerAxis axis, int16_t value) noexcept override {}
void onControllerAdded(uint32_t which) noexcept override {
if (auto* input = g_InputGenerator) {
//input->controllerAdded(which);
} else {
m_deferredControllers.emplace_back(which);
}
}
void onControllerAdded(uint32_t which) noexcept override { m_imGuiConsole.ControllerAdded(which); }
void onControllerRemoved(uint32_t which) noexcept override {
if (auto* input = g_InputGenerator) {
//input->controllerRemoved(which);
}
}
void onControllerRemoved(uint32_t which) noexcept override { m_imGuiConsole.ControllerRemoved(which); }
void onAppExiting() noexcept override {
m_imGuiConsole.Shutdown();
@ -570,7 +549,7 @@ int main(int argc, char** argv) {
.width = icon.width,
.height = icon.height,
};
aurora::app_run(std::move(app), std::move(data), argc, argv);
aurora::app_run(std::move(app), std::move(data), argc, argv, fileMgr.getStoreRoot());
return 0;
}
#endif

View File

@ -149,9 +149,15 @@ function(add_runtime_common_library name)
endfunction()
set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
set(RUNTIME_LIBRARIES amuse zeus nod NESEmulator libjpeg-turbo jbus kabufuda discord-rpc logvisor OptickCore imgui aurora SDL2-static
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
boo # TODO move audiodev
${DISCORD_RPC_LIBRARY}
${ZLIB_LIBRARIES}
SDL2main
)
add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A})
@ -229,6 +235,44 @@ if (TARGET nativefiledialog)
endif()
target_compile_definitions(metaforce PUBLIC "-DMETAFORCE_TARGET_BYTE_ORDER=__BYTE_ORDER__")
if (APPLE)
if (TVOS)
set(RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platforms/tvos)
set(INFO_PLIST ${RESOURCE_DIR}/Info.plist.in)
file(GLOB_RECURSE RESOURCE_FILES "${RESOURCE_DIR}/Base.lproj/*")
list(APPEND RESOURCE_FILES ${RESOURCE_DIR}/Assets.car)
elseif (IOS)
set(RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios)
set(INFO_PLIST ${RESOURCE_DIR}/Info.plist.in)
message("Using INFO_PLIST ${INFO_PLIST}")
file(GLOB_RECURSE RESOURCE_FILES "${RESOURCE_DIR}/Base.lproj/*")
list(APPEND RESOURCE_FILES
${RESOURCE_DIR}/Assets.car
${RESOURCE_DIR}/AppIcon60x60@2x.png
${RESOURCE_DIR}/AppIcon76x76@2x~ipad.png)
else ()
set(RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/platforms/macos)
set(INFO_PLIST ${RESOURCE_DIR}/Info.plist.in)
set(RESOURCE_FILES ${RESOURCE_DIR}/mainicon.icns)
endif ()
target_sources(metaforce PRIVATE ${INFO_PLIST} ${RESOURCE_FILES})
# Add to resources, preserving directory structure
foreach (FILE ${RESOURCE_FILES})
file(RELATIVE_PATH NEW_FILE "${RESOURCE_DIR}" ${FILE})
get_filename_component(NEW_FILE_PATH ${NEW_FILE} DIRECTORY)
set_property(SOURCE ${FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${NEW_FILE_PATH}")
source_group("Resources/${NEW_FILE_PATH}" FILES "${FILE}")
endforeach ()
set_target_properties(
metaforce PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${INFO_PLIST}
MACOSX_BUNDLE_BUNDLE_NAME Metaforce
MACOSX_BUNDLE_GUI_IDENTIFIER dev.test.metaforce
MACOSX_BUNDLE_BUNDLE_VERSION "${METAFORCE_VERSION_STRING}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${METAFORCE_SHORT_VERSION_STRING}"
)
endif ()
if (WINDOWS_STORE)
set_property(TARGET metaforce PROPERTY VS_WINRT_COMPONENT TRUE)
# This should match the Package.appxmanifest

View File

@ -516,36 +516,36 @@ void CMoviePlayer::DrawFrame(const zeus::CVector3f& v1, const zeus::CVector3f& v
CGraphics::SetUseVideoFilter(xf4_26_fieldFlip);
/* Correct movie aspect ratio */
// float hPad, vPad;
// if (CGraphics::GetViewportAspect() >= 1.78f) {
// hPad = 1.78f / CGraphics::GetViewportAspect();
// vPad = 1.78f / 1.33f;
// } else {
// hPad = 1.f;
// vPad = CGraphics::GetViewportAspect() / 1.33f;
// }
//
// /* draw appropriate field */
// CTHPTextureSet& tex = x80_textures[xd0_drawTexSlot];
// aurora::gfx::queue_movie_player(tex.Y[m_deinterlace ? (xfc_fieldIndex != 0) : 0], tex.U, tex.V, hPad, vPad);
float hPad, vPad;
if (CGraphics::GetViewportAspect() >= 1.78f) {
hPad = 1.78f / CGraphics::GetViewportAspect();
vPad = 1.78f / 1.33f;
} else {
hPad = 1.f;
vPad = CGraphics::GetViewportAspect() / 1.33f;
}
MyTHPGXYuv2RgbSetup(CGraphics::g_LastFrameUsedAbove, xf4_26_fieldFlip);
uintptr_t planeSize = x6c_videoInfo.width * x6c_videoInfo.height;
uintptr_t planeSizeQuarter = planeSize / 4;
MyTHPYuv2RgbTextureSetup(m_yuvBuf.get(), m_yuvBuf.get() + planeSize, m_yuvBuf.get() + planeSize + planeSizeQuarter,
x6c_videoInfo.width, x6c_videoInfo.height);
/* draw appropriate field */
CTHPTextureSet& tex = x80_textures[xd0_drawTexSlot];
aurora::gfx::queue_movie_player(tex.Y[m_deinterlace ? (xfc_fieldIndex != 0) : 0], tex.U, tex.V, hPad, vPad);
CGX::Begin(GX::TRIANGLEFAN, GX::VTXFMT7, 4);
GXPosition3f32(v1);
GXTexCoord2f32(0.f, 0.f);
GXPosition3f32(v3);
GXTexCoord2f32(0.f, 1.f);
GXPosition3f32(v4);
GXTexCoord2f32(1.f, 1.f);
GXPosition3f32(v2);
GXTexCoord2f32(1.f, 0.f);
CGX::End();
MyTHPGXRestore();
// MyTHPGXYuv2RgbSetup(CGraphics::g_LastFrameUsedAbove, xf4_26_fieldFlip);
// uintptr_t planeSize = x6c_videoInfo.width * x6c_videoInfo.height;
// uintptr_t planeSizeQuarter = planeSize / 4;
// MyTHPYuv2RgbTextureSetup(m_yuvBuf.get(), m_yuvBuf.get() + planeSize, m_yuvBuf.get() + planeSize + planeSizeQuarter,
// x6c_videoInfo.width, x6c_videoInfo.height);
//
// CGX::Begin(GX::TRIANGLEFAN, GX::VTXFMT7, 4);
// GXPosition3f32(v1);
// GXTexCoord2f32(0.f, 0.f);
// GXPosition3f32(v3);
// GXTexCoord2f32(0.f, 1.f);
// GXPosition3f32(v4);
// GXTexCoord2f32(1.f, 1.f);
// GXPosition3f32(v2);
// GXTexCoord2f32(1.f, 0.f);
// CGX::End();
// MyTHPGXRestore();
/* ensure second field is being displayed by VI to signal advance
* (faked in metaforce with continuous xor) */
@ -655,29 +655,29 @@ void CMoviePlayer::DecodeFromRead(const void* data) {
tjDecompressToYUV(TjHandle, (u8*)inptr, frameHeader.imageSize, m_yuvBuf.get(), 0);
inptr += frameHeader.imageSize;
// uintptr_t planeSize = x6c_videoInfo.width * x6c_videoInfo.height;
// uintptr_t planeSizeHalf = planeSize / 2;
// uintptr_t planeSizeQuarter = planeSizeHalf / 2;
uintptr_t planeSize = x6c_videoInfo.width * x6c_videoInfo.height;
uintptr_t planeSizeHalf = planeSize / 2;
uintptr_t planeSizeQuarter = planeSizeHalf / 2;
// if (m_deinterlace) {
// /* Deinterlace into 2 discrete 60-fps half-res textures */
// auto buffer = std::make_unique<u8[]>(planeSizeHalf);
// for (unsigned y = 0; y < x6c_videoInfo.height / 2; ++y) {
// memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2),
// x6c_videoInfo.width);
// }
// aurora::gfx::write_texture(*tex.Y[0], {buffer.get(), planeSizeHalf});
// for (unsigned y = 0; y < x6c_videoInfo.height / 2; ++y) {
// memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2 + 1),
// x6c_videoInfo.width);
// }
// aurora::gfx::write_texture(*tex.Y[1], {buffer.get(), planeSizeHalf});
// } else {
// /* Direct planar load */
// aurora::gfx::write_texture(*tex.Y[0], {m_yuvBuf.get(), planeSize});
// }
// aurora::gfx::write_texture(*tex.U, {m_yuvBuf.get() + planeSize, planeSizeQuarter});
// aurora::gfx::write_texture(*tex.V, {m_yuvBuf.get() + planeSize + planeSizeQuarter, planeSizeQuarter});
if (m_deinterlace) {
/* Deinterlace into 2 discrete 60-fps half-res textures */
auto buffer = std::make_unique<u8[]>(planeSizeHalf);
for (unsigned y = 0; y < x6c_videoInfo.height / 2; ++y) {
memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2),
x6c_videoInfo.width);
}
aurora::gfx::write_texture(*tex.Y[0], {buffer.get(), planeSizeHalf});
for (unsigned y = 0; y < x6c_videoInfo.height / 2; ++y) {
memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2 + 1),
x6c_videoInfo.width);
}
aurora::gfx::write_texture(*tex.Y[1], {buffer.get(), planeSizeHalf});
} else {
/* Direct planar load */
aurora::gfx::write_texture(*tex.Y[0], {m_yuvBuf.get(), planeSize});
}
aurora::gfx::write_texture(*tex.U, {m_yuvBuf.get() + planeSize, planeSizeQuarter});
aurora::gfx::write_texture(*tex.V, {m_yuvBuf.get() + planeSize + planeSizeQuarter, planeSizeQuarter});
break;
}

View File

@ -688,7 +688,7 @@ std::optional<std::string> ImGuiConsole::ShowAboutWindow(bool canClose, std::str
ImGuiStringViewText("Contributions");
ImGui::PopStyleColor();
ImGuiStringViewText("Darkszero (Profiling)");
ImGuiStringViewText("shio (Flamethrower)");
ImGuiStringViewText("shio (Weapons)");
ImGui::EndGroup();
ImGui::Dummy(padding);
ImGui::Separator();
@ -1233,6 +1233,9 @@ void ImGuiConsole::PreUpdate() {
m_cvarCommons.m_debugOverlayShowInput->addListener([this](CVar* c) { m_showInput = c->toBoolean(); });
m_cvarMgr.findCVar("developer")->addListener([this](CVar* c) { m_developer = c->toBoolean(); });
m_cvarMgr.findCVar("cheats")->addListener([this](CVar* c) { m_cheats = c->toBoolean(); });
if (m_developer) {
m_toasts.emplace_back("Press ` to toggle menu"s, 5.f);
}
}
// We ned to make sure we have a valid CRandom16 at all times, so lets do that here
if (g_StateManager != nullptr && g_StateManager->GetActiveRandom() == nullptr) {
@ -1257,9 +1260,8 @@ void ImGuiConsole::PreUpdate() {
bool canInspect = g_StateManager != nullptr && g_StateManager->GetObjectList();
if (m_isVisible) {
ShowAppMainMenuBar(canInspect);
} else if (m_developer) {
ShowMenuHint();
}
ShowToasts();
if (canInspect && (m_showInspectWindow || !inspectingEntities.empty())) {
UpdateEntityEntries();
if (m_showInspectWindow) {
@ -1612,11 +1614,14 @@ void ImGuiConsole::ShowLayersWindow() {
ImGui::End();
}
void ImGuiConsole::ShowMenuHint() {
if (m_menuHintTime <= 0.f) {
void ImGuiConsole::ShowToasts() {
if (m_toasts.empty()) {
return;
}
m_menuHintTime -= ImGui::GetIO().DeltaTime;
auto& toast = m_toasts.front();
const float dt = ImGui::GetIO().DeltaTime;
toast.remain -= dt;
toast.current += dt;
const ImGuiViewport* viewport = ImGui::GetMainViewport();
const ImVec2 workPos = viewport->WorkPos;
@ -1625,7 +1630,7 @@ void ImGuiConsole::ShowMenuHint() {
const ImVec2 windowPos{workPos.x + workSize.x / 2, workPos.y + workSize.y - padding};
ImGui::SetNextWindowPos(windowPos, ImGuiCond_Always, ImVec2{0.5f, 1.f});
const float alpha = std::min(m_menuHintTime, 1.f);
const float alpha = std::min({toast.remain, toast.current, 1.f});
ImGui::SetNextWindowBgAlpha(alpha * 0.65f);
ImVec4 textColor = ImGui::GetStyleColorVec4(ImGuiCol_Text);
textColor.w *= alpha;
@ -1633,14 +1638,18 @@ void ImGuiConsole::ShowMenuHint() {
borderColor.w *= alpha;
ImGui::PushStyleColor(ImGuiCol_Text, textColor);
ImGui::PushStyleColor(ImGuiCol_Border, borderColor);
if (ImGui::Begin("Menu Hint", nullptr,
if (ImGui::Begin("Toast", nullptr,
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav |
ImGuiWindowFlags_NoMove)) {
ImGuiStringViewText("Press ` to toggle menu"sv);
ImGuiStringViewText(toast.message);
}
ImGui::End();
ImGui::PopStyleColor(2);
if (toast.remain <= 0.f) {
m_toasts.pop_front();
}
}
void ImGuiConsole::ShowPlayerTransformEditor() {
@ -1727,7 +1736,7 @@ void ImGuiConsole::ShowPipelineProgress() {
ImGui::SetNextWindowBgAlpha(0.65f);
ImGui::Begin("Pipelines", nullptr,
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoSavedSettings);
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing);
const auto percent = static_cast<float>(createdPipelines) / static_cast<float>(totalPipelines);
const auto progressStr = fmt::format(FMT_STRING("Processing pipelines: {} / {}"), createdPipelines, totalPipelines);
const auto textSize = ImGui::CalcTextSize(progressStr.data(), progressStr.data() + progressStr.size());
@ -1737,4 +1746,17 @@ void ImGuiConsole::ShowPipelineProgress() {
ImGui::ProgressBar(percent);
ImGui::End();
}
void ImGuiConsole::ControllerAdded(uint32_t idx) {
const char* name = PADGetName(idx);
if (name != nullptr) {
m_toasts.emplace_back(fmt::format("Controller {} ({}) connected", idx, name), 5.f);
} else {
m_toasts.emplace_back(fmt::format("Controller {} connected", idx), 5.f);
}
}
void ImGuiConsole::ControllerRemoved(uint32_t idx) {
m_toasts.emplace_back(fmt::format("Controller {} disconnected", idx), 5.f);
}
} // namespace metaforce

View File

@ -14,6 +14,10 @@
#include <zeus/CEulerAngles.hpp>
#if __APPLE__
#include <TargetConditionals.h>
#endif
namespace metaforce {
void ImGuiStringViewText(std::string_view text);
void ImGuiTextCenter(std::string_view text);
@ -34,6 +38,13 @@ struct ImGuiEntityEntry {
[[nodiscard]] CActor* AsActor() const { return isActor ? static_cast<CActor*>(ent) : nullptr; }
};
struct Toast {
std::string message;
float remain;
float current = 0.f;
Toast(std::string message, float duration) noexcept : message(std::move(message)), remain(duration) {}
};
class ImGuiConsole {
public:
static std::set<TUniqueId> inspectingEntities;
@ -50,6 +61,9 @@ public:
static void BeginEntityRow(const ImGuiEntityEntry& entry);
static void EndEntityRow(const ImGuiEntityEntry& entry);
void ControllerAdded(uint32_t idx);
void ControllerRemoved(uint32_t idx);
private:
CVarManager& m_cvarMgr;
CVarCommons& m_cvarCommons;
@ -77,7 +91,11 @@ private:
// Debug overlays
bool m_frameCounter = m_cvarCommons.m_debugOverlayShowFrameCounter->toBoolean();
#if TARGET_OS_TV
bool m_frameRate = true;
#else
bool m_frameRate = m_cvarCommons.m_debugOverlayShowFramerate->toBoolean();
#endif
bool m_inGameTime = m_cvarCommons.m_debugOverlayShowInGameTime->toBoolean();
bool m_roomTimer = m_cvarCommons.m_debugOverlayShowRoomTimer->toBoolean();
bool m_playerInfo = m_cvarCommons.m_debugOverlayPlayerInfo->toBoolean();
@ -87,7 +105,11 @@ private:
bool m_randomStats = m_cvarCommons.m_debugOverlayShowRandomStats->toBoolean();
bool m_resourceStats = m_cvarCommons.m_debugOverlayShowResourceStats->toBoolean();
bool m_showInput = m_cvarCommons.m_debugOverlayShowInput->toBoolean();
#if TARGET_OS_IOS
bool m_pipelineInfo = false;
#else
bool m_pipelineInfo = true; // TODO cvar
#endif
bool m_developer = m_cvarMgr.findCVar("developer")->toBoolean();
bool m_cheats = m_cvarMgr.findCVar("cheats")->toBoolean();
bool m_isInitialized = false;
@ -97,7 +119,7 @@ private:
const void* m_currentRoom = nullptr;
double m_lastRoomTime = 0.f;
double m_currentRoomStart = 0.f;
float m_menuHintTime = 5.f;
std::deque<Toast> m_toasts;
std::string m_controllerName;
u32 m_whichController = -1;
@ -114,7 +136,7 @@ private:
void ShowItemsWindow();
void ShowLayersWindow();
void ShowConsoleVariablesWindow();
void ShowMenuHint();
void ShowToasts();
void ShowInputViewer();
void SetOverlayWindowLocation(int corner) const;
void ShowCornerContextMenu(int& corner, int avoidCorner) const;

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en-US</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleDisplayName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string>
</array>
<key>CFBundleIconName</key>
<string>AppIcon</string>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string>
<string>AppIcon76x76</string>
</array>
<key>CFBundleIconName</key>
<string>AppIcon</string>
</dict>
</dict>
<key>MinimumOSVersion</key>
<string>${DEPLOYMENT_TARGET}</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.adventure-games</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDarkContent</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
</dict>
</plist>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en-US</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>mainicon.icns</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleDisplayName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en-US</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleDisplayName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>AppleTVOS</string>
</array>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<string>App Icon</string>
</dict>
<key>MinimumOSVersion</key>
<string>${DEPLOYMENT_TARGET}</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.adventure-games</string>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIUserInterfaceStyle</key>
<string>Automatic</string>
</dict>
</plist>

View File

@ -19,19 +19,20 @@ target_include_directories(aurora PUBLIC include ../)
target_include_directories(aurora PRIVATE ../imgui ../extern/imgui)
target_link_libraries(aurora PRIVATE dawn_native dawncpp webgpu_dawn zeus logvisor SDL2-static xxhash
absl::btree absl::flat_hash_map)
if (APPLE)
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_METAL DAWN_ENABLE_BACKEND_VULKAN)
target_sources(aurora PRIVATE lib/dawn/MetalBinding.mm lib/dawn/VulkanBinding.cpp)
set_source_files_properties(lib/dawn/MetalBinding.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
elseif (WIN32)
target_compile_definitions(aurora PRIVATE
DAWN_ENABLE_BACKEND_D3D12
DAWN_ENABLE_BACKEND_VULKAN)
target_sources(aurora PRIVATE lib/dawn/D3D12Binding.cpp lib/dawn/VulkanBinding.cpp)
else ()
target_compile_definitions(aurora PRIVATE
DAWN_ENABLE_BACKEND_VULKAN
DAWN_ENABLE_BACKEND_OPENGL
DAWN_ENABLE_BACKEND_DESKTOP_GL)
target_sources(aurora PRIVATE lib/dawn/OpenGLBinding.cpp lib/dawn/VulkanBinding.cpp)
if (DAWN_ENABLE_VULKAN)
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_VULKAN)
target_sources(aurora PRIVATE lib/dawn/VulkanBinding.cpp)
endif ()
if (DAWN_ENABLE_METAL)
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_METAL)
target_sources(aurora PRIVATE lib/dawn/MetalBinding.mm)
set_source_files_properties(lib/dawn/MetalBinding.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
endif ()
if (DAWN_ENABLE_D3D12)
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_D3D12)
target_sources(aurora PRIVATE lib/dawn/D3D12Binding.cpp)
endif ()
if (DAWN_ENABLE_DESKTOP_GL)
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_OPENGL DAWN_ENABLE_BACKEND_DESKTOP_GL)
target_sources(aurora PRIVATE lib/dawn/OpenGLBinding.cpp)
endif ()

View File

@ -242,7 +242,7 @@ struct AppDelegate {
virtual void onControllerAxis(uint32_t which, ControllerAxis axis, int16_t value) noexcept = 0;
};
void app_run(std::unique_ptr<AppDelegate> app, Icon icon, int argc, char** argv) noexcept;
void app_run(std::unique_ptr<AppDelegate> app, Icon icon, int argc, char** argv, std::string_view configPath) noexcept;
[[nodiscard]] std::vector<std::string> get_args() noexcept;
[[nodiscard]] WindowSize get_window_size() noexcept;
void set_window_title(zstring_view title) noexcept;

View File

@ -16,6 +16,7 @@ static logvisor::Module Log("aurora");
// TODO: Move global state to a class/struct?
static std::unique_ptr<AppDelegate> g_AppDelegate;
static std::vector<std::string> g_Args;
std::string g_configPath;
// SDL
static SDL_Window* g_window;
@ -222,7 +223,12 @@ static bool poll_events() noexcept {
}
static SDL_Window* create_window(wgpu::BackendType type) {
Uint32 flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_RESIZABLE;
Uint32 flags = SDL_WINDOW_ALLOW_HIGHDPI;
#if TARGET_OS_IOS || TARGET_OS_TV
flags |= SDL_WINDOW_FULLSCREEN;
#else
flags |= SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE;
#endif
switch (type) {
#ifdef DAWN_ENABLE_BACKEND_VULKAN
case wgpu::BackendType::Vulkan:
@ -245,12 +251,13 @@ static SDL_Window* create_window(wgpu::BackendType type) {
return SDL_CreateWindow("Metaforce", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1280, 960, flags);
}
void app_run(std::unique_ptr<AppDelegate> app, Icon icon, int argc, char** argv) noexcept {
void app_run(std::unique_ptr<AppDelegate> app, Icon icon, int argc, char** argv, std::string_view configPath) noexcept {
g_AppDelegate = std::move(app);
/* Lets gather arguments skipping the program filename */
for (size_t i = 1; i < argc; ++i) {
g_Args.emplace_back(argv[i]);
}
g_configPath = configPath;
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
Log.report(logvisor::Fatal, FMT_STRING("Error initializing SDL: {}"), SDL_GetError());
@ -363,7 +370,11 @@ std::vector<std::string> get_args() noexcept { return g_Args; }
WindowSize get_window_size() noexcept {
int width, height, fb_w, fb_h;
SDL_GetWindowSize(g_window, &width, &height);
#if DAWN_ENABLE_BACKEND_METAL
SDL_Metal_GetDrawableSize(g_window, &fb_w, &fb_h);
#else
SDL_GL_GetDrawableSize(g_window, &fb_w, &fb_h);
#endif
float scale = static_cast<float>(fb_w) / static_cast<float>(width);
#ifndef __APPLE__
if (SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(g_window), nullptr, &scale, nullptr) == 0) {

View File

@ -8,9 +8,13 @@
#include <absl/container/flat_hash_map.h>
#include <condition_variable>
#include <deque>
#include <fstream>
#include <logvisor/logvisor.hpp>
#include <thread>
#include <fstream>
namespace aurora {
extern std::string g_configPath;
} // namespace aurora
namespace aurora::gfx {
static logvisor::Module Log("aurora::gfx");
@ -22,11 +26,11 @@ using gpu::g_queue;
std::vector<std::string> g_debugGroupStack;
#endif
constexpr uint64_t UniformBufferSize = 3145728; // 3mb
constexpr uint64_t VertexBufferSize = 3145728; // 3mb
constexpr uint64_t IndexBufferSize = 1048576; // 1mb
constexpr uint64_t StorageBufferSize = 8388608; // 8mb
constexpr uint64_t TextureUploadSize = 8388608; // 8mb
constexpr uint64_t UniformBufferSize = 3145728; // 3mb
constexpr uint64_t VertexBufferSize = 3145728; // 3mb
constexpr uint64_t IndexBufferSize = 1048576; // 1mb
constexpr uint64_t StorageBufferSize = 8388608; // 8mb
constexpr uint64_t TextureUploadSize = 25165824; // 24mb
constexpr uint64_t StagingBufferSize =
UniformBufferSize + VertexBufferSize + IndexBufferSize + StorageBufferSize + TextureUploadSize;
@ -346,7 +350,8 @@ void initialize() {
{
// Load serialized pipeline cache
std::ifstream file("pipeline_cache.bin", std::ios::in | std::ios::binary | std::ios::ate);
std::string path = g_configPath + "pipeline_cache.bin";
std::ifstream file(path, std::ios::in | std::ios::binary | std::ios::ate);
if (file) {
const size_t size = file.tellg();
file.seekg(0, std::ios::beg);
@ -415,7 +420,7 @@ void shutdown() {
{
// Write serialized pipelines to file
std::ofstream file("pipeline_cache.bin", std::ios::out | std::ios::trunc | std::ios::binary);
std::ofstream file(g_configPath + "pipeline_cache.bin", std::ios::out | std::ios::trunc | std::ios::binary);
if (file) {
file.write(reinterpret_cast<const char*>(&g_serializedPipelineCount), sizeof(g_serializedPipelineCount));
file.write(reinterpret_cast<const char*>(g_serializedPipelines.data()), g_serializedPipelines.size());

View File

@ -1346,14 +1346,13 @@ static std::pair<wgpu::FilterMode, wgpu::FilterMode> wgpu_filter_mode(GXTexFilte
}
}
static u16 wgpu_aniso(GXAnisotropy aniso) {
// TODO use config values?
switch (aniso) {
case GX_ANISO_1:
return 1;
case GX_ANISO_2:
return 2;
return std::max<u16>(g_graphicsConfig.textureAnisotropy / 2, 1);
case GX_ANISO_4:
return 4;
return std::max<u16>(g_graphicsConfig.textureAnisotropy, 1);
default:
Log.report(logvisor::Fatal, FMT_STRING("invalid aniso mode {}"), aniso);
unreachable();

View File

@ -6,7 +6,7 @@
#include <absl/container/flat_hash_map.h>
constexpr bool EnableNormalVisualization = false;
constexpr bool EnableDebugPrints = true;
constexpr bool EnableDebugPrints = false;
constexpr bool UsePerPixelLighting = true;
namespace aurora::gfx::gx {

View File

@ -79,7 +79,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
.magFilter = wgpu::FilterMode::Linear,
.minFilter = wgpu::FilterMode::Linear,
.mipmapFilter = wgpu::FilterMode::Linear,
.maxAnisotropy = g_graphicsConfig.textureAnistropy,
.maxAnisotropy = 1,
};
auto sampler = g_device.CreateSampler(&samplerDescriptor);

View File

@ -170,17 +170,26 @@ void write_texture(const TextureRef& ref, ArrayRef<uint8_t> data) noexcept {
data.size());
unreachable();
}
auto dstView = wgpu::ImageCopyTexture{
// auto dstView = wgpu::ImageCopyTexture{
// .texture = ref.texture,
// .mipLevel = mip,
// };
// const auto range = push_texture_data(data.data() + offset, dataSize, bytesPerRow, heightBlocks);
// const auto dataLayout = wgpu::TextureDataLayout{
// .offset = range.offset,
// .bytesPerRow = bytesPerRow,
// .rowsPerImage = heightBlocks,
// };
// g_textureUploads.emplace_back(dataLayout, std::move(dstView), physicalSize);
const auto dstView = wgpu::ImageCopyTexture{
.texture = ref.texture,
.mipLevel = mip,
};
const auto range = push_texture_data(data.data() + offset, dataSize, bytesPerRow, heightBlocks);
const auto dataLayout = wgpu::TextureDataLayout{
.offset = range.offset,
.bytesPerRow = bytesPerRow,
.rowsPerImage = heightBlocks,
};
g_textureUploads.emplace_back(dataLayout, std::move(dstView), physicalSize);
g_queue.WriteTexture(&dstView, data.data() + offset, dataSize, &dataLayout, &physicalSize);
offset += dataSize;
}
if (data.size() != UINT32_MAX && offset < data.size()) {

View File

@ -372,8 +372,8 @@ bool initialize(SDL_Window* window, wgpu::BackendType backendType) {
.height = size.fb_height,
.colorFormat = swapChainFormat,
.depthFormat = wgpu::TextureFormat::Depth32Float,
.msaaSamples = 4,
.textureAnistropy = 16,
.msaaSamples = 1,
.textureAnisotropy = 16,
};
create_copy_pipeline();
resize_swapchain(size.fb_width, size.fb_height);

View File

@ -21,7 +21,7 @@ struct GraphicsConfig {
wgpu::TextureFormat colorFormat;
wgpu::TextureFormat depthFormat;
uint32_t msaaSamples;
uint16_t textureAnistropy;
uint16_t textureAnisotropy;
};
struct TextureWithSampler {
wgpu::Texture texture;

View File

@ -134,6 +134,11 @@ Sint32 add_controller(Sint32 which) noexcept {
controller.m_index = which;
controller.m_vid = SDL_GameControllerGetVendor(ctrl);
controller.m_pid = SDL_GameControllerGetProduct(ctrl);
if (controller.m_vid == 0x05ac /* USB_VENDOR_APPLE */ && controller.m_pid == 3) {
// Ignore Apple TV remote
SDL_GameControllerClose(ctrl);
return -1;
}
controller.m_isGameCube = controller.m_vid == 0x057E && controller.m_pid == 0x0337;
controller.m_hasRumble = (SDL_GameControllerHasRumble(ctrl) != 0u);
Sint32 instance = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(ctrl));

13
extern/CMakeLists.txt vendored
View File

@ -15,7 +15,7 @@ if (NOT BUILD_ATDNA)
endif ()
include(FetchContent)
FetchContent_Declare(athena-host
URL "${ATHENA_BASE_URL}/athena-${PLATFORM_NAME}-${ATHENA_HOST_ARCH}.${ATHENA_EXT}")
URL "${ATHENA_BASE_URL}/athena-${HOST_PLATFORM_NAME}-${ATHENA_HOST_ARCH}.${ATHENA_EXT}")
message(STATUS "Fetching atdna host binary")
FetchContent_Populate(athena-host)
include(${athena-host_SOURCE_DIR}/lib/cmake/atdna/atdnaConfig.cmake)
@ -29,7 +29,7 @@ else ()
set(athena_SOURCE_DIR "${athena-host_SOURCE_DIR}")
else ()
FetchContent_Declare(athena
URL "${ATHENA_BASE_URL}/athena-${PLATFORM_NAME}-${ATHENA_ARCH}.tar.gz")
URL "${ATHENA_BASE_URL}/athena-${HOST_PLATFORM_NAME}-${ATHENA_ARCH}.tar.gz")
FetchContent_Populate(athena)
endif ()
include(${athena_SOURCE_DIR}/lib/cmake/athena/AthenaConfig.cmake)
@ -43,7 +43,7 @@ add_subdirectory(nod EXCLUDE_FROM_ALL)
# amuse must come after athena/atdna, boo and nod
add_subdirectory(amuse EXCLUDE_FROM_ALL)
if (NOT GEKKO AND NOT NX)
if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS)
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc)
if (NOT CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/fake-prefix)
@ -76,7 +76,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
target_link_libraries(nativefiledialog PRIVATE ${GTK3_LIBRARIES})
target_compile_options(nativefiledialog PRIVATE ${GTK3_CFLAGS_OTHER})
target_compile_options(nativefiledialog PRIVATE ${GTK3_CFLAGS_OTHER} -Wno-format-truncation -Wno-stringop-truncation)
target_include_directories(nativefiledialog PRIVATE ${GTK3_INCLUDE_DIRS})
target_link_directories(nativefiledialog PRIVATE ${GTK3_LIBRARY_DIRS})
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
@ -98,7 +98,10 @@ if (NOT MSVC)
target_compile_options(SDL2-static PRIVATE -Wno-implicit-fallthrough -Wno-shadow)
endif ()
set(DAWN_ENABLE_VULKAN ON CACHE BOOL "Enable compilation of the Vulkan backend" FORCE)
# Enable MoltenVK
#if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
# set(DAWN_ENABLE_VULKAN ON CACHE BOOL "Enable compilation of the Vulkan backend" FORCE)
#endif()
add_subdirectory(../extern/dawn dawn EXCLUDE_FROM_ALL)
if (DAWN_ENABLE_VULKAN)
target_compile_definitions(dawn_native PRIVATE

2
extern/boo vendored

@ -1 +1 @@
Subproject commit 33cfcd8b63fdd6fabdcca4704c48626838f9b0f8
Subproject commit 49364a152fb9c42d73415db6071f32213cfd127c

2
extern/dawn vendored

@ -1 +1 @@
Subproject commit 59d5fcfc9b958950ac3f6999e63e8db5ed42cf2e
Subproject commit f223c5af9ff49c1d25ec862e11f0191e1339916e

View File

@ -21,7 +21,9 @@ target_link_libraries(imgui PRIVATE aurora zeus logvisor ${ZLIB_LIBRARIES})
# Optional, replaces stb_freetype if available
find_package(Freetype)
if (FREETYPE_FOUND)
# Permit disabling for macOS universal builds
option(IMGUI_USE_FREETYPE "Enable freetype with imgui" ON)
if (FREETYPE_FOUND AND IMGUI_USE_FREETYPE)
target_sources(imgui PRIVATE ../extern/imgui/misc/freetype/imgui_freetype.cpp)
target_compile_definitions(imgui PRIVATE IMGUI_ENABLE_FREETYPE)
target_link_libraries(imgui PRIVATE Freetype::Freetype)