Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdl3 #4859

Draft
wants to merge 29 commits into
base: develop
Choose a base branch
from
Draft

sdl3 #4859

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0161ac3
run `rename_symbols.py --all-symbols`
briaguya-ai Jan 11, 2025
088c425
run `rename_headers.py`
briaguya-ai Jan 11, 2025
80f969e
run `rename_macros.py`
briaguya-ai Jan 11, 2025
57e1a3e
some cmake stuff
briaguya-ai Jan 11, 2025
1365a1f
change/document enough stuff that extractassets works
briaguya-ai Jan 11, 2025
edee336
change/document enough stuff that we can get in-game
briaguya-ai Jan 11, 2025
3a84729
some gamepad stuff
briaguya-ai Jan 11, 2025
a543677
controllers
briaguya-ai Jan 11, 2025
062a48c
try to get a linux build on ci
briaguya-ai Jan 11, 2025
8b36116
submodule commit wrangling
briaguya-ai Jan 11, 2025
ac0e9ab
build with cmake
briaguya-ai Jan 11, 2025
ea9164e
sudo it
briaguya-ai Jan 11, 2025
8fa8202
play with dirs a bit
briaguya-ai Jan 11, 2025
798cd48
more dirs
briaguya-ai Jan 11, 2025
4791796
i guess just install sdl net for now even though i haven't figured ou…
briaguya-ai Jan 11, 2025
735a2b4
just rip out sdl net to get stuff to build
briaguya-ai Jan 11, 2025
d66b99c
go the other way
briaguya-ai Jan 11, 2025
9b65dd8
?
briaguya-ai Jan 11, 2025
13822f5
just turn it off for now
briaguya-ai Jan 11, 2025
4316b45
start on mac
briaguya-ai Jan 11, 2025
8784aee
add windows to the mix
briaguya-ai Jan 11, 2025
a004cac
what's up with macros?
briaguya-ai Jan 11, 2025
56549d8
is sdl3main not a thing?
briaguya-ai Jan 11, 2025
b011817
spots
briaguya-ai Jan 11, 2025
4e599c9
header
briaguya-ai Jan 11, 2025
b763ceb
syswm stuff
briaguya-ai Jan 11, 2025
294d673
pi? huh?
briaguya-ai Jan 11, 2025
ee131ec
main stuff
briaguya-ai Jan 11, 2025
74564d7
mac?
briaguya-ai Jan 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions .github/workflows/generate-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ jobs:
${{ runner.os }}-otr-build-
path: |
build-cmake
SDL2-2.30.3
SDL3-3.1.8
tinyxml2-10.0.0
- name: Install latest SDL
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
if [ ! -d "SDL2-2.30.3" ]; then
wget https://www.libsdl.org/release/SDL2-2.30.3.tar.gz
tar -xzf SDL2-2.30.3.tar.gz
if [ ! -d "SDL3-3.1.8" ]; then
wget https://www.libsdl.org/release/SDL3-3.1.8.tar.gz
tar -xzf SDL3-3.1.8.tar.gz
fi
cd SDL2-2.30.3
./configure --enable-hidapi-libusb
make -j 10
sudo make install
cd SDL3-3.1.8
mkdir -p build
cd build
cmake -S .. -B .
cmake --build .
sudo cmake --install . --prefix /usr/local
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
- name: Install latest tinyxml2
run: |
Expand Down Expand Up @@ -118,7 +120,7 @@ jobs:
name: soh.otr
- name: Build SoH
run: |
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DBUILD_REMOTE_CONTROL=1
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DBUILD_REMOTE_CONTROL=0
cmake --build build-cmake --config Release --parallel 10
mv soh.otr build-cmake/soh
(cd build-cmake && cpack)
Expand Down Expand Up @@ -158,21 +160,23 @@ jobs:
linux-build-${{ github.ref }}
linux-build-
path: |
SDL2-2.30.3
SDL3-3.1.8
SDL2_net-2.2.0
tinyxml2-10.0.0
libzip-1.10.1
- name: Install latest SDL
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
if [ ! -d "SDL2-2.30.3" ]; then
wget https://www.libsdl.org/release/SDL2-2.30.3.tar.gz
tar -xzf SDL2-2.30.3.tar.gz
if [ ! -d "SDL3-3.1.8" ]; then
wget https://www.libsdl.org/release/SDL3-3.1.8.tar.gz
tar -xzf SDL3-3.1.8.tar.gz
fi
cd SDL2-2.30.3
./configure --enable-hidapi-libusb
make -j 10
sudo make install
cd SDL3-3.1.8
mkdir -p build
cd build
cmake -S .. -B .
cmake --build .
sudo cmake --install . --prefix /usr/local
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
- name: Install latest SDL_net
run: |
Expand Down Expand Up @@ -221,7 +225,7 @@ jobs:
- name: Build SoH
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_REMOTE_CONTROL=1
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_REMOTE_CONTROL=0
cmake --build build-cmake --config Release -j3
(cd build-cmake && cpack -G External)

