Resolve merge conflicts with develop-zhora

This commit is contained in:
Christopher Leggett 2022-08-03 23:13:53 -04:00
commit 1da655adb5
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
82 changed files with 1820 additions and 1735 deletions

View File

@ -1,11 +0,0 @@
#!/bin/bash
cp -av /usr/local/lib/libSDL2* /lib/x86_64-linux-gnu/
git config --global --add safe.directory /soh
make setup -C soh -j$(nproc) OPTFLAGS=-O2 DEBUG=0 CC="gcc" CXX="g++"
/opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake -B StormLib/build-switch -S StormLib -DCMAKE_INSTALL_PREFIX=/opt/devkitpro/portlibs/switch/
make -C StormLib/build-switch -j$(nproc)
make install -C StormLib/build-switch
make -f Makefile.switch -j$(nproc) OPTFLAGS=-O2 DEBUG=0

View File

@ -32,13 +32,6 @@ sudo docker run --rm -it -v $(pwd):/soh soh /bin/bash
``` ```
Inside the Docker container: Inside the Docker container:
```bash ```bash
# Clone and build StormLib
git clone https://github.com/ladislav-zezula/StormLib external/StormLib
cmake -B external/StormLib/build -S external/StormLib
cmake --build external/StormLib/build
cp external/StormLib/build/libstorm.a external
cp /usr/local/lib/libGLEW.a external
cd soh cd soh
# Extract the assets/Compile the exporter/Run the exporter # Extract the assets/Compile the exporter/Run the exporter
make setup -j$(nproc) OPTFLAGS=-O2 DEBUG=0 make setup -j$(nproc) OPTFLAGS=-O2 DEBUG=0

View File

@ -3,45 +3,56 @@ FROM ubuntu:20.04 as build
ENV LANG C.UTF-8 ENV LANG C.UTF-8
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
ENV GCCVER=10
RUN apt-get update && \ RUN apt-get update && \
apt-get upgrade -y && \ apt-get upgrade -y && \
apt-get install -y \ apt-get install -y \
binutils \ binutils \
gcc-10 \ gcc-${GCCVER} \
g++-10 \ g++-${GCCVER} \
patchelf \ p7zip-full \
p7zip-full \ python3 \
python3.9 \ make \
make \ cmake \
cmake \ curl \
curl \ git \
git \ lld \
lld \ wget \
libsdl2-dev \ libglew-dev \
zlib1g-dev \ libsdl2-dev \
libbz2-dev \ zlib1g-dev \
libpng-dev \ libbz2-dev \
libgles2-mesa-dev && \ libpng-dev \
ln -s /usr/bin/g++-10 /usr/bin/g++ && \ libgles2-mesa-dev && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 && \ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCCVER} 10 && \
gcc --version && \ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCCVER} 10
g++ --version
RUN apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/apt /var/lib/cache /var/lib/log
RUN git clone https://github.com/Perlmint/glew-cmake.git && \ RUN git clone https://github.com/Perlmint/glew-cmake.git && \
cmake glew-cmake && \ cmake glew-cmake && \
make -j$(nproc) && \ make -j$(nproc) && \
make install make install
ENV SDL2VER=2.0.22 ENV SDL2VER=2.0.22
RUN curl -sLO https://libsdl.org/release/SDL2-${SDL2VER}.tar.gz && \ RUN curl -sLO https://libsdl.org/release/SDL2-${SDL2VER}.tar.gz && \
tar -xzf SDL2-${SDL2VER}.tar.gz && \ tar -xzf SDL2-${SDL2VER}.tar.gz && \
cd SDL2-${SDL2VER} && \ cd SDL2-${SDL2VER} && \
./configure --prefix=/usr && \ ./configure --build=x86_64-linux-gnu && \
make && make install && \ make -j$(nproc) && make install && \
rm ../SDL2-${SDL2VER}.tar.gz && \ rm ../SDL2-${SDL2VER}.tar.gz
cp -av /lib/libSDL* /lib/x86_64-linux-gnu/
RUN \
ln -sf /proc/self/mounts /etc/mtab && \
mkdir -p /usr/local/share/keyring/ && \
wget -O /usr/local/share/keyring/devkitpro-pub.gpg https://apt.devkitpro.org/devkitpro-pub.gpg && \
echo "deb [signed-by=/usr/local/share/keyring/devkitpro-pub.gpg] https://apt.devkitpro.org stable main" > /etc/apt/sources.list.d/devkitpro.list && \
apt-get update -y && \
apt-get install -y devkitpro-pacman && \
yes | dkp-pacman -Syu switch-dev switch-portlibs --noconfirm
ENV DEVKITPRO=/opt/devkitpro
ENV DEVKITARM=/opt/devkitpro/devkitARM
ENV DEVKITPPC=/opt/devkitpro/devkitPPC
ENV PATH=$PATH:/opt/devkitpro/portlibs/switch/bin/
RUN mkdir /soh RUN mkdir /soh
WORKDIR /soh WORKDIR /soh

View File

@ -1,58 +0,0 @@
FROM ubuntu:20.04 as build
ENV LANG C.UTF-8
ARG DEBIAN_FRONTEND=noninteractive
ENV GCCVER=10
RUN \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
binutils \
gcc-10 \
g++-10 \
p7zip-full \
python3 \
make \
cmake \
curl \
git \
lld \
wget \
libsdl2-dev \
zlib1g-dev \
libbz2-dev \
libpng-dev \
libgles2-mesa-dev && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCCVER} 10 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCCVER} 10
RUN git clone https://github.com/Perlmint/glew-cmake.git && \
cmake glew-cmake && \
make -j$(nproc) && \
make install ARCH64=true
ENV SDL2VER=2.0.22
RUN curl -sLO https://libsdl.org/release/SDL2-${SDL2VER}.tar.gz && \
tar -xzf SDL2-${SDL2VER}.tar.gz && \
cd SDL2-${SDL2VER} && \
./configure --build=x86_64-linux-gnu && \
make && make install && \
rm ../SDL2-${SDL2VER}.tar.gz
RUN \
ln -sf /proc/self/mounts /etc/mtab && \
mkdir -p /usr/local/share/keyring/ && \
wget -O /usr/local/share/keyring/devkitpro-pub.gpg https://apt.devkitpro.org/devkitpro-pub.gpg && \
echo "deb [signed-by=/usr/local/share/keyring/devkitpro-pub.gpg] https://apt.devkitpro.org stable main" > /etc/apt/sources.list.d/devkitpro.list && \
apt-get update -y && \
apt-get install -y devkitpro-pacman && \
yes | dkp-pacman -Syu switch-dev switch-portlibs --noconfirm
ENV DEVKITPRO=/opt/devkitpro
ENV DEVKITARM=/opt/devkitpro/devkitARM
ENV DEVKITPPC=/opt/devkitpro/devkitPPC
ENV PATH=$PATH:/opt/devkitpro/portlibs/switch/bin/
RUN mkdir /soh
WORKDIR /soh

19
Jenkinsfile vendored
View File

@ -97,8 +97,7 @@ pipeline {
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64 cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
docker build . -t soh docker build . -t soh
docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash
cp ../../buildsoh.bash soh docker exec sohcont scripts/linux/build.sh
docker exec sohcont soh/buildsoh.bash
mkdir build mkdir build
mv soh/soh.elf build/ mv soh/soh.elf build/
@ -106,9 +105,9 @@ pipeline {
mv OTRGui/build/assets build/ mv OTRGui/build/assets build/
mv ZAPDTR/ZAPD.out build/assets/extractor/ mv ZAPDTR/ZAPD.out build/assets/extractor/
mv README.md readme.txt mv README.md readme.txt
docker exec sohcont appimage/appimage.sh docker exec sohcont scripts/linux/build-appimage.sh
7z a soh-linux.7z SOH-Linux.AppImage readme.txt 7z a soh-linux.7z SOH-Linux.AppImage readme.txt
''' '''
@ -143,9 +142,9 @@ pipeline {
sh ''' sh '''
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64 cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
cd soh cd soh
make setup -j4 OPTFLAGS=-O2 DEBUG=0 LD="ld" make setup -j$(sysctl -n hw.physicalcpu) OPTFLAGS=-O2 DEBUG=0 LD="ld"
make -j4 DEBUG=0 OPTFLAGS=-O2 LD="ld" make -j$(sysctl -n hw.physicalcpu) DEBUG=0 OPTFLAGS=-O2 LD="ld"
make -j4 appbundle make appbundle
mv ../README.md readme.txt mv ../README.md readme.txt
7z a soh-mac.7z soh.app readme.txt 7z a soh-mac.7z soh.app readme.txt
''' '''
@ -177,9 +176,9 @@ pipeline {
sh ''' sh '''
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64 cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
docker build . -t sohswitch -f Dockerfile.switch docker build . -t sohswitch
docker run --name sohcont -dit --rm -v $(pwd):/soh sohswitch /bin/bash docker run --name sohcont -dit --rm -v $(pwd):/soh sohswitch /bin/bash
docker exec sohcont .ci/switch/buildswitch.bash docker exec sohcont scripts/switch/build.sh
mv soh/soh.nro . mv soh/soh.nro .
mv README.md readme.txt mv README.md readme.txt

View File

@ -83,7 +83,7 @@ Refer to the [building instructions](BUILDING.md) to compile SoH.
- Confirm that `zapd.exe` exists in the `/assets/extractor` folder - Confirm that `zapd.exe` exists in the `/assets/extractor` folder
## Nightly Builds ## Nightly Builds
Nightly builds of Ship of Harkinian are available [here](https://builds.shipofharkinian.com/job/SoH_Multibranch/job/develop) Nightly builds of Ship of Harkinian are available [here](https://builds.shipofharkinian.com/)
## The Harbour Masters Are... ## The Harbour Masters Are...

View File

@ -48,11 +48,15 @@ endif
LDFLAGS := -Llib/libgfxd -L../libultraship -L../StormLib/build \ LDFLAGS := -Llib/libgfxd -L../libultraship -L../StormLib/build \
-pthread -lgfxd -lultraship ZAPDUtils/ZAPDUtils.a -lstorm -lbz2 -lm -ldl -pthread -lgfxd -lultraship ZAPDUtils/ZAPDUtils.a -lstorm -lbz2 -lm -ldl
LDFLAGS += $(shell pkg-config --libs glew libpng zlib) $(shell sdl2-config --libs)
INC += $(shell pkg-config --cflags libpng)
ifeq ($(UNAME), Darwin) ifeq ($(UNAME), Darwin)
LDFLAGS += $(shell pkg-config --libs glew libpng zlib) $(shell sdl2-config --libs) -framework OpenGL -framework Foundation LDFLAGS += -framework OpenGL -framework Foundation
INC += $(shell pkg-config --cflags libpng) endif
else
LDFLAGS += -lpng -lGL -lGLEW -lX11 -lz -lSDL2 -lpulse ifeq ($(UNAME), Linux)
LDFLAGS += $(shell pkg-config --libs x11 libpulse)
endif endif
# Use LLD if available. Set LLD=0 to not use it # Use LLD if available. Set LLD=0 to not use it
@ -65,10 +69,12 @@ ifneq ($(LLD),0)
endif endif
UNAMEM := $(shell uname -m) UNAMEM := $(shell uname -m)
ifneq ($(UNAME), Darwin) ifeq ($(UNAME), Linux)
LDFLAGS += -Wl,-export-dynamic -lstdc++fs LDFLAGS += -Wl,-export-dynamic -lstdc++fs
EXPORTERS := -Wl,--whole-archive ../OTRExporter/OTRExporter/OTRExporter.a -Wl,--no-whole-archive EXPORTERS := -Wl,--whole-archive ../OTRExporter/OTRExporter/OTRExporter.a -Wl,--no-whole-archive
else endif
ifeq ($(UNAME), Darwin)
EXPORTERS := -Wl,-force_load ../OTRExporter/OTRExporter/OTRExporter.a EXPORTERS := -Wl,-force_load ../OTRExporter/OTRExporter/OTRExporter.a
endif endif

View File

@ -29,7 +29,6 @@ WARN := -Wall -Wextra -Werror \
-Wno-narrowing \ -Wno-narrowing \
-Wno-missing-field-initializers \ -Wno-missing-field-initializers \
-Wno-error=multichar \ -Wno-error=multichar \
-Wno-unused-command-line-argument \
-Wno-delete-non-abstract-non-virtual-dtor \ -Wno-delete-non-abstract-non-virtual-dtor \
-Wno-unused-private-field \ -Wno-unused-private-field \
-Wno-deprecated-copy-with-user-provided-copy \ -Wno-deprecated-copy-with-user-provided-copy \
@ -46,7 +45,7 @@ endif
CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
CPPFLAGS := -MMD CPPFLAGS := -MMD $(shell pkg-config --cflags sdl2 glew)
MMFLAGS := -Wno-deprecated-declarations -ObjC++ -fobjc-weak -fobjc-arc MMFLAGS := -Wno-deprecated-declarations -ObjC++ -fobjc-weak -fobjc-arc
@ -62,10 +61,6 @@ ifneq ($(CXX_IS_CLANG),1)
MMFLAGS += -stdlib++-isystem ${STD_ISYSTEM} -cxx-isystem ${CXX_ISYSTEM} MMFLAGS += -stdlib++-isystem ${STD_ISYSTEM} -cxx-isystem ${CXX_ISYSTEM}
endif endif
ifeq ($(UNAME), Darwin) #APPLE
CPPFLAGS += $(shell pkg-config --cflags sdl2 glew) -framework OpenGL -framework Foundation
endif
ifneq ($(DEBUG),0) ifneq ($(DEBUG),0)
CXXFLAGS += -g -D_DEBUG CXXFLAGS += -g -D_DEBUG
CFLAGS += -g -D_DEBUG CFLAGS += -g -D_DEBUG

View File

@ -14,3 +14,11 @@ namespace Ship {
constexpr int GetSampleRate() const { return 44100; } constexpr int GetSampleRate() const { return 44100; }
}; };
} }
#ifdef _WIN32
#include "WasapiAudioPlayer.h"
#elif defined(__linux)
#include "PulseAudioPlayer.h"
#else
#include "SDLAudioPlayer.h"
#endif

View File

@ -10,115 +10,116 @@
#include "Utils/StringHelper.h" #include "Utils/StringHelper.h"
#include "Lib/ImGui/imgui_internal.h" #include "Lib/ImGui/imgui_internal.h"
std::map<ImGuiKey, std::string> Bindings; namespace Ship {
std::map<ImGuiKey, std::string> BindingToggle; std::map<ImGuiKey, std::string> Bindings;
std::map<ImGuiKey, std::string> BindingToggle;
static bool HelpCommand(const std::vector<std::string>&) { static bool HelpCommand(const std::vector<std::string>&) {
INFO("SoH Commands:"); INFO("SoH Commands:");
for(const auto& cmd : SohImGui::console->Commands) { for (const auto& cmd : SohImGui::console->Commands) {
INFO("%s", (" - " + cmd.first).c_str()); INFO("%s", (" - " + cmd.first).c_str());
}
return CMD_SUCCESS;
} }
return CMD_SUCCESS;
}
static bool ClearCommand(const std::vector<std::string>&) { static bool ClearCommand(const std::vector<std::string>&) {
SohImGui::console->Log[SohImGui::console->selected_channel].clear(); SohImGui::console->Log[SohImGui::console->selected_channel].clear();
return CMD_SUCCESS; return CMD_SUCCESS;
} }
std::string toLowerCase(std::string in) { std::string toLowerCase(std::string in) {
std::string cpy(in); std::string cpy(in);
std::transform(cpy.begin(), cpy.end(), cpy.begin(), ::tolower); std::transform(cpy.begin(), cpy.end(), cpy.begin(), ::tolower);
return cpy; return cpy;
} }
static bool BindCommand(const std::vector<std::string>& args) { static bool BindCommand(const std::vector<std::string>& args) {
if(args.size() > 2) { if (args.size() > 2) {
const ImGuiIO* io = &ImGui::GetIO();; const ImGuiIO* io = &ImGui::GetIO();;
for (size_t k = 0; k < std::size(io->KeysData); k++) { for (size_t k = 0; k < std::size(io->KeysData); k++) {
std::string key(ImGui::GetKeyName(k)); std::string key(ImGui::GetKeyName(k));
if(toLowerCase(args[1]) == toLowerCase(key)) { if (toLowerCase(args[1]) == toLowerCase(key)) {
std::vector<std::string> tmp; std::vector<std::string> tmp;
const char* const delim = " "; const char* const delim = " ";
std::ostringstream imploded; std::ostringstream imploded;
std::copy(args.begin() + 2, args.end(), std::ostream_iterator<std::string>(imploded, delim)); std::copy(args.begin() + 2, args.end(), std::ostream_iterator<std::string>(imploded, delim));
Bindings[k] = imploded.str(); Bindings[k] = imploded.str();
INFO("Binding '%s' to %s", args[1].c_str(), Bindings[k].c_str()); INFO("Binding '%s' to %s", args[1].c_str(), Bindings[k].c_str());
break; break;
}
}
}
return CMD_SUCCESS;
}
static bool BindToggleCommand(const std::vector<std::string>& args) {
if (args.size() > 2) {
const ImGuiIO* io = &ImGui::GetIO();;
for (size_t k = 0; k < std::size(io->KeysData); k++) {
std::string key(ImGui::GetKeyName(k));
if (toLowerCase(args[1]) == toLowerCase(key)) {
BindingToggle[k] = args[2];
INFO("Binding toggle '%s' to %s", args[1].c_str(), BindingToggle[k].c_str());
break;
}
}
}
return CMD_SUCCESS;
}
std::string BuildUsage(const CommandEntry& entry) {
std::string usage;
for (const auto& arg : entry.arguments)
usage += StringHelper::Sprintf(arg.optional ? "[%s] " : "<%s> ", arg.info.c_str());
return usage;
}
void Console::Init() {
this->InputBuffer = new char[MAX_BUFFER_SIZE];
strcpy(this->InputBuffer, "");
this->FilterBuffer = new char[MAX_BUFFER_SIZE];
strcpy(this->FilterBuffer, "");
this->Commands["help"] = { HelpCommand, "Shows all the commands" };
this->Commands["clear"] = { ClearCommand, "Clear the console history" };
this->Commands["bind"] = { BindCommand, "Binds key to commands" };
this->Commands["bind-toggle"] = { BindToggleCommand, "Bind key as a bool toggle" };
}
void Console::Update() {
for (auto [key, cmd] : Bindings) {
if (ImGui::IsKeyPressed(key)) Dispatch(cmd);
}
for (auto [key, var] : BindingToggle) {
if (ImGui::IsKeyPressed(key)) {
CVar* cvar = CVar_Get(var.c_str());
Dispatch("set " + var + " " + std::to_string(cvar == nullptr ? 0 : !static_cast<bool>(cvar->value.valueS32)));
} }
} }
} }
return CMD_SUCCESS;
}
static bool BindToggleCommand(const std::vector<std::string>& args) { void Console::Draw() {
if (args.size() > 2) { bool input_focus = false;
const ImGuiIO* io = &ImGui::GetIO();; if (!this->opened) return;
for (size_t k = 0; k < std::size(io->KeysData); k++) {
std::string key(ImGui::GetKeyName(k));
if (toLowerCase(args[1]) == toLowerCase(key)) { ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
BindingToggle[k] = args[2]; ImGui::Begin("Console", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
INFO("Binding toggle '%s' to %s", args[1].c_str(), BindingToggle[k].c_str());
break;
}
}
}
return CMD_SUCCESS;
}
std::string BuildUsage(const CommandEntry& entry) {
std::string usage;
for (const auto& arg : entry.arguments)
usage += StringHelper::Sprintf(arg.optional ? "[%s] " : "<%s> ", arg.info.c_str());
return usage;
}
void Console::Init() {
this->InputBuffer = new char[MAX_BUFFER_SIZE];
strcpy(this->InputBuffer, "");
this->FilterBuffer = new char[MAX_BUFFER_SIZE];
strcpy(this->FilterBuffer, "");
this->Commands["help"] = { HelpCommand, "Shows all the commands" };
this->Commands["clear"] = { ClearCommand, "Clear the console history" };
this->Commands["bind"] = { BindCommand, "Binds key to commands" };
this->Commands["bind-toggle"] = { BindToggleCommand, "Bind key as a bool toggle" };
}
void Console::Update() {
for(auto [key, cmd] : Bindings) {
if (ImGui::IsKeyPressed(key)) Dispatch(cmd);
}
for (auto [key, var] : BindingToggle) {
if (ImGui::IsKeyPressed(key)) {
CVar* cvar = CVar_Get(var.c_str());
Dispatch("set " + var + " " + std::to_string(cvar == nullptr ? 0 : !static_cast<bool>(cvar->value.valueS32)));
}
}
}
void Console::Draw() {
bool input_focus = false;
if (!this->opened) return;
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
ImGui::Begin("Console", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
const ImVec2 pos = ImGui::GetWindowPos(); const ImVec2 pos = ImGui::GetWindowPos();
const ImVec2 size = ImGui::GetWindowSize(); const ImVec2 size = ImGui::GetWindowSize();
// SohImGui::ShowCursor(ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows | ImGuiHoveredFlags_RectOnly), SohImGui::Dialogues::dConsole); // SohImGui::ShowCursor(ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows | ImGuiHoveredFlags_RectOnly), SohImGui::Dialogues::dConsole);
// Renders autocomplete window // Renders autocomplete window
if(this->OpenAutocomplete) { if (this->OpenAutocomplete) {
ImGui::SetNextWindowSize(ImVec2(350, std::min(static_cast<int>(this->Autocomplete.size()), 3) * 20.f), ImGuiCond_Once); ImGui::SetNextWindowSize(ImVec2(350, std::min(static_cast<int>(this->Autocomplete.size()), 3) * 20.f), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(pos.x + 8, pos.y + size.y - 1)); ImGui::SetNextWindowPos(ImVec2(pos.x + 8, pos.y + size.y - 1));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(3, 3)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(3, 3));
ImGui::Begin("##WndAutocomplete", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove ); ImGui::Begin("##WndAutocomplete", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove);
ImGui::BeginChild("AC_Child", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar); ImGui::BeginChild("AC_Child", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(.3f, .3f, .3f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(.3f, .3f, .3f, 1.0f));
if (ImGui::BeginTable("AC_History", 1)) { if (ImGui::BeginTable("AC_History", 1)) {
for (const auto &cmd : this->Autocomplete) { for (const auto& cmd : this->Autocomplete) {
std::string usage = BuildUsage(this->Commands[cmd]); std::string usage = BuildUsage(this->Commands[cmd]);
std::string preview = cmd + " - " + this->Commands[cmd].description; std::string preview = cmd + " - " + this->Commands[cmd].description;
std::string autocomplete = (usage == NULLSTR ? cmd : usage); std::string autocomplete = (usage == NULLSTR ? cmd : usage);
ImGui::TableNextRow(); ImGui::TableNextRow();
@ -186,53 +187,53 @@ void Console::Draw() {
// Renders console history // Renders console history
const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing(); const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), false, ImGuiWindowFlags_HorizontalScrollbar); ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), false, ImGuiWindowFlags_HorizontalScrollbar);
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(.3f, .3f, .3f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(.3f, .3f, .3f, 1.0f));
if (ImGui::BeginTable("History", 1)) { if (ImGui::BeginTable("History", 1)) {
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow))) if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)))
if (this->selectedId < (int)this->Log.size() - 1) ++this->selectedId; if (this->selectedId < (int)this->Log.size() - 1)++this->selectedId;
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow))) if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)))
if (this->selectedId > 0) --this->selectedId; if (this->selectedId > 0)--this->selectedId;
const std::vector<ConsoleLine> channel = this->Log[this->selected_channel]; const std::vector<ConsoleLine> channel = this->Log[this->selected_channel];
for (int i = 0; i < static_cast<int>(channel.size()); i++) { for (int i = 0; i < static_cast<int>(channel.size()); i++) {
ConsoleLine line = channel[i]; ConsoleLine line = channel[i];
if(!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue; if (!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue;
if(this->level_filter != NULLSTR && line.priority != (std::find(priority_filters.begin(), priority_filters.end(), this->level_filter) - priority_filters.begin()) - 1) continue; if (this->level_filter != NULLSTR && line.priority != (std::find(priority_filters.begin(), priority_filters.end(), this->level_filter) - priority_filters.begin()) - 1) continue;
std::string id = line.text + "##" + std::to_string(i); std::string id = line.text + "##" + std::to_string(i);
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
const bool is_selected = (this->selectedId == i) || std::find(this->selectedEntries.begin(), this->selectedEntries.end(), i) != this->selectedEntries.end(); const bool is_selected = (this->selectedId == i) || std::find(this->selectedEntries.begin(), this->selectedEntries.end(), i) != this->selectedEntries.end();
ImGui::PushStyleColor(ImGuiCol_Text, this->priority_colors[line.priority]); ImGui::PushStyleColor(ImGuiCol_Text, this->priority_colors[line.priority]);
if (ImGui::Selectable(id.c_str(), is_selected)) { if (ImGui::Selectable(id.c_str(), is_selected)) {
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftCtrl)) && !is_selected) if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftCtrl)) && !is_selected)
this->selectedEntries.push_back(i); this->selectedEntries.push_back(i);
else this->selectedEntries.clear(); else this->selectedEntries.clear();
this->selectedId = is_selected ? -1 : i; this->selectedId = is_selected ? -1 : i;
}
ImGui::PopStyleColor();
if (is_selected) ImGui::SetItemDefaultFocus();
} }
ImGui::EndTable(); ImGui::PopStyleColor();
if (is_selected) ImGui::SetItemDefaultFocus();
} }
ImGui::PopStyleColor(); ImGui::EndTable();
if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) }
ImGui::SetScrollHereY(1.0f); ImGui::PopStyleColor();
if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
ImGui::SetScrollHereY(1.0f);
ImGui::EndChild(); ImGui::EndChild();
// Renders input textfield // Renders input textfield
constexpr ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackEdit | constexpr ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackEdit |
ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory; ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory;
ImGui::PushItemWidth(-53); ImGui::PushItemWidth(-53);
if(ImGui::InputTextWithHint("##CMDInput", ">", this->InputBuffer, MAX_BUFFER_SIZE, flags, &Console::CallbackStub, this)) { if (ImGui::InputTextWithHint("##CMDInput", ">", this->InputBuffer, MAX_BUFFER_SIZE, flags, &Console::CallbackStub, this)) {
input_focus = true; input_focus = true;
if(this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') if (this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ')
this->Dispatch(std::string(this->InputBuffer)); this->Dispatch(std::string(this->InputBuffer));
memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); memset(this->InputBuffer, 0, MAX_BUFFER_SIZE);
} }
if(this->CMDHint != NULLSTR) { if (this->CMDHint != NULLSTR) {
if (ImGui::IsItemFocused()) { if (ImGui::IsItemFocused()) {
ImGui::SetNextWindowPos(ImVec2(pos.x, pos.y + size.y)); ImGui::SetNextWindowPos(ImVec2(pos.x, pos.y + size.y));
ImGui::SameLine(); ImGui::SameLine();
@ -246,38 +247,38 @@ void Console::Draw() {
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 50); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 50);
if(ImGui::Button("Submit") && !input_focus && this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' '){ if (ImGui::Button("Submit") && !input_focus && this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') {
this->Dispatch(std::string(this->InputBuffer)); this->Dispatch(std::string(this->InputBuffer));
memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); memset(this->InputBuffer, 0, MAX_BUFFER_SIZE);
} }
ImGui::SetItemDefaultFocus(); ImGui::SetItemDefaultFocus();
if (input_focus) ImGui::SetKeyboardFocusHere(-1); if (input_focus) ImGui::SetKeyboardFocusHere(-1);
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::End(); ImGui::End();
}
void Console::Dispatch(const std::string& line) {
this->CMDHint = NULLSTR;
this->History.push_back(line);
this->Log[this->selected_channel].push_back({ "> " + line } );
const std::vector<std::string> cmd_args = StringHelper::Split(line, " ");
if (this->Commands.contains(cmd_args[0])) {
const CommandEntry entry = this->Commands[cmd_args[0]];
if(!entry.handler(cmd_args) && !entry.arguments.empty())
this->Log[this->selected_channel].push_back({ "[SOH] Usage: " + cmd_args[0] + " " + BuildUsage(entry), ERROR_LVL});
return;
} }
this->Log[this->selected_channel].push_back({ "[SOH] Command not found", ERROR_LVL });
}
int Console::CallbackStub(ImGuiInputTextCallbackData* data) { void Console::Dispatch(const std::string& line) {
const auto instance = static_cast<Console*>(data->UserData); this->CMDHint = NULLSTR;
const bool empty_history = instance->History.empty(); this->History.push_back(line);
const int history_index = instance->HistoryIndex; this->Log[this->selected_channel].push_back({ "> " + line });
std::string history; const std::vector<std::string> cmd_args = StringHelper::Split(line, " ");
if (this->Commands.contains(cmd_args[0])) {
const CommandEntry entry = this->Commands[cmd_args[0]];
if (!entry.handler(cmd_args) && !entry.arguments.empty())
this->Log[this->selected_channel].push_back({ "[SOH] Usage: " + cmd_args[0] + " " + BuildUsage(entry), ERROR_LVL });
return;
}
this->Log[this->selected_channel].push_back({ "[SOH] Command not found", ERROR_LVL });
}
switch(data->EventKey) { int Console::CallbackStub(ImGuiInputTextCallbackData* data) {
const auto instance = static_cast<Console*>(data->UserData);
const bool empty_history = instance->History.empty();
const int history_index = instance->HistoryIndex;
std::string history;
switch (data->EventKey) {
case ImGuiKey_Tab: case ImGuiKey_Tab:
instance->Autocomplete.clear(); instance->Autocomplete.clear();
for (auto& [cmd, entry] : instance->Commands) for (auto& [cmd, entry] : instance->Commands)
@ -287,7 +288,7 @@ int Console::CallbackStub(ImGuiInputTextCallbackData* data) {
break; break;
case ImGuiKey_UpArrow: case ImGuiKey_UpArrow:
if (empty_history) break; if (empty_history) break;
if(history_index < static_cast<int>(instance->History.size()) - 1) instance->HistoryIndex += 1; if (history_index < static_cast<int>(instance->History.size()) - 1) instance->HistoryIndex += 1;
data->DeleteChars(0, data->BufTextLen); data->DeleteChars(0, data->BufTextLen);
data->InsertChars(0, instance->History[instance->HistoryIndex].c_str()); data->InsertChars(0, instance->History[instance->HistoryIndex].c_str());
instance->CMDHint = NULLSTR; instance->CMDHint = NULLSTR;
@ -296,7 +297,7 @@ int Console::CallbackStub(ImGuiInputTextCallbackData* data) {
if (empty_history) break; if (empty_history) break;
if (history_index > -1) instance->HistoryIndex -= 1; if (history_index > -1) instance->HistoryIndex -= 1;
data->DeleteChars(0, data->BufTextLen); data->DeleteChars(0, data->BufTextLen);
if(history_index >= 0) if (history_index >= 0)
data->InsertChars(0, instance->History[history_index].c_str()); data->InsertChars(0, instance->History[history_index].c_str());
instance->CMDHint = NULLSTR; instance->CMDHint = NULLSTR;
break; break;
@ -316,16 +317,17 @@ int Console::CallbackStub(ImGuiInputTextCallbackData* data) {
} }
instance->CMDHint = NULLSTR; instance->CMDHint = NULLSTR;
} }
}
return 0;
} }
return 0;
}
void Console::Append(const std::string& channel, Priority priority, const char* fmt, ...) { void Console::Append(const std::string& channel, Priority priority, const char* fmt, ...) {
char buf[1024]; char buf[1024];
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);
buf[IM_ARRAYSIZE(buf) - 1] = 0; buf[IM_ARRAYSIZE(buf) - 1] = 0;
va_end(args); va_end(args);
this->Log[channel].push_back({ std::string(buf), priority }); this->Log[channel].push_back({ std::string(buf), priority });
} }
}

View File

@ -7,75 +7,77 @@
#include "Lib/ImGui/imgui.h" #include "Lib/ImGui/imgui.h"
#define LOG(msg, ...) SohImGui::console->Append("Main", Priority::LOG_LVL, msg, ##__VA_ARGS__) namespace Ship {
#define INFO(msg, ...) SohImGui::console->Append("Main", Priority::INFO_LVL, msg, ##__VA_ARGS__) #define LOG(msg, ...) SohImGui::console->Append("Main", Ship::Priority::LOG_LVL, msg, ##__VA_ARGS__)
#define WARNING(msg, ...) SohImGui::console->Append("Main", Priority::WARNING_LVL, msg, ##__VA_ARGS__) #define INFO(msg, ...) SohImGui::console->Append("Main", Ship::Priority::INFO_LVL, msg, ##__VA_ARGS__)
#define ERROR(msg, ...) SohImGui::console->Append("Main", Priority::ERROR_LVL, msg, ##__VA_ARGS__) #define WARNING(msg, ...) SohImGui::console->Append("Main", Ship::Priority::WARNING_LVL, msg, ##__VA_ARGS__)
#define CMD_SUCCESS true #define ERROR(msg, ...) SohImGui::console->Append("Main", Ship::Priority::ERROR_LVL, msg, ##__VA_ARGS__)
#define CMD_FAILED false #define CMD_SUCCESS true
#define MAX_BUFFER_SIZE 255 #define CMD_FAILED false
#define NULLSTR "None" #define MAX_BUFFER_SIZE 255
#define NULLSTR "None"
typedef std::function<bool(std::vector<std::string> args)> CommandHandler; typedef std::function<bool(std::vector<std::string> args)> CommandHandler;
enum Priority { enum Priority {
INFO_LVL, INFO_LVL,
LOG_LVL, LOG_LVL,
WARNING_LVL, WARNING_LVL,
ERROR_LVL ERROR_LVL
};
enum class ArgumentType {
TEXT, NUMBER, PLAYER_POS, PLAYER_ROT
};
struct CommandArgument {
std::string info;
ArgumentType type = ArgumentType::NUMBER;
bool optional = false;
};
struct CommandEntry {
CommandHandler handler;
std::string description;
std::vector<CommandArgument> arguments;
};
struct ConsoleLine {
std::string text;
Priority priority = Priority::INFO_LVL;
std::string channel = "Main";
};
class Console {
int selectedId = -1;
std::vector<int> selectedEntries;
std::string filter;
std::string level_filter = NULLSTR;
std::vector<std::string> log_channels = { "Main", "SoH Logging"};
std::vector<std::string> priority_filters = { "None", "Info", "Log", "Warning", "Error" };
std::vector<ImVec4> priority_colors = {
ImVec4(1.0f, 1.0f, 1.0f, 1.0f),
ImVec4(0.2f, 1.0f, 0.2f, 1.0f),
ImVec4(0.9f, 0.8f, 0.4f, 0.01f),
ImVec4(1.0f, 0.2f, 0.2f, 1.0f)
}; };
public:
std::map<std::string, std::vector<ConsoleLine>> Log; enum class ArgumentType {
std::map<std::string, CommandEntry> Commands; TEXT, NUMBER, PLAYER_POS, PLAYER_ROT
std::vector<std::string> Autocomplete; };
std::vector<std::string> History;
std::string CMDHint = NULLSTR; struct CommandArgument {
char* FilterBuffer = nullptr; std::string info;
char* InputBuffer = nullptr; ArgumentType type = ArgumentType::NUMBER;
bool OpenAutocomplete = false; bool optional = false;
int HistoryIndex = -1; };
std::string selected_channel = "Main";
bool opened = false; struct CommandEntry {
void Init(); CommandHandler handler;
void Update(); std::string description;
void Draw(); std::vector<CommandArgument> arguments;
void Append(const std::string& channel, Priority priority, const char* fmt, ...) IM_FMTARGS(4); };
void Dispatch(const std::string& line);
static int CallbackStub(ImGuiInputTextCallbackData* data); struct ConsoleLine {
}; std::string text;
Priority priority = Priority::INFO_LVL;
std::string channel = "Main";
};
class Console {
int selectedId = -1;
std::vector<int> selectedEntries;
std::string filter;
std::string level_filter = NULLSTR;
std::vector<std::string> log_channels = { "Main", "SoH Logging" };
std::vector<std::string> priority_filters = { "None", "Info", "Log", "Warning", "Error" };
std::vector<ImVec4> priority_colors = {
ImVec4(1.0f, 1.0f, 1.0f, 1.0f),
ImVec4(0.2f, 1.0f, 0.2f, 1.0f),
ImVec4(0.9f, 0.8f, 0.4f, 0.01f),
ImVec4(1.0f, 0.2f, 0.2f, 1.0f)
};
public:
std::map<std::string, std::vector<ConsoleLine>> Log;
std::map<std::string, CommandEntry> Commands;
std::vector<std::string> Autocomplete;
std::vector<std::string> History;
std::string CMDHint = NULLSTR;
char* FilterBuffer = nullptr;
char* InputBuffer = nullptr;
bool OpenAutocomplete = false;
int HistoryIndex = -1;
std::string selected_channel = "Main";
bool opened = false;
void Init();
void Update();
void Draw();
void Append(const std::string& channel, Priority priority, const char* fmt, ...) IM_FMTARGS(4);
void Dispatch(const std::string& line);
static int CallbackStub(ImGuiInputTextCallbackData* data);
};
}

View File

