Merge pull request #494 from briaguya-ai/z64-devmerge

Z64 devmerge
This commit is contained in:
Nicholas Estelami 2022-06-17 17:41:23 -04:00 committed by GitHub
commit 029d7bcda3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 355 additions and 299 deletions

6
Jenkinsfile vendored
View File

@ -8,6 +8,9 @@ pipeline {
stages { stages {
stage ('Build Windows') { stage ('Build Windows') {
options {
timeout(time: 20)
}
environment { environment {
MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe' MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe'
CONFIG='Release' CONFIG='Release'
@ -71,6 +74,9 @@ pipeline {
} }
} }
stage ('Build Linux') { stage ('Build Linux') {
options {
timeout(time: 20)
}
agent { agent {
label "SoH-Linux-Builders" label "SoH-Linux-Builders"
} }

View File

@ -45,14 +45,14 @@ void OTRExporter_Audio::WriteSampleEntry(SampleEntry* entry, BinaryWriter* write
writer->Write((uint32_t)(entry->loop.count)); writer->Write((uint32_t)(entry->loop.count));
writer->Write((uint32_t)entry->loop.states.size()); writer->Write((uint32_t)entry->loop.states.size());
for (int i = 0; i < entry->loop.states.size(); i++) for (size_t i = 0; i < entry->loop.states.size(); i++)
writer->Write((entry->loop.states[i])); writer->Write((entry->loop.states[i]));
writer->Write((uint32_t)(entry->book.order)); writer->Write((uint32_t)(entry->book.order));
writer->Write((uint32_t)(entry->book.npredictors)); writer->Write((uint32_t)(entry->book.npredictors));
writer->Write((uint32_t)entry->book.books.size()); writer->Write((uint32_t)entry->book.books.size());
for (int i = 0; i < entry->book.books.size(); i++) for (size_t i = 0; i < entry->book.books.size(); i++)
writer->Write((entry->book.books[i])); writer->Write((entry->book.books[i]));
} }
@ -128,7 +128,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit
fntWriter.Write((uint32_t)audio->soundFontTable[i].instruments.size()); fntWriter.Write((uint32_t)audio->soundFontTable[i].instruments.size());
fntWriter.Write((uint32_t)audio->soundFontTable[i].soundEffects.size()); fntWriter.Write((uint32_t)audio->soundFontTable[i].soundEffects.size());
for (int k = 0; k < audio->soundFontTable[i].drums.size(); k++) for (size_t k = 0; k < audio->soundFontTable[i].drums.size(); k++)
{ {
fntWriter.Write(audio->soundFontTable[i].drums[k].releaseRate); fntWriter.Write(audio->soundFontTable[i].drums[k].releaseRate);
fntWriter.Write(audio->soundFontTable[i].drums[k].pan); fntWriter.Write(audio->soundFontTable[i].drums[k].pan);
@ -140,7 +140,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit
fntWriter.Write(audio->soundFontTable[i].drums[k].tuning); fntWriter.Write(audio->soundFontTable[i].drums[k].tuning);
} }
for (int k = 0; k < audio->soundFontTable[i].instruments.size(); k++) for (size_t k = 0; k < audio->soundFontTable[i].instruments.size(); k++)
{ {
fntWriter.Write((uint8_t)audio->soundFontTable[i].instruments[k].isValidInstrument); fntWriter.Write((uint8_t)audio->soundFontTable[i].instruments[k].isValidInstrument);
@ -156,7 +156,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit
WriteSoundFontEntry(audio, audio->soundFontTable[i].instruments[k].highNotesSound, audio->samples, &fntWriter); WriteSoundFontEntry(audio, audio->soundFontTable[i].instruments[k].highNotesSound, audio->samples, &fntWriter);
} }
for (int k = 0; k < audio->soundFontTable[i].soundEffects.size(); k++) for (size_t k = 0; k < audio->soundFontTable[i].soundEffects.size(); k++)
{ {
WriteSoundFontEntry(audio, audio->soundFontTable[i].soundEffects[k], audio->samples, &fntWriter); WriteSoundFontEntry(audio, audio->soundFontTable[i].soundEffects[k], audio->samples, &fntWriter);
} }
@ -167,7 +167,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit
} }
// Write Sequences // Write Sequences
for (int i = 0; i < audio->sequences.size(); i++) for (size_t i = 0; i < audio->sequences.size(); i++)
{ {
auto seq = audio->sequences[i]; auto seq = audio->sequences[i];
@ -183,7 +183,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit
seqWriter.Write((uint8_t)audio->sequenceTable[i].cachePolicy); seqWriter.Write((uint8_t)audio->sequenceTable[i].cachePolicy);
seqWriter.Write((uint32_t)audio->fontIndices[i].size()); seqWriter.Write((uint32_t)audio->fontIndices[i].size());
for (int k = 0; k < audio->fontIndices[i].size(); k++) for (size_t k = 0; k < audio->fontIndices[i].size(); k++)
seqWriter.Write((uint8_t)audio->fontIndices[i][k]); seqWriter.Write((uint8_t)audio->fontIndices[i][k]);
std::string fName = OTRExporter_DisplayList::GetPathToRes(res, StringHelper::Sprintf("sequences/%s", audio->seqNames[i].c_str())); std::string fName = OTRExporter_DisplayList::GetPathToRes(res, StringHelper::Sprintf("sequences/%s", audio->seqNames[i].c_str()));

View File

@ -684,3 +684,4 @@ bool WINAPI SListFileFindClose(HANDLE hFind)
return FreeListFileCache(pCache); return FreeListFileCache(pCache);
} }

View File

@ -438,3 +438,4 @@ void DumpFileTable(TFileEntry * pFileTable, DWORD dwFileTableSize);
#endif #endif
#endif // __STORMCOMMON_H__ #endif // __STORMCOMMON_H__

View File

@ -344,6 +344,7 @@ void ZAudio::ParseRawData()
//int gSequenceTableOffset = 0x1386A0; //int gSequenceTableOffset = 0x1386A0;
//int gSampleBankTableOffset = 0x138D90; //int gSampleBankTableOffset = 0x138D90;
//int gSequenceFontTableOffset = 0x1384E0; //int gSequenceFontTableOffset = 0x1384E0;
// NTSC 1.0 // NTSC 1.0
//int gSoundFontTableOffset = 0x1026A0; //int gSoundFontTableOffset = 0x1026A0;
//int gSequenceTableOffset = 0x102AD0; //int gSequenceTableOffset = 0x102AD0;

View File

@ -34,8 +34,8 @@ static SDL_Window *wnd;
static SDL_GLContext ctx; static SDL_GLContext ctx;
static int inverted_scancode_table[512]; static int inverted_scancode_table[512];
static int vsync_enabled = 0; static int vsync_enabled = 0;
static unsigned int window_width = DESIRED_SCREEN_WIDTH; static int window_width = DESIRED_SCREEN_WIDTH;
static unsigned int window_height = DESIRED_SCREEN_HEIGHT; static int window_height = DESIRED_SCREEN_HEIGHT;
static bool fullscreen_state; static bool fullscreen_state;
static void (*on_fullscreen_changed_callback)(bool is_now_fullscreen); static void (*on_fullscreen_changed_callback)(bool is_now_fullscreen);
static bool (*on_key_down_callback)(int scancode); static bool (*on_key_down_callback)(int scancode);
@ -145,7 +145,8 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen) {
int len = sprintf(title, "%s (%s)", game_name, GFX_API_NAME); int len = sprintf(title, "%s (%s)", game_name, GFX_API_NAME);
wnd = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, wnd = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
SDL_GL_GetDrawableSize(wnd, &window_width, &window_height);
if (start_in_fullscreen) { if (start_in_fullscreen) {
set_fullscreen(true, false); set_fullscreen(true, false);
@ -244,8 +245,7 @@ static void gfx_sdl_handle_events(void) {
#endif #endif
case SDL_WINDOWEVENT: case SDL_WINDOWEVENT:
if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
window_width = event.window.data1; SDL_GL_GetDrawableSize(wnd, &window_width, &window_height);
window_height = event.window.data2;
} }
break; break;
case SDL_QUIT: case SDL_QUIT:

View File

@ -50,6 +50,7 @@ bool oldCursorState = true;
ImGui::PopStyleColor(); \ ImGui::PopStyleColor(); \
ImGui::Separator(); ImGui::Separator();
#define TOGGLE_BTN ImGuiKey_F1 #define TOGGLE_BTN ImGuiKey_F1
#define TOGGLE_PAD_BTN ImGuiKey_GamepadBack
#define HOOK(b) if(b) needs_save = true; #define HOOK(b) if(b) needs_save = true;
OSContPad* pads; OSContPad* pads;
@ -556,6 +557,20 @@ namespace SohImGui {
} }
} }
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue) {
if (ImGui::BeginCombo(name.c_str(), items[static_cast<int>(CVar_GetS32(cvarName, defaultValue))].c_str())) {
for (int settingIndex = 0; settingIndex < (int) items.size(); settingIndex++) {
if (ImGui::Selectable(items[settingIndex].c_str())) {
CVar_SetS32(cvarName, settingIndex);
needs_save = true;
}
}
ImGui::EndCombo();
}
}
void RandomizeColor(const char* cvarName, ImVec4* colors) { void RandomizeColor(const char* cvarName, ImVec4* colors) {
std::string Cvar_Red = cvarName; std::string Cvar_Red = cvarName;
Cvar_Red += "R"; Cvar_Red += "R";
@ -684,7 +699,7 @@ namespace SohImGui {
const std::shared_ptr<Window> wnd = GlobalCtx2::GetInstance()->GetWindow(); const std::shared_ptr<Window> wnd = GlobalCtx2::GetInstance()->GetWindow();
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoBackground |
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus | ImGuiWindowFlags_NoResize; ImGuiWindowFlags_NoResize;
if (CVar_GetS32("gOpenMenuBar", 0)) window_flags |= ImGuiWindowFlags_MenuBar; if (CVar_GetS32("gOpenMenuBar", 0)) window_flags |= ImGuiWindowFlags_MenuBar;
const ImGuiViewport* viewport = ImGui::GetMainViewport(); const ImGuiViewport* viewport = ImGui::GetMainViewport();
@ -712,7 +727,9 @@ namespace SohImGui {
ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None); ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None);
if (ImGui::IsKeyPressed(TOGGLE_BTN)) { ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
if ((ImGui::IsKeyPressed(TOGGLE_BTN)) || (ImGui::IsKeyDown(TOGGLE_PAD_BTN))) {
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;
@ -742,7 +759,22 @@ namespace SohImGui {
} }
if (ImGui::BeginMenu("Controller")) if (ImGui::BeginMenu("Controller"))
{ {
EnhancementCheckbox("D-pad Support on Pause and File Select", "gDpadPauseName");
EnhancementCheckbox("D-pad Support in Ocarina and Text Choice", "gDpadOcarinaText");
EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop");
ImGui::Separator();
EnhancementCheckbox("Show Inputs", "gInputEnabled");
Tooltip("Shows currently pressed inputs on the bottom right of the screen");
EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled");
EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false);
Tooltip("Sets the on screen size of the displayed inputs from Show Inputs");
ImGui::Separator();
for (const auto& [i, controllers] : Ship::Window::Controllers) for (const auto& [i, controllers] : Ship::Window::Controllers)
{ {
bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) { bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) {
@ -772,19 +804,6 @@ namespace SohImGui {
ImGui::Separator(); ImGui::Separator();
} }
EnhancementCheckbox("Show Inputs", "gInputEnabled");
Tooltip("Shows currently pressed inputs on the bottom right of the screen");
EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled");
EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false);
Tooltip("Sets the on screen size of the displayed inputs from Show Inputs");
ImGui::Separator();
EnhancementCheckbox("D-pad Support on Pause and File Select", "gDpadPauseName");
EnhancementCheckbox("D-pad Support in Ocarina and Text Choice", "gDpadOcarinaText");
EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop");
ImGui::EndMenu(); ImGui::EndMenu();
} }
@ -859,9 +878,11 @@ namespace SohImGui {
Tooltip("Displays an icon and plays a sound when Stone of Agony should 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("Faster Block Push", "gFasterBlockPush"); EnhancementCheckbox("Faster Block Push", "gFasterBlockPush");
EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots"); EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots");
Tooltip("Allows equiping the tunic and boots to c-buttons"); Tooltip("Allows equipping the tunic and boots to c-buttons");
EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood"); EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood");
Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask"); Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask");
EnhancementCheckbox("No Forced Navi", "gNoForcedNavi");
Tooltip("Prevent forced Navi conversations");
EnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze"); EnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze");
Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas"); Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas");
EnhancementCheckbox("Disable Navi Call Audio", "gDisableNaviCallAudio"); EnhancementCheckbox("Disable Navi Call Audio", "gDisableNaviCallAudio");
@ -872,6 +893,7 @@ namespace SohImGui {
Tooltip("The default response to Kaepora Gaebora is always that you understood what he said"); Tooltip("The default response to Kaepora Gaebora is always that you understood what he said");
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 shared across time periods"); Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods");
EnhancementCheckbox("Enable passage of time on file select", "gTimeFlowFileSelect");
ImGui::EndMenu(); ImGui::EndMenu();
} }
@ -940,6 +962,8 @@ namespace SohImGui {
Tooltip("Show dungeon entrances icon only when it should be"); Tooltip("Show dungeon entrances icon only when it should be");
EnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle"); EnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle");
Tooltip("Makes two handed idle animation play, a seemingly finished animation that was disabled on accident in the original game"); Tooltip("Makes two handed idle animation play, a seemingly finished animation that was disabled on accident in the original game");
EnhancementCheckbox("Fix the Gravedigging Tour Glitch", "gGravediggingTourFix");
Tooltip("Fixes a bug where you can permanently miss the Gravedigging Tour Heart Piece");
EnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix"); EnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix");
Tooltip("Prevents the Forest Stage Deku Nut upgrade from becoming 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");
@ -1015,7 +1039,7 @@ namespace SohImGui {
} }
if (ImGui::BeginMenu("Cosmetics")) { if (ImGui::BeginMenu("Cosmetics")) {
EnhancementCheckbox("Cosmetics editor", "gCosmticsEditor"); EnhancementCheckbox("Cosmetics editor", "gCosmeticEditor");
Tooltip("Edit Navi and Link's Tunics color."); Tooltip("Edit Navi and Link's Tunics color.");
EnhancementCheckbox("HUD Margins editor", "gUseMargins"); EnhancementCheckbox("HUD Margins editor", "gUseMargins");
EnhancementRadioButton("N64 interface", "gHudColors", 0); EnhancementRadioButton("N64 interface", "gHudColors", 0);
@ -1061,6 +1085,8 @@ namespace SohImGui {
Tooltip("Drops from enemies, grass, etc. don't disappear after a set amount of time"); Tooltip("Drops from enemies, grass, etc. don't disappear after a set amount of time");
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");
Tooltip("Allows Link to shield normally with two-handed swords and the Megaton Hammer");
ImGui::EndMenu(); ImGui::EndMenu();
} }
@ -1074,7 +1100,7 @@ namespace SohImGui {
if (CVar_GetS32("gSkipLogoTitle",0)) { if (CVar_GetS32("gSkipLogoTitle",0)) {
EnhancementSliderInt("Loading %d", "##SaveFileID", "gSaveFileID", 0, 4, ""); EnhancementSliderInt("Loading %d", "##SaveFileID", "gSaveFileID", 0, 4, "");
} }
ImGui::Separator(); ImGui::Separator();
EnhancementCheckbox("Stats", "gStatsEnabled"); EnhancementCheckbox("Stats", "gStatsEnabled");
Tooltip("Shows the stats window, with your FPS and frametimes, and 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");
@ -1085,14 +1111,15 @@ namespace SohImGui {
} }
bool Margins_isOpen = CVar_GetS32("gUseMargins", 0); bool Margins_isOpen = CVar_GetS32("gUseMargins", 0);
bool Cosmetics_isOpen = CVar_GetS32("gCosmticsEditor", 0); bool Cosmetics_isOpen = CVar_GetS32("gCosmeticEditor", 0);
bool Interface_isOpen = CVar_GetS32("gColorsEditor", 0); bool Interface_isOpen = CVar_GetS32("gColorsEditor", 0);
if (Margins_isOpen) { if (Margins_isOpen) {
if (!Margins_isOpen) { if (!Margins_isOpen) {
CVar_SetS32("gHUDMargins", 0);
return; return;
} }
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
ImGui::Begin("Margins Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); ImGui::Begin("Margins Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
if (ImGui::BeginTabBar("Margins Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabBar("Margins Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("Interface margins")) { if (ImGui::BeginTabItem("Interface margins")) {
@ -1106,14 +1133,14 @@ namespace SohImGui {
} }
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
ImGui::PopStyleColor();
ImGui::End(); ImGui::End();
} }
if (Cosmetics_isOpen) { if (Cosmetics_isOpen) {
if (!Cosmetics_isOpen) { if (!Cosmetics_isOpen) {
CVar_SetS32("gCosmeticEditor", 0);
return; return;
} }
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::SetNextWindowSize(ImVec2(500, 627), ImGuiCond_FirstUseEver);
ImGui::Begin("Cosmetics Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); ImGui::Begin("Cosmetics Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
if (ImGui::BeginTabBar("Cosmetics Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabBar("Cosmetics Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("Navi")) { if (ImGui::BeginTabItem("Navi")) {
@ -1152,14 +1179,14 @@ namespace SohImGui {
} }
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
ImGui::PopStyleColor();
ImGui::End(); ImGui::End();
} }
if (Interface_isOpen) { if (Interface_isOpen) {
if (!Interface_isOpen) { if (!Interface_isOpen) {
CVar_SetS32("gColorsEditor", 0);
return; return;
} }
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::SetNextWindowSize(ImVec2(215, 627), ImGuiCond_FirstUseEver);
ImGui::Begin("Interface Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); ImGui::Begin("Interface Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
if (ImGui::BeginTabBar("Interface Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabBar("Interface Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("Hearts")) { if (ImGui::BeginTabItem("Hearts")) {
@ -1200,7 +1227,6 @@ namespace SohImGui {
} }
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
ImGui::PopStyleColor();
ImGui::End(); ImGui::End();
} }

View File

@ -72,6 +72,7 @@ namespace SohImGui {
void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage); void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage);
void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue); void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue);
void EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha=false, bool TitleSameLine=false); void EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha=false, bool TitleSameLine=false);
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue = 0);
void DrawMainMenuAndCalculateGameSize(void); void DrawMainMenuAndCalculateGameSize(void);

View File

@ -1,7 +1,7 @@
<Root> <Root>
<File Name="code" OutName="audio" RangeStart="0x0" RangeEnd="0x12CBB0"> <File Name="code" OutName="audio" RangeStart="0x0" RangeEnd="0x12CBB0">
<Audio Name="audio" Offset="0x00" SoundFontTableOffset="0x138290" SequenceTableOffset="0x1386C0" SampleBankTableOffset="0x138DB0" SequenceFontTableOffset="0x138500"> <Audio Name="audio" Offset="0x00" SoundFontTableOffset="0x138290" SequenceTableOffset="0x1386C0" SampleBankTableOffset="0x138DB0" SequenceFontTableOffset="0x138500">
<Sequences> <Sequences>
<Sequence Name="000_Sound_Effects"/> <Sequence Name="000_Sound_Effects"/>
<Sequence Name="001_Ambient_Effects"/> <Sequence Name="001_Ambient_Effects"/>
<Sequence Name="002_Hyrule_Field_Program"/> <Sequence Name="002_Hyrule_Field_Program"/>
@ -113,6 +113,8 @@
<Sequence Name="108_Timed_Minigame"/> <Sequence Name="108_Timed_Minigame"/>
<Sequence Name="109_Cutscene_Effects"/> <Sequence Name="109_Cutscene_Effects"/>
</Sequences> </Sequences>
<Samples Bank="0"> <Samples Bank="0">
<Sample Name="Bird Chirp 1"> <Sample Name="Bird Chirp 1">
<Offset Version="MQDebug" At="0"/> <Offset Version="MQDebug" At="0"/>
@ -1448,69 +1450,71 @@
<Sample Name="Organic Gurgling"> <Sample Name="Organic Gurgling">
<Offset Version="MQDebug" At="0x16480"/> <Offset Version="MQDebug" At="0x16480"/>
</Sample> </Sample>
</Samples> </Samples>
<Samples Bank="4"> <Samples Bank="4">
<Sample Name="Vocal Ohs"> <Sample Name="Vocal Ohs">
<Offset Version="MQDebug" At="0"/> <Offset Version="MQDebug" At="0"/>
</Sample> </Sample>
<Sample Name="Flute and Voice"> <Sample Name="Flute and Voice">
<Offset Version="MQDebug" At="0x6410"/> <Offset Version="MQDebug" At="0x6410"/>
</Sample> </Sample>
<Sample Name="Off-Kilter Flute"> <Sample Name="Off-Kilter Flute">
<Offset Version="MQDebug" At="0x72D0"/> <Offset Version="MQDebug" At="0x72D0"/>
</Sample> </Sample>
<Sample Name="Voice"> <Sample Name="Voice">
<Offset Version="MQDebug" At="0x8230"/> <Offset Version="MQDebug" At="0x8230"/>
</Sample> </Sample>
<Sample Name="Melodic Wooden Clacking"> <Sample Name="Melodic Wooden Clacking">
<Offset Version="MQDebug" At="0x9030"/> <Offset Version="MQDebug" At="0x9030"/>
</Sample> </Sample>
</Samples> </Samples>
<Samples Bank="5">
<Sample Name="Goron Drum">
<Offset Version="MQDebug" At="0"/>
</Sample>
<Sample Name="Bass Slap">
<Offset Version="MQDebug" At="0x2540"/>
</Sample>
<Sample Name="Goron Ooh">
<Offset Version="MQDebug" At="0x4800"/>
</Sample>
<Sample Name="Goron Ooh (High)">
<Offset Version="MQDebug" At="0x72D0"/>
</Sample>
<Sample Name="Tom Drum">
<Offset Version="MQDebug" At="0x7B70"/>
</Sample>
<Sample Name="Resonant Bass Marimba">
<Offset Version="MQDebug" At="0x8630"/>
</Sample>
</Samples>
<Samples Bank="6">
<Sample Name="Warm Synth Pad">
<Offset Version="MQDebug" At="0"/>
</Sample>
<Sample Name="Egyptian Flute">
<Offset Version="MQDebug" At="0xB0D0"/>
</Sample>
<Sample Name="Tom Drum">
<Offset Version="MQDebug" At="0xE120"/>
</Sample>
<Sample Name="Vocal Synth">
<Offset Version="MQDebug" At="0x103E0"/>
</Sample>
<Sample Name="Gong">
<Offset Version="MQDebug" At="0x12EB0"/>
</Sample>
<Sample Name="Bass Slap">
<Offset Version="MQDebug" At="0x1D3E0"/>
</Sample>
<Sample Name="Windchimes">
<Offset Version="MQDebug" At="0x22EE0"/>
</Sample>
</Samples>
<Samples Bank="5">
<Sample Name="Goron Drum">
<Offset Version="MQDebug" At="0"/>
</Sample>
<Sample Name="Bass Slap">
<Offset Version="MQDebug" At="0x2540"/>
</Sample>
<Sample Name="Goron Ooh">
<Offset Version="MQDebug" At="0x4800"/>
</Sample>
<Sample Name="Goron Ooh (High)">
<Offset Version="MQDebug" At="0x72D0"/>
</Sample>
<Sample Name="Tom Drum">
<Offset Version="MQDebug" At="0x7B70"/>
</Sample>
<Sample Name="Resonant Bass Marimba">
<Offset Version="MQDebug" At="0x8630"/>
</Sample>
</Samples>
<Samples Bank="6">
<Sample Name="Warm Synth Pad">
<Offset Version="MQDebug" At="0"/>
</Sample>
<Sample Name="Egyptian Flute">
<Offset Version="MQDebug" At="0xB0D0"/>
</Sample>
<Sample Name="Tom Drum">
<Offset Version="MQDebug" At="0xE120"/>
</Sample>
<Sample Name="Vocal Synth">
<Offset Version="MQDebug" At="0x103E0"/>
</Sample>
<Sample Name="Gong">
<Offset Version="MQDebug" At="0x12EB0"/>
</Sample>
<Sample Name="Bass Slap">
<Offset Version="MQDebug" At="0x1D3E0"/>
</Sample>
<Sample Name="Windchimes">
<Offset Version="MQDebug" At="0x22EE0"/>
</Sample>
</Samples>
<Soundfont Name="02_Ambient_Sounds" Index="2"/> <Soundfont Name="02_Ambient_Sounds" Index="2"/>
<Soundfont Name="37_Unused_Deku_Tree" Index="37" OverrideSampleBank="2"/> <Soundfont Name="37_Unused_Deku_Tree" Index="37" OverrideSampleBank="2"/>
<Soundfont Name="04_Deku_Tree" Index="4"/> <Soundfont Name="04_Deku_Tree" Index="4"/>

View File

@ -1,7 +1,7 @@
<Root> <Root>
<File Name="code" OutName="audio" RangeStart="0x0" RangeEnd="0x12CBB0"> <File Name="code" OutName="audio" RangeStart="0x0" RangeEnd="0x12CBB0">
<Audio Name="audio" Offset="0x00" SoundFontTableOffset="0xFF590" SequenceTableOffset="0xFF9C0" SampleBankTableOffset="0x1000B0" SequenceFontTableOffset="0xFF800"> <Audio Name="audio" Offset="0x00" SoundFontTableOffset="0xFF590" SequenceTableOffset="0xFF9C0" SampleBankTableOffset="0x1000B0" SequenceFontTableOffset="0xFF800">
<Sequences> <Sequences>
<Sequence Name="000_Sound_Effects"/> <Sequence Name="000_Sound_Effects"/>
<Sequence Name="001_Ambient_Effects"/> <Sequence Name="001_Ambient_Effects"/>
<Sequence Name="002_Hyrule_Field_Program"/> <Sequence Name="002_Hyrule_Field_Program"/>
@ -1431,6 +1431,7 @@
<Offset Version="MQDebug" At="0"/> <Offset Version="MQDebug" At="0"/>
</Sample> </Sample>
</Samples> </Samples>
<Samples Bank="3"> <Samples Bank="3">
<Sample Name="Low Rumbling"> <Sample Name="Low Rumbling">
<Offset Version="MQDebug" At="0"/> <Offset Version="MQDebug" At="0"/>
@ -1447,72 +1448,74 @@
<Sample Name="Organic Gurgling"> <Sample Name="Organic Gurgling">
<Offset Version="MQDebug" At="0x16480"/> <Offset Version="MQDebug" At="0x16480"/>
</Sample> </Sample>
</Samples> </Samples>
<Samples Bank="4"> <Samples Bank="4">
<Sample Name="Vocal Ohs"> <Sample Name="Vocal Ohs">
<Offset Version="MQDebug" At="0"/> <Offset Version="MQDebug" At="0"/>
</Sample> </Sample>
<Sample Name="Flute and Voice"> <Sample Name="Flute and Voice">
<Offset Version="MQDebug" At="0x6410"/> <Offset Version="MQDebug" At="0x6410"/>
</Sample> </Sample>
<Sample Name="Off-Kilter Flute"> <Sample Name="Off-Kilter Flute">
<Offset Version="MQDebug" At="0x72D0"/> <Offset Version="MQDebug" At="0x72D0"/>
</Sample> </Sample>
<Sample Name="Voice"> <Sample Name="Voice">
<Offset Version="MQDebug" At="0x8230"/> <Offset Version="MQDebug" At="0x8230"/>
</Sample> </Sample>
<Sample Name="Melodic Wooden Clacking"> <Sample Name="Melodic Wooden Clacking">
<Offset Version="MQDebug" At="0x9030"/> <Offset Version="MQDebug" At="0x9030"/>
</Sample> </Sample>
</Samples> </Samples>
<Samples Bank="5"> <Samples Bank="5">
<Sample Name="Goron Drum"> <Sample Name="Goron Drum">
<Offset Version="MQDebug" At="0"/> <Offset Version="MQDebug" At="0"/>
</Sample> </Sample>
<Sample Name="Bass Slap"> <Sample Name="Bass Slap">
<Offset Version="MQDebug" At="0x2540"/> <Offset Version="MQDebug" At="0x2540"/>
</Sample> </Sample>
<Sample Name="Goron Ooh"> <Sample Name="Goron Ooh">
<Offset Version="MQDebug" At="0x4800"/> <Offset Version="MQDebug" At="0x4800"/>
</Sample> </Sample>
<Sample Name="Goron Ooh (High)"> <Sample Name="Goron Ooh (High)">
<Offset Version="MQDebug" At="0x72D0"/> <Offset Version="MQDebug" At="0x72D0"/>
</Sample> </Sample>
<Sample Name="Tom Drum"> <Sample Name="Tom Drum">
<Offset Version="MQDebug" At="0x7B70"/> <Offset Version="MQDebug" At="0x7B70"/>
</Sample> </Sample>
<Sample Name="Resonant Bass Marimba"> <Sample Name="Resonant Bass Marimba">
<Offset Version="MQDebug" At="0x8630"/> <Offset Version="MQDebug" At="0x8630"/>
</Sample> </Sample>
</Samples> </Samples>
<Samples Bank="6"> <Samples Bank="6">
<Sample Name="Warm Synth Pad"> <Sample Name="Warm Synth Pad">
<Offset Version="MQDebug" At="0"/> <Offset Version="MQDebug" At="0"/>
</Sample> </Sample>
<Sample Name="Egyptian Flute"> <Sample Name="Egyptian Flute">
<Offset Version="MQDebug" At="0xB0D0"/> <Offset Version="MQDebug" At="0xB0D0"/>
</Sample> </Sample>
<Sample Name="Tom Drum"> <Sample Name="Tom Drum">
<Offset Version="MQDebug" At="0xE120"/> <Offset Version="MQDebug" At="0xE120"/>
</Sample> </Sample>
<Sample Name="Vocal Synth"> <Sample Name="Vocal Synth">
<Offset Version="MQDebug" At="0x103E0"/> <Offset Version="MQDebug" At="0x103E0"/>
</Sample> </Sample>
<Sample Name="Gong"> <Sample Name="Gong">
<Offset Version="MQDebug" At="0x12EB0"/> <Offset Version="MQDebug" At="0x12EB0"/>
</Sample> </Sample>
<Sample Name="Bass Slap"> <Sample Name="Bass Slap">
<Offset Version="MQDebug" At="0x1D3E0"/> <Offset Version="MQDebug" At="0x1D3E0"/>
</Sample> </Sample>
<Sample Name="Windchimes"> <Sample Name="Windchimes">
<Offset Version="MQDebug" At="0x22EE0"/> <Offset Version="MQDebug" At="0x22EE0"/>
</Sample> </Sample>
</Samples> </Samples>
<Soundfont Name="02_Ambient_Sounds" Index="2"/>
<Soundfont Name="37_Unused_Deku_Tree" Index="37" OverrideSampleBank="2"/>
<Soundfont Name="04_Deku_Tree" Index="4"/> <Soundfont Name="02_Ambient_Sounds" Index="2"/>
<Soundfont Name="37_Unused_Deku_Tree" Index="37" OverrideSampleBank="2"/>
<Soundfont Name="04_Deku_Tree" Index="4"/>
<Soundfont Name="11_Dodongos_Cavern" Index="11"/> <Soundfont Name="11_Dodongos_Cavern" Index="11"/>
<Soundfont Name="33_Ending_1" Index="33"/> <Soundfont Name="33_Ending_1" Index="33"/>
<Soundfont Name="34_Ending_2" Index="34"/> <Soundfont Name="34_Ending_2" Index="34"/>
@ -1548,6 +1551,8 @@
<Soundfont Name="18_Warp_Songs" Index="18"/> <Soundfont Name="18_Warp_Songs" Index="18"/>
<Soundfont Name="25_Water_Temple" Index="25"/> <Soundfont Name="25_Water_Temple" Index="25"/>
<Soundfont Name="21_Zoras_Domain" Index="21"/> <Soundfont Name="21_Zoras_Domain" Index="21"/>
</Audio> </Audio>
</File> </File>
</Root> </Root>

View File

@ -35,9 +35,11 @@ void BootCommands_Init()
CVar_RegisterS32("gNewDrops", 0); CVar_RegisterS32("gNewDrops", 0);
CVar_RegisterS32("gVisualAgony", 0); CVar_RegisterS32("gVisualAgony", 0);
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French
CVar_RegisterS32("gGravediggingTourFix", 1);
CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom
CVar_RegisterS32("gUseNaviCol", 0); CVar_RegisterS32("gUseNaviCol", 0);
CVar_RegisterS32("gUseTunicsCol", 0); CVar_RegisterS32("gUseTunicsCol", 0);
CVar_RegisterS32("gTimeFlowFileSelect", 0);
} }
//void BootCommands_ParseBootArgs(char* str) //void BootCommands_ParseBootArgs(char* str)

View File

@ -6,6 +6,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <cmath> #include <cmath>
#include <Cvar.h>
extern "C" { extern "C" {
#include <z64.h> #include <z64.h>
@ -15,40 +16,27 @@ extern "C" {
extern GlobalContext* gGlobalCtx; extern GlobalContext* gGlobalCtx;
} }
enum class ColRenderSetting { enum class ColRenderSetting { Disabled, Solid, Transparent };
Disabled,
Solid,
Transparent,
NumSettings
};
std::string ColRenderSettingNames[] = { std::vector<std::string> ColRenderSettingNames = {
"Disabled", "Disabled",
"Solid", "Solid",
"Transparent", "Transparent",
}; };
static ColRenderSetting showSceneColSetting = ColRenderSetting::Disabled; ImVec4 scene_col;
static ColRenderSetting showBgActorSetting = ColRenderSetting::Disabled; ImVec4 hookshot_col;
static ColRenderSetting showColCheckSetting = ColRenderSetting::Disabled; ImVec4 entrance_col;
static ColRenderSetting showWaterboxSetting = ColRenderSetting::Disabled; ImVec4 specialSurface_col;
ImVec4 interactable_col;
ImVec4 slope_col;
ImVec4 void_col;
static uint32_t sceneColor = 0xFFFFFFFF; ImVec4 oc_col;
static uint32_t hookshotColor = 0x8080FFFF; ImVec4 ac_col;
static uint32_t entranceColor = 0x00FF00FF; ImVec4 at_col;
static uint32_t specialSurfaceColor = 0xC0FFC0FF;
static uint32_t interactableColor = 0xC000C0FF;
static uint32_t slopeColor = 0xFFFF80FF;
static uint32_t voidColor = 0xFF0000FF;
static uint32_t ocColor = 0xFFFFFFFF; ImVec4 waterbox_col;
static uint32_t acColor = 0x0000FFFF;
static uint32_t atColor = 0xFF0000FF;
static uint32_t waterboxColor = 0x0000FFFF;
static bool applyAsDecal = false;
static bool isShaded = false;
static std::vector<Gfx> opaDl; static std::vector<Gfx> opaDl;
static std::vector<Gfx> xluDl; static std::vector<Gfx> xluDl;
@ -62,38 +50,10 @@ static std::vector<Vtx> cylinderVtx;
static std::vector<Gfx> sphereGfx; static std::vector<Gfx> sphereGfx;
static std::vector<Vtx> sphereVtx; static std::vector<Vtx> sphereVtx;
// Create a dropdown menu to set a ColRenderSetting
void DrawColRenderSetting(const std::string& name, ColRenderSetting& setting) {
if (ImGui::BeginCombo(name.c_str(), ColRenderSettingNames[static_cast<int>(setting)].c_str())) {
for (int32_t settingIndex = 0; settingIndex < static_cast<int>(ColRenderSetting::NumSettings); settingIndex++) {
if (ImGui::Selectable(ColRenderSettingNames[settingIndex].c_str())) {
setting = static_cast<ColRenderSetting>(settingIndex);
}
}
ImGui::EndCombo();
}
}
// Draw a color picker box
void DrawColorPicker(const std::string& name, uint32_t& color) {
float colorAsFloat[4];
colorAsFloat[0] = ((color >> 24) & 0xFF) / 255.0f;
colorAsFloat[1] = ((color >> 16) & 0xFF) / 255.0f;
colorAsFloat[2] = ((color >> 8) & 0xFF) / 255.0f;
colorAsFloat[3] = (color & 0xFF) / 255.0f;
if (ImGui::ColorEdit4(name.c_str(), colorAsFloat, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel)) {
color = static_cast<uint8_t>(colorAsFloat[3] * 255) |
static_cast<uint8_t>(colorAsFloat[2] * 255) << 8 |
static_cast<uint8_t>(colorAsFloat[1] * 255) << 16 |
static_cast<uint8_t>(colorAsFloat[0] * 255) << 24;
}
ImGui::SameLine();
ImGui::Text(name.c_str());
}
// Draws the ImGui window for the collision viewer // Draws the ImGui window for the collision viewer
void DrawColViewerWindow(bool& open) { void DrawColViewerWindow(bool& open) {
if (!open) { if (!open) {
CVar_SetS32("gCollisionViewerEnabled", 0);
return; return;
} }
@ -102,16 +62,17 @@ void DrawColViewerWindow(bool& open) {
ImGui::End(); ImGui::End();
return; return;
} }
SohImGui::EnhancementCheckbox("Enabled", "gColViewerEnabled");
DrawColRenderSetting("Scene", showSceneColSetting); SohImGui::EnhancementCombo("Scene", "gColViewerScene", ColRenderSettingNames);
DrawColRenderSetting("Bg Actors", showBgActorSetting); SohImGui::EnhancementCombo("Bg Actors", "gColViewerBgActors", ColRenderSettingNames);
DrawColRenderSetting("Col Check", showColCheckSetting); SohImGui::EnhancementCombo("Col Check", "gColViewerColCheck", ColRenderSettingNames);
DrawColRenderSetting("Waterbox", showWaterboxSetting); SohImGui::EnhancementCombo("Waterbox", "gColViewerWaterbox", ColRenderSettingNames);
ImGui::Checkbox("Apply as decal", &applyAsDecal); SohImGui::EnhancementCheckbox("Apply as decal", "gColViewerDecal");
InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring " InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring "
"with the scene geometry, but can cause other artifacts."); "with the scene geometry, but can cause other artifacts.");
ImGui::Checkbox("Shaded", &isShaded); SohImGui::EnhancementCheckbox("Shaded", "gColViewerShaded");
InsertHelpHoverText("Applies the scene's shading to the collision display."); InsertHelpHoverText("Applies the scene's shading to the collision display.");
// This has to be duplicated in both code paths due to the nature of ImGui::IsItemHovered() // This has to be duplicated in both code paths due to the nature of ImGui::IsItemHovered()
@ -119,17 +80,20 @@ void DrawColViewerWindow(bool& open) {
if (ImGui::TreeNode("Colors")) { if (ImGui::TreeNode("Colors")) {
InsertHelpHoverText(colorHelpText); InsertHelpHoverText(colorHelpText);
DrawColorPicker("Normal", sceneColor); SohImGui::EnhancementColor("Normal", "gColViewerColorNormal", scene_col, ImVec4(255, 255, 255, 255), false);
DrawColorPicker("Hookshot", hookshotColor); SohImGui::EnhancementColor("Hookshot", "gColViewerColorHookshot", hookshot_col, ImVec4(128, 128, 255, 255),
DrawColorPicker("Entrance", entranceColor); false);
DrawColorPicker("Special Surface (Grass/Sand/Etc)", specialSurfaceColor); SohImGui::EnhancementColor("Entrance", "gColViewerColorEntrance", entrance_col, ImVec4(0, 255, 0, 255), false);
DrawColorPicker("Interactable (Vines/Crawlspace/Etc)", interactableColor); SohImGui::EnhancementColor("Special Surface (Grass/Sand/Etc)", "gColViewerColorSpecialSurface",
DrawColorPicker("Slope", slopeColor); specialSurface_col, ImVec4(192, 255, 192, 255), false);
DrawColorPicker("Void", voidColor); SohImGui::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", "gColViewerColorInteractable",
DrawColorPicker("OC", ocColor); interactable_col, ImVec4(192, 0, 192, 255), false);
DrawColorPicker("AC", acColor); SohImGui::EnhancementColor("Slope", "gColViewerColorSlope", slope_col, ImVec4(255, 255, 128, 255), false);
DrawColorPicker("AT", atColor); SohImGui::EnhancementColor("Void", "gColViewerColorVoid", void_col, ImVec4(255, 0, 0, 255), false);
DrawColorPicker("Waterbox", waterboxColor); SohImGui::EnhancementColor("OC", "gColViewerColorOC", oc_col, ImVec4(255, 255, 255, 255), false);
SohImGui::EnhancementColor("AC", "gColViewerColorAC", ac_col, ImVec4(0, 0, 255, 255), false);
SohImGui::EnhancementColor("AT", "gColViewerColorAT", at_col, ImVec4(255, 0, 0, 255), false);
SohImGui::EnhancementColor("Waterbox", "gColViewerColorWaterbox", waterbox_col, ImVec4(0, 0, 255, 255), false);
ImGui::TreePop(); ImGui::TreePop();
} else { } else {
@ -161,13 +125,12 @@ void CalcTriNorm(const Vec3f& v1, const Vec3f& v2, const Vec3f& v3, Vec3f& norm)
.n = {.ob = { x, y, z }, .tc = { qs105(s), qs105(t) }, .n = { nx, ny, nz }, .a = ca } \ .n = {.ob = { x, y, z }, .tc = { qs105(s), qs105(t) }, .n = { nx, ny, nz }, .a = ca } \
} }
void CreateCylinderData() { void CreateCylinderData() {
constexpr int32_t CYL_DIVS = 12; constexpr int32_t CYL_DIVS = 12;
cylinderGfx.reserve(5 + CYL_DIVS * 2); cylinderGfx.reserve(5 + CYL_DIVS * 2);
cylinderVtx.reserve(2 + CYL_DIVS * 2); cylinderVtx.reserve(2 + CYL_DIVS * 2);
cylinderVtx.push_back(gdSPDefVtxN(0, 0, 0, 0, 0, 0, -127, 0, 0xFF)); // Bottom center vertex cylinderVtx.push_back(gdSPDefVtxN(0, 0, 0, 0, 0, 0, -127, 0, 0xFF)); // Bottom center vertex
cylinderVtx.push_back(gdSPDefVtxN(0, 128, 0, 0, 0, 0, 127, 0, 0xFF)); // Top center vertex cylinderVtx.push_back(gdSPDefVtxN(0, 128, 0, 0, 0, 0, 127, 0, 0xFF)); // Top center vertex
// Create two rings of vertices // Create two rings of vertices
for (int i = 0; i < CYL_DIVS; ++i) { for (int i = 0; i < CYL_DIVS; ++i) {
@ -210,9 +173,10 @@ void CreateCylinderData() {
cylinderGfx.push_back(gsSPEndDisplayList()); cylinderGfx.push_back(gsSPEndDisplayList());
} }
// This subdivides a face into four tris by placing new verticies at the midpoints of the sides (Like a triforce!), then blowing up the // This subdivides a face into four tris by placing new verticies at the midpoints of the sides (Like a triforce!), then
// verticies so they are on the unit sphere // blowing up the verticies so they are on the unit sphere
void CreateSphereFace(std::vector<std::tuple<size_t, size_t, size_t>>& faces, int32_t v0Index, int32_t v1Index, int32_t v2Index) { void CreateSphereFace(std::vector<std::tuple<size_t, size_t, size_t>>& faces, int32_t v0Index, int32_t v1Index,
int32_t v2Index) {
size_t nextIndex = sphereVtx.size(); size_t nextIndex = sphereVtx.size();
size_t v01Index = nextIndex; size_t v01Index = nextIndex;
@ -248,9 +212,9 @@ void CreateSphereFace(std::vector<std::tuple<size_t, size_t, size_t>>& faces, in
} }
} }
// Creates a sphere following the idea in here: http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html // Creates a sphere following the idea in here:
// Spcifically, create a icosahedron by realizing that the points can be placed on 3 rectangles that are on each unit plane. // http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html Spcifically, create a icosahedron by
// Then, subdividing each face. // realizing that the points can be placed on 3 rectangles that are on each unit plane. Then, subdividing each face.
void CreateSphereData() { void CreateSphereData() {
std::vector<Vec3f> base; std::vector<Vec3f> base;
@ -351,7 +315,7 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
alpha = 0xFF; alpha = 0xFF;
} }
if (applyAsDecal) { if (CVar_GetS32("gColViewerDecal", 0) != 0) {
rm |= ZMODE_DEC; rm |= ZMODE_DEC;
} else if (setting == ColRenderSetting::Transparent) { } else if (setting == ColRenderSetting::Transparent) {
rm |= ZMODE_XLU; rm |= ZMODE_XLU;
@ -363,7 +327,7 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
gfx.push_back(gsDPSetCycleType(G_CYC_1CYCLE)); gfx.push_back(gsDPSetCycleType(G_CYC_1CYCLE));
gfx.push_back(gsDPSetRenderMode(rm | blc1, rm | blc2)); gfx.push_back(gsDPSetRenderMode(rm | blc1, rm | blc2));
if (isShaded) { if (CVar_GetS32("gColViewerShaded", 0) != 0) {
gfx.push_back(gsDPSetCombineMode(G_CC_MODULATERGB_PRIM_ENVA, G_CC_MODULATERGB_PRIM_ENVA)); gfx.push_back(gsDPSetCombineMode(G_CC_MODULATERGB_PRIM_ENVA, G_CC_MODULATERGB_PRIM_ENVA));
gfx.push_back(gsSPLoadGeometryMode(G_CULL_BACK | G_ZBUFFER | G_LIGHTING)); gfx.push_back(gsSPLoadGeometryMode(G_CULL_BACK | G_ZBUFFER | G_LIGHTING));
} else { } else {
@ -376,10 +340,16 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
// Draws a dynapoly structure (scenes or Bg Actors) // Draws a dynapoly structure (scenes or Bg Actors)
void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) { void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
uint32_t color = sceneColor; uint32_t colorR = CVar_GetS32("gColViewerColorNormalR", 255);
uint32_t lastColor = color; uint32_t colorG = CVar_GetS32("gColViewerColorNormalG", 255);
dl.push_back(gsDPSetPrimColor(0, 0, (color >> 24) & 0xFF, (color >> 16) & 0xFF, (color >> 8) & 0xFF, uint32_t colorB = CVar_GetS32("gColViewerColorNormalB", 255);
(color >> 0) & 0xFF)); uint32_t colorA = 255;
uint32_t lastColorR = colorR;
uint32_t lastColorG = colorG;
uint32_t lastColorB = colorB;
dl.push_back(gsDPSetPrimColor(0, 0, colorR, colorG, colorB, colorA));
// This keeps track of if we have processed a poly, but not drawn it yet so we can batch them. // This keeps track of if we have processed a poly, but not drawn it yet so we can batch them.
// This saves several hundred commands in larger scenes // This saves several hundred commands in larger scenes
@ -389,34 +359,49 @@ void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
CollisionPoly* poly = &col->polyList[i]; CollisionPoly* poly = &col->polyList[i];
if (SurfaceType_IsHookshotSurface(&gGlobalCtx->colCtx, poly, bgId)) { if (SurfaceType_IsHookshotSurface(&gGlobalCtx->colCtx, poly, bgId)) {
color = hookshotColor; colorR = CVar_GetS32("gColViewerColorHookshotR", 128);
colorG = CVar_GetS32("gColViewerColorHookshotG", 128);
colorB = CVar_GetS32("gColViewerColorHookshotB", 255);
} else if (func_80041D94(&gGlobalCtx->colCtx, poly, bgId) > 0x01) { } else if (func_80041D94(&gGlobalCtx->colCtx, poly, bgId) > 0x01) {
color = interactableColor; colorR = CVar_GetS32("gColViewerColorInteractableR", 192);
colorG = CVar_GetS32("gColViewerColorInteractableG", 0);
colorB = CVar_GetS32("gColViewerColorInteractableB", 192);
} else if (func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x0C) { } else if (func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x0C) {
color = voidColor; colorR = CVar_GetS32("gColViewerColorVoidR", 255);
colorG = CVar_GetS32("gColViewerColorVoidG", 0);
colorB = CVar_GetS32("gColViewerColorVoidB", 0);
} else if (SurfaceType_GetSceneExitIndex(&gGlobalCtx->colCtx, poly, bgId) || } else if (SurfaceType_GetSceneExitIndex(&gGlobalCtx->colCtx, poly, bgId) ||
func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x05) { func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x05) {
color = entranceColor; colorR = CVar_GetS32("gColViewerColorEntranceR", 0);
colorG = CVar_GetS32("gColViewerColorEntranceG", 255);
colorB = CVar_GetS32("gColViewerColorEntranceB", 0);
} else if (func_80041D4C(&gGlobalCtx->colCtx, poly, bgId) != 0 || } else if (func_80041D4C(&gGlobalCtx->colCtx, poly, bgId) != 0 ||
SurfaceType_IsWallDamage(&gGlobalCtx->colCtx, poly, bgId)) { SurfaceType_IsWallDamage(&gGlobalCtx->colCtx, poly, bgId)) {
color = specialSurfaceColor; colorR = CVar_GetS32("gColViewerColorSpecialSurfaceR", 192);
colorG = CVar_GetS32("gColViewerColorSpecialSurfaceG", 255);
colorB = CVar_GetS32("gColViewerColorSpecialSurfaceB", 192);
} else if (SurfaceType_GetSlope(&gGlobalCtx->colCtx, poly, bgId) == 0x01) { } else if (SurfaceType_GetSlope(&gGlobalCtx->colCtx, poly, bgId) == 0x01) {
color = slopeColor; colorR = CVar_GetS32("gColViewerColorSlopeR", 255);
colorG = CVar_GetS32("gColViewerColorSlopeG", 255);
colorB = CVar_GetS32("gColViewerColorSlopeB", 128);
} else { } else {
color = sceneColor; colorR = CVar_GetS32("gColViewerColorNormalR", 255);
colorG = CVar_GetS32("gColViewerColorNormalG", 255);
colorB = CVar_GetS32("gColViewerColorNormalB", 255);
} }
if (lastColor != color) { if (colorR != lastColorR || colorG != lastColorG || colorB != lastColorB) {
// Color changed, flush previous poly // Color changed, flush previous poly
if (previousPoly) { if (previousPoly) {
dl.push_back(gsSPVertex((uintptr_t)&vtxDl.at(vtxDl.size() - 3), 3, 0)); dl.push_back(gsSPVertex((uintptr_t)&vtxDl.at(vtxDl.size() - 3), 3, 0));
dl.push_back(gsSP1Triangle(0, 1, 2, 0)); dl.push_back(gsSP1Triangle(0, 1, 2, 0));
previousPoly = false; previousPoly = false;
} }
dl.push_back(gsDPSetPrimColor(0, 0, (color >> 24) & 0xFF, (color >> 16) & 0xFF, (color >> 8) & 0xFF, dl.push_back(gsDPSetPrimColor(0, 0, colorR, colorG, colorB, colorA));
(color >> 0) & 0xFF));
} }
lastColor = color; lastColorR = colorR;
lastColorG = colorG;
lastColorB = colorB;
Vec3s* va = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)]; Vec3s* va = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)];
Vec3s* vb = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIB)]; Vec3s* vb = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIB)];
@ -450,7 +435,9 @@ void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
// Draws the scene // Draws the scene
void DrawSceneCollision() { void DrawSceneCollision() {
if (showSceneColSetting == ColRenderSetting::Disabled) { ColRenderSetting showSceneColSetting = (ColRenderSetting)CVar_GetS32("gColViewerScene", 0);
if (showSceneColSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) {
return; return;
} }
@ -463,7 +450,8 @@ void DrawSceneCollision() {
// Draws all Bg Actors // Draws all Bg Actors
void DrawBgActorCollision() { void DrawBgActorCollision() {
if (showBgActorSetting == ColRenderSetting::Disabled) { ColRenderSetting showBgActorSetting = (ColRenderSetting)CVar_GetS32("gColViewerBgActors", 0);
if (showBgActorSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) {
return; return;
} }
@ -489,7 +477,6 @@ void DrawBgActorCollision() {
dl.push_back(gsSPPopMatrix(G_MTX_MODELVIEW)); dl.push_back(gsSPPopMatrix(G_MTX_MODELVIEW));
} }
} }
} }
// Draws a quad // Draws a quad
@ -588,7 +575,8 @@ void DrawColCheckList(std::vector<Gfx>& dl, Collider** objects, int32_t count) {
// Draws all Col Check objects // Draws all Col Check objects
void DrawColCheckCollision() { void DrawColCheckCollision() {
if (showColCheckSetting == ColRenderSetting::Disabled) { ColRenderSetting showColCheckSetting = (ColRenderSetting)CVar_GetS32("gColViewerColCheck", 0);
if (showColCheckSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) {
return; return;
} }
@ -598,16 +586,15 @@ void DrawColCheckCollision() {
CollisionCheckContext& col = gGlobalCtx->colChkCtx; CollisionCheckContext& col = gGlobalCtx->colChkCtx;
dl.push_back(gsDPSetPrimColor(0, 0, (ocColor >> 24) & 0xFF, (ocColor >> 16) & 0xFF, (ocColor >> 8) & 0xFF, dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorOCR", 255), CVar_GetS32("gColViewerColorOCG", 255),
(ocColor >> 0) & 0xFF)); CVar_GetS32("gColViewerColorOCB", 255), 255));
DrawColCheckList(dl, col.colOC, col.colOCCount); DrawColCheckList(dl, col.colOC, col.colOCCount);
dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorACR", 0), CVar_GetS32("gColViewerColorACG", 0),
dl.push_back(gsDPSetPrimColor(0, 0, (acColor >> 24) & 0xFF, (acColor >> 16) & 0xFF, (acColor >> 8) & 0xFF, CVar_GetS32("gColViewerColorACB", 255), 255));
(acColor >> 0) & 0xFF));
DrawColCheckList(dl, col.colAC, col.colACCount); DrawColCheckList(dl, col.colAC, col.colACCount);
dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorATR", 255), CVar_GetS32("gColViewerColorATG", 0),
CVar_GetS32("gColViewerColorATB", 0), 255));
dl.push_back(gsDPSetPrimColor(0, 0, (atColor >> 24) & 0xFF, (atColor >> 16) & 0xFF, (atColor >> 8) & 0xFF,
(atColor >> 0) & 0xFF));
DrawColCheckList(dl, col.colAT, col.colATCount); DrawColCheckList(dl, col.colAT, col.colATCount);
} }
@ -641,15 +628,18 @@ extern "C" f32 zdWaterBoxMinY;
// Draws all waterboxes // Draws all waterboxes
void DrawWaterboxList() { void DrawWaterboxList() {
if (showWaterboxSetting == ColRenderSetting::Disabled) { ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVar_GetS32("gColViewerWaterbox", 0);
if (showWaterboxSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) {
return; return;
} }
std::vector<Gfx>& dl = (showWaterboxSetting == ColRenderSetting::Transparent) ? xluDl : opaDl; std::vector<Gfx>& dl = (showWaterboxSetting == ColRenderSetting::Transparent) ? xluDl : opaDl;
InitGfx(dl, showWaterboxSetting); InitGfx(dl, showWaterboxSetting);
dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH)); dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH));
dl.push_back(gsDPSetPrimColor(0, 0, (waterboxColor >> 24) & 0xFF, (waterboxColor >> 16) & 0xFF,
(waterboxColor >> 8) & 0xFF, (waterboxColor >> 0) & 0xFF)); dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorWaterboxR", 0),
CVar_GetS32("gColViewerColorWaterboxG", 0),
CVar_GetS32("gColViewerColorWaterboxB", 255), 255));
CollisionHeader* col = gGlobalCtx->colCtx.colHeader; CollisionHeader* col = gGlobalCtx->colCtx.colHeader;
for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) { for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) {
@ -664,8 +654,7 @@ void DrawWaterboxList() {
} }
// Resets a vector for the next frame and returns the capacity // Resets a vector for the next frame and returns the capacity
template<typename T> template <typename T> size_t ResetVector(T& vec) {
size_t ResetVector(T& vec) {
size_t oldSize = vec.size(); size_t oldSize = vec.size();
vec.clear(); vec.clear();
// Reserve slightly more space than last frame to account for variance (such as different amounts of bg actors) // Reserve slightly more space than last frame to account for variance (such as different amounts of bg actors)

View File

@ -7,6 +7,7 @@
#include <bit> #include <bit>
#include <map> #include <map>
#include <string> #include <string>
#include <Cvar.h>
extern "C" { extern "C" {
#include <z64.h> #include <z64.h>
@ -1544,6 +1545,7 @@ void DrawPlayerTab() {
void DrawSaveEditor(bool& open) { void DrawSaveEditor(bool& open) {
if (!open) { if (!open) {
CVar_SetS32("gSaveEditorEnabled", 0);
return; return;
} }

View File

@ -808,9 +808,11 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
{ {
uintptr_t i = (uintptr_t)(imgData); uintptr_t i = (uintptr_t)(imgData);
// if (i == 0xD9000000 || i == 0xE7000000 || (i & 1) == 1)
if ((i & 1) == 1) if ((i & 1) == 1)
return 0; return 0;
// if ((i & 0xFF000000) != 0xAB000000 && (i & 0xFF000000) != 0xCD000000 && i != 0) {
if (i != 0) { if (i != 0) {
if (imgData[0] == '_' && imgData[1] == '_' && imgData[2] == 'O' && imgData[3] == 'T' && imgData[4] == 'R' && if (imgData[0] == '_' && imgData[1] == '_' && imgData[2] == 'O' && imgData[3] == 'T' && imgData[4] == 'R' &&
imgData[5] == '_' && imgData[6] == '_') imgData[5] == '_' && imgData[6] == '_')

View File

@ -585,6 +585,8 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
AudioSeq_SequencePlayerDisable(seqPlayer); AudioSeq_SequencePlayerDisable(seqPlayer);
fontId = 0xFF; fontId = 0xFF;
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
numFonts = gAudioContext.sequenceFontTable[index++];
if (gUseLegacySD) { if (gUseLegacySD) {
index = ((u16*)gAudioContext.sequenceFontTable)[seqId]; index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
@ -917,7 +919,6 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
void** ptrs = (void**)mem; void** ptrs = (void**)mem;
#define BASE_OFFSET(x) (void*)((u32)(x) + (u32)(mem)) #define BASE_OFFSET(x) (void*)((u32)(x) + (u32)(mem))
reloc2 = ptrs[0]; reloc2 = ptrs[0];
@ -1495,6 +1496,7 @@ void AudioLoad_InitSlowLoads(void) {
s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) { s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
SoundFontSample* sample; SoundFontSample* sample;
AudioSlowLoad* slowLoad; AudioSlowLoad* slowLoad;
sample = AudioLoad_GetFontSample(fontId, instId); sample = AudioLoad_GetFontSample(fontId, instId);
if (sample == NULL) { if (sample == NULL) {
*isDone = 0; *isDone = 0;
@ -1654,15 +1656,12 @@ s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* isDone) {
} }
seqId = AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId); seqId = AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId);
seqTable = AudioLoad_GetLoadTable(SEQUENCE_TABLE); seqTable = AudioLoad_GetLoadTable(SEQUENCE_TABLE);
slowLoad = &gAudioContext.slowLoads[gAudioContext.slowLoadPos]; slowLoad = &gAudioContext.slowLoads[gAudioContext.slowLoadPos];
if (slowLoad->status == LOAD_STATUS_DONE) { if (slowLoad->status == LOAD_STATUS_DONE) {
slowLoad->status = LOAD_STATUS_WAITING; slowLoad->status = LOAD_STATUS_WAITING;
} }
slowLoad->sample.sampleAddr = NULL; slowLoad->sample.sampleAddr = NULL;
slowLoad->isDone = isDone; slowLoad->isDone = isDone;
@ -2075,7 +2074,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
if (preload->isFree == false) { if (preload->isFree == false) {
sample = preload->sample; sample = preload->sample;
key = sample->sampleAddr + sample->size + sample->medium; key = (u32)sample->sampleAddr + sample->size + sample->medium;
if (key == preload->endAndMediumKey) { if (key == preload->endAndMediumKey) {
// Change storage for sample to the preloaded version. // Change storage for sample to the preloaded version.
sample->sampleAddr = preload->ramAddr; sample->sampleAddr = preload->ramAddr;
@ -2098,12 +2097,12 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
sample = preload->sample; sample = preload->sample;
nChunks = (sample->size >> 12) + 1; nChunks = (sample->size >> 12) + 1;
key = sample->sampleAddr + sample->size + sample->medium; key = (u32)sample->sampleAddr + sample->size + sample->medium;
if (key != preload->endAndMediumKey) { if (key != preload->endAndMediumKey) {
preload->isFree = true; preload->isFree = true;
gAudioContext.preloadSampleStackTop--; gAudioContext.preloadSampleStackTop--;
} else { } else {
AudioLoad_StartAsyncLoad(sample->sampleAddr, preload->ramAddr, sample->size, sample->medium, AudioLoad_StartAsyncLoad((u32)sample->sampleAddr, preload->ramAddr, sample->size, sample->medium,
nChunks, &gAudioContext.preloadSampleQueue, preload->encodedInfo); nChunks, &gAudioContext.preloadSampleQueue, preload->encodedInfo);
break; break;
} }
@ -2251,7 +2250,6 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo
} }
sample = gAudioContext.usedSamples[i]; sample = gAudioContext.usedSamples[i];
if (sample->medium == MEDIUM_RAM) { if (sample->medium == MEDIUM_RAM) {
continue; continue;
} }

View File

@ -355,8 +355,6 @@ Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
return inst; return inst;
} }
return inst; return inst;
} }

View File

@ -360,7 +360,8 @@ s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
void Player_SetModelsForHoldingShield(Player* this) { void Player_SetModelsForHoldingShield(Player* this) {
if ((this->stateFlags1 & 0x400000) && if ((this->stateFlags1 & 0x400000) &&
((this->itemActionParam < 0) || (this->itemActionParam == this->heldItemActionParam))) { ((this->itemActionParam < 0) || (this->itemActionParam == this->heldItemActionParam))) {
if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) { if ((CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK) ||
!Player_HoldsTwoHandedWeapon(this)) && !Player_IsChildWithHylianShield(this)) {
this->rightHandType = 10; this->rightHandType = 10;
this->rightHandDLists = &sPlayerDListGroups[10][gSaveContext.linkAge]; this->rightHandDLists = &sPlayerDListGroups[10][gSaveContext.linkAge];
if (this->sheathType == 18) { if (this->sheathType == 18) {

View File

@ -110,7 +110,7 @@ void ElfMsg_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 ElfMsg_GetMessageId(ElfMsg* this) { s32 ElfMsg_GetMessageId(ElfMsg* this) {
// Negative message ID forces link to talk to Navi // Negative message ID forces link to talk to Navi
if (this->actor.params & 0x8000) { if (this->actor.params & 0x8000 || CVar_GetS32("gNoForcedNavi", 0) != 0) {
return (this->actor.params & 0xFF) + 0x100; return (this->actor.params & 0xFF) + 0x100;
} else { } else {
return -((this->actor.params & 0xFF) + 0x100); return -((this->actor.params & 0xFF) + 0x100);

View File

@ -9,6 +9,10 @@
#include "objects/object_tk/object_tk.h" #include "objects/object_tk/object_tk.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
#define COLLECTFLAG_GRAVEDIGGING_HEART_PIECE 0x19
#define ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE 0x1000
bool heartPieceSpawned;
void EnTk_Init(Actor* thisx, GlobalContext* globalCtx); void EnTk_Init(Actor* thisx, GlobalContext* globalCtx);
void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx);
@ -505,6 +509,7 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) {
this->currentReward = -1; this->currentReward = -1;
this->currentSpot = NULL; this->currentSpot = NULL;
this->actionFunc = EnTk_Rest; this->actionFunc = EnTk_Rest;
heartPieceSpawned = false;
} }
void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx) {
@ -611,13 +616,23 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) {
* Upgrade the purple rupee reward to the heart piece if this * Upgrade the purple rupee reward to the heart piece if this
* is the first grand prize dig. * is the first grand prize dig.
*/ */
if (!(gSaveContext.itemGetInf[1] & 0x1000)) { // If vanilla itemGetInf flag is not set, it's impossible for the new flag to be set, so return true.
gSaveContext.itemGetInf[1] |= 0x1000; // Otherwise if the gGravediggingTourFix is enabled and the new flag hasn't been set, return true.
// If true, spawn the heart piece and set the vanilla itemGetInf flag and new temp clear flag.
if (!heartPieceSpawned &&
(!(gSaveContext.itemGetInf[1] & ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE) ||
CVar_GetS32("gGravediggingTourFix", 0) &&
!Flags_GetCollectible(globalCtx, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE))) {
this->currentReward = 4; this->currentReward = 4;
gSaveContext.itemGetInf[1] |= ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE;
heartPieceSpawned = true;
} }
} }
Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]); EnItem00* reward = Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]);
if (this->currentReward == 4) {
reward->collectibleFlag = COLLECTFLAG_GRAVEDIGGING_HEART_PIECE;
}
} }
} }

View File

@ -2106,10 +2106,10 @@ LinkAnimationHeader* func_808346C4(GlobalContext* globalCtx, Player* this) {
func_808323B4(globalCtx, this); func_808323B4(globalCtx, this);
if (this->unk_870 < 0.5f) { if (this->unk_870 < 0.5f) {
return D_808543A4[Player_HoldsTwoHandedWeapon(this)]; return D_808543A4[Player_HoldsTwoHandedWeapon(this) && !(CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK))];
} }
else { else {
return D_808543AC[Player_HoldsTwoHandedWeapon(this)]; return D_808543AC[Player_HoldsTwoHandedWeapon(this) && !(CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK))];
} }
} }

View File

@ -1602,6 +1602,10 @@ void FileChoose_Main(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx; FileChooseContext* this = (FileChooseContext*)thisx;
Input* input = &this->state.input[0]; Input* input = &this->state.input[0];
if (CVar_GetS32("gTimeFlowFileSelect", 0) != 0) {
gSaveContext.skyboxTime += 0x10;
}
OPEN_DISPS(this->state.gfxCtx, "../z_file_choose.c", 2898); OPEN_DISPS(this->state.gfxCtx, "../z_file_choose.c", 2898);
this->n64ddFlag = 0; this->n64ddFlag = 0;