Expand Down Expand Up @@ -275,7 +279,7 @@ jobs:
VCPKG_ROOT: ${{github.workspace}}/vcpkg
run: |
set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH"
cmake -S . -B build-windows -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DBUILD_REMOTE_CONTROL=1
cmake -S . -B build-windows -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DBUILD_REMOTE_CONTROL=0
cmake --build build-windows --config Release --parallel 10

mkdir soh-windows
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macports-deps.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
libsdl2 +universal libsdl2_net +universal libpng +universal glew +universal libzip +universal nlohmann-json +universal tinyxml2 +universal
SDL3-devel +universal libsdl2_net +universal libpng +universal glew +universal libzip +universal nlohmann-json +universal tinyxml2 +universal
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(VCPKG_TARGET_TRIPLET x64-windows-static)

vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 libzip libpng sdl2 sdl2-net glew glfw3 nlohmann-json tinyxml2 spdlog)
vcpkg_install_packages(zlib bzip2 libzip libpng sdl3 sdl2-net glew glfw3 nlohmann-json tinyxml2 spdlog)

if (CMAKE_C_COMPILER_LAUNCHER MATCHES "ccache|sccache")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)
Expand Down
2 changes: 1 addition & 1 deletion ZAPDTR
2 changes: 1 addition & 1 deletion libultraship
Submodule libultraship updated 54 files
+8 −8 cmake/dependencies/android.cmake
+1 −1 cmake/dependencies/common.cmake
+6 −6 cmake/dependencies/ios.cmake
+2 −2 cmake/dependencies/linux.cmake
+2 −2 cmake/dependencies/mac.cmake
+2 −2 cmake/dependencies/windows.cmake
+1 −1 include/libultraship/classes.h
+5 −5 src/Context.cpp
+27 −13 src/audio/SDLAudioPlayer.cpp
+2 −2 src/audio/SDLAudioPlayer.h
+2 −2 src/config/Config.cpp
+3 −3 src/controller/controldevice/controller/Controller.cpp
+16 −16 src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp
+35 −35 src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp
+17 −17 src/controller/controldevice/controller/mapping/factories/GyroMappingFactory.cpp
+20 −17 src/controller/controldevice/controller/mapping/factories/LEDMappingFactory.cpp
+21 −19 src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp
+10 −10 src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAnyMapping.cpp
+1 −1 src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAnyMapping.h
+1 −1 src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAxisDirectionMapping.cpp
+5 −5 src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.cpp
+70 −70 src/controller/controldevice/controller/mapping/sdl/SDLButtonToAnyMapping.cpp
+1 −1 src/controller/controldevice/controller/mapping/sdl/SDLButtonToAnyMapping.h
+1 −1 src/controller/controldevice/controller/mapping/sdl/SDLButtonToAxisDirectionMapping.cpp
+1 −1 src/controller/controldevice/controller/mapping/sdl/SDLButtonToButtonMapping.cpp
+4 −4 src/controller/controldevice/controller/mapping/sdl/SDLGyroMapping.cpp
+4 −2 src/controller/controldevice/controller/mapping/sdl/SDLLEDMapping.cpp
+30 −27 src/controller/controldevice/controller/mapping/sdl/SDLMapping.cpp
+5 −5 src/controller/controldevice/controller/mapping/sdl/SDLMapping.h
+2 −2 src/controller/controldevice/controller/mapping/sdl/SDLRumbleMapping.cpp
+52 −34 src/controller/deviceindex/ControllerDisconnectedWindow.cpp
+45 −33 src/controller/deviceindex/ControllerReorderingWindow.cpp
+2 −2 src/controller/deviceindex/ControllerReorderingWindow.h
+55 −47 src/controller/deviceindex/ShipDeviceIndexMappingManager.cpp
+5 −5 src/controller/deviceindex/ShipDeviceIndexMappingManager.h
+20 −20 src/controller/deviceindex/ShipDeviceIndexToSDLInstanceIDMapping.cpp
+6 −6 src/controller/deviceindex/ShipDeviceIndexToSDLInstanceIDMapping.h
+1 −1 src/debug/CrashHandler.h
+2 −2 src/graphic/Fast3D/Fast3dWindow.cpp
+5 −5 src/graphic/Fast3D/gfx_metal.cpp
+1 −1 src/graphic/Fast3D/gfx_metal.h
+1 −1 src/graphic/Fast3D/gfx_metal_shader.cpp
+1 −1 src/graphic/Fast3D/gfx_metal_shader.h
+28 −28 src/graphic/Fast3D/gfx_opengl.cpp
+1 −1 src/graphic/Fast3D/gfx_pc.cpp
+163 −71 src/graphic/Fast3D/gfx_sdl2.cpp
+1 −1 src/port/mobile/MobileImpl.cpp
+10 −6 src/public/libultra/os.cpp
+6 −1 src/public/libultra/os_vi.cpp
+1 −1 src/window/Window.cpp
+19 −19 src/window/gui/Gui.cpp
+1 −1 src/window/gui/Gui.h
+25 −25 src/window/gui/InputEditorWindow.cpp
+1 −1 src/window/gui/StatsWindow.cpp
35 changes: 6 additions & 29 deletions soh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ endif()
################################################################################
# Compile definitions
################################################################################
find_package(SDL2)
set(SDL2-INCLUDE ${SDL2_INCLUDE_DIRS})
find_package(SDL3)
set(SDL3-INCLUDE ${SDL3_INCLUDE_DIRS})