@ -7,148 +7,170 @@
#include "SDLController.h" #include "SDLController.h"
#include <Utils/StringHelper.h> #include <Utils/StringHelper.h>
uint8_t* controllerBits; namespace Ship {
uint8_t* controllerBits;
void Ship::ControlDeck::Init(uint8_t* bits) { void ControlDeck::Init(uint8_t* bits) {
ScanPhysicalDevices(); ScanPhysicalDevices();
controllerBits = bits; controllerBits = bits;
} }
void Ship::ControlDeck::ScanPhysicalDevices() { void ControlDeck::ScanPhysicalDevices() {
virtualDevices.clear(); virtualDevices.clear();
physicalDevices.clear(); physicalDevices.clear();
for (int i = 0; i < SDL_NumJoysticks(); i++) { for (int i = 0; i < SDL_NumJoysticks(); i++) {
if (SDL_IsGameController(i)) { if (SDL_IsGameController(i)) {
auto sdl = std::make_shared<SDLController>(i); auto sdl = std::make_shared<SDLController>(i);
sdl->Open(); sdl->Open();
physicalDevices.push_back(sdl); physicalDevices.push_back(sdl);
} }
} }
physicalDevices.push_back(std::make_shared<VirtualController>("Auto", "Auto", true)); physicalDevices.push_back(std::make_shared<VirtualController>("Auto", "Auto", true));
physicalDevices.push_back(std::make_shared<KeyboardController>()); physicalDevices.push_back(std::make_shared<KeyboardController>());
physicalDevices.push_back(std::make_shared<VirtualController>("Disconnected", "None", false)); physicalDevices.push_back(std::make_shared<VirtualController>("Disconnected", "None", false));
for (const auto& device : physicalDevices) { for (const auto& device : physicalDevices) {
for (int i = 0; i < MAXCONTROLLERS; i++) { for (int i = 0; i < MAXCONTROLLERS; i++) {
device->CreateDefaultBinding(i); device->CreateDefaultBinding(i);
} }
} }
for (int i = 0; i < MAXCONTROLLERS; i++) { for (int i = 0; i < MAXCONTROLLERS; i++) {
virtualDevices.push_back(i == 0 ? 0 : static_cast<int>(physicalDevices.size()) - 1); virtualDevices.push_back(i == 0 ? 0 : static_cast<int>(physicalDevices.size()) - 1);
} }
LoadControllerSettings(); LoadControllerSettings();
} }
void Ship::ControlDeck::SetPhysicalDevice(int slot, int deviceSlot) { void ControlDeck::SetPhysicalDevice(int slot, int deviceSlot) {
const std::shared_ptr<Controller> backend = physicalDevices[deviceSlot]; const std::shared_ptr<Controller> backend = physicalDevices[deviceSlot];
virtualDevices[slot] = deviceSlot; virtualDevices[slot] = deviceSlot;
*controllerBits |= (backend->Connected()) << slot; *controllerBits |= (backend->Connected()) << slot;
} }
void Ship::ControlDeck::WriteToPad(OSContPad* pad) const { void ControlDeck::WriteToPad(OSContPad* pad) const {
for (size_t i = 0; i < virtualDevices.size(); i++) { for (size_t i = 0; i < virtualDevices.size(); i++) {
const std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]]; const std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]];
if (backend->GetGuid() == "Auto") { if (backend->GetGuid() == "Auto") {
for (const auto& device : physicalDevices) { for (const auto& device : physicalDevices) {
device->Read(&pad[i], i); device->Read(&pad[i], i);
} }
continue; continue;
} }
backend->Read(&pad[i], i); backend->Read(&pad[i], i);
} }
} }
#define NESTED(key, ...) StringHelper::Sprintf("Controllers.%s.Slot_%d." key, device->GetGuid().c_str(), slot, __VA_ARGS__) #define NESTED(key, ...) StringHelper::Sprintf("Controllers.%s.Slot_%d." key, device->GetGuid().c_str(), slot, __VA_ARGS__)
void Ship::ControlDeck::LoadControllerSettings() { void ControlDeck::LoadControllerSettings() {
std::shared_ptr<Mercury> Config = GlobalCtx2::GetInstance()->GetConfig(); std::shared_ptr<Mercury> Config = GlobalCtx2::GetInstance()->GetConfig();
for (auto const& val : Config->rjson["Controllers"]["Deck"].items()) { for (auto const& val : Config->rjson["Controllers"]["Deck"].items()) {
int slot = std::stoi(val.key().substr(5)); int slot = std::stoi(val.key().substr(5));
for (size_t dev = 0; dev < physicalDevices.size(); dev++) { for (size_t dev = 0; dev < physicalDevices.size(); dev++) {
std::string guid = physicalDevices[dev]->GetGuid(); std::string guid = physicalDevices[dev]->GetGuid();
if(guid != val.value()) continue; if (guid != val.value()) continue;
virtualDevices[slot] = dev; virtualDevices[slot] = dev;
} }
} }
for (size_t i = 0; i < virtualDevices.size(); i++) { for (size_t i = 0; i < virtualDevices.size(); i++) {
std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]]; std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]];
Config->setString(StringHelper::Sprintf("Controllers.Deck.Slot_%d", (int)i), backend->GetGuid()); Config->setString(StringHelper::Sprintf("Controllers.Deck.Slot_%d", (int)i), backend->GetGuid());
} }
for (const auto& device : physicalDevices) { for (const auto& device : physicalDevices) {
std::string guid = device->GetGuid(); std::string guid = device->GetGuid();
for (int slot = 0; slot < MAXCONTROLLERS; slot++) { for (int slot = 0; slot < MAXCONTROLLERS; slot++) {
if (!(Config->rjson["Controllers"].contains(guid) && Config->rjson["Controllers"][guid].contains(StringHelper::Sprintf("Slot_%d", slot)))) continue; if (!(Config->rjson["Controllers"].contains(guid) && Config->rjson["Controllers"][guid].contains(StringHelper::Sprintf("Slot_%d", slot)))) continue;
auto& profile = device->profiles[slot]; auto& profile = device->profiles[slot];
auto rawProfile = Config->rjson["Controllers"][guid][StringHelper::Sprintf("Slot_%d", slot)]; auto rawProfile = Config->rjson["Controllers"][guid][StringHelper::Sprintf("Slot_%d", slot)];
profile.Mappings.clear(); profile.Mappings.clear();
profile.Thresholds.clear(); profile.Thresholds.clear();
profile.UseRumble = Config->getBool(NESTED("Rumble.Enabled", "")); profile.UseRumble = Config->getBool(NESTED("Rumble.Enabled", ""));
profile.RumbleStrength = Config->getFloat(NESTED("Rumble.Strength", "")); profile.RumbleStrength = Config->getFloat(NESTED("Rumble.Strength", ""));
profile.UseGyro = Config->getBool(NESTED("Gyro.Enabled", "")); profile.UseGyro = Config->getBool(NESTED("Gyro.Enabled", ""));
for (auto const& val : rawProfile["Thresholds"].items()) { for (auto const& val : rawProfile["Thresholds"].items()) {
profile.Thresholds[static_cast<ControllerThresholds>(std::stoi(val.key()))] = val.value(); profile.Thresholds[static_cast<ControllerThresholds>(std::stoi(val.key()))] = val.value();
} }
for (auto const& val : rawProfile["Mappings"].items()) { for (auto const& val : rawProfile["Mappings"].items()) {
device->SetButtonMapping(slot, std::stoi(val.key().substr(4)), val.value()); device->SetButtonMapping(slot, std::stoi(val.key().substr(4)), val.value());
} }
} }
} }
} }
void Ship::ControlDeck::SaveControllerSettings() { void ControlDeck::SaveControllerSettings() {
std::shared_ptr<Mercury> Config = GlobalCtx2::GetInstance()->GetConfig(); std::shared_ptr<Mercury> Config = GlobalCtx2::GetInstance()->GetConfig();
for (size_t i = 0; i < virtualDevices.size(); i++) { for (size_t i = 0; i < virtualDevices.size(); i++) {
std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]]; std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]];
Config->setString(StringHelper::Sprintf("Controllers.Deck.Slot_%d", (int)i), backend->GetGuid()); Config->setString(StringHelper::Sprintf("Controllers.Deck.Slot_%d", (int)i), backend->GetGuid());
} }
for (const auto& device : physicalDevices) { for (const auto& device : physicalDevices) {
int slot = 0; int slot = 0;
std::string guid = device->GetGuid(); std::string guid = device->GetGuid();
for (const auto& profile : device->profiles) { for (const auto& profile : device->profiles) {
if (!device->Connected()) continue; if (!device->Connected()) continue;
auto rawProfile = Config->rjson["Controllers"][guid][StringHelper::Sprintf("Slot_%d", slot)]; auto rawProfile = Config->rjson["Controllers"][guid][StringHelper::Sprintf("Slot_%d", slot)];
Config->setBool(NESTED("Rumble.Enabled", ""), profile.UseRumble); Config->setBool(NESTED("Rumble.Enabled", ""), profile.UseRumble);
Config->setFloat(NESTED("Rumble.Strength", ""), profile.RumbleStrength); Config->setFloat(NESTED("Rumble.Strength", ""), profile.RumbleStrength);
Config->setBool(NESTED("Gyro.Enabled", ""), profile.UseGyro); Config->setBool(NESTED("Gyro.Enabled", ""), profile.UseGyro);
for (auto const& val : rawProfile["Mappings"].items()) { for (auto const& val : rawProfile["Mappings"].items()) {
Config->setInt(NESTED("Mappings.%s", val.key().c_str()), -1); Config->setInt(NESTED("Mappings.%s", val.key().c_str()), -1);
} }
for (auto const& [key, val] : profile.Thresholds) { for (auto const& [key, val] : profile.Thresholds) {
Config->setFloat(NESTED("Thresholds.%d", key), val); Config->setFloat(NESTED("Thresholds.%d", key), val);
} }
for (auto const& [key, val] : profile.Mappings) { for (auto const& [key, val] : profile.Mappings) {
Config->setInt(NESTED("Mappings.BTN_%d", val), key); Config->setInt(NESTED("Mappings.BTN_%d", val), key);
} }
slot++; slot++;
} }
} }
Config->save(); Config->save();
} }
std::shared_ptr<Controller> ControlDeck::GetPhysicalDevice(int deviceSlot) {
return physicalDevices[deviceSlot];
}
size_t ControlDeck::GetNumPhysicalDevices() {
return physicalDevices.size();
}
int ControlDeck::GetVirtualDevice(int slot) {
return virtualDevices[slot];
}
size_t ControlDeck::GetNumVirtualDevices() {
return virtualDevices.size();
}
std::shared_ptr<Controller> ControlDeck::GetPhysicalDeviceFromVirtualSlot(int slot) {
return GetPhysicalDevice(GetVirtualDevice(slot));
}
}

View File

@ -2,19 +2,24 @@
#include "Controller.h" #include "Controller.h"
#include <vector> #include <vector>
#include <string>
namespace Ship { namespace Ship {
class ControlDeck { class ControlDeck {
public: public:
std::vector<int> virtualDevices;
std::vector<std::shared_ptr<Controller>> physicalDevices = {};
void Init(uint8_t* controllerBits); void Init(uint8_t* controllerBits);
void ScanPhysicalDevices(); void ScanPhysicalDevices();
void WriteToPad(OSContPad* pad) const; void WriteToPad(OSContPad* pad) const;
void LoadControllerSettings(); void LoadControllerSettings();
void SaveControllerSettings(); void SaveControllerSettings();
void SetPhysicalDevice(int slot, int deviceSlot); void SetPhysicalDevice(int slot, int deviceSlot);
std::shared_ptr<Ship::Controller> GetPhysicalDevice(int deviceSlot);
std::shared_ptr<Ship::Controller> GetPhysicalDeviceFromVirtualSlot(int slot);
size_t GetNumPhysicalDevices();
int GetVirtualDevice(int slot);
size_t GetNumVirtualDevices();
private:
std::vector<int> virtualDevices;
std::vector<std::shared_ptr<Controller>> physicalDevices = {};
}; };
} }

View File

@ -1,11 +1,9 @@
#include "Cvar.h" #include "Cvar.h"
#include <map> #include <map>
#include <string> #include <string.h>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include <PR/ultra64/gbi.h>
#include "imgui_internal.h"
std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars; std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
@ -96,7 +94,7 @@ extern "C" void CVar_SetS32(const char* name, int32_t value) {
cvar->value.valueS32 = value; cvar->value.valueS32 = value;
} }
void CVar_SetFloat(const char* name, float value) { extern "C" void CVar_SetFloat(const char* name, float value) {
auto& cvar = cvars[name]; auto& cvar = cvars[name];
if (!cvar) { if (!cvar) {
cvar = std::make_unique<CVar>(); cvar = std::make_unique<CVar>();
@ -111,7 +109,11 @@ extern "C" void CVar_SetString(const char* name, const char* value) {
cvar = std::make_unique<CVar>(); cvar = std::make_unique<CVar>();
} }
cvar->type = CVarType::String; cvar->type = CVarType::String;
cvar->value.valueStr = value; #ifdef _MSC_VER
cvar->value.valueStr = _strdup(value);
#else
cvar->value.valueStr = strdup(value);
#endif
} }
extern "C" void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue) { extern "C" void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue) {

View File

@ -32,14 +32,13 @@ extern "C" CVar * CVar_Get(const char* name);
extern "C" extern "C"
{ {
#endif #endif
//#include <ultra64.h>
int32_t CVar_GetS32(const char* name, int32_t defaultValue); int32_t CVar_GetS32(const char* name, int32_t defaultValue);
float CVar_GetFloat(const char* name, float defaultValue); float CVar_GetFloat(const char* name, float defaultValue);
void CVar_SetFloat(const char* name, float value);
const char* CVar_GetString(const char* name, const char* defaultValue); const char* CVar_GetString(const char* name, const char* defaultValue);
void CVar_SetS32(const char* name, int32_t value); void CVar_SetS32(const char* name, int32_t value);
void CVar_SetString(const char* name, const char* value); void CVar_SetString(const char* name, const char* value);
Color_RGB8 CVar_GetRGB(const char* name, Color_RGB8 defaultValue); Color_RGB8 CVar_GetRGB(const char* name, Color_RGB8 defaultValue);
Color_RGBA8 CVar_GetRGBA(const char* name, Color_RGBA8 defaultValue); Color_RGBA8 CVar_GetRGBA(const char* name, Color_RGBA8 defaultValue);
void CVar_SetRGBA(const char* name, Color_RGBA8 value); void CVar_SetRGBA(const char* name, Color_RGBA8 value);
@ -56,11 +55,8 @@ void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue);
#ifdef __cplusplus #ifdef __cplusplus
#include <map> #include <map>
#include <string> #include <string>
#include <functional>
#include <memory> #include <memory>
//extern "C" CVar * CVar_Get(const char* name);
extern std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars; extern std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
void CVar_SetFloat(const char* name, float value);
#endif #endif
#endif #endif

View File

@ -1,16 +0,0 @@
#include "Environment.h"
#include <map>
#include <string>
std::map<std::string, std::string> environmentVars;
namespace SohUtils {
void saveEnvironmentVar(const std::string& key, const std::string& value) {
environmentVars[key] = value;
}
std::string getEnvironmentVar(const std::string& key) {
return environmentVars[key];
}
}

View File

@ -1,8 +0,0 @@
#pragma once
#include <string>
namespace SohUtils {
void saveEnvironmentVar(const std::string& key, const std::string& value);
std::string getEnvironmentVar(const std::string& key);
}

View File

@ -6,223 +6,229 @@
#include "ResourceMgr.h" #include "ResourceMgr.h"
#include "Console.h" #include "Console.h"
#include "ImGuiImpl.h" #include "ImGuiImpl.h"
#include "TextureMod.h"
#include "Lib/ImGui/imgui_internal.h" #include "Lib/ImGui/imgui_internal.h"
#include "Utils/StringHelper.h" #include "Utils/StringHelper.h"
void Ship::GameOverlay::LoadFont(const std::string& name, const std::string& path, float fontSize) { namespace Ship {
ImGuiIO& io = ImGui::GetIO(); void GameOverlay::LoadFont(const std::string& name, const std::string& path, float fontSize) {
std::shared_ptr<Archive> base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive(); ImGuiIO& io = ImGui::GetIO();
std::shared_ptr<File> font = std::make_shared<File>(); std::shared_ptr<Archive> base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive();
base->LoadFile(path, false, font); std::shared_ptr<File> font = std::make_shared<File>();
if (font->bIsLoaded) { base->LoadFile(path, false, font);
char* font_data = new char[font->dwBufferSize]; if (font->bIsLoaded) {
memcpy(font_data, font->buffer.get(), font->dwBufferSize); char* font_data = new char[font->dwBufferSize];
Fonts[name] = io.Fonts->AddFontFromMemoryTTF(font_data, font->dwBufferSize, fontSize); memcpy(font_data, font->buffer.get(), font->dwBufferSize);
Fonts[name] = io.Fonts->AddFontFromMemoryTTF(font_data, font->dwBufferSize, fontSize);
}
} }
}
void Ship::GameOverlay::TextDraw(float x, float y, bool shadow, ImVec4 color, const char* fmt, ...) { void GameOverlay::TextDraw(float x, float y, bool shadow, ImVec4 color, const char* fmt, ...) {
char buf[1024]; char buf[1024];
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);
buf[IM_ARRAYSIZE(buf) - 1] = 0; buf[IM_ARRAYSIZE(buf) - 1] = 0;
va_end(args); va_end(args);
ImGui::PushStyleColor(ImGuiCol_Text, color); ImGui::PushStyleColor(ImGuiCol_Text, color);
ImGui::PushFont(Fonts[this->CurrentFont]); ImGui::PushFont(Fonts[this->CurrentFont]);
if (shadow) { if (shadow) {
ImGui::SetCursorPos(ImVec2(x + 1, y + 1)); ImGui::SetCursorPos(ImVec2(x + 1, y + 1));
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(.0f, .0f, .0f, color.w)); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(.0f, .0f, .0f, color.w));
ImGui::Text(buf, args);
}
ImGui::PopStyleColor();
ImGui::SetCursorPos(ImVec2(x, y));
ImGui::Text(buf, args); ImGui::Text(buf, args);
ImGui::PopFont();
ImGui::PopStyleColor();
} }
ImGui::PopStyleColor();
ImGui::SetCursorPos(ImVec2(x, y));
ImGui::Text(buf, args);
ImGui::PopFont();
ImGui::PopStyleColor();
}
void Ship::GameOverlay::TextDrawNotification(float duration, bool shadow, const char* fmt, ...) { void GameOverlay::TextDrawNotification(float duration, bool shadow, const char* fmt, ...) {
char buf[1024]; char buf[1024];
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args);
buf[IM_ARRAYSIZE(buf) - 1] = 0; buf[IM_ARRAYSIZE(buf) - 1] = 0;
va_end(args); va_end(args);
this->RegisteredOverlays[StringHelper::Sprintf("NotificationID:%d%d", rand(), this->RegisteredOverlays.size())] = new Overlay({ OverlayType::NOTIFICATION, ImStrdup(buf), duration, duration }); this->RegisteredOverlays[StringHelper::Sprintf("NotificationID:%d%d", rand(), this->RegisteredOverlays.size())] = new Overlay({ OverlayType::NOTIFICATION, ImStrdup(buf), duration, duration });
NeedsCleanup = true; NeedsCleanup = true;
}
void Ship::GameOverlay::CleanupNotifications() {
if(!NeedsCleanup) return;
for (auto it = this->RegisteredOverlays.begin(); it != this->RegisteredOverlays.end(); ) {
if (it->second->type == OverlayType::NOTIFICATION && it->second->duration <= 0.0f) {
it = this->RegisteredOverlays.erase(it);
} else {
++it;
}
} }
NeedsCleanup = false;
}
float Ship::GameOverlay::GetScreenWidth() { void GameOverlay::CleanupNotifications() {
const ImGuiViewport* viewport = ImGui::GetMainViewport(); if (!NeedsCleanup) return;
return viewport->Size.x; for (auto it = this->RegisteredOverlays.begin(); it != this->RegisteredOverlays.end(); ) {
} if (it->second->type == OverlayType::NOTIFICATION && it->second->duration <= 0.0f) {
it = this->RegisteredOverlays.erase(it);
float Ship::GameOverlay::GetScreenHeight() {
const ImGuiViewport* viewport = ImGui::GetMainViewport();
return viewport->Size.y;
}
float Ship::GameOverlay::GetStringWidth(const char* text) {
return CalculateTextSize(text).x;
}
ImVec2 Ship::GameOverlay::CalculateTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width) {
ImGuiContext& g = *GImGui;
const char* text_display_end;
if (hide_text_after_double_hash)
text_display_end = ImGui::FindRenderedTextEnd(text, text_end); // Hide anything after a '##' string
else
text_display_end = text_end;
GameOverlay* overlay = SohImGui::overlay;
ImFont* font = overlay->CurrentFont == "Default" ? g.Font : overlay->Fonts[overlay->CurrentFont];
const float font_size = font->FontSize;
if (text == text_display_end)
return ImVec2(0.0f, font_size);
ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);
// Round
// FIXME: This has been here since Dec 2015 (7b0bf230) but down the line we want this out.
// FIXME: Investigate using ceilf or e.g.
// - https://git.musl-libc.org/cgit/musl/tree/src/math/ceilf.c
// - https://embarkstudios.github.io/rust-gpu/api/src/libm/math/ceilf.rs.html
text_size.x = IM_FLOOR(text_size.x + 0.99999f);
return text_size;
}
void Ship::GameOverlay::Init() {
this->LoadFont("Press Start 2P", "assets/ship_of_harkinian/fonts/PressStart2P-Regular.ttf", 12.0f);
this->LoadFont("Fipps", "assets/ship_of_harkinian/fonts/Fipps-Regular.otf", 32.0f);
const std::string DefaultFont = this->Fonts.begin()->first;
if(!this->Fonts.empty()) {
const std::string font = CVar_GetString("gOverlayFont", ImStrdup(DefaultFont.c_str()));
for (auto& [name, _] : this->Fonts) {
if (font.starts_with(name)) {
this->CurrentFont = name;
break;
} }
this->CurrentFont = DefaultFont; else {
} ++it;
}
SohImGui::console->Commands["overlay"] = { OverlayCommand, "Draw an overlay using a cvar value" };
}
void Ship::GameOverlay::DrawSettings() {
ImGui::Text("Overlays Text Font");
if (ImGui::BeginCombo("##TextFont", this->CurrentFont.c_str())) {
for (auto& [name, font] : this->Fonts) {
if (ImGui::Selectable(name.c_str(), name == this->CurrentFont)) {
this->CurrentFont = name;
CVar_SetString("gOverlayFont", ImStrdup(name.c_str()));
SohImGui::needs_save = true;
} }
}
ImGui::EndCombo();
}
}
void Ship::GameOverlay::Draw() {
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos, ImGuiCond_Always);
ImGui::SetNextWindowSize(viewport->Size, ImGuiCond_Always);
ImGui::Begin("SoHOverlay", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBackground |
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoInputs);
this->CleanupNotifications();
float textY = 50;
float notY = 0;
for (auto &[key, overlay] : this->RegisteredOverlays) {
if (overlay->type == OverlayType::TEXT) {
const char* text = ImStrdup(overlay->value);
const CVar* var = CVar_Get(text);
ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
switch (var->type) {
case CVarType::Float:
this->TextDraw(30, textY, true, color, "%s %.2f", text, var->value.valueFloat);
break;
case CVarType::S32:
this->TextDraw(30, textY, true, color, "%s %d", text, var->value.valueS32);
break;
case CVarType::String:
this->TextDraw(30, textY, true, color, "%s %s", text, var->value.valueStr);
break;
case CVarType::RGBA:
this->TextDraw(30, textY, true, color, "#%08X", text, var->value.valueRGBA);
break;
}
free((void*) text);
textY += 30;
}
if (overlay->type == OverlayType::NOTIFICATION && overlay->duration > 0) {
const char* text = overlay->value;
const float duration = overlay->duration / overlay->fadeTime;
const ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, duration);
const float textWidth = this->GetStringWidth(overlay->value);
this->TextDraw(GetScreenWidth() - textWidth - 40, GetScreenHeight() - 40 - notY, true, color, text);
notY += 30;
overlay->duration -= .05f;
} }
NeedsCleanup = false;
} }
ImGui::End(); float GameOverlay::GetScreenWidth() {
} const ImGuiViewport* viewport = ImGui::GetMainViewport();
return viewport->Size.x;
bool Ship::OverlayCommand(const std::vector<std::string>& args) {
if (args.size() < 3) {
return CMD_FAILED;
} }
if (CVar_Get(args[2].c_str()) != nullptr) { float GameOverlay::GetScreenHeight() {
const char* key = args[2].c_str(); const ImGuiViewport* viewport = ImGui::GetMainViewport();
return viewport->Size.y;
}
float GameOverlay::GetStringWidth(const char* text) {
return CalculateTextSize(text).x;
}
ImVec2 GameOverlay::CalculateTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width) {
ImGuiContext& g = *GImGui;
const char* text_display_end;
if (hide_text_after_double_hash)
text_display_end = ImGui::FindRenderedTextEnd(text, text_end); // Hide anything after a '##' string
else
text_display_end = text_end;
GameOverlay* overlay = SohImGui::overlay; GameOverlay* overlay = SohImGui::overlay;
if (args[1] == "add") {
if (!overlay->RegisteredOverlays.contains(key)) { ImFont* font = overlay->CurrentFont == "Default" ? g.Font : overlay->Fonts[overlay->CurrentFont];
overlay->RegisteredOverlays[key] = new Overlay({ OverlayType::TEXT, ImStrdup(key), -1.0f }); const float font_size = font->FontSize;
INFO("Added overlay: %s ", key); if (text == text_display_end)
} else { return ImVec2(0.0f, font_size);
ERROR("Overlay already exists: %s", key); ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);
}
} else if (args[1] == "remove") { // Round
if (overlay->RegisteredOverlays.contains(key)) { // FIXME: This has been here since Dec 2015 (7b0bf230) but down the line we want this out.
overlay->RegisteredOverlays.erase(key); // FIXME: Investigate using ceilf or e.g.
INFO("Removed overlay: %s ", key); // - https://git.musl-libc.org/cgit/musl/tree/src/math/ceilf.c
} else { // - https://embarkstudios.github.io/rust-gpu/api/src/libm/math/ceilf.rs.html
ERROR("Overlay not found: %s ", key); text_size.x = IM_FLOOR(text_size.x + 0.99999f);
}
} return text_size;
} else {
ERROR("CVar %s does not exist", args[2].c_str());
} }
return CMD_SUCCESS; void GameOverlay::Init() {
} this->LoadFont("Press Start 2P", "assets/ship_of_harkinian/fonts/PressStart2P-Regular.ttf", 12.0f);
this->LoadFont("Fipps", "assets/ship_of_harkinian/fonts/Fipps-Regular.otf", 32.0f);
const std::string DefaultFont = this->Fonts.begin()->first;
if (!this->Fonts.empty()) {
const std::string font = CVar_GetString("gOverlayFont", ImStrdup(DefaultFont.c_str()));
for (auto& [name, _] : this->Fonts) {
if (font.starts_with(name)) {
this->CurrentFont = name;
break;
}
this->CurrentFont = DefaultFont;
}
}
SohImGui::console->Commands["overlay"] = { OverlayCommand, "Draw an overlay using a cvar value" };
}
void GameOverlay::DrawSettings() {
ImGui::Text("Overlays Text Font");
if (ImGui::BeginCombo("##TextFont", this->CurrentFont.c_str())) {
for (auto& [name, font] : this->Fonts) {
if (ImGui::Selectable(name.c_str(), name == this->CurrentFont)) {
this->CurrentFont = name;
CVar_SetString("gOverlayFont", ImStrdup(name.c_str()));
SohImGui::needs_save = true;
}
}
ImGui::EndCombo();
}
}
void GameOverlay::Draw() {
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos, ImGuiCond_Always);
ImGui::SetNextWindowSize(viewport->Size, ImGuiCond_Always);
ImGui::Begin("SoHOverlay", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBackground |
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoInputs);
this->CleanupNotifications();
float textY = 50;
float notY = 0;
for (auto& [key, overlay] : this->RegisteredOverlays) {
if (overlay->type == OverlayType::TEXT) {
const char* text = ImStrdup(overlay->value);
const CVar* var = CVar_Get(text);
ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
switch (var->type) {
case CVarType::Float:
this->TextDraw(30, textY, true, color, "%s %.2f", text, var->value.valueFloat);
break;
case CVarType::S32:
this->TextDraw(30, textY, true, color, "%s %d", text, var->value.valueS32);
break;
case CVarType::String:
this->TextDraw(30, textY, true, color, "%s %s", text, var->value.valueStr);
break;
case CVarType::RGBA:
this->TextDraw(30, textY, true, color, "#%08X", text, var->value.valueRGBA);
break;
}
free((void*)text);
textY += 30;
}
if (overlay->type == OverlayType::NOTIFICATION && overlay->duration > 0) {
const char* text = overlay->value;
const float duration = overlay->duration / overlay->fadeTime;
const ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, duration);
const float textWidth = this->GetStringWidth(overlay->value);
this->TextDraw(GetScreenWidth() - textWidth - 40, GetScreenHeight() - 40 - notY, true, color, text);
notY += 30;
overlay->duration -= .05f;
}
}
ImGui::End();
}
bool OverlayCommand(const std::vector<std::string>& args) {
if (args.size() < 3) {
return CMD_FAILED;
}
if (CVar_Get(args[2].c_str()) != nullptr) {
const char* key = args[2].c_str();
GameOverlay* overlay = SohImGui::overlay;
if (args[1] == "add") {
if (!overlay->RegisteredOverlays.contains(key)) {
overlay->RegisteredOverlays[key] = new Overlay({ OverlayType::TEXT, ImStrdup(key), -1.0f });
INFO("Added overlay: %s ", key);
}
else {
ERROR("Overlay already exists: %s", key);
}
}
else if (args[1] == "remove") {
if (overlay->RegisteredOverlays.contains(key)) {
overlay->RegisteredOverlays.erase(key);
INFO("Removed overlay: %s ", key);
}
else {
ERROR("Overlay not found: %s ", key);
}
}
}
else {
ERROR("CVar %s does not exist", args[2].c_str());
}
return CMD_SUCCESS;
}
}

View File

