Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into chaos-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Caladius committed Sep 27, 2024
2 parents 38d103e + 19dc4dc commit 9983e5b
Show file tree
Hide file tree
Showing 29 changed files with 764 additions and 821 deletions.
17 changes: 5 additions & 12 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@ Requires:
* At least 8GB of RAM (machines with 4GB have seen complier failures)
* Visual Studio 2022 Community Edition with the C++ feature set
* One of the Windows SDKs that comes with Visual Studio, for example the current Windows 10 version 10.0.19041.0
* The `MSVC v142 - VS 2019 C++ build tools` component of Visual Studio
* The `MSVC v143 - VS 2022 C++ build tools` component of Visual Studio
* Python 3 (can be installed manually or as part of Visual Studio)
* Git (can be installed manually or as part of Visual Studio)
* Cmake (can be installed via chocolatey or manually)

During installation, check the "Desktop development with C++" feature set:

![image](https://user-images.githubusercontent.com/30329717/183511274-d11aceea-7900-46ec-acb6-3f2cc110021a.png)
Doing so should also check one of the Windows SDKs by default. Then, in the installation details in the right-hand column, make sure you also check the v142 toolset.
Doing so should also check one of the Windows SDKs by default. Then, in the installation details in the right-hand column, make sure you also check the v143 toolset. This is often done by default.

You can also find the v142 toolset by searching through the individual components tab:

![image](https://user-images.githubusercontent.com/30329717/183521169-ead6a73b-a1bf-4e99-aab8-441746d8f08e.png)
While you're there, you can also install Python 3 and Git if needed.
It is recommended that you install Python and Git standalone, the install process in VS Installer has given some issues in the past.

1. Clone the Ship of Harkinian repository

Expand All @@ -33,9 +30,7 @@ _Note: Instructions assume using powershell_
cd Shipwright
# Setup cmake project
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# or for VS2019
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 16 2019" -T v142 -A x64
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssets # --config Release (if you're packaging)
# Compile project
Expand All @@ -60,9 +55,7 @@ With the cmake build system you have two options for working on the project:
To develop using Visual Studio you only need to use cmake to generate the solution file:
```powershell
# Generates Ship.sln at `build/x64` for Visual Studio 2022
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64
# or for Visual Studio 2019
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 16 2019" -T v142 -A x64
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64
```

#### Visual Studio Code or another editor
Expand Down
2 changes: 1 addition & 1 deletion libultraship
Submodule libultraship updated 47 files
+1 −1 .github/workflows/tidy-format-validation.yml
+4 −3 cmake/dependencies/common.cmake
+1 −0 include/libultraship/libultra/gbi.h
+2 −2 include/libultraship/libultra/os.h
+7 −7 src/Context.cpp
+3 −3 src/Context.h
+3 −5 src/audio/Audio.cpp
+3 −1 src/audio/Audio.h
+0 −2 src/audio/AudioPlayer.cpp
+32 −4 src/audio/AudioPlayer.h
+1 −7 src/audio/SDLAudioPlayer.cpp
+2 −2 src/audio/SDLAudioPlayer.h
+0 −6 src/audio/WasapiAudioPlayer.cpp
+6 −6 src/audio/WasapiAudioPlayer.h
+1 −1 src/config/Config.cpp
+2 −3 src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToAxisDirectionMapping.cpp
+2 −2 src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToButtonMapping.cpp
+4 −3 src/controller/controldevice/controller/mapping/keyboard/KeyboardScancodes.h
+2 −0 src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAnyMapping.cpp
+8 −0 src/controller/controldevice/controller/mapping/sdl/SDLButtonToAnyMapping.cpp
+2 −2 src/controller/controldevice/controller/mapping/sdl/SDLButtonToButtonMapping.cpp
+1 −1 src/controller/controldevice/controller/mapping/sdl/SDLGyroMapping.cpp
+46 −16 src/graphic/Fast3D/gfx_pc.cpp
+2 −1 src/graphic/Fast3D/gfx_pc.h
+5 −0 src/graphic/Fast3D/gfx_sdl2.cpp
+1 −0 src/graphic/Fast3D/lus_gbi.h
+1 −0 src/resource/ResourceType.h
+1 −1 src/resource/archive/Archive.cpp
+1 −1 src/resource/factory/DisplayListFactory.cpp
+15 −0 src/resource/factory/LightFactory.cpp
+11 −0 src/resource/factory/LightFactory.h
+11 −0 src/resource/type/Light.cpp
+65 −0 src/resource/type/Light.h
+12 −0 src/utils/binarytools/BinaryReader.cpp
+1 −0 src/utils/binarytools/BinaryReader.h
+5 −4 src/window/gui/ConsoleWindow.cpp
+334 −56 src/window/gui/GfxDebuggerWindow.cpp
+1 −1 src/window/gui/GfxDebuggerWindow.h
+73 −65 src/window/gui/Gui.cpp
+4 −2 src/window/gui/Gui.h
+5 −5 src/window/gui/GuiElement.cpp
+1 −1 src/window/gui/GuiElement.h
+2 −2 src/window/gui/GuiMenuBar.cpp
+1 −1 src/window/gui/GuiMenuBar.h
+3 −3 src/window/gui/GuiWindow.cpp
+2 −2 src/window/gui/GuiWindow.h
+3 −3 src/window/gui/InputEditorWindow.cpp
7 changes: 0 additions & 7 deletions soh/soh/Enhancements/audio/AudioEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,6 @@ void AudioEditor::InitElement() {
void AudioEditor::DrawElement() {
AudioCollection::Instance->InitializeShufflePool();

ImGui::SetNextWindowSize(ImVec2(820, 630), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Audio Editor", &mIsVisible)) {
ImGui::End();
return;
}

float buttonSegments = ImGui::GetContentRegionAvail().x / 4;
if (ImGui::Button("Randomize All Groups", ImVec2(buttonSegments, 30.0f))) {
AudioEditor_RandomizeAll();
Expand Down Expand Up @@ -700,7 +694,6 @@ void AudioEditor::DrawElement() {

ImGui::EndTabBar();
}
ImGui::End();
}

std::vector<SeqType> allTypes = { SEQ_BGM_WORLD, SEQ_BGM_EVENT, SEQ_BGM_BATTLE, SEQ_OCARINA, SEQ_FANFARE, SEQ_INSTRUMENT, SEQ_SFX, SEQ_VOICE };
Expand Down
656 changes: 330 additions & 326 deletions soh/soh/Enhancements/controls/InputViewer.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions soh/soh/Enhancements/controls/InputViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class InputViewer : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;

void Draw() override;
void InitElement() override {};
void DrawElement() override;
void UpdateElement() override {};
Expand Down
7 changes: 0 additions & 7 deletions soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1687,12 +1687,6 @@ static const char* colorSchemes[2] = {
};

void CosmeticsEditorWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(550, 520), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Cosmetics Editor", &mIsVisible)) {
ImGui::End();
return;
}

ImGui::Text("Color Scheme");
ImGui::SameLine();
UIWidgets::EnhancementCombobox(CVAR_COSMETIC("DefaultColorScheme"), colorSchemes, COLORSCHEME_N64);
Expand Down Expand Up @@ -1811,7 +1805,6 @@ void CosmeticsEditorWindow::DrawElement() {
}
ImGui::EndTabBar();
}
ImGui::End();
}

void RegisterOnLoadGameHook() {
Expand Down
3 changes: 1 addition & 2 deletions soh/soh/Enhancements/debugconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,5 @@ void DebugConsole_Init(void) {
{"group_name", Ship::ArgumentType::TEXT, true},
}});

