diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..fafae443d --- /dev/null +++ b/.gitignore @@ -0,0 +1,402 @@ +# Cache files +__pycache__/ +.pyc +.DS_Store + +# Text editor remnants +.vscode/ +.vs/ +.idea/ +CMakeLists.txt +cmake-build-debug +venv/ + +# Project-specific ignores +build/ +expected/ +notes/ +baserom/ +docs/doxygen/ +*.elf +*.sra +*.z64 +*.n64 +*.v64 +*.map +*.dump +out.txt + +# Tool artifacts +tools/mipspro7.2_compiler/ +tools/overlayhelpers/batchdisasm/output/* +tools/overlayhelpers/batchdisasm/output2/* +tools/overlayhelpers/batchdisasm/mipsdisasm/* +tools/disasm/output/* +tools/asmsplitter/asm/* +tools/asmsplitter/c/* +ctx.c +tools/*dSYM/ +graphs/ + +# Assets +*.png +*.jpg +*.mdli +*.anmi +*.obj +*.mtl +*.fbx +!*_custom* +.extracted-assets.json + +# Docs +!docs/tutorial/ + +# Per-user configuration +.python-version + + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +*.out +*.o +*.d +lib/libgfxd/libgfxd.a +ExporterTest/ExporterTest.a +ZAPDUtils/ZAPDUtils.a +.vscode/ +build/ +ZAPDUtils/build/ +ZAPD/BuildInfo.h + +DebugObj/* +ReleaseObj/* \ No newline at end of file diff --git a/OTRExporter/OTRExporter/DisplayListExporter.cpp b/OTRExporter/OTRExporter/DisplayListExporter.cpp index dafa8eb72..4e68d8f13 100644 --- a/OTRExporter/OTRExporter/DisplayListExporter.cpp +++ b/OTRExporter/OTRExporter/DisplayListExporter.cpp @@ -667,7 +667,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina { int sss = (data & 0x00FFF00000000000) >> 44; int ttt = (data & 0x00000FFF00000000) >> 32; - int i = (data & 0x000000000F000000) >> 16; + int i = (data & 0x000000000F000000) >> 24; int uuu = (data & 0x0000000000FFF000) >> 12; int vvv= (data & 0x0000000000000FFF); diff --git a/OTRExporter/extract_assets.py b/OTRExporter/extract_assets.py index bb9ed177c..f15cb1beb 100755 --- a/OTRExporter/extract_assets.py +++ b/OTRExporter/extract_assets.py @@ -1,14 +1,51 @@ #!/usr/bin/env python3 -import argparse, json, os, signal, time, sys, shutil +# How to use: +# Place a rom in this directory then run the script. +# If you are using multiple roms, the script will let you choose one. +# To choose with a commandline argument: +# Python3 extract_assets.py +# Invalid input results in the first rom being selected + +import json, os, signal, time, sys, shutil, glob from multiprocessing import Pool, cpu_count, Event, Manager, ProcessError +from enum import Enum import shutil -def BuildOTR(xmlPath): +romVer = "..\\soh\\baserom_non_mq.z64" +roms = []; +checksums = ["", "", ""]; + +class Checksums(Enum): + OOT_NTSC_10 = "EC7011B7" + OOT_NTSC_11 = "D43DA81F" + OOT_NTSC_12 = "693BA2AE" + OOT_PAL_10 = "B044B569" + OOT_PAL_11 = "B2055FBD" + OOT_NTSC_JP_GC_CE = "F7F52DB8" + OOT_NTSC_JP_GC = "F611F4BA" + OOT_NTSC_US_GC = "F3DD35BA" + OOT_PAL_GC = "09465AC3" + OOT_NTSC_JP_MQ = "F43B45BA" + OOT_NTSC_US_MQ = "F034001A" + OOT_PAL_MQ = "1D4136F3" + OOT_PAL_GC_DBG1 = "871E1C92" + OOT_PAL_GC_DBG2 = "87121EFE" + OOT_PAL_GC_MQ_DBG = "917D18F6" + OOT_IQUE_TW = "3D81FB3E" + OOT_IQUE_CN = "B1E1E07B" + OOT_UNKNOWN = "FFFFFFFF" + +CompatibleChecksums = [ + Checksums.OOT_PAL_GC, + Checksums.OOT_PAL_GC_DBG1 +] + +def BuildOTR(xmlPath, rom): shutil.copytree("assets", "Extract/assets") - execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPD/ZAPD.out" - execStr += " ed -i %s -b baserom.z64 -fl CFG\\filelists -o placeholder -osf placeholder -gsf 1 -rconf CFG/Config.xml -se OTR" % (xmlPath) + execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPD/ZAPD.out" + execStr += " ed -i %s -b %s -fl CFG\\filelists -o placeholder -osf placeholder -gsf 1 -rconf CFG/Config.xml -se OTR" % (xmlPath, rom) print(execStr) exitValue = os.system(execStr) @@ -18,23 +55,95 @@ def BuildOTR(xmlPath): print("Aborting...", file=os.sys.stderr) print("\n") -def main(): - parser = argparse.ArgumentParser(description="baserom asset extractor") - parser.add_argument("-v", "--version", help="Sets game version.") - args = parser.parse_args() +def checkChecksum(rom): + r = open(rom, "rb") + r.seek(16) + bytes = r.read(4).hex().upper() + r.close() - # TODO: Read from makerom file to automatically determine game version - xmlVer = "GC_NMQ_D" + for checksum in Checksums: + if (checksum.value == bytes): + + for compat in CompatibleChecksums: + if (checksum.name == compat.name): + print("Compatible rom found!") + return checksum + print("Valid oot rom found. However, not compatible with SoH.") + print("Compatible roms:") + for compat in CompatibleChecksums: + print(compat.name+" | 0x"+compat.value) + sys.exit(1) + + print("Wrong rom! No valid checksum found") + sys.exit(1) - if (args.version == "gc_pal_nmpq"): - xmlVer = "GC_NMQ_PAL_F" - elif (args.version == "dbg_mq"): - xmlVer = "GC_MQ_D" +def main(): + + romToUse = ""; + + for file in glob.glob("*.z64"): + roms.append(file) + + if not (roms): + print("Error: No roms located, place one in the OTRExporter directory", file=os.sys.stderr) + sys.exit(1) + + if (len(roms) > 1): + + # If commandline args exist + if (len(sys.argv) > 1): + try: + if ((int(sys.argv[1]) - 1) < 1): + romToUse = roms[0] + + elif ((int(sys.argv[1]) - 1) > len(roms)): + romToUse = roms[len(roms) - 1] + + else: + romToUse = roms[int(sys.argv[1]) - 1] + except: + romToUse = roms[0] + + # No commandline args, select rom using user input + else: + + print(str(len(roms))+" roms found, please select one by pressing 1-"+str(len(roms))) + + count = 1 + for list in range(len(roms)): + print(str(count)+". "+roms[list]) + count += 1 + + while(1): + try: + selection = int(input()) + except: + print("Bad input. Try again with the number keys.") + continue + + if (selection < 1 or selection > len(roms)): + print("Bad input. Try again.") + continue + + else: break + + romToUse = roms[selection - 1] + + else: + romToUse = roms[0] + + match checkChecksum(romToUse).name: + case Checksums.OOT_PAL_GC: + xmlVer = "GC_NMQ_PAL_F" + case Checksums.OOT_PAL_GC_DBG1: + xmlVer = "GC_MQ_D" + case _: # default case + xmlVer = "GC_NMQ_D" if (os.path.exists("Extract")): shutil.rmtree("Extract") - BuildOTR("..\\soh\\assets\\xml\\" + xmlVer + "\\") + BuildOTR("..\\soh\\assets\\xml\\" + xmlVer + "\\", romToUse) if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/README.md b/README.md index a002eee8a..e9e7b9070 100644 --- a/README.md +++ b/README.md @@ -55,20 +55,22 @@ Official Discord: https://discord.com/invite/BtBmd55HVH 2. Install [Visual Studio 2022 Community Edition](https://visualstudio.microsoft.com/vs/community/) 2b. In the Visual Studio Installer, install `MSVC v142 - VS 2019 C++`. 4. Clone the Ship of Harkinian repository. - 5. Place `oot debug` rom (not Master Quest) in the `soh` folder named `baserom_original_non_mq`. - 6. Launch `soh/fixbaserom.py`. - 7. Launch `soh/extract_baserom.py`. - 8. Copy the `baserom` folder from the `soh` folder into the `OTRExporter` folder. - 9. Run `OTRExporter/OTRExporter.sln`. - 10. Switch the solution to `Release x64`. - 11. Build the solution. - 12. Launching `OTRExporter/extract_assets.py` will generate an `oot.otr` archive file in `OTRExporter/oot.otr`. - 13. Run `soh/soh.sln` - 14. Switch the solution to `Release x86`. - 15. Build the solution. - 16. Copy the `OTRExporter/oot.otr` archive file to `soh/Release`. - 17. Launch `soh.exe`. + 5. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice. + 6. Run `OTRExporter/OTRExporter.sln`. + 7. Switch the solution to `Release x64`. + 8. Build the solution. + 9. Launching `OTRExporter/extract_assets.py` will generate an `oot.otr` archive file in `OTRExporter/oot.otr`. + 10. Run `soh/soh.sln` + 11. Switch the solution to `Release x86`. + 12. Build the solution. + 13. Copy the `OTRExporter/oot.otr` archive file to `soh/Release`. + 14. Launch `soh.exe`. +## Compatible Roms +``` +OOT_PAL_GC checksum 0x09465AC3 +OOT_PAL_GC_DBG1 checksum 0x871E1C92 (debug non-master quest) +``` ## Troubleshooting The Exporter - Affirm that you have an `/assets` folder filled with XMLs in the same directory as OTRGui.exe - Affirm that `zapd.exe` exists in the `/assets/extractor` folder diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index c12922047..c056dec71 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -49,8 +49,11 @@ namespace Game { Settings.debug.n64mode = stob(Conf[ConfSection]["n64_mode"]); // Enhancements - Settings.enhancements.fast_text = stob(Conf[EnhancementSection]["fast_text"]); - CVar_SetS32("gFastText", Settings.enhancements.fast_text); + Settings.enhancements.skip_text = stob(Conf[EnhancementSection]["skip_text"]); + CVar_SetS32("gSkipText", Settings.enhancements.skip_text); + + Settings.enhancements.text_speed = Ship::stoi(Conf[EnhancementSection]["text_speed"]); + CVar_SetS32("gTextSpeed", Settings.enhancements.text_speed); Settings.enhancements.disable_lod = stob(Conf[EnhancementSection]["disable_lod"]); CVar_SetS32("gDisableLOD", Settings.enhancements.disable_lod); @@ -58,9 +61,15 @@ namespace Game { Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]); CVar_SetS32("gPauseLiveLink", Settings.enhancements.animated_pause_menu); + Settings.enhancements.dynamic_wallet_icon = stob(Conf[EnhancementSection]["dynamic_wallet_icon"]); + CVar_SetS32(const_cast("gDynamicWalletIcon"), Settings.enhancements.dynamic_wallet_icon); + Settings.enhancements.minimal_ui = stob(Conf[EnhancementSection]["minimal_ui"]); CVar_SetS32("gMinimalUI", Settings.enhancements.minimal_ui); + Settings.enhancements.visualagony = stob(Conf[EnhancementSection]["visualagony"]); + CVar_SetS32("gVisualAgony", Settings.enhancements.visualagony); + Settings.enhancements.mm_bunny_hood = stob(Conf[EnhancementSection]["mm_bunny_hood"]); CVar_SetS32("gMMBunnyHood", Settings.enhancements.mm_bunny_hood); @@ -121,6 +130,9 @@ namespace Game { Settings.cheats.infinite_magic = stob(Conf[CheatSection]["infinite_magic"]); CVar_SetS32("gInfiniteMagic", Settings.cheats.infinite_magic); + Settings.cheats.infinite_nayru = stob(Conf[CheatSection]["infinite_nayru"]); + CVar_SetS32("gInfiniteNayru", Settings.cheats.infinite_nayru); + Settings.cheats.no_clip = stob(Conf[CheatSection]["no_clip"]); CVar_SetS32("gNoClip", Settings.cheats.no_clip); @@ -133,6 +145,15 @@ namespace Game { Settings.cheats.super_tunic = stob(Conf[CheatSection]["super_tunic"]); CVar_SetS32("gSuperTunic", Settings.cheats.super_tunic); + Settings.cheats.ez_isg = stob(Conf[CheatSection]["ez_isg"]); + CVar_SetS32("gEzISG", Settings.cheats.ez_isg); + + Settings.cheats.no_restrict_item = stob(Conf[CheatSection]["no_restrict_item"]); + CVar_SetS32("gNoRestrictItems", Settings.cheats.no_restrict_item); + + Settings.cheats.freeze_time = stob(Conf[CheatSection]["freeze_time"]); + CVar_SetS32("gFreezeTime", Settings.cheats.freeze_time); + UpdateAudio(); } @@ -154,11 +175,14 @@ namespace Game { Conf[AudioSection]["fanfare"] = std::to_string(Settings.audio.fanfare); // Enhancements - Conf[EnhancementSection]["fast_text"] = std::to_string(Settings.enhancements.fast_text); + Conf[EnhancementSection]["skip_text"] = std::to_string(Settings.enhancements.skip_text); + Conf[EnhancementSection]["text_speed"] = std::to_string(Settings.enhancements.text_speed); Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod); Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu); + Conf[EnhancementSection]["dynamic_wallet_icon"] = std::to_string(Settings.enhancements.dynamic_wallet_icon); Conf[EnhancementSection]["minimal_ui"] = std::to_string(Settings.enhancements.minimal_ui); Conf[EnhancementSection]["newdrops"] = std::to_string(Settings.enhancements.newdrops); + Conf[EnhancementSection]["visualagony"] = std::to_string(Settings.enhancements.visualagony); Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood); diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h index 2a2d481b6..990132f4e 100644 --- a/libultraship/libultraship/GameSettings.h +++ b/libultraship/libultraship/GameSettings.h @@ -20,12 +20,16 @@ struct SoHConfigType { // Enhancements struct { - bool fast_text = false; + int text_speed = 1; + bool skip_text = false; bool disable_lod = false; bool animated_pause_menu = false; + bool dynamic_wallet_icon = false; bool minimal_ui = false; bool newdrops = false; + bool visualagony = false; bool mm_bunny_hood = false; + } enhancements; // Controller @@ -48,10 +52,14 @@ struct SoHConfigType { bool infinite_health = false; bool infinite_ammo = false; bool infinite_magic = false; + bool infinite_nayru = false; bool no_clip = false; bool climb_everything = false; bool moon_jump_on_l = false; bool super_tunic = false; + bool ez_isg = false; + bool no_restrict_item = false; + bool freeze_time = false; } cheats; // Graphics diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp index 5373f8799..e19e9538c 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp @@ -646,7 +646,7 @@ static int gfx_opengl_create_framebuffer() { framebuffers[i].clrbuf_msaa = clrbuf_msaa; framebuffers[i].rbo = rbo; - return fbo; + return i; } static void gfx_opengl_update_framebuffer_parameters(int fb_id, uint32_t width, uint32_t height, uint32_t msaa_level, bool opengl_invert_y, bool render_target, bool has_depth_buffer, bool can_extract_depth) { diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 7ace95e72..72a44162e 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -395,8 +395,14 @@ namespace SohImGui { ImGui::Text("Gameplay"); ImGui::Separator(); - if (ImGui::Checkbox("Fast Text", &Game::Settings.enhancements.fast_text)) { - CVar_SetS32("gFastText", Game::Settings.enhancements.fast_text); + ImGui::Text("Text Speed", Game::Settings.enhancements.text_speed); + if (ImGui::SliderInt("##TEXTSPEED", &Game::Settings.enhancements.text_speed, 1, 5)) { + CVar_SetS32("gTextSpeed", Game::Settings.enhancements.text_speed); + needs_save = true; + } + + if (ImGui::Checkbox("Skip Text", &Game::Settings.enhancements.skip_text)) { + CVar_SetS32("gSkipText", Game::Settings.enhancements.skip_text); needs_save = true; } @@ -429,6 +435,12 @@ namespace SohImGui { CVar_SetS32("gNewDrops", Game::Settings.enhancements.newdrops); needs_save = true; } + + if (ImGui::Checkbox("Dynamic Wallet Icon", &Game::Settings.enhancements.dynamic_wallet_icon)) { + CVar_SetS32(const_cast("gDynamicWalletIcon"), Game::Settings.enhancements.dynamic_wallet_icon); + + needs_save = true; + } ImGui::EndMenu(); } @@ -454,24 +466,33 @@ namespace SohImGui { } if (ImGui::BeginMenu("Cheats")) { - if (ImGui::Checkbox("Infinite Money", &Game::Settings.cheats.infinite_money)) { - CVar_SetS32("gInfiniteMoney", Game::Settings.cheats.infinite_money); - needs_save = true; - } + if (ImGui::BeginMenu("Infinite...")) { + if (ImGui::Checkbox("Money", &Game::Settings.cheats.infinite_money)) { + CVar_SetS32("gInfiniteMoney", Game::Settings.cheats.infinite_money); + needs_save = true; + } - if (ImGui::Checkbox("Infinite Health", &Game::Settings.cheats.infinite_health)) { - CVar_SetS32("gInfiniteHealth", Game::Settings.cheats.infinite_health); - needs_save = true; - } + if (ImGui::Checkbox("Health", &Game::Settings.cheats.infinite_health)) { + CVar_SetS32("gInfiniteHealth", Game::Settings.cheats.infinite_health); + needs_save = true; + } - if (ImGui::Checkbox("Infinite Ammo", &Game::Settings.cheats.infinite_ammo)) { - CVar_SetS32("gInfiniteAmmo", Game::Settings.cheats.infinite_ammo); - needs_save = true; - } + if (ImGui::Checkbox("Ammo", &Game::Settings.cheats.infinite_ammo)) { + CVar_SetS32("gInfiniteAmmo", Game::Settings.cheats.infinite_ammo); + needs_save = true; + } - if (ImGui::Checkbox("Infinite Magic", &Game::Settings.cheats.infinite_magic)) { - CVar_SetS32("gInfiniteMagic", Game::Settings.cheats.infinite_magic); - needs_save = true; + if (ImGui::Checkbox("Magic", &Game::Settings.cheats.infinite_magic)) { + CVar_SetS32("gInfiniteMagic", Game::Settings.cheats.infinite_magic); + needs_save = true; + } + + if (ImGui::Checkbox("Nayru's Love", &Game::Settings.cheats.infinite_nayru)) { + CVar_SetS32("gInfiniteNayru", Game::Settings.cheats.infinite_nayru); + needs_save = true; + } + + ImGui::EndMenu(); } if (ImGui::Checkbox("No Clip", &Game::Settings.cheats.no_clip)) { @@ -494,6 +515,21 @@ namespace SohImGui { needs_save = true; } + if (ImGui::Checkbox("Easy ISG", &Game::Settings.cheats.ez_isg)) { + CVar_SetS32("gEzISG", Game::Settings.cheats.ez_isg); + needs_save = true; + } + + if (ImGui::Checkbox("Unrestricted Items", &Game::Settings.cheats.no_restrict_item)) { + CVar_SetS32("gNoRestrictItems", Game::Settings.cheats.no_restrict_item); + needs_save = true; + } + + if (ImGui::Checkbox("Freeze Time", &Game::Settings.cheats.freeze_time)) { + CVar_SetS32("gFreezeTime", Game::Settings.cheats.freeze_time); + needs_save = true; + } + ImGui::EndMenu(); } diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index 28942b47d..f3ad9aaac 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -26,6 +26,8 @@ void BootCommands_Init() CVar_RegisterS32("gPauseLiveLink", 0); CVar_RegisterS32("gMinimalUI", 0); CVar_RegisterS32("gNewDrops", 0); + CVar_RegisterS32("gVisualAgony", 0); + } //void BootCommands_ParseBootArgs(char* str) diff --git a/soh/src/code/game.c b/soh/src/code/game.c index 9392cbc25..b69537fd8 100644 --- a/soh/src/code/game.c +++ b/soh/src/code/game.c @@ -381,6 +381,11 @@ void GameState_Update(GameState* gameState) { gSaveContext.magic = (gSaveContext.doubleMagic + 1) * 0x30; } } + + // Inf Nayru's Love Timer + if (CVar_GetS32("gInfiniteNayru", 0) != 0) { + gSaveContext.nayrusLoveTimer = 0x44B; + } // Moon Jump On L if (CVar_GetS32("gMoonJumpOnL", 0) != 0) { @@ -393,6 +398,32 @@ void GameState_Update(GameState* gameState) { } } + // Permanent infinite sword glitch (ISG) + if (CVar_GetS32("gEzISG", 0) != 0) { + if (gGlobalCtx) { + Player* player = GET_PLAYER(gGlobalCtx); + player->swordState = 1; + } + } + + // Unrestricted Items + if (CVar_GetS32("gNoRestrictItems", 0) != 0) { + if (gGlobalCtx) { + memset(&gGlobalCtx->interfaceCtx.restrictions, 0, sizeof(gGlobalCtx->interfaceCtx.restrictions)); + } + } + + // Freeze Time + if (CVar_GetS32("gFreezeTime", 0) != 0) { + if (CVar_GetS32("gPrevTime", -1) == -1) { + CVar_SetS32("gPrevTime", gSaveContext.dayTime); + } + + int32_t prevTime = CVar_GetS32("gPrevTime", gSaveContext.dayTime); + gSaveContext.dayTime = prevTime; + } + + gameState->frames++; } diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 43b0fcc12..a767ede79 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -166,7 +166,7 @@ void Message_UpdateOcarinaGame(GlobalContext* globalCtx) { u8 Message_ShouldAdvance(GlobalContext* globalCtx) { Input* input = &globalCtx->state.input[0]; - bool isB_Held = CVar_GetS32("gFastText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) + bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) : CHECK_BTN_ALL(input->press.button, BTN_B); if (CHECK_BTN_ALL(input->press.button, BTN_A) || isB_Held || CHECK_BTN_ALL(input->press.button, BTN_CUP)) { @@ -178,7 +178,7 @@ u8 Message_ShouldAdvance(GlobalContext* globalCtx) { u8 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) { Input* input = &globalCtx->state.input[0]; - bool isB_Held = CVar_GetS32("gFastText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) + bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) : CHECK_BTN_ALL(input->press.button, BTN_B); return CHECK_BTN_ALL(input->press.button, BTN_A) || isB_Held || CHECK_BTN_ALL(input->press.button, BTN_CUP); @@ -951,7 +951,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { } } i = j - 1; - msgCtx->textDrawPos = i + 1; + msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1); if (character) {} } @@ -1061,7 +1061,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { msgCtx->textDelay = msgCtx->msgBufDecoded[++i]; break; case MESSAGE_UNSKIPPABLE: - msgCtx->textUnskippable = CVar_GetS32("gFastText", 0) != 1; + msgCtx->textUnskippable = CVar_GetS32("gSkipText", 0) != 1; break; case MESSAGE_TWO_CHOICE: msgCtx->textboxEndType = TEXTBOX_ENDTYPE_2_CHOICE; @@ -1144,7 +1144,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { } } if (msgCtx->textDelayTimer == 0) { - msgCtx->textDrawPos = i + 1; + msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1); msgCtx->textDelayTimer = msgCtx->textDelay; } else { msgCtx->textDelayTimer--; @@ -2026,7 +2026,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - bool isB_Held = CVar_GetS32("gFastText", 0) != 0 ? CHECK_BTN_ALL(globalCtx->state.input[0].cur.button, BTN_B) + bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(globalCtx->state.input[0].cur.button, BTN_B) : CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B); switch (msgCtx->msgMode) { @@ -3067,7 +3067,7 @@ void Message_Update(GlobalContext* globalCtx) { return; } - bool isB_Held = CVar_GetS32("gFastText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) && !sTextboxSkipped + bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) && !sTextboxSkipped : CHECK_BTN_ALL(input->press.button, BTN_B); switch (msgCtx->msgMode) { diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index dc96ba133..edc4348b9 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -3129,6 +3129,14 @@ void Interface_Draw(GlobalContext* globalCtx) { }; static s16 rupeeDigitsFirst[] = { 1, 0, 0 }; static s16 rupeeDigitsCount[] = { 2, 3, 3 }; + + // courtesy of https://github.com/TestRunnerSRL/OoT-Randomizer/blob/Dev/ASM/c/hud_colors.c + static s16 rupeeWalletColors[3][3] = { + { 0xC8, 0xFF, 0x64 }, // Base Wallet (Green) + { 0x82, 0x82, 0xFF }, // Adult's Wallet (Blue) + { 0xFF, 0x64, 0x64 }, // Giant's Wallet (Red) + }; + static s16 spoilingItemEntrances[] = { 0x01AD, 0x0153, 0x0153 }; static f32 D_80125B54[] = { -40.0f, -35.0f }; // unused static s16 D_80125B5C[] = { 91, 91 }; // unused @@ -3171,7 +3179,15 @@ void Interface_Draw(GlobalContext* globalCtx) { if (fullUi) { // Rupee Icon - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha); + s16* rColor; + + if (CVar_GetS32("gDynamicWalletIcon", 0)) { + rColor = &rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)]; + } else { + rColor = &rupeeWalletColors[0]; + } + + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, rColor[0], rColor[1], rColor[2], interfaceCtx->magicAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 80, 0, 255); OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, OTRGetRectDimensionFromLeftEdge(26), 206, 16, 16, 1 << 10, 1 << 10); @@ -3269,7 +3285,7 @@ void Interface_Draw(GlobalContext* globalCtx) { Gfx_TextureI8(OVERLAY_DISP, ((u8*)digitTextures[interfaceCtx->counterDigits[svar2]]), 8, 16, OTRGetRectDimensionFromLeftEdge(svar3), 206, 8, 16, 1 << 10, 1 << 10); } - } + } else { // Make sure item counts have black backgrounds gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->magicAlpha); diff --git a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index 91c059bee..54b93277c 100644 --- a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -496,7 +496,7 @@ void EnExItem_DrawMagic(EnExItem* this, GlobalContext* globalCtx, s16 magicIndex } void EnExItem_DrawKey(EnExItem* this, GlobalContext* globalCtx, s32 index) { - static s32 keySegments[] = { 0x0403F140 }; + static void* keySegments[] = { gDropKeySmallTex }; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ex_item.c", 880); diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 734ba015e..aa11b6d7e 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -19,6 +19,7 @@ #include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_link_child/object_link_child.h" +#include "textures/icon_item_24_static/icon_item_24_static.h" typedef struct { /* 0x00 */ u8 itemId; @@ -10265,7 +10266,7 @@ void func_80848C74(GlobalContext* globalCtx, Player* this) { } } -void func_80848EF8(Player* this) { +void func_80848EF8(Player* this, GlobalContext* globalCtx) { if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)) { f32 temp = 200000.0f - (this->unk_6A4 * 5.0f); @@ -10274,8 +10275,45 @@ void func_80848EF8(Player* this) { } this->unk_6A0 += temp; + + /*Prevent it on horse, while jumping and on title screen. + If you fly around no stone of agony for you! */ + if (CVar_GetS32("gVisualAgony", 0) !=0 && !this->stateFlags1) { + int rectLeft = OTRGetRectDimensionFromLeftEdge(26); //Left X Pos + int rectTop = 60; //Top Y Pos + int rectWidth = 24; //Texture Width + int rectHeight = 24; //Texture Heigh + int DefaultIconA= 50; //Default icon alphe (55 on 255) + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 2824); + gDPPipeSync(OVERLAY_DISP++); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + if (this->unk_6A0 > 4000000.0f) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); + } else { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA); + } + if (temp == 0 || temp <= 0.1f) { + /*Fail check, it is used to draw off the icon when + link is standing out range but do not refresh unk_6A0. + Also used to make a default value in my case.*/ + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA); + } + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); + gDPSetOtherMode(OVERLAY_DISP++, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_IA16 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); + gDPLoadTextureBlock(OVERLAY_DISP++, gStoneOfAgonyIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gDPSetOtherMode(OVERLAY_DISP++, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_IA16 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); + gSPWideTextureRectangle(OVERLAY_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 3500); + } + if (this->unk_6A0 > 4000000.0f) { this->unk_6A0 = 0.0f; + if (CVar_GetS32("gVisualAgony", 0) !=0 && !this->stateFlags1) { + //This audio is placed here and not in previous CVar check to prevent ears ra.. :) + Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_WOMAN, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E0); + } func_8083264C(this, 120, 20, 10, 0); } } @@ -10547,7 +10585,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { else { this->fallStartHeight = this->actor.world.pos.y; } - func_80848EF8(this); + func_80848EF8(this, globalCtx); } } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 52019dcb2..2003a8b14 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -595,7 +595,6 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gSPInvalidateTexCache(POLY_KAL_DISP++, pauseCtx->iconItemSegment); //gSPInvalidateTexCache(POLY_KAL_DISP++, pauseCtx->iconItem24Segment); gSPInvalidateTexCache(POLY_KAL_DISP++, pauseCtx->nameSegment); - gSPInvalidateTexCache(POLY_KAL_DISP++, globalCtx->interfaceCtx.mapSegment); //gSPSegment(POLY_KAL_DISP++, 0x07, pauseCtx->playerSegment); gSPSegment(POLY_KAL_DISP++, 0x08, pauseCtx->iconItemSegment); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c index 022fdd41d..bd5277286 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c @@ -332,6 +332,10 @@ void KaleidoScope_DrawDungeonMap(GlobalContext* globalCtx, GraphicsContext* gfxC gSPVertex(POLY_KAL_DISP++, &pauseCtx->mapPageVtx[60], 8, 0); + // The dungeon map textures are recreated each frame, so always invalidate them + gSPInvalidateTexCache(POLY_KAL_DISP++, interfaceCtx->mapSegment); + gSPInvalidateTexCache(POLY_KAL_DISP++, interfaceCtx->mapSegment + 0x800); + gDPLoadTextureBlock_4b(POLY_KAL_DISP++, interfaceCtx->mapSegment, G_IM_FMT_CI, 48, 85, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);