@ -3,21 +3,21 @@
#include <vector> #include <vector>
#include "Lib/ImGui/imgui.h" #include "Lib/ImGui/imgui.h"
#include <map>
#include <unordered_map> #include <unordered_map>
enum class OverlayType {
TEXT, IMAGE, NOTIFICATION
};
struct Overlay {
OverlayType type;
const char* value;
float fadeTime;
float duration;
};
namespace Ship { namespace Ship {
enum class OverlayType {
TEXT, IMAGE, NOTIFICATION
};
struct Overlay {
OverlayType type;
const char* value;
float fadeTime;
float duration;
};
class GameOverlay { class GameOverlay {
public: public:
std::unordered_map<std::string, Overlay*> RegisteredOverlays; std::unordered_map<std::string, Overlay*> RegisteredOverlays;

View File

@ -41,8 +41,8 @@ namespace Game {
} }
void InitSettings() { void InitSettings() {
ModInternal::RegisterHook<ModInternal::AudioInit>(UpdateAudio); Ship::RegisterHook<Ship::AudioInit>(UpdateAudio);
ModInternal::RegisterHook<ModInternal::GfxInit>([] { Ship::RegisterHook<Ship::GfxInit>([] {
gfx_get_current_rendering_api()->set_texture_filter((FilteringMode) CVar_GetS32("gTextureFilter", FILTER_THREE_POINT)); gfx_get_current_rendering_api()->set_texture_filter((FilteringMode) CVar_GetS32("gTextureFilter", FILTER_THREE_POINT));
SohImGui::console->opened = CVar_GetS32("gConsoleEnabled", 0); SohImGui::console->opened = CVar_GetS32("gConsoleEnabled", 0);
SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0); SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0);

View File

@ -7,7 +7,6 @@
#include "spdlog/sinks/rotating_file_sink.h" #include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h" #include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/sinks/sohconsole_sink.h" #include "spdlog/sinks/sohconsole_sink.h"
#include "ModManager.h"
#ifdef __APPLE__ #ifdef __APPLE__
#include "OSXFolderManager.h" #include "OSXFolderManager.h"
#elif defined(__SWITCH__) #elif defined(__SWITCH__)
@ -16,7 +15,6 @@
namespace Ship { namespace Ship {
std::weak_ptr<GlobalCtx2> GlobalCtx2::Context; std::weak_ptr<GlobalCtx2> GlobalCtx2::Context;
ModManager* INSTANCE;
std::shared_ptr<GlobalCtx2> GlobalCtx2::GetInstance() { std::shared_ptr<GlobalCtx2> GlobalCtx2::GetInstance() {
return Context.lock(); return Context.lock();
} }
@ -56,7 +54,6 @@ namespace Ship {
GlobalCtx2::~GlobalCtx2() { GlobalCtx2::~GlobalCtx2() {
SPDLOG_INFO("destruct GlobalCtx2"); SPDLOG_INFO("destruct GlobalCtx2");
INSTANCE->Exit();
} }
void GlobalCtx2::InitWindow() { void GlobalCtx2::InitWindow() {
@ -84,8 +81,6 @@ namespace Ship {
#ifdef __SWITCH__ #ifdef __SWITCH__
Ship::Switch::Init(PostInitPhase); Ship::Switch::Init(PostInitPhase);
#endif #endif
INSTANCE = new ModManager(ResMan);
INSTANCE->Init();
} }
void GlobalCtx2::InitLogging() { void GlobalCtx2::InitLogging() {

View File

@ -1,10 +0,0 @@
#include "Hooks.h"
#include <map>
#include <string>
#include <vector>
#include <stdarg.h>
#include <iostream>
void ModInternal_ExecuteAudioInitHooks() {
ModInternal::ExecuteHooks<ModInternal::AudioInit>();
}

View File

@ -1,15 +1,12 @@
#pragma once #pragma once
#ifdef __cplusplus
#include <functional> #include <functional>
#include "UltraController.h" #include "UltraController.h"
#include "Controller.h"
#define DEFINE_HOOK(name, type) struct name { typedef std::function<type> fn; } #define DEFINE_HOOK(name, type) struct name { typedef std::function<type> fn; }
namespace ModInternal { namespace Ship {
class Controller;
template <typename H> template <typename H>
struct RegisteredHooks { struct RegisteredHooks {
@ -29,22 +26,9 @@ namespace ModInternal {
} }
DEFINE_HOOK(ControllerRead, void(OSContPad* cont_pad)); DEFINE_HOOK(ControllerRead, void(OSContPad* cont_pad));
DEFINE_HOOK(ControllerRawInput, void(Ship::Controller* backend, uint32_t raw)); DEFINE_HOOK(ControllerRawInput, void(Controller* backend, uint32_t raw));
DEFINE_HOOK(AudioInit, void()); DEFINE_HOOK(AudioInit, void());
DEFINE_HOOK(LoadTexture, void(const char* path, uint8_t** texture)); DEFINE_HOOK(LoadTexture, void(const char* path, uint8_t** texture));
DEFINE_HOOK(GfxInit, void()); DEFINE_HOOK(GfxInit, void());
DEFINE_HOOK(ExitGame, void()); DEFINE_HOOK(ExitGame, void());
} }
#endif
#ifdef __cplusplus
extern "C" {
#endif
void ModInternal_ExecuteAudioInitHooks();
#ifdef __cplusplus
}
#endif

View File

@ -8,7 +8,6 @@
#include <vector> #include <vector>
#include "Archive.h" #include "Archive.h"
#include "Environment.h"
#include "GameSettings.h" #include "GameSettings.h"
#include "Console.h" #include "Console.h"
#include "Hooks.h" #include "Hooks.h"
@ -16,7 +15,6 @@
#include "Lib/ImGui/imgui_internal.h" #include "Lib/ImGui/imgui_internal.h"
#include "GlobalCtx2.h" #include "GlobalCtx2.h"
#include "ResourceMgr.h" #include "ResourceMgr.h"
#include "TextureMod.h"
#include "Window.h" #include "Window.h"
#include "Cvar.h" #include "Cvar.h"
#include "GameOverlay.h" #include "GameOverlay.h"
@ -25,7 +23,7 @@
#include "Lib/stb/stb_image.h" #include "Lib/stb/stb_image.h"
#include "Lib/Fast3D/gfx_rendering_api.h" #include "Lib/Fast3D/gfx_rendering_api.h"
#include "Lib/spdlog/include/spdlog/common.h" #include "Lib/spdlog/include/spdlog/common.h"
#include "Utils/StringHelper.h" #include "UltraController.h"
#if __APPLE__ #if __APPLE__
#include <SDL_hints.h> #include <SDL_hints.h>
@ -68,6 +66,13 @@ OSContPad* pads;
std::map<std::string, GameAsset*> DefaultAssets; std::map<std::string, GameAsset*> DefaultAssets;
std::vector<std::string> emptyArgs; std::vector<std::string> emptyArgs;
bool isBetaQuestEnabled = false;
extern "C" {
void enableBetaQuest() { isBetaQuestEnabled = true; }
void disableBetaQuest() { isBetaQuestEnabled = false; }
}
namespace SohImGui { namespace SohImGui {
WindowImpl impl; WindowImpl impl;
@ -130,8 +135,9 @@ namespace SohImGui {
} }
void Tooltip(const char* text) { void Tooltip(const char* text) {
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("%s", text); ImGui::SetTooltip("%s", BreakTooltip(text, 60).c_str());
}
} }
void ImGuiWMInit() { void ImGuiWMInit() {
@ -378,7 +384,7 @@ namespace SohImGui {
ImGui::GetStyle().ScaleAllSizes(2); ImGui::GetStyle().ScaleAllSizes(2);
#endif #endif
ModInternal::RegisterHook<ModInternal::GfxInit>([] { Ship::RegisterHook<Ship::GfxInit>([] {
if (GlobalCtx2::GetInstance()->GetWindow()->IsFullscreen()) if (GlobalCtx2::GetInstance()->GetWindow()->IsFullscreen())
ShowCursor(CVar_GetS32("gOpenMenuBar", 0), Dialogues::dLoadSettings); ShowCursor(CVar_GetS32("gOpenMenuBar", 0), Dialogues::dLoadSettings);
@ -395,7 +401,7 @@ namespace SohImGui {
LoadTexture("C-Down", "assets/ship_of_harkinian/buttons/CDown.png"); LoadTexture("C-Down", "assets/ship_of_harkinian/buttons/CDown.png");
}); });
ModInternal::RegisterHook<ModInternal::ControllerRead>([](OSContPad* cont_pad) { Ship::RegisterHook<Ship::ControllerRead>([](OSContPad* cont_pad) {
pads = cont_pad; pads = cont_pad;
}); });
@ -784,7 +790,7 @@ namespace SohImGui {
bool menu_bar = CVar_GetS32("gOpenMenuBar", 0); bool menu_bar = CVar_GetS32("gOpenMenuBar", 0);
CVar_SetS32("gOpenMenuBar", !menu_bar); CVar_SetS32("gOpenMenuBar", !menu_bar);
needs_save = true; needs_save = true;
GlobalCtx2::GetInstance()->GetWindow()->dwMenubar = menu_bar; GlobalCtx2::GetInstance()->GetWindow()->SetMenuBar(menu_bar);
ShowCursor(menu_bar, Dialogues::dMenubar); ShowCursor(menu_bar, Dialogues::dMenubar);
GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->SaveControllerSettings(); GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->SaveControllerSettings();
if (CVar_GetS32("gControlNav", 0)) { if (CVar_GetS32("gControlNav", 0)) {
@ -867,7 +873,7 @@ namespace SohImGui {
// TODO mutual exclusions -- There should be some system to prevent conclifting enhancements from being selected // TODO mutual exclusions -- There should be some system to prevent conclifting enhancements from being selected
EnhancementCheckbox("D-pad Support on Pause and File Select", "gDpadPauseName"); EnhancementCheckbox("D-pad Support on Pause and File Select", "gDpadPauseName");
Tooltip("Enables Pause and File Select screen navigation with the D-pad\nIf used with D-pad as Equip Items, you must hold C-Up\nto equip instead of navigate"); Tooltip("Enables Pause and File Select screen navigation with the D-pad\nIf used with D-pad as Equip Items, you must hold C-Up to equip instead of navigate");
EnhancementCheckbox("D-pad Support in Ocarina and Text Choice", "gDpadOcarinaText"); EnhancementCheckbox("D-pad Support in Ocarina and Text Choice", "gDpadOcarinaText");
EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop"); EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop");
EnhancementCheckbox("D-pad as Equip Items", "gDpadEquips"); EnhancementCheckbox("D-pad as Equip Items", "gDpadEquips");
@ -889,18 +895,20 @@ namespace SohImGui {
if (ImGui::BeginMenu("Graphics")) if (ImGui::BeginMenu("Graphics"))
{ {
#ifndef __APPLE__
EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true); EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true);
Tooltip("Multiplies your output resolution by the value inputted,\nas a more intensive but effective form of anti-aliasing"); Tooltip("Multiplies your output resolution by the value inputted, as a more intensive but effective form of anti-aliasing");
gfx_current_dimensions.internal_mul = CVar_GetFloat("gInternalResolution", 1); gfx_current_dimensions.internal_mul = CVar_GetFloat("gInternalResolution", 1);
EnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, ""); #endif
Tooltip("Activates multi-sample anti-aliasing when above 1x\nup to 8x for 8 samples for every pixel"); EnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, true);
Tooltip("Activates multi-sample anti-aliasing when above 1x up to 8x for 8 samples for every pixel");
gfx_msaa_level = CVar_GetS32("gMSAAValue", 1); gfx_msaa_level = CVar_GetS32("gMSAAValue", 1);
if (impl.backend == Backend::DX11) if (impl.backend == Backend::DX11)
{ {
const char* cvar = "gExtraLatencyThreshold"; const char* cvar = "gExtraLatencyThreshold";
int val = CVar_GetS32(cvar, 80); int val = CVar_GetS32(cvar, 80);
val = MAX(MIN(val, 250), 0); val = MAX(MIN(val, 360), 0);
int fps = val; int fps = val;
if (fps == 0) if (fps == 0)
@ -922,18 +930,13 @@ namespace SohImGui {
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::SliderInt("##ExtraLatencyThreshold", &val, 0, 250, "", ImGuiSliderFlags_AlwaysClamp)) if (ImGui::SliderInt("##ExtraLatencyThreshold", &val, 0, 360, "", ImGuiSliderFlags_AlwaysClamp))
{ {
CVar_SetS32(cvar, val); CVar_SetS32(cvar, val);
needs_save = true; needs_save = true;
} }
Tooltip("When Interpolation FPS setting is at least this threshold,\n" Tooltip("When Interpolation FPS setting is at least this threshold, add one frame of input lag (e.g. 16.6 ms for 60 FPS) in order to avoid jitter. This setting allows the CPU to work on one frame while GPU works on the previous frame.\nThis setting should be used when your computer is too slow to do CPU + GPU work in time.");
"add one frame of input lag (e.g. 16.6 ms for 60 FPS)\n"
"in order to avoid jitter.This setting allows the CPU\n"
"to work on one frame while GPU works on the previous frame.\n"
"This setting should be used when your computer is too slow\n"
"to do CPU + GPU work in time.");
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
@ -983,30 +986,35 @@ namespace SohImGui {
EnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, ""); EnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "");
EnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, ""); EnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, "");
EnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, ""); EnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "");
Tooltip("Allows you to change the number of days it takes for\nBiggoron to forge the Biggoron Sword"); Tooltip("Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword");
EnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, ""); EnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "");
EnhancementCheckbox("Faster Block Push", "gFasterBlockPush"); EnhancementCheckbox("Faster Block Push", "gFasterBlockPush");
EnhancementCheckbox("Faster Heavy Block Lift", "gFasterHeavyBlockLift");
Tooltip("Speeds up lifting silver rocks and obelisks");
EnhancementCheckbox("No Forced Navi", "gNoForcedNavi"); EnhancementCheckbox("No Forced Navi", "gNoForcedNavi");
Tooltip("Prevent forced Navi conversations"); Tooltip("Prevent forced Navi conversations");
EnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze"); EnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze");
Tooltip("Stops the game from freezing the player\nwhen picking up Gold Skulltulas"); Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas");
EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood"); EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood");
Tooltip("Wearing the Bunny Hood grants a speed\nincrease like in Majora's Mask"); Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask");
EnhancementCheckbox("Fast Chests", "gFastChests"); EnhancementCheckbox("Fast Chests", "gFastChests");
Tooltip("Kick open every chest"); Tooltip("Kick open every chest");
EnhancementCheckbox("Fast Drops", "gFastDrops"); EnhancementCheckbox("Skip Pickup Messages", "gFastDrops");
Tooltip("Skip first-time pickup messages for consumable items"); Tooltip("Skip pickup messages for new consumable items and bottle swipes");
EnhancementCheckbox("Better Owl", "gBetterOwl"); EnhancementCheckbox("Better Owl", "gBetterOwl");
Tooltip("The default response to Kaepora Gaebora is\nalways that you understood what he said"); Tooltip("The default response to Kaepora Gaebora is always that you understood what he said");
EnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback"); EnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback");
Tooltip("Skip the part where the Ocarina playback is called when you play\na song"); Tooltip("Skip the part where the Ocarina playback is called when you play a song");
EnhancementCheckbox("Prevent Dropped Ocarina Inputs", "gDpadNoDropOcarinaInput"); EnhancementCheckbox("Prevent Dropped Ocarina Inputs", "gDpadNoDropOcarinaInput");
Tooltip("Prevent dropping inputs when playing the ocarina quickly"); Tooltip("Prevent dropping inputs when playing the ocarina quickly");
EnhancementCheckbox("Instant Putaway", "gInstantPutaway"); EnhancementCheckbox("Instant Putaway", "gInstantPutaway");
Tooltip("Allow Link to put items away without having to wait around"); Tooltip("Allow Link to put items away without having to wait around");
EnhancementCheckbox("Mask Select in Inventory", "gMaskSelect"); EnhancementCheckbox("Mask Select in Inventory", "gMaskSelect");
Tooltip("After completing the mask trading sub-quest,\npress A and any direction on the mask slot to change masks"); Tooltip("After completing the mask trading sub-quest, press A and any direction on the mask slot to change masks");
EnhancementCheckbox("Remember Save Location", "gRememberSaveLocation");
Tooltip("When loading a save, places Link at the last entrance he went through.\n"
"This doesn't work if the save was made in a grotto.");
ImGui::EndMenu(); ImGui::EndMenu();
} }
@ -1137,13 +1145,13 @@ namespace SohImGui {
} }
EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony"); EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony");
Tooltip("Displays an icon and plays a sound when Stone of Agony\nshould be activated, for those without rumble"); Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble");
EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots"); EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots");
Tooltip("Allows equipping the tunic and boots to c-buttons"); Tooltip("Allows equipping the tunic and boots to c-buttons");
EnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved"); EnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved");
Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen."); Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen.");
EnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime"); EnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime");
Tooltip("Allows the Lon Lon Ranch obstacle course reward to be\nshared across time periods"); Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods");
EnhancementCheckbox("Enable visible guard vision", "gGuardVision"); EnhancementCheckbox("Enable visible guard vision", "gGuardVision");
EnhancementCheckbox("Enable passage of time on file select", "gTimeFlowFileSelect"); EnhancementCheckbox("Enable passage of time on file select", "gTimeFlowFileSelect");
EnhancementCheckbox("Allow the cursor to be on any slot", "gPauseAnyCursor"); EnhancementCheckbox("Allow the cursor to be on any slot", "gPauseAnyCursor");
@ -1161,7 +1169,7 @@ namespace SohImGui {
ImGui::Text("Rotation"); ImGui::Text("Rotation");
EnhancementRadioButton("Disabled", "gPauseLiveLinkRotation", 0); EnhancementRadioButton("Disabled", "gPauseLiveLinkRotation", 0);
EnhancementRadioButton("Rotate Link with D-pad", "gPauseLiveLinkRotation", 1); EnhancementRadioButton("Rotate Link with D-pad", "gPauseLiveLinkRotation", 1);
Tooltip("Allow you to rotate Link on the Equipment menu with the DPAD\nUse DPAD-Up or DPAD-Down to reset Link's rotation"); Tooltip("Allow you to rotate Link on the Equipment menu with the D-pad\nUse D-pad Up or D-pad Down to reset Link's rotation");
EnhancementRadioButton("Rotate Link with C-buttons", "gPauseLiveLinkRotation", 2); EnhancementRadioButton("Rotate Link with C-buttons", "gPauseLiveLinkRotation", 2);
Tooltip("Allow you to rotate Link on the Equipment menu with the C-buttons\nUse C-Up or C-Down to reset Link's rotation"); Tooltip("Allow you to rotate Link on the Equipment menu with the C-buttons\nUse C-Up or C-Down to reset Link's rotation");
EnhancementRadioButton("Rotate Link with Right Stick", "gPauseLiveLinkRotation", 3); EnhancementRadioButton("Rotate Link with Right Stick", "gPauseLiveLinkRotation", 3);
@ -1206,7 +1214,7 @@ namespace SohImGui {
EnhancementCheckbox("Enable 3D Dropped items/projectiles", "gNewDrops"); EnhancementCheckbox("Enable 3D Dropped items/projectiles", "gNewDrops");
Tooltip("Change most 2D items and projectiles on the overworld to their 3D versions"); Tooltip("Change most 2D items and projectiles on the overworld to their 3D versions");
EnhancementCheckbox("Disable Black Bar Letterboxes", "gDisableBlackBars"); EnhancementCheckbox("Disable Black Bar Letterboxes", "gDisableBlackBars");
Tooltip("Disables Black Bar Letterboxes during cutscenes and Z-targeting\nNote: there may be minor visual glitches that\nwere covered up by the black bars\nPlease disable this setting before reporting a bug"); Tooltip("Disables Black Bar Letterboxes during cutscenes and Z-targeting\nNote: there may be minor visual glitches that were covered up by the black bars\nPlease disable this setting before reporting a bug");
EnhancementCheckbox("Dynamic Wallet Icon", "gDynamicWalletIcon"); EnhancementCheckbox("Dynamic Wallet Icon", "gDynamicWalletIcon");
Tooltip("Changes the rupee in the wallet icon to match the wallet size you currently have"); Tooltip("Changes the rupee in the wallet icon to match the wallet size you currently have");
EnhancementCheckbox("Always show dungeon entrances", "gAlwaysShowDungeonMinimapIcon"); EnhancementCheckbox("Always show dungeon entrances", "gAlwaysShowDungeonMinimapIcon");
@ -1222,19 +1230,19 @@ namespace SohImGui {
EnhancementCheckbox("Fix L&Z Page switch in Pause menu", "gNGCKaleidoSwitcher"); EnhancementCheckbox("Fix L&Z Page switch in Pause menu", "gNGCKaleidoSwitcher");
Tooltip("Makes L and R switch pages like on the GameCube\nZ opens the Debug Menu instead"); Tooltip("Makes L and R switch pages like on the GameCube\nZ opens the Debug Menu instead");
EnhancementCheckbox("Fix Dungeon entrances", "gFixDungeonMinimapIcon"); EnhancementCheckbox("Fix Dungeon entrances", "gFixDungeonMinimapIcon");
Tooltip("Removes the dungeon entrance icon on the top-left corner\nof the screen when no dungeon is present on the current map"); Tooltip("Removes the dungeon entrance icon on the top-left corner of the screen when no dungeon is present on the current map");
EnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle"); EnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle");
Tooltip("Re-enables the two-handed idle animation, a seemingly\nfinished animation that was disabled on accident in the original game"); Tooltip("Re-enables the two-handed idle animation, a seemingly finished animation that was disabled on accident in the original game");
EnhancementCheckbox("Fix the Gravedigging Tour Glitch", "gGravediggingTourFix"); EnhancementCheckbox("Fix the Gravedigging Tour Glitch", "gGravediggingTourFix");
Tooltip("Fixes a bug where the Gravedigging Tour Heart\nPiece disappears if the area reloads"); Tooltip("Fixes a bug where the Gravedigging Tour Heart Piece disappears if the area reloads");
EnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix"); EnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix");
Tooltip("Prevents the Forest Stage Deku Nut upgrade from\nbecoming unobtainable after receiving the Poacher's Saw"); Tooltip("Prevents the Forest Stage Deku Nut upgrade from becoming unobtainable after receiving the Poacher's Saw");
EnhancementCheckbox("Fix Navi text HUD position", "gNaviTextFix"); EnhancementCheckbox("Fix Navi text HUD position", "gNaviTextFix");
Tooltip("Correctly centers the Navi text prompt on the HUD's C-Up button"); Tooltip("Correctly centers the Navi text prompt on the HUD's C-Up button");
EnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix"); EnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix");
Tooltip("Make Anubis fireballs do fire damage when reflected\nback at them with the Mirror Shield"); Tooltip("Make Anubis fireballs do fire damage when reflected back at them with the Mirror Shield");
EnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix"); EnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix");
Tooltip("Make the Megaton Hammer's crouch stab able to destroy\nrocks without first swinging it normally"); Tooltip("Make the Megaton Hammer's crouch stab able to destroy rocks without first swinging it normally");
if (CVar_GetS32("gCrouchStabHammerFix", 0) == 0) { if (CVar_GetS32("gCrouchStabHammerFix", 0) == 0) {
CVar_SetS32("gCrouchStabFix", 0); CVar_SetS32("gCrouchStabFix", 0);
} else { } else {
@ -1250,7 +1258,7 @@ namespace SohImGui {
EnhancementCheckbox("Red Ganon blood", "gRedGanonBlood"); EnhancementCheckbox("Red Ganon blood", "gRedGanonBlood");
Tooltip("Restore the original red blood from NTSC 1.0/1.1. Disable for green blood"); Tooltip("Restore the original red blood from NTSC 1.0/1.1. Disable for green blood");
EnhancementCheckbox("Fish while hovering", "gHoverFishing"); EnhancementCheckbox("Fish while hovering", "gHoverFishing");
Tooltip("Restore a bug from NTSC 1.0 that allows casting\nthe Fishing Rod while using the Hover Boots"); Tooltip("Restore a bug from NTSC 1.0 that allows casting the Fishing Rod while using the Hover Boots");
EnhancementCheckbox("N64 Weird Frames", "gN64WeirdFrames"); EnhancementCheckbox("N64 Weird Frames", "gN64WeirdFrames");
Tooltip("Restores N64 Weird Frames allowing weirdshots to behave the same as N64"); Tooltip("Restores N64 Weird Frames allowing weirdshots to behave the same as N64");
EnhancementCheckbox("Bombchus out of bounds", "gBombchusOOB"); EnhancementCheckbox("Bombchus out of bounds", "gBombchusOOB");
@ -1268,7 +1276,7 @@ namespace SohImGui {
int maxFps = 60; int maxFps = 60;
#else #else
int minFps = 20; int minFps = 20;
int maxFps = 250; int maxFps = 360;
#endif #endif
int val = CVar_GetS32(fps_cvar, minFps); int val = CVar_GetS32(fps_cvar, minFps);
@ -1296,9 +1304,9 @@ namespace SohImGui {
if (ImGui::SliderInt("##FPSInterpolation", &val, minFps, maxFps, "", ImGuiSliderFlags_AlwaysClamp)) if (ImGui::SliderInt("##FPSInterpolation", &val, minFps, maxFps, "", ImGuiSliderFlags_AlwaysClamp))
{ {
if (val > 250) if (val > 360)
{ {
val = 250; val = 360;
} }
else if (val < 20) else if (val < 20)
{ {
@ -1311,7 +1319,7 @@ namespace SohImGui {
Tooltip("Interpolate extra frames to get smoother graphics\n" Tooltip("Interpolate extra frames to get smoother graphics\n"
"Set to match your monitor's refresh rate, or a divisor of it\n" "Set to match your monitor's refresh rate, or a divisor of it\n"
"A higher target FPS than your monitor's refresh rate will just waste resources,\n" "A higher target FPS than your monitor's refresh rate will just waste resources, "
"and might give a worse result.\n" "and might give a worse result.\n"
"For consistent input lag, set this value and your monitor's refresh rate to a multiple of 20\n" "For consistent input lag, set this value and your monitor's refresh rate to a multiple of 20\n"
"Ctrl+Click for keyboard input"); "Ctrl+Click for keyboard input");
@ -1329,7 +1337,7 @@ namespace SohImGui {
if (ImGui::Button("Match Refresh Rate")) if (ImGui::Button("Match Refresh Rate"))
{ {
int hz = roundf(gfx_get_detected_hz()); int hz = roundf(gfx_get_detected_hz());
if (hz >= 20 && hz <= 250) if (hz >= 20 && hz <= 360)
{ {
CVar_SetS32(fps_cvar, hz); CVar_SetS32(fps_cvar, hz);
needs_save = true; needs_save = true;
@ -1339,7 +1347,7 @@ namespace SohImGui {
EnhancementCheckbox("Disable LOD", "gDisableLOD"); EnhancementCheckbox("Disable LOD", "gDisableLOD");
Tooltip("Turns off the Level of Detail setting, making models use their higher-poly variants at any distance"); Tooltip("Turns off the Level of Detail setting, making models use their higher-poly variants at any distance");
EnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance"); EnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance");
Tooltip("Turns off the objects draw distance,\nmaking objects being visible from a longer range"); Tooltip("Turns off the objects draw distance, making objects being visible from a longer range");
if (CVar_GetS32("gDisableDrawDistance", 0) == 0) { if (CVar_GetS32("gDisableDrawDistance", 0) == 0) {
CVar_SetS32("gDisableKokiriDrawDistance", 0); CVar_SetS32("gDisableKokiriDrawDistance", 0);
} else if (CVar_GetS32("gDisableDrawDistance", 0) == 1) { } else if (CVar_GetS32("gDisableDrawDistance", 0) == 1) {
@ -1350,7 +1358,7 @@ namespace SohImGui {
Tooltip("Holding down B skips text\nKnown to cause a cutscene softlock in Water Temple\nSoftlock can be fixed by pressing D-Right in Debug mode"); Tooltip("Holding down B skips text\nKnown to cause a cutscene softlock in Water Temple\nSoftlock can be fixed by pressing D-Right in Debug mode");
EnhancementCheckbox("Free Camera", "gFreeCamera"); EnhancementCheckbox("Free Camera", "gFreeCamera");
Tooltip("Enables camera control\nNote: You must remap C buttons off of\nthe right stick in the controller\nconfig menu, and map the camera stick\nto the right stick."); Tooltip("Enables camera control\nNote: You must remap C buttons off of the right stick in the controller config menu, and map the camera stick to the right stick.");
#ifdef __SWITCH__ #ifdef __SWITCH__
int slot = CVar_GetS32("gSwitchPerfMode", (int)SwitchProfiles::STOCK); int slot = CVar_GetS32("gSwitchPerfMode", (int)SwitchProfiles::STOCK);
@ -1406,7 +1414,82 @@ namespace SohImGui {
EnhancementCheckbox("Fireproof Deku Shield", "gFireproofDekuShield"); EnhancementCheckbox("Fireproof Deku Shield", "gFireproofDekuShield");
Tooltip("Prevents the Deku Shield from burning on contact with fire"); Tooltip("Prevents the Deku Shield from burning on contact with fire");
EnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded"); EnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded");
Tooltip("This allows you to put up your shield with any two-handed weapon in hand except for Deku Sticks");
Tooltip("This allows you to put up your shield with any two-handed weapon in hand\nexcept for Deku Sticks"); Tooltip("This allows you to put up your shield with any two-handed weapon in hand\nexcept for Deku Sticks");
EnhancementCheckbox("Time Sync", "gTimeSync");
Tooltip("This syncs the ingame time with the real world time");
{
static int32_t betaQuestEnabled = CVar_GetS32("gEnableBetaQuest", 0);
static int32_t lastBetaQuestEnabled = betaQuestEnabled;
static int32_t betaQuestWorld = CVar_GetS32("gBetaQuestWorld", 0xFFEF);
static int32_t lastBetaQuestWorld = betaQuestWorld;
if (!isBetaQuestEnabled) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
EnhancementCheckbox("Enable Beta Quest", "gEnableBetaQuest");
Tooltip("Turns on OoT Beta Quest. *WARNING* This will reset your game.");
betaQuestEnabled = CVar_GetS32("gEnableBetaQuest", 0);
if (betaQuestEnabled) {
if (betaQuestEnabled != lastBetaQuestEnabled) {
betaQuestWorld = 0;
}
ImGui::Text("Beta Quest World: %d", betaQuestWorld);
if (ImGui::Button(" - ##BetaQuest")) {
betaQuestWorld--;
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
ImGui::SliderInt("##BetaQuest", &betaQuestWorld, 0, 8, "", ImGuiSliderFlags_AlwaysClamp);
Tooltip("Set the Beta Quest world to explore. *WARNING* Changing this will reset your game.\nCtrl+Click to type in a value.");
ImGui::Text("After Slider Beta Quest World: %d", betaQuestWorld);
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(" + ##BetaQuest")) {
betaQuestWorld++;
}
if (betaQuestWorld > 8) {
betaQuestWorld = 8;
}
else if (betaQuestWorld < 0) {
betaQuestWorld = 0;
}
ImGui::Text("After Clamp Beta Quest World: %d", betaQuestWorld);
}
else {
lastBetaQuestWorld = betaQuestWorld = 0xFFEF;
CVar_SetS32("gBetaQuestWorld", betaQuestWorld);
needs_save = true;
}
if (betaQuestEnabled != lastBetaQuestEnabled || betaQuestWorld != lastBetaQuestWorld)
{
// Reset the game if the beta quest state or world changed because beta quest happens on redirecting the title screen cutscene.
lastBetaQuestEnabled = betaQuestEnabled;
lastBetaQuestWorld = betaQuestWorld;
CVar_SetS32("gEnableBetaQuest", betaQuestEnabled);
CVar_SetS32("gBetaQuestWorld", betaQuestWorld);
console->Commands["reset"].handler(emptyArgs);
needs_save = true;
}
if (!isBetaQuestEnabled) {
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
}
ImGui::EndMenu(); ImGui::EndMenu();
} }
@ -1416,11 +1499,11 @@ namespace SohImGui {
if (ImGui::BeginMenu("Developer Tools")) if (ImGui::BeginMenu("Developer Tools"))
{ {
EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled"); EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled");
Tooltip("Enables Debug Mode, allowing you to select maps with L + R + Z, noclip with L + D-pad Right,\nand open the debug menu with L on the pause screen"); Tooltip("Enables Debug Mode, allowing you to select maps with L + R + Z, noclip with L + D-pad Right, and open the debug menu with L on the pause screen");
EnhancementCheckbox("OoT Skulltula Debug", "gSkulltulaDebugEnabled"); EnhancementCheckbox("OoT Skulltula Debug", "gSkulltulaDebugEnabled");
Tooltip("Enables Skulltula Debug, when moving the cursor in the menu above various map\nicons (boss key, compass, map screen locations, etc) will set the GS bits in that\narea. USE WITH CAUTION AS IT DOES NOT UPDATE THE GS COUNT."); Tooltip("Enables Skulltula Debug, when moving the cursor in the menu above various map icons (boss key, compass, map screen locations, etc) will set the GS bits in that area.\nUSE WITH CAUTION AS IT DOES NOT UPDATE THE GS COUNT.");
EnhancementCheckbox("Fast File Select", "gSkipLogoTitle"); EnhancementCheckbox("Fast File Select", "gSkipLogoTitle");
Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only\nif you toggle on \"Create a new save if none ?\" else it will bring you to the\nFile choose menu"); Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only if you toggle on \"Create a new save if none ?\" else it will bring you to the File choose menu");
if (CVar_GetS32("gSkipLogoTitle", 0)) { if (CVar_GetS32("gSkipLogoTitle", 0)) {
const char* FastFileSelect[5] = { const char* FastFileSelect[5] = {
"File N.1", "File N.1",
@ -1432,13 +1515,13 @@ namespace SohImGui {
ImGui::Text("Loading :"); ImGui::Text("Loading :");
EnhancementCombobox("gSaveFileID", FastFileSelect, 5, 0); EnhancementCombobox("gSaveFileID", FastFileSelect, 5, 0);
EnhancementCheckbox("Create a new save if none", "gCreateNewSave"); EnhancementCheckbox("Create a new save if none", "gCreateNewSave");
Tooltip("Enable the creation of a new save file\nif none exist in the File number selected\nNo file name will be assigned please do in Save editor once you see the first text\nelse your save file name will be named \"00000000\"\nIf disabled you will fall back in File select menu"); Tooltip("Enable the creation of a new save file if none exist in the File number selected\nNo file name will be assigned please do in Save editor once you see the first text else your save file name will be named \"00000000\"\nIf disabled you will fall back in File select menu");
}; };
ImGui::Separator(); ImGui::Separator();
EnhancementCheckbox("Stats", "gStatsEnabled"); EnhancementCheckbox("Stats", "gStatsEnabled");
Tooltip("Shows the stats window, with your FPS and frametimes,\nand the OS you're playing on"); Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on");
EnhancementCheckbox("Console", "gConsoleEnabled"); EnhancementCheckbox("Console", "gConsoleEnabled");
Tooltip("Enables the console window, allowing you to input commands,\ntype help for some examples"); Tooltip("Enables the console window, allowing you to input commands, type help for some examples");
console->opened = CVar_GetS32("gConsoleEnabled", 0); console->opened = CVar_GetS32("gConsoleEnabled", 0);
ImGui::EndMenu(); ImGui::EndMenu();
@ -1547,12 +1630,10 @@ namespace SohImGui {
pos = ImVec2(size.x / 2 - sw / 2, 0); pos = ImVec2(size.x / 2 - sw / 2, 0);
size = ImVec2(sw, size.y); size = ImVec2(sw, size.y);
} }
std::string fb_str = SohUtils::getEnvironmentVar("framebuffer"); if (gfxFramebuffer) {
if (!fb_str.empty()) { //ImGui::ImageSimple(reinterpret_cast<ImTextureID>(gfxFramebuffer), pos, size);
uintptr_t fbuf = (uintptr_t)std::stoull(fb_str);
//ImGui::ImageSimple(reinterpret_cast<ImTextureID>(fbuf), pos, size);
ImGui::SetCursorPos(pos); ImGui::SetCursorPos(pos);
ImGui::Image(reinterpret_cast<ImTextureID>(fbuf), size); ImGui::Image(reinterpret_cast<ImTextureID>(gfxFramebuffer), size);
} }
ImGui::End(); ImGui::End();
@ -1780,4 +1861,36 @@ namespace SohImGui {
ImGui::EndGroup(); ImGui::EndGroup();
} }
// Automatically add newlines to break up tooltips longer than a specified number of characters
// Manually included newlines will still be respected and reset the line length
// Default line length is 60 characters
std::string BreakTooltip(const char* text, int lineLength) {
std::string newText(text);
const int tipLength = newText.length();
int lastSpace = -1;
int currentLineLength = 0;
for (int currentCharacter = 0; currentCharacter < tipLength; currentCharacter++) {
if (newText[currentCharacter] == '\n') {
currentLineLength = 0;
lastSpace = -1;
continue;
}
else if (newText[currentCharacter] == ' ') {
lastSpace = currentCharacter;
}
if ((currentLineLength >= lineLength) && (lastSpace >= 0)) {
newText[lastSpace] = '\n';
currentLineLength = currentCharacter - lastSpace - 1;
lastSpace = -1;
}
currentLineLength++;
}
return newText;
}
std::string BreakTooltip(const std::string& text, int lineLength) {
return BreakTooltip(text.c_str(), lineLength);
}
} }

View File

@ -1,5 +1,15 @@
#pragma once #pragma once
#ifdef __cplusplus
extern "C" {
#endif
void enableBetaQuest();
void disableBetaQuest();
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#include "GameOverlay.h" #include "GameOverlay.h"
#include "Lib/ImGui/imgui.h" #include "Lib/ImGui/imgui.h"
#include "Console.h" #include "Console.h"
@ -59,7 +69,7 @@ namespace SohImGui {
WindowDrawFunc drawFunc; WindowDrawFunc drawFunc;
} CustomWindow; } CustomWindow;
extern Console* console; extern Ship::Console* console;
extern Ship::InputEditor* controller; extern Ship::InputEditor* controller;
extern Ship::GameOverlay* overlay; extern Ship::GameOverlay* overlay;
extern bool needs_save; extern bool needs_save;
@ -82,7 +92,7 @@ namespace SohImGui {
void Render(void); void Render(void);
void CancelFrame(void); void CancelFrame(void);
void ShowCursor(bool hide, Dialogues w); void ShowCursor(bool hide, Dialogues w);
void BindCmd(const std::string& cmd, CommandEntry entry); void BindCmd(const std::string& cmd, Ship::CommandEntry entry);
void AddWindow(const std::string& category, const std::string& name, WindowDrawFunc drawFunc, bool isEnabled=false, bool isHidden=false); void AddWindow(const std::string& category, const std::string& name, WindowDrawFunc drawFunc, bool isEnabled=false, bool isHidden=false);
void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint = ImVec4(1, 1, 1, 1)); void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint = ImVec4(1, 1, 1, 1));
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha=false); void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha=false);
@ -94,4 +104,8 @@ namespace SohImGui {
ImTextureID GetTextureByName(const std::string& name); ImTextureID GetTextureByName(const std::string& name);
void BeginGroupPanel(const char* name, const ImVec2 & size = ImVec2(0.0f, 0.0f)); void BeginGroupPanel(const char* name, const ImVec2 & size = ImVec2(0.0f, 0.0f));
void EndGroupPanel(float minHeight = 0.0f); void EndGroupPanel(float minHeight = 0.0f);
std::string BreakTooltip(const char* text, int lineLength = 60);
std::string BreakTooltip(const std::string& text, int lineLength = 60);
} }
#endif

View File

@ -16,8 +16,8 @@ namespace Ship {
} }
std::shared_ptr<Controller> GetControllerPerSlot(int slot) { std::shared_ptr<Controller> GetControllerPerSlot(int slot) {
const std::vector<int> vDevices = Window::ControllerApi->virtualDevices; auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
return Window::ControllerApi->physicalDevices[vDevices[slot]]; return controlDeck->GetPhysicalDeviceFromVirtualSlot(slot);
} }
void InputEditor::DrawButton(const char* label, int n64Btn) { void InputEditor::DrawButton(const char* label, int n64Btn) {
@ -82,20 +82,17 @@ namespace Ship {
} }
void InputEditor::DrawControllerSchema() { void InputEditor::DrawControllerSchema() {
auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
const std::vector<int> vDevices = Window::ControllerApi->virtualDevices; auto Backend = controlDeck->GetPhysicalDeviceFromVirtualSlot(CurrentPort);
const std::vector<std::shared_ptr<Controller>> devices = Window::ControllerApi->physicalDevices; DeviceProfile& profile = Backend->profiles[CurrentPort];
std::shared_ptr<Controller> Backend = devices[vDevices[CurrentPort]];
DeviceProfile& profile =Backend->profiles[CurrentPort];
float sensitivity = profile.Thresholds[SENSITIVITY]; float sensitivity = profile.Thresholds[SENSITIVITY];
bool IsKeyboard = Backend->GetGuid() == "Keyboard" || Backend->GetGuid() == "Auto" || !Backend->Connected(); bool IsKeyboard = Backend->GetGuid() == "Keyboard" || Backend->GetGuid() == "Auto" || !Backend->Connected();
const char* ControllerName = Backend->GetControllerName(); const char* ControllerName = Backend->GetControllerName();
if (ControllerName != nullptr && ImGui::BeginCombo("##ControllerEntries", ControllerName)) { if (ControllerName != nullptr && ImGui::BeginCombo("##ControllerEntries", ControllerName)) {
for (uint8_t i = 0; i < devices.size(); i++) { for (uint8_t i = 0; i < controlDeck->GetNumPhysicalDevices(); i++) {
if (ImGui::Selectable(devices[i]->GetControllerName(), i == vDevices[CurrentPort])) { if (ImGui::Selectable(controlDeck->GetPhysicalDevice(i)->GetControllerName(), i == controlDeck->GetVirtualDevice(CurrentPort))) {
Window::ControllerApi->SetPhysicalDevice(CurrentPort, i); controlDeck->SetPhysicalDevice(CurrentPort, i);
} }
} }
ImGui::EndCombo(); ImGui::EndCombo();
@ -104,7 +101,7 @@ namespace Ship {
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Refresh")) { if(ImGui::Button("Refresh")) {
Window::ControllerApi->ScanPhysicalDevices(); controlDeck->ScanPhysicalDevices();
} }
SohImGui::BeginGroupPanel("Buttons", ImVec2(150, 20)); SohImGui::BeginGroupPanel("Buttons", ImVec2(150, 20));

View File

@ -1,7 +1,5 @@
#pragma once #pragma once
#include <string>
#include "Lib/ImGui/imgui.h" #include "Lib/ImGui/imgui.h"
namespace Ship { namespace Ship {

View File

@ -240,7 +240,7 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par
dxgi.current_height = (uint32_t)(l_param >> 16); dxgi.current_height = (uint32_t)(l_param >> 16);
break; break;
case WM_DESTROY: case WM_DESTROY:
ModInternal::ExecuteHooks<ModInternal::ExitGame>(); Ship::ExecuteHooks<Ship::ExitGame>();
exit(0); exit(0);
case WM_PAINT: case WM_PAINT:
if (dxgi.in_paint) { if (dxgi.in_paint) {
@ -358,7 +358,6 @@ static void gfx_dxgi_show_cursor(bool hide) {
* @bug When menubar is open in windowed mode and you toggle fullscreen * @bug When menubar is open in windowed mode and you toggle fullscreen
* ShowCursor no longer responds. Debugging shows the bool to be correct. * ShowCursor no longer responds. Debugging shows the bool to be correct.
**/ **/
INFO("renderer: %s", hide ? "true" : "false");
ShowCursor(hide); ShowCursor(hide);
} }

View File

@ -44,7 +44,6 @@
#include "gfx_cc.h" #include "gfx_cc.h"
#include "gfx_rendering_api.h" #include "gfx_rendering_api.h"
#include "../../ImGuiImpl.h" #include "../../ImGuiImpl.h"
#include "../../Environment.h"
#include "../../GlobalCtx2.h" #include "../../GlobalCtx2.h"
#include "gfx_pc.h" #include "gfx_pc.h"

View File

@ -32,7 +32,6 @@
#include "../../luslog.h" #include "../../luslog.h"
#include "../StrHash64.h" #include "../StrHash64.h"
#include "../../ImGuiImpl.h" #include "../../ImGuiImpl.h"
#include "../../Environment.h"
#include "../../GameVersions.h" #include "../../GameVersions.h"
#include "../../ResourceMgr.h" #include "../../ResourceMgr.h"
#include "../../Utils.h" #include "../../Utils.h"
@ -49,6 +48,8 @@ extern "C" {
int ResourceMgr_OTRSigCheck(char* imgData); int ResourceMgr_OTRSigCheck(char* imgData);
} }
uintptr_t gfxFramebuffer;
using namespace std; using namespace std;
#define SEG_ADDR(seg, addr) (addr | (seg << 24) | 1) #define SEG_ADDR(seg, addr) (addr | (seg << 24) | 1)
@ -1065,8 +1066,8 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx *verti
dotx /= 127.0f; dotx /= 127.0f;
doty /= 127.0f; doty /= 127.0f;
dotx = math::clamp(dotx, -1.0f, 1.0f); dotx = Ship::Math::clamp(dotx, -1.0f, 1.0f);
doty = math::clamp(doty, -1.0f, 1.0f); doty = Ship::Math::clamp(doty, -1.0f, 1.0f);
if (rsp.geometry_mode & G_TEXTURE_GEN_LINEAR) { if (rsp.geometry_mode & G_TEXTURE_GEN_LINEAR) {
// Not sure exactly what formula we should use to get accurate values // Not sure exactly what formula we should use to get accurate values
@ -1118,7 +1119,7 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx *verti
if (winv < 0.0f) winv = std::numeric_limits<int16_t>::max(); if (winv < 0.0f) winv = std::numeric_limits<int16_t>::max();
float fog_z = z * winv * rsp.fog_mul + rsp.fog_offset; float fog_z = z * winv * rsp.fog_mul + rsp.fog_offset;
fog_z = math::clamp(fog_z, 0.0f, 255.0f); fog_z = Ship::Math::clamp(fog_z, 0.0f, 255.0f);
d->color.a = fog_z; // Use alpha variable to store fog factor d->color.a = fog_z; // Use alpha variable to store fog factor
} else { } else {
d->color.a = v->cn[3]; d->color.a = v->cn[3];
@ -2651,7 +2652,11 @@ void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, co
gfx_wapi->init(game_name, start_in_fullscreen, width, height); gfx_wapi->init(game_name, start_in_fullscreen, width, height);
gfx_rapi->init(); gfx_rapi->init();
gfx_rapi->update_framebuffer_parameters(0, width, height, 1, false, true, true, true); gfx_rapi->update_framebuffer_parameters(0, width, height, 1, false, true, true, true);
#ifdef __APPLE__
gfx_current_dimensions.internal_mul = 1;
#else
gfx_current_dimensions.internal_mul = CVar_GetFloat("gInternalResolution", 1); gfx_current_dimensions.internal_mul = CVar_GetFloat("gInternalResolution", 1);
#endif
gfx_msaa_level = CVar_GetS32("gMSAAValue", 1); gfx_msaa_level = CVar_GetS32("gMSAAValue", 1);
gfx_current_dimensions.width = width; gfx_current_dimensions.width = width;
gfx_current_dimensions.height = height; gfx_current_dimensions.height = height;
@ -2694,7 +2699,7 @@ void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, co
//gfx_lookup_or_create_shader_program(precomp_shaders[i]); //gfx_lookup_or_create_shader_program(precomp_shaders[i]);
} }
ModInternal::ExecuteHooks<ModInternal::GfxInit>(); Ship::ExecuteHooks<Ship::GfxInit>();
} }
struct GfxRenderingAPI *gfx_get_current_rendering_api(void) { struct GfxRenderingAPI *gfx_get_current_rendering_api(void) {
@ -2778,7 +2783,7 @@ void gfx_run(Gfx *commands, const std::unordered_map<Mtx *, MtxF>& mtx_replaceme
rendering_state.scissor = {}; rendering_state.scissor = {};
gfx_run_dl(commands); gfx_run_dl(commands);
gfx_flush(); gfx_flush();
SohUtils::saveEnvironmentVar("framebuffer", string()); gfxFramebuffer = 0;
if (game_renders_to_framebuffer) { if (game_renders_to_framebuffer) {
gfx_rapi->start_draw_to_framebuffer(0, 1); gfx_rapi->start_draw_to_framebuffer(0, 1);
gfx_rapi->clear_framebuffer(); gfx_rapi->clear_framebuffer();
@ -2788,12 +2793,12 @@ void gfx_run(Gfx *commands, const std::unordered_map<Mtx *, MtxF>& mtx_replaceme
if (different_size) { if (different_size) {
gfx_rapi->resolve_msaa_color_buffer(game_framebuffer_msaa_resolved, game_framebuffer); gfx_rapi->resolve_msaa_color_buffer(game_framebuffer_msaa_resolved, game_framebuffer);
SohUtils::saveEnvironmentVar("framebuffer", std::to_string((uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer_msaa_resolved))); gfxFramebuffer = (uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer_msaa_resolved);
} else { } else {
gfx_rapi->resolve_msaa_color_buffer(0, game_framebuffer); gfx_rapi->resolve_msaa_color_buffer(0, game_framebuffer);
} }
} else { } else {
SohUtils::saveEnvironmentVar("framebuffer", std::to_string((uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer))); gfxFramebuffer = (uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer);
} }
} }
SohImGui::DrawFramebufferAndGameInput(); SohImGui::DrawFramebufferAndGameInput();
@ -2870,4 +2875,4 @@ uint16_t gfx_get_pixel_depth(float x, float y) {
get_pixel_depth_pending.clear(); get_pixel_depth_pending.clear();
return get_pixel_depth_cached.find(make_pair(x, y))->second; return get_pixel_depth_cached.find(make_pair(x, y))->second;
} }

View File

@ -14,6 +14,8 @@
#define SCREEN_WIDTH 320 #define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240 #define SCREEN_HEIGHT 240
extern uintptr_t gfxFramebuffer;
struct GfxRenderingAPI; struct GfxRenderingAPI;
struct GfxWindowManagerAPI; struct GfxWindowManagerAPI;

View File

@ -239,7 +239,7 @@ static void gfx_sdl_main_loop(void (*run_one_game_iter)(void)) {
#ifdef __SWITCH__ #ifdef __SWITCH__
Ship::Switch::Exit(); Ship::Switch::Exit();
#endif #endif
ModInternal::ExecuteHooks<ModInternal::ExitGame>(); Ship::ExecuteHooks<Ship::ExitGame>();
} }
static void gfx_sdl_get_dimensions(uint32_t *width, uint32_t *height) { static void gfx_sdl_get_dimensions(uint32_t *width, uint32_t *height) {
@ -309,7 +309,7 @@ static void gfx_sdl_handle_events(void) {
Game::SaveSettings(); Game::SaveSettings();
break; break;
case SDL_QUIT: case SDL_QUIT:
ModInternal::ExecuteHooks<ModInternal::ExitGame>(); Ship::ExecuteHooks<Ship::ExitGame>();
SDL_Quit(); // bandaid fix for linux window closing issue SDL_Quit(); // bandaid fix for linux window closing issue
exit(0); exit(0);
} }

View File

@ -6,6 +6,7 @@
#include <filesystem> #include <filesystem>
#include <unordered_map> #include <unordered_map>
#include <any> #include <any>
#include <Utils/StringHelper.h>
namespace fs = std::filesystem; namespace fs = std::filesystem;
using json = nlohmann::json; using json = nlohmann::json;
@ -16,18 +17,9 @@ Mercury::Mercury(std::string path) : path_(std::move(path)) {
this->reload(); this->reload();
} }
std::vector<std::string> split(const std::string& s, const char delimiter) {
std::vector<std::string> result;
std::stringstream ss(s);
std::string item;
while (getline(ss, item, delimiter)) {
result.push_back(item);
}
return result;
}
std::string Mercury::formatNestedKey(const std::string& key) { std::string Mercury::formatNestedKey(const std::string& key) {
const std::vector<std::string> dots = split(key, '.'); std::vector<std::string> dots = StringHelper::Split(key, ".");
std::string tmp; std::string tmp;
if (dots.size() > 1) if (dots.size() > 1)
for (const auto& dot : dots) { for (const auto& dot : dots) {
@ -40,7 +32,7 @@ std::string Mercury::formatNestedKey(const std::string& key) {
} }
json Mercury::nested(const std::string& key) { json Mercury::nested(const std::string& key) {
std::vector<std::string> dots = split(key, '.'); std::vector<std::string> dots = StringHelper::Split(key, ".");
if (!this->vjson.is_object()) if (!this->vjson.is_object())
return this->vjson; return this->vjson;
json gjson = this->vjson.unflatten(); json gjson = this->vjson.unflatten();

View File

@ -4,6 +4,8 @@
#include <string> #include <string>
#include "../nlohmann/json.hpp" #include "../nlohmann/json.hpp"
static const std::string mercuryRGBAObjectType = "RGBA";
class Mercury { class Mercury {
protected: protected:
std::string path_; std::string path_;

View File

@ -34,7 +34,7 @@ public:
protected: protected:
void sink_it_(const details::log_msg &msg) override void sink_it_(const details::log_msg &msg) override
{ {
const Priority priority = convert_to_soh(msg.level); const Ship::Priority priority = convert_to_soh(msg.level);
memory_buf_t formatted; memory_buf_t formatted;
if (use_raw_msg_) if (use_raw_msg_)
{ {
@ -53,24 +53,25 @@ protected:
void flush_() override {} void flush_() override {}
private: private:
static Priority convert_to_soh(spdlog::level::level_enum level) { static Ship::Priority convert_to_soh(spdlog::level::level_enum level)
{
switch (level) { switch (level) {
case spdlog::level::trace: case spdlog::level::trace:
return Priority::INFO_LVL; return Ship::Priority::INFO_LVL;
case spdlog::level::debug: case spdlog::level::debug:
return Priority::LOG_LVL; return Ship::Priority::LOG_LVL;
case spdlog::level::info: case spdlog::level::info:
return Priority::LOG_LVL; return Ship::Priority::LOG_LVL;
case spdlog::level::warn: case spdlog::level::warn:
return Priority::WARNING_LVL; return Ship::Priority::WARNING_LVL;
case spdlog::level::err: case spdlog::level::err:
return Priority::ERROR_LVL; return Ship::Priority::ERROR_LVL;
case spdlog::level::critical: case spdlog::level::critical:
return Priority::ERROR_LVL; return Ship::Priority::ERROR_LVL;
default: default:
break; break;
} }
return Priority::LOG_LVL; return Ship::Priority::LOG_LVL;
} }
std::string tag_; std::string tag_;

View File

@ -1,23 +0,0 @@
#include "ModManager.h"
#include "TextureMod.h"
#include "ModModule.h"
#include "ImGuiImpl.h"
namespace Ship {
std::vector<ModModule*> modules;
void ModManager::Init() {
// ResManager->GetArchive()->loa
// modules.push_back(new TextureModule(this));
// std::shared_ptr<Ship::Archive> archive = std::make_shared<Ship::Archive>("mods/TexMods.otr", "", false);
for (auto& mod : modules) {
mod->Init();
// mod->Open(archive);
}
}
void ModManager::Exit() {
for (auto& mod : modules)
mod->Exit();
}
}

View File

@ -1,12 +0,0 @@
#pragma once
#include "ResourceMgr.h"
namespace Ship {
class ModManager {
public:
std::shared_ptr<Ship::ResourceMgr> ResManager;
explicit ModManager(std::shared_ptr<Ship::ResourceMgr> manager) : ResManager(manager) {}
void Init();
void Exit();
};
}

View File

@ -1,19 +0,0 @@
#pragma once
#include "ModManager.h"
#include "Hooks.h"
#include "Console.h"
#include "Archive.h"
namespace Ship {
class ModModule {
protected:
ModManager* Manager;
public:
virtual ~ModModule() = default;
explicit ModModule(ModManager* Manager) : Manager(Manager) {}
virtual void Init() = 0;
virtual void Open(std::shared_ptr<Ship::Archive> archive) = 0;
virtual void Close(Ship::Archive archive) = 0;
virtual void Exit() = 0;
};
}

View File

@ -1,128 +0,0 @@
#include "TextureMod.h"
#if 0
#include <map>
#include <string>
#include <iostream>
#include <filesystem>
#include <functional>
#include "Lib/stb/stb_image.h"
#include "Lib/Fast3D/gfx_pc.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "Lib/stb/stb_image_write.h"
#include "Lib/Fast3D/gfx_rendering_api.h"
#include "SohImGuiImpl.h"
namespace fs = std::filesystem;
namespace Ship {
void TextureModule::Init() {
BIND_HOOK(LOOKUP_TEXTURE, Hook_LookupTexture);
BIND_HOOK(GRAYOUT_TEXTURE, Hook_GrayScaleFilter);
BIND_HOOK(INVALIDATE_TEXTURE, Hook_InvalidateTexture);
SohImGui::BindCmd("reload", { .handler = [&](const std::vector<std::string>&) {
INFO("Reloading all textures!");
gfx_texture_cache_clear();
this->TexturePool.clear();
this->TextureCache.clear();
return true;
} });
}
void TextureModule::Open(std::shared_ptr<Ship::Archive> archive) {
this->LoadedOTRS.push_back(archive);
}
void TextureModule::Close(Ship::Archive otr) {
// Remove all loaded textures
// this->LoadedOTRS.erase(std::find(this->LoadedOTRS.begin(), this->LoadedOTRS.end(), otr));
}
void TextureModule::Hook_LookupTexture(HookEvent call) {
const auto raw_path = BIND_PTR("path", char*);
if (raw_path == nullptr) return;
const auto api = BIND_PTR("gfx_api", GfxRenderingAPI*);
const auto path = std::string(raw_path) + ".png";
const auto node = BIND_PTR("node", TextureCacheNode**);
const auto fmt = BIND_VAR("fmt", uint32_t*);
const auto siz = BIND_VAR("siz", uint32_t*);
const auto tile = BIND_VAR("tile", int*);
const auto palette = BIND_VAR("palette", uint32_t*);
const auto orig_addr = BIND_VAR("addr", const uint8_t**);
// INFO("The game is trying to load %s", path.c_str());
if (this->TextureCache.contains(path) && this->TextureCache[path][tile] != nullptr) {
*node = this->TextureCache[path][tile];
api->select_texture(tile, (*node)->second.texture_id);
call->cancelled = true;
return;
}
// OTRTODO: Implement loading order
TextureData* tex_data = nullptr;
if (!this->TexturePool.contains(path)) {
std::shared_ptr<Ship::File> raw_data = std::make_shared<Ship::File>();
this->Manager->ResManager->GetArchive()->LoadPatchFile(path, false, raw_data);
if (raw_data->bIsLoaded) {
char* tdata = new char[raw_data->dwBufferSize];
memcpy(tdata, raw_data->buffer.get(), raw_data->dwBufferSize);
tex_data = new TextureData({ .data = tdata, .size = raw_data->dwBufferSize });
INFO("Loaded %s", path.c_str());
this->TexturePool[path] = tex_data;
}
}
if (tex_data == nullptr)
return;
if (!this->TextureCache.contains(path)) this->TextureCache[path].resize(10);
TextureCacheKey key = { orig_addr, { }, static_cast<uint8_t>(fmt), static_cast<uint8_t>(siz), static_cast<uint8_t>(palette) };
TextureCacheValue value = { api->new_texture(), 0, 0, false };
const auto entry = new TextureCacheNode(key, value);
api->select_texture(tile, entry->second.texture_id);
api->set_sampler_parameters(tile, false, 0, 0);
*node = entry;
uint8_t* img_data = stbi_load_from_memory(reinterpret_cast<const stbi_uc*>(tex_data->data), tex_data->size, &tex_data->width, &tex_data->height, nullptr, 4);
if (!img_data)
return;
switch (tex_data->color_modifier) {
case GRAYSCALE: {
GrayOutTexture(img_data, tex_data->width, tex_data->height);
}
default:;
}
std::cout << "Uploading to the GPU" << std::endl;
api->upload_texture(img_data, tex_data->width, tex_data->height);
this->TextureCache[path][tile] = entry;
stbi_image_free(img_data);
call->cancelled = true;
}
void TextureModule::Hook_GrayScaleFilter(HookEvent event) {
// this->Exit();
}
void TextureModule::Hook_InvalidateTexture(HookEvent event) {
// this->Exit();
}
void TextureModule::Exit() {
TextureCache.clear();
TexturePool.clear();
LoadedOTRS.clear();
}
}
#endif

View File

@ -1,55 +0,0 @@
#pragma once
#include "ModModule.h"
#include <PR/ultra64/gbi.h>
#include "Lib/Fast3D/gfx_pc.h"
#if 0
namespace Ship {
enum TextureMod {
GRAYSCALE,
NONE
};
struct TextureData {
char* data;
uint32_t size;
int width;
int height;
char* loaded_data;
std::shared_ptr<Ship::Archive> parent;
TextureMod color_modifier = NONE;
};
class TextureModule : public ModModule {
public:
explicit TextureModule(ModManager* Manager) : ModModule(Manager) {}
private:
std::vector<std::shared_ptr<Ship::Archive>> LoadedOTRS;
std::map<std::string, TextureData*> TexturePool;
std::map<std::string, std::vector<TextureCacheNode*>> TextureCache;
void Init() override;
void Open(std::shared_ptr<Ship::Archive> archive) override;
void Close(Ship::Archive mod) override;
void Exit() override;
protected:
void Hook_LookupTexture(HookEvent event);
void Hook_GrayScaleFilter(HookEvent event);
void Hook_InvalidateTexture(HookEvent event);
};
inline void GrayOutTexture(uint8_t* data, int width, int height) {
for (int x = 0; x < width * height * 4; x += 4) {
int red = data[x];
int green = data[x + 1];
int blue = data[x + 2];
int gray = (red + green + blue) / 3;
data[x] = gray;
data[x + 1] = gray;
data[x + 2] = gray;
}
}
}
#endif

View File

@ -5,14 +5,14 @@
#define strdup _strdup #define strdup _strdup
#endif #endif
namespace math { namespace Ship {
float clamp(float d, float min, float max) { namespace Math {
const float t = d < min ? min : d; float clamp(float d, float min, float max) {
return t > max ? max : t; const float t = d < min ? min : d;
return t > max ? max : t;
}
} }
}
namespace Utils {
std::vector<std::string> SplitText(const std::string text, char separator = ' ', bool keep_quotes = false) { std::vector<std::string> SplitText(const std::string text, char separator = ' ', bool keep_quotes = false) {
std::vector<std::string> args; std::vector<std::string> args;
char* input = strdup(text.c_str()); char* input = strdup(text.c_str());

View File

@ -3,10 +3,11 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace math { namespace Ship {
float clamp(float d, float min, float max);
} namespace Math {
float clamp(float d, float min, float max);
}
namespace Utils {
std::vector<std::string> SplitText(const std::string& text, char separator, bool keep_quotes); std::vector<std::string> SplitText(const std::string& text, char separator, bool keep_quotes);
} }

View File

@ -4,32 +4,34 @@
#include "Controller.h" #include "Controller.h"
class VirtualController final : public Ship::Controller { namespace Ship {
public: class VirtualController final : public Controller {
VirtualController(const std::string& CUID, const std::string& KeyName, bool Connected) { public:
GUID = CUID; VirtualController(const std::string& CUID, const std::string& KeyName, bool Connected) {
isConnected = Connected; GUID = CUID;
ButtonName = KeyName; isConnected = Connected;
} ButtonName = KeyName;
}
std::map<std::vector<std::string>, int32_t> ReadButtonPress(); std::map<std::vector<std::string>, int32_t> ReadButtonPress();
void ReadFromSource(int32_t slot) override {} void ReadFromSource(int32_t slot) override {}
const char* GetControllerName() override { return GUID.c_str(); } const char* GetControllerName() override { return GUID.c_str(); }
const char* GetButtonName(int slot, int n64Button) override { return ButtonName.c_str(); } const char* GetButtonName(int slot, int n64Button) override { return ButtonName.c_str(); }
void WriteToSource(int32_t slot, ControllerCallback* controller) override { } void WriteToSource(int32_t slot, ControllerCallback* controller) override { }
bool Connected() const override { return isConnected; } bool Connected() const override { return isConnected; }
bool CanRumble() const override { return false; } bool CanRumble() const override { return false; }
bool CanGyro() const override { return false; } bool CanGyro() const override { return false; }
void ClearRawPress() override {} void ClearRawPress() override {}
int32_t ReadRawPress() override { return -1; } int32_t ReadRawPress() override { return -1; }
bool HasPadConf() const { return true; } bool HasPadConf() const { return true; }
std::optional<std::string> GetPadConfSection() { return "Unk"; } std::optional<std::string> GetPadConfSection() { return "Unk"; }
void CreateDefaultBinding(int32_t slot) override {} void CreateDefaultBinding(int32_t slot) override {}
protected: protected:
std::string ButtonName; std::string ButtonName;
bool isConnected = false; bool isConnected = false;
std::string GetControllerType() { return "Unk"; } std::string GetControllerType() { return "Unk"; }
std::string GetConfSection() { return "Unk"; } std::string GetConfSection() { return "Unk"; }
std::string GetBindingConfSection() { return "Unk"; } std::string GetBindingConfSection() { return "Unk"; }
}; };
}

View File

@ -1,7 +1,6 @@
#include "Window.h" #include "Window.h"
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
#include "KeyboardController.h" #include "KeyboardController.h"
#include "SDLController.h"
#include "GlobalCtx2.h" #include "GlobalCtx2.h"
#include "DisplayList.h" #include "DisplayList.h"
#include "Vertex.h" #include "Vertex.h"
@ -11,22 +10,18 @@
#include "Blob.h" #include "Blob.h"
#include "Matrix.h" #include "Matrix.h"
#include "AudioPlayer.h" #include "AudioPlayer.h"
#include "WasapiAudioPlayer.h" #include "Hooks.h"
#include "PulseAudioPlayer.h" #include "UltraController.h"
#include "SDLAudioPlayer.h"
#include "Lib/Fast3D/gfx_pc.h" #include "Lib/Fast3D/gfx_pc.h"
#include "Lib/Fast3D/gfx_sdl.h" #include "Lib/Fast3D/gfx_sdl.h"
#include "Lib/Fast3D/gfx_opengl.h" #include "Lib/Fast3D/gfx_opengl.h"
#include "stox.h"
#if __APPLE__ #if __APPLE__
#include <SDL.h> #include <SDL.h>
#else #else
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#endif #endif
#include <map>
#include <string> #include <string>
#include <chrono> #include <chrono>
#include "Hooks.h"
#include "Console.h" #include "Console.h"
#include "Cvar.h" #include "Cvar.h"
@ -57,7 +52,7 @@ extern "C" {
} }
#endif #endif
Ship::Window::ControllerApi->Init(controllerBits); Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->Init(controllerBits);
return 0; return 0;
} }
@ -77,10 +72,10 @@ extern "C" {
pad->gyro_y = 0; pad->gyro_y = 0;
if (!CVar_GetS32("gOpenMenuBar", 0)) { if (!CVar_GetS32("gOpenMenuBar", 0)) {
Ship::Window::ControllerApi->WriteToPad(pad); Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->WriteToPad(pad);
} }
ModInternal::ExecuteHooks<ModInternal::ControllerRead>(pad); Ship::ExecuteHooks<Ship::ControllerRead>(pad);
} }
const char* ResourceMgr_GetNameByCRC(uint64_t crc) { const char* ResourceMgr_GetNameByCRC(uint64_t crc) {
@ -126,7 +121,7 @@ extern "C" {
if (hashStr != nullptr) { if (hashStr != nullptr) {
const auto res = LOAD_TEX(hashStr->c_str()); const auto res = LOAD_TEX(hashStr->c_str());
ModInternal::ExecuteHooks<ModInternal::LoadTexture>(hashStr->c_str(), &res->imageData); Ship::ExecuteHooks<Ship::LoadTexture>(hashStr->c_str(), &res->imageData);
return reinterpret_cast<char*>(res->imageData); return reinterpret_cast<char*>(res->imageData);
} else { } else {
@ -153,7 +148,7 @@ extern "C" {
char* ResourceMgr_LoadTexByName(char* texPath) { char* ResourceMgr_LoadTexByName(char* texPath) {
const auto res = LOAD_TEX(texPath); const auto res = LOAD_TEX(texPath);
ModInternal::ExecuteHooks<ModInternal::LoadTexture>(texPath, &res->imageData); Ship::ExecuteHooks<Ship::LoadTexture>(texPath, &res->imageData);
return (char*)res->imageData; return (char*)res->imageData;
} }
@ -221,7 +216,7 @@ namespace Ship {
int32_t Window::lastScancode; int32_t Window::lastScancode;
Window::Window(std::shared_ptr<GlobalCtx2> Context) : Context(Context), APlayer(nullptr) { Window::Window(std::shared_ptr<GlobalCtx2> Context) : Context(Context), APlayer(nullptr), ControllerApi(nullptr) {
WmApi = nullptr; WmApi = nullptr;
RenderingApi = nullptr; RenderingApi = nullptr;
bIsFullscreen = false; bIsFullscreen = false;
@ -259,8 +254,9 @@ namespace Ship {
std::shared_ptr<Mercury> pConf = GlobalCtx2::GetInstance()->GetConfig(); std::shared_ptr<Mercury> pConf = GlobalCtx2::GetInstance()->GetConfig();
CreateDefaults(); CreateDefaults();
InitializeAudioPlayer();
InitializeControlDeck();
SetAudioPlayer();
bIsFullscreen = pConf->getBool("Window.Fullscreen.Enabled", false); bIsFullscreen = pConf->getBool("Window.Fullscreen.Enabled", false);
if (bIsFullscreen) { if (bIsFullscreen) {
@ -279,7 +275,7 @@ namespace Ship {
WmApi->set_fullscreen_changed_callback(OnFullscreenChanged); WmApi->set_fullscreen_changed_callback(OnFullscreenChanged);
WmApi->set_keyboard_callbacks(KeyDown, KeyUp, AllKeysUp); WmApi->set_keyboard_callbacks(KeyDown, KeyUp, AllKeysUp);
ModInternal::RegisterHook<ModInternal::ExitGame>([]() { Ship::RegisterHook<Ship::ExitGame>([this]() {
ControllerApi->SaveControllerSettings(); ControllerApi->SaveControllerSettings();
}); });
} }
@ -347,7 +343,8 @@ namespace Ship {
lastScancode = -1; lastScancode = -1;
bool bIsProcessed = false; bool bIsProcessed = false;
const auto pad = dynamic_cast<KeyboardController*>(ControllerApi->physicalDevices[ControllerApi->physicalDevices.size() - 2].get()); auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
const auto pad = dynamic_cast<KeyboardController*>(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get());
if (pad != nullptr) { if (pad != nullptr) {
if (pad->ReleaseButton(dwScancode)) { if (pad->ReleaseButton(dwScancode)) {
bIsProcessed = true; bIsProcessed = true;
@ -359,8 +356,8 @@ namespace Ship {
bool Window::KeyDown(int32_t dwScancode) { bool Window::KeyDown(int32_t dwScancode) {
bool bIsProcessed = false; bool bIsProcessed = false;
auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
const auto pad = dynamic_cast<KeyboardController*>(ControllerApi->physicalDevices[ControllerApi->physicalDevices.size() - 2].get()); const auto pad = dynamic_cast<KeyboardController*>(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get());
if (pad != nullptr) { if (pad != nullptr) {
if (pad->PressButton(dwScancode)) { if (pad->PressButton(dwScancode)) {
bIsProcessed = true; bIsProcessed = true;
@ -374,7 +371,8 @@ namespace Ship {
void Window::AllKeysUp(void) { void Window::AllKeysUp(void) {
const auto pad = dynamic_cast<KeyboardController*>(ControllerApi->physicalDevices[ControllerApi->physicalDevices.size() - 2].get()); auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
const auto pad = dynamic_cast<KeyboardController*>(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get());
if (pad != nullptr) { if (pad != nullptr) {
pad->ReleaseAllButtons(); pad->ReleaseAllButtons();
} }
@ -400,7 +398,7 @@ namespace Ship {
return dwHeight; return dwHeight;
} }
void Window::SetAudioPlayer() { void Window::InitializeAudioPlayer() {
#ifdef _WIN32 #ifdef _WIN32
APlayer = std::make_shared<WasapiAudioPlayer>(); APlayer = std::make_shared<WasapiAudioPlayer>();
#elif defined(__linux) #elif defined(__linux)
@ -409,4 +407,8 @@ namespace Ship {
APlayer = std::make_shared<SDLAudioPlayer>(); APlayer = std::make_shared<SDLAudioPlayer>();
#endif #endif
} }
void Window::InitializeControlDeck() {
ControllerApi = std::make_shared<ControlDeck>();
}
} }

View File

@ -16,7 +16,6 @@ namespace Ship {
class Window { class Window {
public: public:
static int32_t lastScancode; static int32_t lastScancode;
inline static ControlDeck* ControllerApi = new ControlDeck;
Window(std::shared_ptr<GlobalCtx2> Context); Window(std::shared_ptr<GlobalCtx2> Context);
~Window(); ~Window();
@ -32,12 +31,12 @@ namespace Ship {
void ToggleFullscreen(); void ToggleFullscreen();
void SetFullscreen(bool bIsFullscreen); void SetFullscreen(bool bIsFullscreen);
void ShowCursor(bool hide); void ShowCursor(bool hide);
bool IsFullscreen() { return bIsFullscreen; } bool IsFullscreen() { return bIsFullscreen; }
uint32_t GetCurrentWidth(); uint32_t GetCurrentWidth();
uint32_t GetCurrentHeight(); uint32_t GetCurrentHeight();
ControlDeck* GetControlDeck() { return ControllerApi; }; uint32_t GetMenuBar() { return dwMenubar; }
uint32_t dwMenubar; void SetMenuBar(uint32_t dwMenuBar) { this->dwMenubar = dwMenuBar; }
std::shared_ptr<ControlDeck> GetControlDeck() { return ControllerApi; };
std::shared_ptr<GlobalCtx2> GetContext() { return Context.lock(); } std::shared_ptr<GlobalCtx2> GetContext() { return Context.lock(); }
std::shared_ptr<AudioPlayer> GetAudioPlayer() { return APlayer; } std::shared_ptr<AudioPlayer> GetAudioPlayer() { return APlayer; }
const char* GetKeyName(int scancode) { return WmApi->get_key_name(scancode); } const char* GetKeyName(int scancode) { return WmApi->get_key_name(scancode); }
@ -48,15 +47,18 @@ namespace Ship {
static bool KeyUp(int32_t dwScancode); static bool KeyUp(int32_t dwScancode);
static void AllKeysUp(void); static void AllKeysUp(void);
static void OnFullscreenChanged(bool bIsNowFullscreen); static void OnFullscreenChanged(bool bIsNowFullscreen);
void SetAudioPlayer(); void InitializeControlDeck();
void InitializeAudioPlayer();
std::weak_ptr<GlobalCtx2> Context; std::weak_ptr<GlobalCtx2> Context;
std::shared_ptr<AudioPlayer> APlayer; std::shared_ptr<AudioPlayer> APlayer;
std::shared_ptr<ControlDeck> ControllerApi;
GfxRenderingAPI* RenderingApi; GfxRenderingAPI* RenderingApi;
GfxWindowManagerAPI* WmApi; GfxWindowManagerAPI* WmApi;
bool bIsFullscreen; bool bIsFullscreen;
uint32_t dwWidth; uint32_t dwWidth;
uint32_t dwHeight; uint32_t dwHeight;
uint32_t dwMenubar;
}; };
} }

View File

@ -258,7 +258,6 @@
<ClCompile Include="Blob.cpp" /> <ClCompile Include="Blob.cpp" />
<ClCompile Include="ControlDeck.cpp" /> <ClCompile Include="ControlDeck.cpp" />
<ClCompile Include="Cvar.cpp" /> <ClCompile Include="Cvar.cpp" />
<ClCompile Include="Environment.cpp" />
<ClCompile Include="Factories\AudioFactory.cpp" /> <ClCompile Include="Factories\AudioFactory.cpp" />
<ClCompile Include="InputEditor.cpp" /> <ClCompile Include="InputEditor.cpp" />
<ClCompile Include="GameOverlay.cpp" /> <ClCompile Include="GameOverlay.cpp" />
@ -268,7 +267,6 @@
<ClCompile Include="Lib\Mercury\Mercury.cpp" /> <ClCompile Include="Lib\Mercury\Mercury.cpp" />
<ClCompile Include="luslog.cpp" /> <ClCompile Include="luslog.cpp" />
<ClCompile Include="mixer.c" /> <ClCompile Include="mixer.c" />
<ClCompile Include="ModManager.cpp" />
<ClCompile Include="SDLAudioPlayer.cpp" /> <ClCompile Include="SDLAudioPlayer.cpp" />
<ClCompile Include="Console.cpp" /> <ClCompile Include="Console.cpp" />
<ClCompile Include="Factories\AnimationFactory.cpp" /> <ClCompile Include="Factories\AnimationFactory.cpp" />
@ -283,7 +281,6 @@
<ClCompile Include="Factories\VtxFactory.cpp" /> <ClCompile Include="Factories\VtxFactory.cpp" />
<ClCompile Include="Array.cpp" /> <ClCompile Include="Array.cpp" />
<ClCompile Include="Controller.cpp" /> <ClCompile Include="Controller.cpp" />
<ClCompile Include="Hooks.cpp" />
<ClCompile Include="ImGuiImpl.cpp" /> <ClCompile Include="ImGuiImpl.cpp" />
<ClCompile Include="KeyboardController.cpp" /> <ClCompile Include="KeyboardController.cpp" />
<ClCompile Include="Factories\CollisionHeaderFactory.cpp" /> <ClCompile Include="Factories\CollisionHeaderFactory.cpp" />
@ -334,7 +331,6 @@
<ClCompile Include="SkeletonLimb.cpp" /> <ClCompile Include="SkeletonLimb.cpp" />
<ClCompile Include="Text.cpp" /> <ClCompile Include="Text.cpp" />
<ClCompile Include="Texture.cpp" /> <ClCompile Include="Texture.cpp" />
<ClCompile Include="TextureMod.cpp" />
<ClCompile Include="Utils.cpp" /> <ClCompile Include="Utils.cpp" />
<ClCompile Include="Vertex.cpp" /> <ClCompile Include="Vertex.cpp" />
<ClCompile Include="WasapiAudioPlayer.cpp" /> <ClCompile Include="WasapiAudioPlayer.cpp" />
@ -354,7 +350,6 @@
<ClInclude Include="color.h" /> <ClInclude Include="color.h" />
<ClInclude Include="ControlDeck.h" /> <ClInclude Include="ControlDeck.h" />
<ClInclude Include="Cvar.h" /> <ClInclude Include="Cvar.h" />
<ClInclude Include="Environment.h" />
<ClInclude Include="Factories\AudioFactory.h" /> <ClInclude Include="Factories\AudioFactory.h" />
<ClInclude Include="InputEditor.h" /> <ClInclude Include="InputEditor.h" />
<ClInclude Include="GameOverlay.h" /> <ClInclude Include="GameOverlay.h" />
@ -367,8 +362,6 @@
<ClInclude Include="Lib\stb\stb_image_write.h" /> <ClInclude Include="Lib\stb\stb_image_write.h" />
<ClInclude Include="luslog.h" /> <ClInclude Include="luslog.h" />
<ClInclude Include="mixer.h" /> <ClInclude Include="mixer.h" />
<ClInclude Include="ModManager.h" />
<ClInclude Include="ModModule.h" />
<ClInclude Include="SDLAudioPlayer.h" /> <ClInclude Include="SDLAudioPlayer.h" />
<ClInclude Include="Console.h" /> <ClInclude Include="Console.h" />
<ClInclude Include="Factories\ArrayFactory.h" /> <ClInclude Include="Factories\ArrayFactory.h" />
@ -407,7 +400,6 @@
<ClInclude Include="Matrix.h" /> <ClInclude Include="Matrix.h" />
<ClInclude Include="Path.h" /> <ClInclude Include="Path.h" />
<ClInclude Include="Text.h" /> <ClInclude Include="Text.h" />
<ClInclude Include="TextureMod.h" />
<ClInclude Include="Utils.h" /> <ClInclude Include="Utils.h" />
<ClInclude Include="Vertex.h" /> <ClInclude Include="Vertex.h" />
<ClInclude Include="stox.h" /> <ClInclude Include="stox.h" />

View File

@ -67,27 +67,15 @@
<Filter Include="Source Files\Audio"> <Filter Include="Source Files\Audio">
<UniqueIdentifier>{ccd6359f-e357-41ca-9b89-5f509dd30649}</UniqueIdentifier> <UniqueIdentifier>{ccd6359f-e357-41ca-9b89-5f509dd30649}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\CustomImpl\Environment">
<UniqueIdentifier>{94ca4b98-cee2-48e6-a88b-68b8d2fed287}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CustomImpl\Utils"> <Filter Include="Source Files\CustomImpl\Utils">
<UniqueIdentifier>{0dca2d94-45ba-4916-b03a-1dd5f949114c}</UniqueIdentifier> <UniqueIdentifier>{0dca2d94-45ba-4916-b03a-1dd5f949114c}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\ModManager">
<UniqueIdentifier>{8e970531-d0cd-4c29-9800-a7e6edc92036}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\ModManager\ModModule">
<UniqueIdentifier>{05f273a3-f147-430e-9853-aeef59e6288d}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CustomImpl\Hooks"> <Filter Include="Source Files\CustomImpl\Hooks">
<UniqueIdentifier>{cc8de11b-7305-4482-853f-7f0f843eef28}</UniqueIdentifier> <UniqueIdentifier>{cc8de11b-7305-4482-853f-7f0f843eef28}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\Logging"> <Filter Include="Source Files\Logging">
<UniqueIdentifier>{bd6557f1-9480-413b-b0cd-843f8efc1939}</UniqueIdentifier> <UniqueIdentifier>{bd6557f1-9480-413b-b0cd-843f8efc1939}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\CustomImpl\Overlay">
<UniqueIdentifier>{3285ab8a-06d8-4dac-9af9-efb2a9723ab1}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Lib\dr_libs"> <Filter Include="Source Files\Lib\dr_libs">
<UniqueIdentifier>{db6e02cc-fc4c-4138-8219-1d281ad93ec2}</UniqueIdentifier> <UniqueIdentifier>{db6e02cc-fc4c-4138-8219-1d281ad93ec2}</UniqueIdentifier>
</Filter> </Filter>
@ -100,6 +88,9 @@
<Filter Include="Source Files\Controller\InputEditor"> <Filter Include="Source Files\Controller\InputEditor">
<UniqueIdentifier>{010dc29b-d1f6-4793-a4e7-4156aa4fcdd6}</UniqueIdentifier> <UniqueIdentifier>{010dc29b-d1f6-4793-a4e7-4156aa4fcdd6}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\GUI">
<UniqueIdentifier>{5d68254f-662d-4e8c-a57f-de0d8e1d4a58}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Factories\MaterialFactory.cpp"> <ClCompile Include="Factories\MaterialFactory.cpp">
@ -303,12 +294,6 @@
<ClCompile Include="Lib\ImGui\backends\imgui_impl_sdl.cpp"> <ClCompile Include="Lib\ImGui\backends\imgui_impl_sdl.cpp">
<Filter>Source Files\Lib\ImGui</Filter> <Filter>Source Files\Lib\ImGui</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="ImGuiImpl.cpp">
<Filter>Source Files\CustomImpl</Filter>
</ClCompile>
<ClCompile Include="Console.cpp">
<Filter>Source Files\CustomImpl</Filter>
</ClCompile>
<ClCompile Include="Lib\ImGui\backends\imgui_impl_dx11.cpp"> <ClCompile Include="Lib\ImGui\backends\imgui_impl_dx11.cpp">
<Filter>Source Files\Lib\ImGui</Filter> <Filter>Source Files\Lib\ImGui</Filter>
</ClCompile> </ClCompile>
@ -321,9 +306,6 @@
<ClCompile Include="SDLAudioPlayer.cpp"> <ClCompile Include="SDLAudioPlayer.cpp">
<Filter>Source Files\Audio</Filter> <Filter>Source Files\Audio</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Environment.cpp">
<Filter>Source Files\CustomImpl\Environment</Filter>
</ClCompile>
<ClCompile Include="Utils.cpp"> <ClCompile Include="Utils.cpp">
<Filter>Source Files\CustomImpl\Utils</Filter> <Filter>Source Files\CustomImpl\Utils</Filter>
</ClCompile> </ClCompile>
@ -333,24 +315,12 @@
<ClCompile Include="Cvar.cpp"> <ClCompile Include="Cvar.cpp">
<Filter>Source Files\Globals</Filter> <Filter>Source Files\Globals</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TextureMod.cpp">
<Filter>Source Files\ModManager\ModModule</Filter>
</ClCompile>
<ClCompile Include="ModManager.cpp">
<Filter>Source Files\ModManager</Filter>
</ClCompile>
<ClCompile Include="Hooks.cpp">
<Filter>Source Files\CustomImpl\Hooks</Filter>
</ClCompile>
<ClCompile Include="luslog.cpp"> <ClCompile Include="luslog.cpp">
<Filter>Source Files\Logging</Filter> <Filter>Source Files\Logging</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="GameSettings.cpp"> <ClCompile Include="GameSettings.cpp">
<Filter>Source Files\CustomImpl</Filter> <Filter>Source Files\CustomImpl</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="GameOverlay.cpp">
<Filter>Source Files\CustomImpl\Overlay</Filter>
</ClCompile>
<ClCompile Include="Audio.cpp"> <ClCompile Include="Audio.cpp">
<Filter>Source Files\Resources\Files</Filter> <Filter>Source Files\Resources\Files</Filter>
</ClCompile> </ClCompile>
@ -366,6 +336,15 @@
<ClCompile Include="Lib\Mercury\Mercury.cpp"> <ClCompile Include="Lib\Mercury\Mercury.cpp">
<Filter>Source Files\Lib\Mercury</Filter> <Filter>Source Files\Lib\Mercury</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Console.cpp">
<Filter>Source Files\GUI</Filter>
</ClCompile>
<ClCompile Include="GameOverlay.cpp">
<Filter>Source Files\GUI</Filter>
</ClCompile>
<ClCompile Include="ImGuiImpl.cpp">
<Filter>Source Files\GUI</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Lib\tinyxml2\tinyxml2.h"> <ClInclude Include="Lib\tinyxml2\tinyxml2.h">
@ -593,21 +572,12 @@
<ClInclude Include="Lib\ImGui\backends\imgui_impl_sdl.h"> <ClInclude Include="Lib\ImGui\backends\imgui_impl_sdl.h">
<Filter>Source Files\Lib\ImGui</Filter> <Filter>Source Files\Lib\ImGui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="ImGuiImpl.h">
<Filter>Source Files\CustomImpl</Filter>
</ClInclude>
<ClInclude Include="Console.h">
<Filter>Source Files\CustomImpl</Filter>
</ClInclude>
<ClInclude Include="Lib\ImGui\backends\imgui_impl_dx11.h"> <ClInclude Include="Lib\ImGui\backends\imgui_impl_dx11.h">
<Filter>Source Files\Lib\ImGui</Filter> <Filter>Source Files\Lib\ImGui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Lib\ImGui\backends\imgui_impl_win32.h"> <ClInclude Include="Lib\ImGui\backends\imgui_impl_win32.h">
<Filter>Source Files\Lib\ImGui</Filter> <Filter>Source Files\Lib\ImGui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Environment.h">
<Filter>Source Files\CustomImpl\Environment</Filter>
</ClInclude>
<ClInclude Include="Utils.h"> <ClInclude Include="Utils.h">
<Filter>Source Files\CustomImpl\Utils</Filter> <Filter>Source Files\CustomImpl\Utils</Filter>
</ClInclude> </ClInclude>
@ -632,15 +602,6 @@
<ClInclude Include="Lib\stb\stb_image_write.h"> <ClInclude Include="Lib\stb\stb_image_write.h">
<Filter>Source Files\Lib\stb</Filter> <Filter>Source Files\Lib\stb</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TextureMod.h">
<Filter>Source Files\ModManager\ModModule</Filter>
</ClInclude>
<ClInclude Include="ModManager.h">
<Filter>Source Files\ModManager</Filter>
</ClInclude>
<ClInclude Include="ModModule.h">
<Filter>Source Files\ModManager\ModModule</Filter>
</ClInclude>
<ClInclude Include="Hooks.h"> <ClInclude Include="Hooks.h">
<Filter>Source Files\CustomImpl\Hooks</Filter> <Filter>Source Files\CustomImpl\Hooks</Filter>
</ClInclude> </ClInclude>
@ -656,9 +617,6 @@
<ClInclude Include="color.h"> <ClInclude Include="color.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="GameOverlay.h">
<Filter>Source Files\CustomImpl\Overlay</Filter>
</ClInclude>
<ClInclude Include="Audio.h"> <ClInclude Include="Audio.h">
<Filter>Header Files\Resources\Files</Filter> <Filter>Header Files\Resources\Files</Filter>
</ClInclude> </ClInclude>
@ -686,5 +644,14 @@
<ClInclude Include="VirtualController.h"> <ClInclude Include="VirtualController.h">
<Filter>Source Files\Controller</Filter> <Filter>Source Files\Controller</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Console.h">
<Filter>Source Files\GUI</Filter>
</ClInclude>
<ClInclude Include="GameOverlay.h">
<Filter>Source Files\GUI</Filter>
</ClInclude>
<ClInclude Include="ImGuiImpl.h">
<Filter>Source Files\GUI</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -6,7 +6,7 @@ curl -sSfL https://github.com$(curl https://github.com/probonopd/go-appimage/rel
chmod a+x mkappimage.AppImage chmod a+x mkappimage.AppImage
mkdir -p AppDir/usr/bin mkdir -p AppDir/usr/bin
cp appimage/{soh.desktop,soh.sh} AppDir/ cp scripts/linux/{soh.desktop,soh.sh} AppDir/
cp soh/macosx/sohIcon.png AppDir/soh.png cp soh/macosx/sohIcon.png AppDir/soh.png
curl -sSfL https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt -o AppDir/usr/bin/gamecontrollerdb.txt curl -sSfL https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt -o AppDir/usr/bin/gamecontrollerdb.txt

11
scripts/linux/build.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
cd soh
make setup -j$(nproc) OPTFLAGS=-O2 DEBUG=0
make -j$(nproc) OPTFLAGS=-O2 DEBUG=0
cd ../OTRGui
mkdir build
cd build
cmake ..
cmake --build . --config Release

4
scripts/switch/build.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
make setup -C soh -j$(nproc) OPTFLAGS=-O2 DEBUG=0
make -f Makefile.switch -j$(nproc)

View File

@ -16,26 +16,35 @@ DEBUG ?= 1
OPTFLAGS ?= -O0 OPTFLAGS ?= -O0
LTO ?= 0 LTO ?= 0
# flag to save whether the compiler being used is clang or gcc by checking CXX --version
CXX_IS_CLANG ?= $(shell $(CXX) --version | grep -c clang)
WARN := \ WARN := \
-Wno-return-type \ -Wno-return-type \
-Wno-unused-command-line-argument \
-Wno-implicit-function-declaration \
-Wno-c++11-narrowing \
-funsigned-char \ -funsigned-char \
-fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -ffreestanding -fwrapv \ -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -ffreestanding -fwrapv \
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib ifeq ($(CXX_IS_CLANG),1)
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib WARN += -Wno-c++11-narrowing
LDFLAGS :=
ifeq ($(UNAME), Linux) #LINUX
CXXFLAGS += -mhard-float -msse2 -mfpmath=sse
CFLAGS += -mhard-float -msse2 -mfpmath=sse
endif endif
ifeq ($(UNAME), Darwin) #APPLE CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -nostdlib $(shell pkg-config --cflags glew) $(shell sdl2-config --cflags)
CXXFLAGS += $(shell pkg-config --cflags sdl2) $(shell sdl2-config --cflags) $(shell pkg-config --cflags glew) -framework OpenGL CFLAGS := $(WARN) -std=c99 -Wno-implicit-function-declaration -D_GNU_SOURCE -nostdlib $(shell pkg-config --cflags glew) $(shell sdl2-config --cflags)
CFLAGS += $(shell pkg-config --cflags sdl2) $(shell sdl2-config --cflags) $(shell pkg-config --cflags glew) -framework OpenGL LDFLAGS :=
ifneq ($(CXX_IS_CLANG),1)
CXXFLAGS += -no-pie
CFLAGS += -no-pie
endif
ifeq ($(UNAME), Linux)
ifeq ($(UNAMEM), x86_64)
CXXFLAGS += -msse2 -mfpmath=sse -mhard-float
CFLAGS += -msse2 -mfpmath=sse -mhard-float
endif
CXXFLAGS += $(shell pkg-config --cflags libpulse)
CFLAGS += $(shell pkg-config --cflags libpulse)
endif endif
CPPFLAGS := -MMD CPPFLAGS := -MMD
@ -57,11 +66,11 @@ ifneq ($(LTO),0)
LDFLAGS += -flto LDFLAGS += -flto
endif endif
ifeq ($(UNAME), Linux) #LINUX ifeq ($(UNAME), Linux)
TARGET := soh.elf TARGET := soh.elf
endif endif
ifeq ($(UNAME), Darwin) #APPLE ifeq ($(UNAME), Darwin)
TARGET := soh-$(UNAMEM) TARGET := soh-$(UNAMEM)
endif endif
@ -78,25 +87,15 @@ INC_DIRS := $(addprefix -I, \
../libultraship/libultraship/Lib/Fast3D/U64/PR \ ../libultraship/libultraship/Lib/Fast3D/U64/PR \
) )
ifeq ($(UNAME), Linux) #LINUX
INC_DIRS += $(addprefix -I, \
/opt/X11/include \
)
endif
LDDIRS := $(addprefix -L, \ LDDIRS := $(addprefix -L, \
../libultraship/ \ ../libultraship/ \
) )
ifeq ($(UNAME), Linux) #LINUX
LDDIRS += $(addprefix -L, \
/opt/X11/lib \
)
endif
LDLIBS := \ LDLIBS := \
$(ZAPDUTILS) \ $(ZAPDUTILS) \
$(LIBSTORM) \ $(LIBSTORM) \
$(shell sdl2-config --libs) \
$(shell pkg-config --libs glew) \
$(addprefix -l, \ $(addprefix -l, \
dl \ dl \
bz2 \ bz2 \
@ -105,24 +104,16 @@ LDLIBS := \
ultraship \ ultraship \
) )
ifeq ($(UNAME), Linux) #LINUX ifeq ($(UNAME), Linux)
LDLIBS += \ LDLIBS += $(shell pkg-config --libs x11 libpulse)
$(addprefix -l, \
X11 \
SDL2 \
GL \
GLEW \
pulse \
)
endif endif
ifeq ($(UNAME), Darwin) #APPLE ifeq ($(UNAME), Darwin)
LDLIBS += \ LDLIBS += \
$(addprefix -framework , \ $(addprefix -framework , \
OpenGL \ OpenGL \
Foundation \ Foundation \
) \ )
$(shell sdl2-config --libs) $(shell pkg-config --libs glew)
endif endif
ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*") ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*")

View File

@ -30,7 +30,7 @@
#include "ichain.h" #include "ichain.h"
#include "regs.h" #include "regs.h"
#if defined(_WIN64) || defined(__x86_64__) || defined(__arm64__) #if defined(__LP64__)
#define _SOH64 #define _SOH64
#endif #endif

View File

@ -356,7 +356,20 @@ typedef struct {
/* 0x00 */ s32 active; /* 0x00 */ s32 active;
/* 0x04 */ Vec3f tip; /* 0x04 */ Vec3f tip;
/* 0x10 */ Vec3f base; /* 0x10 */ Vec3f base;
} WeaponInfo; // size = 0x1C } WeaponInfo; // size = 0x1C\
typedef enum {
FLAG_NONE,
FLAG_SCENE_SWITCH,
FLAG_SCENE_TREASURE,
FLAG_SCENE_CLEAR,
FLAG_SCENE_COLLECTIBLE,
} FlagType;
typedef struct {
/* 0x00 */ s32 flagID; // which flag to set when Player_SetPendingFlag is called
/* 0x04 */ FlagType flagType; // type of flag to set when Player_SetPendingFlag is called
} PendingFlag; // size = 0x06
#define PLAYER_STATE1_0 (1 << 0) #define PLAYER_STATE1_0 (1 << 0)
#define PLAYER_STATE1_1 (1 << 1) #define PLAYER_STATE1_1 (1 << 1)
@ -612,6 +625,7 @@ typedef struct Player {
/* 0x0A86 */ s8 unk_A86; /* 0x0A86 */ s8 unk_A86;
/* 0x0A87 */ u8 unk_A87; /* 0x0A87 */ u8 unk_A87;
/* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position /* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position
} Player; // size = 0xA94 /* 0x0A94 */ PendingFlag pendingFlag;
} Player; // size = 0xAA0
#endif #endif

View File

@ -3,6 +3,7 @@
#include "ultra64.h" #include "ultra64.h"
#include "z64math.h" #include "z64math.h"
#include "z64audio.h"
#include "soh/Enhancements/randomizer/randomizerTypes.h" #include "soh/Enhancements/randomizer/randomizerTypes.h"
typedef struct { typedef struct {
@ -114,9 +115,9 @@ typedef struct {
/* 0x0EF8 */ u16 infTable[30]; // "inf_table" /* 0x0EF8 */ u16 infTable[30]; // "inf_table"
/* 0x0F38 */ u32 worldMapAreaData; // "area_arrival" /* 0x0F38 */ u32 worldMapAreaData; // "area_arrival"
/* 0x0F40 */ u8 scarecrowCustomSongSet; /* 0x0F40 */ u8 scarecrowCustomSongSet;
/* 0x0F41 */ u8 scarecrowCustomSong[0x360]; /* 0x0F41 */ OcarinaNote scarecrowCustomSong[108];
/* 0x12C5 */ u8 scarecrowSpawnSongSet; /* 0x12C5 */ u8 scarecrowSpawnSongSet;
/* 0x12C6 */ u8 scarecrowSpawnSong[0x80]; /* 0x12C6 */ OcarinaNote scarecrowSpawnSong[16];
/* 0x1346 */ char unk_1346[0x02]; /* 0x1346 */ char unk_1346[0x02];
/* 0x1348 */ HorseData horseData; /* 0x1348 */ HorseData horseData;
/* 0x1354 */ s32 fileNum; // "file_no" /* 0x1354 */ s32 fileNum; // "file_no"

View File

@ -82,6 +82,24 @@
<Filter Include="Source Files\soh\Enhancements\debugger"> <Filter Include="Source Files\soh\Enhancements\debugger">
<UniqueIdentifier>{04fc1c52-49ff-48e2-ae23-2c00867374f8}</UniqueIdentifier> <UniqueIdentifier>{04fc1c52-49ff-48e2-ae23-2c00867374f8}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\soh\Enhancements\randomizer">
<UniqueIdentifier>{fd63976d-64b1-45ee-b3ab-530c636391c3}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\soh\Enhancements\randomizer\3drando">
<UniqueIdentifier>{ff94f63c-a792-49af-869b-42557318a32b}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\soh\Enhancements\randomizer\3drando\hint_list">
<UniqueIdentifier>{1ba82a8d-b7d9-4f79-b80b-389322e189bc}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\soh\Enhancements\randomizer\3drando\location_access">
<UniqueIdentifier>{9e20d69b-6a26-48ef-9aae-09c149b2c459}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\soh\Enhancements\randomizer">
<UniqueIdentifier>{d7b4c12f-3876-40ec-a8ec-db435513156c}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\soh\Enhancements\randomizer\3drando">
<UniqueIdentifier>{38ae4e39-fade-4f81-bfdb-af83bf641df0}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\soh\Enhancements\item-tables"> <Filter Include="Source Files\soh\Enhancements\item-tables">
<UniqueIdentifier>{01811baa-7b90-4452-8ef0-d4cdc5dbdebd}</UniqueIdentifier> <UniqueIdentifier>{01811baa-7b90-4452-8ef0-d4cdc5dbdebd}</UniqueIdentifier>
</Filter> </Filter>
@ -2212,172 +2230,172 @@
<Filter>Header Files\include</Filter> <Filter>Header Files\include</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\hint_list\hint_list_exclude_dungeon.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\hint_list\hint_list_exclude_dungeon.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\hint_list</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\hint_list\hint_list_exclude_overworld.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\hint_list\hint_list_exclude_overworld.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\hint_list</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\hint_list\hint_list_item.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\hint_list\hint_list_item.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\hint_list</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_bottom_of_the_well.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_bottom_of_the_well.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_castle_town.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_castle_town.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_death_mountain.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_death_mountain.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_deku_tree.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_deku_tree.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_dodongos_cavern.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_dodongos_cavern.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_fire_temple.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_fire_temple.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_forest_temple.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_forest_temple.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_ganons_castle.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_ganons_castle.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_gerudo_training_grounds.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_gerudo_training_grounds.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_gerudo_valley.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_gerudo_valley.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_hyrule_field.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_hyrule_field.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_ice_cavern.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_ice_cavern.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_jabujabus_belly.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_jabujabus_belly.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_kakariko.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_kakariko.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_lost_woods.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_lost_woods.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_shadow_temple.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_shadow_temple.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_spirit_temple.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_spirit_temple.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_water_temple.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_water_temple.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_zoras_domain.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access\locacc_zoras_domain.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando\location_access</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\cosmetics.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\cosmetics.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\custom_messages.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\custom_messages.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\debug.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\debug.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\dungeon.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\dungeon.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\entrance.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\entrance.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\fill.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\fill.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\hints.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\hints.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\hint_list.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\hint_list.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\item.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\item.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\item_list.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\item_list.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\item_location.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\item_location.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\item_pool.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\item_pool.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\location_access.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\location_access.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\logic.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\logic.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\menu.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\menu.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\music.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\music.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\patch.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\patch.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\playthrough.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\playthrough.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\preset.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\preset.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\random.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\random.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\rando_main.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\rando_main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\settings.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\settings.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\setting_descriptions.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\setting_descriptions.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\shops.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\shops.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\sound_effects.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\sound_effects.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\spoiler_log.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\spoiler_log.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\starting_inventory.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\starting_inventory.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\tinyxml2.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\tinyxml2.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\trial.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\trial.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\3drando\utils.cpp"> <ClCompile Include="soh\Enhancements\randomizer\3drando\utils.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer\3drando</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\randomizer.cpp"> <ClCompile Include="soh\Enhancements\randomizer\randomizer.cpp">
<Filter>Source Files</Filter> <Filter>Source Files\soh\Enhancements\randomizer</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\randomizer.h"> <ClCompile Include="soh\Enhancements\randomizer\randomizer.h">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\gfx.c"> <ClCompile Include="soh\Enhancements\gfx.c">
<Filter>Header Files\soh\Enhancements</Filter> <Filter>Header Files\soh\Enhancements</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\randomizer\randomizer_item_tracker.cpp"> <ClCompile Include="soh\Enhancements\randomizer\randomizer_item_tracker.cpp">
<Filter>Source Files\src</Filter> <Filter>Source Files\soh\Enhancements\randomizer</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="soh\Enhancements\item-tables\ItemTableManager.cpp"> <ClCompile Include="soh\Enhancements\item-tables\ItemTableManager.cpp">
<Filter>Source Files\soh\Enhancements\item-tables</Filter> <Filter>Source Files\soh\Enhancements\item-tables</Filter>
@ -3954,118 +3972,118 @@
<Filter>Header Files\include</Filter> <Filter>Header Files\include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\category.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\category.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\cosmetics.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\cosmetics.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\custom_messages.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\custom_messages.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\debug.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\debug.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\dungeon.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\dungeon.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\entrance.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\entrance.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\fill.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\fill.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\hints.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\hints.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\hint_list.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\hint_list.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\item.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\item.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\item_list.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\item_list.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\item_location.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\item_location.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\item_pool.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\item_pool.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\keys.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\keys.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\location_access.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\location_access.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\logic.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\logic.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\menu.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\menu.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\music.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\music.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\patch.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\patch.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\playthrough.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\playthrough.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\pool_functions.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\pool_functions.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\preset.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\preset.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\random.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\random.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\randomizer.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\randomizer.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\rando_main.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\rando_main.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\settings.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\settings.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\setting_descriptions.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\setting_descriptions.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\shops.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\shops.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\sound_effects.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\sound_effects.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\spoiler_log.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\spoiler_log.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\starting_inventory.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\starting_inventory.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\text.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\text.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\tinyxml2.h"> <ClInclude Include="soh\Enhancements\randomizer\3drando\tinyxml2.h">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\trial.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\trial.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\3drando\utils.hpp"> <ClInclude Include="soh\Enhancements\randomizer\3drando\utils.hpp">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer\3drando</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\randomizerTypes.h"> <ClInclude Include="soh\Enhancements\randomizer\randomizerTypes.h">
<Filter>Header Files</Filter> <Filter>Header Files\soh\Enhancements\randomizer</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\gfx.h"> <ClInclude Include="soh\Enhancements\gfx.h">
<Filter>Header Files\soh\Enhancements</Filter> <Filter>Header Files\soh\Enhancements</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\randomizer\randomizer_item_tracker.h"> <ClInclude Include="soh\Enhancements\randomizer\randomizer_item_tracker.h">
<Filter>Source Files\src</Filter> <Filter>Header Files\soh\Enhancements\randomizer</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\item-tables\ItemTableManager.h"> <ClInclude Include="soh\Enhancements\item-tables\ItemTableManager.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>

View File

@ -463,50 +463,49 @@ void DebugConsole_Init(void) {
CMD_REGISTER("kill", { KillPlayerHandler, "Commit suicide." }); CMD_REGISTER("kill", { KillPlayerHandler, "Commit suicide." });
CMD_REGISTER("map", { LoadSceneHandler, "Load up kak?" }); CMD_REGISTER("map", { LoadSceneHandler, "Load up kak?" });
CMD_REGISTER("rupee", { RuppeHandler, "Set your rupee counter.", { CMD_REGISTER("rupee", { RuppeHandler, "Set your rupee counter.", {
{"amount", ArgumentType::NUMBER } {"amount", Ship::ArgumentType::NUMBER }
}}); }});
CMD_REGISTER("bItem", { BHandler, "Set an item to the B button.", { { "Item ID", ArgumentType::NUMBER } } }); CMD_REGISTER("bItem", { BHandler, "Set an item to the B button.", { { "Item ID", Ship::ArgumentType::NUMBER } } });
CMD_REGISTER("health", { SetPlayerHealthHandler, "Set the health of the player.", { CMD_REGISTER("health", { SetPlayerHealthHandler, "Set the health of the player.", { { "health", Ship::ArgumentType::NUMBER }
{"health", ArgumentType::NUMBER }
}}); }});
CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { { "actor_id", Ship::ArgumentType::NUMBER },
{ "actor_id", ArgumentType::NUMBER }, { "data", Ship::ArgumentType::NUMBER },
{ "data", ArgumentType::NUMBER }, { "x", Ship::ArgumentType::PLAYER_POS, true },
{ "x", ArgumentType::PLAYER_POS, true }, { "y", Ship::ArgumentType::PLAYER_POS, true },
{ "y", ArgumentType::PLAYER_POS, true }, { "z", Ship::ArgumentType::PLAYER_POS, true },
{ "z", ArgumentType::PLAYER_POS, true }, { "rx", Ship::ArgumentType::PLAYER_ROT, true },
{ "rx", ArgumentType::PLAYER_ROT, true }, { "ry", Ship::ArgumentType::PLAYER_ROT, true },
{ "ry", ArgumentType::PLAYER_ROT, true }, { "rz", Ship::ArgumentType::PLAYER_ROT, true }
{ "rz", ArgumentType::PLAYER_ROT, true }
}}); }});
CMD_REGISTER("pos", { SetPosHandler, "Sets the position of the player.", { CMD_REGISTER("pos", { SetPosHandler, "Sets the position of the player.", { { "x", Ship::ArgumentType::PLAYER_POS, true },
{ "x", ArgumentType::PLAYER_POS, true }, { "y", Ship::ArgumentType::PLAYER_POS, true },
{ "y", ArgumentType::PLAYER_POS, true }, { "z", Ship::ArgumentType::PLAYER_POS, true }
{ "z", ArgumentType::PLAYER_POS, true }
}}); }});
CMD_REGISTER("set", { SetCVarHandler, CMD_REGISTER("set", { SetCVarHandler,
"Sets a console variable.", "Sets a console variable.",
{ { "varName", ArgumentType::TEXT }, { "varValue", ArgumentType::TEXT } } }); { { "varName", Ship::ArgumentType::TEXT }, { "varValue", Ship::ArgumentType::TEXT } } });
CMD_REGISTER("get", { GetCVarHandler, "Gets a console variable.", { { "varName", ArgumentType::TEXT } } }); CMD_REGISTER("get", { GetCVarHandler, "Gets a console variable.", { { "varName", Ship::ArgumentType::TEXT } } });
CMD_REGISTER("reset", { ResetHandler, "Resets the game." }); CMD_REGISTER("reset", { ResetHandler, "Resets the game." });
CMD_REGISTER("ammo", { AmmoHandler, "Changes ammo of an item.", CMD_REGISTER("ammo", { AmmoHandler, "Changes ammo of an item.",
{ { "item", ArgumentType::TEXT }, { { "item", Ship::ArgumentType::TEXT }, { "count", Ship::ArgumentType::NUMBER } } });
{ "count", ArgumentType::NUMBER } } });
CMD_REGISTER("bottle", { BottleHandler, CMD_REGISTER("bottle", { BottleHandler,
"Changes item in a bottle slot.", "Changes item in a bottle slot.",
{ { "item", ArgumentType::TEXT }, { "slot", ArgumentType::NUMBER } } }); { { "item", Ship::ArgumentType::TEXT }, { "slot", Ship::ArgumentType::NUMBER } } });
CMD_REGISTER("item", { ItemHandler, CMD_REGISTER("item", { ItemHandler,
"Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.", "Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.",
{ { "slot", ArgumentType::NUMBER }, { "item id", ArgumentType::NUMBER } } }); { { "slot", Ship::ArgumentType::NUMBER }, { "item id", Ship::ArgumentType::NUMBER } } });
CMD_REGISTER("entrance", CMD_REGISTER("entrance", { EntranceHandler,
{ EntranceHandler, "Sends player to the entered entrance (hex)", { { "entrance", ArgumentType::NUMBER } } }); "Sends player to the entered entrance (hex)",
{ { "entrance", Ship::ArgumentType::NUMBER } } });
CMD_REGISTER("save_state", { SaveStateHandler, "Save a state." }); CMD_REGISTER("save_state", { SaveStateHandler, "Save a state." });
CMD_REGISTER("load_state", { LoadStateHandler, "Load a state." }); CMD_REGISTER("load_state", { LoadStateHandler, "Load a state." });
CMD_REGISTER("set_slot", { StateSlotSelectHandler, "Selects a SaveState slot", { CMD_REGISTER("set_slot", { StateSlotSelectHandler, "Selects a SaveState slot", { {
{ "Slot number", ArgumentType::NUMBER, } "Slot number",
Ship::ArgumentType::NUMBER,
}
} }); } });
DebugConsole_LoadCVars(); DebugConsole_LoadCVars();
} }
@ -529,7 +528,7 @@ void DebugConsole_LoadLegacyCVars() {
if (cfg[1].find("\"") == std::string::npos && (cfg[1].find("#") != std::string::npos)) if (cfg[1].find("\"") == std::string::npos && (cfg[1].find("#") != std::string::npos))
{ {
std::string value(cfg[1]); std::string value(cfg[1]);
value.erase(std::ranges::remove(value, '#').begin(), value.end()); value.erase(std::remove_if(value.begin(), value.end(), [](char c) { return c == '#'; }), value.end());
auto splitTest = StringHelper::Split(value, "\r")[0]; auto splitTest = StringHelper::Split(value, "\r")[0];
uint32_t val = std::stoul(splitTest, nullptr, 16); uint32_t val = std::stoul(splitTest, nullptr, 16);
@ -568,20 +567,18 @@ void DebugConsole_LoadCVars() {
switch (value.type()) { switch (value.type()) {
case nlohmann::detail::value_t::array: case nlohmann::detail::value_t::array:
break; break;
case nlohmann::detail::value_t::string: case nlohmann::detail::value_t::object:
if (StringHelper::StartsWith(value.get<std::string>(), "#")) if (value["Type"].get<std::string>() == mercuryRGBAObjectType) {
{
uint32_t val = std::stoul(&value.get<std::string>().c_str()[1], nullptr, 16);
Color_RGBA8 clr; Color_RGBA8 clr;
clr.r = val >> 24; clr.r = value["R"].get<uint8_t>();
clr.g = val >> 16; clr.g = value["G"].get<uint8_t>();
clr.b = val >> 8; clr.b = value["B"].get<uint8_t>();
clr.a = val & 0xFF; clr.a = value["A"].get<uint8_t>();
CVar_SetRGBA(item.key().c_str(), clr);
} }
else
CVar_SetString(item.key().c_str(), value.get<std::string>().c_str()); break;
case nlohmann::detail::value_t::string:
CVar_SetString(item.key().c_str(), value.get<std::string>().c_str());
break; break;
case nlohmann::detail::value_t::boolean: case nlohmann::detail::value_t::boolean:
CVar_SetS32(item.key().c_str(), value.get<bool>()); CVar_SetS32(item.key().c_str(), value.get<bool>());
@ -618,10 +615,13 @@ void DebugConsole_SaveCVars()
pConf->setFloat(key, cvar.second->value.valueFloat); pConf->setFloat(key, cvar.second->value.valueFloat);
else if (cvar.second->type == CVarType::RGBA) else if (cvar.second->type == CVarType::RGBA)
{ {
auto keyStr = key.c_str();
Color_RGBA8 clr = cvar.second->value.valueRGBA; Color_RGBA8 clr = cvar.second->value.valueRGBA;
uint32_t val = (clr.r << 24) + (clr.g << 16) + (clr.b << 8) + clr.a; pConf->setUInt(StringHelper::Sprintf("%s.R", keyStr), clr.r);
std::string str = StringHelper::Sprintf("#%08X", val); pConf->setUInt(StringHelper::Sprintf("%s.G", keyStr), clr.r);
pConf->setString(key, str); pConf->setUInt(StringHelper::Sprintf("%s.B", keyStr), clr.r);
pConf->setUInt(StringHelper::Sprintf("%s.A", keyStr), clr.r);
pConf->setString(StringHelper::Sprintf("%s.Type", keyStr), mercuryRGBAObjectType);
} }
} }

View File

@ -1,10 +1,11 @@
#include "ImGuiHelpers.h" #include "ImGuiHelpers.h"
#include "../../../../libultraship/libultraship/ImGuiImpl.h"
// Adds a text tooltip for the previous ImGui item // Adds a text tooltip for the previous ImGui item
void SetLastItemHoverText(const std::string& text) { void SetLastItemHoverText(const std::string& text) {
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::Text(text.c_str()); ImGui::Text(SohImGui::BreakTooltip(text, 60).c_str());
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
} }
@ -15,7 +16,7 @@ void InsertHelpHoverText(const std::string& text) {
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "?"); ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "?");
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::Text(text.c_str()); ImGui::Text(SohImGui::BreakTooltip(text, 60).c_str());
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
} }

View File

@ -1001,7 +1001,7 @@ void DrawFlagsTab() {
// Draws a combo that lets you choose and upgrade value from a drop-down of text values // Draws a combo that lets you choose and upgrade value from a drop-down of text values
void DrawUpgrade(const std::string& categoryName, int32_t categoryId, const std::vector<std::string>& names) { void DrawUpgrade(const std::string& categoryName, int32_t categoryId, const std::vector<std::string>& names) {
ImGui::Text(categoryName.c_str()); ImGui::Text("%s", categoryName.c_str());
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushID(categoryName.c_str()); ImGui::PushID(categoryName.c_str());
if (ImGui::BeginCombo("##upgrade", names[CUR_UPG_VALUE(categoryId)].c_str())) { if (ImGui::BeginCombo("##upgrade", names[CUR_UPG_VALUE(categoryId)].c_str())) {
@ -1435,7 +1435,7 @@ void DrawPlayerTab() {
InsertHelpHoverText("Link's speed along the Y plane. Caps at -20"); InsertHelpHoverText("Link's speed along the Y plane. Caps at -20");
ImGui::InputScalar("Wall Height", ImGuiDataType_Float, &player->wallHeight); ImGui::InputScalar("Wall Height", ImGuiDataType_Float, &player->wallHeight);
InsertHelpHoverText("\"height used to determine whether link can climb or grab a ledge at the top\""); InsertHelpHoverText("Height used to determine whether Link can climb or grab a ledge at the top");
ImGui::InputScalar("Invincibility Timer", ImGuiDataType_S8, &player->invincibilityTimer); ImGui::InputScalar("Invincibility Timer", ImGuiDataType_S8, &player->invincibilityTimer);
InsertHelpHoverText("Can't take damage while this is nonzero"); InsertHelpHoverText("Can't take damage while this is nonzero");

View File

@ -2102,7 +2102,7 @@ void HintTable_Init() {
hintTable[GANON_LINE07] = HintText::GanonLine({ hintTable[GANON_LINE07] = HintText::GanonLine({
//obscure text //obscure text
Text{"What about Zelda makes you think she'd be a better ruler than I?^I saved Lon Lon Ranch,&fed the hungry,&and my castle floats.", Text{"What about Zelda makes you think&she'd be a better ruler than I?^I saved Lon Lon Ranch,&fed the hungry,&and my castle floats.",
/*french*/"Zelda ne sera jamais un meilleur monarque que moi!^J'ai un château volant, mes sujets sont des belles amazones... et mes Moblins sont clairement plus puissants que jamais!", /*french*/"Zelda ne sera jamais un meilleur monarque que moi!^J'ai un château volant, mes sujets sont des belles amazones... et mes Moblins sont clairement plus puissants que jamais!",
/*spanish*/"¿Qué te hace pensar que Zelda gobierna mejor que yo?^Yo he salvado el Rancho Lon Lon,&he alimentado a los hambrientos&y hasta hago que mi castillo flote."}, /*spanish*/"¿Qué te hace pensar que Zelda gobierna mejor que yo?^Yo he salvado el Rancho Lon Lon,&he alimentado a los hambrientos&y hasta hago que mi castillo flote."},
}); });

View File

@ -579,7 +579,7 @@ std::string AutoFormatHintTextString(std::string unformattedHintTextString) {
bool needsAutomaicNewlines = true; bool needsAutomaicNewlines = true;
if (textStr == "Erreur 0x69a504:&Traduction manquante^C'est de la faute à Purple Hato!&J'vous jure!" || if (textStr == "Erreur 0x69a504:&Traduction manquante^C'est de la faute à Purple Hato!&J'vous jure!" ||
textStr == "Mon très cher @:&Viens vite au château, je t'ai préparé&un délicieux gâteau...^À bientôt, Princesse Zelda" || textStr == "Mon très cher @:&Viens vite au château, je t'ai préparé&un délicieux gâteau...^À bientôt, Princesse Zelda" ||
textStr == "What about Zelda makes you think she'd be a better ruler than I?^I saved Lon Lon Ranch,&fed the hungry,&and my castle floats." || textStr == "What about Zelda makes you think&she'd be a better ruler than I?^I saved Lon Lon Ranch,&fed the hungry,&and my castle floats." ||
textStr == "Many tricks are up my sleeve,&to save yourself&you'd better leave!" || textStr == "Many tricks are up my sleeve,&to save yourself&you'd better leave!" ||
textStr == "I've learned this spell,&it's really neat,&I'll keep it later&for your treat!" || textStr == "I've learned this spell,&it's really neat,&I'll keep it later&for your treat!" ||
textStr == "Sale petit garnement,&tu fais erreur!&C'est maintenant que marque&ta dernière heure!" || textStr == "Sale petit garnement,&tu fais erreur!&C'est maintenant que marque&ta dernière heure!" ||

View File

@ -3543,21 +3543,21 @@ void DrawRandoEditor(bool& open) {
switch (CVar_GetS32("gRandomizeForest", 1)) { switch (CVar_GetS32("gRandomizeForest", 1)) {
case 1: case 1:
InsertHelpHoverText("Mido no longer blocks the path to the Deku Tree\n" InsertHelpHoverText("Mido no longer blocks the path to the Deku Tree\n"
"The Kokiri boy no longer blocks the path\nout of the forest."); "The Kokiri boy no longer blocks the path out of the forest.");
break; break;
case 2: case 2:
InsertHelpHoverText( InsertHelpHoverText(
"The Kokiri boy no longer blocks the path out of the forest\nMido " "The Kokiri boy no longer blocks the path out of the forest\nMido "
"still blocks the path to the Deku\nTree, requiring the Kokiri Sword " "still blocks the path to the Deku Tree, requiring the Kokiri Sword "
"and a Deku Shield to\naccess the Deku Tree."); "and a Deku Shield to access the Deku Tree.");
break; break;
case 0: case 0:
InsertHelpHoverText( InsertHelpHoverText(
"Beating Deku Tree is logically required to leave\nthe forest area " "Beating Deku Tree is logically required to leave the forest area "
"(Kokiri Forest / Loost Woods / Sacred\nForest Meadow / Deku Tree) " "(Kokiri Forest / Lost Woods / Sacred Forest Meadow / Deku Tree) "
"while the Kokiri Sword\nand a Deku Shield are required to access the " "while the Kokiri Sword and a Deku Shield are required to access the "
"Deku\nTree Items needed for this will be guaranteed\ninside the " "Deku Tree\nItems needed for this will be guaranteed inside the "
"forest area.\nThis settins is incompatible with starting as adult."); "forest area.\nThis setting is incompatible with starting as adult.");
break; break;
} }
SohImGui::EnhancementCombobox("gRandomizeForest", randoForest, 3, 1); SohImGui::EnhancementCombobox("gRandomizeForest", randoForest, 3, 1);
@ -3567,13 +3567,13 @@ void DrawRandoEditor(bool& open) {
switch (CVar_GetS32("gRandomizeKakarikoGate", 0)) { switch (CVar_GetS32("gRandomizeKakarikoGate", 0)) {
case 0: case 0:
InsertHelpHoverText( InsertHelpHoverText(
"The gate and the Happy Mask Shop both remain\nclosed until showing " "The gate and the Happy Mask Shop both remain closed until showing "
"Zelda's Letter to the guard\nin Kakariko."); "Zelda's Letter to the guard in Kakariko.");
break; break;
case 1: case 1:
InsertHelpHoverText( InsertHelpHoverText(
"The gate is always open instead of needing\nZelda's Letter.\nThe Happy Mask Shop " "The gate is always open instead of needing Zelda's Letter.\nThe Happy Mask Shop "
"opens upon obtaining \n Zelda's Letter without needing to show\nit to the guard."); "opens upon obtaining Zelda's Letter without needing to show it to the guard.");
break; break;
} }
SohImGui::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, 2, 1); SohImGui::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, 2, 1);
@ -3584,16 +3584,16 @@ void DrawRandoEditor(bool& open) {
switch (CVar_GetS32("gRandomizeDoorOfTime", 0)) { switch (CVar_GetS32("gRandomizeDoorOfTime", 0)) {
case 0: case 0:
InsertHelpHoverText( InsertHelpHoverText(
"The Door of Time starts opened instead of needing\nto play the Song of Time."); "The Door of Time starts opened instead of needing to play the Song of Time.");
break; break;
case 1: case 1:
InsertHelpHoverText( InsertHelpHoverText(
"Only an Ocarina and the Song of Time need to be\nfound to open the Door of Time."); "Only an Ocarina and the Song of Time need to be found to open the Door of Time.");
break; break;
case 2: case 2:
InsertHelpHoverText( InsertHelpHoverText(
"The Ocarina of Time, the Song of Time and\nall Spiritual Stones need to " "The Ocarina of Time, the Song of Time and all Spiritual Stones need to "
"be found to\nopen the Door of Time."); "be found to open the Door of Time.");
break; break;
} }
SohImGui::EnhancementCombobox("gRandomizeDoorOfTime", randoDoorOfTime, 3, 0); SohImGui::EnhancementCombobox("gRandomizeDoorOfTime", randoDoorOfTime, 3, 0);
@ -3605,17 +3605,17 @@ void DrawRandoEditor(bool& open) {
case 0: case 0:
InsertHelpHoverText( InsertHelpHoverText(
"King Zora obstructs the way to Zora's Fountain.\nRuto's Letter must be " "King Zora obstructs the way to Zora's Fountain.\nRuto's Letter must be "
"shown as child in order to\nmove him from both eras."); "shown as child in order to move him from both eras.");
break; break;
case 1: case 1:
InsertHelpHoverText( InsertHelpHoverText(
"King Zora is always moved in the adult era.\nThis means Ruto's Letter is " "King Zora is always moved in the adult era.\nThis means Ruto's Letter is "
"only required to\naccess Zora's fountain as child."); "only required to access Zora's fountain as child.");
break; break;
case 2: case 2:
InsertHelpHoverText( InsertHelpHoverText(
"King Zora starts as moved in both the child and\nadult eras.\nThis also " "King Zora starts as moved in both the child and adult eras.\nThis also "
"removes Ruto's Letter from the\npool since it can't be used."); "removes Ruto's Letter from the pool since it can't be used.");
break; break;
} }
SohImGui::EnhancementCombobox("gRandomizeZorasFountain", randoZorasFountain, 3, 0); SohImGui::EnhancementCombobox("gRandomizeZorasFountain", randoZorasFountain, 3, 0);
@ -3632,9 +3632,9 @@ void DrawRandoEditor(bool& open) {
break; break;
case 2: case 2:
InsertHelpHoverText( InsertHelpHoverText(
"The carpenters are rescued from the start of the\ngame and if \"Shuffle " "The carpenters are rescued from the start of the game and if \"Shuffle "
"Gerudo Card\" is disabled,\nthe player starts with the Gerudo Card in " "Gerudo Card\" is disabled, the player starts with the Gerudo Card in "
"the\ninventory allowing access to Gerudo Training\nGrounds."); "the inventory allowing access to Gerudo Training Grounds.");
break; break;
} }
SohImGui::EnhancementCombobox("gRandomizeGerudoFortress", randoGerudoFortress, 3, 1); SohImGui::EnhancementCombobox("gRandomizeGerudoFortress", randoGerudoFortress, 3, 1);
@ -3645,41 +3645,40 @@ void DrawRandoEditor(bool& open) {
SohImGui::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, 7, 3); SohImGui::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, 7, 3);
switch (CVar_GetS32("gRandomizeRainbowBridge", 3)) { switch (CVar_GetS32("gRandomizeRainbowBridge", 3)) {
case 1: case 1:
InsertHelpHoverText("The Rainbow Bridge requires Shadow and Spirit\nMedallions as well " InsertHelpHoverText("The Rainbow Bridge requires Shadow and Spirit Medallions as well "
"as Light Arrows."); "as Light Arrows.");
break; break;
case 2: case 2:
InsertHelpHoverText("The Rainbow Bridge requires collecting a\nconfigurable number of " InsertHelpHoverText("The Rainbow Bridge requires collecting a configurable number of "
"Spiritual Stones."); "Spiritual Stones.");
SohImGui::EnhancementSliderInt("Stone Count: %d", "##RandoStoneCount", SohImGui::EnhancementSliderInt("Stone Count: %d", "##RandoStoneCount",
"gRandomizeStoneCount", 0, 3, ""); "gRandomizeStoneCount", 0, 3, "");
SetLastItemHoverText( SetLastItemHoverText(
"Sets the number of Spiritual Stones required to\nspawn the Rainbow Bridge."); "Sets the number of Spiritual Stones required to spawn the Rainbow Bridge.");
break; break;
case 3: case 3:
SohImGui::EnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount", SohImGui::EnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount",
"gRandomizeMedallionCount", 0, 6, "", 6); "gRandomizeMedallionCount", 0, 6, "", 6);
SetLastItemHoverText( SetLastItemHoverText(
"The Rainbow Bridge requires collecting a\nconfigurable number of Medallions."); "The Rainbow Bridge requires collecting a configurable number of Medallions.");
break; break;
case 4: case 4:
SohImGui::EnhancementSliderInt("Reward Count: %d", "##RandoRewardCount", SohImGui::EnhancementSliderInt("Reward Count: %d", "##RandoRewardCount",
"gRandomizeRewardCount", 0, 9, ""); "gRandomizeRewardCount", 0, 9, "");
SetLastItemHoverText("The Rainbow Bridge requires collecting a\nconfigurable number of " SetLastItemHoverText("The Rainbow Bridge requires collecting a configurable number of "
"Dungeon Rewards."); "Dungeon Rewards.");
break; break;
case 5: case 5:
SohImGui::EnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount", SohImGui::EnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount",
"gRandomizeDungeonCount", 0, 8, ""); "gRandomizeDungeonCount", 0, 8, "");
SetLastItemHoverText( SetLastItemHoverText(
"The Rainbow Bridge requires completing a\nconfigurable number of " "The Rainbow Bridge requires completing a configurable number of Dungeons.\nDungeons "
"Dungeons.\n\nDungeons " "are considered complete when Link steps into the blue warp at the end of them.");
"are considered complete when Link steps\ninto the blue warp at the end of them.");
break; break;
case 6: case 6:
SohImGui::EnhancementSliderInt("Token Count: %d", "##RandoTokenCount", SohImGui::EnhancementSliderInt("Token Count: %d", "##RandoTokenCount",
"gRandomizeTokenCount", 0, 100, ""); "gRandomizeTokenCount", 0, 100, "");
SetLastItemHoverText("The Rainbow Bridge requires collecting a\nconfigurable number of " SetLastItemHoverText("The Rainbow Bridge requires collecting a configurable number of "
"Gold Skulltula Tokens."); "Gold Skulltula Tokens.");
break; break;
} }
@ -3688,17 +3687,17 @@ void DrawRandoEditor(bool& open) {
// Random Ganon's Trials // Random Ganon's Trials
/* /*
ImGui::Text("Random Ganon's Trials"); ImGui::Text("Random Ganon's Trials");
InsertHelpHoverText("Sets a random number or required trials to enter\nGanon's Tower."); InsertHelpHoverText("Sets a random number or required trials to enter Ganon's Tower.");
SohImGui::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, 2, 0); SohImGui::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, 2, 0);
if (CVar_GetS32("gRandomizeGanonTrial", 0) == 0) { if (CVar_GetS32("gRandomizeGanonTrial", 0) == 0) {
*/ */
//SohImGui::EnhancementSliderInt("Ganon's Trial Count: %d", "##RandoTrialCount", //SohImGui::EnhancementSliderInt("Ganon's Trial Count: %d", "##RandoTrialCount",
// "gRandomizeGanonTrialCount", 0, 6, ""); // "gRandomizeGanonTrialCount", 0, 6, "");
//InsertHelpHoverText("Set the number of trials required to enter\nGanon's Tower."); //InsertHelpHoverText("Set the number of trials required to enter Ganon's Tower.");
// RANDTODO: Switch back to slider when pre-completing some of Ganon's Trials is properly implemnted. // RANDTODO: Switch back to slider when pre-completing some of Ganon's Trials is properly implemnted.
SohImGui::EnhancementCheckbox("Skip Ganon's Trials", "gRandomizeGanonTrialCount"); SohImGui::EnhancementCheckbox("Skip Ganon's Trials", "gRandomizeGanonTrialCount");
InsertHelpHoverText( InsertHelpHoverText(
"Sets whether or not Ganon's Castle Trials are required\nto enter Ganon's Tower."); "Sets whether or not Ganon's Castle Trials are required to enter Ganon's Tower.");
// } // }
ImGui::Separator(); ImGui::Separator();
@ -3717,9 +3716,9 @@ void DrawRandoEditor(bool& open) {
// Starting Age // Starting Age
// ImGui::Text("Starting Age"); // ImGui::Text("Starting Age");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Choose which age Link will start as.\n\nStarting as adult means you start with the " // "Choose which age Link will start as.\nStarting as adult means you start with the "
// "Master\nSword " // "Master Sword in your inventory.\nOnly the child option is compatible with "
// "in your inventory.\n\nOnly the child option is compatible with Closed\nForest."); // "Closed Forest.");
// SohImGui::EnhancementCombobox("gRandomizeStartingAge", randoStartingAge, 3, 0); // SohImGui::EnhancementCombobox("gRandomizeStartingAge", randoStartingAge, 3, 0);
// ImGui::Separator(); // ImGui::Separator();
@ -3727,31 +3726,26 @@ void DrawRandoEditor(bool& open) {
// Shuffle Entrances // Shuffle Entrances
// ImGui::Text("Shuffle Entrances"); // ImGui::Text("Shuffle Entrances");
// InsertHelpHoverText("Shuffle where the entrances between areas lead to.\n" // InsertHelpHoverText("Shuffle where the entrances between areas lead to.\n"
// "If turned on, select which kinds of entrances you\n" // "If turned on, select which kinds of entrances you "
// "want shuffled in the options below. Note that some\n" // "want shuffled in the options below.\n Note that some "
// "types of entrances can have widly varying\ngeneration times."); // "types of entrances can have widly varying generation times.");
// SohImGui::EnhancementCombobox("gRandomizeShuffleEntrances", randoShuffleEntrances, 2, 0); // SohImGui::EnhancementCombobox("gRandomizeShuffleEntrances", randoShuffleEntrances, 2, 0);
// if (CVar_GetS32("gRandomizeShuffleEntrances", 0) == 1) { // if (CVar_GetS32("gRandomizeShuffleEntrances", 0) == 1) {
// ImGui::Indent(); // ImGui::Indent();
// ImGui::Text("Shuffle Dungeons Entrances"); // ImGui::Text("Shuffle Dungeons Entrances");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Shuffle the pool of dungeon entrances, including\nBottom of the Well, Ice caven and " // "Shuffle the pool of dungeon entrances, including Bottom of the Well, Ice Cavern and "
// "Gerudo\n" // "Gerudo Training Grounds\nGanon's Castle is not shuffled.\nAdditionally, the entrance "
// "Training Grounds However, Ganon's Caslte is not\nshuffled.\n\nAdditionally, the " // "of Deku Tree, Fire Temple and Bottom of the Well are open for both adult and child.");
// "entrance "
// "of "
// "Deku Tree, Fire\nTemple and Bottom of the Well are opened for both\nadult and child.");
// SohImGui::EnhancementCombobox("gRandomizeShuffleDungeonsEntrances", // SohImGui::EnhancementCombobox("gRandomizeShuffleDungeonsEntrances",
// randoShuffleDungeonsEntrances, 2, 0); // randoShuffleDungeonsEntrances, 2, 0);
// ImGui::Text("Shuffle Overworld Entrances"); // ImGui::Text("Shuffle Overworld Entrances");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Shuffle the pool of Overworld entrances, which\ncorresponds to almost all loading " // "Shuffle the pool of Overworld entrances, which corresponds to almost all loading "
// "zones " // "zones between Overworld areas.\nSome entrances are unshuffled to avoid issues:\n"
// "between\nOverworld areas.\n\nSome entrances are unshuffled to avoid issues:\n- Hyrule " // "- Hyrule Castle Courtyard and Garden entrance\n"
// "Castle " // "- Both Market Back Alley entrances\n"
// "Courtyard and Garden entrance\n- Both Market Back Alley entrances\n- Gerudo Valley to " // "- Gerudo Valley to Lake Hylia (unless entrances are decoupled)");
// "Lake "
// "Hylia (unless entrances\nare decoupled).");
// SohImGui::EnhancementCombobox("gRandomizeShuffleOverworldEntrances", // SohImGui::EnhancementCombobox("gRandomizeShuffleOverworldEntrances",
// randoShuffleOverworldEntrances, 2, 0); // randoShuffleOverworldEntrances, 2, 0);
// ImGui::Text("Shuffle Interiors Entrances"); // ImGui::Text("Shuffle Interiors Entrances");
@ -3760,8 +3754,8 @@ void DrawRandoEditor(bool& open) {
// randoShuffleInteriorsEntrances, 2, 0); // randoShuffleInteriorsEntrances, 2, 0);
// ImGui::Text("Shuffle Grottos Entrances"); // ImGui::Text("Shuffle Grottos Entrances");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Shuffle the pool of grotto entrances, including\nall graves, small Fairy " // "Shuffle the pool of grotto entrances, including all graves, small Fairy "
// "fountains and the Lost\nWoods Stage."); // "fountains and the Lost Woods Stage.");
// SohImGui::EnhancementCombobox("gRandomizeShuffleGrottosEntrances", // SohImGui::EnhancementCombobox("gRandomizeShuffleGrottosEntrances",
// randoShuffleGrottosEntrances, 2, 0); // randoShuffleGrottosEntrances, 2, 0);
// ImGui::Unindent(); // ImGui::Unindent();
@ -3772,9 +3766,8 @@ void DrawRandoEditor(bool& open) {
// Bombchus in Logic // Bombchus in Logic
// ImGui::Text("Bombchus in Logic"); // ImGui::Text("Bombchus in Logic");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Bombchus are properly considered in logic.\nThey can be replenished in shops " // "Bombchus are properly considered in logic.\nThey can be replenished in shops or "
// "or trough\nbombchu " // "through bombchu drops, if those are enabled.\nBombchu Bowling is opened by bombchus.");
// "drops, if those are enabled.\nBombchu Bowling is opened by bombchus.");
// SohImGui::EnhancementCombobox("gRandomizeBombchusInLogic", randoBombchusInLogic, 3, 0); // SohImGui::EnhancementCombobox("gRandomizeBombchusInLogic", randoBombchusInLogic, 3, 0);
// ImGui::Separator(); // ImGui::Separator();
@ -3784,17 +3777,17 @@ void DrawRandoEditor(bool& open) {
// switch (CVar_GetS32("gRandomizeAmmoDrops", 0)) { // switch (CVar_GetS32("gRandomizeAmmoDrops", 0)) {
// case 0: // case 0:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Bombs, arrows, seeds, nuts, sticks and\nmagic jars appear as normal.\n" // "Bombs, arrows, seeds, nuts, sticks and magic jars appear as normal.\n"
// "Bombchus can sometimes replace bomb drops."); // "Bombchus can sometimes replace bomb drops.");
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText( // InsertHelpHoverText(
// "All ammo drops will be replaced by blue rupees,\nexcept for Deku Sticks.\n" // "All ammo drops will be replaced by blue rupees, except for Deku Sticks.\n"
// "Ammo upgrades will only refill ammo by 10 units."); // "Ammo upgrades will only refill ammo by 10 units.");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Bombs, arrow, seeds, nuts, sticks and\nmagic jars appear as normal."); // "Bombs, arrow, seeds, nuts, sticks and magic jars appear as normal.");
// break; // break;
// } // }
// SohImGui::EnhancementCombobox("gRandomizeAmmoDrops", randoAmmoDrops, 3, 0); // SohImGui::EnhancementCombobox("gRandomizeAmmoDrops", randoAmmoDrops, 3, 0);
@ -3844,20 +3837,19 @@ void DrawRandoEditor(bool& open) {
switch (CVar_GetS32("gRandomizeShuffleDungeonReward", 0)) { switch (CVar_GetS32("gRandomizeShuffleDungeonReward", 0)) {
case 0: case 0:
InsertHelpHoverText( InsertHelpHoverText(
"Medallions and Spiritual Stones will be given as\nrewards for beating " "Medallions and Spiritual Stones will be given as rewards for beating dungeons.\n"
"dungeons.\n\nThis " "This setting will force Link's Pocket to be a Medallion or a Spiritual Stone.");
"setting will force Link's Pocket to be a\nMedallion or a Spiritual Stone.");
break; break;
case 1: case 1:
InsertHelpHoverText( InsertHelpHoverText(
"Medallions and Spiritual Stones can only appear\ninside of dungeons."); "Medallions and Spiritual Stones can only appear inside of dungeons.");
break; break;
case 2: case 2:
InsertHelpHoverText( InsertHelpHoverText(
"Medallions and Spiritual Stones can only appear\noutside dungeons."); "Medallions and Spiritual Stones can only appear outside dungeons.");
break; break;
case 3: case 3:
InsertHelpHoverText("Medallions and Spiritual Stones can appear\nanywhere."); InsertHelpHoverText("Medallions and Spiritual Stones can appear anywhere.");
break; break;
} }
SohImGui::EnhancementCombobox("gRandomizeShuffleDungeonReward", randoShuffleDungeonRewards, 4, SohImGui::EnhancementCombobox("gRandomizeShuffleDungeonReward", randoShuffleDungeonRewards, 4,
@ -3870,16 +3862,16 @@ void DrawRandoEditor(bool& open) {
// ImGui::Text("Link's Pocket"); // ImGui::Text("Link's Pocket");
// switch (CVar_GetS32("gRandomizeLinksPocket", 0)) { // switch (CVar_GetS32("gRandomizeLinksPocket", 0)) {
// case 0: // case 0:
// InsertHelpHoverText("Link will start with a Dungeon Reward in his\ninventory."); // InsertHelpHoverText("Link will start with a Dungeon Reward in his inventory.");
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText("Link will receive a random advancement item at the\nbeginning " // InsertHelpHoverText("Link will receive a random advancement item at the beginning "
// "of the playtrough."); // "of the playtrough.");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Link will recieve a random item from the item pool\nat the beginning " // "Link will recieve a random item from the item pool at the beginning "
// "of the playthrought."); // "of the playthrough.");
// break; // break;
// case 3: // case 3:
// InsertHelpHoverText("Link will start with a very useful green rupee."); // InsertHelpHoverText("Link will start with a very useful green rupee.");
@ -3894,16 +3886,15 @@ void DrawRandoEditor(bool& open) {
ImGui::Text("Shuffle Songs"); ImGui::Text("Shuffle Songs");
switch (CVar_GetS32("gRandomizeShuffleSongs", 0)) { switch (CVar_GetS32("gRandomizeShuffleSongs", 0)) {
case 0: case 0:
InsertHelpHoverText("Songs will only appear at locations that normally\nteach songs."); InsertHelpHoverText("Songs will only appear at locations that normally teach songs.");
break; break;
case 1: case 1:
InsertHelpHoverText("Songs appear at the end of dungeons.\nFor major dungeons, they " InsertHelpHoverText("Songs appear at the end of dungeons.\nFor major dungeons, they "
"will be at the boss " "will be at the boss heart container location.\nThe remaining 4 "
"heart container location.\nThe remaining 4 songs are placed " "songs are placed at:\n- Zelda's Lullaby location\n"
"at:\n- Zelda's Lullaby " "- Ice Cavern's Serenade of Water Location\n"
"location\n- Ice Cavern's Serenade of Water Location\n- Bottom of " "- Bottom of the Well's Lens of Truth Location\n"
"the Well's Lens of " "- Gerudo Training Ground's Ice Arrow Location.");
"Truth Location\n- Gerudo Training Ground's Ice Arrow Location.");
break; break;
case 2: case 2:
InsertHelpHoverText("Songs can appear in any location"); InsertHelpHoverText("Songs can appear in any location");
@ -3920,32 +3911,32 @@ void DrawRandoEditor(bool& open) {
// InsertHelpHoverText("All shop items will be the same as vanilla."); // InsertHelpHoverText("All shop items will be the same as vanilla.");
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText("Vanilla shop items will be shuffled among\ndifferent shops."); // InsertHelpHoverText("Vanilla shop items will be shuffled among different shops.");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Vanilla shop items will be shuffled among different shops, and each " // "Vanilla shop items will be shuffled among different shops, and each "
// "shop will contain\n1 non-vanilla shop item."); // "shop will contain 1 non-vanilla shop item.");
// break; // break;
// case 3: // case 3:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Vanilla shop items will be shuffled among different shops, and each " // "Vanilla shop items will be shuffled among different shops, and each "
// "shop will contain\n2 non-vanilla shop items."); // "shop will contain 2 non-vanilla shop items.");
// break; // break;
// case 4: // case 4:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Vanilla shop items will be shuffled among different shops, and each " // "Vanilla shop items will be shuffled among different shops, and each "
// "shop will contain\n3 non-vanilla shop items."); // "shop will contain 3 non-vanilla shop items.");
// break; // break;
// case 5: // case 5:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Vanilla shop items will be shuffled among different shops, and each " // "Vanilla shop items will be shuffled among different shops, and each "
// "shop will contain\n4 non-vanilla shop items."); // "shop will contain 4 non-vanilla shop items.");
// break; // break;
// case 6: // case 6:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Vanilla shop items will be shuffled among different shops, and each " // "Vanilla shop items will be shuffled among different shops, and each "
// "shop will contain\n1 to 4 non-vanilla shop items."); // "shop will contain 1 to 4 non-vanilla shop items.");
// break; // break;
// } // }
// SohImGui::EnhancementCombobox("gRandomizeShopsanity", randoShopsanity, 7, 0); // SohImGui::EnhancementCombobox("gRandomizeShopsanity", randoShopsanity, 7, 0);
@ -3960,16 +3951,15 @@ void DrawRandoEditor(bool& open) {
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText( // InsertHelpHoverText(
// "This only shuffles 65 location that are\nwithing dungeons, increasing the value " // "This only shuffles 65 location that are within dungeons, increasing the value "
// "of " // "of most dungeons and making internal dungeon exploration more diverse.");
// "most\ndungeons and making internal dungeon exploration\nmore diverse.");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText( // InsertHelpHoverText(
// "This only shuffles the 65 locations that are\noutside of dungeons."); // "This only shuffles the 65 locations that are outside of dungeons.");
// break; // break;
// case 3: // case 3:
// InsertHelpHoverText("Effectively adds 100 new locations for items to\nappear."); // InsertHelpHoverText("Effectively adds 100 new locations for items to appear.");
// break; // break;
// } // }
// SohImGui::EnhancementCombobox("gRandomizeTokensanity", randoTokensanity, 4, 0); // SohImGui::EnhancementCombobox("gRandomizeTokensanity", randoTokensanity, 4, 0);
@ -3981,15 +3971,15 @@ void DrawRandoEditor(bool& open) {
// switch (CVar_GetS32("gRandomizeShuffleScrubs", 0)) { // switch (CVar_GetS32("gRandomizeShuffleScrubs", 0)) {
// case 0: // case 0:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Only the 3 Scrubs that give one-time items in the\nvanilla game (PoH, " // "Only the 3 Scrubs that give one-time items in the vanilla game (PoH, "
// "Deku Nut capacity, and Deku\nStick capacity) will have random items."); // "Deku Nut capacity, and Deku Stick capacity) will have random items.");
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText("All Scrub prices will be reduced to 10 rupees each."); // InsertHelpHoverText("All Scrub prices will be reduced to 10 rupees each.");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText("All Scrub prices will be their vanilla prices.\nThis will require " // InsertHelpHoverText("All Scrub prices will be their vanilla prices.\nThis will require "
// "spending over 1000 rupees on\nSrubs."); // "spending over 1000 rupees on Scrubs.");
// break; // break;
// case 3: // case 3:
// InsertHelpHoverText("All Scrub prices will be between 0 to 95 rupees.\nThis will on " // InsertHelpHoverText("All Scrub prices will be between 0 to 95 rupees.\nThis will on "
@ -4003,16 +3993,16 @@ void DrawRandoEditor(bool& open) {
// // Shuffle Cows // // Shuffle Cows
// ImGui::Text("Shuffle Cows"); // ImGui::Text("Shuffle Cows");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Enabling this will let cows give you items upon\nperforming Epona's Song in " // "Enabling this will let cows give you items upon performing Epona's Song in "
// "front of them. There\nare 9 cows."); // "front of them. There are 9 cows.");
// SohImGui::EnhancementCombobox("gRandomizeShuffleCows", randoShuffleCows, 2, 0); // SohImGui::EnhancementCombobox("gRandomizeShuffleCows", randoShuffleCows, 2, 0);
// ImGui::Separator(); // ImGui::Separator();
if(CVar_GetS32("gRandomizeStartingKokiriSword", 0) == 0) { if(CVar_GetS32("gRandomizeStartingKokiriSword", 0) == 0) {
// Shuffle Kokiri Sword // Shuffle Kokiri Sword
ImGui::Text("Shuffle Kokiri Sword"); ImGui::Text("Shuffle Kokiri Sword");
InsertHelpHoverText("Enabling this shuffles the Kokiri Sword into the item pool.\n\nThis will " InsertHelpHoverText("Enabling this shuffles the Kokiri Sword into the item pool.\nThis will "
"require extensive use of sticks until\nthe sword is found."); "require extensive use of sticks until the sword is found.");
SohImGui::EnhancementCombobox("gRandomizeShuffleKokiriSword", randoShuffleKokiriSword, 2, 0); SohImGui::EnhancementCombobox("gRandomizeShuffleKokiriSword", randoShuffleKokiriSword, 2, 0);
ImGui::Separator(); ImGui::Separator();
} }
@ -4020,9 +4010,9 @@ void DrawRandoEditor(bool& open) {
if(CVar_GetS32("gRandomizeStartingOcarina", 0) == 0) { if(CVar_GetS32("gRandomizeStartingOcarina", 0) == 0) {
// Shuffle Ocarinas // Shuffle Ocarinas
ImGui::Text("Shuffle Ocarinas"); ImGui::Text("Shuffle Ocarinas");
InsertHelpHoverText("Enabling this shuffles the Fairy Ocarina and the\nOcarina of time into " InsertHelpHoverText("Enabling this shuffles the Fairy Ocarina and the Ocarina of time into "
"the item pool.\n\nThis " "the item pool.\n"
"will require finding an Ocarina before being\nable to play songs."); "This will require finding an Ocarina before being able to play songs.");
SohImGui::EnhancementCombobox("gRandomizeShuffleOcarinas", randoShuffleOcarinas, 2, 0); SohImGui::EnhancementCombobox("gRandomizeShuffleOcarinas", randoShuffleOcarinas, 2, 0);
ImGui::Separator(); ImGui::Separator();
} }
@ -4032,11 +4022,11 @@ void DrawRandoEditor(bool& open) {
// Shuffle Weird Egg // Shuffle Weird Egg
ImGui::Text("Shuffle Weird Egg"); ImGui::Text("Shuffle Weird Egg");
InsertHelpHoverText( InsertHelpHoverText(
"Enabling this shuffles the Weird Egg from Malon\ninto the item pool.\nThis " "Enabling this shuffles the Weird Egg from Malon into the item pool.\nThis "
"will require finding the Weird Egg to talk to\nZelda in Hyrule Castle which " "will require finding the Weird Egg to talk to Zelda in Hyrule Castle which "
"in turn locks\nrewards from Impa, Xaria, Malon and Talon as\nwell as the " "in turn unlocks rewards from Impa, Saria, Malon and Talon as well as the "
"Happy Mask Sidequest. The Weird egg\nis also required for Zelda's Letter to " "Happy Mask Sidequest.\nThe Weird egg is also required for Zelda's Letter to "
"unlock the\nKakariko Gate as child which can lock some\nprogression."); "unlock the Kakariko Gate as child which can lock some progression.");
SohImGui::EnhancementCombobox("gRandomizeShuffleWeirdEgg", randoShuffleWeirdEgg, 2, 0); SohImGui::EnhancementCombobox("gRandomizeShuffleWeirdEgg", randoShuffleWeirdEgg, 2, 0);
ImGui::Separator(); ImGui::Separator();
} }
@ -4044,16 +4034,16 @@ void DrawRandoEditor(bool& open) {
// Shuffle Gerudo Membership Card // Shuffle Gerudo Membership Card
ImGui::Text("Shuffle Gerudo Membership Card"); ImGui::Text("Shuffle Gerudo Membership Card");
InsertHelpHoverText( InsertHelpHoverText(
"Enabling this shuffles the Gerudo Membership Card into the\nitem pool.\n\nThe Gerudo " "Enabling this shuffles the Gerudo Membership Card into the item pool.\nThe Gerudo "
"Token is required to enter the Gerudo\nTraining Ground."); "Token is required to enter the Gerudo Training Ground.");
SohImGui::EnhancementCombobox("gRandomizeShuffleGerudoToken", randoShuffleGerudoToken, 2, 0); SohImGui::EnhancementCombobox("gRandomizeShuffleGerudoToken", randoShuffleGerudoToken, 2, 0);
ImGui::Separator(); ImGui::Separator();
// todo implement magic bean 10 pack // todo implement magic bean 10 pack
// // Shuffle Magic Beans // // Shuffle Magic Beans
// ImGui::Text("Shuffle Magic Beans"); // ImGui::Text("Shuffle Magic Beans");
// InsertHelpHoverText("Enabling this adds a pack of 10 beans to the item\n" // InsertHelpHoverText("Enabling this adds a pack of 10 beans to the item "
// "pool and changes the Magic Bean Salesman to sell a\n" // "pool and changes the Magic Bean Salesman to sell a "
// "random item at a price of 60 rupees."); // "random item at a price of 60 rupees.");
// SohImGui::EnhancementCombobox("gRandomizeShuffleMagicBeans", randoShuffleMagicBeans, 2, 0); // SohImGui::EnhancementCombobox("gRandomizeShuffleMagicBeans", randoShuffleMagicBeans, 2, 0);
// ImGui::Separator(); // ImGui::Separator();
@ -4063,13 +4053,13 @@ void DrawRandoEditor(bool& open) {
// ImGui::Text("Shuffle Merchants"); // ImGui::Text("Shuffle Merchants");
// if (CVar_GetS32("gRandomizeShuffleMerchants", 0) == 0) { // if (CVar_GetS32("gRandomizeShuffleMerchants", 0) == 0) {
// InsertHelpHoverText( // InsertHelpHoverText(
// "Enabling this adds a Giant's Knife and a pack\nof Bombchus to the item " // "Enabling this adds a Giant's Knife and a pack of Bombchus to the item "
// "pool and changes both\nMediagoron and the Haunted Wasteland " // "pool and changes both Mediagoron and the Haunted Wasteland "
// "Carpet\nSalesman to sell a random item once at the price\nof 200 rupees."); // "Carpet Salesman to sell a random item once at the price of 200 rupees.");
// } else if (CVar_GetS32("gRandomizeShuffleMerchants", 0) <= 2) { // } else if (CVar_GetS32("gRandomizeShuffleMerchants", 0) <= 2) {
// InsertHelpHoverText( // InsertHelpHoverText(
// "These hints will make Medigoron and the Carpet\nsalesman tell you which item they\'re " // "These hints will make Medigoron and the Carpet salesman tell you which item they're "
// "selling.\n\nThe Clearer Hints setting will affect how they\nrefer to the item."); // "selling.\nThe Clearer Hints setting will affect how they refer to the item.");
// } // }
// SohImGui::EnhancementCombobox("gRandomizeShuffleMerchants", randoShuffleMerchants, 3, 0); // SohImGui::EnhancementCombobox("gRandomizeShuffleMerchants", randoShuffleMerchants, 3, 0);
// ImGui::Separator(); // ImGui::Separator();
@ -4078,13 +4068,10 @@ void DrawRandoEditor(bool& open) {
// Shuffle Adult Trade // Shuffle Adult Trade
// ImGui::Text("Shuffle Adult Trade"); // ImGui::Text("Shuffle Adult Trade");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Enabling this adds all of the adult trade quest\nitems to the pool, each of which can be " // "Enabling this adds all of the adult trade quest items to the pool, each of which can be "
// "traded\nfor a unique reward You will be able to choose\nwhich of your owner adult trade " // "traded for a unique reward.\nYou will be able to choose which of your adult trade items "
// "items " // "are visible in the inventory by selecting the item and using the L and R buttons.\n"
// " " // "If disabled only the Claim Check will be found in the pool.");
// "is visible\nin the inventory by selecting the item and using\nthe L and R buttons If "
// "disabled "
// "only the Claim\nCheck will be found in the pool.");
// SohImGui::EnhancementCombobox("gRandomizeShuffleAdultTrade", randoShuffleAdultTrade, 2, 0); // SohImGui::EnhancementCombobox("gRandomizeShuffleAdultTrade", randoShuffleAdultTrade, 2, 0);
} }
ImGui::PopItemWidth(); ImGui::PopItemWidth();
@ -4115,26 +4102,26 @@ void DrawRandoEditor(bool& open) {
// ImGui::Text("Maps / Compasses"); // ImGui::Text("Maps / Compasses");
// switch (CVar_GetS32("gRandomizeShuffleMapsAndCompasses", 0)) { // switch (CVar_GetS32("gRandomizeShuffleMapsAndCompasses", 0)) {
// case 0: // case 0:
// InsertHelpHoverText("Maps and Compasses can only appear in their repsective dungeon."); // InsertHelpHoverText("Maps and Compasses can only appear in their respective dungeon.");
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Maps and Compasses can only appear in a dungeon\nbut not necessarily the " // "Maps and Compasses can only appear in a dungeon but not necessarily the "
// "dungeon they are for."); // "dungeon they are for.");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText("Maps and Compasses can only appear outside of\ndungeons."); // InsertHelpHoverText("Maps and Compasses can only appear outside of dungeons.");
// break; // break;
// case 3: // case 3:
// InsertHelpHoverText("Maps and Compasses can appear anywhere in the\nworld."); // InsertHelpHoverText("Maps and Compasses can appear anywhere in the world.");
// break; // break;
// case 4: // case 4:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Maps and Compasses are given to you from the start.\nThis will add a " // "Maps and Compasses are given to you from the start.\nThis will add a "
// "small amount of money and\nrefill items to the pool."); // "small amount of money and refill items to the pool.");
// break; // break;
// case 5: // case 5:
// InsertHelpHoverText("Maps and Compasses will appear in their vanilla\nlocations."); // InsertHelpHoverText("Maps and Compasses will appear in their vanilla locations.");
// break; // break;
// } // }
// SohImGui::EnhancementCombobox("gRandomizeShuffleMapsAndCompasses", randoShuffleMapsAndCompasses, // SohImGui::EnhancementCombobox("gRandomizeShuffleMapsAndCompasses", randoShuffleMapsAndCompasses,
@ -4146,28 +4133,28 @@ void DrawRandoEditor(bool& open) {
// ImGui::Text("Small Keys"); // ImGui::Text("Small Keys");
// switch (CVar_GetS32("gRandomizeShuffleSmallKeys", 0)) { // switch (CVar_GetS32("gRandomizeShuffleSmallKeys", 0)) {
// case 0: // case 0:
// InsertHelpHoverText("Small Keys can only appear in their respective\ndungeon."); // InsertHelpHoverText("Small Keys can only appear in their respective dungeon.");
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Small Keys can only appear inside of any dungon,\nbut won't necessarily " // "Small Keys can only appear inside of any dungon, but won't necessarily "
// "be in the dungeon that the\nkey is for.\nA difficult mode since it is " // "be in the dungeon that the key is for.\nA difficult mode since it is "
// "more likely\nto need to enter a dungeon multiple times."); // "more likely to need to enter a dungeon multiple times.");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Small Keys can only appear outside of dungeons.\nYou may need to enter a " // "Small Keys can only appear outside of dungeons.\nYou may need to enter a "
// "dungeon multiple times to\ngain items to access the overworld locations " // "dungeon multiple times to gain items to access the overworld locations "
// "with\nthe keys required to finish a dungeon."); // "with the keys required to finish a dungeon.");
// break; // break;
// case 3: // case 3:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Small Keys can appear anywhere in the world.\nA difficult mode since it " // "Small Keys can appear anywhere in the world.\nA difficult mode since it "
// "is more likely to need to\nenter a dungeon multiple times."); // "is more likely to need to enter a dungeon multiple times.");
// break; // break;
// case 4: // case 4:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Small Keys are given to you from the start so you\nwon't have to worry " // "Small Keys are given to you from the start so you won't have to worry "
// "about locked doors.\nAn easier mode."); // "about locked doors.\nAn easier mode.");
// break; // break;
// case 5: // case 5:
@ -4183,18 +4170,17 @@ void DrawRandoEditor(bool& open) {
// switch (CVar_GetS32("gRandomizeShuffleGerudoFortressKeys", 0)) { // switch (CVar_GetS32("gRandomizeShuffleGerudoFortressKeys", 0)) {
// case 0: // case 0:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Gerudo Fortress Keys will appear in their vanilla\nlocation dropping " // "Gerudo Fortress Keys will appear in their vanilla location dropping from "
// "from fighting Gerudo " // "fighting Gerudo guards that attack when trying to free the jailed carpenters.");
// "guard\nthat attack when trying to free the jailed\ncarpenters.");
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText("Gerudo Fortress Keys can only appear inside of\ndungeons."); // InsertHelpHoverText("Gerudo Fortress Keys can only appear inside of dungeons.");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText("Gerudo Fortress Keys can only appear outside of\ndungeons."); // InsertHelpHoverText("Gerudo Fortress Keys can only appear outside of dungeons.");
// break; // break;
// case 3: // case 3:
// InsertHelpHoverText("Gerudo Fortress Keys can appear anywhere in the\nworld."); // InsertHelpHoverText("Gerudo Fortress Keys can appear anywhere in the world.");
// break; // break;
// } // }
// SohImGui::EnhancementCombobox("gRandomizeShuffleGerudoFortressKeys", // SohImGui::EnhancementCombobox("gRandomizeShuffleGerudoFortressKeys",
@ -4206,28 +4192,27 @@ void DrawRandoEditor(bool& open) {
// ImGui::Text("Boss Keys"); // ImGui::Text("Boss Keys");
// switch (CVar_GetS32("gRandomizeShuffleBossKeys", 0)) { // switch (CVar_GetS32("gRandomizeShuffleBossKeys", 0)) {
// case 0: // case 0:
// InsertHelpHoverText("Boss Keys can only appear in their respective\ndungeons."); // InsertHelpHoverText("Boss Keys can only appear in their respective dungeons.");
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Boss Keys can only appear inside of any dungeon,\nbut won't necessarily " // "Boss Keys can only appear inside of any dungeon, but won't necessarily "
// "be in the dungon that the\nkey is for.\nA difficult mode since it is " // "be in the dungon that the key is for.\nA difficult mode since it is "
// "more\nlikely to need to enter a dungeon multiple times."); // "more likely to need to enter a dungeon multiple times.");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Boss keys can only appear outside of dungeons.\nYou may need to enter a dungeon " // "Boss Keys can only appear outside of dungeons.\nYou may need to enter a dungeon "
// "without " // "without the boss key to get items required to find the key in the overworld.");
// "the boss\nkey to get items required to find the key in the\noverworld.");
// break; // break;
// case 3: // case 3:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Boss key can appear anywhere in the overworld.\nA difficult mode since it " // "Boss Keys can appear anywhere in the overworld.\nA difficult mode since it "
// "is more likely to need to\nenter a dungeon multiple times."); // "is more likely to need to enter a dungeon multiple times.");
// break; // break;
// case 4: // case 4:
// InsertHelpHoverText( // InsertHelpHoverText(
// "Boss Keys are given to you from the start so you\nwon't have to worry " // "Boss Keys are given to you from the start so you won't have to worry "
// "about boss doors.\nAn easier mode."); // "about boss doors.\nAn easier mode.");
// break; // break;
// case 5: // case 5:
@ -4246,80 +4231,80 @@ void DrawRandoEditor(bool& open) {
switch (CVar_GetS32("gRandomizeShuffleGanonBossKey", 0)) { switch (CVar_GetS32("gRandomizeShuffleGanonBossKey", 0)) {
case 0: case 0:
SetLastItemHoverText( SetLastItemHoverText(
"Ganon's Boss Key is given to you from the\nstart and you don't " "Ganon's Boss Key is given to you from the start and you don't "
"have to worry about finding it."); "have to worry about finding it.");
break; break;
case 1: case 1:
SetLastItemHoverText("Ganon's Boss Key will appear in the vanilla\nlocation."); SetLastItemHoverText("Ganon's Boss Key will appear in the vanilla location.");
break; break;
case 2: case 2:
SetLastItemHoverText("Ganon's Boss Key will appear somewhere inside\nGanon's Castle."); SetLastItemHoverText("Ganon's Boss Key will appear somewhere inside Ganon's Castle.");
break; break;
// case 0: // case 0:
// SetLastItemHoverText( // SetLastItemHoverText(
// "Ganon's Castle Boss Key can only appear inside of\na dungeon, but not " // "Ganon's Castle Boss Key can only appear inside of a dungeon, but not "
// "necessarily Ganon's Castle."); // "necessarily Ganon's Castle.");
// break; // break;
// case 1: // case 1:
// SetLastItemHoverText("Ganon's Castle Boss Key can only appear outside of\ndungeons."); // SetLastItemHoverText("Ganon's Castle Boss Key can only appear outside of dungeons.");
// break; // break;
// case 2: // case 2:
// SetLastItemHoverText("Ganon's Castle Boss Key can appear anywhere in the\nworld."); // SetLastItemHoverText("Ganon's Castle Boss Key can appear anywhere in the world.");
// break; // break;
// case 3: // case 3:
// SetLastItemHoverText( // SetLastItemHoverText(
// "These settings put the boss key on the Light Arrow\nCutscene location, " // "These settings put the boss key on the Light Arrow Cutscene location, "
// "from Zelda in Temple of Time as\nadult, with differing requirements."); // "from Zelda in Temple of Time as adult, with differing requirements.");
// break; // break;
// case 4: // case 4:
// SetLastItemHoverText("Ganon's Caslte Boss Key can appear anywhere in the\nworld."); // SetLastItemHoverText("Ganon's Castle Boss Key can appear anywhere in the world.");
// break; // break;
// case 5: // case 5:
// SetLastItemHoverText( // SetLastItemHoverText(
// "These settings put the boss key on the Light Arrow\nCutscene location, " // "These settings put the boss key on the Light Arrow Cutscene location, "
// "from Zelda in Temple of Time as\nadult, with differing requirements."); // "from Zelda in Temple of Time as adult, with differing requirements.");
// SohImGui::EnhancementSliderInt("Medallion Count: %d", "##RandoGanonMedallionCount", // SohImGui::EnhancementSliderInt("Medallion Count: %d", "##RandoGanonMedallionCount",
// "gRandomizeGanonMedallionCount", 0, 6, ""); // "gRandomizeGanonMedallionCount", 0, 6, "");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Set the number of Medallions required to trigger\nthe Light Arrow Cutscene."); // "Set the number of Medallions required to trigger the Light Arrow Cutscene.");
// break; // break;
// case 6: // case 6:
// SetLastItemHoverText( // SetLastItemHoverText(
// "These settings put the boss key on the Light Arrow\nCutscene location, " // "These settings put the boss key on the Light Arrow Cutscene location, "
// "from Zelda in Temple of Time as\nadult, with differing requirements."); // "from Zelda in Temple of Time as adult, with differing requirements.");
// SohImGui::EnhancementSliderInt("Stone Count: %d", "##RandoGanonStoneCount", // SohImGui::EnhancementSliderInt("Stone Count: %d", "##RandoGanonStoneCount",
// "gRandomizeGanonStoneCount", 0, 3, ""); // "gRandomizeGanonStoneCount", 0, 3, "");
// InsertHelpHoverText("Set the number of Spiritual Stones required to trigger\nthe Light " // InsertHelpHoverText("Set the number of Spiritual Stones required to trigger the Light "
// "Arrow Cutscene."); // "Arrow Cutscene.");
// break; // break;
// case 7: // case 7:
// SetLastItemHoverText( // SetLastItemHoverText(
// "These settings put the boss key on the Light Arrow\nCutscene location, " // "These settings put the boss key on the Light Arrow Cutscene location, "
// "from Zelda in Temple of Time as\nadult, with differing requirements."); // "from Zelda in Temple of Time as adult, with differing requirements.");
// SohImGui::EnhancementSliderInt("Reward Count: %d", "##RandoGanonRewardCount", // SohImGui::EnhancementSliderInt("Reward Count: %d", "##RandoGanonRewardCount",
// "gRandomizeGanonRewardCount", 0, 9, ""); // "gRandomizeGanonRewardCount", 0, 9, "");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Set the number of Dungeon Rewards (Spiritual\nStones and Medallions) " // "Set the number of Dungeon Rewards (Spiritual Stones and Medallions) "
// "required to trigger the\nLight Arrow Cutscene."); // "required to trigger the Light Arrow Cutscene.");
// break; // break;
// case 8: // case 8:
// SetLastItemHoverText( // SetLastItemHoverText(
// "These settings put the boss key on the Light Arrow\nCutscene location, " // "These settings put the boss key on the Light Arrow Cutscene location, "
// "from Zelda in Temple of Time as\nadult, with differing requirements."); // "from Zelda in Temple of Time as adult, with differing requirements.");
// SohImGui::EnhancementSliderInt("MDungeon Count: %d", "##RandoGanonDungeonCount", // SohImGui::EnhancementSliderInt("MDungeon Count: %d", "##RandoGanonDungeonCount",
// "gRandomizeGanonDungeonCount", 0, 8, ""); // "gRandomizeGanonDungeonCount", 0, 8, "");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Set the number of completed dungeons required to\ntrigger the Light Arrow " // "Set the number of completed dungeons required to trigger the Light Arrow "
// "Cutscene.\n\nDungeons are considered complete when Link steps\ninto the " // "Cutscene.\nDungeons are considered complete when Link steps into the "
// "blue warp at the end of them."); // "blue warp at the end of them.");
// break; // break;
// case 9: // case 9:
// SetLastItemHoverText( // SetLastItemHoverText(
// "These settings put the boss key on the Light Arrow\nCutscene location, " // "These settings put the boss key on the Light Arrow Cutscene location, "
// "from Zelda in Temple of Time as\nadult, with differing requirements."); // "from Zelda in Temple of Time as adult, with differing requirements.");
// SohImGui::EnhancementSliderInt("Token Count: %d", "##RandoGanonTokenCount", // SohImGui::EnhancementSliderInt("Token Count: %d", "##RandoGanonTokenCount",
// "gRandomizeGanonTokenCount", 0, 100, ""); // "gRandomizeGanonTokenCount", 0, 100, "");
// InsertHelpHoverText("Set the number of Gold Skulltula Tokens required\nto trigger the " // InsertHelpHoverText("Set the number of Gold Skulltula Tokens required to trigger the "
// "Light Arrow Cutscene."); // "Light Arrow Cutscene.");
// break; // break;
} }
@ -4343,82 +4328,82 @@ void DrawRandoEditor(bool& open) {
// todo implement minigame repeat skip // todo implement minigame repeat skip
// // Skip Minigame repetition // // Skip Minigame repetition
// SohImGui::EnhancementCheckbox("Skip Minigame Repetition", "gRandomizeSkipMinigameRepetition"); // SohImGui::EnhancementCheckbox("Skip Minigame Repetition", "gRandomizeSkipMinigameRepetition");
// InsertHelpHoverText("Completing the second objective in the Dampe Race\nand Gerudo Archery on the " // InsertHelpHoverText("Completing the second objective in the Dampe Race and Gerudo Archery on the "
// "first attempt will give\nboth rewards at once for that minigame."); // "first attempt will give both rewards at once for that minigame.");
// ImGui::Separator(); // ImGui::Separator();
// todo implement free scarecrow (is this already in?) // todo implement free scarecrow (is this already in?)
// // Free scarecrow // // Free scarecrow
// SohImGui::EnhancementCheckbox("Free Scarecrow", "gRandomizeFreeScarecrow"); // SohImGui::EnhancementCheckbox("Free Scarecrow", "gRandomizeFreeScarecrow");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Pulling the Ocarina near a spot at which\nPierre can spawn will do so, without " // "Pulling the Ocarina near a spot at which Pierre can spawn will do so, without "
// "needing\nthe song."); // "needing the song.");
// ImGui::Separator(); // ImGui::Separator();
// todo implement skip poes (did we already?) // todo implement skip poes (did we already?)
// // Skip Four Poes cutscene // // Skip Four Poes cutscene
// SohImGui::EnhancementCheckbox("Skip Four Poes Cutscene", "gRandomizeSkipFourPoesCutscene"); // SohImGui::EnhancementCheckbox("Skip Four Poes Cutscene", "gRandomizeSkipFourPoesCutscene");
// InsertHelpHoverText( // InsertHelpHoverText(
// "The cutscene with the 4 poes in Forest Temple will\nbe skipped. If the cutscene " // "The cutscene with the 4 poes in Forest Temple will be skipped. If the cutscene "
// "is not skipped, it can\nbe exploited to reach the basement early."); // "is not skipped, it can be exploited to reach the basement early.");
// ImGui::Separator(); // ImGui::Separator();
// todo implement skip lake hylia owl // todo implement skip lake hylia owl
// // Skip Lake Hylia owl // // Skip Lake Hylia owl
// SohImGui::EnhancementCheckbox("Skip Lake Hylia Owl Cutscene", "gRandomizeSkipLakeHyliaOwl"); // SohImGui::EnhancementCheckbox("Skip Lake Hylia Owl Cutscene", "gRandomizeSkipLakeHyliaOwl");
// InsertHelpHoverText( // InsertHelpHoverText(
// "The owl flight cutscene in Lake Hylia will be\nskipped. This cutscene lets you " // "The owl flight cutscene in Lake Hylia will be skipped. This cutscene lets you "
// "see what item\nis on top of the laboratory roof."); // "see what item is on top of the laboratory roof.");
// ImGui::Separator(); // ImGui::Separator();
// Cuccos to return // Cuccos to return
SohImGui::EnhancementSliderInt("Cuccos to return: %d", "##RandoCuccosToReturn", SohImGui::EnhancementSliderInt("Cuccos to return: %d", "##RandoCuccosToReturn",
"gRandomizeCuccosToReturn", 0, 7, "", 7); "gRandomizeCuccosToReturn", 0, 7, "", 7);
InsertHelpHoverText("The cucco Lady will give a reward for returning\nthis many of her cuccos to the pen."); InsertHelpHoverText("The cucco Lady will give a reward for returning this many of her cuccos to the pen.");
ImGui::Separator(); ImGui::Separator();
// // Big Poe Target Count // // Big Poe Target Count
SohImGui::EnhancementSliderInt("Big Poe Target Count: %d", "##RandoBigPoeTargetCount", SohImGui::EnhancementSliderInt("Big Poe Target Count: %d", "##RandoBigPoeTargetCount",
"gRandomizeBigPoeTargetCount", 1, 10, "", 10); "gRandomizeBigPoeTargetCount", 1, 10, "", 10);
InsertHelpHoverText("The Poe buyer will give a reward for turning in\nthe chosen number of Big Poes."); InsertHelpHoverText("The Poe buyer will give a reward for turning in the chosen number of Big Poes.");
ImGui::Separator(); ImGui::Separator();
// // Skip child stealth // // Skip child stealth
SohImGui::EnhancementCheckbox("Skip Child Stealth", "gRandomizeSkipChildStealth"); SohImGui::EnhancementCheckbox("Skip Child Stealth", "gRandomizeSkipChildStealth");
InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to\nZelda, skipping the guards."); InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to Zelda, skipping the guards.");
ImGui::Separator(); ImGui::Separator();
// Skip Epona race // Skip Epona race
SohImGui::EnhancementCheckbox("Skip Epona Race", "gRandomizeSkipEponaRace"); SohImGui::EnhancementCheckbox("Skip Epona Race", "gRandomizeSkipEponaRace");
InsertHelpHoverText("Epona can be summoned with Epona's Song without\nneeding to race Ingo."); InsertHelpHoverText("Epona can be summoned with Epona's Song without needing to race Ingo.");
ImGui::Separator(); ImGui::Separator();
// Skip tower escape // Skip tower escape
SohImGui::EnhancementCheckbox("Skip Tower Escape", "gRandomizeSkipTowerEscape"); SohImGui::EnhancementCheckbox("Skip Tower Escape", "gRandomizeSkipTowerEscape");
InsertHelpHoverText("The tower escape sequence between Ganondorf and\nGanon will be skipped."); InsertHelpHoverText("The tower escape sequence between Ganondorf and Ganon will be skipped.");
ImGui::Separator(); ImGui::Separator();
// todo implement complete mask quest // todo implement complete mask quest
// // Complete Mask Quest // // Complete Mask Quest
// SohImGui::EnhancementCheckbox("Complete Mask Quest", "gRandomizeCompleteMaskQuest"); // SohImGui::EnhancementCheckbox("Complete Mask Quest", "gRandomizeCompleteMaskQuest");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Once the Happy Mask Shop is opened, all masks\nwill be available to be borrowed."); // "Once the Happy Mask Shop is opened, all masks will be available to be borrowed.");
// ImGui::Separator(); // ImGui::Separator();
// todo implement keep farores (in soh) // todo implement keep farores (in soh)
// // Keep Farore's Wind Warp Point // // Keep Farore's Wind Warp Point
// SohImGui::EnhancementCheckbox("Keep Farore's Wind Warp Point", "gRandomizeKeepFaroresWindWarp"); // SohImGui::EnhancementCheckbox("Keep Farore's Wind Warp Point", "gRandomizeKeepFaroresWindWarp");
// InsertHelpHoverText( // InsertHelpHoverText(
// "The Farore's Wind warp point will stay active\nafter having been warped to. The " // "The Farore's Wind warp point will stay active after having been warped to.\nThe "
// "old point will\nneed to be dispelled before setting a new one."); // "old point will need to be dispelled before setting a new one.");
// ImGui::Separator(); // ImGui::Separator();
// todo implement skip song replays (in soh) // todo implement skip song replays (in soh)
// // Skip Song Replays // // Skip Song Replays
// ImGui::Text("Skip Song Replays"); // ImGui::Text("Skip Song Replays");
// InsertHelpHoverText( // InsertHelpHoverText(
// "The automatic replay after you play a song will\nbe skipped.\nYou can choose to " // "The automatic replay after you play a song will be skipped.\nYou can choose to "
// "keep the SFX anyway, but you\nwill have control of Link during it."); // "keep the SFX anyway, but you will have control of Link during it.");
// SohImGui::EnhancementCombobox("gRandomizeSkipSongReplays", randoSkipSongReplays, 3, 0); // SohImGui::EnhancementCombobox("gRandomizeSkipSongReplays", randoSkipSongReplays, 3, 0);
// ImGui::Separator(); // ImGui::Separator();
@ -4429,12 +4414,10 @@ void DrawRandoEditor(bool& open) {
// Gossip Stone Hints // Gossip Stone Hints
ImGui::Text("Gossip Stone Hints"); ImGui::Text("Gossip Stone Hints");
InsertHelpHoverText( InsertHelpHoverText(
"Gossip Stones can be made to give hints about\nwhere items can be found.\nDifferent settings " "Gossip Stones can be made to give hints about where items can be found.\nDifferent settings can "
"can " "be chosen to decide which item is needed to speak to Gossip Stones. \nChoosing to stick with the "
"be chosen to decide which\nitem is needed to speak to Gossip Stones. Choosing\nto sticl with " "Mask of Truth will make the hints very difficult to obtain.\nHints for \"on the way of the "
"the " "hero\" are locations that contain items that are required to beat the game.");
"Mask of Trutj will make the\nhints very difficult to obtain.\nHints for \"on the way of the "
"hero\" are locations\ntaht contain items that are required to beat the\ngame.");
SohImGui::EnhancementCombobox("gRandomizeGossipStoneHints", randoGossipStoneHints, 4, 1); SohImGui::EnhancementCombobox("gRandomizeGossipStoneHints", randoGossipStoneHints, 4, 1);
if (CVar_GetS32("gRandomizeGossipStoneHints", 1) != 0) { if (CVar_GetS32("gRandomizeGossipStoneHints", 1) != 0) {
@ -4444,18 +4427,18 @@ void DrawRandoEditor(bool& open) {
switch (CVar_GetS32("gRandomizeHintClarity", 2)) { switch (CVar_GetS32("gRandomizeHintClarity", 2)) {
case 0: case 0:
InsertHelpHoverText( InsertHelpHoverText(
"Sets the difficulty of hints.\nObscure: Hints are unique for each thing, but\nthe " "Sets the difficulty of hints.\nObscure: Hints are unique for each thing, but the "
"writing may be confusing.\nEx: Kokiri Sword > a butter knife"); "writing may be confusing.\nEx: Kokiri Sword > a butter knife");
break; break;
case 1: case 1:
InsertHelpHoverText( InsertHelpHoverText(
"Sets the difficulty of hints.\nAmbiguous: Hints are clearly written, " "Sets the difficulty of hints.\nAmbiguous: Hints are clearly written, "
"but may\nrefer to more than one thing.\nEx: Kokiri Sword > a sword"); "but may refer to more than one thing.\nEx: Kokiri Sword > a sword");
break; break;
case 2: case 2:
InsertHelpHoverText( InsertHelpHoverText(
"Sets the difficulty of hints.\nClear: Hints are clearly written and " "Sets the difficulty of hints.\nClear: Hints are clearly written and "
"are unique\nfor each thing.\nEx: Kokiri Sword > the Kokiri Sword"); "are unique for each thing.\nEx: Kokiri Sword > the Kokiri Sword");
break; break;
} }
SohImGui::EnhancementCombobox("gRandomizeHintClarity", randoHintClarity, 3, 2); SohImGui::EnhancementCombobox("gRandomizeHintClarity", randoHintClarity, 3, 2);
@ -4491,7 +4474,7 @@ void DrawRandoEditor(bool& open) {
// todo implement starting time // todo implement starting time
// // Starting Time // // Starting Time
// ImGui::Text("Starting Time"); // ImGui::Text("Starting Time");
// InsertHelpHoverText("Change up Link's sleep routine."); // InsertHelpHoverText("Change up Link's sleep routine.");
// SohImGui::EnhancementCombobox("gRandomizeStartingTime", randoStartingTime, 2, 0); // SohImGui::EnhancementCombobox("gRandomizeStartingTime", randoStartingTime, 2, 0);
// ImGui::Separator(); // ImGui::Separator();
@ -4499,7 +4482,7 @@ void DrawRandoEditor(bool& open) {
// // Chest Size and Color // // Chest Size and Color
// ImGui::Text("Chest Size and Color"); // ImGui::Text("Chest Size and Color");
// InsertHelpHoverText( // InsertHelpHoverText(
// "This option will change the appearance of all\nregular chests depending on their " // "This option will change the appearance of all regular chests depending on their "
// "contents:\nMajor Items = Big Wooden Chests\nLesser Items = Small Wooden " // "contents:\nMajor Items = Big Wooden Chests\nLesser Items = Small Wooden "
// "Chests\nBoss Keys = Big Fancy Chests\nSmall Keys = Small Fancy Chests"); // "Chests\nBoss Keys = Big Fancy Chests\nSmall Keys = Small Fancy Chests");
// SohImGui::EnhancementCombobox("gRandomizeChestSizeAndColor", randoChestSizeAndColor, 2, 0); // SohImGui::EnhancementCombobox("gRandomizeChestSizeAndColor", randoChestSizeAndColor, 2, 0);
@ -4510,11 +4493,11 @@ void DrawRandoEditor(bool& open) {
// switch (CVar_GetS32("gRandomize", 0)) { // switch (CVar_GetS32("gRandomize", 0)) {
// case 0: // case 0:
// InsertHelpHoverText( // InsertHelpHoverText(
// "All alternative traps will cause a small damage\nand no other negative effets."); // "All alternative traps will cause small damage and no other negative effects.");
// break; // break;
// case 1: // case 1:
// InsertHelpHoverText("Some chest traps will burn your Deku Shield or\ncause a lot of damage " // InsertHelpHoverText("Some chest traps will burn your Deku Shield or cause a lot of damage "
// "(with one-hit protection)."); // "(with one-hit KO protection).");
// break; // break;
// case 2: // case 2:
// InsertHelpHoverText("All traps will be the base game ice trap."); // InsertHelpHoverText("All traps will be the base game ice trap.");
@ -4536,7 +4519,7 @@ void DrawRandoEditor(bool& open) {
InsertHelpHoverText("Original item pool."); InsertHelpHoverText("Original item pool.");
break; break;
case 2: case 2:
InsertHelpHoverText("Some excess items are removed, including health\nupgrades."); InsertHelpHoverText("Some excess items are removed, including health upgrades.");
break; break;
case 3: case 3:
InsertHelpHoverText("Most excess items are removed."); InsertHelpHoverText("Most excess items are removed.");
@ -4556,14 +4539,14 @@ void DrawRandoEditor(bool& open) {
break; break;
case 2: case 2:
InsertHelpHoverText( InsertHelpHoverText(
"Chance to add extra Ice Traps when junk items are\nadded to the item pool."); "Chance to add extra Ice Traps when junk items are added to the item pool.");
break; break;
case 3: case 3:
InsertHelpHoverText("All added junk items will be Ice Traps."); InsertHelpHoverText("All added junk items will be Ice Traps.");
break; break;
case 4: case 4:
InsertHelpHoverText( InsertHelpHoverText(
"All junk items will be replaced by Ice Traps, even\nthose in the base pool."); "All junk items will be replaced by Ice Traps, even those in the base pool.");
break; break;
} }
SohImGui::EnhancementCombobox("gRandomizeIceTraps", randoIceTraps, 5, 1); SohImGui::EnhancementCombobox("gRandomizeIceTraps", randoIceTraps, 5, 1);
@ -4572,7 +4555,7 @@ void DrawRandoEditor(bool& open) {
// todo implement double defense getitem // todo implement double defense getitem
// // Remove Double Defense // // Remove Double Defense
// SohImGui::EnhancementCheckbox("Remove Double Defense", "gRandomizeRemoveDoubleDefense"); // SohImGui::EnhancementCheckbox("Remove Double Defense", "gRandomizeRemoveDoubleDefense");
// InsertHelpHoverText("If set the double defense item will be removed\nfrom the item pool for " // InsertHelpHoverText("If set the double defense item will be removed from the item pool for "
// "balanced and plentiful."); // "balanced and plentiful.");
// ImGui::Separator(); // ImGui::Separator();
@ -4580,8 +4563,8 @@ void DrawRandoEditor(bool& open) {
// // Prog Goron Sword // // Prog Goron Sword
// SohImGui::EnhancementCheckbox("Prog Goron Sword", "gRandomizeProgGoronSword"); // SohImGui::EnhancementCheckbox("Prog Goron Sword", "gRandomizeProgGoronSword");
// InsertHelpHoverText( // InsertHelpHoverText(
// "Giant's Knife will walays be found before Biggoron's\nSword. Medigoron only " // "Giant's Knife will always be found before Biggoron's Sword.\nMedigoron only "
// "starts selling new knives\nonce the Giant's Knife has been found\nand broken."); // "starts selling new knives once the Giant's Knife has been found and broken.");
// ImGui::Separator(); // ImGui::Separator();
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::EndTable(); ImGui::EndTable();

View File

@ -985,7 +985,7 @@ void DrawItemTracker(bool& open) {
} }
SohImGui::EnhancementCheckbox("Display \"Ammo/MaxAmo\"", "gItemTrackerAmmoDisplay"); SohImGui::EnhancementCheckbox("Display \"Ammo/MaxAmo\"", "gItemTrackerAmmoDisplay");
SohImGui::EnhancementCheckbox("Randomizer colors for Songs", "gItemTrackeSongColor"); SohImGui::EnhancementCheckbox("Randomizer colors for Songs", "gItemTrackeSongColor");
SohImGui::Tooltip("Will dispaly non-warp songs with randomizer\ncolors instead of pure white"); SohImGui::Tooltip("Will display non-warp songs with randomizer colors instead of pure white");
SohImGui::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gRandoTrackIconSize", 32, 128, ""); SohImGui::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gRandoTrackIconSize", 32, 128, "");
SohImGui::EnhancementSliderInt("X spacing : %dpx", "##ITEMTRACKERSPACINGX", "gRandoTrackIconSpacingX", minimalSpacingX, 256, SohImGui::EnhancementSliderInt("X spacing : %dpx", "##ITEMTRACKERSPACINGX", "gRandoTrackIconSpacingX", minimalSpacingX, 256,

View File

@ -4,9 +4,7 @@
#include <algorithm> #include <algorithm>
#include <filesystem> #include <filesystem>
#include <locale> #include <locale>
#include <codecvt>
#include "GlobalCtx2.h" #include "GlobalCtx2.h"
#include "GameSettings.h"
#include "ResourceMgr.h" #include "ResourceMgr.h"
#include "DisplayList.h" #include "DisplayList.h"
#include "PlayerAnimation.h" #include "PlayerAnimation.h"
@ -22,11 +20,9 @@
#else #else
#include <time.h> #include <time.h>
#endif #endif
#include <Vertex.h>
#include <CollisionHeader.h> #include <CollisionHeader.h>
#include <Array.h> #include <Array.h>
#include <Cutscene.h> #include <Cutscene.h>
#include <Texture.h>
#include "Lib/stb/stb_image.h" #include "Lib/stb/stb_image.h"
#define DRMP3_IMPLEMENTATION #define DRMP3_IMPLEMENTATION
#include "Lib/dr_libs/mp3.h" #include "Lib/dr_libs/mp3.h"
@ -40,10 +36,10 @@
#include <soh/Enhancements/randomizer/randomizer_item_tracker.h> #include <soh/Enhancements/randomizer/randomizer_item_tracker.h>
#include "Enhancements/n64_weird_frame_data.inc" #include "Enhancements/n64_weird_frame_data.inc"
#include "soh/frame_interpolation.h" #include "soh/frame_interpolation.h"
#include "Utils/BitConverter.h"
#include "variables.h" #include "variables.h"
#include "macros.h" #include "macros.h"
#include <Utils/StringHelper.h> #include <Utils/StringHelper.h>
#include "Hooks.h"
#ifdef __APPLE__ #ifdef __APPLE__
#include <SDL_scancode.h> #include <SDL_scancode.h>
@ -1445,10 +1441,11 @@ extern "C" uint32_t OTRGetCurrentHeight() {
} }
extern "C" void OTRControllerCallback(ControllerCallback* controller) { extern "C" void OTRControllerCallback(ControllerCallback* controller) {
const auto controllers = Ship::Window::ControllerApi->virtualDevices; auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
for (int i = 0; i < controllers.size(); ++i) { for (int i = 0; i < controlDeck->GetNumVirtualDevices(); ++i) {
Ship::Window::ControllerApi->physicalDevices[controllers[i]]->WriteToSource(i, controller); auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(i);
physicalDevice->WriteToSource(i, controller);
} }
} }
@ -1502,11 +1499,11 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
} }
extern "C" int Controller_ShouldRumble(size_t i) { extern "C" int Controller_ShouldRumble(size_t i) {
auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck();
const auto controllers = Ship::Window::ControllerApi->virtualDevices; for (int i = 0; i < controlDeck->GetNumVirtualDevices(); ++i) {
auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(i);
for (const auto virtual_entry : controllers) { if (physicalDevice->CanRumble()) {
if (Ship::Window::ControllerApi->physicalDevices[virtual_entry]->CanRumble()) {
return 1; return 1;
} }
} }
@ -1514,6 +1511,10 @@ extern "C" int Controller_ShouldRumble(size_t i) {
return 0; return 0;
} }
extern "C" void Hooks_ExecuteAudioInit() {
Ship::ExecuteHooks<Ship::AudioInit>();
}
extern "C" void* getN64WeirdFrame(s32 i) { extern "C" void* getN64WeirdFrame(s32 i) {
char* weirdFrameBytes = reinterpret_cast<char*>(n64WeirdFrames); char* weirdFrameBytes = reinterpret_cast<char*>(n64WeirdFrames);
return &weirdFrameBytes[i + sizeof(n64WeirdFrames)]; return &weirdFrameBytes[i + sizeof(n64WeirdFrames)];
@ -1654,6 +1655,10 @@ extern "C" s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerChec
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId); return OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
} }
extern "C" bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) {
return gSaveContext.n64ddFlag && Randomizer_GetItemIdFromKnownCheck(randomizerCheck, ogId) == GI_ICE_TRAP;
}
extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) { extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) {
return ItemTableManager::Instance->RetrieveItemEntry("Vanilla", getItemID); return ItemTableManager::Instance->RetrieveItemEntry("Vanilla", getItemID);
} }

View File

@ -87,6 +87,7 @@ int AudioPlayer_GetDesiredBuffered(void);
void AudioPlayer_Play(const uint8_t* buf, uint32_t len); void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples); void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
int Controller_ShouldRumble(size_t i); int Controller_ShouldRumble(size_t i);
void Hooks_ExecuteAudioInit();
void* getN64WeirdFrame(s32 i); void* getN64WeirdFrame(s32 i);
Sprite* GetSeedTexture(uint8_t index); Sprite* GetSeedTexture(uint8_t index);
void Randomizer_LoadSettings(const char* spoilerFileName); void Randomizer_LoadSettings(const char* spoilerFileName);
@ -102,6 +103,7 @@ s16 Randomizer_GetItemModelFromId(s16 itemId);
s32 Randomizer_GetItemIDFromGetItemID(s32 getItemId); s32 Randomizer_GetItemIDFromGetItemID(s32 getItemId);
s32 Randomizer_GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum); s32 Randomizer_GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId); s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId);
GetItemEntry ItemTable_Retrieve(int16_t getItemID); GetItemEntry ItemTable_Retrieve(int16_t getItemID);
#endif #endif

View File

@ -22,7 +22,8 @@ std::filesystem::path SaveManager::GetFileName(int fileNum) {
SaveManager::SaveManager() { SaveManager::SaveManager() {
AddLoadFunction("base", 1, LoadBaseVersion1); AddLoadFunction("base", 1, LoadBaseVersion1);
AddSaveFunction("base", 1, SaveBase); AddLoadFunction("base", 2, LoadBaseVersion2);
AddSaveFunction("base", 2, SaveBase);
AddLoadFunction("randomizer", 1, LoadRandomizerVersion1); AddLoadFunction("randomizer", 1, LoadRandomizerVersion1);
AddSaveFunction("randomizer", 1, SaveRandomizer); AddSaveFunction("randomizer", 1, SaveRandomizer);
@ -319,11 +320,23 @@ void SaveManager::InitFileNormal() {
gSaveContext.worldMapAreaData = 0; gSaveContext.worldMapAreaData = 0;
gSaveContext.scarecrowCustomSongSet = 0; gSaveContext.scarecrowCustomSongSet = 0;
for (int i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowCustomSong); i++) { for (int i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowCustomSong); i++) {
gSaveContext.scarecrowCustomSong[i] = 0; gSaveContext.scarecrowCustomSong[i].noteIdx = 0;
gSaveContext.scarecrowCustomSong[i].unk_01 = 0;
gSaveContext.scarecrowCustomSong[i].unk_02 = 0;
gSaveContext.scarecrowCustomSong[i].volume = 0;
gSaveContext.scarecrowCustomSong[i].vibrato = 0;
gSaveContext.scarecrowCustomSong[i].tone = 0;
gSaveContext.scarecrowCustomSong[i].semitone = 0;
} }
gSaveContext.scarecrowSpawnSongSet = 0; gSaveContext.scarecrowSpawnSongSet = 0;
for (int i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowSpawnSong); i++) { for (int i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowSpawnSong); i++) {
gSaveContext.scarecrowSpawnSong[i] = 0; gSaveContext.scarecrowSpawnSong[i].noteIdx = 0;
gSaveContext.scarecrowSpawnSong[i].unk_01 = 0;
gSaveContext.scarecrowSpawnSong[i].unk_02 = 0;
gSaveContext.scarecrowSpawnSong[i].volume = 0;
gSaveContext.scarecrowSpawnSong[i].vibrato = 0;
gSaveContext.scarecrowSpawnSong[i].tone = 0;
gSaveContext.scarecrowSpawnSong[i].semitone = 0;
} }
gSaveContext.horseData.scene = SCENE_SPOT00; gSaveContext.horseData.scene = SCENE_SPOT00;
@ -700,12 +713,172 @@ void SaveManager::LoadBaseVersion1() {
}); });
SaveManager::Instance->LoadData("worldMapAreaData", gSaveContext.worldMapAreaData); SaveManager::Instance->LoadData("worldMapAreaData", gSaveContext.worldMapAreaData);
SaveManager::Instance->LoadData("scarecrowCustomSongSet", gSaveContext.scarecrowCustomSongSet); SaveManager::Instance->LoadData("scarecrowCustomSongSet", gSaveContext.scarecrowCustomSongSet);
SaveManager::Instance->LoadArray("scarecrowCustomSong", sizeof(gSaveContext.scarecrowCustomSong), [](size_t i) {
SaveManager::Instance->LoadData("", ((u8*)&gSaveContext.scarecrowCustomSong)[i]);
});
SaveManager::Instance->LoadData("scarecrowSpawnSongSet", gSaveContext.scarecrowSpawnSongSet);
SaveManager::Instance->LoadArray("scarecrowSpawnSong", sizeof(gSaveContext.scarecrowSpawnSong), [](size_t i) {
SaveManager::Instance->LoadData("", ((u8*)&gSaveContext.scarecrowSpawnSong)[i]);
});
SaveManager::Instance->LoadStruct("horseData", []() {
SaveManager::Instance->LoadData("scene", gSaveContext.horseData.scene);
SaveManager::Instance->LoadStruct("pos", []() {
SaveManager::Instance->LoadData("x", gSaveContext.horseData.pos.x);
SaveManager::Instance->LoadData("y", gSaveContext.horseData.pos.y);
SaveManager::Instance->LoadData("z", gSaveContext.horseData.pos.z);
});
SaveManager::Instance->LoadData("angle", gSaveContext.horseData.angle);
});
SaveManager::Instance->LoadArray("dungeonsDone", ARRAY_COUNT(gSaveContext.dungeonsDone), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.dungeonsDone[i]);
});
SaveManager::Instance->LoadArray("trialsDone", ARRAY_COUNT(gSaveContext.trialsDone),
[](size_t i) { SaveManager::Instance->LoadData("", gSaveContext.trialsDone[i]); });
}
void SaveManager::LoadBaseVersion2() {
SaveManager::Instance->LoadData("entranceIndex", gSaveContext.entranceIndex);
SaveManager::Instance->LoadData("linkAge", gSaveContext.linkAge);
SaveManager::Instance->LoadData("cutsceneIndex", gSaveContext.cutsceneIndex);
SaveManager::Instance->LoadData("dayTime", gSaveContext.dayTime);
SaveManager::Instance->LoadData("nightFlag", gSaveContext.nightFlag);
SaveManager::Instance->LoadData("totalDays", gSaveContext.totalDays);
SaveManager::Instance->LoadData("bgsDayCount", gSaveContext.bgsDayCount);
SaveManager::Instance->LoadData("deaths", gSaveContext.deaths);
SaveManager::Instance->LoadArray("playerName", ARRAY_COUNT(gSaveContext.playerName), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.playerName[i]);
});
SaveManager::Instance->LoadData("n64ddFlag", gSaveContext.n64ddFlag);
SaveManager::Instance->LoadData("healthCapacity", gSaveContext.healthCapacity);
SaveManager::Instance->LoadData("health", gSaveContext.health);
SaveManager::Instance->LoadData("magicLevel", gSaveContext.magicLevel);
SaveManager::Instance->LoadData("magic", gSaveContext.magic);
SaveManager::Instance->LoadData("rupees", gSaveContext.rupees);
SaveManager::Instance->LoadData("swordHealth", gSaveContext.swordHealth);
SaveManager::Instance->LoadData("naviTimer", gSaveContext.naviTimer);
SaveManager::Instance->LoadData("magicAcquired", gSaveContext.magicAcquired);
SaveManager::Instance->LoadData("doubleMagic", gSaveContext.doubleMagic);
SaveManager::Instance->LoadData("doubleDefense", gSaveContext.doubleDefense);
SaveManager::Instance->LoadData("bgsFlag", gSaveContext.bgsFlag);
SaveManager::Instance->LoadData("ocarinaGameRoundNum", gSaveContext.ocarinaGameRoundNum);
SaveManager::Instance->LoadStruct("childEquips", []() {
SaveManager::Instance->LoadArray("buttonItems", ARRAY_COUNT(gSaveContext.childEquips.buttonItems), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.childEquips.buttonItems[i],
static_cast<uint8_t>(ITEM_NONE));
});
SaveManager::Instance->LoadArray("cButtonSlots", ARRAY_COUNT(gSaveContext.childEquips.cButtonSlots), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.childEquips.cButtonSlots[i],
static_cast<uint8_t>(SLOT_NONE));
});
SaveManager::Instance->LoadData("equipment", gSaveContext.childEquips.equipment);
});
SaveManager::Instance->LoadStruct("adultEquips", []() {
SaveManager::Instance->LoadArray("buttonItems", ARRAY_COUNT(gSaveContext.adultEquips.buttonItems), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.adultEquips.buttonItems[i],
static_cast<uint8_t>(ITEM_NONE));
});
SaveManager::Instance->LoadArray("cButtonSlots", ARRAY_COUNT(gSaveContext.adultEquips.cButtonSlots), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.adultEquips.cButtonSlots[i],
static_cast<uint8_t>(SLOT_NONE));
});
SaveManager::Instance->LoadData("equipment", gSaveContext.adultEquips.equipment);
});
SaveManager::Instance->LoadData("unk_54", gSaveContext.unk_54);
SaveManager::Instance->LoadData("savedSceneNum", gSaveContext.savedSceneNum);
SaveManager::Instance->LoadStruct("equips", []() {
SaveManager::Instance->LoadArray("buttonItems", ARRAY_COUNT(gSaveContext.equips.buttonItems), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.equips.buttonItems[i], static_cast<uint8_t>(ITEM_NONE));
});
SaveManager::Instance->LoadArray("cButtonSlots", ARRAY_COUNT(gSaveContext.equips.cButtonSlots), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.equips.cButtonSlots[i], static_cast<uint8_t>(SLOT_NONE));
});
SaveManager::Instance->LoadData("equipment", gSaveContext.equips.equipment);
});
SaveManager::Instance->LoadStruct("inventory", []() {
SaveManager::Instance->LoadArray("items", ARRAY_COUNT(gSaveContext.inventory.items), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.inventory.items[i]);
});
SaveManager::Instance->LoadArray("ammo", ARRAY_COUNT(gSaveContext.inventory.ammo), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.inventory.ammo[i]);
});
SaveManager::Instance->LoadData("equipment", gSaveContext.inventory.equipment);
SaveManager::Instance->LoadData("upgrades", gSaveContext.inventory.upgrades);
SaveManager::Instance->LoadData("questItems", gSaveContext.inventory.questItems);
SaveManager::Instance->LoadArray("dungeonItems", ARRAY_COUNT(gSaveContext.inventory.dungeonItems), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.inventory.dungeonItems[i]);
});
SaveManager::Instance->LoadArray("dungeonKeys", ARRAY_COUNT(gSaveContext.inventory.dungeonKeys), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.inventory.dungeonKeys[i]);
});
SaveManager::Instance->LoadData("defenseHearts", gSaveContext.inventory.defenseHearts);
SaveManager::Instance->LoadData("gsTokens", gSaveContext.inventory.gsTokens);
});
SaveManager::Instance->LoadArray("sceneFlags", ARRAY_COUNT(gSaveContext.sceneFlags), [](size_t i) {
SaveManager::Instance->LoadStruct("", [&i]() {
SaveManager::Instance->LoadData("chest", gSaveContext.sceneFlags[i].chest);
SaveManager::Instance->LoadData("swch", gSaveContext.sceneFlags[i].swch);
SaveManager::Instance->LoadData("clear", gSaveContext.sceneFlags[i].clear);
SaveManager::Instance->LoadData("collect", gSaveContext.sceneFlags[i].collect);
SaveManager::Instance->LoadData("unk", gSaveContext.sceneFlags[i].unk);
SaveManager::Instance->LoadData("rooms", gSaveContext.sceneFlags[i].rooms);
SaveManager::Instance->LoadData("floors", gSaveContext.sceneFlags[i].floors);
});
});
SaveManager::Instance->LoadStruct("fw", []() {
SaveManager::Instance->LoadStruct("pos", []() {
SaveManager::Instance->LoadData("x", gSaveContext.fw.pos.x);
SaveManager::Instance->LoadData("y", gSaveContext.fw.pos.y);
SaveManager::Instance->LoadData("z", gSaveContext.fw.pos.z);
});
SaveManager::Instance->LoadData("yaw", gSaveContext.fw.yaw);
SaveManager::Instance->LoadData("playerParams", gSaveContext.fw.playerParams);
SaveManager::Instance->LoadData("entranceIndex", gSaveContext.fw.entranceIndex);
SaveManager::Instance->LoadData("roomIndex", gSaveContext.fw.roomIndex);
SaveManager::Instance->LoadData("set", gSaveContext.fw.set);
SaveManager::Instance->LoadData("tempSwchFlags", gSaveContext.fw.tempSwchFlags);
SaveManager::Instance->LoadData("tempCollectFlags", gSaveContext.fw.tempCollectFlags);
});
SaveManager::Instance->LoadArray("gsFlags", ARRAY_COUNT(gSaveContext.gsFlags), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.gsFlags[i]);
});
SaveManager::Instance->LoadArray("highScores", ARRAY_COUNT(gSaveContext.highScores), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.highScores[i]);
});
SaveManager::Instance->LoadArray("eventChkInf", ARRAY_COUNT(gSaveContext.eventChkInf), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.eventChkInf[i]);
});
SaveManager::Instance->LoadArray("itemGetInf", ARRAY_COUNT(gSaveContext.itemGetInf), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.itemGetInf[i]);
});
SaveManager::Instance->LoadArray("infTable", ARRAY_COUNT(gSaveContext.infTable), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.infTable[i]);
});
SaveManager::Instance->LoadData("worldMapAreaData", gSaveContext.worldMapAreaData);
SaveManager::Instance->LoadData("scarecrowCustomSongSet", gSaveContext.scarecrowCustomSongSet);
SaveManager::Instance->LoadArray("scarecrowCustomSong", ARRAY_COUNT(gSaveContext.scarecrowCustomSong), [](size_t i) { SaveManager::Instance->LoadArray("scarecrowCustomSong", ARRAY_COUNT(gSaveContext.scarecrowCustomSong), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.scarecrowCustomSong[i]); SaveManager::Instance->LoadStruct("", [&i]() {
SaveManager::Instance->LoadData("noteIdx", gSaveContext.scarecrowCustomSong[i].noteIdx);
SaveManager::Instance->LoadData("unk_01", gSaveContext.scarecrowCustomSong[i].unk_01);
SaveManager::Instance->LoadData("unk_02", gSaveContext.scarecrowCustomSong[i].unk_02);
SaveManager::Instance->LoadData("volume", gSaveContext.scarecrowCustomSong[i].volume);
SaveManager::Instance->LoadData("vibrato", gSaveContext.scarecrowCustomSong[i].vibrato);
SaveManager::Instance->LoadData("tone", gSaveContext.scarecrowCustomSong[i].tone);
SaveManager::Instance->LoadData("semitone", gSaveContext.scarecrowCustomSong[i].semitone);
});
}); });
SaveManager::Instance->LoadData("scarecrowSpawnSongSet", gSaveContext.scarecrowSpawnSongSet); SaveManager::Instance->LoadData("scarecrowSpawnSongSet", gSaveContext.scarecrowSpawnSongSet);
SaveManager::Instance->LoadArray("scarecrowSpawnSong", ARRAY_COUNT(gSaveContext.scarecrowSpawnSong), [](size_t i) { SaveManager::Instance->LoadArray("scarecrowSpawnSong", ARRAY_COUNT(gSaveContext.scarecrowSpawnSong), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.scarecrowSpawnSong[i]); SaveManager::Instance->LoadStruct("", [&i]() {
SaveManager::Instance->LoadData("noteIdx", gSaveContext.scarecrowSpawnSong[i].noteIdx);
SaveManager::Instance->LoadData("unk_01", gSaveContext.scarecrowSpawnSong[i].unk_01);
SaveManager::Instance->LoadData("unk_02", gSaveContext.scarecrowSpawnSong[i].unk_02);
SaveManager::Instance->LoadData("volume", gSaveContext.scarecrowSpawnSong[i].volume);
SaveManager::Instance->LoadData("vibrato", gSaveContext.scarecrowSpawnSong[i].vibrato);
SaveManager::Instance->LoadData("tone", gSaveContext.scarecrowSpawnSong[i].tone);
SaveManager::Instance->LoadData("semitone", gSaveContext.scarecrowSpawnSong[i].semitone);
});
}); });
SaveManager::Instance->LoadStruct("horseData", []() { SaveManager::Instance->LoadStruct("horseData", []() {
SaveManager::Instance->LoadData("scene", gSaveContext.horseData.scene); SaveManager::Instance->LoadData("scene", gSaveContext.horseData.scene);
@ -841,11 +1014,27 @@ void SaveManager::SaveBase() {
SaveManager::Instance->SaveData("worldMapAreaData", gSaveContext.worldMapAreaData); SaveManager::Instance->SaveData("worldMapAreaData", gSaveContext.worldMapAreaData);
SaveManager::Instance->SaveData("scarecrowCustomSongSet", gSaveContext.scarecrowCustomSongSet); SaveManager::Instance->SaveData("scarecrowCustomSongSet", gSaveContext.scarecrowCustomSongSet);
SaveManager::Instance->SaveArray("scarecrowCustomSong", ARRAY_COUNT(gSaveContext.scarecrowCustomSong), [](size_t i) { SaveManager::Instance->SaveArray("scarecrowCustomSong", ARRAY_COUNT(gSaveContext.scarecrowCustomSong), [](size_t i) {
SaveManager::Instance->SaveData("", gSaveContext.scarecrowCustomSong[i]); SaveManager::Instance->SaveStruct("", [&i]() {
SaveManager::Instance->SaveData("noteIdx", gSaveContext.scarecrowCustomSong[i].noteIdx);
SaveManager::Instance->SaveData("unk_01", gSaveContext.scarecrowCustomSong[i].unk_01);
SaveManager::Instance->SaveData("unk_02", gSaveContext.scarecrowCustomSong[i].unk_02);
SaveManager::Instance->SaveData("volume", gSaveContext.scarecrowCustomSong[i].volume);
SaveManager::Instance->SaveData("vibrato", gSaveContext.scarecrowCustomSong[i].vibrato);
SaveManager::Instance->SaveData("tone", gSaveContext.scarecrowCustomSong[i].tone);
SaveManager::Instance->SaveData("semitone", gSaveContext.scarecrowCustomSong[i].semitone);
});
}); });
SaveManager::Instance->SaveData("scarecrowSpawnSongSet", gSaveContext.scarecrowSpawnSongSet); SaveManager::Instance->SaveData("scarecrowSpawnSongSet", gSaveContext.scarecrowSpawnSongSet);
SaveManager::Instance->SaveArray("scarecrowSpawnSong", ARRAY_COUNT(gSaveContext.scarecrowSpawnSong), [](size_t i) { SaveManager::Instance->SaveArray("scarecrowSpawnSong", ARRAY_COUNT(gSaveContext.scarecrowSpawnSong), [](size_t i) {
SaveManager::Instance->SaveData("", gSaveContext.scarecrowSpawnSong[i]); SaveManager::Instance->SaveStruct("", [&i]() {
SaveManager::Instance->SaveData("noteIdx", gSaveContext.scarecrowSpawnSong[i].noteIdx);
SaveManager::Instance->SaveData("unk_01", gSaveContext.scarecrowSpawnSong[i].unk_01);
SaveManager::Instance->SaveData("unk_02", gSaveContext.scarecrowSpawnSong[i].unk_02);
SaveManager::Instance->SaveData("volume", gSaveContext.scarecrowSpawnSong[i].volume);
SaveManager::Instance->SaveData("vibrato", gSaveContext.scarecrowSpawnSong[i].vibrato);
SaveManager::Instance->SaveData("tone", gSaveContext.scarecrowSpawnSong[i].tone);
SaveManager::Instance->SaveData("semitone", gSaveContext.scarecrowSpawnSong[i].semitone);
});
}); });
SaveManager::Instance->SaveStruct("horseData", []() { SaveManager::Instance->SaveStruct("horseData", []() {
SaveManager::Instance->SaveData("scene", gSaveContext.horseData.scene); SaveManager::Instance->SaveData("scene", gSaveContext.horseData.scene);
@ -1252,13 +1441,9 @@ void CopyV0Save(SaveContext_v0& src, SaveContext& dst) {
} }
dst.worldMapAreaData = src.worldMapAreaData; dst.worldMapAreaData = src.worldMapAreaData;
dst.scarecrowCustomSongSet = src.scarecrowCustomSongSet; dst.scarecrowCustomSongSet = src.scarecrowCustomSongSet;
for (size_t i = 0; i < ARRAY_COUNT(src.scarecrowCustomSong); i++) { memcpy(&dst.scarecrowCustomSong[0], &src.scarecrowCustomSong[0], sizeof(src.scarecrowCustomSong));
dst.scarecrowCustomSong[i] = src.scarecrowCustomSong[i];
}
dst.scarecrowSpawnSongSet = src.scarecrowSpawnSongSet; dst.scarecrowSpawnSongSet = src.scarecrowSpawnSongSet;
for (size_t i = 0; i < ARRAY_COUNT(src.scarecrowSpawnSong); i++) { memcpy(&dst.scarecrowSpawnSong[0], &src.scarecrowSpawnSong[0], sizeof(src.scarecrowSpawnSong));
dst.scarecrowSpawnSong[i] = src.scarecrowSpawnSong[i];
}
dst.horseData.scene = src.horseData.scene; dst.horseData.scene = src.horseData.scene;
dst.horseData.pos.x = src.horseData.pos.x; dst.horseData.pos.x = src.horseData.pos.x;
dst.horseData.pos.y = src.horseData.pos.y; dst.horseData.pos.y = src.horseData.pos.y;

View File

@ -117,6 +117,7 @@ public:
static void SaveRandomizer(); static void SaveRandomizer();
static void LoadBaseVersion1(); static void LoadBaseVersion1();
static void LoadBaseVersion2();
static void SaveBase(); static void SaveBase();
std::vector<InitFunc> initFuncs; std::vector<InitFunc> initFuncs;

View File

@ -1,6 +1,6 @@
#include "global.h" #include "global.h"
#include "Hooks.h"
#include <string.h> #include <string.h>
#include "soh/OTRGlobals.h"
void func_800C3C80(AudioMgr* audioMgr) { void func_800C3C80(AudioMgr* audioMgr) {
AudioTask* task; AudioTask* task;
@ -108,7 +108,7 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon
AudioLoad_SetDmaHandler(DmaMgr_DmaHandler); AudioLoad_SetDmaHandler(DmaMgr_DmaHandler);
Audio_InitSound(); Audio_InitSound();
osSendMesgPtr(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK); osSendMesgPtr(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK);
ModInternal_ExecuteAudioInitHooks(); Hooks_ExecuteAudioInit();
// Removed due to crash // Removed due to crash
//IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->unk_74); //IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->unk_74);
hasInitialized = true; hasInitialized = true;

View File

@ -8,7 +8,7 @@ void SaveContext_Init(void) {
gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
gSaveContext.nextCutsceneIndex = 0xFFEF; gSaveContext.nextCutsceneIndex = CVar_GetS32("gBetaQuestWorld", 0xFFEF);
gSaveContext.cutsceneTrigger = 0; gSaveContext.cutsceneTrigger = 0;
gSaveContext.chamberCutsceneNum = 0; gSaveContext.chamberCutsceneNum = 0;
gSaveContext.nextDayTime = 0xFFFF; gSaveContext.nextDayTime = 0xFFFF;

View File

@ -2737,7 +2737,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) {
if (msgCtx->lastPlayedSong < OCARINA_SONG_SARIAS && if (msgCtx->lastPlayedSong < OCARINA_SONG_SARIAS &&
(msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET || (msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET ||
msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) { msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) {
if (msgCtx->disableWarpSongs || interfaceCtx->restrictions.warpSongs == 3) { if (msgCtx->disableWarpSongs || (interfaceCtx->restrictions.warpSongs == 3 && !gSaveContext.n64ddFlag)) {
Message_StartTextbox(globalCtx, 0x88C, NULL); // "You can't warp here!" Message_StartTextbox(globalCtx, 0x88C, NULL); // "You can't warp here!"
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04;
} else if ((gSaveContext.eventInf[0] & 0xF) != 1) { } else if ((gSaveContext.eventInf[0] & 0xF) != 1) {

View File

@ -1041,18 +1041,37 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
break; break;
case 4020: case 4020:
if (CVar_GetS32("gFasterHeavyBlockLift", 0)) {
D_8012368C[0].timerInit *= (1.0f / 3.0f);
D_8012368C[1].timerInit *= (1.0f / 3.0f);
D_8012368C[2].timerInit *= (1.0f / 3.0f);
D_8012368C[3].timerInit *= (1.0f / 3.0f);
}
csInfo->keyFrames = D_8012368C; csInfo->keyFrames = D_8012368C;
csInfo->keyFrameCnt = 4; csInfo->keyFrameCnt = 4;
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
break; break;
case 4021: case 4021:
if (CVar_GetS32("gFasterHeavyBlockLift", 0)) {
D_8012372C[0].timerInit *= (1.0f / 3.0f);
D_8012372C[1].timerInit *= (1.0f / 3.0f);
D_8012372C[2].timerInit *= (1.0f / 3.0f);
D_8012372C[3].timerInit *= (1.0f / 3.0f);
}
csInfo->keyFrames = D_8012372C; csInfo->keyFrames = D_8012372C;
csInfo->keyFrameCnt = 4; csInfo->keyFrameCnt = 4;
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
break; break;
case 4022: case 4022:
if (CVar_GetS32("gFasterHeavyBlockLift", 0)) {
D_801237CC[0].timerInit *= (1.0f / 3.0f);
D_801237CC[1].timerInit *= (1.0f / 3.0f);
D_801237CC[2].timerInit *= (1.0f / 3.0f);
D_801237CC[3].timerInit *= (1.0f / 3.0f);
D_801237CC[4].timerInit *= (1.0f / 3.0f);
}
csCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit + csCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit +
D_801237CC[2].timerInit + D_801237CC[4].timerInit; D_801237CC[2].timerInit + D_801237CC[4].timerInit;

View File

@ -624,21 +624,21 @@ static OnePointCsFull D_801235C4[5] = {
{ 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_8012368C[4] = { OnePointCsFull D_8012368C[4] = {
{ 0x0F, 0xFF, 0x0101, 10, 0, 60.0f, 1.0f, { -1110.0f, -180.0f, -840.0f }, { -985.0f, -220.0f, -840.0f } }, { 0x0F, 0xFF, 0x0101, 10, 0, 60.0f, 1.0f, { -1110.0f, -180.0f, -840.0f }, { -985.0f, -220.0f, -840.0f } },
{ 0x02, 0xFF, 0x0101, 70, -45, 75.0f, 1.0f, { -1060.0f, -160.0f, -840.0f }, { -1005.0f, -230.0f, -840.0f } }, { 0x02, 0xFF, 0x0101, 70, -45, 75.0f, 1.0f, { -1060.0f, -160.0f, -840.0f }, { -1005.0f, -230.0f, -840.0f } },
{ 0x0F, 0xFF, 0x0000, 10, -45, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, { 0x0F, 0xFF, 0x0000, 10, -45, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
{ 0x0F, 0xFF, 0x0101, 180, 9, 80.0f, 1.0f, { -1205.0f, -175.0f, -840.0f }, { -1305.0f, -230.0f, -828.0f } }, { 0x0F, 0xFF, 0x0101, 180, 9, 80.0f, 1.0f, { -1205.0f, -175.0f, -840.0f }, { -1305.0f, -230.0f, -828.0f } },
}; };
static OnePointCsFull D_8012372C[4] = { OnePointCsFull D_8012372C[4] = {
{ 0x0F, 0xFF, 0x0142, 10, 0, 70.0f, 1.0f, { 0.0f, 80.0f, 0.0f }, { -1650.0f, 200.0f, -2920.0f } }, { 0x0F, 0xFF, 0x0142, 10, 0, 70.0f, 1.0f, { 0.0f, 80.0f, 0.0f }, { -1650.0f, 200.0f, -2920.0f } },
{ 0x02, 0xFF, 0x0142, 110, -2, 50.0f, 0.5f, { 0.0f, 150.0f, 0.0f }, { -1320.0f, 170.0f, -2900.0f } }, { 0x02, 0xFF, 0x0142, 110, -2, 50.0f, 0.5f, { 0.0f, 150.0f, 0.0f }, { -1320.0f, 170.0f, -2900.0f } },
{ 0x0B, 0xFF, 0x4242, 100, 2, 70.0f, 0.1f, { 0.0f, 150.0f, 50.0f }, { -1.0f, -1.0f, -1.0f } }, { 0x0B, 0xFF, 0x4242, 100, 2, 70.0f, 0.1f, { 0.0f, 150.0f, 50.0f }, { -1.0f, -1.0f, -1.0f } },
{ 0x03, 0xFF, 0x4242, 60, 2, 45.0f, 0.01f, { 0.0f, 150.0f, 50.0f }, { 0.0f, 200.0f, -80.0f } }, { 0x03, 0xFF, 0x4242, 60, 2, 45.0f, 0.01f, { 0.0f, 150.0f, 50.0f }, { 0.0f, 200.0f, -80.0f } },
}; };
static OnePointCsFull D_801237CC[5] = { OnePointCsFull D_801237CC[5] = {
{ 0x8F, 0xFF, 0x4242, 20, 0, 50.0f, 1.0f, { 0.0f, 50.0f, -10.0f }, { 0.0f, 0.0f, 100.0f } }, { 0x8F, 0xFF, 0x4242, 20, 0, 50.0f, 1.0f, { 0.0f, 50.0f, -10.0f }, { 0.0f, 0.0f, 100.0f } },
{ 0x0A, 0xFF, 0x0101, 80, 0, 75.0f, 1.0f, { 2900.0f, 1300.0f, 530.0f }, { 2800.0f, 1190.0f, 540.0f } }, { 0x0A, 0xFF, 0x0101, 80, 0, 75.0f, 1.0f, { 2900.0f, 1300.0f, 530.0f }, { 2800.0f, 1190.0f, 540.0f } },
{ 0x0F, 0xFF, 0x0000, 10, 0, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, { 0x0F, 0xFF, 0x0000, 10, 0, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },

View File

@ -4745,12 +4745,14 @@ void Interface_Draw(GlobalContext* globalCtx) {
} else { } else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, dpadAlpha); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, dpadAlpha);
} }
gDPLoadTextureBlock(OVERLAY_DISP++, ResourceMgr_LoadFileRaw("assets/ship_of_harkinian/buttons/dpad.bin"), if (fullUi) {
G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, gDPLoadTextureBlock(OVERLAY_DISP++, ResourceMgr_LoadFileRaw("assets/ship_of_harkinian/buttons/dpad.bin"),
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
gSPWideTextureRectangle(OVERLAY_DISP++, DpadPosX << 2, DpadPosY << 2, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
(DpadPosX + 32) << 2, (DpadPosY + 32) << 2, gSPWideTextureRectangle(OVERLAY_DISP++, DpadPosX << 2, DpadPosY << 2,
G_TX_RENDERTILE, 0, 0, (1 << 10), (1 << 10)); (DpadPosX + 32) << 2, (DpadPosY + 32) << 2,
G_TX_RENDERTILE, 0, 0, (1 << 10), (1 << 10));
}
// DPad-Up Button Icon & Ammo Count // DPad-Up Button Icon & Ammo Count
if (gSaveContext.equips.buttonItems[4] < 0xF0) { if (gSaveContext.equips.buttonItems[4] < 0xF0) {

View File

@ -4,9 +4,11 @@
#include <string.h> #include <string.h>
#include "soh/Enhancements/gameconsole.h" #include "soh/Enhancements/gameconsole.h"
#include "../libultraship/ImGuiImpl.h"
#include "soh/frame_interpolation.h" #include "soh/frame_interpolation.h"
#include <time.h>
void* D_8012D1F0 = NULL; void* D_8012D1F0 = NULL;
//UNK_TYPE D_8012D1F4 = 0; // unused //UNK_TYPE D_8012D1F4 = 0; // unused
Input* D_8012D1F8 = NULL; Input* D_8012D1F8 = NULL;
@ -190,6 +192,7 @@ void Gameplay_Destroy(GameState* thisx) {
KaleidoManager_Destroy(); KaleidoManager_Destroy();
ZeldaArena_Cleanup(); ZeldaArena_Cleanup();
Fault_RemoveClient(&D_801614B8); Fault_RemoveClient(&D_801614B8);
disableBetaQuest();
gGlobalCtx = NULL; gGlobalCtx = NULL;
} }
@ -237,10 +240,11 @@ void GivePlayerRandoRewardZeldaLightArrowsGift(GlobalContext* globalCtx, Randomi
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && LINK_IS_ADULT && if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && LINK_IS_ADULT &&
(gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_TOKINOMA) && (gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_TOKINOMA) &&
!Flags_GetTreasure(globalCtx, 0x1E) && player != NULL && !Player_InBlockingCsMode(globalCtx, player) && !Flags_GetTreasure(globalCtx, 0x1E) && player != NULL && !Player_InBlockingCsMode(globalCtx, player) &&
globalCtx->sceneLoadFlag == 0 && player->getItemId == GI_NONE) { globalCtx->sceneLoadFlag == 0) {
GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, GI_ARROW_LIGHT); GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, GI_ARROW_LIGHT);
GiveItemWithoutActor(globalCtx, getItemId); GiveItemWithoutActor(globalCtx, getItemId);
Flags_SetTreasure(globalCtx, 0x1E); player->pendingFlag.flagID = 0x1E;
player->pendingFlag.flagType = FLAG_SCENE_TREASURE;
} }
} }
@ -260,6 +264,7 @@ void GivePlayerRandoRewardSariaGift(GlobalContext* globalCtx, RandomizerCheck ch
void Gameplay_Init(GameState* thisx) { void Gameplay_Init(GameState* thisx) {
GlobalContext* globalCtx = (GlobalContext*)thisx; GlobalContext* globalCtx = (GlobalContext*)thisx;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
enableBetaQuest();
gGlobalCtx = globalCtx; gGlobalCtx = globalCtx;
//globalCtx->state.gfxCtx = NULL; //globalCtx->state.gfxCtx = NULL;
uintptr_t zAlloc; uintptr_t zAlloc;
@ -1407,7 +1412,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
OVERLAY_DISP = sp70; OVERLAY_DISP = sp70;
globalCtx->unk_121C7 = 2; globalCtx->unk_121C7 = 2;
SREG(33) |= 1; SREG(33) |= 1;
} else { } else if (R_PAUSE_MENU_MODE != 3) {
Gameplay_Draw_DrawOverlayElements: Gameplay_Draw_DrawOverlayElements:
if ((HREG(80) != 10) || (HREG(89) != 0)) { if ((HREG(80) != 10) || (HREG(89) != 0)) {
Gameplay_DrawOverlayElements(globalCtx); Gameplay_DrawOverlayElements(globalCtx);
@ -1441,6 +1446,18 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
CLOSE_DISPS(gfxCtx); CLOSE_DISPS(gfxCtx);
} }
time_t Gameplay_GetRealTime() {
time_t t1, t2;
struct tm* tms;
time(&t1);
tms = localtime(&t1);
tms->tm_hour = 0;
tms->tm_min = 0;
tms->tm_sec = 0;
t2 = mktime(tms);
return t1 - t2;
}
void Gameplay_Main(GameState* thisx) { void Gameplay_Main(GameState* thisx) {
GlobalContext* globalCtx = (GlobalContext*)thisx; GlobalContext* globalCtx = (GlobalContext*)thisx;
@ -1484,6 +1501,20 @@ void Gameplay_Main(GameState* thisx) {
if (1 && HREG(63)) { if (1 && HREG(63)) {
LOG_NUM("1", 1); LOG_NUM("1", 1);
} }
if (CVar_GetS32("gTimeSync", 0)) {
const int maxRealDaySeconds = 86400;
const int maxInGameDayTicks = 65536;
int secs = (int)Gameplay_GetRealTime();
float percent = (float)secs / (float)maxRealDaySeconds;
int newIngameTime = maxInGameDayTicks * percent;
gSaveContext.dayTime = newIngameTime;
}
} }
// original name: "Game_play_demo_mode_check" // original name: "Game_play_demo_mode_check"

View File

@ -442,62 +442,65 @@ void Sram_OpenSave() {
Save_LoadFile(); Save_LoadFile();
switch (gSaveContext.savedSceneNum) { if (!CVar_GetS32("gRememberSaveLocation", 0) || gSaveContext.savedSceneNum == SCENE_YOUSEI_IZUMI_TATE ||
case SCENE_YDAN: gSaveContext.savedSceneNum == SCENE_KAKUSIANA) {
case SCENE_DDAN: switch (gSaveContext.savedSceneNum) {
case SCENE_BDAN: case SCENE_YDAN:
case SCENE_BMORI1: case SCENE_DDAN:
case SCENE_HIDAN: case SCENE_BDAN:
case SCENE_MIZUSIN: case SCENE_BMORI1:
case SCENE_JYASINZOU: case SCENE_HIDAN:
case SCENE_HAKADAN: case SCENE_MIZUSIN:
case SCENE_HAKADANCH: case SCENE_JYASINZOU:
case SCENE_ICE_DOUKUTO: case SCENE_HAKADAN:
case SCENE_GANON: case SCENE_HAKADANCH:
case SCENE_MEN: case SCENE_ICE_DOUKUTO:
case SCENE_GERUDOWAY: case SCENE_GANON:
case SCENE_GANONTIKA: case SCENE_MEN:
gSaveContext.entranceIndex = dungeonEntrances[gSaveContext.savedSceneNum]; case SCENE_GERUDOWAY:
break; case SCENE_GANONTIKA:
case SCENE_YDAN_BOSS: gSaveContext.entranceIndex = dungeonEntrances[gSaveContext.savedSceneNum];
gSaveContext.entranceIndex = 0; break;
break; case SCENE_YDAN_BOSS:
case SCENE_DDAN_BOSS: gSaveContext.entranceIndex = 0;
gSaveContext.entranceIndex = 4; break;
break; case SCENE_DDAN_BOSS:
case SCENE_BDAN_BOSS: gSaveContext.entranceIndex = 4;
gSaveContext.entranceIndex = 0x28; break;
break; case SCENE_BDAN_BOSS:
case SCENE_MORIBOSSROOM: gSaveContext.entranceIndex = 0x28;
gSaveContext.entranceIndex = 0x169; break;
break; case SCENE_MORIBOSSROOM:
case SCENE_FIRE_BS: gSaveContext.entranceIndex = 0x169;
gSaveContext.entranceIndex = 0x165; break;
break; case SCENE_FIRE_BS:
case SCENE_MIZUSIN_BS: gSaveContext.entranceIndex = 0x165;
gSaveContext.entranceIndex = 0x10; break;
break; case SCENE_MIZUSIN_BS:
case SCENE_JYASINBOSS: gSaveContext.entranceIndex = 0x10;
gSaveContext.entranceIndex = 0x82; break;
break; case SCENE_JYASINBOSS:
case SCENE_HAKADAN_BS: gSaveContext.entranceIndex = 0x82;
gSaveContext.entranceIndex = 0x37; break;
break; case SCENE_HAKADAN_BS:
case SCENE_GANON_SONOGO: gSaveContext.entranceIndex = 0x37;
case SCENE_GANONTIKA_SONOGO: break;
case SCENE_GANON_BOSS: case SCENE_GANON_SONOGO:
case SCENE_GANON_FINAL: case SCENE_GANONTIKA_SONOGO:
case SCENE_GANON_DEMO: case SCENE_GANON_BOSS:
gSaveContext.entranceIndex = 0x41B; case SCENE_GANON_FINAL:
break; case SCENE_GANON_DEMO:
gSaveContext.entranceIndex = 0x41B;
break;
default: default:
if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) { if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) {
gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4; gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4;
} else { } else {
gSaveContext.entranceIndex = 0xBB; gSaveContext.entranceIndex = 0xBB;
} }
break; break;
}
} }
osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex); osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex);

View File

@ -1697,7 +1697,10 @@ void BossDodongo_DrawEffects(GlobalContext* globalCtx) {
func_80093D84(globalCtx->state.gfxCtx); func_80093D84(globalCtx->state.gfxCtx);
unkMtx = &globalCtx->billboardMtxF; unkMtx = &globalCtx->billboardMtxF;
// OTRTODO: This call causes the whole texture cache to be cleaned up, which causes an important slowdown on switch so we need to find a way to avoid it.
#ifndef __SWITCH__
gSPInvalidateTexCache(POLY_XLU_DISP++, 0); gSPInvalidateTexCache(POLY_XLU_DISP++, 0);
#endif
for (i = 0; i < 80; i++, eff++) { for (i = 0; i < 80; i++, eff++) {
if (eff->unk_24 == 1) { if (eff->unk_24 == 1) {

View File

@ -1059,7 +1059,7 @@ void EnSkj_SetupPostSariasSong(EnSkj* this) {
} }
void EnSkj_ChangeModeAfterSong(EnSkj* this, GlobalContext* globalCtx) { void EnSkj_ChangeModeAfterSong(EnSkj* this, GlobalContext* globalCtx) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { if (((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) || Randomizer_ItemIsIceTrap(RC_LW_SKULL_KID, GI_HEART_PIECE)) {
gSaveContext.itemGetInf[1] |= 0x40; gSaveContext.itemGetInf[1] |= 0x40;
EnSkj_SetNaviId(this); EnSkj_SetNaviId(this);
EnSkj_SetupWaitInRange(this); EnSkj_SetupWaitInRange(this);

View File

@ -288,14 +288,16 @@ void func_80B3CA38(EnXc* this, GlobalContext* globalCtx) {
} }
void GivePlayerRandoRewardSheikSong(EnXc* sheik, GlobalContext* globalCtx, RandomizerCheck check, int sheikType, GetItemID ogSongId) { void GivePlayerRandoRewardSheikSong(EnXc* sheik, GlobalContext* globalCtx, RandomizerCheck check, int sheikType, GetItemID ogSongId) {
if (sheik->actor.parent != NULL && sheik->actor.parent->id == GET_PLAYER(globalCtx)->actor.id && Player* player = GET_PLAYER(globalCtx);
if (sheik->actor.parent != NULL && sheik->actor.parent->id == player->actor.id &&
!(gSaveContext.eventChkInf[5] & sheikType)) { !(gSaveContext.eventChkInf[5] & sheikType)) {
gSaveContext.eventChkInf[5] |= sheikType; gSaveContext.eventChkInf[5] |= sheikType;
} else if (!(gSaveContext.eventChkInf[5] & sheikType)) { } else if (!(gSaveContext.eventChkInf[5] & sheikType)) {
GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, ogSongId); GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, ogSongId);
if (check == RC_SHEIK_AT_TEMPLE && !Flags_GetTreasure(globalCtx, 0x1F)) { if (check == RC_SHEIK_AT_TEMPLE && !Flags_GetTreasure(globalCtx, 0x1F)) {
if (func_8002F434(&sheik->actor, globalCtx, getItemId, 10000.0f, 100.0f)) { if (func_8002F434(&sheik->actor, globalCtx, getItemId, 10000.0f, 100.0f)) {
Flags_SetTreasure(globalCtx, 0x1F); player->pendingFlag.flagID = 0x1F;
player->pendingFlag.flagType = FLAG_SCENE_TREASURE;
} }
} else if (check != RC_SHEIK_AT_TEMPLE) { } else if (check != RC_SHEIK_AT_TEMPLE) {
func_8002F434(&sheik->actor, globalCtx, getItemId, 10000.0f, 100.0f); func_8002F434(&sheik->actor, globalCtx, getItemId, 10000.0f, 100.0f);

View File

@ -167,6 +167,7 @@ void func_8083CA20(GlobalContext* globalCtx, Player* this);
void func_8083CA54(GlobalContext* globalCtx, Player* this); void func_8083CA54(GlobalContext* globalCtx, Player* this);
void func_8083CA9C(GlobalContext* globalCtx, Player* this); void func_8083CA9C(GlobalContext* globalCtx, Player* this);
s32 func_8083E0FC(Player* this, GlobalContext* globalCtx); s32 func_8083E0FC(Player* this, GlobalContext* globalCtx);
void Player_SetPendingFlag(Player* this, GlobalContext* globalCtx);
s32 func_8083E5A8(Player* this, GlobalContext* globalCtx); s32 func_8083E5A8(Player* this, GlobalContext* globalCtx);
s32 func_8083EB44(Player* this, GlobalContext* globalCtx); s32 func_8083EB44(Player* this, GlobalContext* globalCtx);
s32 func_8083F7BC(Player* this, GlobalContext* globalCtx); s32 func_8083F7BC(Player* this, GlobalContext* globalCtx);
@ -4648,7 +4649,11 @@ void func_8083A0F4(GlobalContext* globalCtx, Player* this) {
anim = D_80853914[PLAYER_ANIMGROUP_13][this->modelAnimType]; anim = D_80853914[PLAYER_ANIMGROUP_13][this->modelAnimType];
} }
func_80832264(globalCtx, this, anim); if (CVar_GetS32("gFasterHeavyBlockLift", 0) && interactActorId == ACTOR_BG_HEAVY_BLOCK) {
LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, 3.0f);
} else {
LinkAnimation_PlayOnce(globalCtx, &this->skelAnime, anim);
}
} }
} }
else { else {
@ -6232,6 +6237,30 @@ void func_8083E4C4(GlobalContext* globalCtx, Player* this, GetItemEntry* giEntry
func_80078884((this->getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); func_80078884((this->getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM);
} }
// Sets a flag according to which type of flag is specified in player->pendingFlag.flagType
// and which flag is specified in player->pendingFlag.flagID.
void Player_SetPendingFlag(Player* this, GlobalContext* globalCtx) {
switch (this->pendingFlag.flagType) {
case FLAG_SCENE_CLEAR:
Flags_SetClear(globalCtx, this->pendingFlag.flagID);
break;
case FLAG_SCENE_COLLECTIBLE:
Flags_SetCollectible(globalCtx, this->pendingFlag.flagID);
break;
case FLAG_SCENE_SWITCH:
Flags_SetSwitch(globalCtx, this->pendingFlag.flagID);
break;
case FLAG_SCENE_TREASURE:
Flags_SetTreasure(globalCtx, this->pendingFlag.flagID);
break;
case FLAG_NONE:
default:
break;
}
this->pendingFlag.flagType = FLAG_NONE;
this->pendingFlag.flagID = 0;
}
s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) {
Actor* interactedActor; Actor* interactedActor;
@ -6255,6 +6284,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) {
this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11);
this->actor.colChkInfo.damage = 0; this->actor.colChkInfo.damage = 0;
func_80837C0C(globalCtx, this, 3, 0.0f, 0.0f, 0, 20); func_80837C0C(globalCtx, this, 3, 0.0f, 0.0f, 0, 20);
Player_SetPendingFlag(this, globalCtx);
return; return;
} }
@ -12685,8 +12715,10 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) {
gSaveContext.swordHealth = 8; gSaveContext.swordHealth = 8;
} }
Message_StartTextbox(globalCtx, giEntry.textId, &this->actor); Message_StartTextbox(globalCtx, giEntry->textId, &this->actor);
Item_Give(globalCtx, giEntry.itemId); Item_Give(globalCtx, giEntry->itemId);
Player_SetPendingFlag(this, globalCtx);
if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) || if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) ||
((this->getItemId >= GI_RUPEE_PURPLE) && (this->getItemId <= GI_RUPEE_GOLD)) || ((this->getItemId >= GI_RUPEE_PURPLE) && (this->getItemId <= GI_RUPEE_GOLD)) ||
@ -13129,7 +13161,10 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) {
if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { if (LinkAnimation_Update(globalCtx, &this->skelAnime)) {
if (this->unk_84F != 0) { if (this->unk_84F != 0) {
if (this->unk_850 == 0) { if (this->unk_850 == 0) {
Message_StartTextbox(globalCtx, D_80854A04[this->unk_84F - 1].textId, &this->actor); if (CVar_GetS32("gFastDrops", 0))
{ this->unk_84F = 0; }
else
{ Message_StartTextbox(globalCtx, D_80854A04[this->unk_84F - 1].textId, &this->actor); }
Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900);
this->unk_850 = 1; this->unk_850 = 1;
} }
@ -13165,11 +13200,13 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) {
if (i < 4) { if (i < 4) {
this->unk_84F = i + 1; this->unk_84F = i + 1;
this->unk_850 = 0; this->unk_850 = 0;
this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29;
this->interactRangeActor->parent = &this->actor; this->interactRangeActor->parent = &this->actor;
Player_UpdateBottleHeld(globalCtx, this, catchInfo->itemId, ABS(catchInfo->actionParam)); Player_UpdateBottleHeld(globalCtx, this, catchInfo->itemId, ABS(catchInfo->actionParam));
func_808322D0(globalCtx, this, sp24->unk_04); if (!CVar_GetS32("gFastDrops", 0)) {
func_80835EA4(globalCtx, 4); this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29;
func_808322D0(globalCtx, this, sp24->unk_04);
func_80835EA4(globalCtx, 4);
}
} }
} }
} }

View File

@ -39,8 +39,10 @@ void Title_PrintBuildInfo(Gfx** gfxp) {
GfxPrint_Printf(&printer, "GCC SHIP"); GfxPrint_Printf(&printer, "GCC SHIP");
#endif #endif
GfxPrint_SetPos(&printer, 5, 4); GfxPrint_SetPos(&printer, 1, 4);
GfxPrint_Printf(&printer, "Game Version: %s", gameVersionStr); GfxPrint_Printf(&printer, "Game Version: %s", gameVersionStr);
GfxPrint_SetPos(&printer, 1, 5);
GfxPrint_Printf(&printer, "Release Version: %s", gBuildVersion);
GfxPrint_SetColor(&printer, 255, 255, 255, 255); GfxPrint_SetColor(&printer, 255, 255, 255, 255);
GfxPrint_SetPos(&printer, 2, 22); GfxPrint_SetPos(&printer, 2, 22);
@ -49,8 +51,6 @@ void Title_PrintBuildInfo(Gfx** gfxp) {
GfxPrint_Printf(&printer, "Build Date:%s", gBuildDate); GfxPrint_Printf(&printer, "Build Date:%s", gBuildDate);
GfxPrint_SetPos(&printer, 3, 26); GfxPrint_SetPos(&printer, 3, 26);
GfxPrint_Printf(&printer, "%s", gBuildTeam); GfxPrint_Printf(&printer, "%s", gBuildTeam);
GfxPrint_SetPos(&printer, 3, 28);
GfxPrint_Printf(&printer, "Release Version: %s", gBuildVersion);
g = GfxPrint_Close(&printer); g = GfxPrint_Close(&printer);
GfxPrint_Destroy(&printer); GfxPrint_Destroy(&printer);
*gfxp = g; *gfxp = g;

View File

@ -12,7 +12,6 @@
#include "textures/map_name_static/map_name_static.h" #include "textures/map_name_static/map_name_static.h"
#include "textures/map_48x85_static/map_48x85_static.h" #include "textures/map_48x85_static/map_48x85_static.h"
#include "vt.h" #include "vt.h"
#include "Hooks.h"
#include "soh/frame_interpolation.h" #include "soh/frame_interpolation.h"
@ -3228,10 +3227,9 @@ void KaleidoScope_LoadDungeonMap(GlobalContext* globalCtx) {
char* firstTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX]; char* firstTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX];
char* secondTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX + 1]; char* secondTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX + 1];
uint32_t firstTextureSize = ResourceMgr_LoadTexSizeByName(firstTextureName);
memcpy(interfaceCtx->mapSegment, ResourceMgr_LoadTexByName(firstTextureName), ResourceMgr_LoadTexSizeByName(firstTextureName)); memcpy(interfaceCtx->mapSegment, ResourceMgr_LoadTexByName(firstTextureName), ResourceMgr_LoadTexSizeByName(firstTextureName));
memcpy(interfaceCtx->mapSegment + (firstTextureSize / 2), ResourceMgr_LoadTexByName(secondTextureName), ResourceMgr_LoadTexSizeByName(secondTextureName)); memcpy(interfaceCtx->mapSegment + 0x800, ResourceMgr_LoadTexByName(secondTextureName), ResourceMgr_LoadTexSizeByName(secondTextureName));
} }
void KaleidoScope_UpdateDungeonMap(GlobalContext* globalCtx) { void KaleidoScope_UpdateDungeonMap(GlobalContext* globalCtx) {