CVarSave();
CVarLoad();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
}
6 changes: 0 additions & 6 deletions soh/soh/Enhancements/debugger/MessageViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ void MessageViewer::InitElement() {
}

void MessageViewer::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Custom Message Debugger", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
ImGui::Text("Table ID");
ImGui::SameLine();
ImGui::InputText("##TableID", mTableIdBuf, MAX_STRING_SIZE, ImGuiInputTextFlags_CallbackCharFilter, UIWidgets::TextFilters::FilterAlphaNum);
Expand Down Expand Up @@ -74,7 +69,6 @@ void MessageViewer::DrawElement() {
if (ImGui::Button("Display Message##CustomMessage")) {
mDisplayCustomMessageClicked = true;
}
ImGui::End();
// ReSharper restore CppDFAUnreachableCode
}

Expand Down
8 changes: 0 additions & 8 deletions soh/soh/Enhancements/debugger/actorViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,12 +925,6 @@ void ActorViewer_AddTagForAllActors() {
}

void ActorViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Actor Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

static Actor* display;
static Actor empty{};
static Actor* fetch = NULL;
Expand Down Expand Up @@ -1235,8 +1229,6 @@ void ActorViewerWindow::DrawElement() {
actors.clear();
}
}

ImGui::End();
}

void ActorViewerWindow::InitElement() {
Expand Down
7 changes: 0 additions & 7 deletions soh/soh/Enhancements/debugger/colViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ static std::vector<Vtx> sphereVtx;

// Draws the ImGui window for the collision viewer
void ColViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Collision Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
UIWidgets::EnhancementCheckbox("Enabled", CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"));

UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), ColRenderSettingNames, COLVIEW_DISABLED);
Expand Down Expand Up @@ -95,8 +90,6 @@ void ColViewerWindow::DrawElement() {
} else {
UIWidgets::InsertHelpHoverText(colorHelpText);
}