if (BUILD_REMOTE_CONTROL)
find_package(SDL2_net)
Expand Down Expand Up @@ -644,8 +644,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
"libultraship;"
"ZAPDLib;"
"glu32;"
"SDL2::SDL2;"
"SDL2::SDL2main;"
"SDL3::SDL3;"
"$<$<BOOL:${BUILD_REMOTE_CONTROL}>:SDL2_net::SDL2_net-static>"
"glfw;"
"winmm;"
Expand All @@ -658,44 +657,22 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
"libultraship;"
"ZAPDLib;"
"glu32;"
"SDL2::SDL2;"
"SDL2::SDL2main;"
"SDL3::SDL3;"
"glfw;"
"winmm;"
"imm32;"
"version;"
"setupapi"
)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
find_package(SDL2)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
SDL2::SDL2
-lglad
Threads::Threads
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
find_package(SDL2 REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
SDL2::SDL2-static

"$<$<CONFIG:Debug>:-Wl,--wrap=abort>"
)
target_include_directories(${PROJECT_NAME} PRIVATE
${DEVKITPRO}/portlibs/wiiu/include/
)
else()
find_package(SDL2)
find_package(SDL3)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
"ZAPDLib;"
SDL2::SDL2
SDL3::SDL3
"$<$<BOOL:${BUILD_REMOTE_CONTROL}>:SDL2_net::SDL2_net>"
${CMAKE_DL_LIBS}
Threads::Threads
Expand Down
4 changes: 2 additions & 2 deletions soh/include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ u32 Locale_IsRegionNative(void);
void _assert(const char* exp, const char* file, s32 line);
#elif defined(__linux__)
void __assert(const char* exp, const char* file, s32 line) __THROW;
#elif !defined(__APPLE__) && !defined(__SWITCH__)
#elif !defined(SDL_PLATFORM_APPLE) && !defined(__SWITCH__)
void __assert(const char* exp, const char* file, s32 line);
#endif
#if defined(__APPLE__) && defined(NDEBUG)
#if defined(SDL_PLATFORM_APPLE) && defined(NDEBUG)
void __assert(const char* exp, const char* file, s32 line);
#endif
void isPrintfInit(void);
Expand Down
50 changes: 25 additions & 25 deletions soh/soh/Enhancements/controls/SohInputEditorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64Butt
->GetControlDeck()
->GetDeviceIndexMappingManager()
->GetDeviceIndexMappingFromShipDeviceIndex(mapping->GetShipDeviceIndex());
auto sdlIndexMapping = std::dynamic_pointer_cast<Ship::ShipDeviceIndexToSDLDeviceIndexMapping>(indexMapping);
auto sdlInstanceIDMapping = std::dynamic_pointer_cast<Ship::ShipDeviceIndexToSDLInstanceIDMapping>(indexMapping);

