diff --git a/ZAPDTR b/ZAPDTR index 04d42249d2c..f19ebdaa8ac 160000 --- a/ZAPDTR +++ b/ZAPDTR @@ -1 +1 @@ -Subproject commit 04d42249d2c15c3b442a0282a90bc8b7bda25b03 +Subproject commit f19ebdaa8ac6a13c2001c73fdd18fcf8e1600d48 diff --git a/libultraship b/libultraship index 78d951e4130..c16d8d8e693 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 78d951e41301a2c2fbba514f8355015669ea7541 +Subproject commit c16d8d8e693d389d4e6072225eaf2206076c33c6 diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 8218588e4cc..a0286177a25 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -303,19 +303,19 @@ 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) +# if (BUILD_REMOTE_CONTROL) +# find_package(SDL2_net) - if(NOT SDL2_net_FOUND) - message(STATUS "SDL2_net not found (it's possible the version installed is too old). Disabling BUILD_REMOTE_CONTROL.") +# if(NOT SDL2_net_FOUND) +# message(STATUS "SDL2_net not found (it's possible the version installed is too old). Disabling BUILD_REMOTE_CONTROL.") set(BUILD_REMOTE_CONTROL 0) - else() - set(SDL2-NET-INCLUDE ${SDL_NET_INCLUDE_DIRS}) - endif() -endif() +# else() +# set(SDL2-NET-INCLUDE ${SDL_NET_INCLUDE_DIRS}) +# endif() +# endif() target_include_directories(${PROJECT_NAME} PRIVATE assets ${CMAKE_CURRENT_SOURCE_DIR}/include/ @@ -346,8 +346,8 @@ target_include_directories(${PROJECT_NAME} PRIVATE assets ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic/Fast3D/U64/PR ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic ${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD/resource/type - ${SDL2-INCLUDE} - ${SDL2-NET-INCLUDE} + ${SDL3-INCLUDE} + # ${SDL2-NET-INCLUDE} ${BOOST-INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/assets/ . @@ -667,35 +667,14 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") "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 - - "$<$:-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 "$<$:SDL2_net::SDL2_net>" ${CMAKE_DL_LIBS} Threads::Threads diff --git a/soh/include/functions.h b/soh/include/functions.h index 64d7026e1d2..b3f8fad7e5d 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -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); diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index 807c269d3f3..c3e8ede5532 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -455,8 +455,11 @@ void DrawInventoryTab() { uint8_t item = gSaveContext.inventory.items[index]; if (item != ITEM_NONE) { const ItemMapEntry& slotEntry = itemMapping.find(item)->second; - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), - ImVec2(1, 1), 0)) { + if (ImGui::ImageButton(slotEntry.name.c_str(), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), + ImVec2(32.0f, 32.0f), + ImVec2(0, 0), + ImVec2(1, 1))) { selectedIndex = index; ImGui::OpenPopup(itemPopupPicker); } @@ -503,8 +506,11 @@ void DrawInventoryTab() { ImGui::SameLine(); } const ItemMapEntry& slotEntry = possibleItems[pickerIndex]; - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), - ImVec2(0, 0), ImVec2(1, 1), 0)) { + if (ImGui::ImageButton(slotEntry.name.c_str(), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), + ImVec2(32.0f, 32.0f), + ImVec2(0, 0), + ImVec2(1, 1))) { gSaveContext.inventory.items[selectedIndex] = slotEntry.id; // Set adult trade item flag if you're playing adult trade shuffle in rando if (IS_RANDO && @@ -986,8 +992,11 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const uint8_t item = items[CUR_UPG_VALUE(categoryId)]; if (item != ITEM_NONE) { const ItemMapEntry& slotEntry = itemMapping[item]; - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), - ImVec2(1, 1), 0)) { + if (ImGui::ImageButton(slotEntry.name.c_str(), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), + ImVec2(32.0f, 32.0f), + ImVec2(0, 0), + ImVec2(1, 1))) { ImGui::OpenPopup(upgradePopupPicker); } } else { @@ -1014,8 +1023,11 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const UIWidgets::SetLastItemHoverText("None"); } else { const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]]; - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), - ImVec2(1, 1), 0)) { + if (ImGui::ImageButton(slotEntry.name.c_str(), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), + ImVec2(32.0f, 32.0f), + ImVec2(0, 0), + ImVec2(1, 1))) { Inventory_ChangeUpgrade(categoryId, pickerIndex); ImGui::CloseCurrentPopup(); } @@ -1051,8 +1063,11 @@ void DrawEquipmentTab() { bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0; const ItemMapEntry& entry = itemMapping[equipmentValues[i]]; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded), - ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { + if (ImGui::ImageButton(entry.name.c_str(), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded), + ImVec2(32.0f, 32.0f), + ImVec2(0, 0), + ImVec2(1, 1))) { if (hasEquip) { gSaveContext.inventory.equipment &= ~bitMask; } else { @@ -1150,8 +1165,11 @@ void DrawQuestItemButton(uint32_t item) { uint32_t bitMask = 1 << entry.id; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), - ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { + if (ImGui::ImageButton(entry.name.c_str(), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), + ImVec2(32.0f, 32.0f), + ImVec2(0, 0), + ImVec2(1, 1))) { if (hasQuestItem) { gSaveContext.inventory.questItems &= ~bitMask; } else { @@ -1168,8 +1186,11 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) { uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded), - ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { + if (ImGui::ImageButton(entry.name.c_str(), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded), + ImVec2(32.0f, 32.0f), + ImVec2(0, 0), + ImVec2(1, 1))) { if (hasItem) { gSaveContext.inventory.dungeonItems[scene] &= ~bitMask; } else { @@ -1215,8 +1236,11 @@ void DrawQuestStatusTab() { uint32_t bitMask = 1 << entry.id; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), - ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { + if (ImGui::ImageButton(entry.name.c_str(), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), + ImVec2(32.0f, 32.0f), + ImVec2(0, 0), + ImVec2(1, 1))) { if (hasQuestItem) { gSaveContext.inventory.questItems &= ~bitMask; } else { diff --git a/soh/soh/Enhancements/randomizer/Plandomizer.cpp b/soh/soh/Enhancements/randomizer/Plandomizer.cpp index 6dd6a5175aa..5260fa3036a 100644 --- a/soh/soh/Enhancements/randomizer/Plandomizer.cpp +++ b/soh/soh/Enhancements/randomizer/Plandomizer.cpp @@ -715,15 +715,21 @@ void PlandomizerDrawItemPopup(uint32_t index) { ImGui::PushID(item); ImGui::TableNextColumn(); PlandomizerItemImageCorrection(plandomizerRandoRetrieveItem(item)); - if (ImGui::ImageButton(textureID, - imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { + std::string name = plandomizerRandoRetrieveItem(item).GetName().english; + if (ImGui::ImageButton(name.c_str(), + textureID, + imageSize, + textureUV0, + textureUV1, + ImVec4(0, 0, 0, 0), + itemColor)) { if (std::find(infiniteItemList.begin(), infiniteItemList.end(), plandoLogData[index].checkRewardItem.GetRandomizerGet()) == infiniteItemList.end()) { PlandomizerAddToItemList(plandoLogData[index].checkRewardItem); } plandoLogData[index].checkRewardItem = plandomizerRandoRetrieveItem(item); ImGui::CloseCurrentPopup(); } - UIWidgets::Tooltip(plandomizerRandoRetrieveItem(item).GetName().english.c_str()); + UIWidgets::Tooltip(name.c_str()); PlandomizerOverlayText(std::make_pair(plandomizerRandoRetrieveItem(item), 1)); ImGui::PopID(); } @@ -741,8 +747,14 @@ void PlandomizerDrawItemPopup(uint32_t index) { ImGui::PushID(itemIndex); auto itemToDraw = drawSlots.first; PlandomizerItemImageCorrection(drawSlots.first); - if (ImGui::ImageButton(textureID, - imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { + auto name = drawSlots.first.GetName().english; + if (ImGui::ImageButton(name.c_str(), + textureID, + imageSize, + textureUV0, + textureUV1, + ImVec4(0, 0, 0, 0), + itemColor)) { if (itemToDraw.GetRandomizerGet() >= RG_PROGRESSIVE_HOOKSHOT && itemToDraw.GetRandomizerGet() <= RG_PROGRESSIVE_GORONSWORD) { plandoLogData[index].checkRewardItem = drawSlots.first; @@ -757,7 +769,7 @@ void PlandomizerDrawItemPopup(uint32_t index) { ImGui::CloseCurrentPopup(); } if (!isClicked) { - UIWidgets::Tooltip(drawSlots.first.GetName().english.c_str()); + UIWidgets::Tooltip(name.c_str()); } ImGui::PopID(); @@ -786,12 +798,13 @@ void PlandomizerDrawIceTrapPopUp(uint32_t index) { } ImGui::TableNextColumn(); ImGui::PushID(items.first); + auto name = Rando::StaticData::RetrieveItem(items.first).GetName().english; PlandomizerItemImageCorrection(Rando::StaticData::RetrieveItem(items.first)); - if (ImGui::ImageButton(textureID, imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { + if (ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor)) { plandoLogData[index].iceTrapModel = Rando::StaticData::RetrieveItem(items.first); ImGui::CloseCurrentPopup(); }; - UIWidgets::Tooltip(Rando::StaticData::RetrieveItem(items.first).GetName().english.c_str()); + UIWidgets::Tooltip(name.c_str()); auto itemObject = Rando::StaticData::RetrieveItem(items.first); PlandomizerOverlayText(std::make_pair(itemObject, 1)); @@ -808,13 +821,14 @@ void PlandomizerDrawItemSlots(uint32_t index) { ImGui::PushID(index); PlandoPushImageButtonStyle(); PlandomizerItemImageCorrection(plandoLogData[index].checkRewardItem); - if (ImGui::ImageButton(textureID, imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { + auto name = plandoLogData[index].checkRewardItem.GetName().english; + if (ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor)) { shouldPopup = true; temporaryItem = plandoLogData[index].checkRewardItem; ImGui::OpenPopup("ItemList"); }; PlandoPopImageButtonStyle(); - UIWidgets::Tooltip(plandoLogData[index].checkRewardItem.GetName().english.c_str()); + UIWidgets::Tooltip(name.c_str()); PlandomizerOverlayText(std::make_pair(plandoLogData[index].checkRewardItem, 1)); PlandomizerDrawItemPopup(index); ImGui::PopID(); @@ -852,12 +866,13 @@ void PlandomizerDrawIceTrapSetup(uint32_t index) { ImGui::TableNextColumn(); PlandomizerItemImageCorrection(plandoLogData[index].iceTrapModel); PlandoPushImageButtonStyle(); - if (ImGui::ImageButton(textureID, imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) { + auto name = plandoLogData[index].iceTrapModel.GetName().english; + if (ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor)) { shouldTrapPopup = true; ImGui::OpenPopup("TrapList"); }; PlandoPopImageButtonStyle(); - UIWidgets::Tooltip(plandoLogData[index].iceTrapModel.GetName().english.c_str()); + UIWidgets::Tooltip(name.c_str()); PlandomizerDrawIceTrapPopUp(index); ImGui::SameLine(); ImGui::TableNextColumn(); @@ -934,8 +949,8 @@ void PlandomizerDrawOptions() { for (auto& hash : plandoHash) { ImGui::PushID(index); textureID = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gSeedTextures[hash].tex); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_UP"), - ImVec2(35.0f, 18.0f), ImVec2(1, 1), ImVec2(0, 0), 2.0f, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { + if (ImGui::ImageButton("HASH ARROW UP", Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_UP"), + ImVec2(35.0f, 18.0f), ImVec2(1, 1), ImVec2(0, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { if (hash + 1 >= gSeedTextures.size()) { hash = 0; } @@ -944,8 +959,8 @@ void PlandomizerDrawOptions() { } } ImGui::Image(textureID, ImVec2(35.0f, 35.0f)); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_DWN"), - ImVec2(35.0f, 18.0f), ImVec2(0, 0), ImVec2(1, 1), 2.0f, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { + if (ImGui::ImageButton("HASH_ARROW_DWN", Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_DWN"), + ImVec2(35.0f, 18.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) { if (hash == 0) { hash = gSeedTextures.size() - 1; } diff --git a/soh/soh/Enhancements/resolution-editor/ResolutionEditor.cpp b/soh/soh/Enhancements/resolution-editor/ResolutionEditor.cpp index c15f0436496..727bb611d55 100644 --- a/soh/soh/Enhancements/resolution-editor/ResolutionEditor.cpp +++ b/soh/soh/Enhancements/resolution-editor/ResolutionEditor.cpp @@ -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."); diff --git a/soh/soh/Enhancements/speechsynthesizer/SpeechSynthesizer.h b/soh/soh/Enhancements/speechsynthesizer/SpeechSynthesizer.h index 29d209b5f88..ded6a4143db 100644 --- a/soh/soh/Enhancements/speechsynthesizer/SpeechSynthesizer.h +++ b/soh/soh/Enhancements/speechsynthesizer/SpeechSynthesizer.h @@ -33,7 +33,7 @@ class SpeechSynthesizer { #ifdef _WIN32 #include "SAPISpeechSynthesizer.h" -#elif defined(__APPLE__) +#elif defined(SDL_PLATFORM_APPLE) #include "DarwinSpeechSynthesizer.h" #endif diff --git a/soh/soh/Enhancements/timesplits/TimeSplits.cpp b/soh/soh/Enhancements/timesplits/TimeSplits.cpp index 57a73dd6fe4..b79c62b10a5 100644 --- a/soh/soh/Enhancements/timesplits/TimeSplits.cpp +++ b/soh/soh/Enhancements/timesplits/TimeSplits.cpp @@ -432,8 +432,8 @@ void TimeSplitsPopUpContext() { ImGui::BeginTable("Token Table", 2); ImGui::TableNextColumn(); SplitsPushImageButtonStyle(); - ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("QUEST_SKULL_TOKEN"), - ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 2.0f, ImVec4(0, 0, 0, 0)); + ImGui::ImageButton("QUEST_SKULL_TOKEN", Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("QUEST_SKULL_TOKEN"), + ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0)); ImGui::TableNextColumn(); SplitsPopImageButtonStyle(); ImGui::PushItemWidth(150.0f); @@ -479,8 +479,8 @@ void TimeSplitsPopUpContext() { SplitObject& popupObject = *findID; ImGui::BeginGroup(); ImGui::PushID(popupObject.splitID); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(popupObject.splitImage), - ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 2, ImVec4(0, 0, 0, 0), popupObject.splitTint)) { + if (ImGui::ImageButton(popupObject.splitImage.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(popupObject.splitImage), + ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), popupObject.splitTint)) { splitList.push_back(popupObject); if (splitList.size() == 1) { splitList[0].splitTimeStatus = SPLIT_STATUS_ACTIVE; @@ -650,8 +650,8 @@ void TimeSplitsDrawSplitsList() { ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, IM_COL32(47, 79, 90, 255)); } TimeSplitsGetImageSize(split.splitID); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(split.splitImage), - imageSize, ImVec2(0, 0), ImVec2(1, 1), imagePadding, ImVec4(0, 0, 0, 0), split.splitTint)) { + if (ImGui::ImageButton(split.splitImage.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(split.splitImage), + imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), split.splitTint)) { TimeSplitsSkipSplit(dragIndex); } HandleDragAndDrop(splitList, dragIndex, split.splitName); @@ -722,8 +722,8 @@ void TimeSplitsDrawItemList(uint32_t type) { ImGui::PushID(split.splitID); TimeSplitsGetImageSize(split.splitID); SplitsPushImageButtonStyle(); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(split.splitImage), - imageSize, ImVec2(0, 0), ImVec2(1, 1), imagePadding, ImVec4(0, 0, 0, 0), split.splitTint)) { + if (ImGui::ImageButton(split.splitImage.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(split.splitImage), + imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), split.splitTint)) { if (popupList.contains(split.splitID) && (split.splitType < SPLIT_TYPE_BOSS)) { popupID = split.splitID; @@ -875,8 +875,8 @@ void TimeSplitsDrawManageList() { ImGui::SetCursorPosX(ImGui::GetCursorPosX() + offsetX); // Apply the offset to center } TimeSplitsGetImageSize(data.splitID); - if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(data.splitImage), - imageSize, ImVec2(0, 0), ImVec2(1, 1), imagePadding, ImVec4(0, 0, 0, 0), data.splitTint)) { + if (ImGui::ImageButton(data.splitImage.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(data.splitImage), + imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), data.splitTint)) { removeIndex = index; } HandleDragAndDrop(splitList, index, splitList[index].splitName); diff --git a/soh/soh/Extractor/Extract.cpp b/soh/soh/Extractor/Extract.cpp index 673afc8a645..92f86d9f6ce 100644 --- a/soh/soh/Extractor/Extract.cpp +++ b/soh/soh/Extractor/Extract.cpp @@ -40,7 +40,7 @@ #include -#include +#include #include #include @@ -121,13 +121,13 @@ int Extractor::ShowRomPickBox(uint32_t verCrc) const { SDL_MessageBoxButtonData buttons[3] = { { 0 } }; int ret; - buttons[0].buttonid = 0; + buttons[0].buttonID = 0; buttons[0].text = "Yes"; buttons[0].flags = SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT; - buttons[1].buttonid = 1; + buttons[1].buttonID = 1; buttons[1].text = "No"; buttons[1].flags = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT; - buttons[2].buttonid = 2; + buttons[2].buttonID = 2; buttons[2].text = "Find ROM"; boxData.numbuttons = 3; boxData.flags = SDL_MESSAGEBOX_INFORMATION; @@ -152,10 +152,10 @@ int Extractor::ShowYesNoBox(const char* title, const char* box) { SDL_MessageBoxData boxData = { 0 }; SDL_MessageBoxButtonData buttons[2] = { { 0 } }; - buttons[0].buttonid = IDYES; + buttons[0].buttonID = IDYES; buttons[0].text = "Yes"; buttons[0].flags = SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT; - buttons[1].buttonid = IDNO; + buttons[1].buttonID = IDNO; buttons[1].text = "No"; buttons[1].flags = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT; boxData.numbuttons = 2; diff --git a/soh/soh/Extractor/FastCrc32C.c b/soh/soh/Extractor/FastCrc32C.c index d88b04bebe8..44ba03baf2c 100644 --- a/soh/soh/Extractor/FastCrc32C.c +++ b/soh/soh/Extractor/FastCrc32C.c @@ -122,7 +122,7 @@ uint32_t CRC32C(unsigned char* data, size_t dataSize) { unsigned int cpuidData[4]; #ifdef _WIN32 __cpuid(cpuidData, 1); -#elif __APPLE__ || (defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)) +#elif SDL_PLATFORM_APPLE || (defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)) // Every Mac that supports SoH should support this instruction. Also check for ARM64 at the same time return CRC32IntrinImpl(data, dataSize); #else diff --git a/soh/soh/Extractor/portable-file-dialogs.h b/soh/soh/Extractor/portable-file-dialogs.h index 1fc79a29103..4333e64cb1a 100644 --- a/soh/soh/Extractor/portable-file-dialogs.h +++ b/soh/soh/Extractor/portable-file-dialogs.h @@ -32,7 +32,7 @@ #ifndef _POSIX_C_SOURCE # define _POSIX_C_SOURCE 2 // for popen() #endif -#ifdef __APPLE__ +#ifdef SDL_PLATFORM_APPLE # ifndef _DARWIN_C_SOURCE # define _DARWIN_C_SOURCE # endif @@ -535,7 +535,7 @@ inline settings::settings(bool resync) #if _WIN32 flags(flag::is_vista) = internal::is_vista(); -#elif !__APPLE__ +#elif !SDL_PLATFORM_APPLE flags(flag::has_zenity) = check_program("zenity"); flags(flag::has_matedialog) = check_program("matedialog"); flags(flag::has_qarma) = check_program("qarma"); @@ -559,7 +559,7 @@ inline bool settings::available() { #if _WIN32 return true; -#elif __APPLE__ +#elif SDL_PLATFORM_APPLE return true; #elif __EMSCRIPTEN__ // FIXME: Return true after implementation is complete. @@ -603,7 +603,7 @@ inline bool settings::check_program(std::string const &program) inline bool settings::is_osascript() const { -#if __APPLE__ +#if SDL_PLATFORM_APPLE return true; #else return false; @@ -979,7 +979,7 @@ inline internal::dialog::dialog() inline std::vector internal::dialog::desktop_helper() const { -#if __APPLE__ +#if SDL_PLATFORM_APPLE return { "osascript" }; #else return { flags(flag::has_zenity) ? "zenity" diff --git a/soh/soh/Network/Network.h b/soh/soh/Network/Network.h index 6bd4f816424..3c98600e9c8 100644 --- a/soh/soh/Network/Network.h +++ b/soh/soh/Network/Network.h @@ -4,7 +4,7 @@ #ifdef __cplusplus #include -#include +#include #include class Network { diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 9189da7e581..44c47ba1096 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -53,10 +53,10 @@ #include -#ifdef __APPLE__ -#include +#ifdef SDL_PLATFORM_APPLE +#include #else -#include +#include #endif #ifdef __SWITCH__ @@ -1152,7 +1152,7 @@ extern "C" void InitOTR() { SohGui::SetupGuiElements(); AudioCollection::Instance = new AudioCollection(); ActorDB::Instance = new ActorDB(); -#ifdef __APPLE__ +#ifdef SDL_PLATFORM_APPLE SpeechSynthesizer::Instance = new DarwinSpeechSynthesizer(); SpeechSynthesizer::Instance->Init(); #elif defined(_WIN32) @@ -1338,7 +1338,7 @@ extern "C" void Graph_StartFrame() { break; } -#if defined(_WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(SDL_PLATFORM_APPLE) case KbScancode::LUS_KB_F9: { // Toggle TTS CVarSetInteger(CVAR_SETTING("A11yTTS"), !CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)); diff --git a/soh/soh/SohGui.cpp b/soh/soh/SohGui.cpp index 2dbf62a99a6..9ea8464f53b 100644 --- a/soh/soh/SohGui.cpp +++ b/soh/soh/SohGui.cpp @@ -16,7 +16,7 @@ #include #include -#ifdef __APPLE__ +#ifdef SDL_PLATFORM_APPLE #include "graphic/Fast3D/gfx_metal.h" #endif diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index c4989542180..ea6e7eda9c1 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -197,7 +197,7 @@ void DrawShipMenu() { UIWidgets::Spacer(0); #endif if (ImGui::MenuItem("Reset", -#ifdef __APPLE__ +#ifdef SDL_PLATFORM_APPLE "Command-R" #elif !defined(__SWITCH__) && !defined(__WIIU__) "Ctrl+R" @@ -320,7 +320,7 @@ void DrawSettingsMenu() { UIWidgets::Spacer(0); if (ImGui::BeginMenu("Graphics")) { - #ifndef __APPLE__ + #ifndef SDL_PLATFORM_APPLE const bool disabled_resolutionSlider = CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0) && CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0); if (UIWidgets::EnhancementSliderFloat("Internal Resolution: %.1f %%", "##IMul", CVAR_INTERNAL_RESOLUTION, 0.5f, @@ -562,7 +562,7 @@ void DrawSettingsMenu() { UIWidgets::Spacer(0); if (ImGui::BeginMenu("Accessibility")) { - #if defined(_WIN32) || defined(__APPLE__) + #if defined(_WIN32) || defined(SDL_PLATFORM_APPLE) UIWidgets::PaddedEnhancementCheckbox("Text to Speech", CVAR_SETTING("A11yTTS")); UIWidgets::Tooltip("Enables text to speech for in game dialog"); #endif diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index 23af9f613e0..2e22c7b1c88 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -159,7 +159,7 @@ namespace UIWidgets { ImGui::RenderFrame(check_bb.Min, check_bb.Max, ImGui::GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding); ImU32 check_col = ImGui::GetColorU32(ImGuiCol_CheckMark); ImU32 cross_col = ImGui::GetColorU32(ImVec4(0.50f, 0.50f, 0.50f, 1.00f)); - bool mixed_value = (g.LastItemData.InFlags & ImGuiItemFlags_MixedValue) != 0; + bool mixed_value = (g.LastItemData.ItemFlags & ImGuiItemFlags_MixedValue) != 0; if (mixed_value) { // Undocumented tristate/mixed/indeterminate checkbox (#2644) // This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox) @@ -787,12 +787,17 @@ namespace UIWidgets { if (!ImGui::ItemAdd(bb, id)) return false; - if (g.LastItemData.InFlags & ImGuiItemFlags_ButtonRepeat) - flags |= ImGuiButtonFlags_Repeat; + if (g.LastItemData.ItemFlags & ImGuiItemFlags_ButtonRepeat) { + ImGui::PushItemFlag(ImGuiItemFlags_ButtonRepeat, true); + } bool hovered, held; bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held, flags); + if (g.LastItemData.ItemFlags & ImGuiItemFlags_ButtonRepeat) { + ImGui::PopItemFlag(); // ImGuiItemFlags_ButtonRepeat; + } + // Render const ImU32 bg_col = ImGui::GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered diff --git a/soh/src/buffers/heaps.c b/soh/src/buffers/heaps.c index 2191ae72f67..6efef60a40c 100644 --- a/soh/src/buffers/heaps.c +++ b/soh/src/buffers/heaps.c @@ -1,6 +1,6 @@ #include "z64.h" #include -#ifndef __APPLE__ +#ifndef SDL_PLATFORM_APPLE #include #endif #include