├── .clang-format ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── banner.raw ├── format.sh ├── icon.raw ├── include ├── HUDConsole.h ├── array.h ├── chestRando.h ├── controller.h ├── customChecks.h ├── customMessage.h ├── defines.h ├── eventListener.h ├── game_patches.h ├── gc │ ├── OSCache.h │ ├── OSModule.h │ └── bmgres.h ├── global.h ├── grottoChecks.h ├── item.h ├── itemChecks.h ├── items.h ├── keyPlacement.h ├── memory.h ├── mod.h ├── musicRando.h ├── patch.h ├── singleton.h ├── stage.h ├── systemConsole.h ├── tools.h ├── tp.eu.lst ├── tp.jp.lst ├── tp.us.lst └── tp │ ├── DynamicLink.h │ ├── JFWSystem.h │ ├── JKRExpHeap.h │ ├── Z2SceneMgr.h │ ├── Z2SeqMgr.h │ ├── control.h │ ├── d_a_alink.h │ ├── d_a_shop_item_static.h │ ├── d_com_inf_game.h │ ├── d_item.h │ ├── d_item_data.h │ ├── d_kankyo.h │ ├── d_map_path_dmap.h │ ├── d_menu_collect.h │ ├── d_meter2_info.h │ ├── d_msg_class.h │ ├── d_msg_flow.h │ ├── d_save.h │ ├── d_stage.h │ ├── dzx.h │ ├── evt_control.h │ ├── f_ap_game.h │ ├── f_op_actor_mng.h │ ├── f_op_scene_req.h │ ├── m_Do_controller_pad.h │ ├── m_Do_ext.h │ ├── processor.h │ └── resource.h └── source ├── HUDConsole.cpp ├── array.cpp ├── chestRando.cpp ├── controller.cpp ├── cxx.cpp ├── cxx.ld ├── eventListener.cpp ├── game_patches.cpp ├── grottoChecks.cpp ├── item.cpp ├── itemChecks.cpp ├── keyPlacement.cpp ├── memory.cpp ├── mod.cpp ├── musicRando.cpp ├── patch.cpp ├── rel.cpp ├── runtime ├── restfpr_x.s └── restgpr_x.s ├── singleton.cpp ├── stage.cpp ├── systemConsole.cpp └── tools.cpp /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Chromium 3 | AlignEscapedNewlines: Left 4 | AlignOperands: 'true' 5 | AlignTrailingComments: 'true' 6 | AllowAllArgumentsOnNextLine: 'false' 7 | AllowAllParametersOfDeclarationOnNextLine: 'false' 8 | AllowShortIfStatementsOnASingleLine: Never 9 | AlwaysBreakTemplateDeclarations: 'Yes' 10 | BinPackArguments: 'false' 11 | BinPackParameters: 'false' 12 | BreakBeforeBraces: Allman 13 | BreakBeforeTernaryOperators: 'true' 14 | BreakConstructorInitializers: AfterColon 15 | BreakInheritanceList: AfterColon 16 | ColumnLimit: '128' 17 | CompactNamespaces: 'false' 18 | Cpp11BracedListStyle: 'true' 19 | FixNamespaceComments: 'true' 20 | IncludeBlocks: Regroup 21 | IndentWidth: '4' 22 | IndentWrappedFunctionNames: 'true' 23 | Language: Cpp 24 | NamespaceIndentation: All 25 | PointerAlignment: Left 26 | SortIncludes: 'true' 27 | SortUsingDeclarations: 'true' 28 | SpaceAfterCStyleCast: 'true' 29 | SpaceAfterLogicalNot: 'false' 30 | SpaceAfterTemplateKeyword: 'false' 31 | SpaceBeforeAssignmentOperators: 'true' 32 | SpaceBeforeCpp11BracedList: 'true' 33 | SpaceBeforeCtorInitializerColon: 'false' 34 | SpaceBeforeInheritanceColon: 'false' 35 | SpaceBeforeParens: ControlStatements 36 | SpaceBeforeRangeBasedForLoopColon: 'true' 37 | SpaceInEmptyParentheses: 'false' 38 | SpacesBeforeTrailingComments: '5' 39 | SpacesInAngles: 'false' 40 | SpacesInCStyleCastParentheses: 'false' 41 | SpacesInContainerLiterals: 'true' 42 | SpacesInParentheses: 'true' 43 | TabWidth: '4' 44 | UseTab: Never 45 | 46 | ... 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.elf 2 | *.rel 3 | *.gci 4 | *.bak 5 | 6 | create.sh 7 | gcipack.py 8 | 9 | .vscode/ 10 | build.*/ -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | # Clear the implicit built in rules 3 | #--------------------------------------------------------------------------------- 4 | .SUFFIXES: 5 | #--------------------------------------------------------------------------------- 6 | ifeq ($(strip $(DEVKITPPC)),) 7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") 8 | endif 9 | 10 | include $(DEVKITPPC)/gamecube_rules 11 | 12 | export ELF2REL := elf2rel 13 | export GCIPACK := gcipack 14 | 15 | ifeq ($(VERSION),) 16 | all: us jp eu 17 | us: 18 | @$(MAKE) --no-print-directory VERSION=us 19 | jp: 20 | @$(MAKE) --no-print-directory VERSION=jp 21 | eu: 22 | @$(MAKE) --no-print-directory VERSION=eu 23 | 24 | clean: 25 | @$(MAKE) --no-print-directory clean_target VERSION=us 26 | @$(MAKE) --no-print-directory clean_target VERSION=eu 27 | @$(MAKE) --no-print-directory clean_target VERSION=jp 28 | 29 | .PHONY: all clean us jp eu 30 | else 31 | 32 | #--------------------------------------------------------------------------------- 33 | # TARGET is the name of the output 34 | # BUILD is the directory where object files & intermediate files will be placed 35 | # SOURCES is a list of directories containing source code 36 | # INCLUDES is a list of directories containing extra header files 37 | #--------------------------------------------------------------------------------- 38 | TARGET := $(notdir $(CURDIR)).$(VERSION) 39 | BUILD := build.$(VERSION) 40 | SOURCES := source $(wildcard source/*) 41 | DATA := data 42 | INCLUDES := include 43 | 44 | #--------------------------------------------------------------------------------- 45 | # options for code generation 46 | #--------------------------------------------------------------------------------- 47 | 48 | MACHDEP = -mno-sdata -mgcn -DGEKKO -mcpu=750 -meabi -mhard-float 49 | 50 | CFLAGS = -nostdlib -ffreestanding -ffunction-sections -fdata-sections -g -Os -Wall -Werror -Wno-address-of-packed-member $(MACHDEP) $(INCLUDE) 51 | CXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++17 $(CFLAGS) 52 | 53 | LDFLAGS = -r -e _prolog -u _prolog -u _epilog -u _unresolved -Wl,--gc-sections -nostdlib -g $(MACHDEP) -Wl,-Map,$(notdir $@).map 54 | 55 | # Platform options 56 | ifeq ($(VERSION),us) 57 | CFLAGS += -DTP_US 58 | ASFLAGS += -DTP_US 59 | GAMECODE = "GZ2E" 60 | PRINTVER = "US" 61 | else ifeq ($(VERSION),eu) 62 | CFLAGS += -DTP_EU 63 | ASFLAGS += -DTP_EU 64 | GAMECODE = "GZ2P" 65 | PRINTVER = "EU" 66 | else ifeq ($(VERSION),jp) 67 | CFLAGS += -DTP_JP 68 | ASFLAGS += -DTP_JP 69 | GAMECODE = "GZ2J" 70 | PRINTVER = "JP" 71 | endif 72 | 73 | 74 | #--------------------------------------------------------------------------------- 75 | # any extra libraries we wish to link with the project 76 | #--------------------------------------------------------------------------------- 77 | LIBS := 78 | 79 | #--------------------------------------------------------------------------------- 80 | # list of directories containing libraries, this must be the top level containing 81 | # include and lib 82 | #--------------------------------------------------------------------------------- 83 | LIBDIRS := 84 | 85 | #--------------------------------------------------------------------------------- 86 | # no real need to edit anything past this point unless you need to add additional 87 | # rules for different file extensions 88 | #--------------------------------------------------------------------------------- 89 | ifneq ($(BUILD),$(notdir $(CURDIR))) 90 | #--------------------------------------------------------------------------------- 91 | 92 | export OUTPUT := $(CURDIR)/$(TARGET) 93 | 94 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 95 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 96 | 97 | export DEPSDIR := $(CURDIR)/$(BUILD) 98 | 99 | #--------------------------------------------------------------------------------- 100 | # automatically build a list of object files for our project 101 | #--------------------------------------------------------------------------------- 102 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 103 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 104 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 105 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) 106 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 107 | 108 | #--------------------------------------------------------------------------------- 109 | # use CXX for linking C++ projects, CC for standard C 110 | #--------------------------------------------------------------------------------- 111 | ifeq ($(strip $(CPPFILES)),) 112 | export LD := $(CC) 113 | else 114 | export LD := $(CXX) 115 | endif 116 | 117 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) 118 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) 119 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) 120 | 121 | export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) 122 | 123 | # For REL linking 124 | export LDFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.ld))) 125 | export MAPFILE := $(CURDIR)/include/tp.$(VERSION).lst 126 | export BANNERFILE := $(CURDIR)/banner.raw 127 | export ICONFILE := $(CURDIR)/icon.raw 128 | 129 | #--------------------------------------------------------------------------------- 130 | # build a list of include paths 131 | #--------------------------------------------------------------------------------- 132 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 133 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 134 | -I$(CURDIR)/$(BUILD) \ 135 | -I$(LIBOGC_INC) 136 | 137 | #--------------------------------------------------------------------------------- 138 | # build a list of library paths 139 | #--------------------------------------------------------------------------------- 140 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ 141 | -L$(LIBOGC_LIB) 142 | 143 | export OUTPUT := $(CURDIR)/$(TARGET) 144 | .PHONY: $(BUILD) clean_target 145 | 146 | #--------------------------------------------------------------------------------- 147 | $(BUILD): 148 | @[ -d $@ ] || mkdir -p $@ 149 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 150 | 151 | #--------------------------------------------------------------------------------- 152 | clean_target: 153 | @echo clean ... $(VERSION) 154 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol $(OUTPUT).rel $(OUTPUT).gci 155 | 156 | #--------------------------------------------------------------------------------- 157 | else 158 | 159 | DEPENDS := $(OFILES:.o=.d) 160 | 161 | #--------------------------------------------------------------------------------- 162 | # main targets 163 | #--------------------------------------------------------------------------------- 164 | $(OUTPUT).gci: $(OUTPUT).rel $(BANNERFILE) $(ICONFILE) 165 | $(OUTPUT).rel: $(OUTPUT).elf $(MAPFILE) 166 | $(OUTPUT).elf: $(LDFILES) $(OFILES) 167 | 168 | $(OFILES_SOURCES) : $(HFILES) 169 | 170 | # REL linking 171 | %.rel: %.elf 172 | @echo output ... $(notdir $@) 173 | @$(ELF2REL) $< -s $(MAPFILE) 174 | 175 | %.gci: %.rel 176 | @echo packing ... $(notdir $@) 177 | @$(GCIPACK) $< "Custom REL File" "Twilight Princess" "($(PRINTVER)) REL" $(BANNERFILE) $(ICONFILE) $(GAMECODE) 178 | 179 | #--------------------------------------------------------------------------------- 180 | # This rule links in binary data with the .jpg extension 181 | #--------------------------------------------------------------------------------- 182 | %.jpg.o %_jpg.h : %.jpg 183 | #--------------------------------------------------------------------------------- 184 | @echo $(notdir $<) 185 | $(bin2o) 186 | 187 | -include $(DEPENDS) 188 | 189 | #--------------------------------------------------------------------------------- 190 | endif 191 | #--------------------------------------------------------------------------------- 192 | endif 193 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Twilight Princess REL base 2 | [Homepage](https://rando.zeldatp.net) | [Mirror](https://git.zeldatp.net) | [Discord](https://discord.zeldatp.net) 3 | 4 | #### Disclaimer 5 | > The new Repository will just be [Randomizer](https://github.com/zsrtp/Randomizer) due to massive code and structural changes 6 | > Currently this is still active! 7 | 8 | > This project is based on Piston's [ttyd-tools](https://github.com/PistonMiner/ttyd-tools) and ported to Twilight Princess by [Zephiles](https://github.com//Zephiles) 9 | 10 | ### Build Requirements 11 | * [DevkitPPC](https://devkitpro.org/) 12 | * [GC-DevTools](https://github.com/zsrtp/GC-DevTools) 13 | 14 | > After downloading the DevTools you want to adjust some files for the **Makefile** to match your **elf2rel** and **gcipack** path(s) 15 | 16 | **Linux/Unix:** 17 | 18 | `$ sudo cp /path/to/elf2rel /usr/bin/elf2rel` 19 | 20 | `$ sudo echo 'python3 /path/to/gcipack.py "$@"' > /usr/bin/gcipack && sudo chmod +x /usr/bin/gcipack` 21 | 22 | In this case the **Makefile** does not need to be changed, however if you don't want to add the binaries/scripts to your *PATH* or *bin* you should edit the Makefile (see Windows variant) 23 | 24 | **Windows** 25 | * Open the **Makefile** for edit 26 | * Change line 12 from `export ELF2REL := elf2rel` to `export ELF2REL := /path/to/elf2rel.exe` (or `/path/to/elf2rel` on linux) 27 | * Change line 13 from `export GCIPACK := gcipack` to `export GCIPACK := python3 /path/to/gcipack.py` 28 | 29 | > *It is suggested to create a `bin` folder inside the Randomizer and copy the binary/script (`elf2rel`, `gcipack.py`) inside there - then use `bin/elf2rel[.exe]` and `bin/gcipack.py` as paths* 30 | 31 | ### Credits and special thanks to 32 | * AECX for the first versions of the randomizer 33 | * Piston for TTYD-Tools 34 | * Zephiles for porting them to TP and helping to set them up properly aswell as hours of testing, debugging and providing help 35 | * Taka for helping *a lot* with testing and gathering meta-data for chests 36 | * Skyreon for also helping with REL testing 37 | * Hornlitz for writing down all chests + some information on how to access them 38 | * Jacquaid for his TPHD rando logic and general information 39 | * dragonbane for providing inifinite amounts of information and being a constant source of Game knowledge 40 | * Everyone who contributed to researching the game and/or was involved in the Ultimate TP Spreadsheet 41 | -------------------------------------------------------------------------------- /banner.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsrtp/GC-Randomizer/03a14361dc1d748dd2db3df96b29dcca3e9ca1af/banner.raw -------------------------------------------------------------------------------- /format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | find . -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.hpp | xargs clang-format -style=file -i -fallback-style=none -------------------------------------------------------------------------------- /icon.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsrtp/GC-Randomizer/03a14361dc1d748dd2db3df96b29dcca3e9ca1af/icon.raw -------------------------------------------------------------------------------- /include/HUDConsole.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | 7 | namespace mod 8 | { 9 | struct Option 10 | { 11 | char Title[16]; 12 | u8* Target; 13 | u32 Limit; 14 | }; 15 | 16 | struct Watch 17 | { 18 | char Title[16]; 19 | void* Target; 20 | char Format; 21 | u8 Interpretation; 22 | }; 23 | 24 | enum WatchInterpretation : u8 25 | { 26 | _u8 = 0, 27 | _u16 = 1, 28 | _u32 = 2, 29 | _u64 = 3, 30 | _s8 = 4, 31 | _s16 = 5, 32 | _s32 = 6, 33 | _s64 = 7, 34 | _str = 8 35 | }; 36 | 37 | enum ConsoleActions : u8 38 | { 39 | Move_Up = 0, 40 | Move_Down = 1, 41 | Move_Left = 2, 42 | Move_Right = 3, 43 | Option_Increase = 4, 44 | Option_Decrease = 5 45 | }; 46 | 47 | class HUDConsole 48 | { 49 | public: 50 | HUDConsole( const char firstPage[16], u32 RGBA = 0x000000FF ); 51 | 52 | /** 53 | * Adds an option to the Console 54 | * 55 | * @param page Page index where the option should appear 56 | * @param title Short description (limit 16) 57 | * @param target The target value that can be set via the menu 58 | * @param limit When target >= limit it will reset to 0 59 | */ 60 | void addOption( u8 page, const char title[16], u8* target, u32 limit ); 61 | 62 | /** 63 | * Adds a watch to the console 64 | * 65 | * @param page Page index where the watch should appear 66 | * @param title Short description (limit 16) 67 | * @param target Target value to be represented 68 | * @param format Formatting char (s, d, u, x, ...) 69 | * @param interpretation How to read from the target* (mod::WatchInterpretation) 70 | */ 71 | void addWatch( u8 page, const char title[16], void* target, char format, u8 interpretation ); 72 | 73 | /** 74 | * Adds a page to the Console (pages can be switched with R/L) 75 | * 76 | * @param title The name to appear when this page is opened 77 | * @returns The index of the new page if successful otherwise -1 78 | */ 79 | s8 addPage( const char title[16] ); 80 | 81 | /** 82 | * Performs an action 83 | * 84 | * @param consoleAction A valid mod::ConsoleAction that's going to be performed 85 | */ 86 | void performAction( u8 consoleAction, u8 amount = 1 ); 87 | 88 | /** 89 | * Draws the current page and it's options 90 | */ 91 | void draw(); 92 | 93 | private: 94 | u8 selectedOption; // Y Position 95 | u8 selectedPage; // X Position 96 | 97 | u8 numOptions[MAX_HUDCONSOLE_PAGES]; 98 | u8 numWatches[MAX_HUDCONSOLE_PAGES]; 99 | u8 numPages; 100 | 101 | char pages[MAX_HUDCONSOLE_PAGES][16]; 102 | Option options[MAX_HUDCONSOLE_PAGES][10]; 103 | Watch watches[MAX_HUDCONSOLE_PAGES][10]; 104 | }; 105 | } // namespace mod -------------------------------------------------------------------------------- /include/array.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::array 6 | { 7 | extern "C" 8 | { 9 | /** 10 | * Checks whether an array contains a value and returns it's index 11 | * 12 | * @param needle The value to be searched for 13 | * @param haystack Pointer to the array 14 | * @param count Number of elements within the array 15 | * @returns If successful the index of needle inside the array, otherwise -1 16 | */ 17 | s32 indexOf( u16 needle, u16* haystack, size_t count ); 18 | } 19 | } // namespace mod::array -------------------------------------------------------------------------------- /include/chestRando.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | #include "item.h" 7 | 8 | namespace mod 9 | { 10 | class ChestRandomizer 11 | { 12 | private: 13 | u8* itemOrder = nullptr; // Used for checksum 14 | u8 itemOrderIndex; 15 | 16 | public: 17 | // Conditions used by the generator to determine wether a check is already reachable 18 | u32 currentPlayerConditions; 19 | 20 | // Layer 0 conditions, basically 21 | u32 startConditions = 0b100000000000000100010; // AND, small key, master sword (<-locked anyway) 22 | 23 | // Debug values 24 | char lastSourceInfo[50]; 25 | char lastDestInfo[50]; 26 | 27 | u64 currentSeed; 28 | u16 checkSum; 29 | 30 | u16 totalChecks; 31 | u16 layerCheckCount; 32 | u16 empty; 33 | float rangeX = 400.0f; 34 | float rangeY = 200.0f; 35 | float rangeZ = 400.0f; 36 | 37 | u8 isProgressiveEnabled = 1; 38 | u8 isBugsanityEnabled = 1; 39 | u8 isPoesanityEnabled = 1; 40 | u8 isShopsanityEnabled = 1; 41 | u8 areDungeonItemsRandomized = 1; 42 | u8 isTwilightSkipEnabled = 1; 43 | u8 isKeysanityEnabled = 1; 44 | u8 areHeartPiecesRandomized = 1; 45 | u8 areRupeesRandomized = 1; 46 | u8 areAmmoRandomized = 1; 47 | 48 | u8 itemThatReplacesHalfMilk = 0; 49 | u8 itemThatReplacesSlingShot = 0; 50 | 51 | tp::d_com_inf_game::ItemSlots* itemWheel; 52 | 53 | public: 54 | /** 55 | * Generates a new set of chest replacements based 56 | * on current RAND_SEED 57 | */ 58 | void generate(); 59 | 60 | /** 61 | * Returns the item replacement if found, otherwise 62 | * the item that's passed via argument 63 | * 64 | * @param pos The cXyz of the chest 65 | * @param item Internal Item ID of the item 66 | */ 67 | s32 getItemReplacement( const float pos[3], s32 item ); 68 | 69 | /** 70 | * Checks if the stage given is a boss room 71 | * to know if we can spawn a HC 72 | * 73 | * excludes hyrule castle since boss doesn't spawn heart container 74 | */ 75 | bool isStageBoss(); 76 | 77 | /** 78 | * checks if the stage is one of the 5 grotto stages 79 | */ 80 | 81 | bool isStageDungeon(); 82 | 83 | bool isStageGrotto(); 84 | 85 | bool isStageInterior(); 86 | 87 | bool isStageCave(); 88 | 89 | bool isStageSpecial(); 90 | 91 | bool isStageTOD(); 92 | 93 | private: 94 | /** 95 | * Finds a random source within a specified layer range 96 | */ 97 | item::ItemCheck* findSource( u8 maxLayer, u8 minLayer = 0, item::ItemCheck* destCheck = nullptr ); 98 | 99 | /** 100 | * Places dest into source and sets the flags necessary 101 | */ 102 | void placeCheck( item::ItemCheck* sourceCheck, item::ItemCheck* destCheck ); 103 | 104 | /** 105 | * Checks if the player with their current conditions can access the chest 106 | */ 107 | bool checkCondition( item::ItemCheck* sourceCheck, item::ItemCheck* destCheck ); 108 | 109 | /** 110 | * Checks if the item should be locked in place 111 | */ 112 | bool isLocked( item::ItemCheck* check ); 113 | 114 | /** 115 | * Checks if the stage given is a dungeon 116 | * to prevent heart containers to spawn there so boss heart containers can spawn (doesn't fix it entirely based on 117 | *Zephiles) 118 | * 119 | *includes miniboss rooms but not boss rooms 120 | *excludes hyrule castle since boss doesn't spawn heart container 121 | */ 122 | bool isStageADungeon( char* stage ); 123 | 124 | /** 125 | * checks if item given is a type of bombs 126 | * to prevent problems with the game changing bomb type based on type of bombs in inventory 127 | * 128 | * excludes bomb bag+bombs 129 | */ 130 | bool isItemBombs( u8 itemID ); 131 | 132 | /** 133 | * checks if item given is a bottle content without a bottle 134 | */ 135 | bool isItemBottleFill( u8 itemID ); 136 | 137 | /** 138 | * 139 | * places the key checks correctly 140 | */ 141 | void handleKeysanity(); 142 | 143 | /** 144 | * check if the check gotten in a grotto is the right one 145 | */ 146 | bool isGrottoCheckOk( u16 checkID ); 147 | }; 148 | } // namespace mod -------------------------------------------------------------------------------- /include/controller.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::controller 6 | { 7 | enum PadInputs : u32 8 | { 9 | Button_DPad_Left = 0x00000001, 10 | Button_DPad_Right = 0x00000002, 11 | Button_DPad_Down = 0x00000004, 12 | Button_DPad_Up = 0x00000008, 13 | Button_Z = 0x00000010, 14 | Button_R = 0x00000020, 15 | Button_L = 0x00000040, 16 | Button_A = 0x00000100, 17 | Button_B = 0x00000200, 18 | Button_X = 0x00000400, 19 | Button_Y = 0x00000800, 20 | Button_Start = 0x00001000, 21 | Stick_C_Left = 0x00010000, 22 | Stick_C_Right = 0x00020000, 23 | Stick_C_Down = 0x00040000, 24 | Stick_C_Up = 0x00080000, 25 | Stick_Left = 0x01000000, 26 | Stick_Right = 0x02000000, 27 | Stick_Down = 0x04000000, 28 | Stick_Up = 0x08000000 29 | }; 30 | 31 | extern "C" 32 | { 33 | bool checkForButtonInput( u32 buttonCombo ); 34 | bool checkForButtonInputSingleFrame( u32 buttonCombo ); 35 | } 36 | } // namespace mod::controller -------------------------------------------------------------------------------- /include/customChecks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #include "defines.h" 6 | #include "tools.h" 7 | 8 | struct customCheck 9 | { 10 | char stage[8]; 11 | u8 room; 12 | 13 | u8 chestType; 14 | 15 | u8 saveFlag; 16 | u8 itemID; 17 | 18 | u32 X; 19 | u32 Y; 20 | u32 Z; 21 | 22 | s32 Angle; 23 | 24 | void ( *overrides )(); 25 | 26 | bool ( *requirement )(); 27 | }; 28 | 29 | namespace mod 30 | { 31 | customCheck customChecks[30] = { 32 | /*Ordon Shield*/ 33 | { "F_SP103", 34 | 0, 35 | 0, 36 | 0x74, 37 | 0x2A, 38 | 0x456C12A0, 39 | 0x43390000, 40 | 0x44405C5E, 41 | 0x5FA0, 42 | []() { 43 | gameInfo.localAreaNodes.unk_0[0x8] |= 0x4; /*remove ordon shield*/ 44 | }, 45 | []() { 46 | return ( gameInfo.scratchPad.eventBits[0x5] & 0x7A ) != 0; /*have sewers been done*/ 47 | } }, 48 | /*Ordon Sword*/ 49 | { "R_SP01", 50 | 4, 51 | 0, 52 | 0x70, 53 | 0x28, 54 | 0x439D0602, 55 | 0x0, 56 | 0xC26ABE99, 57 | 0xCC7D, 58 | []() { 59 | gameInfo.localAreaNodes.unk_0[0x8] |= 0x1; /*got ordon sword*/ 60 | gameInfo.localAreaNodes.unk_0[0x1B] |= 0x8; /*remove ordon sword*/ 61 | }, 62 | []() { 63 | return ( gameInfo.scratchPad.eventBits[0x5] & 0x7A ) != 0; /*have sewers been done*/ 64 | } }, 65 | /*Fishing rod*/ 66 | { "F_SP103", 67 | 0, 68 | 1, 69 | 0x68, 70 | 0x4A, 71 | 0xC3FEB5F1, 72 | 0x42960000, 73 | 0x4514FB40, 74 | 0x883A, 75 | []() { 76 | gameInfo.scratchPad.eventBits[0x3] |= 0x5; /*brought Cradle to Uli and got fishing rod*/ 77 | gameInfo.scratchPad.eventBits[0x46] |= 0x1; /*took cradle from monkey*/ 78 | }, 79 | []() { 80 | return ( gameInfo.localAreaNodes.unk_0[0xC] & 0x2 ) != 0; /*is goats 1 done*/ 81 | } }, 82 | /*Sera Bottle*/ 83 | { "F_SP103", 84 | 0, 85 | 1, 86 | 0x7C, 87 | 0x65, 88 | 0x444C8DC3, 89 | 0x42AF0000, 90 | 0xC4CB2577, 91 | 0xA3E7, 92 | []() { 93 | gameInfo.scratchPad.eventBits[0x12] |= 0x8; /*can shop at Sera's shop*/ 94 | gameInfo.scratchPad.eventBits[0x14] |= 0x8; /*Sera Bottle gotten*/ 95 | }, 96 | []() { 97 | return ( gameInfo.localAreaNodes.unk_0[0xC] & 0x2 ) != 0; /*is goats 1 done*/ 98 | } }, 99 | /*Slingshot*/ 100 | { "F_SP103", 101 | 0, 102 | 0, 103 | 0x78, 104 | 0x4B, 105 | 0xC3EDF8A9, 106 | 0x44CD922E, 107 | 0x45F31BF5, 108 | 0x7881, 109 | nullptr /*Flag is set in game_patches to avoid interaction with vanilla check*/, 110 | []() { 111 | return ( gameInfo.localAreaNodes.unk_0[0xC] & 0x2 ) != 0; /*is goats 1 done*/ 112 | } }, 113 | /*Lantern*/ 114 | { "F_SP108", 0xFF, 1, 0xF8, 0x48, 0xC66D4C1B, 0x41C19A25, 0xC65D2696, 0x36EC, nullptr, []() { return true; } }, 115 | /*Zora Armor*/ 116 | { "F_SP111", 117 | 0, 118 | 1, 119 | 0x7C, 120 | 0x31, 121 | 0x46A85A96, 122 | 0x43FA0000, 123 | 0x43944190, 124 | 0xC270, 125 | []() { 126 | gameInfo.scratchPad.eventBits[0x8] |= 0x4; /*got zora armor from Rutela*/ 127 | }, 128 | []() { return true; } }, 129 | /*Coral Earring*/ 130 | { "F_SP111", 131 | 0, 132 | 1, 133 | 0x78, 134 | 0x3D, 135 | 0x46A81087, 136 | 0x43FA57D9, 137 | 0xC3BCEFAC, 138 | 0xC270, 139 | []() { 140 | gameInfo.scratchPad.eventBits[0x3B] |= 0x80; /*Got Coral Earring from Ralis*/ 141 | }, 142 | []() { return tools::checkItemFlag( ItemFlags::Asheis_Sketch ); } }, 143 | /*Auru's Memo*/ 144 | { "F_SP115", 145 | 0, 146 | 1, 147 | 0x7C, 148 | 0x90, 149 | 0xC7E2E398, 150 | 0xC6770800, 151 | 0x47656746, 152 | 0x143D, 153 | []() { 154 | gameInfo.scratchPad.eventBits[0x25] |= 0x30; /*Auru Cutscene Complete + Auru's Memo gotten*/ 155 | }, 156 | []() { return gameInfo.scratchPad.allAreaNodes.Lakebed_Temple.dungeon.bossBeaten == 0b1; } }, 157 | /*Ashei's Sketch*/ 158 | { "F_SP114", 159 | 0, 160 | 1, 161 | 0x7C, 162 | 0x91, 163 | 0x46F71891, 164 | 0xC6502A32, 165 | 0xC6348FA6, 166 | 0x86E6, 167 | []() { 168 | gameInfo.scratchPad.eventBits[0x29] |= 0x40; /*Got Ashei's Sketch from Ashei*/ 169 | }, 170 | []() { return true; } }, 171 | /*Renardo's Letter*/ 172 | { "R_SP109", 173 | 0, 174 | 1, 175 | 0x68, 176 | 0x80, 177 | 0x43D3A702, 178 | 0x0, 179 | 0x43D5A60B, 180 | 0xC1FD, 181 | []() { 182 | gameInfo.scratchPad.eventBits[0xF] |= 0x80; /*Got Renardo's Letter from Renardo*/ 183 | }, 184 | []() { return gameInfo.scratchPad.allAreaNodes.Temple_of_Time.dungeon.bossBeaten == 0b1; } }, 185 | /*Invoice*/ 186 | { "R_SP116", 187 | 5, 188 | 1, 189 | 0x70, 190 | 0x81, 191 | 0x45282E22, 192 | 0xC48FC000, 193 | 0x453BED7D, 194 | 0x0000, 195 | []() { 196 | gameInfo.scratchPad.eventBits[0x21] |= 0x80; /*Got Invoice from Telma*/ 197 | }, 198 | []() { return tools::checkItemFlag( ItemFlags::Renardos_Letter ); } }, 199 | /*Wooden Statue*/ 200 | { "F_SP122", 201 | 16, 202 | 1, 203 | 0x68, 204 | 0x82, 205 | 0xC7493734, 206 | 0xC5C3E9D7, 207 | 0x46F956C6, 208 | 0x7FE1, 209 | []() { 210 | gameInfo.scratchPad.eventBits[0x22] |= 0x4; /*Got Wooden Statue from wolves*/ 211 | }, 212 | []() { return ( ( gameInfo.scratchPad.eventBits[0x2F] & 0x4 ) != 0 ); } }, 213 | /*Horse Call*/ 214 | { "R_SP109", 215 | 0, 216 | 1, 217 | 0x74, 218 | 0x84, 219 | 0x43CDBCA1, 220 | 0x0, 221 | 0xC31EEBF3, 222 | 0xBDBE, 223 | []() { 224 | gameInfo.scratchPad.eventBits[0x23] |= 0x20; /*Got horse call from Ilia*/ 225 | }, 226 | []() { return tools::checkItemFlag( ItemFlags::Ilias_Charm ); } }, 227 | /*Fishing Hole Bottle*/ 228 | { "F_SP127", 229 | 0, 230 | 1, 231 | 0x7C, 232 | 0x60, 233 | 0x45B27147, 234 | 0x420C0000, 235 | 0x450F716A, 236 | 0x62E5, 237 | []() { 238 | gameInfo.scratchPad.eventBits[0x39] |= 0x8; /*Got fishing hole bottle*/ 239 | }, 240 | []() { return true; } }, 241 | /*Coro Key*/ 242 | { "F_SP108", 243 | 0xFF, 244 | 0, 245 | 0xF4, 246 | 0xFE, 247 | 0xC64BA600, 248 | 0x403DA884, 249 | 0xC663BC8E, 250 | 0x7A11, 251 | []() { 252 | gameInfo.scratchPad.eventBits[0x1A] |= 0x10; /*Talked to Coro after Faron Twilight*/ 253 | gameInfo.localAreaNodes.unk_0[0xD] |= 0x4; /*got Coro key*/ 254 | }, 255 | []() { return gameInfo.scratchPad.clearedTwilights.Faron == 0b1; } }, 256 | /*Camp Key*/ 257 | { "F_SP118", 258 | 1, 259 | 0, 260 | 0x7C, 261 | 0x20, 262 | 0x457F816B, 263 | 0x43820000, 264 | 0xC572F680, 265 | 0x0000, 266 | []() { 267 | gameInfo.localAreaNodes.unk_0[0x4] |= 0x80; /*get camp key*/ 268 | }, 269 | []() { return true; } }, 270 | /*Jovani Poe*/ 271 | { "R_SP160", 272 | 5, 273 | 0, 274 | 0x7C, 275 | 0xE0, 276 | 0x45906531, 277 | 0xC2960000, 278 | 0x45229AEB, 279 | 0xC3C9, 280 | []() { 281 | gameInfo.localAreaNodes.unk_0[0x8] |= 0x80; /*killed poe*/ 282 | gameInfo.localAreaNodes.unk_0[0xF] |= 0x7; /*cs + open path to sewers*/ 283 | gameInfo.localAreaNodes.unk_0[0x17] |= 0x8; /*Gengle Free*/ 284 | }, 285 | []() { return true; } }, 286 | /*Shadow Crystal*/ 287 | { "F_SP117", 288 | 1, 289 | 0, 290 | 0x7C, 291 | 0x32, 292 | 0xC36EB7DC, 293 | 0x44CB2000, 294 | 0xC5964574, 295 | 0x0000, 296 | []() { 297 | gameInfo.scratchPad.eventBits[0x10] |= 0x20; /*got master sword cs*/ 298 | }, 299 | []() { return true; } }, 300 | /*Master Sword*/ 301 | { "F_SP117", 302 | 1, 303 | 2, 304 | 0x78, 305 | 0x29, 306 | 0x4372ACFB, 307 | 0x44CB2000, 308 | 0xC5991A55, 309 | 0x0000, 310 | []() { 311 | gameInfo.scratchPad.eventBits[0x10] |= 0x20; /*got master sword cs*/ 312 | }, 313 | []() { return true; } }, 314 | /*Powered Dominion Rod*/ 315 | { "R_SP209", 316 | 7, 317 | 1, 318 | 0x70, 319 | 0x4C, 320 | 0xC3DB30E9, 321 | 0xC4408000, 322 | 0xC523C471, 323 | 0x3CF0, 324 | nullptr, 325 | []() { return tools::checkItemFlag( ItemFlags::Ancient_Sky_Book_empty ); } }, 326 | /*Ending Blow*/ 327 | { "F_SP108", 328 | 6, 329 | 2, 330 | 0xF0, 331 | 0xE1, 332 | 0xC71A5B41, 333 | 0x44898000, 334 | 0xC6E08544, 335 | 0x0000, 336 | nullptr, 337 | []() { return gameInfo.scratchPad.clearedTwilights.Faron == 0b1; } }, 338 | /*Shield Bash*/ 339 | { "F_SP104", 340 | 1, 341 | 2, 342 | 0x6C, 343 | 0xE2, 344 | 0xC4BB1F1C, 345 | 0x438C0000, 346 | 0xC613CAAA, 347 | 0x4138, 348 | []() { 349 | gameInfo.scratchPad.eventBits[0x3C] |= 0x8; /*Got skill from Ordon Wolf*/ 350 | }, 351 | []() { 352 | return ( gameInfo.scratchPad.eventBits[0x3A] & 0x80 ) != 0; /*DMT howling stone done*/ 353 | } }, 354 | /*Back Slice*/ 355 | { "F_SP122", 356 | 8, 357 | 2, 358 | 0x78, 359 | 0xE3, 360 | 0xC78590C8, 361 | 0xC4834000, 362 | 0x45B7BC37, 363 | 0xC15B, 364 | []() { 365 | gameInfo.scratchPad.eventBits[0x3C] |= 0x4; /*Got skill from West CT Wolf*/ 366 | }, 367 | []() { 368 | return ( gameInfo.scratchPad.eventBits[0x3A] & 0x40 ) != 0; /*UZR howling stone done*/ 369 | } }, 370 | /*Helm Splitter*/ 371 | { "F_SP122", 372 | 16, 373 | 2, 374 | 0x74, 375 | 0xE4, 376 | 0xC75990D6, 377 | 0xC5BEA000, 378 | 0x46C3B269, 379 | 0x0000, 380 | []() { 381 | gameInfo.scratchPad.eventBits[0x3C] |= 0x2; /*Got skill from South CT Wolf*/ 382 | }, 383 | []() { 384 | return ( gameInfo.scratchPad.eventBits[0x3A] & 0x20 ) != 0; /*Faron howling stone done*/ 385 | } }, 386 | /*Mortal Draw*/ 387 | { "F_SP124", 388 | 0, 389 | 2, 390 | 0x78, 391 | 0xE5, 392 | 0xC53E0B78, 393 | 0x41C428F6, 394 | 0x46318C93, 395 | 0x4565, 396 | []() { 397 | gameInfo.scratchPad.eventBits[0x3C] |= 0x1; /*Got skill from Bublin Camp Wolf*/ 398 | }, 399 | []() { 400 | return ( gameInfo.scratchPad.eventBits[0x3A] & 0x10 ) != 0; /*Lake Hylia howling stone done*/ 401 | } }, 402 | /*Jump Strike*/ 403 | { "F_SP111", 404 | 0, 405 | 2, 406 | 0x6C, 407 | 0xE6, 408 | 0x467D1395, 409 | 0x44034000, 410 | 0xC1F855A7, 411 | 0x3EE7, 412 | []() { 413 | gameInfo.scratchPad.eventBits[0x3D] |= 0x80; /*Got skill from Graveyard Wolf*/ 414 | }, 415 | []() { 416 | return ( gameInfo.scratchPad.eventBits[0x3A] & 0x8 ) != 0; /*Snowpeak howling stone done*/ 417 | } }, 418 | /*Great Spin*/ 419 | { "F_SP116", 420 | 1, 421 | 2, 422 | 0x78, 423 | 0xE7, 424 | 0x42204113, 425 | 0x44480000, 426 | 0xC61FB41E, 427 | 0x0000, 428 | []() { 429 | gameInfo.scratchPad.eventBits[0x3D] |= 0x40; /*Got skill from Barrier Wolf*/ 430 | }, 431 | []() { 432 | return ( gameInfo.scratchPad.eventBits[0x3A] & 0x4 ) != 0; /*Hidden Village howling stone done*/ 433 | } }, 434 | /*Snowpeak Map*/ 435 | { "D_MN11", 436 | 0xFF, 437 | 0, 438 | 0x74, 439 | 0xBA, 440 | 0x447AF8E0, 441 | 0x00000000, 442 | 0xC42C93A9, 443 | 0xFEED, 444 | []() { 445 | gameInfo.localAreaNodes.unk_0[0xA] |= 0x10; /*got map from Yeta*/ 446 | gameInfo.scratchPad.eventBits[0xB] |= 0x20; /*Talked to Yeta in SPR first time*/ 447 | gameInfo.localAreaNodes.unk_0[0x10] |= 0x20; /*Yeta lets you open kitchen door*/ 448 | gameInfo.localAreaNodes.unk_0[0x16] |= 0x40; /*Yeta points to kitchen cs*/ 449 | }, 450 | []() { return true; } } }; 451 | }; -------------------------------------------------------------------------------- /include/customMessage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | 7 | namespace mod::customMessage 8 | { 9 | MSG_BEGIN( customForestSKText ) 10 | MSG_SPEED( MSG_SPEED_FAST ) 11 | "You got a " 12 | MSG_COLOR(MSG_COLOR_RED) 13 | "small key" 14 | MSG_COLOR(MSG_COLOR_WHITE) 15 | "!\nIt can be used in the\n" 16 | MSG_COLOR(MSG_COLOR_GREEN) 17 | "Forest Temple" 18 | MSG_COLOR(MSG_COLOR_WHITE) 19 | "." 20 | MSG_END() 21 | 22 | MSG_BEGIN(customMinesSKText) 23 | MSG_SPEED(MSG_SPEED_FAST) 24 | "You got a " 25 | MSG_COLOR(MSG_COLOR_RED) 26 | "small key" 27 | MSG_COLOR(MSG_COLOR_WHITE) 28 | "!\nIt can be used in\n" 29 | MSG_COLOR(MSG_COLOR_RED) 30 | "Goron Mines" 31 | MSG_COLOR(MSG_COLOR_WHITE) 32 | "." 33 | MSG_END() 34 | 35 | MSG_BEGIN(customLakebedSKText) 36 | MSG_SPEED(MSG_SPEED_FAST) 37 | "You got a " 38 | MSG_COLOR(MSG_COLOR_RED) 39 | "small key" 40 | MSG_COLOR(MSG_COLOR_WHITE) 41 | "!\nIt can be used in the\n" 42 | MSG_COLOR(CUSTOM_MSG_COLOR_BLUE) 43 | "Lakebed Temple" 44 | MSG_COLOR(MSG_COLOR_WHITE) 45 | "." 46 | MSG_END() 47 | 48 | MSG_BEGIN(customArbitersSKText) 49 | MSG_SPEED(MSG_SPEED_FAST) 50 | "You got a " 51 | MSG_COLOR(MSG_COLOR_RED) 52 | "small key" 53 | MSG_COLOR(MSG_COLOR_WHITE) 54 | "!\nIt can be used in\n" 55 | MSG_COLOR(MSG_COLOR_ORANGE) 56 | "Arbiter's Grounds" 57 | MSG_COLOR(MSG_COLOR_WHITE) 58 | "." 59 | MSG_END() 60 | 61 | MSG_BEGIN(customSnowpeakSKText) 62 | MSG_SPEED(MSG_SPEED_FAST) 63 | "You got a " 64 | MSG_COLOR(MSG_COLOR_RED) 65 | "small key" 66 | MSG_COLOR(MSG_COLOR_WHITE) 67 | "!\nIt can be used in\n" 68 | MSG_COLOR(MSG_COLOR_LIGHT_BLUE) 69 | "Snowpeak Ruins" 70 | MSG_COLOR(MSG_COLOR_WHITE) 71 | "." 72 | MSG_END() 73 | 74 | MSG_BEGIN(customToTSKText) 75 | MSG_SPEED(MSG_SPEED_FAST) 76 | "You got a " 77 | MSG_COLOR(MSG_COLOR_RED) 78 | "small key" 79 | MSG_COLOR(MSG_COLOR_WHITE) 80 | "!\nIt can be used in the\n" 81 | MSG_COLOR(CUSTOM_MSG_COLOR_DARK_GREEN) 82 | "Temple of Time" 83 | MSG_COLOR(MSG_COLOR_WHITE) 84 | "." 85 | MSG_END() 86 | 87 | MSG_BEGIN(customCitySKText) 88 | MSG_SPEED(MSG_SPEED_FAST) 89 | "You got a " 90 | MSG_COLOR(MSG_COLOR_RED) 91 | "small key" 92 | MSG_COLOR(MSG_COLOR_WHITE) 93 | "!\nIt can be used in the\n" 94 | MSG_COLOR(MSG_COLOR_YELLOW) 95 | "City in The Sky" 96 | MSG_COLOR(MSG_COLOR_WHITE) 97 | "." 98 | MSG_END() 99 | 100 | MSG_BEGIN(customPalaceSKText) 101 | MSG_SPEED(MSG_SPEED_FAST) 102 | "You got a " 103 | MSG_COLOR(MSG_COLOR_RED) 104 | "small key" 105 | MSG_COLOR(MSG_COLOR_WHITE) 106 | "!\nIt can be used in the\n" 107 | MSG_COLOR(MSG_COLOR_PURPLE) 108 | "Palace of Twilight" 109 | MSG_COLOR(MSG_COLOR_WHITE) 110 | "." 111 | MSG_END() 112 | 113 | MSG_BEGIN(customCastleSKText) 114 | MSG_SPEED(MSG_SPEED_FAST) 115 | "You got a " 116 | MSG_COLOR(MSG_COLOR_RED) 117 | "small key" 118 | MSG_COLOR(MSG_COLOR_WHITE) 119 | "!\nIt can be used in\n" 120 | MSG_COLOR(CUSTOM_MSG_COLOR_SILVER) 121 | "Hyrule Castle" 122 | MSG_COLOR(MSG_COLOR_WHITE) 123 | "." 124 | MSG_END() 125 | 126 | MSG_BEGIN(customBublinSKText) 127 | MSG_SPEED(MSG_SPEED_FAST) 128 | "You got a " 129 | MSG_COLOR(MSG_COLOR_RED) 130 | "small key" 131 | MSG_COLOR(MSG_COLOR_WHITE) 132 | "!\nIt can be used in the\n" 133 | MSG_COLOR(MSG_COLOR_ORANGE) 134 | "Bulblin Camp" 135 | MSG_COLOR(MSG_COLOR_WHITE) 136 | "." 137 | MSG_END() 138 | 139 | MSG_BEGIN(customCrystalText) 140 | MSG_SPEED(MSG_SPEED_SLOW) 141 | "You got the " 142 | MSG_COLOR(MSG_COLOR_RED) 143 | "Shadow Crystal" 144 | MSG_COLOR(MSG_COLOR_WHITE) 145 | "!\nThis is a dark manifestation\nof " 146 | MSG_COLOR(MSG_COLOR_RED) 147 | "Zant's " 148 | MSG_COLOR(MSG_COLOR_WHITE) 149 | "power that allows\nyou to transform at will!\nHold " 150 | MSG_ICON(MSG_ICON_R) 151 | MSG_COLOR(MSG_COLOR_WHITE) 152 | " then " 153 | MSG_ICON(MSG_ICON_Y) 154 | MSG_COLOR(MSG_COLOR_WHITE) 155 | " at the same\ntime to quickly transform.\nWhile talking to " 156 | MSG_COLOR(MSG_COLOR_LIGHT_BLUE) 157 | "Midna" 158 | MSG_COLOR(MSG_COLOR_WHITE) 159 | ", hold\n" 160 | MSG_ICON(MSG_ICON_R) 161 | MSG_COLOR(MSG_COLOR_WHITE) 162 | " then " 163 | MSG_ICON(MSG_ICON_Y) 164 | MSG_COLOR(MSG_COLOR_WHITE) 165 | " to change time." 166 | MSG_END() 167 | 168 | MSG_BEGIN(customForestMapText) 169 | MSG_SPEED(MSG_SPEED_FAST) 170 | "You got a " 171 | MSG_COLOR(MSG_COLOR_RED) 172 | "dungeon map" 173 | MSG_COLOR(MSG_COLOR_WHITE) 174 | "!\nIt can be used in the\n" 175 | MSG_COLOR(MSG_COLOR_GREEN) 176 | "Forest Temple" 177 | MSG_COLOR(MSG_COLOR_WHITE) 178 | "." 179 | MSG_END() 180 | 181 | MSG_BEGIN(customMinesMapText) 182 | MSG_SPEED(MSG_SPEED_FAST) 183 | "You got a " 184 | MSG_COLOR(MSG_COLOR_RED) 185 | "dungeon map" 186 | MSG_COLOR(MSG_COLOR_WHITE) 187 | "!\nIt can be used in\n" 188 | MSG_COLOR(MSG_COLOR_RED) 189 | "Goron Mines" 190 | MSG_COLOR(MSG_COLOR_WHITE) 191 | "." 192 | MSG_END() 193 | 194 | MSG_BEGIN(customLakebedMapText) 195 | MSG_SPEED(MSG_SPEED_FAST) 196 | "You got a " 197 | MSG_COLOR(MSG_COLOR_RED) 198 | "dungeon map" 199 | MSG_COLOR(MSG_COLOR_WHITE) 200 | "!\nIt can be used in the\n" 201 | MSG_COLOR(CUSTOM_MSG_COLOR_BLUE) 202 | "Lakebed Temple" 203 | MSG_COLOR(MSG_COLOR_WHITE) 204 | "." 205 | MSG_END() 206 | 207 | MSG_BEGIN(customArbitersMapText) 208 | MSG_SPEED(MSG_SPEED_FAST) 209 | "You got a " 210 | MSG_COLOR(MSG_COLOR_RED) 211 | "dungeon map" 212 | MSG_COLOR(MSG_COLOR_WHITE) 213 | "!\nIt can be used in\n" 214 | MSG_COLOR(MSG_COLOR_ORANGE) 215 | "Arbiter's Grounds" 216 | MSG_COLOR(MSG_COLOR_WHITE) 217 | "." 218 | MSG_END() 219 | 220 | MSG_BEGIN(customSnowpeakMapText) 221 | MSG_SPEED(MSG_SPEED_FAST) 222 | "You got a " 223 | MSG_COLOR(MSG_COLOR_RED) 224 | "dungeon map" 225 | MSG_COLOR(MSG_COLOR_WHITE) 226 | "!\nIt can be used in\n" 227 | MSG_COLOR(MSG_COLOR_LIGHT_BLUE) 228 | "Snowpeak Ruins" 229 | MSG_COLOR(MSG_COLOR_WHITE) 230 | "." 231 | MSG_END() 232 | 233 | MSG_BEGIN(customToTMapText) 234 | MSG_SPEED(MSG_SPEED_FAST) 235 | "You got a " 236 | MSG_COLOR(MSG_COLOR_RED) 237 | "dungeon map" 238 | MSG_COLOR(MSG_COLOR_WHITE) 239 | "!\nIt can be used in the\n" 240 | MSG_COLOR(CUSTOM_MSG_COLOR_DARK_GREEN) 241 | "Temple of Time" 242 | MSG_COLOR(MSG_COLOR_WHITE) 243 | "." 244 | MSG_END() 245 | 246 | MSG_BEGIN(customCityMapText) 247 | MSG_SPEED(MSG_SPEED_FAST) 248 | "You got a " 249 | MSG_COLOR(MSG_COLOR_RED) 250 | "dungeon map" 251 | MSG_COLOR(MSG_COLOR_WHITE) 252 | "!\nIt can be used in the\n" 253 | MSG_COLOR(MSG_COLOR_YELLOW) 254 | "City in The Sky" 255 | MSG_COLOR(MSG_COLOR_WHITE) 256 | "." 257 | MSG_END() 258 | 259 | MSG_BEGIN(customPalaceMapText) 260 | MSG_SPEED(MSG_SPEED_FAST) 261 | "You got a " 262 | MSG_COLOR(MSG_COLOR_RED) 263 | "dungeon map" 264 | MSG_COLOR(MSG_COLOR_WHITE) 265 | "!\nIt can be used in the\n" 266 | MSG_COLOR(MSG_COLOR_PURPLE) 267 | "Palace of Twilight" 268 | MSG_COLOR(MSG_COLOR_WHITE) 269 | "." 270 | MSG_END() 271 | 272 | MSG_BEGIN(customCastleMapText) 273 | MSG_SPEED(MSG_SPEED_FAST) 274 | "You got a " 275 | MSG_COLOR(MSG_COLOR_RED) 276 | "dungeon map" 277 | MSG_COLOR(MSG_COLOR_WHITE) 278 | "!\nIt can be used in\n" 279 | MSG_COLOR(CUSTOM_MSG_COLOR_SILVER) 280 | "Hyrule Castle" 281 | MSG_COLOR(MSG_COLOR_WHITE) 282 | "." 283 | MSG_END() 284 | 285 | MSG_BEGIN(customForestCompassText) 286 | MSG_SPEED(MSG_SPEED_FAST) 287 | "You got a " 288 | MSG_COLOR(MSG_COLOR_RED) 289 | "compass" 290 | MSG_COLOR(MSG_COLOR_WHITE) 291 | "!\nIt can be used in the\n" 292 | MSG_COLOR(MSG_COLOR_GREEN) 293 | "Forest Temple" 294 | MSG_COLOR(MSG_COLOR_WHITE) 295 | "." 296 | MSG_END() 297 | 298 | MSG_BEGIN(customMinesCompassText) 299 | MSG_SPEED(MSG_SPEED_FAST) 300 | "You got a " 301 | MSG_COLOR(MSG_COLOR_RED) 302 | "compass" 303 | MSG_COLOR(MSG_COLOR_WHITE) 304 | "!\nIt can be used in\n" 305 | MSG_COLOR(MSG_COLOR_RED) 306 | "Goron Mines" 307 | MSG_COLOR(MSG_COLOR_WHITE) 308 | "." 309 | MSG_END() 310 | 311 | MSG_BEGIN(customLakebedCompassText) 312 | MSG_SPEED(MSG_SPEED_FAST) 313 | "You got a " 314 | MSG_COLOR(MSG_COLOR_RED) 315 | "compass" 316 | MSG_COLOR(MSG_COLOR_WHITE) 317 | "!\nIt can be used in the\n" 318 | MSG_COLOR(CUSTOM_MSG_COLOR_BLUE) 319 | "Lakebed Temple" 320 | MSG_COLOR(MSG_COLOR_WHITE) 321 | "." 322 | MSG_END() 323 | 324 | MSG_BEGIN(customArbitersCompassText) 325 | MSG_SPEED(MSG_SPEED_FAST) 326 | "You got a " 327 | MSG_COLOR(MSG_COLOR_RED) 328 | "compass" 329 | MSG_COLOR(MSG_COLOR_WHITE) 330 | "!\nIt can be used in\n" 331 | MSG_COLOR(MSG_COLOR_ORANGE) 332 | "Arbiter's Grounds" 333 | MSG_COLOR(MSG_COLOR_WHITE) 334 | "." 335 | MSG_END() 336 | 337 | MSG_BEGIN(customSnowpeakCompassText) 338 | MSG_SPEED(MSG_SPEED_FAST) 339 | "You got a " 340 | MSG_COLOR(MSG_COLOR_RED) 341 | "compass" 342 | MSG_COLOR(MSG_COLOR_WHITE) 343 | "!\nIt can be used in\n" 344 | MSG_COLOR(MSG_COLOR_LIGHT_BLUE) 345 | "Snowpeak Ruins" 346 | MSG_COLOR(MSG_COLOR_WHITE) 347 | "." 348 | MSG_END() 349 | 350 | MSG_BEGIN(customToTCompassText) 351 | MSG_SPEED(MSG_SPEED_FAST) 352 | "You got a " 353 | MSG_COLOR(MSG_COLOR_RED) 354 | "compass" 355 | MSG_COLOR(MSG_COLOR_WHITE) 356 | "!\nIt can be used in the\n" 357 | MSG_COLOR(CUSTOM_MSG_COLOR_DARK_GREEN) 358 | "Temple of Time" 359 | MSG_COLOR(MSG_COLOR_WHITE) 360 | "." 361 | MSG_END() 362 | 363 | MSG_BEGIN(customCityCompassText) 364 | MSG_SPEED(MSG_SPEED_FAST) 365 | "You got a " 366 | MSG_COLOR(MSG_COLOR_RED) 367 | "compass" 368 | MSG_COLOR(MSG_COLOR_WHITE) 369 | "!\nIt can be used in the\n" 370 | MSG_COLOR(MSG_COLOR_YELLOW) 371 | "City in The Sky" 372 | MSG_COLOR(MSG_COLOR_WHITE) 373 | "." 374 | MSG_END() 375 | 376 | MSG_BEGIN(customPalaceCompassText) 377 | MSG_SPEED(MSG_SPEED_FAST) 378 | "You got a " 379 | MSG_COLOR(MSG_COLOR_RED) 380 | "compass" 381 | MSG_COLOR(MSG_COLOR_WHITE) 382 | "!\nIt can be used in the\n" 383 | MSG_COLOR(MSG_COLOR_PURPLE) 384 | "Palace of Twilight" 385 | MSG_COLOR(MSG_COLOR_WHITE) 386 | "." 387 | MSG_END() 388 | 389 | MSG_BEGIN(customCastleCompassText) 390 | MSG_SPEED(MSG_SPEED_FAST) 391 | "You got a " 392 | MSG_COLOR(MSG_COLOR_RED) 393 | "compass" 394 | MSG_COLOR(MSG_COLOR_WHITE) 395 | "!\nIt can be used in\n" 396 | MSG_COLOR(CUSTOM_MSG_COLOR_SILVER) 397 | "Hyrule Castle" 398 | MSG_COLOR(MSG_COLOR_WHITE) 399 | "." 400 | MSG_END() 401 | 402 | MSG_BEGIN(customForestBigKeyText) 403 | MSG_SPEED(MSG_SPEED_FAST) 404 | "You got a " 405 | MSG_COLOR(MSG_COLOR_RED) 406 | "big key" 407 | MSG_COLOR(MSG_COLOR_WHITE) 408 | "!\nIt can be used in the\n" 409 | MSG_COLOR(MSG_COLOR_GREEN) 410 | "Forest Temple" 411 | MSG_COLOR(MSG_COLOR_WHITE) 412 | "." 413 | MSG_END() 414 | 415 | MSG_BEGIN(customMinesBigKeyText) 416 | MSG_SPEED(MSG_SPEED_FAST) 417 | "You got a " 418 | MSG_COLOR(MSG_COLOR_RED) 419 | "big key" 420 | MSG_COLOR(MSG_COLOR_WHITE) 421 | "!\nIt can be used in\n" 422 | MSG_COLOR(MSG_COLOR_RED) 423 | "Goron Mines" 424 | MSG_COLOR(MSG_COLOR_WHITE) 425 | "." 426 | MSG_END() 427 | 428 | MSG_BEGIN(customLakebedBigKeyText) 429 | MSG_SPEED(MSG_SPEED_FAST) 430 | "You got a " 431 | MSG_COLOR(MSG_COLOR_RED) 432 | "big key" 433 | MSG_COLOR(MSG_COLOR_WHITE) 434 | "!\nIt can be used in the\n" 435 | MSG_COLOR(CUSTOM_MSG_COLOR_BLUE) 436 | "Lakebed Temple" 437 | MSG_COLOR(MSG_COLOR_WHITE) 438 | "." 439 | MSG_END() 440 | 441 | MSG_BEGIN(customArbitersBigKeyText) 442 | MSG_SPEED(MSG_SPEED_FAST) 443 | "You got a " 444 | MSG_COLOR(MSG_COLOR_RED) 445 | "big key" 446 | MSG_COLOR(MSG_COLOR_WHITE) 447 | "!\nIt can be used in\n" 448 | MSG_COLOR(MSG_COLOR_ORANGE) 449 | "Arbiter's Grounds" 450 | MSG_COLOR(MSG_COLOR_WHITE) 451 | "." 452 | MSG_END() 453 | 454 | MSG_BEGIN(customSnowpeakBigKeyText) 455 | MSG_SPEED(MSG_SPEED_FAST) 456 | "You got a " 457 | MSG_COLOR(MSG_COLOR_RED) 458 | "big key" 459 | MSG_COLOR(MSG_COLOR_WHITE) 460 | "!\nIt can be used in\n" 461 | MSG_COLOR(MSG_COLOR_LIGHT_BLUE) 462 | "Snowpeak Ruins" 463 | MSG_COLOR(MSG_COLOR_WHITE) 464 | "." 465 | MSG_END() 466 | 467 | MSG_BEGIN(customToTBigKeyText) 468 | MSG_SPEED(MSG_SPEED_FAST) 469 | "You got a " 470 | MSG_COLOR(MSG_COLOR_RED) 471 | "big key" 472 | MSG_COLOR(MSG_COLOR_WHITE) 473 | "!\nIt can be used in the\n" 474 | MSG_COLOR(CUSTOM_MSG_COLOR_DARK_GREEN) 475 | "Temple of Time" 476 | MSG_COLOR(MSG_COLOR_WHITE) 477 | "." 478 | MSG_END() 479 | 480 | MSG_BEGIN(customCityBigKeyText) 481 | MSG_SPEED(MSG_SPEED_FAST) 482 | "You got a " 483 | MSG_COLOR(MSG_COLOR_RED) 484 | "big key" 485 | MSG_COLOR(MSG_COLOR_WHITE) 486 | "!\nIt can be used in the\n" 487 | MSG_COLOR(MSG_COLOR_YELLOW) 488 | "City in The Sky" 489 | MSG_COLOR(MSG_COLOR_WHITE) 490 | "." 491 | MSG_END() 492 | 493 | MSG_BEGIN(customPalaceBigKeyText) 494 | MSG_SPEED(MSG_SPEED_FAST) 495 | "You got a " 496 | MSG_COLOR(MSG_COLOR_RED) 497 | "big key" 498 | MSG_COLOR(MSG_COLOR_WHITE) 499 | "!\nIt can be used in the\n" 500 | MSG_COLOR(MSG_COLOR_PURPLE) 501 | "Palace of Twilight" 502 | MSG_COLOR(MSG_COLOR_WHITE) 503 | "." 504 | MSG_END() 505 | 506 | MSG_BEGIN(customCastleBigKeyText) 507 | MSG_SPEED(MSG_SPEED_FAST) 508 | "You got a " 509 | MSG_COLOR(MSG_COLOR_RED) 510 | "big key" 511 | MSG_COLOR(MSG_COLOR_WHITE) 512 | "!\nIt can be used in\n" 513 | MSG_COLOR(CUSTOM_MSG_COLOR_SILVER) 514 | "Hyrule Castle" 515 | MSG_COLOR(MSG_COLOR_WHITE) 516 | "." 517 | MSG_END() 518 | 519 | MSG_BEGIN(endingBlowText) 520 | MSG_SPEED(MSG_SPEED_FAST) 521 | "You got the " 522 | MSG_COLOR(MSG_COLOR_RED) 523 | "Ending Blow" 524 | MSG_COLOR(MSG_COLOR_WHITE) 525 | "!" 526 | MSG_END() 527 | 528 | MSG_BEGIN(shieldAttackText) 529 | MSG_SPEED(MSG_SPEED_FAST) 530 | "You got the " 531 | MSG_COLOR(MSG_COLOR_RED) 532 | "Shield Attack" 533 | MSG_COLOR(MSG_COLOR_WHITE) 534 | "!" 535 | MSG_END() 536 | 537 | MSG_BEGIN(backSliceText) 538 | MSG_SPEED(MSG_SPEED_FAST) 539 | "You got the " 540 | MSG_COLOR(MSG_COLOR_RED) 541 | "Back Slice" 542 | MSG_COLOR(MSG_COLOR_WHITE) 543 | "!" 544 | MSG_END() 545 | 546 | MSG_BEGIN(helmSplitterText) 547 | MSG_SPEED(MSG_SPEED_FAST) 548 | "You got the " 549 | MSG_COLOR(MSG_COLOR_RED) 550 | "Helm Splitter" 551 | MSG_COLOR(MSG_COLOR_WHITE) 552 | "!" 553 | MSG_END() 554 | 555 | MSG_BEGIN(mortalDrawText) 556 | MSG_SPEED(MSG_SPEED_FAST) 557 | "You got the " 558 | MSG_COLOR(MSG_COLOR_RED) 559 | "Mortal Draw" 560 | MSG_COLOR(MSG_COLOR_WHITE) 561 | "!" 562 | MSG_END() 563 | 564 | MSG_BEGIN(jumpStrikeText) 565 | MSG_SPEED(MSG_SPEED_FAST) 566 | "You got the " 567 | MSG_COLOR(MSG_COLOR_RED) 568 | "Jump Strike" 569 | MSG_COLOR(MSG_COLOR_WHITE) 570 | "!" 571 | MSG_END() 572 | 573 | MSG_BEGIN(greatSpinText) 574 | MSG_SPEED(MSG_SPEED_FAST) 575 | "You got the " 576 | MSG_COLOR(MSG_COLOR_RED) 577 | "Great Spin" 578 | MSG_COLOR(MSG_COLOR_WHITE) 579 | "!" 580 | MSG_END() 581 | 582 | MSG_BEGIN(customPoweredRodText) 583 | MSG_SPEED(MSG_SPEED_FAST) 584 | "Power has been restored to\nthe " 585 | MSG_COLOR(MSG_COLOR_RED) 586 | "Dominion Rod" 587 | MSG_COLOR(MSG_COLOR_WHITE) 588 | "! Now it can\nbe used to imbude statues\nwith life in the present!" 589 | MSG_END() 590 | } // namespace mod::customMessage -------------------------------------------------------------------------------- /include/defines.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | using std::size_t; 6 | 7 | // Data types 8 | typedef unsigned long long u64; 9 | typedef signed long long s64; 10 | typedef unsigned int u32; 11 | typedef signed int s32; 12 | typedef unsigned short u16; 13 | typedef signed short s16; 14 | typedef unsigned char u8; 15 | typedef signed char s8; 16 | 17 | // Helper 18 | #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" 19 | #define BYTE_TO_BINARY( byte ) \ 20 | ( byte & 0b10000000 ? '1' : '0' ), ( byte & 0b01000000 ? '1' : '0' ), ( byte & 0b00100000 ? '1' : '0' ), \ 21 | ( byte & 0b00010000 ? '1' : '0' ), ( byte & 0b00001000 ? '1' : '0' ), ( byte & 0b00000100 ? '1' : '0' ), \ 22 | ( byte & 0b00000010 ? '1' : '0' ), ( byte & 0b00000001 ? '1' : '0' ) 23 | 24 | // Allows to transform data as bytes 1:1 from A<-->B and vice versa 25 | template 26 | union typeTransform 27 | { 28 | A a; 29 | B b; 30 | }; 31 | 32 | // Array modification 33 | #define MAX_LOAD_EVENTS 40 // eventListener 34 | #define MAX_HUDCONSOLE_PAGES 12 // HUDConsole 35 | 36 | // Mnemonics 37 | #define AUTHOR "ZTPR" 38 | #define VERSION "v0.20b" 39 | #define RAND_SEED mod::tools::randomSeed 40 | #define gameInfo tp::d_com_inf_game::dComIfG_gameInfo 41 | #define getPlayerPos tp::d_map_path_dmap::getMapPlayerPos 42 | #define sysConsolePtr tp::jfw_system::systemConsole 43 | #define isLoading tp::f_op_scene_req::isUsingOfOverlap 44 | #define ItemFlags tp::d_com_inf_game::ItemFlagBits 45 | 46 | // Stage translations for mod::stage::allStages[] 47 | #define Stage_Lakebed_Temple 0 48 | #define Stage_Morpheel 1 49 | #define Stage_Deku_Toad 2 50 | #define Stage_Goron_Mines 3 51 | #define Stage_Fyrus 4 52 | #define Stage_Dangoro 5 53 | #define Stage_Forest_Temple 6 54 | #define Stage_Diababa 7 55 | #define Stage_Ook 8 56 | #define Stage_Temple_of_Time 9 57 | #define Stage_Armogohma 10 58 | #define Stage_Darknut 11 59 | #define Stage_City_in_the_Sky 12 60 | #define Stage_Argorok 13 61 | #define Stage_Aeralfos 14 62 | #define Stage_Palace_of_Twilight 15 63 | #define Stage_Zant_Main 16 64 | #define Stage_Phantom_Zant_1 17 65 | #define Stage_Phantom_Zant_2 18 66 | #define Stage_Zant_Fight 19 67 | #define Stage_Hyrule_Castle 20 68 | #define Stage_Ganondorf_Castle 21 69 | #define Stage_Ganondorf_Field 22 70 | #define Stage_Ganondorf_Defeated 23 71 | #define Stage_Arbiters_Grounds 24 72 | #define Stage_Stallord 25 73 | #define Stage_Death_Sword 26 74 | #define Stage_Snowpeak_Ruins 27 75 | #define Stage_Blizzeta 28 76 | #define Stage_Darkhammer 29 77 | #define Stage_Lanayru_Ice_Puzzle_Cave 30 78 | #define Stage_Cave_of_Ordeals 31 79 | #define Stage_Eldin_Long_Cave 32 80 | #define Stage_Lake_Hylia_Long_Cave 33 81 | #define Stage_Eldin_Goron_Stockcave 34 82 | #define Stage_Grotto_1 35 83 | #define Stage_Grotto_2 36 84 | #define Stage_Grotto_3 37 85 | #define Stage_Grotto_4 38 86 | #define Stage_Grotto_5 39 87 | #define Stage_Faron_Woods_Cave 40 88 | #define Stage_Ordon_Ranch 41 89 | #define Stage_Title_Screen 42 90 | #define Stage_Ordon_Village 43 91 | #define Stage_Ordon_Spring 44 92 | #define Stage_Faron_Woods 45 93 | #define Stage_Kakariko_Village 46 94 | #define Stage_Death_Mountain 47 95 | #define Stage_Kakariko_Graveyard 48 96 | #define Stage_Zoras_River 49 97 | #define Stage_Zoras_Domain 50 98 | #define Stage_Snowpeak 51 99 | #define Stage_Lake_Hylia 52 100 | #define Stage_Castle_Town 53 101 | #define Stage_Sacred_Grove 54 102 | #define Stage_Bublin_Camp 55 103 | #define Stage_Hyrule_Field 56 104 | #define Stage_Outside_Castle_Town 57 105 | #define Stage_Bublin_2 58 106 | #define Stage_Gerudo_Desert 59 107 | #define Stage_Mirror_Chamber 60 108 | #define Stage_Upper_Zoras_River 61 109 | #define Stage_Fishing_Pond 62 110 | #define Stage_Hidden_Village 63 111 | #define Stage_Hidden_Skill 64 112 | #define Stage_Ordon_Interiors 65 113 | #define Stage_Hyrule_Castle_Sewers 66 114 | #define Stage_Coros_Lantern_Shop 67 115 | #define Stage_Kakariko_Interiors 68 116 | #define Stage_Death_Mountain_Sumo_Hall 69 117 | #define Stage_Castle_Town_Interiors 70 118 | #define Stage_Henas_Cabin 71 119 | #define Stage_Impaz_House 72 120 | #define Stage_Castle_Town_Shops 73 121 | #define Stage_Star_Game 74 122 | #define Stage_Sanctuary_Basement 75 -------------------------------------------------------------------------------- /include/eventListener.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::event 6 | { 7 | /** 8 | * Runs when the according event triggers 9 | */ 10 | typedef void ( *EventFunction )(); 11 | 12 | enum LoadEventAccuracy : u8 13 | { 14 | All = 0, 15 | Stage = 1, 16 | Stage_Room = 2, 17 | Stage_Room_Spawn = 3, 18 | Stage_Room_Spawn_State = 4 19 | }; 20 | 21 | struct LoadEvent 22 | { 23 | char* Stage; 24 | u8 Room; 25 | u8 Spawn; 26 | u8 State; 27 | u8 Eventid; // Cutscene event id 28 | EventFunction Trigger; 29 | LoadEventAccuracy Accuracy; 30 | }; 31 | 32 | class EventListener 33 | { 34 | private: 35 | u8 loadEventIndex; 36 | LoadEvent loadEvents[MAX_LOAD_EVENTS]; 37 | 38 | public: 39 | EventListener(); 40 | 41 | /** 42 | * Runs a loop that triggers the according event if it's conditions match 43 | */ 44 | void checkLoadEvents(); 45 | 46 | /** 47 | * Executes a function when certain load conditions match 48 | * 49 | * @param stage The stage identifier (internal id) 50 | * @param room The room identifier (internal room id) 51 | * @param spawn The spawnpoint identifier (internal spawn id) 52 | * @param state The state (internal state id) 53 | * @param csevent If it's a CS this is the id 54 | * @param trigger The (void) function(void) to be executed when the event occurs 55 | * @param accuracy Defines which of the identifiers have to match for the event to trigger 56 | */ 57 | void addLoadEvent( char* stage, 58 | u8 room, 59 | u8 spawn, 60 | u8 state, 61 | u8 eventid, 62 | EventFunction trigger, 63 | LoadEventAccuracy accuracy = LoadEventAccuracy::All ); 64 | }; 65 | } // namespace mod::event -------------------------------------------------------------------------------- /include/game_patches.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "defines.h" 7 | 8 | /** 9 | * Contains functions that fix certain cutscenes 10 | * those functions should only run when the CS 11 | * is currently playing and tried to be skipped by the user 12 | */ 13 | namespace mod::cutscene_skip 14 | { 15 | /** 16 | * Runs when master sword CS is skipped 17 | */ 18 | s32 onMasterSwordSkip( void* unk, s32 unk2 ); 19 | } // namespace mod::cutscene_skip 20 | 21 | /** 22 | * Contains patch functions that take no parameters 23 | * and immediately perfom the described action 24 | */ 25 | namespace mod::game_patch 26 | { 27 | /** 28 | * Enables the debug screen without 29 | * active debug mode; It triggers 30 | * automatically when crashing 31 | */ 32 | void assemblyOverwrites(); 33 | 34 | /** 35 | * Kills spider at links house 36 | */ 37 | void killLinkHouseSpider(); 38 | 39 | /** 40 | * Increasees Links climbing speed 41 | */ 42 | void increaseClimbSpeed(); 43 | 44 | /** 45 | * Removes the movementspeed limit 46 | * when wearing IB 47 | */ 48 | void removeIBLimit(); 49 | 50 | /** 51 | * Changes the max rupee amounts for each 52 | * of the wallets 53 | */ 54 | void increaseWalletSize(); 55 | 56 | /** 57 | * Skips sewers immediately 58 | * triggers the load to Ordon Spring 59 | * and sets the flags accordingly 60 | */ 61 | void skipSewers(); 62 | 63 | /** 64 | * Adds the chests that disappear after KB3 65 | * changes the state of faron from 1 to 3 66 | */ 67 | void setBublinState(); 68 | 69 | /** 70 | * Sets the flag after Ilia CS 71 | * which tells the game that you started 72 | * with sewers 73 | */ 74 | void setFirstTimeWolf(); 75 | 76 | /** 77 | * Sets form to human 78 | */ 79 | void setHuman(); 80 | 81 | /** 82 | * Sets form to wolf 83 | */ 84 | void setWolf(); 85 | 86 | /** 87 | * Activates the sense button (X) 88 | * for Wolf Link 89 | */ 90 | void giveSense(); 91 | 92 | /** 93 | * Tames Epona 94 | */ 95 | void giveEpona(); 96 | 97 | /** 98 | * Gives Master Sword and equips it 99 | */ 100 | void giveMasterSword(); 101 | 102 | /** 103 | * Gives Midna and sets the according sewers flag 104 | * Makes her appear on Z 105 | */ 106 | void giveMidna(); 107 | 108 | /** 109 | * Gives Midna Text that allows transformation 110 | */ 111 | void giveMidnaTransform(); 112 | 113 | /** 114 | * Removes the locks from the 2 bulblin gates in HF 115 | * change doesn't get saved so set it evry time you load into HF 116 | */ 117 | void setFieldBits(); 118 | 119 | /** 120 | * when spawning in goats 2, will warp you to Illia taking Epona CS 121 | */ 122 | void skipGoats(); 123 | 124 | /** 125 | * opens the door the the master sword in sacred grove 126 | */ 127 | void setGroveFlags(); 128 | 129 | /** 130 | * when you spawn into the Cart Escort, game will spawn you in Kakariko Afterwards 131 | */ 132 | void skipCartEscort(); 133 | 134 | /** 135 | * warps player to Lanayru twilight gate if they don't have MS 136 | */ 137 | void setLanayruWolf(); 138 | 139 | /** 140 | * Fixes the cannon and puts it at lake hylia 141 | */ 142 | void earlyCiTS(); 143 | 144 | /** 145 | * Fyer will let you go to the desert if you have MS 146 | */ 147 | void earlyDesert(); 148 | 149 | /** 150 | * give boss key to all dungeons 151 | */ 152 | void checkBossKeysey(); 153 | 154 | /** 155 | * check whether you have MS before being allowed to enter the desert 156 | */ 157 | void accessDesert(); 158 | 159 | /** 160 | * skips midna text and story CS 161 | */ 162 | void skipTextAndCS(); 163 | 164 | /** 165 | * escort avalable at any time 166 | */ 167 | void setEscortState(); 168 | 169 | /** 170 | * skips the zant CS for MDH 171 | */ 172 | void skipMDHCS(); 173 | 174 | /** 175 | * won't allow you to leave the forest if Faron escape is disabled until you beat Diababa 176 | */ 177 | void allowFaronEscape(); 178 | 179 | /** 180 | * set MDH skip after Lanayru Twilight 181 | */ 182 | void skipMDH(); 183 | 184 | /** 185 | * unset the story flag and boss flag when re-entering a dungeon 186 | */ 187 | void setLanternFlag(); 188 | 189 | void breakBarrier(); 190 | 191 | void setCustomItemData(); 192 | 193 | void setCustomItemFunctions(); 194 | 195 | extern u16 dungeonStoryFlags[8]; 196 | 197 | } // namespace mod::game_patch -------------------------------------------------------------------------------- /include/gc/OSCache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace gc::os_cache 6 | { 7 | extern "C" 8 | { 9 | // DCEnable 10 | // DCInvalidateRange 11 | void DCFlushRange( void* startAddr, u32 nBytes ); 12 | // DCStoreRange 13 | // DCFlushRangeNoSync 14 | // DCStoreRangeNoSync 15 | // DCZeroRange 16 | void ICInvalidateRange( void* startAddr, u32 nBytes ); 17 | // ICFlashInvalidate 18 | // ICEnable 19 | // __LCEnable 20 | // LCEnable 21 | // LCDisable 22 | // LCStoreBlocks 23 | // LCStoreData 24 | // LCQueueWait 25 | // L2GlobalInvalidate 26 | // DMAErrorHandler 27 | // __OSCacheInit 28 | } 29 | } // namespace gc::os_cache -------------------------------------------------------------------------------- /include/gc/OSModule.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace gc::OSModule 6 | { 7 | struct OSModuleInfo 8 | { 9 | u32 id; 10 | OSModuleInfo* next; 11 | OSModuleInfo* prev; 12 | u32 numSections; 13 | u32 sectionInfoOffset; 14 | u32 nameOffset; 15 | u32 nameSize; 16 | u32 version; 17 | } __attribute__( ( __packed__ ) ); 18 | 19 | } // namespace gc::OSModule -------------------------------------------------------------------------------- /include/gc/bmgres.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace gc::bmgres 6 | { 7 | struct FileHeader 8 | { 9 | u8 misc[0x100]; // Very start of the file; Should define at some point 10 | } __attribute__((__packed__)); 11 | 12 | struct BMGHeader 13 | { 14 | char signature[4]; 15 | char identifier[4]; 16 | u32 dataSize; 17 | u32 numBlocks; 18 | u8 charset; 19 | u8 unk_11; 20 | u16 unk_12; 21 | s32 unk_14[2]; 22 | s32 unk_1c; 23 | } __attribute__((__packed__)); 24 | 25 | struct MessageEntry 26 | { 27 | u32 offsetToMessage; 28 | u16 messageId; 29 | u8 unk[0xE]; 30 | } __attribute__((__packed__)); 31 | 32 | struct TextIndexTable 33 | { 34 | char kind[4]; // Should be INF1 in ASCII 35 | u32 size; 36 | u16 numEntries; 37 | u16 entrySize; 38 | u16 groupId; 39 | u8 defaultColor; 40 | u8 unk; 41 | MessageEntry entry[]; // Amount of entries is numEntries 42 | } __attribute__((__packed__)); 43 | 44 | static_assert(sizeof(FileHeader) == 0x100); 45 | static_assert(sizeof(BMGHeader) == 0x20); 46 | static_assert(sizeof(MessageEntry) == 0x14); 47 | } 48 | -------------------------------------------------------------------------------- /include/global.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "HUDConsole.h" 4 | #include "chestRando.h" 5 | #include "eventListener.h" 6 | #include "game_patches.h" 7 | #include "mod.h" 8 | 9 | namespace mod::global 10 | { 11 | extern mod::Mod* modPtr; 12 | extern mod::ChestRandomizer* chestRandoPtr; 13 | extern mod::event::EventListener* eventListenerPtr; 14 | extern mod::HUDConsole* hudConsolePtr; 15 | extern uint64_t* seedInSaveFile; 16 | } // namespace mod::global -------------------------------------------------------------------------------- /include/grottoChecks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::grottoChecks 6 | { 7 | extern u16 g1_0[1]; // Lanayru2 8 | extern u16 g1_1[2]; // Eldin2 9 | extern u16 g1_2[1]; // Ordon 10 | extern u16 g1_3[2]; // Lanayru3 11 | 12 | extern u16 g2_0[3]; // Eldin4 13 | extern u16 g2_1[3]; // Faron1 14 | extern u16 g2_2[1]; // Sacred 15 | // extern u16 g2_3[0];//Eldin1 16 | 17 | extern u16 g3_0[3]; // Gerudo3 18 | // extern u16 g3_1[0];//Gerudo2 19 | // extern u16 g3_2[0];//Snowpeak2 20 | // extern u16 g3_3[0];//Lanayru5 21 | 22 | extern u16 g4_0[1]; // Lanayru6 23 | extern u16 g4_1[1]; // Gerudo1 24 | extern u16 g4_2[1]; // Snowpeak1 25 | extern u16 g4_3[1]; // Lanayru4 26 | 27 | extern u16 g5_0[1]; // Lanayru1 28 | // extern u16 g5_1[0];//Faron2 29 | extern u16 g5_2[1]; // Lake2 30 | extern u16 g5_3[1]; // Eldin3 31 | extern u16 g5_4[1]; // Lake1 32 | } // namespace mod::grottoChecks -------------------------------------------------------------------------------- /include/item.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::item 6 | { 7 | /** 8 | * Returns the flag(s) to an item under certain conditions 9 | * 10 | * @param item Internal item ID 11 | * @param currentPlayerConditions Current conditions of the player 12 | */ 13 | u32 getFlags( u8 item, u32 currentPlayerConditions ); 14 | 15 | /** 16 | * Bitwise conditions for ItemCheck 17 | */ 18 | enum Condition : u32 19 | { 20 | OR = 0b000000000000000000000, 21 | AND = 0b100000000000000000000, 22 | Lantern = 0b010000000000000000000, // 0x48 23 | Iron_Boots = 0b001000000000000000000, // 0x45 24 | Boomerang = 0b000100000000000000000, // 0x40 25 | Slingshot = 0b000010000000000000000, // 0x4B 26 | Bow = 0b000001000000000000000, // 0x43 27 | Bombs = 0b000000100000000000000, // 0x70 0x51 28 | Water_Bombs = 0b000000010000000000000, // 0x70 0x51 29 | Bomb_Arrows = 0b000000001000000000000, // 0x43 0x70 0x51 30 | Ball_And_Chain = 0b000000000100000000000, // 0x42 31 | Clawshot = 0b000000000010000000000, // 0x44 32 | Double_Clawshot = 0b000000000001000000000, // 0x47 33 | Spinner = 0b000000000000100000000, // 0x41 34 | Dominion_Rod = 0b000000000000010000000, // 0x46 35 | Zora_Armor = 0b000000000000001000000, // 0x31 36 | Small_Key = 0b000000000000000100000, // locked 37 | Coral_Earring = 0b000000000000000010000, // 0x3D 38 | Wooden_Sword = 0b000000000000000001000, // 0x3F 39 | Ordon_Sword = 0b000000000000000000100, // 0x28 40 | Shadow_Crystal = 0b000000000000000000010, // 0x32 41 | Shield = 0b000000000000000000001, // 0x2C 42 | }; 43 | 44 | enum ItemType : u8 45 | { 46 | Equip = 0, 47 | Gear = 1, 48 | Dungeon = 2, 49 | HeartPiece = 3, 50 | Story = 4, 51 | Ammo = 5, 52 | Misc = 6, 53 | Rupee = 7, 54 | Key = 8, 55 | Bottle = 9, 56 | Bug = 10, 57 | PoeSoul = 11, 58 | Shop = 12, 59 | Skill = 13, 60 | Scent = 14 61 | }; 62 | 63 | /** 64 | * Contains item check info 65 | */ 66 | struct ItemCheck 67 | { 68 | u8 itemID; 69 | u8 type; 70 | char* stage; 71 | u8 room; 72 | u8 sourceLayer; 73 | u8 destLayer; 74 | u32 condition; 75 | float position[3]; 76 | ItemCheck* source; 77 | ItemCheck* destination; 78 | }; 79 | 80 | enum class NodeDungeonItemType : u8 81 | { 82 | Small_Key, 83 | Dungeon_Map, 84 | Compass, 85 | Big_Key 86 | }; 87 | 88 | /** 89 | * Contains the values for the flags to be set to skip the animations of first getting specific items 90 | */ 91 | extern u8 itemGetAnimationFlags[10]; 92 | 93 | extern u8 customSmallKeyItemIDs[10]; 94 | extern u8 customBigKeyItemIDs[7]; 95 | extern u8 customDungeonMapItemIDs[9]; 96 | extern u8 customCompassItemIDs[9]; 97 | extern u8 customHiddenSkillItemIDs[7]; 98 | } // namespace mod::item -------------------------------------------------------------------------------- /include/itemChecks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | #include "item.h" 5 | 6 | namespace mod::item 7 | { 8 | extern ItemCheck checks[503]; 9 | extern u16 checkPriorityOrder[24]; 10 | } // namespace mod::item -------------------------------------------------------------------------------- /include/items.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::items 6 | { 7 | enum Item : u8 8 | { 9 | Recovery_Heart = 0x00, 10 | Green_Rupee = 0x01, 11 | Blue_Rupee = 0x02, 12 | Yellow_Rupee = 0x03, 13 | Red_Rupee = 0x04, 14 | Purple_Rupee = 0x05, 15 | Orange_Rupee = 0x06, 16 | Silver_Rupee = 0x07, 17 | /*Small Magic = 0x08,*/ 18 | /*Large Magic = 0x09,*/ 19 | Bombs_5 = 0x0A, 20 | Bombs_10 = 0x0B, 21 | Bombs_20 = 0x0C, 22 | Bombs_30 = 0x0D, 23 | Arrows_10 = 0x0E, 24 | Arrows_20 = 0x0F, 25 | Arrows_30 = 0x10, 26 | Arrows_1 = 0x11, 27 | Seeds_50 = 0x12, 28 | /*? = 0x13,*/ 29 | /*? = 0x14,*/ 30 | /*? = 0x15,*/ 31 | Water_Bombs_5 = 0x16, 32 | Water_Bombs_10 = 0x17, 33 | Water_Bombs_15 = 0x18, 34 | Water_Bombs_3 = 0x19, 35 | Bomblings_5 = 0x1A, 36 | Bomblings_10 = 0x1B, 37 | Bomblings_3 = 0x1C, 38 | Bombling_1 = 0x1D, 39 | Fairy = 0x1E, 40 | Recovery_Heart_x3 = 0x1F, 41 | Small_Key = 0x20, 42 | Piece_of_Heart = 0x21, 43 | Heart_Container = 0x22, 44 | Dungeon_Map = 0x23, 45 | Compass = 0x24, 46 | Ooccoo_FT = 0x25, 47 | Big_Key = 0x26, 48 | Ooccoo_Jr = 0x27, 49 | Ordon_Sword = 0x28, 50 | Master_Sword = 0x29, 51 | Ordon_Shield = 0x2A, 52 | Wooden_Shield = 0x2B, 53 | Hylian_Shield = 0x2C, 54 | Ooccoos_Note = 0x2D, 55 | Ordon_Clothing = 0x2E, 56 | Heros_Clothes = 0x2F, 57 | Magic_Armor = 0x30, 58 | Zora_Armor = 0x31, 59 | Shadow_Crystal = 0x32, // Does nothing in Vanilla. Is used to handle the transformation flag in the Randomizer. 60 | Ooccoo_Dungeon = 0x33, 61 | Small_Wallet = 0x34, // Unused 62 | Big_Wallet = 0x35, 63 | Giant_Wallet = 0x36, 64 | /*Piece_of_Heart_2? = 0x37,*/ 65 | /*Piece_of_Heart_3? = 0x38,*/ 66 | /*Piece_of_Heart_4? = 0x39,*/ 67 | /*Piece_of_Heart_5? = 0x3A,*/ 68 | /*sword? = 0x3B,*/ 69 | /*? = 0x3C,*/ 70 | Coral_Earring = 0x3D, 71 | Hawkeye = 0x3E, 72 | Wooden_Sword = 0x3F, 73 | Boomerang = 0x40, 74 | Spinner = 0x41, 75 | Ball_and_Chain = 0x42, 76 | Heros_Bow = 0x43, 77 | Clawshot = 0x44, 78 | Iron_Boots = 0x45, 79 | Dominion_Rod = 0x46, 80 | Clawshots = 0x47, 81 | Lantern = 0x48, 82 | Master_Sword_Light = 0x49, 83 | Fishing_Rod = 0x4A, 84 | Slingshot = 0x4B, 85 | Dominion_Rod_Uncharged = 0x4C, 86 | /*? = 0x4D,*/ 87 | /*? = 0x4E,*/ 88 | Giant_Bomb_Bag = 0x4F, 89 | Empty_Bomb_Bag = 0x50, 90 | Goron_Bomb_Bag = 0x51, 91 | /*Giant_Bomb_Bag? = 0x52,*/ 92 | /*? = 0x53,*/ 93 | Small_Quiver = 0x54, // Unused 94 | Big_Quiver = 0x55, 95 | Giant_Quiver = 0x56, 96 | /*? = 0x57,*/ 97 | Fishing_Rod_Lure = 0x58, 98 | Bow_Bombs = 0x59, 99 | Bow_Hawkeye = 0x5A, 100 | Fishing_Rod_Bee_Larva = 0x5B, 101 | Fishing_Rod_Coral_Earring = 0x5C, 102 | Fishing_Rod_Worm = 0x5D, 103 | Fishing_Rod_Earring_Bee_Larva = 0x5E, 104 | Fishing_Rod_Earring_Worm = 0x5F, 105 | Empty_Bottle = 0x60, 106 | Red_Potion_Shop = 0x61, 107 | Green_Potion = 0x62, 108 | Blue_Potion = 0x63, 109 | Milk = 0x64, 110 | Sera_Bottle = 0x65, 111 | Lantern_Oil_Shop = 0x66, 112 | Water = 0x67, 113 | Lantern_Oil_Scooped = 0x68, 114 | Red_Potion_Scooped = 0x69, 115 | Nasty_soup = 0x6A, 116 | Hot_spring_water_Scooped = 0x6B, 117 | Fairy_Bottle = 0x6C, 118 | Hot_Spring_Water_Shop = 0x6D, 119 | Lantern_Refill_Scooped = 0x6E, 120 | Lantern_Refill_Shop = 0x6F, 121 | Bomb_Bag_Regular_Bombs = 0x70, 122 | Bomb_Bag_Water_Bombs = 0x71, 123 | Bomb_Bag_Bomblings = 0x72, 124 | Fairy_Tears = 0x73, 125 | Worm = 0x74, 126 | Jovani_Bottle = 0x75, 127 | Bee_Larva_Scooped = 0x76, 128 | Rare_Chu_Jelly = 0x77, 129 | Red_Chu_Jelly = 0x78, 130 | Blue_Chu_Jelly = 0x79, 131 | Green_Chu_Jelly = 0x7A, 132 | Yellow_Chu_Jelly = 0x7B, 133 | Purple_Chu_Jelly = 0x7C, 134 | Simple_Soup = 0x7D, 135 | Good_Soup = 0x7E, 136 | Superb_Soup = 0x7F, 137 | Renardos_Letter = 0x80, 138 | Invoice = 0x81, 139 | Wooden_Statue = 0x82, 140 | Ilias_Charm = 0x83, 141 | Horse_Call = 0x84, 142 | Forest_Temple_Small_Key = 0x85, // Custom Item added for the Randomizer. 143 | Goron_Mines_Small_Key = 0x86, // Custom Item added for the Randomizer. 144 | Lakebed_Temple_Small_Key = 0x87, // Custom Item added for the Randomizer. 145 | Arbiters_Grounds_Small_Key = 0x88, // Custom Item added for the Randomizer. 146 | Snowpeak_Ruins_Small_Key = 0x89, // Custom Item added for the Randomizer. 147 | Temple_of_Time_Small_Key = 0x8A, // Custom Item added for the Randomizer. 148 | City_in_The_Sky_Small_Key = 0x8B, // Custom Item added for the Randomizer. 149 | Palace_of_Twilight_Small_Key = 0x8C, // Custom Item added for the Randomizer. 150 | Hyrule_Castle_Small_Key = 0x8D, // Custom Item added for the Randomizer. 151 | Bublin_Camp_Key = 0x8E, // Custom Item added for the Randomizer. 152 | Foolish_Item = 0x8F, // Custom Item added for the Randomizer. 153 | Aurus_Memo = 0x90, 154 | Asheis_Sketch = 0x91, 155 | Forest_Temple_Big_Key = 0x92, // Custom Item added for the Randomizer. 156 | Lakebed_Temple_Big_Key = 0x93, // Custom Item added for the Randomizer. 157 | Arbiters_Grounds_Big_Key = 0x94, // Custom Item added for the Randomizer. 158 | Temple_of_Time_Big_Key = 0x95, // Custom Item added for the Randomizer. 159 | City_in_The_Sky_Big_Key = 0x96, // Custom Item added for the Randomizer. 160 | Palace_of_Twilight_Big_Key = 0x97, // Custom Item added for the Randomizer. 161 | Hyrule_Castle_Big_Key = 0x98, // Custom Item added for the Randomizer. 162 | Forest_Temple_Compass = 0x99, // Custom Item added for the Randomizer. 163 | Goron_Mines_Compass = 0x9A, // Custom Item added for the Randomizer. 164 | Lakebed_Temple_Compass = 0x9B, // Custom Item added for the Randomizer. 165 | Lantern_Yellow_Chu_Chu = 0x9C, 166 | Coro_Bottle = 0x9D, 167 | Bee_Larva_Shop = 0x9E, 168 | Black_Chu_Jelly = 0x9F, 169 | /*unused*/ Tear_Of_Light = 0xA0, 170 | Vessel_Of_Light_Faron = 0xA1, 171 | Vessel_Of_Light_Eldin = 0xA2, 172 | Vessel_Of_Light_Lanayru = 0xA3, 173 | /*unused*/ Vessel_Of_Light_Full = 0xA4, 174 | /*unused*/ Mirror_Piece_2 = 0xA5, 175 | /*unused*/ Mirror_Piece_3 = 0xA6, 176 | /*unused*/ Mirror_Piece_4 = 0xA7, 177 | Arbiters_Grounds_Compass = 0xA8, // Custom Item added for the Randomizer. 178 | Snowpeak_Ruins_Compass = 0xA9, // Custom Item added for the Randomizer. 179 | Temple_of_Time_Compass = 0xAA, // Custom Item added for the Randomizer. 180 | City_in_The_Sky_Compass = 0xAB, // Custom Item added for the Randomizer. 181 | Palace_of_Twilight_Compass = 0xAC, // Custom Item added for the Randomizer. 182 | Hyrule_Castle_Compass = 0xAD, // Custom Item added for the Randomizer. 183 | /*? = 0xAE,*/ 184 | /*? = 0xAF,*/ 185 | Ilias_Scent = 0xB0, 186 | /*Unused_Scent? = 0xB1,*/ 187 | Poe_Scent = 0xB2, 188 | Reekfish_Scent = 0xB3, 189 | Youths_Scent = 0xB4, 190 | Medicine_Scent = 0xB5, 191 | Forest_Temple_Dungeon_Map = 0xB6, // Custom Item added for the Randomizer. 192 | Goron_Mines_Dungeon_Map = 0xB7, // Custom Item added for the Randomizer. 193 | Lakebed_Temple_Dungeon_Map = 0xB8, // Custom Item added for the Randomizer. 194 | Arbiters_Grounds_Dungeon_Map = 0xB9, // Custom Item added for the Randomizer. 195 | Snowpeak_Ruins_Dungeon_Map = 0xBA, // Custom Item added for the Randomizer. 196 | Temple_of_Time_Dungeon_Map = 0xBB, // Custom Item added for the Randomizer. 197 | City_in_The_Sky_Dungeon_Map = 0xBC, // Custom Item added for the Randomizer. 198 | Palace_of_Twilight_Dungeon_Map = 0xBD, // Custom Item added for the Randomizer. 199 | Hyrule_Castle_Dungeon_Map = 0xBE, // Custom Item added for the Randomizer. 200 | /*Bottle_Insides? = 0xBF,*/ 201 | Male_Beetle = 0xC0, 202 | Female_Beetle = 0xC1, 203 | Male_Butterfly = 0xC2, 204 | Female_Butterfly = 0xC3, 205 | Male_Stag_Beetle = 0xC4, 206 | Female_Stag_Beetle = 0xC5, 207 | Male_Grasshopper = 0xC6, 208 | Female_Grasshopper = 0xC7, 209 | Male_Phasmid = 0xC8, 210 | Female_Phasmid = 0xC9, 211 | Male_Pill_Bug = 0xCA, 212 | Female_Pill_Bug = 0xCB, 213 | Male_Mantis = 0xCC, 214 | Female_Mantis = 0xCD, 215 | Male_Ladybug = 0xCE, 216 | Female_Ladybug = 0xCF, 217 | Male_Snail = 0xD0, 218 | Female_Snail = 0xD1, 219 | Male_Dragonfly = 0xD2, 220 | Female_Dragonfly = 0xD3, 221 | Male_Ant = 0xD4, 222 | Female_Ant = 0xD5, 223 | Male_Dayfly = 0xD6, 224 | Female_Dayfly = 0xD7, 225 | /*? = 0xD8,*/ 226 | /*? = 0xD9,*/ 227 | /*? = 0xDA,*/ 228 | /*? = 0xDB,*/ 229 | /*? = 0xDC,*/ 230 | /*? = 0xDD,*/ 231 | /*? = 0xDE,*/ 232 | /*? = 0xDF,*/ 233 | Poe_Soul = 0xE0, 234 | Ending_Blow = 0xE1, // Custom Item added for the Randomizer. 235 | Shield_Attack = 0xE2, // Custom Item added for the Randomizer. 236 | Back_Slice = 0xE3, // Custom Item added for the Randomizer. 237 | Helm_Splitter = 0xE4, // Custom Item added for the Randomizer. 238 | Mortal_Draw = 0xE5, // Custom Item added for the Randomizer. 239 | Jump_Strike = 0xE6, // Custom Item added for the Randomizer. 240 | Great_Spin = 0xE7, // Custom Item added for the Randomizer. 241 | /*? = 0xE8,*/ 242 | Ancient_Sky_Book_empty = 0xE9, 243 | Ancient_Sky_Book_partly_filled = 0xEA, 244 | Ancient_Sky_Book_completed = 0xEB, 245 | Ooccoo_CitS = 0xEC, 246 | Purple_Rupee_Links_house = 0xED, 247 | Small_Key_N_Faron_Gate = 0xEE, 248 | /*Blue_Fire? = 0xEF,*/ 249 | /*Blue_Fire? = 0xF0,*/ 250 | /*Blue_Fire? = 0xF1,*/ 251 | /*Blue_Fire? = 0xF2,*/ 252 | Gate_Keys = 0xF3, 253 | Ordon_Pumpkin = 0xF4, 254 | Ordon_Goat_Cheese = 0xF5, 255 | Bed_Key = 0xF6, 256 | /*Shield? = 0xF7,*/ 257 | Got_Lantern_Back = 0xF8, 258 | Key_Shard_1 = 0xF9, 259 | Key_Shard_2 = 0xFA, 260 | Key_Shard_3 = 0xFB, 261 | /*Key? = 0xFC,*/ 262 | Big_Key_Goron_Mines = 0xFD, 263 | Coro_Key = 0xFE, 264 | /*Gives_Vanilla*/ NullItem = 0xFF 265 | }; 266 | } -------------------------------------------------------------------------------- /include/keyPlacement.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::keyPlacement 6 | { 7 | extern u16 FT_keys[4]; 8 | extern u16 FT_1[5]; 9 | extern u16 FT_2[5]; 10 | extern u16 FT_3[9]; 11 | extern u16 FT_4[9]; 12 | 13 | extern u16 GM_keys[3]; 14 | extern u16 GM_1[2]; 15 | extern u16 GM_2[10]; 16 | extern u16 GM_3[12]; 17 | 18 | extern u16 LBT_keys[3]; 19 | extern u16 LBT_1[7]; 20 | extern u16 LBT_2[9]; 21 | extern u16 LBT_3[11]; 22 | 23 | extern u16 AG_keys[5]; 24 | extern u16 AG_1[1]; 25 | extern u16 AG_2[7]; 26 | extern u16 AG_3[9]; 27 | extern u16 AG_4[11]; 28 | extern u16 AG_5[16]; 29 | 30 | extern u16 SPR_keys[6]; 31 | extern u16 SPR_1[5]; 32 | extern u16 SPR_2[6]; 33 | extern u16 SPR_3[10]; 34 | extern u16 SPR_4[13]; 35 | extern u16 SPR_5[19]; 36 | extern u16 SPR_6[22]; 37 | 38 | extern u16 ToT_keys[3]; 39 | extern u16 ToT_1[2]; 40 | extern u16 ToT_2[8]; 41 | extern u16 ToT_3[16]; 42 | 43 | extern u16 CitS_keys[1]; 44 | extern u16 CitS_1[7]; 45 | 46 | extern u16 PoT_keys[7]; 47 | extern u16 PoT_1[1]; 48 | extern u16 PoT_2[4]; 49 | extern u16 PoT_3[6]; 50 | extern u16 PoT_4[10]; 51 | extern u16 PoT_5[14]; 52 | extern u16 PoT_6[16]; 53 | extern u16 PoT_7[17]; 54 | 55 | extern u16 HC_keys[3]; 56 | extern u16 HC_1[9]; 57 | extern u16 HC_2[15]; 58 | extern u16 HC_3[15]; 59 | 60 | extern u16 F_keys[2]; 61 | extern u16 F_1[4]; 62 | extern u16 F_2[2]; 63 | 64 | extern u16 GD_keys[1]; 65 | extern u16 GD_1[21]; 66 | 67 | } // namespace mod::keyPlacement -------------------------------------------------------------------------------- /include/memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::memory 6 | { 7 | extern "C" 8 | { 9 | void* clearMemory( void* ptr, size_t size ); 10 | void clear_DC_IC_Cache( void* ptr, u32 size ); 11 | } 12 | } // namespace mod::memory -------------------------------------------------------------------------------- /include/mod.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "HUDConsole.h" 11 | #include "chestRando.h" 12 | #include "defines.h" 13 | #include "eventListener.h" 14 | 15 | namespace mod 16 | { 17 | class Mod 18 | { 19 | public: 20 | Mod(); 21 | /** 22 | * Init this and other stuff in order for all 23 | * modifications to work 24 | */ 25 | void init(); 26 | 27 | /** 28 | * Custom event listener that can 29 | * schedule function calls 30 | */ 31 | event::EventListener* eventListener; 32 | ChestRandomizer* chestRandomizer; 33 | HUDConsole* hudConsole; 34 | 35 | // Options 36 | u8 customSeed; // Use custom seed? 37 | u8 randoEnabled; // Randomize chests? 38 | u8 truePause; // Disable controls during console? 39 | u8 inputBuffering; // En/Disable buffering 40 | 41 | // item search 42 | u8 lastItemSearchID; 43 | u8 itemSearchID; 44 | 45 | u8 lastItemReverseSearchID; 46 | u8 itemReverseSearchID; 47 | char itemSearchResults[30]; 48 | char itemReverseSearchResults[30]; 49 | 50 | // check search 51 | u8 checkSearchID1; 52 | u8 checkSearchID2; 53 | 54 | u8 checkReverseSearchID1; 55 | u8 checkReverseSearchID2; 56 | 57 | u16 lastCheckSearchID; 58 | u16 checkSearchID; 59 | 60 | u16 lastCheckReverseSearchID; 61 | u16 checkReverseSearchID; 62 | char checkSearchResults[30]; 63 | char checkReverseSearchResults[30]; 64 | 65 | // Debug info 66 | char lastItemFunc[32]; // Last called item create function 67 | char lastItemDataID[5]; 68 | char lastItemDataX[30]; 69 | char lastItemDataY[30]; 70 | char lastItemDataZ[30]; 71 | 72 | char currentPosX[30]; 73 | char currentPosY[30]; 74 | char currentPosZ[30]; 75 | 76 | char linkAngle[30]; 77 | 78 | u8 coordsAreInHex = 0; 79 | 80 | // Replacment handler 81 | s32 procItemCreateFunc( const float pos[3], s32 item, const char funcIdentifier[32] ); 82 | 83 | u8 enableNormalTime = 1; 84 | u8 setDay = 1; 85 | 86 | u32 skyAngle; 87 | 88 | u8 enableQuickTransform = 1; 89 | 90 | u8 stage = 0; 91 | u8 room = 0; 92 | u8 spawn = 0; 93 | u8 state = 0; 94 | u8 trigerLoadSave = 0; 95 | 96 | u8 dungeonFlagsView1; 97 | u8 dungeonFlagsView2; 98 | u8 dungeonFlagsView3; 99 | u8 dungeonFlagsView4; 100 | u8 dungeonFlagsView5; 101 | u8 dungeonFlagsView6; 102 | u8 dungeonFlagsView7; 103 | u8 dungeonFlagsView8; 104 | u8 dungeonFlagsViewEdit; 105 | 106 | u16 colorResult; 107 | 108 | u8 topToggle = 1; 109 | u8 redTop = 0; 110 | u8 greenTop = 0; 111 | u8 blueTop = 0; 112 | u8 bottomToggle = 1; 113 | u8 redBottom = 0; 114 | u8 greenBottom = 0; 115 | u8 blueBottom = 0; 116 | 117 | u8 allowBottleItemsShopAnytime = 1; 118 | u8 shieldTrickOn = 0; 119 | u8 hadHShield; 120 | u8 hadOShield; 121 | u8 hadWShield; 122 | u8 bombBagTrickOn = 0; 123 | u8 bombBag1Contents; 124 | u8 bombBag2Contents; 125 | u8 bombBag3Contents; 126 | u8 bombBag1Ammo; 127 | u8 bombBag2Ammo; 128 | u8 bombBag3Ammo; 129 | u8 lastGoodSpawn; 130 | 131 | u8 yetaTrickOn = 0; 132 | 133 | u8 eventFlagToEdit = 0; 134 | u8 newValueForEventFlag = 0; 135 | u8 triggerEventFlagEdit = 0; 136 | u8 innerRed = 0x50; 137 | u8 innerGreen = 0x28; 138 | u8 innerBlue = 0x14; 139 | u8 outerRed = 0x28; 140 | u8 outerGreen = 0x1E; 141 | u8 outerBlue = 0x0A; 142 | 143 | char itemName[10]; 144 | // u8 newItemId; 145 | 146 | // Functions 147 | private: 148 | /** 149 | * Runs once each frame 150 | */ 151 | void procNewFrame(); 152 | 153 | /** 154 | * Runs when checking if the treasure chest content 155 | * should be returned or can be obtained 156 | */ 157 | bool procCheckTreasureRupeeReturn( void* unk1, s32 item ); 158 | 159 | s32 procEvtSkipper( void* evtPtr ); 160 | 161 | bool proc_query022( void* unk1, void* unk2, s32 unk3 ); 162 | 163 | bool proc_query023( void* unk1, void* unk2, s32 unk3 ); 164 | 165 | bool proc_query024( void* dMsgFlow_cPtr, void* mesg_flow_node_branchPtr, void* fopAc_ac_cPtr, int unused ); 166 | 167 | bool proc_query025( void* unk1, void* unk2, s32 unk3 ); 168 | 169 | bool proc_isDungeonItem( void* memBitPtr, const int param_1 ); 170 | 171 | bool procDoLink( tp::dynamic_link::DynamicModuleControl* dmc ); 172 | 173 | void procItem_func_UTUWA_HEART(); 174 | 175 | bool canQuickTransform(); 176 | 177 | bool canChangeToD(); 178 | 179 | s32 getMsgIndex( const void* TProcessor, u16 unk2, u32 msgId ); 180 | 181 | s32 getItemMsgIndex( const void* TProcessor, u16 unk2, u32 itemId ); 182 | 183 | s32 getItemIdFromMsgId( const void* TProcessor, u16 unk3, u32 msgId ); 184 | 185 | u32 getCustomMsgColor( u8 colorId ); 186 | 187 | s32 proc_checkItemGet( u8 item, s32 defaultValue ); 188 | 189 | bool proc_isEventBit( u8* eventSystem, u16 indexNumber ); 190 | 191 | /** 192 | * gives the unlocked scent that can be seen in the current area (defaults to most advanced one obtained) 193 | */ 194 | void giveAllStoryItems(); 195 | 196 | /** 197 | * order the item wheel correctly 198 | */ 199 | void reorderItemWheel(); 200 | 201 | /** 202 | * Allows Yeta to always be in the living room even with the BK 203 | * Allows Yeto to always be in the kitchen even with the BK 204 | */ 205 | void fixYetaAndYeto(); 206 | 207 | /** 208 | * removes the empty skybook if you are in the sanctuary basement 209 | */ 210 | void preventPoweringUpDomRod(); 211 | 212 | /** 213 | * gives the unlocked scent that can be seen in the current area (defaults to most advanced one obtained) 214 | */ 215 | void giveAllScents(); 216 | 217 | /** 218 | * checks if the current stage contains a shop 219 | */ 220 | bool isStageShop(); 221 | 222 | /** 223 | * Inserts custom TRES Boxes if applicable to this stage+room 224 | */ 225 | void doCustomTRESActor( void* mStatus_roomControl ); 226 | 227 | void changeLanternColor(); 228 | 229 | // Private members 230 | // private: 231 | 232 | // Hook trampolines 233 | private: 234 | void ( *fapGm_Execute_trampoline )() = nullptr; 235 | 236 | s32 ( *evt_control_Skipper_trampoline )( void* eventPtr ) = nullptr; 237 | 238 | bool ( *query022_trampoline )( void* unk1, void* unk2, s32 unk3 ) = nullptr; 239 | 240 | bool ( *query023_trampoline )( void* unk1, void* unk2, s32 unk3 ) = nullptr; 241 | 242 | bool ( *query024_trampoline )( void* dMsgFlow_cPtr, 243 | void* mesg_flow_node_branchPtr, 244 | void* fopAc_ac_cPtr, 245 | int unused ) = nullptr; 246 | 247 | bool ( *query025_trampoline )( void* unk1, void* unk2, s32 unk3 ) = nullptr; 248 | 249 | bool ( *do_link_trampoline )( tp::dynamic_link::DynamicModuleControl* dmc ) = nullptr; 250 | 251 | bool ( *checkTreasureRupeeReturn_trampoline )( void* unk1, s32 item ) = nullptr; 252 | 253 | void ( *item_func_UTUWA_HEART_trampoline )() = nullptr; 254 | 255 | bool ( *actorCommonLayerInit_trampoline )( void* mStatus_roomControl, 256 | tp::d_stage::dzxChunkTypeInfo* chunkTypeInfo, 257 | int unk3, 258 | void* unk4 ) = nullptr; 259 | 260 | bool ( *actorInit_always_trampoline )( void* mStatus_roomControl, 261 | tp::d_stage::dzxChunkTypeInfo* chunkTypeInfo, 262 | int unk3, 263 | void* unk4 ) = nullptr; 264 | 265 | void ( *putSave_trampoline )( tp::d_com_inf_game::GameInfo* gameInfoPtr, s32 areaID ) = nullptr; 266 | 267 | // Item functions 268 | s32 ( *createItemForPresentDemo_trampoline )( const float pos[3], 269 | s32 item, 270 | u8 unk3, 271 | s32 unk4, 272 | s32 unk5, 273 | const float unk6[3], 274 | const float unk7[3] ) = nullptr; 275 | s32 ( *createItemForTrBoxDemo_trampoline )( const float pos[3], 276 | s32 item, 277 | s32 unk3, 278 | s32 unk4, 279 | const float unk5[3], 280 | const float unk6[3] ) = nullptr; 281 | s32 ( *createItemForBoss_trampoline )( const float pos[3], 282 | s32 item, 283 | s32 unk3, 284 | const float unk4[3], 285 | const float unk5[3], 286 | float unk6, 287 | float unk7, 288 | s32 unk8 ) = nullptr; 289 | s32 ( *createItemForMidBoss_trampoline )( const float pos[3], 290 | s32 item, 291 | s32 unk3, 292 | const float unk4[3], 293 | const float unk5[3], 294 | s32 unk6, 295 | s32 unk7 ) = nullptr; 296 | s32 ( *createItemForDirectGet_trampoline )( const float pos[3], 297 | s32 item, 298 | s32 unk3, 299 | const float unk4[3], 300 | const float unk5[3], 301 | float unk6, 302 | float unk7 ) = nullptr; 303 | s32 ( *createItemForSimpleDemo_trampoline )( const float pos[3], 304 | s32 item, 305 | s32 unk3, 306 | const float unk4[3], 307 | const float unk5[3], 308 | float unk6, 309 | float unk7 ) = nullptr; 310 | s32 ( *createItem_trampoline )( const float pos[3], 311 | s32 item, 312 | s32 unk3, 313 | s32 unk4, 314 | const float unk5[3], 315 | const float unk6[3], 316 | s32 unk7 ) = nullptr; 317 | 318 | void ( *setItemBombNumCount_trampoline )( u32 unk1, u8 bagNb, short amount ) = nullptr; 319 | 320 | bool ( *isDungeonItem_trampoline )( void* memBitPtr, int param_1 ) = nullptr; 321 | 322 | int ( *getLayerNo_common_common_trampoline )( const char* stageName, int roomId, int layerOverride ) = nullptr; 323 | 324 | bool ( *setMessageCode_inSequence_trampoline )( tp::control::TControl* control, 325 | const void* TProcessor, 326 | u16 unk3, 327 | u16 msgId ) = nullptr; 328 | 329 | u32 ( *getFontCCColorTable_trampoline )( u8 colorId, u8 unk ) = nullptr; 330 | u32 ( *getFontGCColorTable_trampoline )( u8 colorId, u8 unk ) = nullptr; 331 | 332 | s32 ( *checkItemGet_trampoline )( u8 item, s32 defaultValue ) = nullptr; 333 | 334 | char ( *parseCharacter1Byte_trampoline )( const char** text ) = nullptr; 335 | 336 | bool ( *isEventBit_trampoline )( u8* eventSystem, u16 indexNumber ) = nullptr; 337 | 338 | void ( *onEventBit_trampoline )( u8* eventSystem, u16 indexNumber ) = nullptr; 339 | 340 | void ( *setGetItemFace_trampoline )( void* daAlink_c, u16 itemId ) = nullptr; 341 | }; 342 | } // namespace mod -------------------------------------------------------------------------------- /include/musicRando.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "defines.h" 3 | 4 | namespace mod::musicrando 5 | { 6 | extern u8 musicRandoEnabled; 7 | extern u8 enemyBgmDisabled; 8 | extern u8 fanfareRandoEnabled; 9 | void initMusicRando(); 10 | } // namespace mod::musicrando -------------------------------------------------------------------------------- /include/patch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | #include "memory.h" 5 | 6 | namespace mod::patch 7 | { 8 | void writeBranch( void* ptr, void* destination ); 9 | void writeBranchLR( void* ptr, void* destination ); 10 | void writeBranchMain( void* ptr, void* destination, u32 branch ); 11 | 12 | template 13 | Func hookFunction( Func function, Dest destination ) 14 | { 15 | u32* instructions = reinterpret_cast( function ); 16 | 17 | u32* trampoline = new u32[2]; 18 | 19 | // Original instruction 20 | trampoline[0] = instructions[0]; 21 | memory::clear_DC_IC_Cache( &trampoline[0], sizeof( u32 ) ); 22 | 23 | // Branch to original function past hook 24 | writeBranch( &trampoline[1], &instructions[1] ); 25 | 26 | // Write actual hook 27 | writeBranch( &instructions[0], reinterpret_cast( static_cast( destination ) ) ); 28 | 29 | return reinterpret_cast( trampoline ); 30 | } 31 | } // namespace mod::patch -------------------------------------------------------------------------------- /include/singleton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | /** 6 | * Contains variables that can be edited and read by everyone 7 | */ 8 | namespace mod 9 | { 10 | class Singleton 11 | { 12 | public: 13 | static Singleton* getInstance(); 14 | 15 | u8 isMDHSkipEnabled; 16 | u8 isForestEscapeEnabled; 17 | u8 isGateUnlockEnabled; 18 | u8 isGoatSkipEnabled; 19 | u8 isMSPuzzleSkipEnabled; 20 | u8 isCartEscortSkipEnabled; 21 | u8 isEarlyCiTSEnabled; 22 | u8 isCannonRepaired; 23 | u8 isEarlyDesertEnabled; 24 | u8 isBossKeyseyEnabled; 25 | u8 isSewerSkipEnabled; 26 | u8 shuffledSkybook; 27 | u8 isIntroSkipped; 28 | u8 isTwilightSkipped; 29 | u8 diababaMusicFixed; 30 | u8 midnaTimeControl; 31 | u8 hasActorCommonLayerRan; 32 | u8 isEarlyToTEnabled; 33 | u8 isEarlyPoTEnabled; 34 | u8 isGMStoryPatch; 35 | u8 isEarlyHCEnabled; 36 | u8 startWithCrystal; 37 | u8 shuffleHiddenSkills; 38 | 39 | u8 hasCiTSOoccoo; 40 | 41 | private: 42 | static Singleton* instance; 43 | 44 | Singleton(); 45 | }; 46 | } // namespace mod -------------------------------------------------------------------------------- /include/stage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::stage 6 | { 7 | extern char allStages[76][8]; 8 | extern const char* dungeonStages[18]; 9 | extern const char* bossStages[8]; 10 | extern const char* shopStages[8]; 11 | extern const char* grottoStages[5]; 12 | extern const char* caveStages[6]; 13 | extern const char* interiorStages[8]; 14 | extern const char* specialStages[3]; 15 | extern const char* timeOfDayStages[18]; 16 | extern const char* mainDungeonStages[9]; 17 | extern const char* allDungeonStages[26]; 18 | } // namespace mod::stage -------------------------------------------------------------------------------- /include/systemConsole.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::system_console 6 | { 7 | extern "C" 8 | { 9 | void setBackgroundColor( u32 rgba ); 10 | void setState( bool activeFlag, u32 totalLines ); 11 | } 12 | } // namespace mod::system_console -------------------------------------------------------------------------------- /include/tools.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "defines.h" 7 | 8 | namespace mod::tools 9 | { 10 | extern "C" 11 | { 12 | extern u64 randomSeed; 13 | 14 | /** 15 | * Generates a simple random number (not perfectly random but good enough for most purposes) 16 | * Note: It's best to use with a clock that advances randomSeed 17 | * (C) http://xoshiro.di.unimi.it/splitmix64.c 18 | * 19 | * @param max The maximum number to return 20 | * @returns A random integer between 0 and max, excluding max 21 | */ 22 | u32 getRandom( u32 max ); 23 | 24 | /** 25 | * Triggers the generator function which is a member function 26 | * (This is a wrapper) 27 | */ 28 | void triggerRandomGenerator(); 29 | 30 | /** 31 | * Triggers a load savely by setting some important 32 | * variables for the game to handle it properly 33 | */ 34 | void triggerSaveLoad( char* stage, u8 room, u8 spawn, u8 state = 0xFF, u8 event = 0xFF ); 35 | 36 | /** 37 | * Sets whether the cutscene can be skipped 38 | * 39 | * Unskippable cutscenes sometimes set flags so take care of them 40 | * in the function that calls this if needed 41 | * 42 | * @param skippable If true the user can skip, otherwise unskippable 43 | * @param fade If true the skip action will smoothly transition 44 | * @param onSkip The tp::evt_control::csFunc that runs when trying to skip 45 | */ 46 | void setCutscene( bool skippable, bool fade = true, tp::evt_control::csFunc onSkip = tp::evt_control::defaultSkipStb ); 47 | 48 | /** 49 | * Compares two floats and returns their difference 50 | */ 51 | float fCompare( const float f1, const float f2 ); 52 | 53 | /** 54 | * Generates a simple u32 checksum 55 | * 56 | * @param data The data you need a checksum for 57 | * @param count The number of bytes 58 | */ 59 | u16 fletcher16( u8* data, s32 count ); 60 | 61 | /** 62 | * Sets a specific bit/flag in the itemFlags variable in tp::d_com_inf_game::gameInfo.scratchPad.itemFlags 63 | */ 64 | void setItemFlag( ItemFlags flag ); 65 | 66 | /** 67 | * Unsets a specific bit/flag in the itemFlags variable in tp::d_com_inf_game::gameInfo.scratchPad.itemFlags 68 | */ 69 | void clearItemFlag( ItemFlags flag ); 70 | 71 | /** 72 | * Checks if a specific bit/flag in the itemFlags variable in tp::d_com_inf_game::gameInfo.scratchPad.itemFlags is set 73 | */ 74 | bool checkItemFlag( ItemFlags flag ); 75 | } 76 | } // namespace mod::tools -------------------------------------------------------------------------------- /include/tp.eu.lst: -------------------------------------------------------------------------------- 1 | // memory 2 | 80003458:memset 3 | 80003540:memcpy 4 | 5 | // m_Do_ext.o 6 | // text 7 | 8000EDA8:getArchiveHeapPtr 8 | // data 9 | 80452BF4:archiveHeap 10 | 11 | // d_save.o 12 | 80032B50:getRupeeMax 13 | 800351EC:getSave 14 | 80035220:putSave 15 | 80034aec:isEventBit 16 | 80034abc:onEventBit 17 | 80034a64:isDungeonItem 18 | 19 | / d_stage.o 20 | 80025914:actorCommonLayerInit 21 | 80025AE0:actorInit 22 | 80025bcc:actorInit_always 23 | 24 | // data 25 | 803F8034:mStatus_roomControl 26 | 27 | // d_event.o 28 | 800428A8:defaultSkipStb 29 | 80042B04:skipper 30 | 31 | // f_op_scene_req.o 32 | // data 33 | 804525D4:freezeActors 34 | 80452CA0:isUsingOfOverlap 35 | 36 | // f_ap_game.o 37 | 80018B14:fapGm_Execute 38 | 39 | // f_op_actor_mng.o 40 | 8001BC90:createItemForPresentDemo 41 | 8001BD1C:createItemForTrBoxDemo 42 | 8001C120:createDemoItem 43 | 8001C17C:createItemForBoss 44 | 8001C21C:createItemForMidBoss 45 | 8001C260:createItemForDirectGet 46 | 8001C2A4:createItemForSimpleDemo 47 | 48 | // d_map_path_dmap.o 49 | 8003EF8C:getMapPlayerPos 50 | 8003F050:getMapPlayerAngleY 51 | 52 | // d_item.o 53 | 80097FBC:execItemGet 54 | 80098010:checkItemGet 55 | 800983E4:item_func_UTUWA_HEART 56 | 803b0a58:item_info 57 | 803b0e58:item_func_ptr 58 | 803ae280:item_resource 59 | 60 | // d_a_alink.h 61 | 8009DC6C:checkStageName 62 | 800B2928:setStickData 63 | 800BB6C4:checkHeavyStateOn 64 | 800C7A00:procCoMetamorphoseInit 65 | 8011A908:checkTreasureRupeeReturn 66 | 803DEDF4:linkStatus 67 | 8038FF7C:lanternVariables 68 | 80115E2C:checkEventRun 69 | 800CF47C:checkCanoeRide 70 | 800CF468:checkBoardRide 71 | 800CF490:checkHorseRide 72 | 800CF4D4:checkSpinnerRide 73 | 800CF4C0:checkBoarRide 74 | 8039325C:getSeType 75 | 801183ac:setGetItemFace 76 | // data 77 | 8039038C:ladderVars 78 | 79 | // d_menu_collect.o 80 | 801B3598:setWalletMaxNum 81 | 82 | // d_msg_flow.o 83 | 8024BF88:query022 84 | 8024bfbc:query023 85 | 8024bff8:query024 86 | 8024c018:query025 87 | 88 | // DynamicLink.o 89 | 80263A5C:do_link 90 | 91 | // JKRExpHeap.o 92 | 802CFF28:do_alloc_JKRExpHeap 93 | 802D05AC:do_free_JKRExpHeap 94 | 95 | // OSCache.o 96 | // 8033C36C:DCEnable 97 | // 8033C380:DCInvalidateRange 98 | 8033C3AC:DCFlushRange 99 | // 8033C3DC:DCStoreRange 100 | // 8033C40C:DCFlushRangeNoSync 101 | // 8033C438:DCStoreRangeNoSync 102 | // 8033C464:DCZeroRange 103 | 8033C490:ICInvalidateRange 104 | // 8033C4C4:ICFlashInvalidate 105 | // 8033C4D4:ICEnable 106 | // 8033C4E8:__LCEnable 107 | // 8033C5B4:LCEnable 108 | // 8033C5EC:LCDisable 109 | // 8033C614:LCStoreBlocks 110 | // 8033C638:LCStoreData 111 | // 8033C6E4:LCQueueWait 112 | // 8033C6F8:L2GlobalInvalidate 113 | // 8033C790:DMAErrorHandler 114 | // 8033C8F0:__OSCacheInit 115 | 116 | // runtime.o 117 | 80362F38:_savefpr_14 118 | 80362F3C:_savefpr_15 119 | 80362F40:_savefpr_16 120 | 80362F44:_savefpr_17 121 | 80362F48:_savefpr_18 122 | 80362F4C:_savefpr_19 123 | 80362F50:_savefpr_20 124 | 80362F54:_savefpr_21 125 | 80362F58:_savefpr_22 126 | 80362F5C:_savefpr_23 127 | 80362F60:_savefpr_24 128 | 80362F64:_savefpr_25 129 | 80362F68:_savefpr_26 130 | 80362F6C:_savefpr_27 131 | 80362F70:_savefpr_28 132 | 80362F74:_savefpr_29 133 | 80362F78:_savefpr_30 134 | 80362F7C:_savefpr_31 135 | 80362FD0:_savegpr_14 136 | 80362FD4:_savegpr_15 137 | 80362FD8:_savegpr_16 138 | 80362FDC:_savegpr_17 139 | 80362FE0:_savegpr_18 140 | 80362FE4:_savegpr_19 141 | 80362FE8:_savegpr_20 142 | 80362FEC:_savegpr_21 143 | 80362FF0:_savegpr_22 144 | 80362FF4:_savegpr_23 145 | 80362FF8:_savegpr_24 146 | 80362FFC:_savegpr_25 147 | 80363000:_savegpr_26 148 | 80363004:_savegpr_27 149 | 80363008:_savegpr_28 150 | 8036300C:_savegpr_29 151 | 80363010:_savegpr_30 152 | 80363014:_savegpr_31 153 | 8036328C:__umoddi3 154 | 155 | // mem.o 156 | 80366EBC:memcmp 157 | 158 | // printf.o 159 | 8036730C:sprintf 160 | 803673EC:snprintf 161 | 162 | // string.o 163 | 803697C4:strcmp 164 | 8036995C:strcpy 165 | 80369918:strncpy 166 | 80369784:strncmp 167 | 80369a14:strlen 168 | 169 | //currentState 170 | 803A8393:current_state 171 | 172 | // m_Do_controller_pad.o 173 | // data 174 | 803DF288:cpadInfo 175 | 176 | // d_com_inf_game.o 177 | // data 178 | 80408160:dComIfG_gameInfo 179 | 8002B414:setItemBombNumCount 180 | 8002f8b8:dComIfGs_Wolf_Change_Check 181 | 801415a8:dComIfGs_isEventBit 182 | 8002b4dc:getLayerNo_common_common 183 | 184 | // d_kankyo.o 185 | // data 186 | 8042EA14:env_light 187 | 188 | // JFWSystem.o 189 | // data 190 | 80453180:systemConsole 191 | 192 | //currentState 193 | 803A8393:current_state 194 | 195 | //canWarp 196 | 80408956:can_warp 197 | 198 | //d_meter2_info.o 199 | 80432164:wZButtonPtr 200 | 201 | //Z2SceneMgr 202 | 802BA968:sceneChange 203 | 204 | //Z2SeqMgr 205 | 802B5CB0:startBattleBgm 206 | 802B029C:subBgmStart 207 | 802AACE8:startSound 208 | 209 | //control.o 210 | 802a8820:setMessageCode_inSequence 211 | 212 | //d_msg_class.o 213 | 80228bc0:getFontCCColorTable 214 | 80228c6c:getFontGCColorTable 215 | 216 | //resource.o 217 | 802aa290:parseCharacter_1Byte 218 | 219 | //processor.o 220 | 802a8a54:getResource_groupID -------------------------------------------------------------------------------- /include/tp.jp.lst: -------------------------------------------------------------------------------- 1 | // memory 2 | 80003458:memset 3 | 80003540:memcpy 4 | 5 | // m_Do_ext.o 6 | // text 7 | 8000EDF4:getArchiveHeapPtr 8 | // data 9 | 8044AD74:archiveHeap 10 | 11 | // d_save.o 12 | 80032AA8:getRupeeMax 13 | 800350BC:getSave 14 | 800350F0:putSave 15 | 800349bc:isEventBit 16 | 8003498c:onEventBit 17 | 80034934:isDungeonItem 18 | 19 | // d_stage.o 20 | 8002586C:actorCommonLayerInit 21 | 80025A38:actorInit 22 | 80025b24:actorInit_always 23 | // data 24 | 803F01D4:mStatus_roomControl 25 | 26 | // d_event.o 27 | 80042778:defaultSkipStb 28 | 800429D4:skipper 29 | 30 | // f_op_scene_req.o 31 | // data 32 | 8044A754:freezeActors 33 | 8044AE20:isUsingOfOverlap 34 | 35 | // f_ap_game.o 36 | 80018A6C:fapGm_Execute 37 | 38 | // f_op_actor_mng.o 39 | 8001BBE8:createItemForPresentDemo 40 | 8001BC74:createItemForTrBoxDemo 41 | 8001c078:createDemoItem 42 | 8001C0D4:createItemForBoss 43 | 8001C174:createItemForMidBoss 44 | 8001C1B8:createItemForDirectGet 45 | 8001C1FC:createItemForSimpleDemo 46 | 47 | // d_map_path_dmap.o 48 | 8003EE5C:getMapPlayerPos 49 | 8003EF20:getMapPlayerAngleY 50 | 51 | // d_item.o 52 | 80097ECC:execItemGet 53 | 80097F20:checkItemGet 54 | 800982F4:item_func_UTUWA_HEART 55 | 803a8ed8:item_info 56 | 803a6700:item_resource 57 | 803a92d8:item_func_ptr 58 | 59 | // d_a_alink.h 60 | 8009DA98:checkStageName 61 | 800B2754:setStickData 62 | 800BB4F0:checkHeavyStateOn 63 | 800C782C:procCoMetamorphoseInit 64 | 8011A734:checkTreasureRupeeReturn 65 | 803D6F94:linkStatus 66 | 803887fC:lanternVariables 67 | 80115C58:checkEventRun 68 | 800CF2A8:checkCanoeRide 69 | 800CF294:checkBoardRide 70 | 800CF2bC:checkHorseRide 71 | 800CF300:checkSpinnerRide 72 | 800CF2EC:checkBoarRide 73 | 8038badC:getSeType 74 | 801413e8:dComIfGs_isEventBit 75 | 801181d8:setGetItemFace 76 | 77 | // data 78 | 80388C0C:ladderVars 79 | 80 | // d_menu_collect.o 81 | 801B3300:setWalletMaxNum 82 | 83 | // d_msg_flow.o 84 | 8024D24C:query022 85 | 8024d280:query023 86 | 8024d2bc:query024 87 | 8024d2dc:query025 88 | 89 | // DynamicLink.o 90 | 8026508C:do_link 91 | 92 | // JKRExpHeap.o 93 | 802D15C4:do_alloc_JKRExpHeap 94 | 802D1C48:do_free_JKRExpHeap 95 | 96 | // OSCache.o 97 | // 8033DA08:DCEnable 98 | // 8033DA1C:DCInvalidateRange 99 | 8033DA48:DCFlushRange 100 | // 8033DA78:DCStoreRange 101 | // 8033DAA8:DCFlushRangeNoSync 102 | // 8033DAD4:DCStoreRangeNoSync 103 | // 8033DB00:DCZeroRange 104 | 8033DB2C:ICInvalidateRange 105 | // 8033DB60:ICFlashInvalidate 106 | // 8033DB70:ICEnable 107 | // 8033DB84:__LCEnable 108 | // 8033DC50:LCEnable 109 | // 8033DC88:LCDisable 110 | // 8033DCB0:LCStoreBlocks 111 | // 8033DCD4:LCStoreData 112 | // 8033DD80:LCQueueWait 113 | // 8033DD94:L2GlobalInvalidate 114 | // 8033DE2C:DMAErrorHandler 115 | // 8033DF8C:__OSCacheInit 116 | 117 | // runtime.o 118 | 803645A4:_savefpr_14 119 | 803645A8:_savefpr_15 120 | 803645AC:_savefpr_16 121 | 803645B0:_savefpr_17 122 | 803645B4:_savefpr_18 123 | 803645B8:_savefpr_19 124 | 803645BC:_savefpr_20 125 | 803645C0:_savefpr_21 126 | 803645C4:_savefpr_22 127 | 803645C8:_savefpr_23 128 | 803645CC:_savefpr_24 129 | 803645D0:_savefpr_25 130 | 803645D4:_savefpr_26 131 | 803645D8:_savefpr_27 132 | 803645DC:_savefpr_28 133 | 803645E0:_savefpr_29 134 | 803645E4:_savefpr_30 135 | 803645E8:_savefpr_31 136 | 8036463C:_savegpr_14 137 | 80364640:_savegpr_15 138 | 80364644:_savegpr_16 139 | 80364648:_savegpr_17 140 | 8036464C:_savegpr_18 141 | 80364650:_savegpr_19 142 | 80364654:_savegpr_20 143 | 80364658:_savegpr_21 144 | 8036465C:_savegpr_22 145 | 80364660:_savegpr_23 146 | 80364664:_savegpr_24 147 | 80364668:_savegpr_25 148 | 8036466C:_savegpr_26 149 | 80364670:_savegpr_27 150 | 80364674:_savegpr_28 151 | 80364678:_savegpr_29 152 | 8036467C:_savegpr_30 153 | 80364680:_savegpr_31 154 | 803648F8:__umoddi3 155 | 156 | // mem.o 157 | 80368528:memcmp 158 | 159 | // printf.o 160 | 80368978:sprintf 161 | 80368A58:snprintf 162 | 163 | // string.o 164 | 8036AE30:strcmp 165 | 8036AFC8:strcpy 166 | 8036AF84:strncpy 167 | 8036adf0:strncmp 168 | 8036b080:strlen 169 | 170 | //currentState 171 | 803B8000:current_state 172 | 173 | // m_Do_controller_pad.o 174 | // data 175 | 803D7428:cpadInfo 176 | 177 | // d_com_inf_game.o 178 | // data 179 | 80400300:dComIfG_gameInfo 180 | 8002B36C:setItemBombNumCount 181 | 8002f810:dComIfGs_Wolf_Change_Check 182 | 8002b434:getLayerNo_common_common 183 | 184 | // d_kankyo.o 185 | // data 186 | 80426B94:env_light 187 | 188 | // JFWSystem.o 189 | // data 190 | 8044B2F8:systemConsole 191 | 192 | //currentState 193 | 803B8000:current_state 194 | 195 | //canWarp 196 | 80400AF6:can_warp 197 | 198 | //d_meter2_info.o 199 | 8042A2E4:wZButtonPtr 200 | 201 | //Z2SceneMgr 202 | 802BBFA8:sceneChange 203 | 204 | //Z2SeqMgr 205 | 802B72F0:startBattleBgm 206 | 802B18DC:subBgmStart 207 | 802AC328:startSound 208 | 209 | //control.o 210 | 802a9e60:setMessageCode_inSequence 211 | 212 | //d_msg_class.o 213 | 80229048:getFontCCColorTable 214 | 802290f4:getFontGCColorTable 215 | 216 | //resource.o 217 | 802ab8d0:parseCharacter_1Byte 218 | 219 | //processor.o 220 | 802aa094:getResource_groupID -------------------------------------------------------------------------------- /include/tp.us.lst: -------------------------------------------------------------------------------- 1 | // memory 2 | 80003458:memset 3 | 80003540:memcpy 4 | 5 | // m_Do_ext.o 6 | // text 7 | 8000EDF4:getArchiveHeapPtr 8 | // data 9 | 80450C34:archiveHeap 10 | 11 | // d_save.o 12 | 80032AA8:getRupeeMax 13 | 800350BC:getSave 14 | 800350F0:putSave 15 | 80034934:isDungeonItem 16 | 800349bc:isEventBit 17 | 8003498c:onEventBit 18 | 19 | // d_stage.o 20 | 8002586C:actorCommonLayerInit 21 | 80025A38:actorInit 22 | 80025b24:actorInit_always 23 | 24 | // data 25 | 803F6094:mStatus_roomControl 26 | 27 | // d_event.o 28 | 80042778:defaultSkipStb 29 | 800429D4:skipper 30 | 31 | // f_op_scene_req.o 32 | // data 33 | 80450614:freezeActors 34 | 80450CE0:isUsingOfOverlap 35 | 36 | // f_ap_game.o 37 | 80018A6C:fapGm_Execute 38 | 39 | // f_op_actor_mng.o 40 | 8001BBE8:createItemForPresentDemo 41 | 8001BC74:createItemForTrBoxDemo 42 | 8001C078:createDemoItem 43 | 8001C0D4:createItemForBoss 44 | 8001C174:createItemForMidBoss 45 | 8001C1B8:createItemForDirectGet 46 | 8001C1FC:createItemForSimpleDemo 47 | 48 | // d_map_path_dmap.o 49 | 8003EE5C:getMapPlayerPos 50 | 8003EF20:getMapPlayerAngleY 51 | 52 | // d_item.o 53 | 80097E8C:execItemGet 54 | 80097EE0:checkItemGet 55 | 800982B4:item_func_UTUWA_HEART 56 | 803AF178:item_func_ptr 57 | 803AF578:item_getcheck_func_ptr 58 | 59 | // d_a_alink.h 60 | 8009DA60:checkStageName 61 | 800B271C:setStickData 62 | 800BB4B8:checkHeavyStateOn 63 | 800C77F4:procCoMetamorphoseInit 64 | 8011A6FC:checkTreasureRupeeReturn 65 | 803DCE54:linkStatus 66 | 8038e77c:lanternVariables 67 | 80115c20:checkEventRun 68 | 800cf270:checkCanoeRide 69 | 800cf25c:checkBoardRide 70 | 800cf284:checkHorseRide 71 | 800cf2c8:checkSpinnerRide 72 | 800cf2b4:checkBoarRide 73 | 8014139c:dComIfGs_isEventBit 74 | 80391A5C:getSeType 75 | 801181a0:setGetItemFace 76 | 77 | // data 78 | 8038EB8C:ladderVars 79 | 80 | // d_menu_collect.o 81 | 801B3340:setWalletMaxNum 82 | 83 | // d_msg_flow.o 84 | 8024B8E4:query022 85 | 8024b918:query023 86 | 8024B954:query024 87 | 8024b974:query025 88 | 89 | // d_msg_class.o 90 | 802288fc:getFontCCColorTable 91 | 802289a8:getFontGCColorTable 92 | 93 | // DynamicLink.o 94 | 80262C5C:do_link 95 | 96 | // JKRExpHeap.o 97 | 802CF128:do_alloc_JKRExpHeap 98 | 802CF7AC:do_free_JKRExpHeap 99 | 100 | // OSCache.o 101 | // 8033B56C:DCEnable 102 | // 8033B580:DCInvalidateRange 103 | 8033B5AC:DCFlushRange 104 | // 8033B5DC:DCStoreRange 105 | // 8033B60C:DCFlushRangeNoSync 106 | // 8033B638:DCStoreRangeNoSync 107 | // 8033B664:DCZeroRange 108 | 8033B690:ICInvalidateRange 109 | // 8033B6C4:ICFlashInvalidate 110 | // 8033B6D4:ICEnable 111 | // 8033B6E8:__LCEnable 112 | // 8033B7B4:LCEnable 113 | // 8033B7EC:LCDisable 114 | // 8033B814:LCStoreBlocks 115 | // 8033B838:LCStoreData 116 | // 8033B8E4:LCQueueWait 117 | // 8033B8F8:L2GlobalInvalidate 118 | // 8033B990:DMAErrorHandler 119 | // 8033BAF0:__OSCacheInit 120 | 121 | // runtime.o 122 | 80362108:_savefpr_14 123 | 8036210C:_savefpr_15 124 | 80362110:_savefpr_16 125 | 80362114:_savefpr_17 126 | 80362118:_savefpr_18 127 | 8036211C:_savefpr_19 128 | 80362120:_savefpr_20 129 | 80362124:_savefpr_21 130 | 80362128:_savefpr_22 131 | 8036212C:_savefpr_23 132 | 80362130:_savefpr_24 133 | 80362134:_savefpr_25 134 | 80362138:_savefpr_26 135 | 8036213C:_savefpr_27 136 | 80362140:_savefpr_28 137 | 80362144:_savefpr_29 138 | 80362148:_savefpr_30 139 | 8036214C:_savefpr_31 140 | 803621A0:_savegpr_14 141 | 803621A4:_savegpr_15 142 | 803621A8:_savegpr_16 143 | 803621AC:_savegpr_17 144 | 803621B0:_savegpr_18 145 | 803621B4:_savegpr_19 146 | 803621B8:_savegpr_20 147 | 803621BC:_savegpr_21 148 | 803621C0:_savegpr_22 149 | 803621C4:_savegpr_23 150 | 803621C8:_savegpr_24 151 | 803621CC:_savegpr_25 152 | 803621D0:_savegpr_26 153 | 803621D4:_savegpr_27 154 | 803621D8:_savegpr_28 155 | 803621DC:_savegpr_29 156 | 803621E0:_savegpr_30 157 | 803621E4:_savegpr_31 158 | 8036245C:__umoddi3 159 | 160 | // mem.o 161 | 8036608C:memcmp 162 | 163 | // printf.o 164 | 803664DC:sprintf 165 | 803665BC:snprintf 166 | 167 | // string.o 168 | 80368994:strcmp 169 | 80368B2C:strcpy 170 | 80368AE8:strncpy 171 | 80368954:strncmp 172 | 80368be4:strlen 173 | 174 | //currentState 175 | 803A66B3:current_state 176 | 177 | // m_Do_controller_pad.o 178 | // data 179 | 803DD2E8:cpadInfo 180 | 181 | // d_com_inf_game.o 182 | // data 183 | 804061C0:dComIfG_gameInfo 184 | 8002B36C:setItemBombNumCount 185 | 8002b434:getLayerNo_common_common 186 | 8002f810:dComIfGs_Wolf_Change_Check 187 | 188 | // d_kankyo.o 189 | // data 190 | 8042CA54:env_light 191 | 192 | // JFWSystem.o 193 | // data 194 | 804511B8:systemConsole 195 | 196 | //currentState 197 | 803A66B3:current_state 198 | 199 | //walletText 200 | 80bbc749:wallet_text 201 | 202 | //walletdescription 203 | 80BBD835:wallet_description 204 | 205 | //canwarp 206 | 804069B6:can_warp 207 | 208 | //resource.o 209 | 802a9490:parseCharacter_1Byte 210 | 211 | //d_item_data.o 212 | 803AC5A0:item_resource 213 | 803ADD88:field_item_res 214 | 803AED78:item_info 215 | 216 | //d_meter2_info.o 217 | 804301A4:wZButtonPtr 218 | 219 | //Z2SceneMgr 220 | 802B9B68:sceneChange 221 | 222 | //Z2SeqMgr 223 | 802B4EB0:startBattleBgm 224 | 802AF49C:subBgmStart 225 | 802A9EE8:startSound 226 | 227 | //processor.o 228 | 802A7C54:getResource_groupID 229 | 230 | //control.o 231 | 802A7A20:setMessageCode_inSequence 232 | 233 | //resource.o 234 | 802a9490:parseCharacter_1Byte -------------------------------------------------------------------------------- /include/tp/DynamicLink.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | 7 | namespace tp::dynamic_link 8 | { 9 | // Should try to fill in the variables at some point 10 | struct DynamicModuleControl 11 | { 12 | u8 unk_0[0x10]; 13 | gc::OSModule::OSModuleInfo* moduleInfo; 14 | u8 unk_10[0x18]; 15 | } __attribute__( ( __packed__ ) ); 16 | 17 | // This size may not be correct 18 | static_assert( sizeof( DynamicModuleControl ) == 0x2C ); 19 | 20 | extern "C" 21 | { 22 | bool do_link( DynamicModuleControl* dmc ); 23 | 24 | #define SET_LOAD_IMMEDIATE( register, value ) ( 0x38000000 + ( register * 0x200000 ) ) | static_cast( value ) 25 | } 26 | } // namespace tp::dynamic_link -------------------------------------------------------------------------------- /include/tp/JFWSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::jfw_system 6 | { 7 | struct ConsoleLine 8 | { 9 | bool showLine; 10 | char line[61]; 11 | } __attribute__( ( __packed__ ) ); 12 | 13 | // Should try to fill in the missing variables at some point 14 | // Need to also get the exact size of this struct 15 | struct SystemConsole 16 | { 17 | u8 unk_0[0x60]; 18 | u8 consoleColor[4]; // rgba 19 | u8 unk_64[0x4]; 20 | bool consoleEnabled; 21 | u8 unk_69[3]; 22 | ConsoleLine consoleLine[25]; // Should figure out the total amount of lines at some point 23 | } __attribute__( ( __packed__ ) ); 24 | 25 | static_assert( sizeof( ConsoleLine ) == 0x3E ); 26 | 27 | extern "C" 28 | { 29 | extern SystemConsole* systemConsole; 30 | } 31 | } // namespace tp::jfw_system -------------------------------------------------------------------------------- /include/tp/JKRExpHeap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::jkr_exp_heap 6 | { 7 | extern "C" 8 | { 9 | void* do_alloc_JKRExpHeap( void* heap, u32 size, s32 unk3 ); 10 | void do_free_JKRExpHeap( void* heap, void* ptr ); 11 | } 12 | } // namespace tp::jkr_exp_heap -------------------------------------------------------------------------------- /include/tp/Z2SceneMgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "defines.h" 3 | 4 | struct Z2SceneMgr; 5 | 6 | struct JAISoundID 7 | { 8 | u32 id; 9 | }; 10 | namespace tp::Z2AudioLib::SceneMgr 11 | { 12 | extern "C" 13 | { 14 | void sceneChange( Z2SceneMgr* sceneMgr, 15 | JAISoundID id, 16 | u8 SeWave1, 17 | u8 SeWave2, 18 | u8 BgmWave1, 19 | u8 BgmWave2, 20 | u8 DemoWave, 21 | bool param_7 ); 22 | }; 23 | } // namespace tp::Z2AudioLib::SceneMgr 24 | -------------------------------------------------------------------------------- /include/tp/Z2SeqMgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct Z2SeqMgr; 4 | 5 | namespace tp::Z2AudioLib::SeqMgr 6 | { 7 | extern "C" 8 | { 9 | void startBattleBgm( Z2SeqMgr* seqMgr, bool param_1 ); 10 | void subBgmStart( Z2SeqMgr* seqMgr, u32 id ); 11 | } 12 | } // namespace tp::Z2AudioLib::SeqMgr -------------------------------------------------------------------------------- /include/tp/control.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | 7 | namespace tp::control 8 | { 9 | struct TControl 10 | { 11 | void* unk_0; 12 | void* unk_4; 13 | void* unk_8; 14 | u16 unk_E; // unk3 in setMessageCode_inSequence 15 | u16 msgId; 16 | void* unk_10; 17 | gc::bmgres::MessageEntry* msgEntry; 18 | const char* msg; 19 | u8 unk_1C[0x4]; 20 | const char* wMsgRender; 21 | u32 unk_24; 22 | } __attribute__( ( __packed__ ) ); 23 | 24 | extern "C" 25 | { 26 | bool setMessageCode_inSequence( TControl* control, const void* TProcessor, u16 unk3, u16 msgId ); 27 | } 28 | } // namespace tp::control -------------------------------------------------------------------------------- /include/tp/d_a_alink.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d_com_inf_game.h" 4 | #include "defines.h" 5 | 6 | namespace tp::d_a_alink 7 | { 8 | // Should try to fill in the variables at some point 9 | struct LadderVars 10 | { 11 | u8 unk_0[0x28]; 12 | float ladderClimbInitSpeed; 13 | u8 unk_2c[0x4]; 14 | float ladderReachTopClimbUpSpeed; 15 | u8 unk_30[0x4]; 16 | float ladderTopStartClimbDownSpeed; 17 | u8 unk_34[0x4]; 18 | float ladderBottomGetOffSpeed; 19 | u8 unk_38[0x8]; 20 | float ladderClimbSpeed; 21 | u8 unk_40[0x10]; 22 | float wallClimbHorizontalSpeed; 23 | u8 unk_58[0x4]; 24 | float wallClimbVerticalSpeed; 25 | u8 unk_5c[0x4]; 26 | } __attribute__( ( __packed__ ) ); 27 | 28 | static_assert( sizeof( LadderVars ) == 0x70 ); 29 | 30 | struct LinkStatus 31 | { 32 | u8 unk_0[0xA2]; 33 | u8 status; 34 | } __attribute__( ( __packed__ ) ); 35 | 36 | extern "C" 37 | { 38 | bool checkStageName( const char* name ); // Checks if dComIfG_gameInfo.currentStage is equal to name 39 | void setStickData(); 40 | bool checkHeavyStateOn( s32 unk1, s32 unk2 ); 41 | bool procCoMetamorphoseInit( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); 42 | bool checkTreasureRupeeReturn( void* unk1, s32 item ); 43 | bool lanternVariables( s8 unk1, s8 unk2 ); 44 | bool checkEventRun( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); 45 | bool checkBoardRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); 46 | bool checkCanoeRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); 47 | bool checkHorseRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); 48 | bool checkBoarRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); 49 | bool checkSpinnerRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); 50 | bool dComIfGs_isEventBit( u16 flag ); 51 | void setGetItemFace( void* daAlink_c, u16 itemId ); 52 | extern u8 getSeType[0x100]; 53 | 54 | // Variables 55 | extern LadderVars ladderVars; 56 | extern LinkStatus* linkStatus; 57 | } 58 | } // namespace tp::d_a_alink -------------------------------------------------------------------------------- /include/tp/d_a_shop_item_static.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::d_a_shop_item_static 6 | { 7 | enum ShopItemDataIndex : u8 8 | { 9 | Sold_Out = 0x0, 10 | Lantern_Oil = 0x1, // Item Id = 0x66 11 | Red_Potion = 0x2, // Item Id = 0x61 12 | Milk = 0x3, // Item Id = 0x64 13 | Sera_Bottle = 0x4, // Item Id = 0x65 14 | Arrows = 0x5, // Item Id = 0xE to 0x10 15 | Wooden_Shield = 0x6, // Item Id = 0x2B 16 | Hylian_Shield = 0x7, // Item Id = 0x2C 17 | Bombs = 0x8, // Item Id = 0xA to 0xD 18 | Bomb_Bag_Water_Bombs = 0x9, // Item Id = 0x71 -- Uses Water Bomb model 19 | Bomb_Bag_Bomblings = 0xA, // Item Id = 0x72 -- Uses Bombling model 20 | Empty_Bomb_Bag = 0xB, // Item Id = 0x50 -- Possibly handles multiple different bomb bags 21 | Giant_Bomb_Bag = 0xC, // Item Id = 0x4F 22 | Land_Mine = 0xD, // Unused in getShopArcname 23 | Bottle = 0xE, // Unused in getShopArcname 24 | Bee_Larva = 0xF, // Item Id = 0x76 25 | Slingshot = 0x10, // Item Id = 0x4B 26 | Blue_Potion = 0x11, // Item Id = 0x63 27 | Hawkeye = 0x12, // Item Id = 0x3E 28 | Magic_Armor = 0x13, // Item Id = 0x30 29 | Magic_Armor_Sold_Out = 0x14, 30 | Green_Potion = 0x15, // Item Id = 0x62 31 | Jovani_Bottle = 0x16, // Item Id = 0x75 32 | }; 33 | 34 | struct ShopItemData 35 | { 36 | char* arcName; 37 | s16 modelResIdx; 38 | s16 wBtkResIdx; 39 | s16 unk_8; 40 | s16 wBckResIdx; 41 | s16 unk_C; 42 | s16 wBrkResIdx; 43 | s16 wBtpResIdx; 44 | s16 unk_12; 45 | float posY; 46 | float scale; 47 | s16 wRot[4]; 48 | u32 mFlags; 49 | u8 mShadowSize; 50 | u8 mCollisionH; 51 | u8 mCollisionR; 52 | u8 tevFrm; 53 | u8 btpFrm; 54 | u8 unk_2D[3]; 55 | } __attribute__( ( __packed__ ) ); 56 | 57 | static_assert( sizeof( ShopItemData ) == 0x30 ); 58 | 59 | extern "C" 60 | { 61 | extern ShopItemData shopItemData[23]; // mData__12daShopItem_c 62 | } 63 | } // namespace tp::d_a_shop_item_static -------------------------------------------------------------------------------- /include/tp/d_item.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::d_item 6 | { 7 | typedef void ( *ItemFunc )(); 8 | typedef s32 ( *ItemGetCheckFunc )(); 9 | 10 | extern "C" 11 | { 12 | s32 execItemGet( u8 item ); 13 | s32 checkItemGet( u8 item, s32 defaultValue ); 14 | void item_func_UTUWA_HEART(); 15 | extern ItemFunc item_func_ptr[0x100]; 16 | extern ItemGetCheckFunc item_getcheck_func_ptr[0x100]; 17 | } 18 | } // namespace tp::d_item -------------------------------------------------------------------------------- /include/tp/d_item_data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | 7 | namespace tp::d_item_data 8 | { 9 | struct ItemResource // d_item_data.h 10 | { 11 | const char* arcName; 12 | s16 modelResIdx; 13 | s16 btkResIdx; 14 | s16 bckResIdx; 15 | s16 brkResIdx; 16 | s16 btpResIdx; 17 | u8 tevFrm; 18 | u8 btpFrm; 19 | s16 ringTexResIdx; // The icon displayed next to the text shown when you get an item. 20 | s16 unk_12[3]; 21 | } __attribute__( ( __packed__ ) ); 22 | 23 | struct FieldItemRes // d_item_data.h 24 | { 25 | const char* arcName; 26 | s16 modelResIdx; 27 | s16 bckAnmResIdx; 28 | s16 brkAnmResIdx; 29 | s16 unk_a; 30 | s16 heapSize; 31 | s16 unk_e; 32 | } __attribute__( ( __packed__ ) ); 33 | 34 | struct ItemInfo // d_item_data.h 35 | { 36 | u8 mShadowSize; 37 | u8 mCollisionH; 38 | u8 mCollisionR; 39 | u8 mFlags; 40 | } __attribute__( ( __packed__ ) ); 41 | 42 | static_assert( sizeof( ItemResource ) == 0x18 ); 43 | static_assert( sizeof( FieldItemRes ) == 0x10 ); 44 | static_assert( sizeof( ItemInfo ) == 0x4 ); 45 | 46 | extern "C" 47 | { 48 | extern ItemResource item_resource[255]; 49 | extern FieldItemRes field_item_res[255]; 50 | extern ItemInfo item_info[255]; 51 | } 52 | } // namespace tp::d_item_data -------------------------------------------------------------------------------- /include/tp/d_kankyo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::d_kankyo 6 | { 7 | // Should try to fill in the missing variables at some point 8 | struct EnvLight 9 | { 10 | u8 unk_0[0x98C]; 11 | u8 currentRoom; 12 | u8 unk_98d[0x983]; 13 | } __attribute__( ( __packed__ ) ); 14 | 15 | static_assert( sizeof( EnvLight ) == 0x1310 ); 16 | 17 | extern "C" 18 | { 19 | extern EnvLight env_light; 20 | } 21 | } // namespace tp::d_kankyo -------------------------------------------------------------------------------- /include/tp/d_map_path_dmap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::d_map_path_dmap 6 | { 7 | extern "C" 8 | { 9 | void getMapPlayerPos( float posOut[3] ); 10 | u32 getMapPlayerAngleY(); 11 | } 12 | } // namespace tp::d_map_path_dmap -------------------------------------------------------------------------------- /include/tp/d_menu_collect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::d_menu_collect 6 | { 7 | extern "C" 8 | { 9 | void setWalletMaxNum(); 10 | } 11 | } // namespace tp::d_menu_collect -------------------------------------------------------------------------------- /include/tp/d_meter2_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | 7 | namespace tp::d_meter2_info 8 | { 9 | extern "C" 10 | { 11 | extern void* wZButtonPtr; 12 | } 13 | } // namespace tp::d_meter2_info -------------------------------------------------------------------------------- /include/tp/d_msg_class.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::d_msg_class 6 | { 7 | extern "C" 8 | { 9 | u32 getFontCCColorTable( u8 colorId, u8 unk ); 10 | u32 getFontGCColorTable( u8 colorId, u8 unk ); 11 | } 12 | } // namespace tp::d_msg_class -------------------------------------------------------------------------------- /include/tp/d_msg_flow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::d_msg_flow 6 | { 7 | extern "C" 8 | { 9 | bool query022( void* unk1, void* unk2, s32 unk3 ); 10 | bool query023( void* unk1, void* unk2, s32 unk3 ); 11 | bool query024( void* dMsgFlow_cPtr, void* mesg_flow_node_branchPtr, void* fopAc_ac_cPtr, int unused ); 12 | bool query025( void* unk1, void* unk2, s32 unk3 ); 13 | } 14 | } // namespace tp::d_msg_flow -------------------------------------------------------------------------------- /include/tp/d_save.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | 7 | namespace tp::d_save 8 | { 9 | extern "C" 10 | { 11 | u16 getRupeeMax(); 12 | void getSave( tp::d_com_inf_game::GameInfo* gameInfoPtr, s32 areaID ); 13 | void putSave( tp::d_com_inf_game::GameInfo* gameInfoPtr, s32 areaID ); 14 | bool isDungeonItem( void* memBitPtr, const int param_1 ); 15 | bool isEventBit( u8* eventSystem, u16 indexNumber ); 16 | void onEventBit( u8* eventSystem, u16 indexNumber ); 17 | } 18 | } // namespace tp::d_save -------------------------------------------------------------------------------- /include/tp/d_stage.h: -------------------------------------------------------------------------------- 1 | /** @file d_stage.h 2 | * @brief Stage related functions and fields 3 | * 4 | * @author AECX 5 | * @bug No known bugs. 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "../defines.h" 11 | #include "dzx.h" 12 | 13 | namespace tp::d_stage 14 | { 15 | struct Item 16 | { 17 | char objectName[8]; 18 | u8 paramOne; 19 | u8 paramTwo; 20 | u8 membitFlag; 21 | u8 item; 22 | float pos[3]; 23 | s16 rot[3]; 24 | u16 enemyNum; 25 | } __attribute__( ( __packed__ ) ); 26 | 27 | static_assert( sizeof( Item ) == 0x20 ); 28 | 29 | extern "C" 30 | { 31 | extern void* mStatus_roomControl; 32 | 33 | /** 34 | * @brief Initialises Actors, can run multiple times per load 35 | * 36 | * @param mStatus_roomControl Pointer to roomControl data (unknown) 37 | * @param chunkTypeInfo Pointer to dzxHeader 38 | * @param unk3 unknown 39 | * @param unk4 unknown 40 | */ 41 | bool actorCommonLayerInit( void* mStatus_roomControl, dzxChunkTypeInfo* chunkTypeInfo, int unk3, void* unk4 ); 42 | bool actorInit( void* mStatus_roomControl, dzxChunkTypeInfo* chunkTypeInfo, int unk3, void* unk4 ); 43 | bool actorInit_always( void* mStatus_roomControl, dzxChunkTypeInfo* chunkTypeInfo, int unk3, void* unk4 ); 44 | } 45 | } // namespace tp::d_stage -------------------------------------------------------------------------------- /include/tp/dzx.h: -------------------------------------------------------------------------------- 1 | /** @file dzx.h 2 | * @brief dzx related definitions 3 | * 4 | * @author AECX 5 | * @bug No known bugs. 6 | */ 7 | #pragma once 8 | #include 9 | 10 | #include "../defines.h" 11 | 12 | namespace tp::d_stage 13 | { 14 | /** 15 | * @brief Holds information about the given dzx Chunktype 16 | * 17 | * Example: 18 | * TRES 19 | * 0001 20 | * 80401234 = 1 TRES Chunk at this address 21 | */ 22 | 23 | struct Actr 24 | { 25 | char objectName[8]; 26 | u32 parameters; 27 | float pos[3]; 28 | s16 rot[3]; 29 | u16 enemyNum; 30 | } __attribute__( ( __packed__ ) ); 31 | static_assert( sizeof( Actr ) == 0x20 ); 32 | 33 | struct dzxChunkTypeInfo 34 | { 35 | char tag[4]; 36 | u32 numChunks; 37 | void* chunkDataPtr; 38 | } __attribute__( ( __packed__ ) ); 39 | 40 | struct TRES 41 | { 42 | char actorName[8]; 43 | u32 flags; 44 | 45 | float X; 46 | float Y; 47 | float Z; 48 | 49 | s32 angle; 50 | 51 | u8 item; 52 | u8 unk2[3]; // Seems to always be 0xFF 53 | 54 | TRES() { memset( this, 0xFF, sizeof( TRES ) ); } 55 | } __attribute__( ( __packed__ ) ); 56 | static_assert( sizeof( TRES ) == 0x20 ); 57 | 58 | } // namespace tp::d_stage -------------------------------------------------------------------------------- /include/tp/evt_control.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::evt_control 6 | { 7 | typedef s32( csFunc )( void* unk, s32 unk2 ); 8 | extern "C" 9 | { 10 | s32 skipper( void* eventPtr ); 11 | s32 defaultSkipStb( void* unk, s32 unk2 ); 12 | } 13 | } // namespace tp::evt_control -------------------------------------------------------------------------------- /include/tp/f_ap_game.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::f_ap_game 6 | { 7 | extern "C" 8 | { 9 | void fapGm_Execute(); 10 | } 11 | } // namespace tp::f_ap_game -------------------------------------------------------------------------------- /include/tp/f_op_actor_mng.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::f_op_actor_mng 6 | { 7 | extern "C" 8 | { 9 | s32 createItemForPresentDemo( const float pos[3], 10 | s32 item, 11 | u8 unk3, 12 | s32 unk4, 13 | s32 unk5, 14 | const float unk6[3], 15 | const float unk7[3] ); 16 | s32 createItemForTrBoxDemo( const float pos[3], 17 | s32 item, 18 | s32 unk3, 19 | s32 unk4, 20 | const float unk5[3], 21 | const float unk6[3] ); 22 | s32 createDemoItem( const float pos[3], 23 | s32 item, 24 | s32 unk3, 25 | const float unk4[3], 26 | s32 unk5, 27 | const float unk6[3], 28 | u8 unk7 ); 29 | s32 createItemForBoss( const float pos[3], 30 | s32 item, 31 | s32 unk3, 32 | const float unk4[3], 33 | const float unk5[3], 34 | float unk6, 35 | float unk7, 36 | s32 unk8 ); 37 | s32 createItemForMidBoss( const float pos[3], 38 | s32 item, 39 | s32 unk3, 40 | const float unk4[3], 41 | const float unk5[3], 42 | s32 unk6, 43 | s32 unk7 ); 44 | s32 createItemForDirectGet( const float pos[3], 45 | s32 item, 46 | s32 unk3, 47 | const float unk4[3], 48 | const float unk5[3], 49 | float unk6, 50 | float unk7 ); 51 | s32 createItemForSimpleDemo( const float pos[3], 52 | s32 item, 53 | s32 unk3, 54 | const float unk4[3], 55 | const float unk5[3], 56 | float unk6, 57 | float unk7 ); 58 | } 59 | } // namespace tp::f_op_actor_mng -------------------------------------------------------------------------------- /include/tp/f_op_scene_req.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::f_op_scene_req 6 | { 7 | extern "C" 8 | { 9 | extern u8 freezeActors; 10 | extern s32 isUsingOfOverlap; 11 | } 12 | } // namespace tp::f_op_scene_req -------------------------------------------------------------------------------- /include/tp/m_Do_controller_pad.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::m_do_controller_pad 6 | { 7 | // Should try to fill in the missing variables at some point 8 | struct CPadInfo 9 | { 10 | u8 unk_0[0x30]; 11 | u32 buttonInput; 12 | u32 buttonInputTrg; 13 | u8 unk_38[0xC8]; 14 | } __attribute__( ( __packed__ ) ); 15 | 16 | static_assert( sizeof( CPadInfo ) == 0x100 ); 17 | 18 | extern "C" 19 | { 20 | extern CPadInfo cpadInfo; 21 | } 22 | } // namespace tp::m_do_controller_pad -------------------------------------------------------------------------------- /include/tp/m_Do_ext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::m_Do_ext 6 | { 7 | extern "C" 8 | { 9 | extern void* archiveHeap; 10 | } 11 | } // namespace tp::m_Do_ext -------------------------------------------------------------------------------- /include/tp/processor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::processor 6 | { 7 | extern "C" 8 | { 9 | void* getResource_groupID( const void* TProcessor, u16 unk2 ); 10 | } 11 | } // namespace tp::processor -------------------------------------------------------------------------------- /include/tp/resource.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "defines.h" 4 | 5 | namespace tp::resource 6 | { 7 | // Message commands 8 | #define MSG_BEGIN( name ) const char* name = 9 | 10 | #define MSG_END() ; 11 | 12 | // Message Speeds 13 | #define MSG_SPEED( speed ) "\x1A\x05\x00\x00" speed 14 | 15 | #define MSG_SPEED_FAST "\x01" 16 | #define MSG_SPEED_SLOW "\x02" 17 | 18 | #define MSG_COLOR( id ) "\x1A\x06\xFF\x00\x00" id 19 | 20 | // Message Icons 21 | #define MSG_ICON( icon ) "\x1A\x05\x00\x00" icon 22 | 23 | // Message colors 24 | #define MSG_COLOR_WHITE "\x00" 25 | #define MSG_COLOR_RED "\x01" 26 | #define MSG_COLOR_GREEN "\x02" 27 | #define MSG_COLOR_LIGHT_BLUE "\x03" 28 | #define MSG_COLOR_YELLOW "\x04" 29 | #define MSG_COLOR_PURPLE "\x06" 30 | #define MSG_COLOR_ORANGE "\x08" 31 | 32 | // Custom message colors 33 | #define CUSTOM_MSG_COLOR_DARK_GREEN "\x09" 34 | #define CUSTOM_MSG_COLOR_BLUE "\x0A" 35 | #define CUSTOM_MSG_COLOR_SILVER "\x0B" 36 | 37 | // Standard hex values for custom message colors 38 | // Needed for the getFontCCColorTable and getFontGCColorTable hooks 39 | #define CUSTOM_MSG_COLOR_DARK_GREEN_HEX 0x9 40 | #define CUSTOM_MSG_COLOR_BLUE_HEX 0xA 41 | #define CUSTOM_MSG_COLOR_SILVER_HEX 0xB 42 | 43 | // Message Icon Values 44 | #define MSG_ICON_R "\x0E" 45 | #define MSG_ICON_A "\x0A" 46 | #define MSG_ICON_X "\x0F" 47 | #define MSG_ICON_Y "\x10" 48 | 49 | extern "C" 50 | { 51 | char parseCharacter_1Byte( const char** text ); 52 | } 53 | } // namespace tp::resource -------------------------------------------------------------------------------- /source/HUDConsole.cpp: -------------------------------------------------------------------------------- 1 | #include "HUDConsole.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "defines.h" 7 | #include "systemConsole.h" 8 | 9 | namespace mod 10 | { 11 | HUDConsole::HUDConsole( const char firstPage[16], u32 RGBA ) 12 | { 13 | strcpy( pages[0], firstPage ); 14 | numPages = 1; 15 | 16 | // Set the visibility flags for all lines but disable the console 17 | system_console::setState( true, 25 ); 18 | system_console::setState( false, 0 ); 19 | 20 | system_console::setBackgroundColor( RGBA ); 21 | } 22 | 23 | void HUDConsole::addOption( u8 page, const char title[16], u8* target, u32 limit ) 24 | { 25 | // Page is 0-based index, numPages the absolute counter 26 | if ( page < numPages ) 27 | { 28 | // Find the option struct 29 | u8 optionIndex = numOptions[page]; 30 | 31 | if ( optionIndex < 10 ) 32 | { 33 | strcpy( options[page][optionIndex].Title, title ); 34 | options[page][optionIndex].Target = target; 35 | options[page][optionIndex].Limit = limit; 36 | 37 | // Incrase the counter 38 | numOptions[page]++; 39 | } 40 | } 41 | } 42 | 43 | void HUDConsole::addWatch( u8 page, const char title[16], void* target, char format, u8 interpretation ) 44 | { 45 | // Page is 0-based index, numPages the absolute counter 46 | if ( page < numPages ) 47 | { 48 | // Find the watch struct 49 | u8 watchIndex = numWatches[page]; 50 | 51 | if ( watchIndex < 10 ) 52 | { 53 | strcpy( watches[page][watchIndex].Title, title ); 54 | watches[page][watchIndex].Target = target; 55 | watches[page][watchIndex].Format = format; 56 | watches[page][watchIndex].Interpretation = interpretation; 57 | 58 | // Increase the counter 59 | numWatches[page]++; 60 | } 61 | } 62 | } 63 | 64 | s8 HUDConsole::addPage( const char title[16] ) 65 | { 66 | if ( numPages < MAX_HUDCONSOLE_PAGES ) 67 | { 68 | sprintf( pages[numPages], title ); 69 | numPages++; 70 | 71 | return ( numPages - 1 ); 72 | } 73 | return -1; 74 | } 75 | 76 | void HUDConsole::performAction( u8 consoleAction, u8 amount ) 77 | { 78 | Option* o = &options[selectedPage][selectedOption]; 79 | switch ( consoleAction ) 80 | { 81 | case ConsoleActions::Move_Up: 82 | // Y movement (Caret) 83 | if ( selectedOption > 0 ) 84 | { 85 | selectedOption--; 86 | } 87 | else 88 | { 89 | // Go to last option 90 | selectedOption = numOptions[selectedPage] - 1; 91 | } 92 | break; 93 | 94 | case ConsoleActions::Move_Down: 95 | // Y movement (Caret) 96 | if ( selectedOption < numOptions[selectedPage] - 1 ) 97 | { 98 | selectedOption++; 99 | } 100 | else 101 | { 102 | // Reset position 103 | selectedOption = 0; 104 | } 105 | break; 106 | 107 | case ConsoleActions::Move_Left: 108 | selectedOption = 0; 109 | // X Movement (Page) 110 | if ( selectedPage > 0 ) 111 | { 112 | selectedPage--; 113 | } 114 | else 115 | { 116 | // Go to last page 117 | selectedPage = numPages - 1; 118 | } 119 | break; 120 | 121 | case ConsoleActions::Move_Right: 122 | selectedOption = 0; 123 | // X Movement (Page) 124 | if ( selectedPage < numPages - 1 ) 125 | { 126 | selectedPage++; 127 | } 128 | else 129 | { 130 | // Go to first page 131 | selectedPage = 0; 132 | } 133 | break; 134 | 135 | case ConsoleActions::Option_Increase: 136 | if ( numOptions[selectedPage] < 1 ) 137 | return; 138 | if ( *o->Target + amount <= o->Limit ) 139 | { 140 | *o->Target = *o->Target + amount; 141 | } 142 | else 143 | { 144 | // Loop back 145 | *o->Target = 0; 146 | } 147 | break; 148 | 149 | case ConsoleActions::Option_Decrease: 150 | if ( numOptions[selectedPage] < 1 ) 151 | return; 152 | else if ( *o->Target - amount >= 0 ) 153 | { 154 | *o->Target = *o->Target - amount; 155 | } 156 | else 157 | { 158 | // Loop back 159 | *o->Target = static_cast( o->Limit ); 160 | } 161 | break; 162 | } 163 | } 164 | 165 | void HUDConsole::draw() 166 | { 167 | // Current line index 168 | u8 i = 0; 169 | 170 | tp::jfw_system::SystemConsole* console = sysConsolePtr; 171 | 172 | // Print heading 173 | sprintf( console->consoleLine[i].line, 174 | "[%d/%d][%-18s] %s (C) %s", 175 | selectedPage + 1, 176 | numPages, 177 | pages[selectedPage], 178 | VERSION, 179 | AUTHOR ); 180 | 181 | // Print options 182 | for ( i = 1; i <= numOptions[selectedPage]; i++ ) 183 | { 184 | // Template: 185 | // [>] [title] (padding) [value] 186 | u8 optionindex = i - 1; // Option[0] is line 1 187 | Option o = options[selectedPage][optionindex]; 188 | 189 | if ( o.Limit == 1 ) 190 | { 191 | sprintf( console->consoleLine[i].line, 192 | "%c%-25s %s", 193 | ( optionindex == selectedOption ? '>' : ' ' ), 194 | o.Title, 195 | ( *o.Target ? "Yes" : "No" ) ); 196 | } 197 | else 198 | { 199 | sprintf( console->consoleLine[i].line, 200 | "%c%-25s %02x", 201 | ( optionindex == selectedOption ? '>' : ' ' ), 202 | o.Title, 203 | *o.Target ); 204 | } 205 | } 206 | 207 | for ( i = i; i < 11; i++ ) 208 | { 209 | console->consoleLine[i].line[0] = '\0'; 210 | } 211 | 212 | for ( i = i; ( i - 11 ) < numWatches[selectedPage]; i++ ) 213 | { 214 | u8 watchIndex = i - 11; 215 | // Print the watch to this line 216 | Watch w = watches[selectedPage][watchIndex]; 217 | 218 | char format[12]; 219 | sprintf( format, "%s%c", "%-15s %", w.Format ); 220 | 221 | if ( w.Interpretation == WatchInterpretation::_s64 || w.Interpretation == WatchInterpretation::_u64 ) 222 | { 223 | sprintf( format, "%s%c", "%-15s %ll", w.Format ); 224 | } 225 | 226 | switch ( w.Interpretation ) 227 | { 228 | case WatchInterpretation::_u8: 229 | sprintf( console->consoleLine[i].line, format, w.Title, *reinterpret_cast( w.Target ) ); 230 | break; 231 | 232 | case WatchInterpretation::_u16: 233 | sprintf( console->consoleLine[i].line, format, w.Title, *reinterpret_cast( w.Target ) ); 234 | break; 235 | 236 | case WatchInterpretation::_u32: 237 | sprintf( console->consoleLine[i].line, format, w.Title, *reinterpret_cast( w.Target ) ); 238 | break; 239 | 240 | case WatchInterpretation::_u64: 241 | sprintf( console->consoleLine[i].line, format, w.Title, *reinterpret_cast( w.Target ) ); 242 | break; 243 | 244 | case WatchInterpretation::_s8: 245 | sprintf( console->consoleLine[i].line, format, w.Title, *reinterpret_cast( w.Target ) ); 246 | break; 247 | 248 | case WatchInterpretation::_s16: 249 | sprintf( console->consoleLine[i].line, format, w.Title, *reinterpret_cast( w.Target ) ); 250 | break; 251 | 252 | case WatchInterpretation::_s32: 253 | sprintf( console->consoleLine[i].line, format, w.Title, *reinterpret_cast( w.Target ) ); 254 | break; 255 | 256 | case WatchInterpretation::_s64: 257 | sprintf( console->consoleLine[i].line, format, w.Title, *reinterpret_cast( w.Target ) ); 258 | break; 259 | 260 | case WatchInterpretation::_str: 261 | sprintf( console->consoleLine[i].line, format, w.Title, reinterpret_cast( w.Target ) ); 262 | break; 263 | 264 | default: 265 | strcpy( console->consoleLine[i].line, "Error parsing watch" ); 266 | break; 267 | } 268 | } 269 | 270 | for ( i = i; i < 20; i++ ) 271 | { 272 | console->consoleLine[i].line[0] = '\0'; 273 | } 274 | } 275 | } // namespace mod -------------------------------------------------------------------------------- /source/array.cpp: -------------------------------------------------------------------------------- 1 | #include "array.h" 2 | 3 | #include 4 | 5 | #include "memory.h" 6 | 7 | namespace mod::array 8 | { 9 | s32 indexOf( u16 needle, u16* haystack, size_t count ) 10 | { 11 | for ( u32 i = 0; i < count; i++ ) 12 | { 13 | if ( haystack[i] == needle ) 14 | { 15 | return static_cast( i ); 16 | } 17 | } 18 | return -1; 19 | } 20 | } // namespace mod::array -------------------------------------------------------------------------------- /source/controller.cpp: -------------------------------------------------------------------------------- 1 | #include "controller.h" 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | 7 | namespace mod::controller 8 | { 9 | bool checkForButtonInput( u32 buttonCombo ) 10 | { 11 | return ( tp::m_do_controller_pad::cpadInfo.buttonInput & buttonCombo ) == buttonCombo; 12 | } 13 | 14 | bool checkForButtonInputSingleFrame( u32 buttonCombo ) 15 | { 16 | tp::m_do_controller_pad::CPadInfo* PadInfo = &tp::m_do_controller_pad::cpadInfo; 17 | if ( ( PadInfo->buttonInput & buttonCombo ) == buttonCombo ) 18 | { 19 | if ( PadInfo->buttonInputTrg & buttonCombo ) 20 | { 21 | return true; 22 | } 23 | } 24 | return false; 25 | } 26 | } // namespace mod::controller -------------------------------------------------------------------------------- /source/cxx.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "defines.h" 7 | 8 | void* operator new( size_t size ) 9 | { 10 | void* ArchiveHeapPtr = tp::m_Do_ext::archiveHeap; 11 | void* NewPtr = tp::jkr_exp_heap::do_alloc_JKRExpHeap( ArchiveHeapPtr, size, 0x20 ); 12 | return memset( NewPtr, 0, size ); 13 | } 14 | void* operator new[]( size_t size ) 15 | { 16 | void* ArchiveHeapPtr = tp::m_Do_ext::archiveHeap; 17 | void* NewPtr = tp::jkr_exp_heap::do_alloc_JKRExpHeap( ArchiveHeapPtr, size, 0x20 ); 18 | return memset( NewPtr, 0, size ); 19 | } 20 | void operator delete( void* ptr ) 21 | { 22 | void* ArchiveHeapPtr = tp::m_Do_ext::archiveHeap; 23 | return tp::jkr_exp_heap::do_free_JKRExpHeap( ArchiveHeapPtr, ptr ); 24 | } 25 | void operator delete[]( void* ptr ) 26 | { 27 | void* ArchiveHeapPtr = tp::m_Do_ext::archiveHeap; 28 | return tp::jkr_exp_heap::do_free_JKRExpHeap( ArchiveHeapPtr, ptr ); 29 | } -------------------------------------------------------------------------------- /source/cxx.ld: -------------------------------------------------------------------------------- 1 | /* Symbols for us to be able to call global constructors and destructors */ 2 | _ctors_start = ADDR(.ctors); 3 | _ctors_end = _ctors_start + SIZEOF(.ctors); 4 | _dtors_start = ADDR(.dtors); 5 | _dtors_end = _dtors_start + SIZEOF(.dtors); -------------------------------------------------------------------------------- /source/eventListener.cpp: -------------------------------------------------------------------------------- 1 | #include "eventListener.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #include "defines.h" 11 | 12 | namespace mod::event 13 | { 14 | EventListener::EventListener() { sprintf( sysConsolePtr->consoleLine[20].line, "Event Listener Initialized." ); } 15 | 16 | void EventListener::addLoadEvent( char* stage, 17 | u8 room, 18 | u8 spawn, 19 | u8 state, 20 | u8 eventid, 21 | EventFunction trigger, 22 | LoadEventAccuracy accuracy ) 23 | { 24 | if ( loadEventIndex < MAX_LOAD_EVENTS ) 25 | { 26 | // Add the event to the array 27 | loadEvents[loadEventIndex] = { stage, room, spawn, state, eventid, trigger, accuracy }; 28 | 29 | loadEventIndex++; 30 | } 31 | } 32 | 33 | void EventListener::checkLoadEvents() 34 | { 35 | char* stage = gameInfo.nextStageVars.nextStage; 36 | u8 room = gameInfo.nextStageVars.nextRoom; 37 | u8 spawn = static_cast( gameInfo.nextStageVars.nextSpawnPoint ); 38 | u8 state = gameInfo.nextStageVars.nextState; 39 | u8 eventid = gameInfo.eventSystem.currentEventID; 40 | 41 | for ( u8 i = 0; i < loadEventIndex; i++ ) 42 | { 43 | LoadEvent e = loadEvents[i]; 44 | if ( strcmp( stage, e.Stage ) == 0 ) 45 | { 46 | // Stage is minimum requirement 47 | if ( e.Accuracy == LoadEventAccuracy::Stage ) 48 | { 49 | e.Trigger(); 50 | } 51 | 52 | if ( room == e.Room || e.Room == 0xFF ) 53 | { 54 | if ( e.Accuracy == LoadEventAccuracy::Stage_Room ) 55 | { 56 | e.Trigger(); 57 | } 58 | 59 | if ( spawn == e.Spawn || e.Spawn == 0xFF ) 60 | { 61 | if ( e.Accuracy == LoadEventAccuracy::Stage_Room_Spawn ) 62 | { 63 | e.Trigger(); 64 | } 65 | 66 | if ( state == e.State || e.State == 0xFF ) 67 | { 68 | if ( e.Accuracy == LoadEventAccuracy::Stage_Room_Spawn_State ) 69 | { 70 | e.Trigger(); 71 | } 72 | 73 | if ( eventid == e.Eventid ) 74 | { 75 | // No accuracy check since it's already ::All 76 | e.Trigger(); 77 | } 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | } // namespace mod::event -------------------------------------------------------------------------------- /source/grottoChecks.cpp: -------------------------------------------------------------------------------- 1 | #include "grottoChecks.h" 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::grottoChecks 6 | { 7 | u16 g1_0[1] // Lanayru2 8 | { 73 }; 9 | u16 g1_1[2] // Eldin2 10 | { 121, 122 }; 11 | u16 g1_2[1] // Ordon 12 | { 167 }; 13 | u16 g1_3[2] // Lanayru3 14 | { 15 | 434, // poe 30 16 | 435 // poe 31 17 | }; 18 | 19 | u16 g2_0[3] // Eldin4 20 | { 163, 164, 165 }; 21 | u16 g2_1[3] // Faron1 22 | { 111, 112, 113 }; 23 | u16 g2_2[1] // Sacred 24 | { 72 }; 25 | /*u16 g2_3[0]//Eldin1 26 | { 27 | 28 | };*/ 29 | 30 | u16 g3_0[3] // Gerudo3 31 | { 32 | 132, 33 | 420, // poe 16 34 | 421 // poe 17 35 | }; 36 | /*u16 g3_1[0]//Gerudo2 37 | { 38 | 39 | };*/ 40 | /*u16 g3_2[0]//Snowpeak2 41 | { 42 | 43 | };*/ 44 | /*u16 g3_3[0]//Lanayru5 45 | { 46 | 47 | };*/ 48 | 49 | u16 g4_0[1] // Lanayru6 50 | { 108 }; 51 | u16 g4_1[1] // Gerudo1 52 | { 124 }; 53 | u16 g4_2[1] // Snowpeak1 54 | { 189 }; 55 | u16 g4_3[1] // Lanayru4 56 | { 105 }; 57 | 58 | u16 g5_0[1] // Lanayru1 59 | { 120 }; 60 | /*u16 g5_1[0]//Faron2 61 | { 62 | 63 | };*/ 64 | u16 g5_2[1] // Lake2 65 | { 89 }; 66 | u16 g5_3[1] // Eldin3 67 | { 123 }; 68 | u16 g5_4[1] // Lake1 69 | { 102 }; 70 | 71 | } // namespace mod::grottoChecks -------------------------------------------------------------------------------- /source/item.cpp: -------------------------------------------------------------------------------- 1 | #include "item.h" 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | #include "items.h" 7 | 8 | namespace mod::item 9 | { 10 | u8 itemGetAnimationFlags[10] = { 11 | static_cast( ItemFlags::Blue_Rupee ), 12 | static_cast( ItemFlags::Yellow_Rupee ), 13 | static_cast( ItemFlags::Red_Rupee ), 14 | static_cast( ItemFlags::Purple_Rupee ), 15 | static_cast( ItemFlags::Orange_Rupee ), 16 | static_cast( ItemFlags::Seeds_50 ), 17 | static_cast( ItemFlags::Arrows_30 ), 18 | static_cast( ItemFlags::Arrows_20 ), 19 | static_cast( ItemFlags::Arrows_10 ), 20 | static_cast( ItemFlags::Arrows_1 ), 21 | }; 22 | u32 getFlags( u8 item, u32 currentPlayerConditions ) 23 | { 24 | u32 flags = currentPlayerConditions; 25 | switch ( item ) 26 | { 27 | case items::Item::Lantern: 28 | flags |= item::Condition::Lantern; 29 | break; 30 | 31 | case items::Item::Iron_Boots: 32 | flags |= item::Condition::Iron_Boots; 33 | break; 34 | 35 | case items::Item::Boomerang: 36 | flags |= item::Condition::Boomerang; 37 | break; 38 | 39 | case items::Item::Slingshot: 40 | flags |= item::Condition::Slingshot; 41 | break; 42 | 43 | case items::Item::Heros_Bow: 44 | flags |= item::Condition::Bow; 45 | break; 46 | 47 | case items::Item::Goron_Bomb_Bag: 48 | flags |= item::Condition::Bombs; 49 | flags |= item::Condition::Water_Bombs; 50 | break; 51 | 52 | case items::Item::Empty_Bomb_Bag: 53 | flags |= item::Condition::Bombs; 54 | flags |= item::Condition::Water_Bombs; 55 | break; 56 | 57 | case items::Item::Ball_and_Chain: 58 | flags |= item::Condition::Ball_And_Chain; 59 | break; 60 | 61 | case items::Item::Clawshot: 62 | flags |= item::Condition::Clawshot; 63 | break; 64 | 65 | case items::Item::Clawshots: 66 | flags |= item::Condition::Double_Clawshot; 67 | break; 68 | 69 | case items::Item::Spinner: 70 | flags |= item::Condition::Spinner; 71 | break; 72 | 73 | case items::Item::Dominion_Rod_Uncharged: 74 | flags |= item::Condition::Dominion_Rod; 75 | break; 76 | 77 | case items::Item::Zora_Armor: 78 | flags |= item::Condition::Zora_Armor; 79 | break; 80 | 81 | case items::Item::Coral_Earring: 82 | flags |= item::Condition::Coral_Earring; 83 | break; 84 | 85 | case items::Item::Wooden_Sword: 86 | flags |= item::Condition::Wooden_Sword; 87 | break; 88 | 89 | case items::Item::Ordon_Sword: 90 | flags |= item::Condition::Ordon_Sword; 91 | break; 92 | 93 | case items::Item::Shadow_Crystal: 94 | flags |= item::Condition::Shadow_Crystal; 95 | break; 96 | 97 | case items::Item::Ordon_Shield: 98 | flags |= item::Condition::Shield; 99 | break; 100 | 101 | case items::Item::Wooden_Shield: 102 | flags |= item::Condition::Shield; 103 | break; 104 | 105 | case items::Item::Hylian_Shield: 106 | flags |= item::Condition::Shield; 107 | break; 108 | } 109 | 110 | if ( ( flags & item::Condition::Bow ) && 111 | ( ( flags & item::Condition::Bombs ) || ( flags & item::Condition::Water_Bombs ) ) ) 112 | { 113 | // We have bow && (bombs || waterbombs) = bombarrows 114 | flags |= item::Condition::Bomb_Arrows; 115 | } 116 | 117 | return flags; 118 | } 119 | 120 | u8 customSmallKeyItemIDs[10] = { items::Forest_Temple_Small_Key, 121 | items::Goron_Mines_Small_Key, 122 | items::Lakebed_Temple_Small_Key, 123 | items::Arbiters_Grounds_Small_Key, 124 | items::Snowpeak_Ruins_Small_Key, 125 | items::Temple_of_Time_Small_Key, 126 | items::City_in_The_Sky_Small_Key, 127 | items::Palace_of_Twilight_Small_Key, 128 | items::Hyrule_Castle_Small_Key, 129 | items::Bublin_Camp_Key }; 130 | 131 | u8 customBigKeyItemIDs[7] = { items::Forest_Temple_Big_Key, 132 | items::Lakebed_Temple_Big_Key, 133 | items::Arbiters_Grounds_Big_Key, 134 | items::Temple_of_Time_Big_Key, 135 | items::City_in_The_Sky_Big_Key, 136 | items::Palace_of_Twilight_Big_Key, 137 | items::Hyrule_Castle_Big_Key }; 138 | 139 | u8 customDungeonMapItemIDs[9] = { items::Forest_Temple_Dungeon_Map, 140 | items::Goron_Mines_Dungeon_Map, 141 | items::Lakebed_Temple_Dungeon_Map, 142 | items::Arbiters_Grounds_Dungeon_Map, 143 | items::Snowpeak_Ruins_Dungeon_Map, 144 | items::Temple_of_Time_Dungeon_Map, 145 | items::City_in_The_Sky_Dungeon_Map, 146 | items::Palace_of_Twilight_Dungeon_Map, 147 | items::Hyrule_Castle_Dungeon_Map }; 148 | 149 | u8 customCompassItemIDs[9] = { items::Forest_Temple_Compass, 150 | items::Goron_Mines_Compass, 151 | items::Lakebed_Temple_Compass, 152 | items::Arbiters_Grounds_Compass, 153 | items::Snowpeak_Ruins_Compass, 154 | items::Temple_of_Time_Compass, 155 | items::City_in_The_Sky_Compass, 156 | items::Palace_of_Twilight_Compass, 157 | items::Hyrule_Castle_Compass }; 158 | 159 | u8 customHiddenSkillItemIDs[7] = { items::Ending_Blow, 160 | items::Shield_Attack, 161 | items::Back_Slice, 162 | items::Helm_Splitter, 163 | items::Mortal_Draw, 164 | items::Jump_Strike, 165 | items::Great_Spin }; 166 | } // namespace mod::item -------------------------------------------------------------------------------- /source/keyPlacement.cpp: -------------------------------------------------------------------------------- 1 | #include "keyPlacement.h" 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::keyPlacement 6 | { 7 | u16 FT_keys[4] { 8 | 9, // Windless Bridge Chest 9 | 11, // totem key 10 | 343, // big baba 11 | 18 // North Deku like chest 12 | }; 13 | u16 FT_1[5] { 14 | 6, // entry 15 | 8, // map 16 | 9, // Windless Bridge Chest 17 | 344, // ooccoo 18 | 17 // Water Cave Chest 19 | }; 20 | u16 FT_2[5] { 21 | 6, // entry 22 | 8, // map 23 | 9, // Windless Bridge Chest 24 | 344, // ooccoo 25 | 17 // Water Cave Chest 26 | }; 27 | u16 FT_3[9] { 28 | 6, // entry 29 | 8, // map 30 | 9, // Windless Bridge Chest 31 | 344, // ooccoo 32 | 17, // Water Cave Chest 33 | 13, // PoH deku ike 34 | 11, // totem key 35 | 12, // Small Chest West Tile 36 | 343 // big baba 37 | }; 38 | u16 FT_4[9] { 39 | 6, // entry 40 | 8, // map 41 | 9, // Windless Bridge Chest 42 | 344, // ooccoo 43 | 17, // Water Cave Chest 44 | 13, // PoH deku ike 45 | 11, // totem key 46 | 12, // Small Chest West Tile 47 | 343 // big baba 48 | }; 49 | 50 | u16 GM_keys[3] { 51 | 23, // Hub Bottom Chest 52 | 27, // Chest under water 53 | 30 // Outside Bemos Chest 54 | }; 55 | u16 GM_1[2] { 56 | 22, // Entry Chest 57 | 23 // Hub Bottom Chest 58 | }; 59 | u16 GM_2[10] { 60 | 22, // Entry Chest 61 | 23, // Hub Bottom Chest 62 | 24, // map 63 | 25, // Gor Amato Small Chest 64 | 354, // key shard 1 65 | 345, // ooccoo 66 | 26, // POH Chest 67 | 28, // Small chest in water room 68 | 27, // Chest under water 69 | 29 // POH Chest 2 70 | }; 71 | u16 GM_3[12] { 72 | 22, // Entry Chest 73 | 23, // Hub Bottom Chest 74 | 24, // map 75 | 25, // Gor Amato Small Chest 76 | 354, // key shard 1 77 | 345, // ooccoo 78 | 26, // POH Chest 79 | 28, // Small chest in water room 80 | 27, // Chest under water 81 | 29, // POH Chest 2 82 | 30, // Outside Bemos Chest 83 | 37 // Outside Underwater 84 | }; 85 | 86 | u16 LBT_keys[3] { 87 | 51, // Water Bridge Chest 88 | 53, // 2nd Floor East SE Chest 89 | 55 // Pre Deku Toad Chest 90 | }; 91 | u16 LBT_1[7] { 92 | 46, // Entry Chest 1 93 | 47, // Entry Chest 2 94 | 48, // Stalactie Small Chest 95 | 49, // Hub Small Chest 96 | 346, // ooccoo 97 | 50, // map 98 | 51 // Water Bridge Chest 99 | }; 100 | u16 LBT_2[9] { 101 | 46, // Entry Chest 1 102 | 47, // Entry Chest 2 103 | 48, // Stalactie Small Chest 104 | 49, // Hub Small Chest 105 | 346, // ooccoo 106 | 50, // map 107 | 51, // Water Bridge Chest 108 | 52, // 2nd Floor East SW Chest 109 | 53 // 2nd Floor East SE Chest 110 | }; 111 | u16 LBT_3[11] { 112 | 46, // Entry Chest 1 113 | 47, // Entry Chest 2 114 | 48, // Stalactie Small Chest 115 | 49, // Hub Small Chest 116 | 346, // ooccoo 117 | 50, // map 118 | 51, // Water Bridge Chest 119 | 52, // 2nd Floor East SW Chest 120 | 53, // 2nd Floor East SE Chest 121 | 54, // East Water Small Chest 122 | 55 // Pre Deku Toad Chest 123 | }; 124 | 125 | u16 AG_keys[5] { 126 | 143, // Entry Chest 127 | 144, // East Redead Small Chest 128 | 148, // East Upper Redead Chest 129 | 149, // Ghoul Rat Small Chest 130 | 154 // North Turn Room Chest 131 | }; 132 | u16 AG_1[1] { 133 | 143 // Entry Chest 134 | }; 135 | u16 AG_2[7] { 136 | 143, // Entry Chest 137 | 146, // map 138 | 145, // Poe Hub POH 139 | 405, // poe 1 140 | 144, // East Redead Small Chest 141 | 406, // poe 2 142 | 150 // West Small Chest 143 | }; 144 | u16 AG_3[9] { 145 | 143, // Entry Chest 146 | 146, // map 147 | 145, // Poe Hub POH 148 | 405, // poe 1 149 | 144, // East Redead Small Chest 150 | 406, // poe 2 151 | 150, // West Small Chest 152 | 147, // compass 153 | 148 // East Upper Redead Chest 154 | }; 155 | u16 AG_4[11] { 156 | 143, // Entry Chest 157 | 146, // map 158 | 145, // Poe Hub POH 159 | 405, // poe 1 160 | 144, // East Redead Small Chest 161 | 406, // poe 2 162 | 150, // West Small Chest 163 | 147, // compass 164 | 148, // East Upper Redead Chest 165 | 407, // poe 3 166 | 149 // Ghoul Rat Small Chest 167 | }; 168 | u16 AG_5[16] { 169 | 143, // Entry Chest 170 | 146, // map 171 | 145, // Poe Hub POH 172 | 405, // poe 1 173 | 144, // East Redead Small Chest 174 | 406, // poe 2 175 | 150, // West Small Chest 176 | 147, // compass 177 | 148, // East Upper Redead Chest 178 | 407, // poe 3 179 | 149, // Ghoul Rat Small Chest 180 | 151, // West Chandelier Chest 181 | 152, // Stalfos Chest 1 182 | 153, // Stalfos Chest 2 183 | 408, // poe 4 184 | 154 // North Turn Room Chest 185 | }; 186 | 187 | u16 SPR_keys[6] { 188 | 174, // CY Partially Buried Chest 189 | 173, // pumpkin 190 | 171, // Buried Chest 191 | 178, // cheese 192 | 180, // Wooden Beam C. Chest 193 | 184 // Chilfos Small Chest 194 | }; 195 | u16 SPR_1[5] { 196 | 456, // poe 1 197 | 339, // map 198 | 348, // ooccoo 199 | 172, // Courtyard Open Chest 200 | 174 // CY Partially Buried Chest 201 | }; 202 | u16 SPR_2[6] { 203 | 456, // poe 1 204 | 339, // map 205 | 348, // ooccoo 206 | 172, // Courtyard Open Chest 207 | 174, // CY Partially Buried Chest 208 | 173 // pumpkin 209 | }; 210 | u16 SPR_3[10] { 211 | 456, // poe 1 212 | 339, // map 213 | 348, // ooccoo 214 | 172, // Courtyard Open Chest 215 | 174, // CY Partially Buried Chest 216 | 173, // pumpkin 217 | 185, // Storage Chest Right 218 | 175, // Small Beams Chest 219 | 176, // compass 220 | 171 // Buried Chest 221 | }; 222 | u16 SPR_4[13] { 223 | 456, // poe 1 224 | 339, // map 225 | 348, // ooccoo 226 | 172, // Courtyard Open Chest 227 | 174, // CY Partially Buried Chest 228 | 173, // pumpkin 229 | 185, // Storage Chest Right 230 | 175, // Small Beams Chest 231 | 176, // compass 232 | 171, // Buried Chest 233 | 177, // Courtyard South Chest 234 | 290, // BaC 235 | 178 // cheese 236 | }; 237 | u16 SPR_5[19] { 238 | 456, // poe 1 239 | 339, // map 240 | 348, // ooccoo 241 | 172, // Courtyard Open Chest 242 | 174, // CY Partially Buried Chest 243 | 173, // pumpkin 244 | 185, // Storage Chest Right 245 | 175, // Small Beams Chest 246 | 176, // compass 247 | 171, // Buried Chest 248 | 177, // Courtyard South Chest 249 | 290, // BaC 250 | 178, // cheese 251 | 179, // Breakable Floor POH 252 | 180, // Wooden Beam C. Chest 253 | 457, // poe 2 254 | 182, // Entry Chest Left 255 | 183, // Entry Chest Right 256 | 186 // Storage Chest Left 257 | }; 258 | u16 SPR_6[22] { 259 | 456, // poe 1 260 | 339, // map 261 | 348, // ooccoo 262 | 172, // Courtyard Open Chest 263 | 174, // CY Partially Buried Chest 264 | 173, // pumpkin 265 | 185, // Storage Chest Right 266 | 175, // Small Beams Chest 267 | 176, // compass 268 | 171, // Buried Chest 269 | 177, // Courtyard South Chest 270 | 290, // BaC 271 | 178, // cheese 272 | 179, // Breakable Floor POH 273 | 180, // Wooden Beam C. Chest 274 | 457, // poe 2 275 | 182, // Entry Chest Left 276 | 183, // Entry Chest Right 277 | 186, // Storage Chest Left 278 | 181, // Entry POH Chest 279 | 458, // poe 3 280 | 184 // Chilfos Small Chest 281 | }; 282 | 283 | u16 ToT_keys[3] { 284 | 193, // Entry Chest 285 | 197, // Armos Room Left Chest 286 | 200 // Third Stair Window Chest 287 | }; 288 | u16 ToT_1[2] { 289 | 193, // Entry Chest 290 | 349 // ooccoo 291 | }; 292 | u16 ToT_2[8] { 293 | 193, // Entry Chest 294 | 349, // ooccoo 295 | 194, // First Stair Small Chest pots 296 | 195, // First Stair Small Chest 297 | 196, // map 298 | 459, // poe 1 299 | 207, // Armos Room Small Chest 300 | 197 // Armos Room Left Chest 301 | }; 302 | u16 ToT_3[16] { 303 | 193, // Entry Chest 304 | 349, // ooccoo 305 | 194, // First Stair Small Chest pots 306 | 195, // First Stair Small Chest 307 | 196, // map 308 | 459, // poe 1 309 | 207, // Armos Room Small Chest 310 | 197, // Armos Room Left Chest 311 | 198, // compass 312 | 199, // Scale Room Spider Chest 313 | 460, // poe 2 314 | 203, // Small Chest Scale Room 315 | 204, // Helmasaur Small Chest 316 | 205, // boss key 317 | 200, // Third Stair Window Chest 318 | 201 // Gilloutine Chest 319 | }; 320 | 321 | u16 CitS_keys[1] { 322 | 219 // West Wing Chest 1 323 | }; 324 | u16 CitS_1[7] { 325 | 217, // Underwater Chest 1 326 | 218, // Underwater Chest 2 327 | 219, // West Wing Chest 1 328 | 350, // ooccoo 329 | 488, // Lantern_Oil 330 | 489, // Red_Potion 331 | 490 // Blue_Potion 332 | }; 333 | 334 | u16 PoT_keys[7] { 335 | 245, // West 1st Central Chest 336 | 246, // West 2nd Central Chest 337 | 251, // East 1st North Chest 338 | 255, // East 2nd SE Chest 339 | 258, // Central Room 1st Chest 340 | 260, // Central Outdoor Chest 341 | 261 // Central Tower Chest 342 | }; 343 | u16 PoT_1[1] { 344 | 245 // West 1st Central Chest 345 | }; 346 | u16 PoT_2[4] { 347 | 245, // West 1st Central Chest 348 | 246, // West 2nd Central Chest 349 | 247, // compass 350 | 248 // West 2nd SE Chest 351 | }; 352 | u16 PoT_3[6] { 353 | 245, // West 1st Central Chest 354 | 246, // West 2nd Central Chest 355 | 247, // compass 356 | 248, // West 2nd SE Chest 357 | 250, // East 1st Small Chest 358 | 251 // East 1st North Chest 359 | }; 360 | u16 PoT_4[10] { 361 | 245, // West 1st Central Chest 362 | 246, // West 2nd Central Chest 363 | 247, // compass 364 | 248, // West 2nd SE Chest 365 | 250, // East 1st Small Chest 366 | 251, // East 1st North Chest 367 | 252, // East 2nd NE Chest 368 | 253, // East 2nd NW Chest 369 | 254, // map 370 | 255 // East 2nd SE Chest 371 | }; 372 | u16 PoT_5[14] { 373 | 245, // West 1st Central Chest 374 | 246, // West 2nd Central Chest 375 | 247, // compass 376 | 248, // West 2nd SE Chest 377 | 250, // East 1st Small Chest 378 | 251, // East 1st North Chest 379 | 252, // East 2nd NE Chest 380 | 253, // East 2nd NW Chest 381 | 254, // map 382 | 255, // East 2nd SE Chest 383 | 249, // West 1st POH Chest 384 | 256, // East 1st POH Chest 385 | 257, // East 1st West Chest 386 | 258 // Central Room 1st Chest 387 | }; 388 | u16 PoT_6[16] { 389 | 245, // West 1st Central Chest 390 | 246, // West 2nd Central Chest 391 | 247, // compass 392 | 248, // West 2nd SE Chest 393 | 250, // East 1st Small Chest 394 | 251, // East 1st North Chest 395 | 252, // East 2nd NE Chest 396 | 253, // East 2nd NW Chest 397 | 254, // map 398 | 255, // East 2nd SE Chest 399 | 249, // West 1st POH Chest 400 | 256, // East 1st POH Chest 401 | 257, // East 1st West Chest 402 | 258, // Central Room 1st Chest 403 | 259, // big key 404 | 260 // Central Outdoor Chest 405 | }; 406 | u16 PoT_7[17] { 407 | 245, // West 1st Central Chest 408 | 246, // West 2nd Central Chest 409 | 247, // compass 410 | 248, // West 2nd SE Chest 411 | 250, // East 1st Small Chest 412 | 251, // East 1st North Chest 413 | 252, // East 2nd NE Chest 414 | 253, // East 2nd NW Chest 415 | 254, // map 416 | 255, // East 2nd SE Chest 417 | 249, // West 1st POH Chest 418 | 256, // East 1st POH Chest 419 | 257, // East 1st West Chest 420 | 258, // Central Room 1st Chest 421 | 259, // big key 422 | 260, // Central Outdoor Chest 423 | 261 // Central Tower Chest 424 | }; 425 | 426 | u16 HC_keys[3] { 427 | 342, // king bulblin key 428 | 265, // Grave Owl Chest 429 | 274 // SE Balcony Tower Chest 430 | }; 431 | u16 HC_1[9] { 432 | 262, // Grave Switch Right Chest 433 | 263, // Grave Switch Left Chest 1 434 | 264, // Grave Switch Left Chest 2 435 | 265, // Grave Owl Chest 436 | 266, // map 437 | 267, // East Castle Balcony 438 | 268, // West CY North Chest 439 | 269, // West CY Central Chest 440 | 342 // king bulblin key 441 | }; 442 | u16 HC_2[15] { 443 | 262, // Grave Switch Right Chest 444 | 263, // Grave Switch Left Chest 1 445 | 264, // Grave Switch Left Chest 2 446 | 265, // Grave Owl Chest 447 | 266, // map 448 | 267, // East Castle Balcony 449 | 268, // West CY North Chest 450 | 269, // West CY Central Chest 451 | 342, // king bulblin key 452 | 270, // compass 453 | 271, // Lantern Staircase 454 | 272, // HUB SW Chest 455 | 273, // HUB NW Chest 456 | 274, // SE Balcony Tower Chest 457 | 275 // big key 458 | }; 459 | u16 HC_3[15] { 460 | 262, // Grave Switch Right Chest 461 | 263, // Grave Switch Left Chest 1 462 | 264, // Grave Switch Left Chest 2 463 | 265, // Grave Owl Chest 464 | 266, // map 465 | 267, // East Castle Balcony 466 | 268, // West CY North Chest 467 | 269, // West CY Central Chest 468 | 342, // king bulblin key 469 | 270, // compass 470 | 271, // Lantern Staircase 471 | 272, // HUB SW Chest 472 | 273, // HUB NW Chest 473 | 274, // SE Balcony Tower Chest 474 | 275 // big key 475 | }; 476 | 477 | u16 F_keys[2] { 478 | 2, // North Cave Key 479 | 351 // coro key 480 | }; 481 | u16 F_1[4] { 482 | 296, // lantern 483 | 2, // North Cave Key 484 | 3, // PoH key cave 485 | 1 // transition cave 486 | }; 487 | u16 F_2[2] { 488 | 329, // coro bottle 489 | 351 // coro key 490 | }; 491 | 492 | u16 GD_keys[1] { 493 | 353 // camp key 494 | }; 495 | 496 | u16 GD_1[21] { 497 | 125, // desert chest 498 | 126, // desert chest 499 | 127, // desert chest 500 | 131, // desert chest 501 | 133, // desert chest 502 | 134, // desert chest 503 | 135, // desert chest 504 | 136, // desert chest 505 | 137, // desert chest 506 | 138, // desert chest 507 | 139, // desert chest 508 | 140, // camp small chest 1 509 | 141, // camp small chest 2 510 | 338, // camp PoH 511 | 353, // camp key 512 | 377, // Male Dayfly 513 | 378, // Female Dayfly 514 | 417, // poe 13 515 | 418, // poe 14 516 | 419, // poe 15 517 | 422 // poe 18 518 | }; 519 | 520 | } // namespace mod::keyPlacement -------------------------------------------------------------------------------- /source/memory.cpp: -------------------------------------------------------------------------------- 1 | #include "memory.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include "defines.h" 8 | 9 | namespace mod::memory 10 | { 11 | void* clearMemory( void* ptr, size_t size ) { return memset( ptr, 0, size ); } 12 | 13 | void clear_DC_IC_Cache( void* ptr, u32 size ) 14 | { 15 | gc::os_cache::DCFlushRange( ptr, size ); 16 | gc::os_cache::ICInvalidateRange( ptr, size ); 17 | } 18 | } // namespace mod::memory -------------------------------------------------------------------------------- /source/musicRando.cpp: -------------------------------------------------------------------------------- 1 | #include "musicRando.h" 2 | 3 | #include "patch.h" 4 | #include "tools.h" 5 | #include "tp/Z2SceneMgr.h" 6 | #include "tp/Z2SeqMgr.h" 7 | 8 | struct BGM 9 | { // Struct to store info about the source of BGM and the waves required to play correctly. Not using full Ids here to save 10 | // memory 11 | u8 id; 12 | u8 bgmwave_1; 13 | }; 14 | 15 | static const BGM bgmSource[] = { 16 | { 0x0, 0x19 }, { 0x1, 0x19 }, { 0x4, 0x0d }, { 0x5, 0x03 }, { 0x6, 0x02 }, { 0x9, 0x0a }, { 0xd, 0x0c }, 17 | { 0xe, 0x0c }, { 0xf, 0x00 }, { 0x10, 0x1 }, { 0x11, 0x2 }, { 0x16, 0xe }, { 0x17, 0x5 }, { 0x18, 0x13 }, 18 | { 0x1a, 0x11 }, { 0x1b, 0xe }, { 0x1d, 0x14 }, { 0x1e, 0x7 }, { 0x1f, 0x7 }, { 0x20, 0x15 }, { 0x23, 0xf }, 19 | { 0x24, 0x9 }, { 0x25, 0x16 }, { 0x26, 0x10 }, { 0x27, 0x17 }, { 0x29, 0x18 }, { 0x2c, 0x8 }, { 0x2d, 0x1a }, 20 | { 0x2e, 0x1b }, { 0x2f, 0x1c }, { 0x30, 0x1e }, { 0x31, 0x1e }, { 0x34, 0x1f }, { 0x35, 0x20 }, { 0x37, 0x1d }, 21 | { 0x39, 0x48 }, { 0x3a, 0x24 }, { 0x3b, 0x25 }, { 0x3c, 0x26 }, { 0x3d, 0x27 }, { 0x3e, 0x28 }, { 0x3f, 0x29 }, 22 | { 0x40, 0x11 }, { 0x41, 0x2a }, { 0x42, 0x2b }, { 0x47, 0x2c }, { 0x48, 0x2c }, { 0x49, 0x00 }, { 0x4a, 0x2d }, 23 | { 0x4b, 0x3a }, { 0x4c, 0x2e }, { 0x4d, 0x2e }, { 0x50, 0x2f }, { 0x51, 0x30 }, { 0x57, 0x31 }, { 0x58, 0x32 }, 24 | { 0x59, 0x33 }, { 0x5a, 0x34 }, // Lake hylia, but plays plums song 25 | { 0x5e, 0x35 }, { 0x5f, 0x36 }, { 0x60, 0x37 }, { 0x61, 0x3f }, { 0x62, 0x39 }, { 0x6b, 0x3e }, { 0x6c, 0x3f }, 26 | { 0x6d, 0x40 }, { 0x6e, 0x57 }, { 0x6f, 0x3f }, { 0x70, 0x44 }, { 0x77, 0x45 }, { 0x78, 0x46 }, { 0x7a, 0x46 }, 27 | { 0x85, 0x48 }, { 0x86, 0x49 }, { 0x87, 0x4a }, { 0x88, 0x4b }, { 0x8b, 0x4c }, { 0x8c, 0x4c }, { 0x8f, 0x1e }, 28 | { 0x90, 0x1e }, { 0x91, 0x47 }, { 0x94, 0x4e }, { 0x95, 0x4e }, { 0x96, 0x3d }, { 0x97, 0x3d }, { 0x9a, 0x8 }, 29 | { 0x9b, 0x56 }, { 0x9e, 0x19 }, { 0x9f, 0x55 }, { 0xa5, 0x57 }, { 0xa8, 0x58 }, { 0xa9, 0x59 } }; 30 | 31 | // Some fanfares can't be played using the current method as when subStartBgm is called it includes additional logic on some, 32 | // such as stopping the main music track 33 | static const u8 fanfareSrc[] = 34 | { 0x0a, 0x0b, 0x14, 0x1c, 0x43, 0x44, 0x45, 0x46, 0x81, 0x82, 0x83, 0x98, 0x99, 0x9c, 0x9d, 0xa0, 0xa3, 0xa4 }; 35 | 36 | static const u8 bgmSource_length = sizeof( bgmSource ) / sizeof( BGM ); 37 | 38 | static u8 randomizedBGMs[bgmSource_length]; 39 | 40 | static const u8 fanfareSourceLength = sizeof( fanfareSrc ); 41 | 42 | static u8 randomizedFanfares[fanfareSourceLength]; 43 | 44 | void ( *sceneChange_trampoline )( Z2SceneMgr* sceneMgr, 45 | JAISoundID id, 46 | u8 SeWave1, 47 | u8 SeWave2, 48 | u8 BgmWave1, 49 | u8 BgmWave2, 50 | u8 DemoWave, 51 | bool param_7 ) = nullptr; 52 | void ( *startBattleBgm_trampoline )( Z2SeqMgr* seqMgr, bool param_1 ) = nullptr; 53 | void ( *startSound_trampoline )( struct Z2SoundMgr* soundMgr, 54 | JAISoundID soundId, 55 | struct JAISoundHandle* soundHandle, 56 | struct TVec3* pos ) = nullptr; 57 | 58 | static void sceneChangeHook( Z2SceneMgr* sceneMgr, 59 | JAISoundID BGMId, 60 | u8 SeWave1, 61 | u8 SeWave2, 62 | u8 BgmWave1, 63 | u8 BgmWave2, 64 | u8 DemoWave, 65 | bool param_7 ) 66 | { 67 | u32 id = BGMId.id; 68 | if ( mod::musicrando::musicRandoEnabled && id >= 0x1000000 && id < 0x2000000 ) 69 | { 70 | // Only Sequences are applied here 71 | id = id - 0x1000000; 72 | u8 index_of_id = 0; 73 | bool found = false; 74 | for ( u8 i = 0; i < bgmSource_length; i++ ) 75 | { 76 | if ( randomizedBGMs[i] == id ) 77 | { 78 | index_of_id = i; 79 | found = true; 80 | break; 81 | } 82 | } 83 | if ( found ) 84 | { 85 | JAISoundID new_id; 86 | new_id.id = bgmSource[index_of_id].id + 0x1000000; 87 | if ( bgmSource[index_of_id].bgmwave_1 == 0 ) 88 | { 89 | sceneChange_trampoline( sceneMgr, new_id, SeWave1, SeWave2, BgmWave1, BgmWave2, DemoWave, param_7 ); 90 | } 91 | else 92 | { 93 | sceneChange_trampoline( sceneMgr, 94 | new_id, 95 | SeWave1, 96 | SeWave2, 97 | bgmSource[index_of_id].bgmwave_1, 98 | BgmWave2, 99 | DemoWave, 100 | param_7 ); 101 | } 102 | } 103 | else 104 | { 105 | sceneChange_trampoline( sceneMgr, BGMId, SeWave1, SeWave2, BgmWave1, BgmWave2, DemoWave, param_7 ); 106 | } 107 | } 108 | else 109 | { 110 | sceneChange_trampoline( sceneMgr, BGMId, SeWave1, SeWave2, BgmWave1, BgmWave2, DemoWave, param_7 ); 111 | } 112 | } 113 | 114 | extern "C" 115 | { 116 | void startSound( struct Z2SoundMgr* soundMgr, JAISoundID soundId, struct JAISoundHandle* soundHandle, struct TVec3* pos ); 117 | } 118 | 119 | void startSoundHook( struct Z2SoundMgr* soundMgr, JAISoundID soundId, struct JAISoundHandle* soundHandle, struct TVec3* pos ) 120 | { 121 | u32 id = soundId.id; 122 | if ( mod::musicrando::fanfareRandoEnabled && id >= 0x1000000 && id < 0x2000000) 123 | { 124 | u32 id = soundId.id; 125 | id = id - 0x1000000; 126 | u8 index = 0; 127 | bool found = false; 128 | for ( u8 i = 0; i < fanfareSourceLength; i++ ) 129 | { 130 | if ( randomizedFanfares[i] == id ) 131 | { 132 | index = i; 133 | found = true; 134 | break; 135 | } 136 | } 137 | if ( found ) 138 | { 139 | u32 newId = fanfareSrc[index] + 0x1000000; 140 | JAISoundID newIdSound; 141 | newIdSound.id = newId; 142 | startSound_trampoline( soundMgr, newIdSound, soundHandle, pos ); 143 | } 144 | else 145 | { 146 | startSound_trampoline( soundMgr, soundId, soundHandle, pos ); 147 | } 148 | } 149 | else 150 | { 151 | startSound_trampoline( soundMgr, soundId, soundHandle, pos ); 152 | } 153 | } 154 | 155 | static void startBattleBgmHook( Z2SeqMgr* seqMgr, bool param_1 ) 156 | { 157 | if ( !mod::musicrando::enemyBgmDisabled ) 158 | { 159 | startBattleBgm_trampoline( seqMgr, param_1 ); 160 | } 161 | } 162 | 163 | static u32 getRandomWithSeedReference( u32 max, u64* seed ) 164 | { 165 | u64 z = ( *seed += 0x9e3779b97f4a7c15 ); 166 | z = ( z ^ ( z >> 30 ) ) * 0xbf58476d1ce4e5b9; 167 | z = ( z ^ ( z >> 27 ) ) * 0x94d049bb133111eb; 168 | return ( z % max ); 169 | } 170 | 171 | static void randomizeTable( void* srcTable, u8 destTable[], size_t srcTableElementSize, size_t tableSize ) 172 | { 173 | u64 seedCopy = mod::tools::randomSeed; 174 | for ( u8 i = 0; i < tableSize; i++ ) 175 | { // Fills in the array with random ids 176 | bool gotUnique = false; 177 | while ( !gotUnique ) 178 | { // Depends on randomness to shuffle the original array; needs a better method 179 | u8 random = getRandomWithSeedReference( tableSize, &seedCopy ); 180 | u8 idGot = *( (u8*) srcTable + ( random * srcTableElementSize ) ); 181 | bool valueExists = false; 182 | for ( u8 j = 0; j < i; j++ ) 183 | { 184 | if ( destTable[j] == idGot ) 185 | { 186 | valueExists = true; 187 | break; 188 | } 189 | } 190 | if ( valueExists == false ) 191 | { 192 | destTable[i] = *( ( (u8*) srcTable ) + ( random * srcTableElementSize ) ); 193 | gotUnique = true; 194 | break; 195 | } 196 | } 197 | } 198 | } 199 | 200 | #define HookTrampoline( trampoline, origin, hook ) \ 201 | if ( trampoline == nullptr ) \ 202 | { \ 203 | trampoline = mod::patch::hookFunction( origin, hook ); \ 204 | } 205 | 206 | static bool musicRandoInit = false; 207 | 208 | namespace mod::musicrando 209 | { 210 | u8 musicRandoEnabled = 0; 211 | u8 enemyBgmDisabled = 0; 212 | u8 fanfareRandoEnabled = 0; 213 | void initMusicRando() 214 | { 215 | if ( musicRandoInit == false ) 216 | { 217 | musicRandoInit = true; 218 | randomizeTable( (void*) &bgmSource, randomizedBGMs, sizeof( BGM ), bgmSource_length ); 219 | randomizeTable( (void*) &fanfareSrc, randomizedFanfares, sizeof( u8 ), fanfareSourceLength ); 220 | HookTrampoline( sceneChange_trampoline, tp::Z2AudioLib::SceneMgr::sceneChange, sceneChangeHook ); 221 | HookTrampoline( startBattleBgm_trampoline, tp::Z2AudioLib::SeqMgr::startBattleBgm, startBattleBgmHook ); 222 | HookTrampoline( startSound_trampoline, startSound, startSoundHook ); 223 | } 224 | } 225 | } // namespace mod::musicrando -------------------------------------------------------------------------------- /source/patch.cpp: -------------------------------------------------------------------------------- 1 | #include "patch.h" 2 | 3 | #include "defines.h" 4 | #include "memory.h" 5 | 6 | namespace mod::patch 7 | { 8 | void writeBranch( void* ptr, void* destination ) 9 | { 10 | u32 branch = 0x48000000; // b 11 | writeBranchMain( ptr, destination, branch ); 12 | } 13 | 14 | void writeBranchLR( void* ptr, void* destination ) 15 | { 16 | u32 branch = 0x48000001; // bl 17 | writeBranchMain( ptr, destination, branch ); 18 | } 19 | 20 | void writeBranchMain( void* ptr, void* destination, u32 branch ) 21 | { 22 | u32 delta = reinterpret_cast( destination ) - reinterpret_cast( ptr ); 23 | 24 | branch |= ( delta & 0x03FFFFFC ); 25 | 26 | u32* p = reinterpret_cast( ptr ); 27 | *p = branch; 28 | 29 | memory::clear_DC_IC_Cache( ptr, sizeof( u32 ) ); 30 | } 31 | } // namespace mod::patch -------------------------------------------------------------------------------- /source/rel.cpp: -------------------------------------------------------------------------------- 1 | extern "C" 2 | { 3 | typedef void ( *PFN_voidfunc )(); 4 | __attribute__( ( section( ".ctors" ) ) ) extern PFN_voidfunc _ctors_start[]; 5 | __attribute__( ( section( ".ctors" ) ) ) extern PFN_voidfunc _ctors_end[]; 6 | __attribute__( ( section( ".dtors" ) ) ) extern PFN_voidfunc _dtors_start[]; 7 | __attribute__( ( section( ".dtors" ) ) ) extern PFN_voidfunc _dtors_end[]; 8 | 9 | void _prolog(); 10 | void _epilog(); 11 | void _unresolved(); 12 | } 13 | 14 | namespace mod 15 | { 16 | extern void main(); 17 | } 18 | 19 | void _prolog() 20 | { 21 | // Run global constructors 22 | for ( PFN_voidfunc* ctor = _ctors_start; ctor != _ctors_end && *ctor; ++ctor ) 23 | { 24 | ( *ctor )(); 25 | } 26 | // Run mod main 27 | mod::main(); 28 | } 29 | 30 | void _epilog() 31 | { 32 | // In the unlikely event we ever get here, run the global destructors 33 | for ( PFN_voidfunc* dtor = _dtors_start; dtor != _dtors_end && *dtor; ++dtor ) 34 | { 35 | ( *dtor )(); 36 | } 37 | } 38 | 39 | void _unresolved( void ) {} -------------------------------------------------------------------------------- /source/runtime/restfpr_x.s: -------------------------------------------------------------------------------- 1 | .global _restfpr_14_x 2 | .global _restfpr_15_x 3 | .global _restfpr_16_x 4 | .global _restfpr_17_x 5 | .global _restfpr_18_x 6 | .global _restfpr_19_x 7 | .global _restfpr_20_x 8 | .global _restfpr_21_x 9 | .global _restfpr_22_x 10 | .global _restfpr_23_x 11 | .global _restfpr_24_x 12 | .global _restfpr_25_x 13 | .global _restfpr_26_x 14 | .global _restfpr_27_x 15 | .global _restfpr_28_x 16 | .global _restfpr_29_x 17 | .global _restfpr_30_x 18 | .global _restfpr_31_x 19 | 20 | _restfpr_14_x: lfd %f14,-0x90(%r11) 21 | _restfpr_15_x: lfd %f15,-0x88(%r11) 22 | _restfpr_16_x: lfd %f16,-0x80(%r11) 23 | _restfpr_17_x: lfd %f17,-0x78(%r11) 24 | _restfpr_18_x: lfd %f18,-0x70(%r11) 25 | _restfpr_19_x: lfd %f19,-0x68(%r11) 26 | _restfpr_20_x: lfd %f20,-0x60(%r11) 27 | _restfpr_21_x: lfd %f21,-0x58(%r11) 28 | _restfpr_22_x: lfd %f22,-0x50(%r11) 29 | _restfpr_23_x: lfd %f23,-0x48(%r11) 30 | _restfpr_24_x: lfd %f24,-0x40(%r11) 31 | _restfpr_25_x: lfd %f25,-0x38(%r11) 32 | _restfpr_26_x: lfd %f26,-0x30(%r11) 33 | _restfpr_27_x: lfd %f27,-0x28(%r11) 34 | _restfpr_28_x: lfd %f28,-0x20(%r11) 35 | _restfpr_29_x: lfd %f29,-0x18(%r11) 36 | _restfpr_30_x: lfd %f30,-0x10(%r11) 37 | _restfpr_31_x: 38 | lwz %r0,0x4(%r11) 39 | lfd %f31,-0x8(%r11) 40 | mtlr %r0 41 | mr %sp,%r11 42 | blr -------------------------------------------------------------------------------- /source/runtime/restgpr_x.s: -------------------------------------------------------------------------------- 1 | .global _restgpr_14_x 2 | .global _restgpr_15_x 3 | .global _restgpr_16_x 4 | .global _restgpr_17_x 5 | .global _restgpr_18_x 6 | .global _restgpr_19_x 7 | .global _restgpr_20_x 8 | .global _restgpr_21_x 9 | .global _restgpr_22_x 10 | .global _restgpr_23_x 11 | .global _restgpr_24_x 12 | .global _restgpr_25_x 13 | .global _restgpr_26_x 14 | .global _restgpr_27_x 15 | .global _restgpr_28_x 16 | .global _restgpr_29_x 17 | .global _restgpr_30_x 18 | .global _restgpr_31_x 19 | 20 | _restgpr_14_x: lwz %r14,-0x48(%r11) 21 | _restgpr_15_x: lwz %r15,-0x44(%r11) 22 | _restgpr_16_x: lwz %r16,-0x40(%r11) 23 | _restgpr_17_x: lwz %r17,-0x3C(%r11) 24 | _restgpr_18_x: lwz %r18,-0x38(%r11) 25 | _restgpr_19_x: lwz %r19,-0x34(%r11) 26 | _restgpr_20_x: lwz %r20,-0x30(%r11) 27 | _restgpr_21_x: lwz %r21,-0x2C(%r11) 28 | _restgpr_22_x: lwz %r22,-0x28(%r11) 29 | _restgpr_23_x: lwz %r23,-0x24(%r11) 30 | _restgpr_24_x: lwz %r24,-0x20(%r11) 31 | _restgpr_25_x: lwz %r25,-0x1C(%r11) 32 | _restgpr_26_x: lwz %r26,-0x18(%r11) 33 | _restgpr_27_x: lwz %r27,-0x14(%r11) 34 | _restgpr_28_x: lwz %r28,-0x10(%r11) 35 | _restgpr_29_x: lwz %r29,-0xC(%r11) 36 | _restgpr_30_x: lwz %r30,-0x8(%r11) 37 | _restgpr_31_x: 38 | lwz %r0,0x4(%r11) 39 | lwz %r31,-0x4(%r11) 40 | mtlr %r0 41 | mr %sp,%r11 42 | blr -------------------------------------------------------------------------------- /source/singleton.cpp: -------------------------------------------------------------------------------- 1 | #include "singleton.h" 2 | 3 | #include "defines.h" 4 | 5 | namespace mod 6 | { 7 | Singleton* Singleton::instance = 0; 8 | 9 | Singleton* Singleton::getInstance() 10 | { 11 | if ( instance == 0 ) 12 | { 13 | instance = new Singleton(); 14 | } 15 | return instance; 16 | } 17 | 18 | Singleton::Singleton() 19 | { 20 | isMDHSkipEnabled = 1; 21 | isForestEscapeEnabled = 1; 22 | isGateUnlockEnabled = 1; 23 | isGoatSkipEnabled = 1; 24 | isMSPuzzleSkipEnabled = 1; 25 | isCartEscortSkipEnabled = 1; 26 | isEarlyCiTSEnabled = 0; 27 | isCannonRepaired = 0; 28 | isEarlyDesertEnabled = 0; 29 | isBossKeyseyEnabled = 0; 30 | isSewerSkipEnabled = 1; 31 | shuffledSkybook = 1; 32 | isIntroSkipped = 1; 33 | isTwilightSkipped = 1; 34 | diababaMusicFixed = 0; 35 | midnaTimeControl = 1; 36 | hasActorCommonLayerRan = 0; 37 | isEarlyToTEnabled = 0; 38 | isEarlyPoTEnabled = 0; 39 | isGMStoryPatch = 0; 40 | isEarlyHCEnabled = 0; 41 | startWithCrystal = 0; 42 | shuffleHiddenSkills = 0; 43 | hasCiTSOoccoo = 0; 44 | } 45 | 46 | } // namespace mod -------------------------------------------------------------------------------- /source/stage.cpp: -------------------------------------------------------------------------------- 1 | #include "stage.h" 2 | 3 | #include "defines.h" 4 | 5 | namespace mod::stage 6 | { 7 | char allStages[76][8] = { 8 | "D_MN01", "D_MN01A", "D_MN01B", "D_MN04", "D_MN04A", "D_MN04B", "D_MN05", "D_MN05A", "D_MN05B", "D_MN06", "D_MN06A", 9 | "D_MN06B", "D_MN07", "D_MN07A", "D_MN07B", "D_MN08", "D_MN08A", "D_MN08B", "D_MN08C", "D_MN08D", "D_MN09", "D_MN09A", 10 | "D_MN09B", "D_MN09C", "D_MN10", "D_MN10A", "D_MN10B", "D_MN11", "D_MN11A", "D_MN11B", "D_SB00", "D_SB01", "D_SB02", 11 | "D_SB03", "D_SB04", "D_SB05", "D_SB06", "D_SB07", "D_SB08", "D_SB09", "D_SB10", "F_SP00", "F_SP102", "F_SP103", 12 | "F_SP104", "F_SP108", "F_SP109", "F_SP110", "F_SP111", "F_SP112", "F_SP113", "F_SP114", "F_SP115", "F_SP116", "F_SP117", 13 | "F_SP118", "F_SP121", "F_SP122", "F_SP123", "F_SP124", "F_SP125", "F_SP126", "F_SP127", "F_SP128", "F_SP200", "R_SP01", 14 | "R_SP107", "R_SP108", "R_SP109", "R_SP110", "R_SP116", "R_SP127", "R_SP128", "R_SP160", "R_SP161", "R_SP209" }; 15 | 16 | const char* dungeonStages[18] { 17 | allStages[Stage_Lakebed_Temple], 18 | allStages[Stage_Deku_Toad], 19 | allStages[Stage_Goron_Mines], 20 | allStages[Stage_Dangoro], 21 | allStages[Stage_Forest_Temple], 22 | allStages[Stage_Ook], 23 | allStages[Stage_Temple_of_Time], 24 | allStages[Stage_Darknut], 25 | allStages[Stage_City_in_the_Sky], 26 | allStages[Stage_Aeralfos], 27 | allStages[Stage_Palace_of_Twilight], 28 | allStages[Stage_Phantom_Zant_1], 29 | allStages[Stage_Phantom_Zant_2], 30 | allStages[Stage_Hyrule_Castle], 31 | allStages[Stage_Arbiters_Grounds], 32 | allStages[Stage_Death_Sword], 33 | allStages[Stage_Snowpeak_Ruins], 34 | allStages[Stage_Darkhammer], 35 | }; 36 | 37 | const char* bossStages[8] { allStages[Stage_Morpheel], 38 | allStages[Stage_Fyrus], 39 | allStages[Stage_Diababa], 40 | allStages[Stage_Armogohma], 41 | allStages[Stage_Argorok], 42 | allStages[Stage_Zant_Main], 43 | allStages[Stage_Stallord], 44 | allStages[Stage_Blizzeta] }; 45 | 46 | const char* shopStages[8] { allStages[Stage_Ordon_Interiors], 47 | allStages[Stage_Faron_Woods], 48 | allStages[Stage_Kakariko_Interiors], 49 | allStages[Stage_Death_Mountain], 50 | allStages[Stage_Kakariko_Village], 51 | allStages[Stage_Castle_Town_Shops], 52 | allStages[Stage_Castle_Town], 53 | allStages[Stage_City_in_the_Sky] }; 54 | 55 | const char* grottoStages[5] { allStages[Stage_Grotto_1], 56 | allStages[Stage_Grotto_2], 57 | allStages[Stage_Grotto_3], 58 | allStages[Stage_Grotto_4], 59 | allStages[Stage_Grotto_5] }; 60 | 61 | const char* caveStages[6] { allStages[Stage_Lanayru_Ice_Puzzle_Cave], 62 | allStages[Stage_Cave_of_Ordeals], 63 | allStages[Stage_Eldin_Long_Cave], 64 | allStages[Stage_Lake_Hylia_Long_Cave], 65 | allStages[Stage_Eldin_Goron_Stockcave], 66 | allStages[Stage_Faron_Woods_Cave] }; 67 | 68 | const char* interiorStages[8] { allStages[Stage_Ordon_Interiors], 69 | allStages[Stage_Kakariko_Interiors], 70 | allStages[Stage_Castle_Town_Shops], 71 | allStages[Stage_Sanctuary_Basement], 72 | allStages[Stage_Impaz_House], 73 | allStages[Stage_Henas_Cabin], 74 | allStages[Stage_Castle_Town_Interiors], 75 | allStages[Stage_Castle_Town] }; 76 | 77 | const char* specialStages[3] { allStages[Stage_Title_Screen], allStages[Stage_Bublin_2], allStages[Stage_Hidden_Skill] }; 78 | 79 | const char* timeOfDayStages[18] { allStages[Stage_Ordon_Village], 80 | allStages[Stage_Ordon_Spring], 81 | allStages[Stage_Ordon_Ranch], 82 | allStages[Stage_Faron_Woods], 83 | allStages[Stage_Death_Mountain], 84 | allStages[Stage_Kakariko_Graveyard], 85 | allStages[Stage_Kakariko_Village], 86 | allStages[Stage_Zoras_River], 87 | allStages[Stage_Zoras_Domain], 88 | allStages[Stage_Upper_Zoras_River], 89 | allStages[Stage_Lake_Hylia], 90 | allStages[Stage_Outside_Castle_Town], 91 | allStages[Stage_Hyrule_Field], 92 | allStages[Stage_Sacred_Grove], 93 | allStages[Stage_Bublin_Camp], 94 | allStages[Stage_Gerudo_Desert], 95 | allStages[Stage_Hidden_Village], 96 | allStages[Stage_Fishing_Pond] }; 97 | 98 | const char* mainDungeonStages[9] { allStages[Stage_Lakebed_Temple], 99 | allStages[Stage_Goron_Mines], 100 | allStages[Stage_Forest_Temple], 101 | allStages[Stage_Temple_of_Time], 102 | allStages[Stage_City_in_the_Sky], 103 | allStages[Stage_Palace_of_Twilight], 104 | allStages[Stage_Hyrule_Castle], 105 | allStages[Stage_Arbiters_Grounds], 106 | allStages[Stage_Snowpeak_Ruins] }; 107 | 108 | const char* allDungeonStages[26] { allStages[Stage_Lakebed_Temple], 109 | allStages[Stage_Deku_Toad], 110 | allStages[Stage_Goron_Mines], 111 | allStages[Stage_Dangoro], 112 | allStages[Stage_Forest_Temple], 113 | allStages[Stage_Ook], 114 | allStages[Stage_Temple_of_Time], 115 | allStages[Stage_Darknut], 116 | allStages[Stage_City_in_the_Sky], 117 | allStages[Stage_Aeralfos], 118 | allStages[Stage_Palace_of_Twilight], 119 | allStages[Stage_Phantom_Zant_1], 120 | allStages[Stage_Phantom_Zant_2], 121 | allStages[Stage_Hyrule_Castle], 122 | allStages[Stage_Arbiters_Grounds], 123 | allStages[Stage_Death_Sword], 124 | allStages[Stage_Snowpeak_Ruins], 125 | allStages[Stage_Darkhammer], 126 | allStages[Stage_Morpheel], 127 | allStages[Stage_Fyrus], 128 | allStages[Stage_Diababa], 129 | allStages[Stage_Armogohma], 130 | allStages[Stage_Argorok], 131 | allStages[Stage_Zant_Main], 132 | allStages[Stage_Stallord], 133 | allStages[Stage_Blizzeta] }; 134 | } // namespace mod::stage -------------------------------------------------------------------------------- /source/systemConsole.cpp: -------------------------------------------------------------------------------- 1 | #include "systemConsole.h" 2 | 3 | #include 4 | 5 | #include "defines.h" 6 | 7 | namespace mod::system_console 8 | { 9 | void setBackgroundColor( u32 rgba ) 10 | { 11 | u32* ConsoleColor = reinterpret_cast( sysConsolePtr->consoleColor ); 12 | *ConsoleColor = rgba; 13 | } 14 | 15 | void setState( bool activeFlag, u32 totalLines ) 16 | { 17 | tp::jfw_system::SystemConsole* Console = sysConsolePtr; 18 | Console->consoleEnabled = activeFlag; 19 | 20 | for ( u32 i = 0; i < totalLines; i++ ) 21 | { 22 | Console->consoleLine[i].showLine = activeFlag; 23 | } 24 | } 25 | } // namespace mod::system_console -------------------------------------------------------------------------------- /source/tools.cpp: -------------------------------------------------------------------------------- 1 | #include "tools.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #include "defines.h" 11 | #include "global.h" 12 | 13 | namespace mod::tools 14 | { 15 | u64 randomSeed = 0x9e3779b97f4a7c15; 16 | 17 | u32 getRandom( u32 max ) 18 | { 19 | u64 z = ( randomSeed += 0x9e3779b97f4a7c15 ); 20 | z = ( z ^ ( z >> 30 ) ) * 0xbf58476d1ce4e5b9; 21 | z = ( z ^ ( z >> 27 ) ) * 0x94d049bb133111eb; 22 | 23 | return ( z % max ); 24 | } 25 | 26 | void triggerRandomGenerator() 27 | { 28 | // This function runs when the user starts a new file (intro cs is running) 29 | // We do it the dirty way and store the seed behind Epona's name (hehe xd) 30 | // With 1.0 this will change anyway so I really don't care and it improves QoL for players! 31 | 32 | *global::seedInSaveFile = tools::randomSeed; 33 | global::chestRandoPtr->generate(); 34 | } 35 | 36 | void triggerSaveLoad( char* stage, u8 room, u8 spawn, u8 state, u8 event ) 37 | { 38 | strcpy( gameInfo.nextStageVars.nextStage, stage ); 39 | gameInfo.nextStageVars.nextRoom = room; 40 | gameInfo.nextStageVars.nextSpawnPoint = spawn; 41 | gameInfo.nextStageVars.nextState = state; 42 | 43 | gameInfo.eventSystem.nextEventID = event; 44 | gameInfo.respawnValues.respawnAnimation = 0; 45 | gameInfo.nextStageVars.isVoidorWarp = 0; 46 | gameInfo.respawnValues.respawnCutscene = 0; 47 | gameInfo.eventSystem.immediateControl = 0xFFFF; 48 | gameInfo.nextStageVars.fadeType = 0x13; 49 | 50 | gameInfo.nextStageVars.triggerLoad = true; 51 | } 52 | 53 | void setCutscene( bool skippable, bool fade, tp::evt_control::csFunc onSkip ) 54 | { 55 | gameInfo.eventSystem.fadeOnSkip = fade; 56 | if ( skippable ) 57 | { 58 | gameInfo.eventSystem.onSkip = onSkip; 59 | } 60 | else 61 | { 62 | gameInfo.eventSystem.onSkip = nullptr; 63 | } 64 | } 65 | 66 | float fCompare( const float f1, const float f2 ) 67 | { 68 | if ( f1 > f2 ) 69 | { 70 | return ( f1 - f2 ); 71 | } 72 | else 73 | { 74 | return ( f2 - f1 ); 75 | } 76 | } 77 | 78 | u16 fletcher16( u8* data, s32 count ) 79 | { 80 | u16 sum1 = 0; 81 | u16 sum2 = 0; 82 | 83 | for ( s32 index = 0; index < count; ++index ) 84 | { 85 | sum1 = ( sum1 + data[index] ) % 0xFF; 86 | sum2 = ( sum2 + sum1 ) % 0xFF; 87 | } 88 | 89 | return ( sum2 << 8 ) | sum1; 90 | } 91 | 92 | void setItemFlag( ItemFlags flag ) 93 | { 94 | u32 flagsPerVar = sizeof( u32 ) * 8; 95 | u32 tempFlagVar = static_cast( flag ); 96 | 97 | u32* tempItemFlagsArray = gameInfo.scratchPad.itemFlags; 98 | tempItemFlagsArray[tempFlagVar / flagsPerVar] |= 1 << ( tempFlagVar % flagsPerVar ); 99 | } 100 | 101 | void clearItemFlag( ItemFlags flag ) 102 | { 103 | u32 flagsPerVar = sizeof( u32 ) * 8; 104 | u32 tempFlagVar = static_cast( flag ); 105 | 106 | u32* tempItemFlagsArray = gameInfo.scratchPad.itemFlags; 107 | tempItemFlagsArray[tempFlagVar / flagsPerVar] &= ~( 1 << ( tempFlagVar % flagsPerVar ) ); 108 | } 109 | 110 | bool checkItemFlag( ItemFlags flag ) 111 | { 112 | u32 flagsPerVar = sizeof( u32 ) * 8; 113 | u32 tempFlagVar = static_cast( flag ); 114 | 115 | u32* tempItemFlagsArray = gameInfo.scratchPad.itemFlags; 116 | return tempItemFlagsArray[tempFlagVar / flagsPerVar] & ( 1 << ( tempFlagVar % flagsPerVar ) ); 117 | } 118 | } // namespace mod::tools --------------------------------------------------------------------------------