ImGui::End();
}

// Calculates the normal for a triangle at the 3 specified points
Expand Down
8 changes: 0 additions & 8 deletions soh/soh/Enhancements/debugger/debugSaveEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1747,12 +1747,6 @@ void DrawPlayerTab() {
}

void SaveEditorWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Save Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

if (ImGui::BeginTabBar("SaveContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("Info")) {
DrawInfoTab();
Expand Down Expand Up @@ -1786,8 +1780,6 @@ void SaveEditorWindow::DrawElement() {

ImGui::EndTabBar();
}

ImGui::End();
}

void SaveEditorWindow::InitElement() {
Expand Down
11 changes: 0 additions & 11 deletions soh/soh/Enhancements/debugger/dlViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ void PerformDisplayListSearch() {
}

void DLViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Display List Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

// Debounce the search field as listing otr files is expensive
if (ImGui::InputText("Search Display Lists", searchString, ARRAY_COUNT(searchString))) {
doSearch = true;
Expand All @@ -122,7 +116,6 @@ void DLViewerWindow::DrawElement() {
}

if (activeDisplayList == "") {
ImGui::End();
return;
}

Expand All @@ -131,7 +124,6 @@ void DLViewerWindow::DrawElement() {

if (res->GetInitData()->Type != static_cast<uint32_t>(LUS::ResourceType::DisplayList)) {
ImGui::Text("Resource type is not a Display List. Please choose another.");
ImGui::End();
return;
}

Expand Down Expand Up @@ -325,11 +317,8 @@ void DLViewerWindow::DrawElement() {
}
} catch (const std::exception& e) {
ImGui::Text("Error displaying DL instructions.");
ImGui::End();
return;
}

ImGui::End();
}

void DLViewerWindow::InitElement() {
Expand Down
8 changes: 0 additions & 8 deletions soh/soh/Enhancements/debugger/valueViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ extern "C" void ValueViewer_Draw(GfxPrint* printer) {
}

void ValueViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Value Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

UIWidgets::PaddedEnhancementCheckbox("Enable Printing", CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting"));

ImGui::BeginGroup();
Expand Down Expand Up @@ -212,8 +206,6 @@ void ValueViewerWindow::DrawElement() {
}
ImGui::EndGroup();
}

ImGui::End();
}

void ValueViewerWindow::InitElement() {
Expand Down
8 changes: 0 additions & 8 deletions soh/soh/Enhancements/gameplaystats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,6 @@ void DrawGameplayStatsOptionsTab() {
}

void GameplayStatsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(480, 550), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Gameplay Stats", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

DrawGameplayStatsHeader();

if (ImGui::BeginTabBar("Stats", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
Expand All @@ -654,8 +648,6 @@ void GameplayStatsWindow::DrawElement() {
}

ImGui::Text("Note: Gameplay stats are saved to the current file and will be\nlost if you quit without saving.");

ImGui::End();
}
void InitStats(bool isDebug) {
gSaveContext.sohStats.heartPieces = isDebug ? 8 : 0;
Expand Down
3 changes: 1 addition & 2 deletions soh/soh/Enhancements/randomizer/3drando/rando_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ void RandoMain::GenerateRando(std::unordered_map<RandomizerSettingKey, u8> cvarS
std::string fileName = Ship::Context::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations, enabledTricks, seedString).c_str());
CVarSetString(CVAR_GENERAL("SpoilerLog"), fileName.c_str());

CVarSave();
CVarLoad();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
CVarSetInteger(CVAR_GENERAL("NewSeedGenerated"), 1);
}

Expand Down
11 changes: 1 addition & 10 deletions soh/soh/Enhancements/randomizer/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3053,8 +3053,7 @@ void GenerateRandomizerImgui(std::string seed = "") {
RandoMain::GenerateRando(cvarSettings, excludedLocations, enabledTricks, seed);

CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 0);
CVarSave();
CVarLoad();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();

generated = 1;
}
Expand Down Expand Up @@ -3137,13 +3136,6 @@ void RandomizerSettingsWindow::DrawElement() {

static int maxKeyringCount;
static bool disableGFKeyring = false;

ImGui::SetNextWindowSize(ImVec2(920, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Randomizer Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

bool disableEditingRandoSettings = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
if (disableEditingRandoSettings) {
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
Expand Down Expand Up @@ -5284,7 +5276,6 @@ void RandomizerSettingsWindow::DrawElement() {
if (disableEditingRandoSettings) {
UIWidgets::ReEnableComponent("");
}
ImGui::End();
}

CustomMessage Randomizer::GetWarpSongMessage(u16 textId, bool mysterious) {
Expand Down
26 changes: 14 additions & 12 deletions soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,16 @@ void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) {
UpdateOrdering(area);
}

void CheckTrackerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
void CheckTrackerWindow::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}

void CheckTrackerWindow::DrawElement() {
if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
if (CVarGetInteger(CVAR_TRACKER_CHECK("ShowOnlyPaused"), 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) {
return;
Expand All @@ -880,14 +887,16 @@ void CheckTrackerWindow::DrawElement() {
int comboButton2Mask = buttons[CVarGetInteger(CVAR_TRACKER_CHECK("ComboButton2"), TRACKER_COMBO_BUTTON_R)];
OSContPad* trackerButtonsPressed = Ship::Context::GetInstance()->GetControlDeck()->GetPads();
bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
trackerButtonsPressed[0].button & comboButton1Mask &&
trackerButtonsPressed[0].button & comboButton2Mask;
trackerButtonsPressed[0].button & comboButton1Mask &&
trackerButtonsPressed[0].button & comboButton2Mask;
if (!comboButtonsHeld) {
return;
}
}
}

ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);

BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar);

if (!GameInteractor::IsSaveLoaded() || !initialized) {
Expand Down Expand Up @@ -1601,14 +1610,8 @@ static const char* windowType[] = { "Floating", "Window" };
static const char* displayType[] = { "Always", "Combo Button Hold" };
static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button",
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
void CheckTrackerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);

if (!ImGui::Begin("Check Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

void CheckTrackerSettingsWindow::DrawElement() {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f });
ImGui::BeginTable("CheckTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV);
ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f);
Expand Down Expand Up @@ -1668,7 +1671,6 @@ void CheckTrackerSettingsWindow::DrawElement() {

ImGui::PopStyleVar(1);
ImGui::EndTable();
ImGui::End();
}

void CheckTrackerWindow::InitElement() {
Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/randomizer/randomizer_check_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CheckTrackerSettingsWindow : public Ship::GuiWindow {
class CheckTrackerWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;
void Draw() override;
~CheckTrackerWindow() {};

protected:
Expand Down
Loading

0 comments on commit 9983e5b

Please sign in to comment.