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

Merge controller menus #3860

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/generate-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ jobs:
needs: generate-soh-otr
runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }}
container:
image: devkitpro/devkita64:latest
image: devkitpro/devkita64:20240120
steps:
- name: Install dependencies
run: |
Expand Down
361 changes: 0 additions & 361 deletions soh/soh/Enhancements/controls/GameControlEditor.cpp

This file was deleted.

21 changes: 0 additions & 21 deletions soh/soh/Enhancements/controls/GameControlEditor.h

This file was deleted.

345 changes: 330 additions & 15 deletions soh/soh/Enhancements/controls/SohInputEditorWindow.cpp

Large diffs are not rendered by default.

22 changes: 20 additions & 2 deletions soh/soh/Enhancements/controls/SohInputEditorWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
#include <string>
#include <vector>
#include <set>
#include <list>

typedef uint32_t N64ButtonMask;

typedef struct {
const char* label;
const char* cVarName;
N64ButtonMask defaultBtn;
} CustomButtonMap;

class SohInputEditorWindow : public LUS::GuiWindow {
public:
Expand Down Expand Up @@ -51,6 +60,17 @@ class SohInputEditorWindow : public LUS::GuiWindow {
void DrawRemoveGyroMappingButton(uint8_t port, std::string id);
void DrawAddGyroMappingButton(uint8_t port);

// Used together for an incomplete linked hash map implementation in order to
// map button masks to their names and original mapping on N64
std::list<std::pair<N64ButtonMask, const char*>> buttons;
std::unordered_map<N64ButtonMask, decltype(buttons)::iterator> buttonNames;
void addButtonName(N64ButtonMask mask, const char* name);
void DrawMapping(CustomButtonMap& mapping, float labelWidth, N64ButtonMask excludedButtons);
void DrawOcarinaControlPanel();
void DrawCameraControlPanel();
void DrawDpadControlPanel();
void DrawMiscControlPanel();

int32_t mGameInputBlockTimer;
int32_t mMappingInputBlockTimer;
int32_t mRumbleTimer;
Expand Down Expand Up @@ -84,6 +104,4 @@ class SohInputEditorWindow : public LUS::GuiWindow {
bool mInputEditorPopupOpen;
void DrawSetDefaultsButton(uint8_t portIndex);
void DrawClearAllButton(uint8_t portIndex);

void DrawHelpIcon(const std::string& helptext);
};
1 change: 0 additions & 1 deletion soh/soh/OTRGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <dr_libs/wav.h>
#include <AudioPlayer.h>
#include "Enhancements/speechsynthesizer/SpeechSynthesizer.h"
#include "Enhancements/controls/GameControlEditor.h"
#include "Enhancements/controls/SohInputEditorWindow.h"
#include "Enhancements/cosmetics/CosmeticsEditor.h"
#include "Enhancements/audio/AudioCollection.h"
Expand Down
4 changes: 0 additions & 4 deletions soh/soh/SohGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ namespace SohGui {
std::shared_ptr<LUS::GuiWindow> mInputEditorWindow;

std::shared_ptr<AudioEditor> mAudioEditorWindow;
std::shared_ptr<GameControlEditor::GameControlEditorWindow> mGameControlEditorWindow;
std::shared_ptr<CosmeticsEditorWindow> mCosmeticsEditorWindow;
std::shared_ptr<ActorViewerWindow> mActorViewerWindow;
std::shared_ptr<ColViewerWindow> mColViewerWindow;
Expand Down Expand Up @@ -164,8 +163,6 @@ namespace SohGui {

mAudioEditorWindow = std::make_shared<AudioEditor>("gAudioEditor.WindowOpen", "Audio Editor");
gui->AddGuiWindow(mAudioEditorWindow);
mGameControlEditorWindow = std::make_shared<GameControlEditor::GameControlEditorWindow>("gGameControlEditorEnabled", "Game Control Editor");
gui->AddGuiWindow(mGameControlEditorWindow);
mCosmeticsEditorWindow = std::make_shared<CosmeticsEditorWindow>("gCosmeticsEditorEnabled", "Cosmetics Editor");
gui->AddGuiWindow(mCosmeticsEditorWindow);
mActorViewerWindow = std::make_shared<ActorViewerWindow>("gActorViewerEnabled", "Actor Viewer");
Expand Down Expand Up @@ -211,7 +208,6 @@ namespace SohGui {
mColViewerWindow = nullptr;
mActorViewerWindow = nullptr;
mCosmeticsEditorWindow = nullptr;
mGameControlEditorWindow = nullptr;
mAudioEditorWindow = nullptr;
mInputEditorWindow = nullptr;
mStatsWindow = nullptr;
Expand Down
1 change: 0 additions & 1 deletion soh/soh/SohGui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <stdio.h>
#include "SohMenuBar.h"
#include "Enhancements/audio/AudioEditor.h"
#include "Enhancements/controls/GameControlEditor.h"
#include "Enhancements/cosmetics/CosmeticsEditor.h"
#include "Enhancements/debugger/actorViewer.h"
#include "Enhancements/debugger/colViewer.h"
Expand Down
7 changes: 0 additions & 7 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


#include "Enhancements/audio/AudioEditor.h"
#include "Enhancements/controls/GameControlEditor.h"
#include "Enhancements/cosmetics/CosmeticsEditor.h"
#include "Enhancements/debugger/actorViewer.h"
#include "Enhancements/debugger/colViewer.h"
Expand Down Expand Up @@ -180,7 +179,6 @@ void DrawShipMenu() {
}

extern std::shared_ptr<LUS::GuiWindow> mInputEditorWindow;
extern std::shared_ptr<GameControlEditor::GameControlEditorWindow> mGameControlEditorWindow;
extern std::shared_ptr<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow> mAdvancedResolutionSettingsWindow;

void DrawSettingsMenu() {
Expand Down Expand Up @@ -241,11 +239,6 @@ void DrawSettingsMenu() {
mInputEditorWindow->ToggleVisibility();
}
}
if (mGameControlEditorWindow) {
if (ImGui::Button(GetWindowButtonText("Additional Controller Options", CVarGetInteger("gGameControlEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) {
mGameControlEditorWindow->ToggleVisibility();
}
}
UIWidgets::PaddedSeparator();
ImGui::PopStyleColor(1);
ImGui::PopStyleVar(3);
Expand Down
Loading