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

Latest LUS #911

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ include(CMake/GlobalSettingsInclude.cmake OPTIONAL)
################################################################################
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# FIXME: temp patch to resolve imgui cache issues
execute_process(
COMMAND git reset --hard
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/imgui-src
)

################################################################################
# Sub-projects
################################################################################
Expand Down Expand Up @@ -240,3 +246,17 @@ endif()

set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/CMake/Packaging-2.cmake)
include(CMake/Packaging.cmake)

# FIXME: temp patch to resolve imgui cache issues
execute_process(
COMMAND git config --local user.email "[email protected]"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/imgui-src
)
execute_process(
COMMAND git config --local user.name "Noname"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/imgui-src
)
execute_process(
COMMAND git commit -a -m patch
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/imgui-src
)
2 changes: 1 addition & 1 deletion libultraship
Submodule libultraship updated 153 files
2 changes: 0 additions & 2 deletions mm/2s2h/BenGui/BenGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <spdlog/spdlog.h>
#include <imgui.h>
#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui_internal.h>
#include <libultraship/libultraship.h>
#include <Fast3D/gfx_pc.h>
Expand Down Expand Up @@ -112,7 +111,6 @@ void SetupGuiElements() {
mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>("gWindows.ItemTrackerSettings",
"Item Tracker Settings", ImVec2(800, 400));
gui->AddGuiWindow(mItemTrackerSettingsWindow);
gui->SetPadBtnTogglesMenu();

mNotificationWindow = std::make_shared<Notification::Window>("gWindows.Notifications", "Notifications Window");
gui->AddGuiWindow(mNotificationWindow);
Expand Down
10 changes: 5 additions & 5 deletions mm/2s2h/BenGui/BenInputEditorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void BenInputEditorWindow::UpdateElement() {
}
}

Ship::Context::GetInstance()->GetWindow()->GetGui()->BlockImGuiGamepadNavigation();
Ship::Context::GetInstance()->GetWindow()->GetGui()->BlockGamepadNavigation();
} else {
if (mGameInputBlockTimer != INT32_MAX) {
mGameInputBlockTimer--;
Expand All @@ -69,13 +69,13 @@ void BenInputEditorWindow::UpdateElement() {
}
}

if (Ship::Context::GetInstance()->GetWindow()->GetGui()->ImGuiGamepadNavigationEnabled()) {
if (Ship::Context::GetInstance()->GetWindow()->GetGui()->GamepadNavigationEnabled()) {
mMappingInputBlockTimer = ImGui::GetIO().Framerate / 3;
} else {
mMappingInputBlockTimer = INT32_MAX;
}

Ship::Context::GetInstance()->GetWindow()->GetGui()->UnblockImGuiGamepadNavigation();
Ship::Context::GetInstance()->GetWindow()->GetGui()->UnblockGamepadNavigation();
}
}

Expand Down Expand Up @@ -1237,7 +1237,7 @@ void BenInputEditorWindow::DrawButtonDeviceIcons(uint8_t portIndex, std::set<CON
}
}