if (sdlIndexMapping != nullptr && sdlAxisDirectionToButtonMapping != nullptr) {
if (sdlInstanceIDMapping != nullptr && sdlAxisDirectionToButtonMapping != nullptr) {
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f));
auto buttonColor = ImGui::GetStyleColorVec4(ImGuiCol_Button);
auto buttonHoveredColor = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered);
Expand Down Expand Up @@ -360,14 +360,14 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64Butt
if (sdlAxisDirectionToButtonMapping->AxisIsStick()) {
ImGui::Text("Stick axis threshold:");

int32_t stickAxisThreshold = sdlIndexMapping->GetStickAxisThresholdPercentage();
int32_t stickAxisThreshold = sdlInstanceIDMapping->GetStickAxisThresholdPercentage();
if (stickAxisThreshold == 0) {
ImGui::BeginDisabled();
}
ImGui::PushButtonRepeat(true);
if (ImGui::Button(StringHelper::Sprintf("-##Stick Axis Threshold%s", id.c_str()).c_str())) {
sdlIndexMapping->SetStickAxisThresholdPercentage(stickAxisThreshold - 1);
sdlIndexMapping->SaveToConfig();
sdlInstanceIDMapping->SetStickAxisThresholdPercentage(stickAxisThreshold - 1);
sdlInstanceIDMapping->SaveToConfig();
}
ImGui::PopButtonRepeat();
if (stickAxisThreshold == 0) {
Expand All @@ -377,17 +377,17 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64Butt
ImGui::SetNextItemWidth(SCALE_IMGUI_SIZE(160.0f));
if (ImGui::SliderInt(StringHelper::Sprintf("##Stick Axis Threshold%s", id.c_str()).c_str(),
&stickAxisThreshold, 0, 100, "%d%%", ImGuiSliderFlags_AlwaysClamp)) {
sdlIndexMapping->SetStickAxisThresholdPercentage(stickAxisThreshold);
sdlIndexMapping->SaveToConfig();
sdlInstanceIDMapping->SetStickAxisThresholdPercentage(stickAxisThreshold);
sdlInstanceIDMapping->SaveToConfig();
}
ImGui::SameLine(0.0f, 0.0f);
if (stickAxisThreshold == 100) {
ImGui::BeginDisabled();
}
ImGui::PushButtonRepeat(true);
if (ImGui::Button(StringHelper::Sprintf("+##Stick Axis Threshold%s", id.c_str()).c_str())) {
sdlIndexMapping->SetStickAxisThresholdPercentage(stickAxisThreshold + 1);
sdlIndexMapping->SaveToConfig();
sdlInstanceIDMapping->SetStickAxisThresholdPercentage(stickAxisThreshold + 1);
sdlInstanceIDMapping->SaveToConfig();
}
ImGui::PopButtonRepeat();
if (stickAxisThreshold == 100) {
Expand All @@ -398,14 +398,14 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64Butt
if (sdlAxisDirectionToButtonMapping->AxisIsTrigger()) {
ImGui::Text("Trigger axis threshold:");

int32_t triggerAxisThreshold = sdlIndexMapping->GetTriggerAxisThresholdPercentage();
int32_t triggerAxisThreshold = sdlInstanceIDMapping->GetTriggerAxisThresholdPercentage();
if (triggerAxisThreshold == 0) {
ImGui::BeginDisabled();
}
ImGui::PushButtonRepeat(true);
if (ImGui::Button(StringHelper::Sprintf("-##Trigger Axis Threshold%s", id.c_str()).c_str())) {
sdlIndexMapping->SetTriggerAxisThresholdPercentage(triggerAxisThreshold - 1);
sdlIndexMapping->SaveToConfig();
sdlInstanceIDMapping->SetTriggerAxisThresholdPercentage(triggerAxisThreshold - 1);
sdlInstanceIDMapping->SaveToConfig();
}
ImGui::PopButtonRepeat();
if (triggerAxisThreshold == 0) {
Expand All @@ -415,17 +415,17 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64Butt
ImGui::SetNextItemWidth(SCALE_IMGUI_SIZE(160.0f));
if (ImGui::SliderInt(StringHelper::Sprintf("##Trigger Axis Threshold%s", id.c_str()).c_str(),
&triggerAxisThreshold, 0, 100, "%d%%", ImGuiSliderFlags_AlwaysClamp)) {
sdlIndexMapping->SetTriggerAxisThresholdPercentage(triggerAxisThreshold);
sdlIndexMapping->SaveToConfig();
sdlInstanceIDMapping->SetTriggerAxisThresholdPercentage(triggerAxisThreshold);
sdlInstanceIDMapping->SaveToConfig();
}
ImGui::SameLine(0.0f, 0.0f);
if (triggerAxisThreshold == 100) {
ImGui::BeginDisabled();
}
ImGui::PushButtonRepeat(true);
if (ImGui::Button(StringHelper::Sprintf("+##Trigger Axis Threshold%s", id.c_str()).c_str())) {
sdlIndexMapping->SetTriggerAxisThresholdPercentage(triggerAxisThreshold + 1);
sdlIndexMapping->SaveToConfig();
sdlInstanceIDMapping->SetTriggerAxisThresholdPercentage(triggerAxisThreshold + 1);
sdlInstanceIDMapping->SaveToConfig();
}
ImGui::PopButtonRepeat();
if (triggerAxisThreshold == 100) {
Expand Down Expand Up @@ -1657,24 +1657,24 @@ void SohInputEditorWindow::DrawDeviceVisibilityButtons() {
->GetControlDeck()
->GetDeviceIndexMappingManager()
->GetAllDeviceIndexMappingsFromConfig()) {
auto sdlIndexMapping = std::static_pointer_cast<Ship::ShipDeviceIndexToSDLDeviceIndexMapping>(mapping);
if (sdlIndexMapping == nullptr) {
auto sdlInstanceIDMapping = std::static_pointer_cast<Ship::ShipDeviceIndexToSDLInstanceIDMapping>(mapping);
if (sdlInstanceIDMapping == nullptr) {
continue;
}

indexMappings[lusIndex] = { sdlIndexMapping->GetSDLControllerName(), -1 };
indexMappings[lusIndex] = { sdlInstanceIDMapping->GetSDLControllerName(), -1 };
}

for (auto [lusIndex, mapping] : Ship::Context::GetInstance()
->GetControlDeck()
->GetDeviceIndexMappingManager()
->GetAllDeviceIndexMappings()) {
auto sdlIndexMapping = std::static_pointer_cast<Ship::ShipDeviceIndexToSDLDeviceIndexMapping>(mapping);
if (sdlIndexMapping == nullptr) {
auto sdlInstanceIDMapping = std::static_pointer_cast<Ship::ShipDeviceIndexToSDLInstanceIDMapping>(mapping);
if (sdlInstanceIDMapping == nullptr) {
continue;
}

indexMappings[lusIndex] = { sdlIndexMapping->GetSDLControllerName(), sdlIndexMapping->GetSDLDeviceIndex() };
indexMappings[lusIndex] = { sdlInstanceIDMapping->GetSDLControllerName(), sdlInstanceIDMapping->GetSDLInstanceID() };
}

auto keyboardButtonColor = ImGui::GetStyleColorVec4(ImGuiCol_Button);
Expand Down Expand Up @@ -2015,12 +2015,12 @@ void SohInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) {
->GetControlDeck()
->GetDeviceIndexMappingManager()
->GetAllDeviceIndexMappings()) {
auto sdlIndexMapping = std::static_pointer_cast<Ship::ShipDeviceIndexToSDLDeviceIndexMapping>(mapping);
if (sdlIndexMapping == nullptr) {
auto sdlInstanceIDMapping = std::static_pointer_cast<Ship::ShipDeviceIndexToSDLInstanceIDMapping>(mapping);
if (sdlInstanceIDMapping == nullptr) {
continue;
}

indexMappings[lusIndex] = { sdlIndexMapping->GetSDLControllerName(), sdlIndexMapping->GetSDLDeviceIndex() };
indexMappings[lusIndex] = { sdlInstanceIDMapping->GetSDLControllerName(), sdlInstanceIDMapping->GetSDLInstanceID() };
}

bool shouldClose = false;
Expand Down
5 changes: 5 additions & 0 deletions soh/soh/Enhancements/randomizer/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
#include "soh_assets.h"
#include "soh/Enhancements/cosmetics/cosmeticsTypes.h"

// no idea why this suddently decided it didn't exist on windows
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923
#endif

extern "C" {
extern SaveContext gSaveContext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
const bool disabled_everything = !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0);
const bool disabled_pixelCount = !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0);

#ifdef __APPLE__
#ifdef SDL_PLATFORM_APPLE
// Display HiDPI warning. (Remove this once we can definitively say it's fixed.)
ImGui::TextColored(messageColor[MESSAGE_INFO],
ICON_FA_INFO_CIRCLE " These settings may behave incorrectly on Retina displays.");
Expand Down
2 changes: 1 addition & 1 deletion soh/soh/Enhancements/speechsynthesizer/SpeechSynthesizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SpeechSynthesizer {

#ifdef _WIN32
#include "SAPISpeechSynthesizer.h"
#elif defined(__APPLE__)
#elif defined(SDL_PLATFORM_APPLE)
#include "DarwinSpeechSynthesizer.h"
#endif

Expand Down
Loading
Loading