void BenInputEditorWindow::DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::Stick stick) {
void BenInputEditorWindow::DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::StickIndex stick) {
std::set<Ship::ShipDeviceIndex> allLusDeviceIndices;
allLusDeviceIndices.insert(Ship::ShipDeviceIndex::Keyboard);
for (auto [lusIndex, mapping] : Ship::Context::GetInstance()
Expand All @@ -1250,7 +1250,7 @@ void BenInputEditorWindow::DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::S
std::vector<std::pair<Ship::ShipDeviceIndex, bool>> lusDeviceIndiciesWithMappings;
for (auto lusIndex : allLusDeviceIndices) {
auto controllerStick =
stick == Ship::Stick::LEFT_STICK
stick == Ship::StickIndex::LEFT_STICK
? Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetLeftStick()
: Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetRightStick();
if (controllerStick->HasMappingsForShipDeviceIndex(lusIndex)) {
Expand Down
5 changes: 1 addition & 4 deletions mm/2s2h/BenGui/BenInputEditorWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

#include "stdint.h"
#include "window/gui/GuiWindow.h"
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h>
#include <unordered_map>
#include <string>
Expand Down Expand Up @@ -77,7 +74,7 @@ class BenInputEditorWindow : public Ship::GuiWindow {
std::set<CONTROLLERBUTTONS_T> mButtonsBitmasks;
std::set<CONTROLLERBUTTONS_T> mDpadBitmasks;
void DrawButtonDeviceIcons(uint8_t portIndex, std::set<CONTROLLERBUTTONS_T> bitmasks);
void DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::Stick stick);
void DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::StickIndex stick);
void DrawRumbleDeviceIcons(uint8_t portIndex);
void DrawGyroDeviceIcons(uint8_t portIndex);
void DrawLEDDeviceIcons(uint8_t portIndex);
Expand Down
6 changes: 3 additions & 3 deletions mm/2s2h/BenGui/BenMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ void DrawSettingsMenu() {
AudioSeq_SetPortVolumeScale(SEQ_PLAYER_AMBIENCE, CVarGetFloat("gSettings.Audio.AmbienceVolume", 1.0f));
}

auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetAudioBackend();
auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetCurrentAudioBackend();
if (UIWidgets::Combobox(
"Audio API", &currentAudioBackend, audioBackendsMap,
{ .tooltip = "Sets the audio API used by the game. Requires a relaunch to take effect.",
.disabled = Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1,
.disabledTooltip = "Only one audio API is available on this platform." })) {
Ship::Context::GetInstance()->GetAudio()->SetAudioBackend(currentAudioBackend);
Ship::Context::GetInstance()->GetAudio()->SetCurrentAudioBackend(currentAudioBackend);
}

ImGui::EndMenu();
Expand Down Expand Up @@ -265,7 +265,7 @@ void DrawSettingsMenu() {
int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
if (hz >= 20 && hz <= 360) {
CVarSetInteger("gInterpolationFPS", hz);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions mm/2s2h/BenGui/CosmeticEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void CosmeticEditorRandomizeElement(CosmeticEditorElement element) {

CVarSetColor(element.colorCvar, colorSelected);
CVarSetInteger(element.colorChangedCvar, true);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}

void CosmeticEditorRandomizeAllElements() {
Expand Down Expand Up @@ -217,13 +217,13 @@ void CosmeticEditorDrawColorTab() {

CVarSetColor(entry.colorCvar, colorSelected);
CVarSetInteger(entry.colorChangedCvar, true);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::SameLine();
if (ImGui::Button(ICON_FA_UNDO, ImVec2(27.0f, 27.0f))) {
CVarClear(entry.colorCvar);
CVarClear(entry.colorChangedCvar);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::SameLine();
if (ImGui::Button(ICON_FA_RECYCLE, ImVec2(27.0f, 27.0f))) {
Expand Down
6 changes: 3 additions & 3 deletions mm/2s2h/BenGui/HudEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void HudEditorWindow::DrawElement() {
break;
}
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}

for (int i = HUD_EDITOR_ELEMENT_B; i < HUD_EDITOR_ELEMENT_MAX; i++) {
Expand Down Expand Up @@ -255,14 +255,14 @@ void HudEditorWindow::DrawElement() {

CVarSetColor(hudEditorElements[i].colorCvar, colorSelected);
CVarSetInteger(hudEditorElements[i].colorChangedCvar, true);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::SameLine();
if (ImGui::Button(ICON_FA_REFRESH)) {
float color[4] = { defaultColor[0], defaultColor[1], defaultColor[2], defaultColor[3] };
CVarClear(hudEditorElements[i].colorCvar);
CVarClear(hudEditorElements[i].colorChangedCvar);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::SameLine();
if (UIWidgets::CVarCombobox("Mode", hudEditorElements[i].modeCvar, modeNames,
Expand Down
10 changes: 5 additions & 5 deletions mm/2s2h/BenGui/SearchableMenuItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ void AddSettings() {
int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
if (hz >= 20 && hz <= 360) {
CVarSetInteger("gInterpolationFPS", hz);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
},
[](widgetInfo& info) { info.isHidden = disabledMap.at(DISABLE_FOR_NOT_DIRECTX).active; } },
Expand Down Expand Up @@ -1564,7 +1564,7 @@ void AddDevTools() {
CVarSetFloat(WARP_POINT_CVAR "Z", player->actor.world.pos.z);
CVarSetFloat(WARP_POINT_CVAR "Rotation", player->actor.shape.rot.y);
CVarSetInteger(WARP_POINT_CVAR "Saved", 1);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
},
[](widgetInfo& info) { info.isHidden = disabledMap.at(DISABLE_FOR_NULL_PLAY_STATE).active; } },
{ "Scene Room ID",
Expand Down Expand Up @@ -1594,7 +1594,7 @@ void AddDevTools() {
CVarClear(WARP_POINT_CVAR "Z");
CVarClear(WARP_POINT_CVAR "Rotation");
CVarClear(WARP_POINT_CVAR "Saved");
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
},
[](widgetInfo& info) {
info.isHidden = disabledMap.at(DISABLE_FOR_NULL_PLAY_STATE).active ||
Expand Down Expand Up @@ -1849,15 +1849,15 @@ void SearchMenuGetItem(widgetInfo& widget) {
};
break;
case WIDGET_AUDIO_BACKEND: {
auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetAudioBackend();
auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetCurrentAudioBackend();
if (UIWidgets::Combobox(
"Audio API", &currentAudioBackend, audioBackendsMap,
{ .color = menuTheme[menuThemeIndex],
.tooltip = widget.widgetTooltip,
.disabled =
Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1,
.disabledTooltip = "Only one audio API is available on this platform." })) {
Ship::Context::GetInstance()->GetAudio()->SetAudioBackend(currentAudioBackend);
Ship::Context::GetInstance()->GetAudio()->SetCurrentAudioBackend(currentAudioBackend);
}
} break;
case WIDGET_VIDEO_BACKEND: {
Expand Down
11 changes: 5 additions & 6 deletions mm/2s2h/BenGui/UIWidgets.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "UIWidgets.hpp"
#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui_internal.h>
#include <sstream>
#include <libultraship/libultraship.h>
Expand Down Expand Up @@ -247,7 +246,7 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) {
: ImGuiCol_FrameBg),
true, style.FrameRounding);
ImU32 check_col = ImGui::GetColorU32(ImGuiCol_CheckMark);
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
Expand Down Expand Up @@ -275,7 +274,7 @@ bool CVarCheckbox(const char* label, const char* cvarName, const CheckboxOptions
bool value = (bool)CVarGetInteger(cvarName, options.defaultValue);
if (Checkbox(label, &value, options)) {
CVarSetInteger(cvarName, value);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
Expand Down Expand Up @@ -384,7 +383,7 @@ bool CVarSliderInt(const char* label, const char* cvarName, int32_t min, int32_t
int32_t value = CVarGetInteger(cvarName, defaultValue);
if (SliderInt(label, &value, min, max, options)) {
CVarSetInteger(cvarName, value);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
Expand Down Expand Up @@ -496,7 +495,7 @@ bool CVarSliderFloat(const char* label, const char* cvarName, float min, float m
float value = CVarGetFloat(cvarName, defaultValue);
if (SliderFloat(label, &value, min, max, options)) {
CVarSetFloat(cvarName, value);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
Expand All @@ -514,7 +513,7 @@ bool CVarColorPicker(const char* label, const char* cvarName, Color_RGBA8 defaul
color.b = (uint8_t)(colorVec.z * 255.0f);
color.a = (uint8_t)(colorVec.w * 255.0f);
CVarSetColor(cvarName, color);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
changed = true;
}
Expand Down
7 changes: 3 additions & 4 deletions mm/2s2h/BenGui/UIWidgets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <vector>
#include <span>
#include <stdint.h>
#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui.h>
#include <libultraship/libultraship.h>
#include <unordered_map>
Expand Down Expand Up @@ -351,7 +350,7 @@ namespace UIWidgets {
int32_t value = CVarGetInteger(cvarName, options.defaultIndex);
if (Combobox<T>(label, &value, comboMap, options)) {
CVarSetInteger(cvarName, value);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
Expand All @@ -364,7 +363,7 @@ namespace UIWidgets {
int32_t value = CVarGetInteger(cvarName, options.defaultIndex);
if (Combobox<T>(label, &value, comboVector, options)) {
CVarSetInteger(cvarName, value);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
Expand All @@ -377,7 +376,7 @@ namespace UIWidgets {
int32_t value = CVarGetInteger(cvarName, options.defaultIndex);
if (Combobox<T>(label, &value, comboArray, options)) {
CVarSetInteger(cvarName, value);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
Expand Down
Loading
Loading