├── .gitignore ├── .vscode └── c_cpp_properties.json ├── CppProperties.json ├── LICENSE.md ├── README.md ├── build.py ├── docs ├── Effects.md └── Scripts.md ├── get_percent.py ├── include ├── MusyX │ └── seq.h ├── battle │ ├── ac │ │ ├── ac_table.h │ │ └── ac_timing_a.h │ ├── battle.h │ ├── battle_ac.h │ ├── battle_ac_help.h │ ├── battle_acrobat.h │ ├── battle_actrecord.h │ ├── battle_audience.h │ ├── battle_audience_kind_data.h │ ├── battle_break_slot.h │ ├── battle_camera.h │ ├── battle_damage.h │ ├── battle_database_common.h │ ├── battle_disp.h │ ├── battle_event_cmd.h │ ├── battle_icon.h │ ├── battle_information.h │ ├── battle_item_data.h │ ├── battle_menu_disp.h │ ├── battle_monosiri.h │ ├── battle_pad.h │ ├── battle_party.h │ ├── battle_seq.h │ ├── battle_seq_command.h │ ├── battle_stage.h │ ├── battle_stage_object.h │ ├── battle_status_effect.h │ ├── battle_status_icon.h │ ├── battle_sub.h │ ├── battle_unit.h │ ├── battle_unit_event.h │ ├── battle_weapon_power.h │ ├── sac │ │ └── sac_bakugame.h │ └── unit │ │ └── unit_party_nokotarou.h ├── countdown.h ├── data │ ├── item_data.h │ ├── mapdata.h │ └── npc_data.h ├── database.h ├── drv │ ├── animdrv.h │ ├── arcdrv.h │ ├── bgdrv.h │ ├── camdrv.h │ ├── casedrv.h │ ├── dispdrv.h │ ├── effdrv.h │ ├── envdrv.h │ ├── extdrv.h │ ├── fadedrv.h │ ├── hitdrv.h │ ├── icondrv.h │ ├── imgdrv.h │ ├── itemdrv.h │ ├── lightdrv.h │ ├── mapdrv.h │ ├── mobjdrv.h │ ├── msgdrv.h │ ├── npcdrv.h │ ├── offscreendrv.h │ ├── seqdrv.h │ ├── shadowdrv.h │ ├── swdrv.h │ └── windowdrv.h ├── eff │ ├── eff_kemuri.h │ ├── eff_mahorn2.h │ ├── eff_n64.h │ ├── eff_nice.h │ ├── eff_scanning.h │ ├── eff_sleep.h │ ├── eff_ultra_hammer.h │ └── n64 │ │ ├── eff_expbom_n64.h │ │ └── eff_kemuri1_n64.h ├── error_handler.h ├── event.h ├── evt │ ├── evt_audience.h │ ├── evt_badgeshop.h │ ├── evt_bero.h │ ├── evt_cmd.h │ ├── evt_door.h │ ├── evt_eff.h │ ├── evt_fade.h │ ├── evt_johoya.h │ ├── evt_lottery.h │ ├── evt_msg.h │ ├── evt_npc.h │ ├── evt_seq.h │ ├── evt_shop.h │ ├── evt_snd.h │ └── evt_yuugijou.h ├── gxsub.h ├── main.h ├── mario │ ├── mario.h │ ├── mario_cam.h │ ├── mario_party.h │ ├── mario_pouch.h │ ├── mario_sbr.h │ └── mariost.h ├── memory.h ├── mgr │ ├── arammgr.h │ ├── cardmgr.h │ ├── dvdmgr.h │ ├── evtmgr.h │ ├── evtmgr_cmd.h │ ├── filemgr.h │ ├── fontmgr.h │ └── winmgr.h ├── mot │ └── mot_plane.h ├── nameent.h ├── parse.h ├── party.h ├── party │ └── party_vivian.h ├── pmario_sound.h ├── romfont.h ├── sdk │ ├── DEMOInit.h │ └── arc.h ├── seq │ ├── seq_e3.h │ ├── seq_game.h │ ├── seq_logo.h │ ├── seq_mapchange.h │ └── seq_title.h ├── sound.h ├── statuswindow.h ├── system.h ├── texPalette.h └── win │ └── win_main.h ├── module ├── aaa │ ├── include │ │ └── aaa_00.h │ └── source │ │ ├── aaa.c │ │ └── aaa_00.c └── aji │ ├── include │ ├── aji.h │ ├── aji_00.h │ └── aji_01.h │ └── source │ ├── aji.c │ ├── aji_00.c │ └── aji_01.c └── source ├── battle ├── ac │ ├── ac_table.c │ └── ac_timing_a.c ├── battle.c ├── battle_ac.c ├── battle_ac_help.c ├── battle_acrobat.c ├── battle_actrecord.c ├── battle_audience.c ├── battle_audience_kind_data.c ├── battle_break_slot.c ├── battle_camera.c ├── battle_damage.c ├── battle_disp.c ├── battle_event_cmd.c ├── battle_icon.c ├── battle_information.c ├── battle_item_data.c ├── battle_menu_disp.c ├── battle_monosiri.c ├── battle_pad.c ├── battle_party.c ├── battle_seq.c ├── battle_seq_command.c ├── battle_stage.c ├── battle_stage_object.c ├── battle_status_effect.c ├── battle_status_icon.c ├── battle_sub.c ├── battle_unit.c ├── battle_unit_event.c ├── battle_weapon_power.c ├── sac │ └── sac_bakugame.c └── unit │ └── unit_party_nokotarou.c ├── countdown.c ├── data ├── item_data.c ├── mapdata.c └── npc_data.c ├── database.c ├── drv ├── animdrv.c ├── arcdrv.c ├── bgdrv.c ├── camdrv.c ├── casedrv.c ├── dispdrv.c ├── effdrv.c ├── envdrv.c ├── extdrv.c ├── fadedrv.c ├── hitdrv.c ├── icondrv.c ├── imgdrv.c ├── itemdrv.c ├── lightdrv.c ├── mapdrv.c ├── mobjdrv.c ├── msgdrv.c ├── npcdrv.c ├── offscreendrv.c ├── seqdrv.c ├── shadowdrv.c ├── swdrv.c └── windowdrv.c ├── eff ├── eff_kemuri.c ├── eff_mahorn2.c ├── eff_n64.c ├── eff_nice.c ├── eff_scanning.c ├── eff_sleep.c ├── eff_ultra_hammer.c └── n64 │ ├── eff_expbom_n64.c │ └── eff_kemuri1_n64.c ├── error_handler.c ├── event.c ├── evt ├── evt_audience.c ├── evt_badgeshop.c ├── evt_bero.c ├── evt_door.c ├── evt_eff.c ├── evt_fade.c ├── evt_johoya.c ├── evt_lottery.c ├── evt_msg.c ├── evt_npc.c ├── evt_seq.c ├── evt_shop.c ├── evt_snd.c └── evt_yuugijou.c ├── gxsub.c ├── main.c ├── mario ├── mario.c ├── mario_cam.c ├── mario_party.c ├── mario_pouch.c ├── mario_sbr.c └── mariost.c ├── memory.c ├── mgr ├── arammgr.c ├── cardmgr.c ├── dvdmgr.c ├── evtmgr.c ├── evtmgr_cmd.c ├── filemgr.c ├── fontmgr.c └── winmgr.c ├── mot └── mot_plane.c ├── nameent.c ├── parse.c ├── party.c ├── party └── party_vivian.c ├── pmario_sound.c ├── romfont.c ├── sdk ├── DEMOInit.c └── arc.c ├── seq ├── seq_e3.c ├── seq_game.c ├── seq_logo.c ├── seq_mapchange.c ├── seq_title.c └── seqdef.c ├── sound.c ├── statuswindow.c ├── system.c ├── texPalette.c └── win └── win_main.c /.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | build 3 | build1 4 | build2 5 | out 6 | old 7 | CMakeSettings.json 8 | .vscode/settings.json -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "CodeWarrior IntelliSense", 5 | "includePath": [ 6 | "${workspaceRoot}\\include", 7 | "${env.SDK_BASE_PATH}\\include", 8 | "${env.MW_BASE_PATH}\\PowerPC_EABI_Support\\MSL\\MSL_C\\MSL_Common\\Include", 9 | "${env.MUSYX_BASE_PATH}\\include", 10 | "${workspaceRoot}\\module\\aaa\\include", 11 | "${workspaceRoot}\\module\\aji\\include" 12 | ], 13 | "defines": [ 14 | "GX_REV=2", 15 | "__dest_os", 16 | "HW2", 17 | "GEKKO" 18 | ], 19 | "intelliSenseMode": "windows-msvc-x86", 20 | "compilerPath": "", 21 | "cStandard": "c99", 22 | "cppStandard": "c++98" 23 | } 24 | ], 25 | "version": 4 26 | } -------------------------------------------------------------------------------- /CppProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "CodeWarrior IntelliSense", 5 | "includePath": [ 6 | // local include folder 7 | "${workspaceRoot}\\include", 8 | // SDK include folders 9 | "${env.SDK_BASE_PATH}\\include", 10 | "${env.MW_BASE_PATH}\\PowerPC_EABI_Support\\MSL\\MSL_C\\MSL_Common\\Include", 11 | "${env.MUSYX_BASE_PATH}\\include", 12 | 13 | //include path for each module, fix if there's collisions 14 | "${workspaceRoot}\\module\\aaa\\include" 15 | ], 16 | "defines": [ 17 | "GX_REV=2", 18 | "__dest_os", 19 | "HW2", 20 | "GEKKO" 21 | ] 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2021 NWPlayer123 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Paper Mario: The Thousand-Year Door Decompilation Project 2 | ## Introduction 3 | This repository contains work-in-progress source code decompiled from Paper Mario: The Thousand-Year Door (Japanese version, G8MJ01), based on symbol maps from the Paper Mario 2 demo. It does not currently try to match 1:1, but contains the same functionality. 4 | 5 | Decompilation is the process of looking at the compiled bytecode for a program and writing code that produces the same bytecode, thus recovering some semblance of the original program (with originality, there is no way to know if it is actually "correct"). 6 | ## How to Compile 7 | The build system requires a couple environment variables to be set for various tools that are needed to compile the project, these are: 8 | 9 | * `SDK_BASE_PATH`: Path to a 20-Apr-2004 Patch 1 Nintendo GameCube SDK installation (root has `HW2` / `include`, from May 31, 2004). 10 | * `MUSYX_BASE_PATH`: Path to a MusyX 2.0 Patch 3 SDK installation (root has `HW2` / `include`, from August 20, 2004). 11 | * `MW_BASE_PATH`: Path to a CodeWarrior 2.7 for GameCube installation (root has `PowerPC_EABI_Support` / `PowerPC_EABI_Tools`, from August 24, 2004). 12 | 13 | Then, you need to install Python 3, run `pip install regex colorama` to install dependencies, and then you can run `build.py` to compile the project. If there are no errors (which can be common while decompiling a program), you should get `build/G8MJ01.elf` and `build/G8MJ01.map` with the compiled code. 14 | ## How to Contribute 15 | Currently, the project does not have an easy way to load all symbols needed for decompilation into a single binary. You will need to compile [the doldecomp repo](https://github.com/doldecomp/ttyd) to get an elf that matches retail with function names, which you can load into IDA or Ghidra. 16 | 17 | For variable names, the only way is to acquire a copy of the Paper Mario 2 Demo TGC from Demo Disc 2004.7.1/2004.8.1/2004.9.1 for the symbol maps that were used to port to retail. 18 | ## License 19 | This project is distributed under the MIT license. By contributing to this project, you agree to license your contribution under the MIT license to this project. 20 | 21 | The copyright notice is currently under [NWPlayer123](https://github.com/NWPlayer123), although that may need to change in the future (to e.g. "The TTYD Decompilation Team") if enough outside contributions are made. By contributing to this project, you also agree to this potential copyright/license change, should it need to happen. 22 | ## Credits 23 | Decompilation, Build System by **[NWPlayer123](https://github.com/NWPlayer123)** 24 | 25 | Additional Help, Previous Work by **[PistonMiner](https://github.com/PistonMiner)**, **[Jdaster64](https://github.com/jdaster64)**, **[SeekyCt](https://github.com/SeekyCt)**, **[JasperRLZ](https://github.com/magcius)** 26 | -------------------------------------------------------------------------------- /docs/Effects.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | As with most subsystems, effects are handled through effdrv (effect driver), which keeps track of all effects and handles most of the processing so it's easier to customize individual effects. 3 | 4 | # Process Flow 5 | All effect data is centralized in effdrv's work struct. It gets initialized at game boot with `marioStInit` calling `effInit`, which does its own setup along with calling `effInit64`. It allocates 0x100 entries and stores the pointer to that array in its struct. 6 | 7 | Any time an effect is needed, you call `effEntry`, which selects an unused entry, does some basic initialization, and gives you a pointer to that entry. effdrv keeps track of which ones are in use with flags (0 = available). Then, that effect adds its own data to the struct which is still contained in the array. 8 | 9 | Every tick, `marioStMain` calls `effMain`, which calls the Main() function of any valid effect to do its rendering. Once it's done, it needs to call `effDelete` to free up that slot. 10 | 11 | # Customization 12 | An effect can allocate its own userdata to keep track of values from tick to tick with `__memAlloc`, which `effDelete` will deallocate when it's called. 13 | -------------------------------------------------------------------------------- /include/MusyX/seq.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define SND_MAX_SEQNOTES 256 6 | #define SND_MAX_SEQINSTANCES 8 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /include/battle/ac/ac_table.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "battle/battle.h" 4 | #include 5 | 6 | typedef struct ActionCommandEntry { 7 | s32 id; 8 | s32 (*main)(BattleWork* work); 9 | s32 (*result)(BattleWork* work); 10 | void (*disp)(CameraId cameraId, void* param); 11 | void (*delete)(BattleWork* work); 12 | } ActionCommandEntry; 13 | 14 | -------------------------------------------------------------------------------- /include/battle/ac/ac_timing_a.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle.h" 5 | 6 | s32 battleAcMain_TimingA(BattleWork* work); -------------------------------------------------------------------------------- /include/battle/battle_ac.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle_pad.h" 5 | #include "drv/dispdrv.h" 6 | #include "drv/effdrv.h" 7 | 8 | typedef s32 (*BattleACMainCallback)(struct BattleWork* work); 9 | typedef s32 (*BattleACResultCallback)(struct BattleWork* work); 10 | typedef void (*BattleACDeleteCallback)(struct BattleWork* work); 11 | 12 | typedef struct BattleACDispParams { 13 | u8 field_0x0[0x14 - 0x0]; //0x0 14 | f32 iconX; //0x14, see actionCommandDisp 15 | f32 iconY; //0x18, see actionCommandDisp 16 | u8 field_0x1C[0x2C - 0x1C]; //0x1C 17 | } BattleACDispParams; 18 | 19 | typedef struct BattleACExtraParams { 20 | u8 field_0x0[0x254 - 0x0]; //0x0 21 | EffectEntry* effect; //0x254 22 | u8 field_0x258[0x7D0 - 0x258]; //0x258 23 | } BattleACExtraParams; 24 | 25 | typedef struct BattleACManager { 26 | struct BattleWorkUnit* mAcUnit; //0x0 27 | s32 field_0x4; //0x4 28 | s32 field_0x8; //0x8 29 | s32 mAcState; //0xC 30 | BattleACMainCallback maincb; //0x10 31 | BattleACResultCallback resultcb; //0x14 32 | DispCallback dispcb; //0x18 33 | BattleACDeleteCallback deletecb; //0x1C 34 | s32 mDefenseResult; //0x20 35 | s32 mResultCount; //0x24 36 | s32 result; //0x28 37 | s8 mBaseAcDifficulty; //0x2C 38 | s8 mAcDifficulty; //0x2D 39 | u8 field_0x2E[2]; //0x2E 40 | s32 field_0x30; //0x30 41 | u8 field_0x34[0x8C - 0x34]; //0x34 42 | BattleWorkPad pad; //0x8C 43 | s32 field_0x288; //0x288 44 | u8 field_0x28C[0x290 - 0x28C]; //0x28C 45 | BattleACDispParams dispParams; //0x290 46 | BattleACExtraParams extraParams; //0x2BC 47 | s32 mStylishCurFrame; //0xA8C 48 | s32 mStylishWindowStart; //0xA90 49 | s32 mStylishWindowEnd; //0xA94 50 | s32 mStylishEndFrame; //0xA98 51 | s32 mStylishUnitId; //0xA9C 52 | s32 mStylishResult; //0xAA0 53 | s32 mStylishEarlyFrames; //0xAA4 54 | } BattleACManager; 55 | 56 | void BattleActionCommandManagerInit(struct BattleWork* wp); 57 | void BattleActionCommandManager(struct BattleWork* wp); 58 | s32 BattleActionCommandResult(struct BattleWork* work); 59 | void BattleActionCommandDeclareACResult(struct BattleWork* work, struct BattleWeapon* weapon, s32 result); 60 | 61 | void BattleActionCommandStart(struct BattleWork* work); 62 | void BattleActionCommandStop(struct BattleWork* work); 63 | s32 BattleActionCommandGetDefenceResult(void); 64 | void BattleActionCommandResetDefenceResult(void); 65 | s8 BattleActionCommandGetDifficulty(struct BattleWork* work); 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /include/battle/battle_ac_help.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void BattleAcHelpInit(void); 6 | void BattleAcHelpMain(void); 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /include/battle/battle_acrobat.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "battle/battle.h" 4 | 5 | s32 BattleAcrobatStart(BattleWork* work, s32 unitId, s32 windowStartFrame, 6 | s32 windowEndFrame, s32 endFrame, s32 earlyFrames); 7 | s32 BattleAcrobatMain(BattleWork* work); 8 | s32 BattleAcrobatGetResult(BattleWork* work, s32* result, s32* curFrame); -------------------------------------------------------------------------------- /include/battle/battle_actrecord.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle.h" 5 | 6 | typedef enum BattleActRecordConditionType { 7 | kNoFailureCondition, //0x0 8 | kConditionJumpLess, //0x1 9 | kConditionJumpMore, //0x2 10 | kConditionHammerLess, //0x3 11 | kConditionHammerMore, //0x4 12 | kConditionUseSpecialMovesLess, //0x5 13 | kConditionUseSpecialMovesMore, //0x6 14 | kConditionMarioTakeLessDamage, //0x7 15 | kConditionMarioTakeMoreDamage, //0x8 16 | kConditionPartnersTakeLessDamage, //0x9 17 | kConditionPartnersTakeMoreDamage, //0xA 18 | kConditionPartyTakeLessDamage, //0xB 19 | kConditionPartyTakeMoreDamage, //0xC 20 | kConditionMarioTakeFewerHits, //0xD 21 | kConditionMarioTakeMoreHits, //0xE 22 | kConditionPartnersTakeFewerHits, //0xF 23 | kConditionPartnersTakeMoreHits, //0x10 24 | kConditionPartyTakeFewerHits, //0x11 25 | kConditionPartyTakeMoreHits, //0x12 26 | kConditionMarioWinMoreHp, //0x13 27 | kConditionMarioWinLessHp, //0x14 28 | kConditionPowerBounceCombo, //0x15 29 | kConditionMarioUseFewerItems, //0x16 30 | kConditionMarioUseMoreItems, //0x17 31 | kConditionPartnersUseFewerItems, //0x18 32 | kConditionPartnersUseMoreItems, //0x19 33 | kConditionPartyUseFewerItems, //0x1A 34 | kConditionPartyUseMoreItems, //0x1B 35 | kConditionMarioSwapPartnersLess, //0x1C 36 | kConditionMarioSwapPartnersMore, //0x1D 37 | kConditionPartnersSwapPartnersLess, //0x1E 38 | kConditionPartnersSwapPartnersMore, //0x1F 39 | kConditionPartySwapPartnersLess, //0x20 40 | kConditionPartySwapPartnersMore, //0x21 41 | kConditionMarioAttackAudienceLess, //0x22 42 | kConditionMarioAttackAudienceMore, //0x23 43 | kConditionPartnersAttackAudienceLess, //0x24 44 | kConditionPartnersAttackAudienceMore, //0x25 45 | kConditionMarioAppealLess, //0x26 46 | kConditionMarioAppealMore, //0x27 47 | kConditionPartnersAppealLess, //0x28 48 | kConditionPartnersAppealMore, //0x29 49 | kConditionPartyAppealLess, //0x2A 50 | kConditionPartyAppealMore, //0x2B 51 | kConditionMarioSpendLessFp, //0x2C 52 | kConditionMarioSpendMoreFp, //0x2D 53 | kConditionPartnersSpendLessFp, //0x2E 54 | kConditionPartnersSpendMoreFp, //0x2F 55 | kConditionPartySpendLessFp_0x30, //0x30 56 | kConditionPartySpendMoreFp_0x31, //0x31 57 | kConditionMarioUseMovesLess, //0x32 58 | kConditionMarioUseMovesMore, //0x33 59 | kConditionPartnerUseMovesLess, //0x34 60 | kConditionPartnerUseMovesMore, //0x35 61 | kConditionPartySpendLessFp_0x36, //0x36 62 | kConditionPartySpendMoreFp_0x37, //0x37 63 | kConditionPartyUseMovesLess, //0x38 64 | kConditionPartyUseMovesMore, //0x39 65 | kConditionWinInMoreTurns, //0x3A 66 | kConditionWinInFewerTurns, //0x3B 67 | kConditionWaitTurnsBeforeMarioActions, //0x3C 68 | kConditionWaitTurnsBeforePartnerActions, //0x3D 69 | kConditionWaitTurnsBeforePartyActions, //0x3E 70 | kConditionWaitTurnsBeforeMarioAttacks, //0x3F 71 | kConditionWaitTurnsBeforePartnerAttacks, //0x40 72 | kConditionWaitTurnsBeforePartyAttacks, //0x41 73 | kConditionMarioOnlyJumpOrDefend, //0x42 74 | kConditionMarioOnlyHammerOrDefend, //0x43 75 | } BattleActRecordConditionType; -------------------------------------------------------------------------------- /include/battle/battle_audience_kind_data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mario/mario_pouch.h" 4 | #include 5 | 6 | typedef struct BattleAudienceItemKind { 7 | ItemType type; //0x0 8 | s32 chance; //0x4 9 | } BattleAudienceItemKind; 10 | 11 | /* seems unused, just static table size 12 | typedef struct BattleAudienceAnimTable { 13 | s32* animWaitFront; //0x0 14 | s32* animWaitBack; //0x4 15 | s32* animJumpFront; //0x8 16 | s32* animJumpBack; //0xC 17 | s32* animRaiseBack; //0x10 18 | s32* animItemOnBack; //0x14 19 | s32* animItemThrowBack; //0x18 20 | s32* animRunFront; //0x1C 21 | s32* animTumbleFront; //0x20 22 | s32* animDamageFront; //0x24 23 | s32* animSleepFront; //0x28 24 | s32* animSleepBack; //0x2C 25 | s32* animConfuseFront; //0x30 26 | s32* animConfuseBack; //0x34 27 | s32* animSingFront; //0x38, for Crazy Dayzees 28 | s32* animShellBack; //0x3C, for Koopas 29 | s32* animIgniteFront; //0x40, for Bulky Bob-Ombs 30 | s32* animIgniteBack; //0x44, for Bulky Bob-Ombs 31 | s32* animEatFront; //0x48, for Piranha Plants 32 | } BattleAudienceAnimTable;*/ 33 | 34 | #pragma warn_padding off 35 | typedef struct BattleAudienceKind { 36 | u8 field_0x0; //0x0, some flag in BattleAudienceSettingAudience 37 | //pad 3 bytes 38 | s32** animTable; //0x4 39 | BattleAudienceItemKind* itemTable; //0x8 40 | f32 field_0xC; //0xC, offsetX? 41 | f32 field_0x10; //0x10, offsetY? 42 | f32 field_0x14; //0x14, itemChance? 43 | f32 field_0x18; //0x18, scaleX? 44 | f32 field_0x1C; //0x1C, scaleY? 45 | } BattleAudienceKind; 46 | #pragma warn_padding on 47 | -------------------------------------------------------------------------------- /include/battle/battle_break_slot.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void BattleBreakSlot_Init(void); 4 | void BattleBreakSlot_Main(void); 5 | void BattleBreakSlot_End(void); 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /include/battle/battle_camera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct { 6 | s32 flags; //0x0 7 | s32 unk4; //0x4 8 | s32 priLimit; //0x8 9 | s32 mode; //0xC 10 | u8 unk10[0x24 - 0x10]; //0x10 11 | f32 zoom; //0x24 12 | u16 moveSpeedLv; //0x28 13 | u16 zoomSpeedLv; //0x2A 14 | u8 unk2C[0x5C - 0x2C]; //0x2C 15 | Vec position; //0x5C 16 | u8 unk68[0x104 - 0x68]; //0x68 17 | } BattleCameraWork; 18 | 19 | void battleCameraInit(void); -------------------------------------------------------------------------------- /include/battle/battle_damage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct BattleVulnerableStatus { 6 | u8 sleepRate; //0x0 7 | u8 stopRate; //0x1 8 | u8 dizzyRate; //0x2 9 | u8 poisonRate; //0x3 10 | u8 confuseRate; //0x4 11 | u8 electricRate; //0x5 12 | u8 burnRate; //0x6 13 | u8 freezeRate; //0x7 14 | u8 hugeRate; //0x8 15 | u8 tinyRate; //0x9 16 | u8 attackUpRate; //0xA 17 | u8 attackDownRate; //0xB 18 | u8 defenseUpRate; //0xC 19 | u8 defenseDownRate; //0xD 20 | u8 allergicRate; //0xE 21 | u8 frightRate; //0xF 22 | u8 galeForceRate; //0x10 23 | u8 fastRate; //0x11 24 | u8 slowRate; //0x12 25 | u8 dodgyRate; //0x13 26 | u8 invisibleRate; //0x14 27 | u8 instaKillRate; //0x15 28 | } BattleVulnerableStatus; 29 | 30 | s32 BattleCheckDamage(struct BattleWorkUnit* unit1, struct BattleWorkUnit* unit2, struct BattleWorkUnitPart* part, struct BattleWeapon* weapon, s32 flags); -------------------------------------------------------------------------------- /include/battle/battle_database_common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef enum BattleWeaponSpecialFlags { 6 | SPECIAL_UNGUARDABLE = 0x20000 7 | } BattleWeaponSpecialFlags; 8 | 9 | typedef struct BattleWeapon { 10 | u8 field_0x0[0x18 - 0x0]; //0x0 11 | s8 mStylishCommandMultiplier; //0x18 12 | s8 field_0x19; //0x19 13 | s8 mBingoSlotChance; //0x1A 14 | s8 field_0x1B; //0x1B 15 | u8 field_0x1C[0x74 - 0x1C]; //0x1C 16 | BattleWeaponSpecialFlags special; //0x74 17 | u8 field_0x78[0xB0 - 0x78]; //0x78 18 | void* mAttackEvtScript; //0xB0 19 | u8 field_0xB4[0xC0 - 0xB4]; //0xB4 20 | } BattleWeapon; -------------------------------------------------------------------------------- /include/battle/battle_disp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle_unit.h" 5 | 6 | typedef struct BattleDispPose { //for BattleWorkUnitPart 7 | u32 poseId; //0x0 8 | const char* poseName; //0x4 9 | } BattleDispPose; 10 | 11 | void btlDispGXInit2DRasta(void); 12 | void btlDispGXInit2D(void); 13 | void btlDispGXPoint2DRasta(f32 x, f32 y, u8 r, u8 g, u8 b, u8 a); 14 | void btlDispGXQuads2DRasta(f32 x0, f32 y0, f32 x1, f32 y1, u8 r, u8 g, u8 b, u8 a); 15 | void btlDispGXPoint2D(f32 x, f32 y, u8 r, u8 g, u8 b, u8 a, f32 s, f32 t); 16 | void btlDispGXQuads2D(f32 x0, f32 y0, f32 x1, f32 y1, u8 r, u8 g, u8 b, u8 a); 17 | void btlDispTexPlane(u32 id, GXColor color, f32 tX, f32 tY, f32 tZ, f32 sX, f32 sY); 18 | void btlDispTexPlane2(Mtx mtx, u32 id, GXColor color); 19 | void btlDispTexPlane3(Mtx mtx, u32 id, GXColor color0, GXColor color1, GXColor color2, GXColor color3); 20 | void btlDispInit(void); 21 | StatusEffectType _GetStatusPoseType(BattleWorkUnit* unit); 22 | 23 | 24 | void btlDispMain(void); 25 | 26 | 27 | 28 | 29 | void btlDispEntAnime(BattleWorkUnit* unit); 30 | 31 | -------------------------------------------------------------------------------- /include/battle/battle_icon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/icondrv.h" 5 | 6 | typedef struct BattleWorkIcon { 7 | s16 flags; //0x0 8 | s16 iconId; //0x2 9 | s32 index; //0x4, TODO: rename? 10 | Vec position; //0x8 11 | f32 field_0x14; //0x14, prob X, TODO 12 | f32 field_0x18; //0x18 13 | IconEntry* base; //0x1C 14 | u8 field_0x20[0x4C - 0x20]; //0x20 15 | f32 fallAccel; //0x4C 16 | u8 field_0x50[0x9C - 0x50]; //0x50 17 | } BattleWorkIcon; 18 | 19 | void BattleIconInit(void); 20 | void BattleIconMain(void); 21 | void BattleIconEnd(void); 22 | BattleWorkIcon* BtlIcon_Entry(s16 iconId, f32 x, f32 y, f32 z); 23 | void BtlIcon_Delete(BattleWorkIcon* icon); 24 | -------------------------------------------------------------------------------- /include/battle/battle_information.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle_unit.h" 5 | #include "drv/npcdrv.h" 6 | 7 | typedef struct FieldBattleInfo { 8 | u32 mode; //0x0, unused 9 | BattleUnitType party; //0x4 10 | u32 partyId; //0x8 11 | NpcBattleInfo* setup; //0xC 12 | u32 result; //0x10 13 | u8 field_0x14[0x1C - 0x14]; //0x14 14 | } FieldBattleInfo; 15 | 16 | void BattleInformationSetMode(FieldBattleInfo* info, u32 mode); 17 | void BattleInformationSetParty(FieldBattleInfo* info, BattleUnitType party); 18 | void BattleInformationSetFirstAttack(FieldBattleInfo* info, u32 partyId); 19 | void BattleInformationInit(FieldBattleInfo* info); 20 | void BattleInfomationSetBattleSetupInfo(FieldBattleInfo* info, NpcBattleInfo* setup); 21 | void BattleInformationSetResult(FieldBattleInfo* info, u32 result); 22 | u32 BattleInformationGetResult(FieldBattleInfo* info); 23 | 24 | 25 | -------------------------------------------------------------------------------- /include/battle/battle_item_data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "evt/evt_cmd.h" 4 | 5 | USERFUNC_DEF(_full_ap_recover); -------------------------------------------------------------------------------- /include/battle/battle_menu_disp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle.h" 5 | 6 | void SelectedItemCoordinateColorUpDate(void); 7 | BOOL BattleMenuKeyOKInACT(BattleWork* wp); 8 | void battleMenuDispInit(void); 9 | 10 | void battleMenuDispEnd(void); 11 | 12 | -------------------------------------------------------------------------------- /include/battle/battle_monosiri.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle.h" 5 | 6 | //most of these strings are tag names for text lookup 7 | typedef struct TattleEntry { 8 | const char* enemyTag; //0x0, enemy name 9 | const char* tattleBtlTag; //0x4, Goombella Tattle description 10 | const char* tattleLogTag; //0x8, Tattle Log description 11 | const char* modelName; //0xC, for filename lookup 12 | const char* poseName; //0x10 13 | const char* locationTag; //0x14 14 | } TattleEntry; 15 | 16 | TattleEntry* battleGetUnitMonosiriPtr(s32 id); 17 | BOOL battleCheckUnitMonosiriFlag(BattleWorkUnit* unit); 18 | void battleSetUnitMonosiriFlag(BattleUnitType kind); 19 | -------------------------------------------------------------------------------- /include/battle/battle_pad.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct BattleWorkPad { 6 | PADStatus mPadData[2]; //0x0, current, last 7 | 8 | u32 mButtonsPressedHistory[30]; //0x18 9 | u32 mButtonsHeldHistory[30]; //0x90 10 | u32 mButtonsHistory[30]; //0x108 11 | u32 mButtonsReleasedHistory[30]; //0x180 12 | 13 | u8 mHoldRepeatState; //0x1F8 14 | u8 mHoldRepeatFrameCounter; //0x1F9 15 | u8 pad_0x1FA[2]; //0x1FA 16 | } BattleWorkPad; 17 | 18 | void BattlePadInit(void); 19 | void BattlePadManager(void); 20 | 21 | void BtlPad_WorkInit(BattleWorkPad* pad); 22 | void BtlPad_WorkUpdate(BattleWorkPad* pad, s32 chan); 23 | 24 | u32 BattlePadGetTrigger(void); 25 | u32 BattlePadGetNow(void); 26 | 27 | u32 BattlePadCheckTrigger(s32 mask); 28 | u32 BattlePadMultiCheckTrigger(s32 chan, s32 mask); 29 | 30 | u32 BattlePadCheckRecordTrigger(s32 frame, s32 mask); 31 | u32 BattlePadMultiCheckRecordTrigger(s32 chan, s32 frame, s32 mask); 32 | 33 | u32 BattlePadCheckNow(s32 mask); 34 | u32 BattlePadMultiCheckNow(s32 chan, s32 mask); 35 | 36 | u32 BattlePadCheckUp(s32 mask); 37 | u32 BattlePadMultiCheckUp(s32 chan, s32 mask); 38 | 39 | u32 BattlePadCheckRepeat(s32 mask); 40 | u32 BattlePadMultiCheckRepeat(s32 chan, s32 mask); 41 | -------------------------------------------------------------------------------- /include/battle/battle_party.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /include/battle/battle_seq.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void BattleSequenceManager(void); -------------------------------------------------------------------------------- /include/battle/battle_seq_command.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct BattleCommandCursor { 6 | s32 unk0; //0x0 7 | s32 unk4; //0x4 8 | s32 unk8; //0x8 9 | } BattleCommandCursor; 10 | 11 | typedef struct BattleCommand { 12 | s32 unk0; //0x0 13 | s32 unk4; //0x4 14 | u8 unk8[0x498 - 0x8]; //0x8 15 | BattleCommandCursor cursor[14]; //0x498 16 | u8 unk534[0x55C - 0x534]; //0x534 17 | void* unk55C; //0x55C 18 | u8 unk560[0x574 - 0x560]; //0x560 19 | } BattleCommand; 20 | -------------------------------------------------------------------------------- /include/battle/battle_stage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle_stage_object.h" 5 | 6 | typedef struct BattleStageSpotEntry { 7 | u8 field_0x0[0x2C - 0x0]; //0x0 8 | } BattleStageSpotEntry; 9 | 10 | typedef struct BattleStageSpotWork { 11 | s32 count; //0x0 12 | BattleStageSpotEntry* entries; //0x4 13 | u8 field_0x8[4]; //0x8 14 | } BattleStageSpotWork; 15 | 16 | typedef struct BattleStageData { 17 | char* mGlobalStageDataDir; //0x0 18 | char* mSpecificStageDataDir; //0x4 19 | u32 mNumObjects; //0x8 20 | BattleStageObjectData* mObjects; //0xC, TODO extern? 21 | } BattleStageData; 22 | 23 | typedef struct BattleStage { 24 | u8 field_0x0[0xB3C - 0x0]; //0x0 25 | } BattleStage; 26 | 27 | BattleStage* BattleStageGetPtr(void); 28 | 29 | 30 | 31 | void BattleStageInit(void); 32 | void BattleStageMain(void); 33 | void BattleStageEnd(void); 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /include/battle/battle_stage_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "evt/evt_cmd.h" 5 | 6 | typedef struct BattleStageObjectData { 7 | char* name; //0x0 8 | u16 mSpawnSpecialUnitType; //0x4 9 | u16 mLayer; //0x8 10 | Vec mPosition; //0xC 11 | u8 mNumFramesToStartFalling; //0x14 12 | u8 mNumFramesToFall; //0x15 13 | u8 pad_16[2]; //0x16, TODO remove cuz compiler auto-pads 14 | } BattleStageObjectData; 15 | 16 | typedef struct BattleStageObject { 17 | s32 id; //0x0 18 | Vec mPosition; //0x4 19 | Vec field_0x10; //0x10, mPositionOffset1? 20 | Vec mRotation; //0x1C 21 | Vec field_0x28; //0x28, mPositionOffset2? 22 | Vec field_0x34; //0x34, mPositionTemp? 23 | Vec field_0x40; //0x40, mPositionOffset1Temp? 24 | Vec field_0x4C; //0x4C, mRotationTemp? 25 | Vec field_0x58; //0x58, mPositionOffset2Temp? 26 | BattleStageObjectData* data; //0x64 27 | u32 mFlags; //0x68 28 | u32 mBattleUnitIdx; //0x6C 29 | u8 mNumFramesToStartFalling; //0x70 30 | u8 mNumFramesFalling; //0x71 31 | u8 field_0x72; //0x72 32 | u8 mShakePeriodLength; //0x73 33 | u8 mShakePeriodPosition; //0x74 34 | u8 field_0x75[3]; //0x75 35 | f32 mShakeAngle; //0x78 36 | } BattleStageObject; 37 | 38 | BattleStageObject* BattleGetObjectPtr(s32 id); 39 | BattleStageObject* BattleSearchObjectPtr(const char* name); 40 | 41 | void BattleStageObjectMain(void); 42 | 43 | 44 | 45 | 46 | 47 | USERFUNC_DEF(_set_mobj_shake_init); 48 | 49 | 50 | void BattleStageObjectInit(void); -------------------------------------------------------------------------------- /include/battle/battle_status_effect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | //battle_status_effect 6 | //should be an s8, typecasting for now 7 | typedef enum StatusEffectType { 8 | kStatusAllergic, //0x0 9 | kStatusSleep, //0x1 10 | kStatusStop, //0x2 11 | kStatusDizzy, //0x3 12 | kStatusPoison, //0x4 13 | kStatusConfuse, //0x5 14 | kStatusElectric, //0x6 15 | kStatusDodgy, //0x7 16 | kStatusBurn, //0x8 17 | kStatusFreeze, //0x9 18 | kStatusHuge, //0xA 19 | kStatusTiny, //0xB 20 | kStatusAttackUp, //0xC 21 | kStatusAttackDown, //0xD 22 | kStatusDefenseUp, //0xE 23 | kStatusDefenseDown, //0xF 24 | kStatusCharge, //0x10 25 | kStatusFlipped, //0x11 26 | kStatusInvisible, //0x12 27 | kStatusFast, //0x13 28 | kStatusSlow, //0x14 29 | kStatusPayback, //0x15 30 | kStatusHoldFast, //0x16 31 | kStatusHpRegen, //0x17 32 | kStatusFpRegen, //0x18 33 | kStatusFright, //0x19 34 | kStatusGaleForce, //0x1A 35 | kStatusInstantKill, //0x1B 36 | kStatusInvalid //0x1C 37 | } StatusEffectType; 38 | 39 | void BattleStatusEffectInit(struct BattleWorkUnit* unit); 40 | void BattleStatusEffectMain(struct BattleWorkUnit* unit); 41 | void BSE_TurnFirstProcessEffectEntry(struct BattleWorkUnit* unit, s16 active); 42 | BOOL BSE_TurnFirstProcessEffectMain(struct BattleWorkUnit* unit); 43 | void BattleStatusChangeInfoWorkInit(struct BattleWorkUnit* unit); 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | void BattleStatusChangeMsgWorkInit(void); -------------------------------------------------------------------------------- /include/battle/battle_status_icon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct BattleWorkStatusIconEntry { 6 | u8 field_0x0[0x44 - 0x0]; //0x0 7 | } BattleWorkStatusIconEntry; 8 | 9 | typedef struct BattleWorkStatusIcon { 10 | Vec mPosition; //0x0 11 | Vec mScreenSpaceOffset; //0xC 12 | f32 mDistanceBetweenIcons; //0x18 13 | s32 mFlags; //0x1C 14 | BattleWorkStatusIconEntry mIcons[28]; //0x20 15 | u8 field_0x790[0x794 - 0x790]; //0x790 16 | s16 mNumStatusIcons; //0x794 17 | u8 field_0x796[0x7A0 - 0x796]; //0x796 18 | } BattleWorkStatusIcon; 19 | 20 | void BattleStatusIconInit(struct BattleWorkUnit* unit); 21 | void BattleStatusIconMain(struct BattleWorkUnit* unit); 22 | void BattleStatusIconDelete(struct BattleWorkUnit* unit); 23 | 24 | 25 | -------------------------------------------------------------------------------- /include/battle/battle_sub.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "battle/battle.h" 4 | #include "mgr/evtmgr.h" 5 | 6 | void btlsubResetMoveColorLvAll(BattleWork* work); 7 | s32 BattleTransID(EventEntry* evt, s32 type); -------------------------------------------------------------------------------- /include/battle/battle_unit_event.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle.h" 5 | #include "battle/battle_unit.h" 6 | 7 | BOOL BattleCheckEndUnitInitEvent(BattleWork* wp); 8 | s32 BattleRunHitEventDirect(BattleWorkUnit* unit, s32 damageCode, void* code); 9 | s32 BattleRunHitEvent(BattleWorkUnit* unit, s32 damageCode); 10 | s32 BattleRunPhaseEvent(BattleWorkUnit* unit, BOOL isUnison); 11 | void BattlePhaseEventStartDeclare(BattleWorkUnit* unit); 12 | s32 BattleRunWaitEvent(BattleWorkUnit* unit); 13 | -------------------------------------------------------------------------------- /include/battle/battle_weapon_power.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | -------------------------------------------------------------------------------- /include/battle/sac/sac_bakugame.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle_ac.h" 5 | 6 | BattleACExtraParams* GetBakuGamePtr(void); -------------------------------------------------------------------------------- /include/battle/unit/unit_party_nokotarou.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /include/countdown.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct CountdownWork { 6 | u8 field_0x0[0x40 - 0x0]; //0x0 7 | } CountdownWork; 8 | 9 | void countDownInit(void); 10 | void countDownSaveReStart(void); 11 | 12 | 13 | 14 | void countDownMain(void); -------------------------------------------------------------------------------- /include/data/item_data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "battle/battle_database_common.h" 5 | 6 | typedef struct ItemData { 7 | const char* id; //0x0, japanese name of the item 8 | const char* name; //0x4 9 | const char* description; //0x8 10 | const char* menu_description; //0xC 11 | s16 usable_locations; //0x10 12 | s16 type_sort_order; //0x12 13 | s16 buy_price; //0x14 14 | s16 discount_price; //0x16 15 | s16 star_piece_price; //0x18 16 | s16 sell_price; //0x1A 17 | s8 bp_cost; //0x1C 18 | s8 hp_restored; //0x1D 19 | s8 fp_restored; //0x1E 20 | s8 sp_restored; //0x1F 21 | s16 icon_id; //0x20 22 | s16 field_0x22; //0x22 23 | BattleWeapon* battle_params; //0x24 24 | } ItemData; -------------------------------------------------------------------------------- /include/data/mapdata.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void relSetEvtAddr(const char* name, s32* script); -------------------------------------------------------------------------------- /include/data/npc_data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/npcdrv.h" 4 | #include 5 | 6 | typedef struct NpcAiInfo { 7 | const char* description; //0x0, used for s/etup.xml tag lookup 8 | s32 flags; //0x4 9 | s32* initEvent; //0x8 10 | s32* moveEvent; //0xC 11 | s32* deadEvent; //0x10 12 | s32* findEvent; //0x14 13 | s32* lostEvent; //0x18 14 | s32* returnEvent; //0x1C 15 | s32* blowEvent; //0x20 16 | } NpcAiInfo; -------------------------------------------------------------------------------- /include/database.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /include/drv/arcdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "sdk/arc.h" 5 | 6 | #pragma warn_padding off 7 | typedef struct ArchiveEntry { 8 | u16 flags; //0x0 9 | //will pad 2 bytes 10 | ARCHandle handle; //0x4 11 | void* data; //0x20 12 | u32 size; //0x24 13 | } ArchiveEntry; 14 | #pragma warn_padding on 15 | 16 | 17 | void arcInit(void); 18 | void* arcOpen(const char* filename, void** addr, u32* length); 19 | 20 | void arcEntry(s32 id, void* data, u32 size); -------------------------------------------------------------------------------- /include/drv/bgdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef enum BackgroundFlags { 6 | BG_RENDERING = (1 << 0), 7 | BG_DO_MULTIPLY = (1 << 1), 8 | BG_NO_AUTOSCROLL = (1 << 2), 9 | BG_NO_TRANSLATION = (1 << 3) 10 | } BackgroundFlags; 11 | 12 | typedef struct BackgroundWork { 13 | u16 flags; //0x0 14 | u8 pad_2[2]; //0x2 15 | f32 trans_x; //0x4 16 | f32 trans_y; //0x8 17 | f32 scrl_x; //0xC 18 | f32 scrl_y; //0x10 19 | GXColor color; //0x14 20 | GXColor multiply; //0x18, see BG_DO_MULTIPLY 21 | void* data; //0x1C 22 | } BackgroundWork; 23 | 24 | void bgInit(void); 25 | void bgReInit(void); 26 | void bgEntry(const char* filename); 27 | void bgReEntry(const char* filename); 28 | void bgSetColor(GXColor color); 29 | void bgDispOn(void); 30 | void bgDispOff(void); 31 | void bgSetScrlOffset(f32 x, f32 y); 32 | void bgAutoScrollOff(void); 33 | void bgAutoScrollOn(void); 34 | void bgTransOffsetOff(void); 35 | void bgTransOffsetOn(void); 36 | void bgMain(void); -------------------------------------------------------------------------------- /include/drv/camdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | //#pragma enumsalwaysint on 7 | 8 | typedef void (*CameraCallback)(struct CameraEntry* entry); 9 | 10 | //see camInit 11 | typedef enum CameraId { 12 | CAMERA_OFFSCREEN = 0, 13 | CAMERA_OFFSCREEN2, 14 | CAMERA_SHADOW, 15 | CAMERA_BACKGROUND, 16 | CAMERA_3D, 17 | CAMERA_3D_EFFECTA, 18 | CAMERA_3D_IMAGE, 19 | CAMERA_3D_EFFECTB, 20 | CAMERA_2D, 21 | CAMERA_FADE, 22 | CAMERA_FADE2, 23 | CAMERA_DEBUG, 24 | CAMERA_DEBUG_3D 25 | } CameraId; 26 | 27 | typedef struct CameraEntry { 28 | u16 flags; //0x0 29 | u16 mode; //0x2 30 | u16 field_0x4; //0x4 31 | u16 field_0x6; //0x6, padding? 32 | f32 field_0x8; //0x8 33 | Vec cameraPos; //0xC 34 | Vec target; //0x18 35 | Vec cameraUp; //0x24 36 | f32 near; //0x30 37 | f32 far; //0x34 38 | f32 fovY; //0x38 39 | f32 aspect; //0x3C 40 | u8 field_0x40[0xF4 - 0x40]; //0x40 41 | u16 mScissor[4]; //0xF4, TODO retype? 42 | f32 mProjection[6]; //0xFC, TODO retype? 43 | f32 field_0x114; //0x114 44 | f32 field_0x118; //0x118 45 | Mtx view; //0x11C 46 | f32 bankRotation; //0x14C 47 | Vec postTranslation; //0x150 48 | Mtx44 projection; //0x15C 49 | GXProjectionType type; //0x19C 50 | u8 field_0x1A0[0x1E8 - 0x1A0]; //0x1A0 51 | u32 field_0x1E8; //0x1E8 52 | CameraCallback callback; //0x1EC 53 | Vec field_0x1F0; //0x1F0 54 | u32 field_0x1FC; //0x1FC, unknown 55 | Vec field_0x200; //0x200 56 | Vec field_0x20C; //0x20C 57 | u16 field_0x218; //0x218 58 | u16 field_0x21A; //0x21A 59 | u16 field_0x21C; //0x21C 60 | u16 field_0x21E; //0x21E 61 | u32 field_0x220; //0x220, unknown 62 | Vec field_0x224; //0x224 63 | Vec field_0x230; //0x230 64 | Vec field_0x23C; //0x23C 65 | Vec field_0x248; //0x248 66 | char name[0xC]; //0x254 67 | } CameraEntry; 68 | 69 | //u32 test = sizeof(cameraObj); //0x260/608 70 | 71 | void camInit(void); 72 | void camMain(void); 73 | void camDraw(void); 74 | 75 | CameraEntry* camGetPtr(s32 id); 76 | CameraEntry* camGetCurPtr(void); 77 | -------------------------------------------------------------------------------- /include/drv/casedrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct CaseSetup { 6 | u16 activeConditionId; //0x0, TODO rename 7 | u8 pad_2[2]; //0x2 8 | const char* hitObjName; //0x4 9 | u32 swFlag; //0x8 10 | void* activeFunc; //0xC 11 | s32 lwData[16]; //0x10 12 | u8 field_0x50[0x54 - 0x50]; //0x50 13 | void* evtCode; //0x54, TODO re-type 14 | s32 priority; //0x58 15 | } CaseSetup; 16 | 17 | void caseInit(void); 18 | void caseReInit(void); 19 | s32 caseEntry(CaseSetup* setup); 20 | void caseDelete(s32 caseId); 21 | void caseMain(void); -------------------------------------------------------------------------------- /include/drv/dispdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/camdrv.h" 5 | 6 | typedef void (*DispCallback)(CameraId cameraId, void* param); 7 | 8 | #pragma warn_padding off 9 | typedef struct DispEntry { 10 | u8 cameraId; //0x0, CameraId 11 | u8 renderMode; //0x1 12 | //will pad 2 bytes 13 | f32 order; //0x4 14 | DispCallback callback; //0x8 15 | void* param; //0xC 16 | } DispEntry; 17 | #pragma warn_padding on 18 | 19 | void dispInit(void); 20 | void dispReInit(void); 21 | void dispEntry(CameraId cameraId, s32 renderMode, DispCallback callback, void* param, f32 order); 22 | void dispSort(void); 23 | void dispDraw(CameraId cameraId); 24 | f32 dispCalcZ(Vec* input); 25 | DispEntry* dispGetCurWork(void); 26 | -------------------------------------------------------------------------------- /include/drv/effdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "mgr/filemgr.h" 5 | #include "texPalette.h" 6 | 7 | typedef void (*EffectCallback)(struct EffectEntry* effect); 8 | 9 | typedef struct EffectEntry { 10 | u32 flags; //0x0 11 | u32 inBattle; //0x4 12 | s32 count; //0x8 13 | void* userdata; //0xC, for effects to store their own data 14 | EffectCallback callback; //0x10 15 | const char* type; //0x14 16 | char name[16]; //0x18 17 | } EffectEntry; 18 | 19 | #pragma warn_padding off 20 | typedef struct EffectSet { 21 | s16 id; //0x0 22 | //will pad 2 bytes 23 | const char* name; //0x4 24 | } EffectSet; 25 | #pragma warn_padding on 26 | 27 | typedef struct EffectWork { 28 | s32 count; //0x0 29 | EffectEntry* entries; //0x4 30 | TPLHeader* texture; //0x8 31 | BOOL texLoaded; //0xC 32 | FileEntry* handle; //0x10 33 | s32 language; //0x14 34 | } EffectWork; 35 | 36 | void effInit(void); 37 | void effTexSetup(void); 38 | void effGetTexObj(u32 id, GXTexObj* obj); 39 | void effAutoRelease(BOOL inBattle); 40 | EffectEntry* effEntry(void); 41 | void effSetName(EffectEntry* effect, const char* name); 42 | void effMain(void); 43 | void effDelete(EffectEntry* effect); 44 | void effSoftDelete(EffectEntry* effect); 45 | EffectEntry* effNameToPtr(const char* name); 46 | EffectSet* effGetSet(const char* name); 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /include/drv/envdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "memory.h" 5 | 6 | typedef struct EnvironmentGlareTexCoord { 7 | f32 unk0; //0x0 8 | f32 unk4; //0x4 9 | } EnvironmentGlareTexCoord; 10 | 11 | typedef struct EnvironmentGlare { 12 | GXBlendMode mode; //0x0 13 | GXBlendFactor srcFactor; //0x4 14 | GXBlendFactor dstFactor; //0x8 15 | GXTevKColorSel unkC; //0xC 16 | GXTevKColorSel unk10; //0x10 17 | f32 unk14; //0x14 18 | s32 count; //0x18, number of coords that follors 19 | EnvironmentGlareTexCoord coords[]; //0x1C 20 | } EnvironmentGlare; 21 | 22 | typedef struct EnvironmentGlareFilter { 23 | u16 flags; //0x0 24 | u16 type; //0x2 25 | u16 y0; //0x4 26 | u16 y1; //0x6 27 | u16 x0; //0x8 28 | u16 x1; //0xA 29 | f32 zscale; //0xC 30 | } EnvironmentGlareFilter; 31 | 32 | typedef struct EnvironmentUnk88 { 33 | u16 unk0; //0x0 34 | u8 unk2; //0x2 35 | u8 unk3; //0x3 36 | f32 unk4; //0x4 37 | f32 unk8; //0x8 38 | } EnvironmentUnk88; 39 | 40 | typedef struct EnvironmentWork { 41 | s32 flags; //0x0 42 | smartEntry* capture; //0x4 43 | smartEntry* capture2; //0x8 44 | GXTexObj captureObj; //0xC 45 | GXTexObj captureObj2; //0x2C 46 | void* envBlur; //0x4C, see envBlurOn 47 | GXTexObj envBlurObj; //0x50 48 | u8 unk70[0x88 - 0x70]; //0x70 49 | EnvironmentUnk88 unk88; //0x88 50 | u8 unk94[0x98 - 0x94]; //0x94 51 | u16 unk98; //0x98, some substruct 52 | u8 unk9A[0xB0 - 0x9A]; //0x9A 53 | EnvironmentGlareFilter filter; //0xB0 54 | u8 unkC0[0xF0 - 0xC0]; //0xC0 55 | } EnvironmentWork; 56 | 57 | void envInit(void); 58 | void envReInit(void); 59 | void envTexSetup(void); 60 | void envMain(void); 61 | //envBlurOn 62 | //envBlurOff 63 | void envGlare(EnvironmentGlare* glare); 64 | 65 | 66 | -------------------------------------------------------------------------------- /include/drv/extdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct ExtWork { 6 | s32 poseNum; //0x0, TODO: poseId 7 | u8 field_0x4[4]; //0x4 8 | s32 field_0x8; //0x8 9 | u8 field_0xC[0x70 - 0xC]; //0xC 10 | } ExtWork; 11 | 12 | void extInit(void); 13 | void extMain(void); -------------------------------------------------------------------------------- /include/drv/fadedrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/imgdrv.h" 4 | #include "texPalette.h" 5 | #include 6 | #include 7 | 8 | typedef void (*OffscreenCallback)(void* param, void* unused); 9 | 10 | typedef enum FadeType { 11 | FADE_IN_BLACK = 9, 12 | FADE_OUT_BLACK = 10, 13 | 14 | 15 | 16 | 17 | 18 | 19 | FADE_OUT_WHITE = 17, 20 | FADE_IN_WHITE2 = 18, 21 | 22 | 23 | 24 | 25 | 26 | TITLE_SCREEN_CURTAIN_LEAVE_GRADUAL2 = 39 27 | } FadeType; 28 | 29 | typedef struct FadeEntry { 30 | u16 flags; //0x0, 4 = use virtual pos 31 | u8 pad_2[2]; //0x2 32 | FadeType type; //0x4 33 | s32 field_0x8; //0x8 34 | u8 field_0xC[0x10 - 0xC]; //0xC 35 | s32 field_0x10; //0x10 36 | s32 field_0x14; //0x14 37 | GXColor color; //0x18 38 | f32 fadeSpotX; //0x1C 39 | f32 fadeSpotY; //0x20 40 | f32 field_0x24; //0x24 41 | f32 field_0x28; //0x28 42 | u8 field_0x2C[0x5C - 0x2C]; //0x2C 43 | f32 field_0x5C; //0x5C 44 | const char* field_0x60; //0x60 45 | const char* field_0x64; //0x64 46 | s32 imageType; //0x68 47 | s32 field_0x6C; //0x6C 48 | s32 field_0x70; //0x70 49 | u8 field_0x74[0x78 - 0x74]; //0x74 50 | f32 animOffsetX; //0x78 51 | f32 animOffsetY; //0x7C 52 | Vec VirtualPos; //0x80 53 | ImageEntry* image; //0x8C 54 | f32 field_0x90; //0x90 55 | u8 field_0x94[0x98 - 0x94]; //0x94 56 | OffscreenCallback callback; //0x9C 57 | void* offparam; //0xA0 58 | u32 field_0xA4; //0xA4 59 | } FadeEntry; 60 | 61 | typedef struct FadeWork { 62 | u16 flags; //0x0 63 | u8 pad_2[2]; //0x2 64 | u32 field_0x4; //0x4 65 | FadeEntry entries[5]; //0x8 66 | s32 field_0x350; //0x350 67 | f32 field_0x354; //0x354, softness? fadeTecSoftOn 68 | TPLHeader* texture; //0x358 69 | BOOL loaded; //0x35C 70 | } FadeWork; 71 | 72 | void fadeInit(void); 73 | void fadeTexSetup(void); 74 | void fadeEntry(s32 type, s32 duration, GXColor color); 75 | void fadeTecOn(void); 76 | void fadeTecOff(void); 77 | void fadeTecSoftOn(void); 78 | void fadeTecSoftOff(void); 79 | void fadeSoftFocusOn(void); 80 | void fadeSoftFocusOff(void); 81 | void fadeWhiteOutOn(void); 82 | void fadeWhiteOutOff(void); 83 | void fadeSetSpotPos(f32 x, f32 y); 84 | void fadeSetAnimOfsPos(f32 x, f32 y); 85 | void fadeSetOffscreenCallback(OffscreenCallback callback, void* param); 86 | void fadeMain(void); 87 | BOOL fadeIsFinish(void); 88 | void fadeReset(s32 id); 89 | TPLHeader* fadeGetTpl(void); 90 | void fadeSetNarrowFast(void); 91 | -------------------------------------------------------------------------------- /include/drv/hitdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/mapdrv.h" 5 | 6 | typedef BOOL (*HitFilterCallback)(struct HitCheckQuery* query, struct HitEntry* entry); 7 | 8 | typedef struct HitVector { 9 | Vec e13; //0x0, v3 - v1 10 | Vec e21; //0xC, v1 - v2 11 | Vec e32; //0x18, v2 - v3 12 | Vec v1; //0x24 13 | Vec v2; //0x30 14 | Vec v3; //0x3C 15 | Vec normal; //0x48 16 | } HitVector; 17 | 18 | typedef struct HitCheckQuery { 19 | BOOL singleSided; //0x0 20 | s32 user0; //0x4 21 | s32 user1; //0x8 22 | Vec targetPos; //0xC 23 | Vec targetDir; //0x18 24 | Vec hitPos; //0x24 25 | Vec hitNormal; //0x30 26 | f32 targetDistance; //0x3C 27 | } HitCheckQuery; 28 | 29 | typedef struct HitDamageReturn { 30 | const char* mapobjName; //0x0 31 | Vec position; //0x4 32 | } HitDamageReturn; 33 | 34 | typedef struct HitEntry { 35 | u16 flags; //0x0 36 | u8 unk2[0x4 - 0x2]; //0x2 37 | s32 attributes; //0x4 38 | MapJoint* joint; //0x8 39 | Mtx unkC; //0xC 40 | Mtx unk3C; //0x3C 41 | Mtx unk6C; //0x6C 42 | Vec unk9C; //0x9C 43 | s16 unkA8; //0xA8 44 | u8 unkAA[0xAC - 0xAA]; //0xAA 45 | HitVector* unkAC; //0xAC 46 | HitDamageReturn* damage; //0xB0 47 | u8 unkB4[0xC0 - 0xB4]; //0xB4 48 | Vec unkC0; //0xC0 49 | f32 unkCC; //0xCC 50 | MapObject* mapObj; //0xD0 51 | struct HitEntry* parent; //0xD4 52 | struct HitEntry* child; //0xD8 53 | struct HitEntry* next; //0xDC 54 | struct HitEntry* nextActive; //0xE0 55 | } HitEntry; 56 | 57 | void hitInit(void); 58 | void hitMain(void); 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | void hitReCalcMatrix(HitEntry* hit, Mtx mtx); 68 | HitEntry* hitCheckVecFilter(HitCheckQuery* query, HitFilterCallback callback); 69 | HitEntry* hitCheckFilter(HitFilterCallback callback, f32* hitX, f32* hitY, f32* hitZ, f32* distance, 70 | f32* hitNX, f32* hitNY, f32* hitNZ, f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz); 71 | BOOL hitCheckVecHitObjXZ(HitCheckQuery* query, HitEntry* entry); 72 | HitEntry* hitCheckAttr(s32 user0, f32* hitX, f32* hitY, f32* hitZ, f32* distance, f32* hitNX, 73 | f32* hitNY, f32* hitNZ, f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz); 74 | HitEntry* hitCheckSphereFilter(HitFilterCallback callback, f32 x, f32 y, f32 z, f32 distance); 75 | HitEntry *hitNameToPtr(const char *name); 76 | void hitObjGetPos(const char* name, Vec* position); 77 | void hitObjGetNormal(const char *name, Vec *normal); 78 | const char* hitGetName(HitEntry* hit); 79 | s32 hitGetAttr(HitEntry* hit); 80 | void hitGrpDamageReturnSet(const char* name, HitDamageReturn* damage); 81 | Vec* hitGetDamageReturnPos(HitEntry* hit); 82 | void hitBindMapObj(const char *hitName, const char *mapobjName); 83 | 84 | -------------------------------------------------------------------------------- /include/drv/icondrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | icon.bin structure: 5 | s16 numEntries 6 | s16 entryOffset[numEntries] 7 | s16 IconBinEntry[6][numEntries] (?, width override? height override? numImages, tplId, iconDelay?) 8 | 2 extra bytes for some reason 9 | */ 10 | 11 | #include 12 | 13 | #define numBinEntries 0x218 14 | 15 | typedef struct IconBinaryEntry { 16 | u16 type; //0x0, 1 if animated 17 | u16 width; //0x2, overrides tpl size 18 | u16 height; //0x4, overrides tpl size 19 | u16 numIcons; //0x6, for simple anims like button press 20 | u16 tplId; //0x8, for tpl lookup 21 | u16 frameDelay; //0xA, if animated, number of frames until next 22 | } IconBinaryEntry; 23 | 24 | typedef struct IconBinary { 25 | u16 count; //0x0, numBinEntries 26 | u16 offset[numBinEntries]; //0x2 27 | IconBinaryEntry data[numBinEntries]; //0x432 28 | } IconBinary; 29 | 30 | 31 | //flags, 1 = in use, 0x10 = 2D, 0x1000 = animated(?), 0x2000 = ?(something to do with bin) 32 | #pragma warn_padding off 33 | typedef struct IconEntry { 34 | s16 flags; //0x0 35 | u8 field_0x2; //0x2 36 | //pad 1 byte 37 | Vec position; //0x4 38 | f32 scale; //0x10 39 | GXColor color; //0x14 40 | char name[16]; //0x18 41 | s16 iconId; //0x28 42 | u16 width; //0x2A 43 | u16 height; //0x2C 44 | u16 numIcons; //0x2E 45 | u16 currIcon; //0x30, if animated, currently displayed icon (starts at 0) 46 | u16 tplId; //0x32 47 | u16 frameDelay; //0x34 48 | u8 field_0x36[2]; //0x36, padding? 49 | } IconEntry; 50 | #pragma warn_padding on 51 | 52 | typedef struct IconWork { 53 | s32 count; //0x0 54 | IconEntry* entries; //0x4 55 | } IconWork; 56 | 57 | void iconInit(void); 58 | void iconTexSetup(void); 59 | void iconReInit(void); 60 | void iconMain(void); 61 | void iconEntry(const char* name, s16 iconId); 62 | void iconEntry2D(const char* name, s16 iconId); 63 | void iconDelete(const char* name); 64 | void iconChange(const char* name, s16 iconId); 65 | void iconDispGxAlpha(Vec position, s16 flags, s16 iconId, u8 alpha, f32 scale); 66 | void iconDispGx(Vec position, s16 flags, s16 iconId, f32 scale); 67 | void iconDispGx2(Mtx mtx, s16 flags, s16 iconId); 68 | void iconDispGxCol(Mtx pos, s16 flags, s32 iconId, GXColor color); 69 | void iconGetTexObj(GXTexObj* texObj, s16 iconId); 70 | void iconGetWidthHeight(u16* width, u16* height, s16 iconId); 71 | IconEntry* iconNameToPtr(const char* name); 72 | void iconSetPos(const char* name, f32 x, f32 y, f32 z); 73 | void iconFlagOn(const char* name, s16 flags); 74 | void iconFlagOff(const char* name, s16 mask); 75 | void iconSetScale(const char* name, f32 scale); 76 | void iconSetAlpha(const char* name, u8 alpha); 77 | f32 iconNumberDispGx(Mtx mtx, s32 number, BOOL small, GXColor color); 78 | f32 iconNumberDispGx3D(Mtx mtx, s32 number, BOOL small, GXColor color); 79 | -------------------------------------------------------------------------------- /include/drv/imgdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/camdrv.h" 4 | #include "memory.h" 5 | #include 6 | 7 | typedef struct ImageShadow { 8 | s32 flags; //0x0 9 | u16 field_0x4; //0x4 10 | u16 field_0x6; //0x6 11 | u8 field_0x8[0x10 - 0x8]; //0x8 12 | s32 field_0x10; //0x10 13 | s32 field_0x14; //0x14 14 | s32 field_0x18; //0x18 15 | u8 field_0x1C[0x3C - 0x1C]; //0x1C 16 | smartEntry* field_0x3C; //0x3C, TODO: "data"? 17 | s32 field_0x40; //0x40, TODO: "hasData" or smth? 18 | } ImageShadow; 19 | 20 | typedef struct ImageEntry { 21 | ImageShadow shadows[3]; //0x0 22 | u32 flags; //0xCC 23 | s32 type; //0xD0 24 | char name[16]; //0xD4 25 | u16 field_0xE4; //0xE4 26 | u16 field_0xE6; //0xE6 27 | f32 field_0xE8; //0xE8 28 | f32 field_0xEC; //0xEC 29 | Vec point; //0xF0, virtual point 30 | f32 order; //0xFC 31 | s32 shadowId; //0x100 32 | s32 poseId; //0x104 33 | s32 field_0x108; //0x108 34 | u8 field_0x10C[0x118 - 0x10C]; //0x10C 35 | f32 field_0x118; //0x118 36 | f32 field_0x11C; //0x11C 37 | Mtx field_0x120; //0x120 38 | CameraId cameraId; //0x150 39 | s32 field_0x154; //0x154 40 | } ImageEntry; 41 | 42 | typedef struct ImageWork { 43 | s32 count; //0x0 44 | ImageEntry* entries; //0x4 45 | } ImageWork; 46 | 47 | void imgInit(void); 48 | void imgAutoRelease(s32 type); 49 | s32 imgEntry(const char* name, s32 type); 50 | void imgMain(void); 51 | ImageEntry* imgNameToPtr(const char* name, s32 type); 52 | void imgFreeCapture(ImageEntry* entry, s32 shadowId); 53 | void imgSetVirtualPoint(ImageEntry* entry, const Vec* point); 54 | void imgClearVirtualPoint(ImageEntry* entry); 55 | void imgRelease(ImageEntry* entry, s32 type); 56 | void imgSetShadow(ImageEntry* entry, s32 shadowId); 57 | 58 | -------------------------------------------------------------------------------- /include/drv/itemdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/effdrv.h" 4 | #include 5 | 6 | typedef struct ItemEntry { 7 | u16 flags; //0x0 8 | u16 field_0x2; //0x2 9 | s32 itemId; //0x4 10 | s32 evtId; //0x8, TODO: better name? 11 | char name[0x10]; //0xC 12 | EffectEntry* effect; //0x1C 13 | u8 field_0x20[0x24 - 0x20]; //0x20 14 | u16 mode; //0x24 15 | u16 field_0x26; //0x26 16 | u8 field_0x28[0x3C - 0x28]; //0x28 17 | Vec position; //0x3C 18 | f32 scale; //0x48 19 | u8 alpha; //0x4C, TODO: "icon_alpha"? 20 | u8 field_0x4D[0x68 - 0x4D]; //0x4D 21 | OSTime field_0x68; //0x68 22 | u8 field_0x70[0x98 - 0x70]; //0x70 23 | } ItemEntry; 24 | 25 | typedef struct ItemWork { 26 | s32 count; //0x0 27 | ItemEntry* entries; //0x4 28 | u32 currId; //0x8, next available itemId 29 | u8 field_0xC[0x1C - 0xC]; //0xC 30 | } ItemWork; 31 | 32 | void itemInit(void); 33 | void itemReInit(void); 34 | 35 | void itemMain(void); -------------------------------------------------------------------------------- /include/drv/lightdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #define LIGHT_ENTRY_COUNT 32 7 | 8 | #pragma enumsalwaysint off 9 | typedef enum LightEntryFlags { 10 | LIGHT_ENABLED = 1 << 0, 11 | LIGHT_NO_DIST_ATTEN = 1 << 6, //TODO: rename? 12 | LIGHT_CHARA = 1 << 7, 13 | LIGHT_POINT = 1 << 12, 14 | LIGHT_SPOT = 1 << 13, 15 | LIGHT_DIRECTIONAL = 1 << 14, 16 | LIGHT_AMBIENT = 1 << 15 17 | } LightEntryFlags; 18 | #pragma enumsalwaysint on 19 | 20 | typedef struct LightEntry { 21 | LightEntryFlags flags; //0x0 22 | char name[32]; //0x2 23 | u8 align_22[2]; //0x22 24 | Vec position; //0x24 25 | Vec rotation; //0x30 26 | Vec field_0x3C; //0x3C, some other positional 27 | GXColor color; //0x48 28 | f32 spotAngle; //0x4C 29 | f32 attenAngle; //0x50 30 | Vec attenDistCoef; //0x54 31 | } LightEntry; 32 | 33 | typedef struct LightWork { 34 | s32 count; //0x0 35 | LightEntry* entries; //0x4 36 | } LightWork; 37 | 38 | void lightInit(void); 39 | void lightReInit(void); 40 | void lightMain(void); 41 | s32 lightEntry(const char* name, s32 type, Vec position, Vec rotation, GXColor color, s32 attenType, s32 flags, f32 spotAngle, f32 attenAngle); 42 | LightEntry* lightNameToPtr(const char* name); 43 | void lightGetNearObj(Vec position, LightEntry* entry, s32 count, LightEntryFlags flags); 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /include/drv/mobjdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | typedef struct MapObjectHitEntry { 7 | u8 field_0x0[0x88 - 0x0]; //0x0 8 | } MapObjectHitEntry; 9 | 10 | typedef struct MapObjectEntry { 11 | u8 field_0x0[0x38 - 0x0]; //0x0 12 | Vec position; //0x38 13 | Vec scale; //0x44 14 | Vec rotation; //0x50 15 | u8 field_0x5C[0x70 - 0x5C]; //0x5C 16 | s32 poseId; //0x70 17 | MapObjectHitEntry hitObj[2]; //0x74 18 | Vec scale2; //0x184 19 | u8 field_0x190[0x23C - 0x190]; //0x190 20 | } MapObjectEntry; 21 | 22 | typedef struct MapObjectWork { 23 | s32 count; //0x0 24 | MapObjectEntry* entries; //0x4 25 | u8 field_0x8[0x1C - 0x8]; //0x8 26 | } MapObjectWork; 27 | 28 | void mobjInit(void); 29 | void mobjMain(void); -------------------------------------------------------------------------------- /include/drv/msgdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/windowdrv.h" 5 | #include "memory.h" 6 | 7 | typedef struct MsgDataEntry { 8 | u32 field_0x0; //0x0, probably a GXColor? 9 | u16 glyph; //0x4 10 | u8 field_0x6[0xC - 0x6]; //0x6 11 | s32 field_0xC; //0xC 12 | u8 field_0x10[0x18 - 0x10]; //0x10 13 | /*s32 poseId; //0x0 14 | s16 field_0x4; //0x4 15 | s16 field_0x6; //0x6 16 | s16 field_0x8; //0x8 17 | u8 pad_0xA[2]; //0xA 18 | s32 paperPoseId; //0xC 19 | f32 scale; //0x10 20 | f32 rotY; //0x14*/ 21 | } MsgDataEntry; 22 | 23 | typedef struct MessageData { //TODO: rename? 24 | u8 field_0x0[0x18 - 0x0]; //0x0 25 | OSTime field_0x18; //0x18 26 | u8 field_0x20[0x30 - 0x20]; //0x20 27 | OSTime field_0x30; //0x30 28 | s32 entryId; //0x38 29 | MsgDataEntry entries[1298]; //0x3C, TODO: why -2? 30 | u8 field_0x79EC[0x7A30 - 0x79EC]; //0x79EC 31 | s32 field_0x7A30; //0x7A30 32 | u8 field_0x7A34[0x7A4C - 0x7A34]; //0x7A34 33 | WindowEntry* window; //0x7A4C 34 | u8 field_0x7A50[0x7A58 - 0x7A50]; //0x7A50 35 | } MessageData; 36 | 37 | typedef struct MessageEntry { 38 | u32 length; //0x0 39 | void* address; //0x4 40 | u32 count; //0x8 41 | smartEntry* lookup; //0xC 42 | } MessageEntry; 43 | 44 | typedef struct MessageWork { 45 | MessageEntry entries[2]; //0x0 46 | s32 poseId; //0x20 47 | } MessageWork; 48 | 49 | void msgInit(void); 50 | void msgLoad(const char* filename, s32 index); 51 | 52 | 53 | MessageWork* msgGetWork(void); 54 | 55 | const char* msgSearch(const char* tag); 56 | BOOL _ismbblead(u32 a1); -------------------------------------------------------------------------------- /include/drv/offscreendrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct OffscreenEntry { 6 | s32 flags; //0x0 7 | char name[4]; //0x4, TODO get full size 8 | u8 field_0x8[0x14 - 0x8]; //0x8 9 | u16 currLeft; //0x14 10 | u16 currTop; //0x16 11 | u16 currRight; //0x18 12 | u16 currBottom; //0x1A 13 | u8 field_0x1C[0x3C - 0x1C]; //0x1C 14 | s32 field_0x3C; //0x3C 15 | s32 field_0x40; //0x40 16 | u8 field_0x44[0x48 - 0x44]; //0x44 17 | u16 prevLeft; //0x48 18 | u16 prevTop; //0x4A 19 | u16 prevRight; //0x4C 20 | u16 prevBottom; //0x4E 21 | } OffscreenEntry; 22 | 23 | typedef struct OffscreenWork { 24 | s32 count; //0x0 25 | OffscreenEntry* entries; //0x4 26 | } OffscreenWork; 27 | 28 | void offscreenInit(void); 29 | void offscreenReset(BOOL inBattle); 30 | s32 offscreenEntry(const char* name); 31 | void offscreenMain(void); 32 | void offscreenAddBoundingBox(s32 id, u16 left, u16 top, u16 right, u16 bottom); 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /include/drv/seqdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef void (*SequenceCallback)(struct SequenceWork* work); 6 | 7 | typedef enum SequenceType { 8 | SEQ_UNDEFINED = -1, 9 | SEQ_LOGO = 0, 10 | SEQ_TITLE = 1, 11 | SEQ_GAME = 2, 12 | SEQ_MAP_CHANGE = 3, 13 | SEQ_BATTLE = 4, 14 | SEQ_GAME_OVER = 5, 15 | SEQ_LOAD = 6, 16 | SEQ_E3 = 7 17 | } SequenceType; 18 | 19 | typedef struct SequenceWork { 20 | SequenceType sequence; //0x0 21 | s32 state; //0x4, 0-7 22 | const char* mapName; //0x8 23 | const char* beroName; //0xC 24 | u32 field_0x10; //0x10 25 | u32 field_0x14; //0x14 26 | u32 field_0x18; //0x18 27 | u32 field_0x1C; //0x1C 28 | } SequenceWork; 29 | 30 | void seqInit_MARIOSTORY(void); 31 | void seqMain(void); 32 | void seqSetSeq(SequenceType seq, const char* map, const char* bero); 33 | SequenceType seqGetSeq(void); 34 | SequenceType seqGetPrevSeq(void); 35 | SequenceType seqGetNextSeq(void); 36 | BOOL seqCheckSeq(void); 37 | -------------------------------------------------------------------------------- /include/drv/shadowdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "memory.h" 5 | 6 | typedef struct DepthShadowWork { 7 | s32 unk0; //0x0 8 | s32 unk4; //0x4 9 | s32 unk8; //0x8 10 | u8 unkC[0x100 - 0xC]; //0xC 11 | GXColor unk100; //0x100 12 | } DepthShadowWork; 13 | 14 | typedef struct ProjShadowWork { 15 | s32 unk0; //0x0 16 | s32 unk4; //0x4 17 | s32 unk8; //0x8 18 | u8 unkC[0x100 - 0xC]; //0xC 19 | GXColor unk100; //0x100 20 | } ProjShadowWork; 21 | 22 | typedef struct ShadowEntry { 23 | u8 unk0[0x5C - 0x0]; //0x0 24 | } ShadowEntry; 25 | 26 | typedef struct CharShadowWork { 27 | s32 unk0; //0x0 28 | s32 unk4; //0x4 29 | s32 unk8; //0x8 30 | u8 field_0xC[0xFC - 0xC]; //0xC 31 | smartEntry* unkFC; //0xFC 32 | GXColor unk100; //0x100 33 | s32 unk104; //0x104 34 | ShadowEntry* entries; //0x108 35 | s32 unk10C; //0x10C 36 | s32 unk110; //0x110 37 | f32 unk114; //0x114 38 | s32 unk118; //0x118 39 | } CharShadowWork; 40 | 41 | void shadowInit(void); 42 | void shadowMain(void); -------------------------------------------------------------------------------- /include/drv/swdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void swInit(void); 6 | void swReInit(void); 7 | 8 | //Local Saved Work 9 | s32 _swByteGet(s32 index); 10 | void _swByteSet(s32 index, u8 value); 11 | //Local Saved Work Flags 12 | void _swClear(s32 index); 13 | BOOL _swGet(s32 index); 14 | void _swSet(s32 index); 15 | //Global Saved Work 16 | s32 swByteGet(s32 index); 17 | void swByteSet(s32 index, s32 value); 18 | //Global Saved Work Flags 19 | void swClear(s32 index); 20 | BOOL swGet(s32 index); 21 | void swSet(s32 index); 22 | -------------------------------------------------------------------------------- /include/drv/windowdrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "memory.h" 6 | 7 | typedef struct WindowEntry WindowEntry; 8 | 9 | typedef enum WindowType { 10 | WINDOW_TYPE_NORMAL = 0, 11 | WINDOW_TYPE_SMALL = 1, 12 | WINDOW_TYPE_PLATE = 2, 13 | WINDOW_TYPE_SYSTEM = 3, 14 | WINDOW_TYPE_KANBAN = 4, //kanban = sign/billboard 15 | WINDOW_TYPE_SELECT = 5, 16 | WINDOW_TYPE_BOSS = 6, 17 | WINDOW_TYPE_DIARY = 7, 18 | WINDOW_TYPE_TEC = 8, 19 | WINDOW_TYPE_MAJO = 9, //majo = witch, shadow sirens 20 | WINDOW_TYPE_HOUSOU = 10, //housou = broadcast/announcement 21 | WINDOW_TYPE_CLEAR = 11 22 | } WindowType; 23 | 24 | struct WindowEntry { 25 | u8 field_0x0[2]; //0x0 26 | u16 flags; //0x2 27 | u16 field_0x4; //0x4 28 | s16 alpha; //0x6, window alpha 29 | s32 type; //0x8, WindowType 30 | f32 x; //0xC, window xpos 31 | f32 y; //0x10, window ypos 32 | f32 height; //0x14 33 | f32 width; //0x18 34 | u8 field_0x1C[0x28 - 0x1C]; //0x1C 35 | smartEntry* userdata; //0x28, TODO: verify? could be wrong 36 | s16 field_0x2C; //0x2C 37 | u8 field_0x2E[0x3C - 0x2E]; //0x2E 38 | void (*main)(WindowEntry* entry); //0x3C 39 | void (*delete)(WindowEntry* entry); //0x40 40 | u8 field_0x44[0x48 - 0x44]; //0x44 41 | }; 42 | 43 | void windowInit(void); 44 | void windowTexSetup(void); 45 | void windowReInit(void); 46 | s32 windowEntry(u16 a1); 47 | BOOL windowDelete(WindowEntry* entry); 48 | BOOL windowDeleteID(s32 id); 49 | void windowMain(void); 50 | void windowDispGX_Kanban(s32 type, u8 alpha, f32 x, f32 y, f32 height, f32 width); 51 | void windowDispGX_System(s32 type, u8 alpha, f32 x, f32 y, f32 height, f32 width); 52 | void windowDispGX_Message(s32 type, s32 a2, u8 alpha, f32 x, f32 y, f32 height, f32 width, f32 a9, f32 a10); 53 | void windowDispGX_Waku_col(s16 gxTexMapID, GXColor color, f32 x, f32 y, f32 height, f32 width, f32 curve); 54 | void windowDispGX2_Waku_col(Mtx mtx, s16 gxTexMapID, GXColor color, f32 x, f32 y, f32 width, f32 height, f32 curve); 55 | s32 windowCheckID(s32 id); 56 | WindowEntry* windowGetPointer(s32 id); 57 | GXTexObj* getWakuTexObj(s32 id); 58 | -------------------------------------------------------------------------------- /include/eff/eff_kemuri.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/effdrv.h" 4 | #include 5 | 6 | EffectEntry* effKemuriEntry(s32 int2, f32 float3, f32 float4, f32 float5); 7 | void effKemuriMain(EffectEntry* effect); -------------------------------------------------------------------------------- /include/eff/eff_mahorn2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/effdrv.h" 5 | 6 | typedef struct effMahorn2Data { 7 | BOOL unused; //0x0 8 | Vec position; //0x4 9 | Vec target; //0x10 10 | f32 scale; //0x1C 11 | f32 hitDistance; //0x20, how big the hitbox is around the target 12 | s32 alpha; //0x24 13 | s32 intplStep; //0x28, interpolation step for scaling 14 | s32 type; //0x2C, what type of entity is it (inside this effect) 15 | BOOL unused2; //0x30 16 | s32 counter; //0x34 17 | BOOL hasHit; //0x38, have we hit the target yet? 18 | } effMahorn2Data; 19 | 20 | EffectEntry* effMahorn2Entry(BOOL unused, f32 posX, f32 posY, f32 posZ, f32 dstX, f32 dstY, f32 dstZ, f32 scale, f32 radius); 21 | -------------------------------------------------------------------------------- /include/eff/eff_n64.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "texPalette.h" 5 | 6 | typedef struct eff_n64_work { 7 | TPLHeader* effTexture; //0x0 8 | BOOL effTextureLoaded; //0x4 9 | } eff_n64_work; 10 | 11 | #pragma warn_padding off 12 | typedef struct eff_set { 13 | s16 id; //0x0 14 | //will pad to 2 bytes 15 | char* name; //0x4 16 | } eff_set; 17 | #pragma warn_padding on 18 | 19 | typedef struct effVtxArray { 20 | s16 pos[3]; //0x0, XYZ 21 | s16 tex0[2]; //0x6, ST 22 | u8 clr0[3][0xE]; //0xA, RGBA8 23 | u32 unk; //0x34 24 | } effVtxArray; 25 | 26 | void effInit64(void); 27 | void effTexSetupN64(void); 28 | void effGetTexObjN64(u32 id, GXTexObj* obj); 29 | eff_set* effGetSetN64(const char* name); 30 | u32 effTblRandN64(u32 rand, s32 index); 31 | void effSetVtxDescN64(effVtxArray* array); 32 | void tri1(u16 x, u16 y, u16 z); -------------------------------------------------------------------------------- /include/eff/eff_nice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/effdrv.h" 4 | #include 5 | 6 | typedef struct NiceEffectWork { 7 | s32 type; //0x0 8 | Vec position; //0x4 9 | f32 field_0x10; //0x10, Vec scale;? 10 | f32 field_0x14; //0x14 11 | f32 field_0x18; //0x18 12 | f32 field_0x1C; //0x1C 13 | s32 field_0x20; //0x20 14 | u8 field_0x24[0x28 - 0x24]; //0x24 15 | s32 field_0x28; //0x28 16 | u8 field_0x2C[0x30 - 0x2C]; //0x2C 17 | s32 poseId; //0x30 18 | u8 field_0x34[0x64 - 0x34]; //0x34 19 | } NiceEffectWork; 20 | 21 | BOOL effNiceAsync(s32 group); 22 | EffectEntry* effNiceEntry(s32 type, f32 x, f32 y, f32 z); 23 | 24 | -------------------------------------------------------------------------------- /include/eff/eff_scanning.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/effdrv.h" -------------------------------------------------------------------------------- /include/eff/eff_sleep.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/effdrv.h" 4 | #include 5 | 6 | typedef struct effSleepData { 7 | s32 field_0x0; //0x0 8 | Vec position; //0x4 9 | f32 scale; //0x10 10 | s32 field_0x14; //0x14 11 | s32 field_0x18; //0x18, time? 12 | s32 field_0x1C; //0x1C 13 | s32 field_0x20; //0x20 14 | } effSleepData; 15 | 16 | EffectEntry* effSleepEntry(s32 a1, s32 a2, f32 a3, f32 a4, f32 a5, f32 a6, f32 a7); 17 | void effSleepMain(EffectEntry* effect); 18 | -------------------------------------------------------------------------------- /include/eff/eff_ultra_hammer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/effdrv.h" 5 | 6 | typedef struct EffUltraHammerData { 7 | BOOL unk0; //0x0, doesn't actually get read 8 | Vec position; //0x4 9 | f32 scale; //0x10 10 | f32 offsetX; //0x14 11 | f32 offsetY; //0x18 12 | s32 alpha; //0x1C 13 | s32 counter; //0x20, 1000 ticks until effect is destroyed 14 | s32 scroll; //0x24, controls scroll data 15 | s32 update; //0x28, how long until scroll updates 16 | } EffUltraHammerData; 17 | 18 | EffectEntry* effUltraHammerEntry(BOOL arg0, s32 counter, f32 x, f32 y, f32 z, f32 scale); -------------------------------------------------------------------------------- /include/eff/n64/eff_expbom_n64.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/effdrv.h" 5 | 6 | EffectEntry* effExpBomN64Entry(f32 x, f32 y, f32 z); -------------------------------------------------------------------------------- /include/eff/n64/eff_kemuri1_n64.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/effdrv.h" 5 | 6 | EffectEntry* effKemuri1N64Entry(s32 type, f32 a2, f32 a3, f32 a4, f32 a5); -------------------------------------------------------------------------------- /include/error_handler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void setupErrorHandler(void); -------------------------------------------------------------------------------- /include/evt/evt_audience.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "evt/evt_cmd.h" 4 | #include 5 | 6 | USERFUNC_DEF(evt_audience_base_flag_on); 7 | USERFUNC_DEF(evt_audience_flag_check); 8 | USERFUNC_DEF(evt_audience_flag_on); 9 | USERFUNC_DEF(evt_audience_flag_off); 10 | USERFUNC_DEF(evt_audience_set_position); 11 | USERFUNC_DEF(evt_audience_get_position); 12 | USERFUNC_DEF(evt_audience_set_rotate); 13 | USERFUNC_DEF(evt_audience_set_rotate_offset); 14 | USERFUNC_DEF(evt_audience_move_position_frame); 15 | USERFUNC_DEF(evt_audience_move_position_speed); 16 | USERFUNC_DEF(evt_audience_jump_position_firstsp); 17 | USERFUNC_DEF(evt_audience_jump_position_gravity); 18 | USERFUNC_DEF(evt_audience_set_animpose); 19 | USERFUNC_DEF(evt_audience_entry); 20 | USERFUNC_DEF(evt_audience_delete); 21 | USERFUNC_DEF(evt_audience_ap_recovery); 22 | USERFUNC_DEF(evt_audience_reflesh_natural_all); 23 | USERFUNC_DEF(evt_audience_abnormal_natural_all); 24 | //USERFUNC_DEF(); 25 | //USERFUNC_DEF(); 26 | //USERFUNC_DEF(); 27 | //USERFUNC_DEF(); 28 | //USERFUNC_DEF(); 29 | //USERFUNC_DEF(); 30 | //USERFUNC_DEF(); 31 | //USERFUNC_DEF(); 32 | //USERFUNC_DEF(); 33 | //USERFUNC_DEF(); 34 | //USERFUNC_DEF(); 35 | //USERFUNC_DEF(); 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /include/evt/evt_badgeshop.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "evt/evt_cmd.h" 5 | 6 | typedef struct BadgeShopWork { 7 | u8 special_table[0x19]; //0x0, Lovely Howz of Badges 8 | u8 bargain_table[0x19]; //0x19, Lovely Howz of Badges Discount 9 | u8 starmaniac_table[0x19]; //0x32, Dazzle's Badges 10 | u8 bottakuru_table[0x55]; //0x4B, Charlieton's Items 11 | u8 bteresa_table[0x55]; //0xA0, Pianta Parlor 12 | u8 align[3]; 13 | s32 field_0xF8[5]; //0xF8 14 | s32 field_0x10C; //0x10C 15 | u32 field_0x110; //0x110 16 | u16 field_0x114; //0x114 17 | u16 field_0x116; //0x116 18 | u32 field_0x118; //0x118 19 | u32 field_0x11C; //0x11C 20 | u32 field_0x120; //0x120 21 | } BadgeShopWork; 22 | 23 | s32 getBadgeBottakuru100TableMaxCount(void); //Charlieton Pit of 100 Trials 24 | s32 getBadgeStarmaniacTableMaxCount(void); //Dazzle 25 | s32 getBadgeBteresaTableMaxCount(void); //Pianta Parlor 26 | void badgeShop_init(void); 27 | void badgeShop_bottakuruGeneration(void); 28 | void badgeShop_bteresaGeneration(void); 29 | void badgeShop_bargainGeneration(void); 30 | s32 badgeShop_set(u8* table, s16 id, s16 val); 31 | s32 badgeShop_get(u8* table, s16 id); 32 | s32 badgeShop_add(u8* table, s32 id, s32 val); 33 | USERFUNC_DEF(badgeShop_getBargainTable); 34 | USERFUNC_DEF(evt_badgeShop_throw_inc); 35 | USERFUNC_DEF(evt_badgeShop_throw_dec); 36 | USERFUNC_DEF(evt_badgeShop_special_dec); 37 | USERFUNC_DEF(evt_badgeShop_starmaniac_dec); 38 | USERFUNC_DEF(evt_badgeShop_bottakuru_dec); 39 | USERFUNC_DEF(evt_badgeShop_throw_get_kind_cnt); 40 | USERFUNC_DEF(evt_badgeShop_starmaniac_get_kind_cnt); 41 | USERFUNC_DEF(evt_badgeShop_bottakuru_get_kind_cnt); 42 | USERFUNC_DEF(evt_badgeShop_get_special_zaiko); //TODO: unknown name 43 | USERFUNC_DEF(evt_badgeShop_bteresa_get_kind_cnt); 44 | s32 badgeShop_ThrowCheck(s32 itemId); 45 | s32 badgeShop_SpecialCheck(void); 46 | 47 | -------------------------------------------------------------------------------- /include/evt/evt_bero.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "evt/evt_cmd.h" 5 | 6 | typedef union BeroINFO { 7 | const char* name; 8 | s32 value; 9 | } BeroINFO; 10 | 11 | typedef struct BeroEntry { 12 | const char* hitName; //0x0 13 | s16 kinddirArg1; //0x4 14 | s16 kinddirArg2; //0x6 15 | s32 kinddirArg3; //0x8 16 | s32 field_0xC; //0xC 17 | s32 unknown1; //0x10 18 | s32 unknown2; //0x14 19 | s32 field_0x18; //0x18 20 | s32* enterEvent; //0x1C; 21 | s32 field_0x20; //0x20 22 | s32* exitEvent; //0x24 23 | s32 nextareaArg1; //0x28 24 | const char* nextareaArg2; //0x2C 25 | s16 animeArg1; //0x30 26 | s16 animeArg2; //0x32 27 | s32 animeArg3; //0x34 28 | s32 animeArg4; //0x28 29 | } BeroEntry; 30 | 31 | EVT_DEF(evt_bero_info_run); 32 | 33 | USERFUNC_DEF(evt_bero_set_reset_position); 34 | USERFUNC_DEF(evt_bero_set_reset_position_current); 35 | s32 bero_get_BeroEXEC(void); 36 | s32 bero_get_BeroNUM(void); 37 | f32 bero_get_BeroSX(void); 38 | f32 bero_get_BeroSY(void); 39 | f32 bero_get_BeroSZ(void); 40 | f32 bero_get_BeroEX(void); 41 | f32 bero_get_BeroEY(void); 42 | f32 bero_get_BeroEZ(void); 43 | BeroEntry** bero_get_ptr(void); 44 | void bero_clear_Offset(void); 45 | s32 bero_id_filter(s32 id); 46 | USERFUNC_DEF(evt_bero_mapchange); 47 | USERFUNC_DEF(evt_bero_get_entername); 48 | USERFUNC_DEF(evt_bero_exec_onoff); 49 | USERFUNC_DEF(evt_bero_exec_get); 50 | USERFUNC_DEF(evt_bero_exec_wait); 51 | USERFUNC_DEF(evt_bero_get_start_position); 52 | USERFUNC_DEF(evt_bero_get_end_position); 53 | USERFUNC_DEF(evt_bero_get_info_anime); 54 | USERFUNC_DEF(evt_bero_get_info_length); 55 | USERFUNC_DEF(evt_bero_get_info_kinddir); 56 | USERFUNC_DEF(evt_bero_get_info_nextarea); 57 | USERFUNC_DEF(evt_bero_set_now_number); 58 | USERFUNC_DEF(evt_bero_get_now_number); 59 | USERFUNC_DEF(evt_bero_get_info); 60 | USERFUNC_DEF(evt_bero_get_into_info); 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /include/evt/evt_cmd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* This header file is meant for creating evt scripts, until there's a better compiler. 4 | * Includes macros for the scripts themselves, along with user function helpers. 5 | */ 6 | 7 | #include "mgr/evtmgr.h" 8 | #include "mgr/evtmgr_cmd.h" 9 | 10 | //Function Helpers 11 | 12 | //Used to define native C functions that scripts can call 13 | #define USERFUNC_DEF(function) \ 14 | s32 (function)(EventEntry* event, BOOL isFirstCall) 15 | 16 | 17 | 18 | //Script Helpers 19 | #define NUMARGS(...) (sizeof((s32[]){__VA_ARGS__})/sizeof(s32)) 20 | 21 | #define PTR(value) (s32)(value) 22 | #define STRING(value) PTR(value) 23 | 24 | #define EVT_HELPER_CMD(param_count, opcode) \ 25 | (((param_count) << 16) | (opcode)) 26 | 27 | #define EVT_DEF(name) \ 28 | s32 (name)[] 29 | 30 | #define EVT_BEGIN(name) \ 31 | s32 (name)[] = { 32 | 33 | #define EVT_END() \ 34 | OPCODE_END_SCRIPT}; 35 | 36 | //Script Parameters 37 | #define RETURN() \ 38 | EVT_HELPER_CMD(0, OPCODE_END_EVENT), 39 | 40 | 41 | #define WAIT_FRAMES(frames) \ 42 | EVT_HELPER_CMD(1, OPCODE_WAIT_FRAME), frames, 43 | 44 | #define WAIT_MSEC(msec) \ 45 | EVT_HELPER_CMD(1, OPCODE_WAIT_MSEC), msec, 46 | 47 | 48 | 49 | #define IF_LESS(lhs, rhs) \ 50 | EVT_HELPER_CMD(2, OPCODE_IF_LESS), lhs, rhs, 51 | 52 | 53 | #define SET(index, value) \ 54 | EVT_HELPER_CMD(2, OPCODE_SET), index, value, 55 | 56 | 57 | 58 | 59 | #define USER_FUNC(...) \ 60 | EVT_HELPER_CMD(NUMARGS((s32)__VA_ARGS__), OPCODE_USER_FUNC), \ 61 | (s32)__VA_ARGS__, 62 | 63 | //TODO: RUN_SCRIPT_TID, RUN_SCRIPT_ASYNC 64 | #define RUN_SCRIPT(evt) \ 65 | EVT_HELPER_CMD(1, OPCODE_RUN_CHILD_EVENT), (s32)(evt), 66 | -------------------------------------------------------------------------------- /include/evt/evt_door.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "evt/evt_cmd.h" 4 | #include 5 | 6 | USERFUNC_DEF(snd_door_in); 7 | USERFUNC_DEF(snd_door_out); 8 | USERFUNC_DEF(door_entry); 9 | -------------------------------------------------------------------------------- /include/evt/evt_eff.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /include/evt/evt_fade.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "evt/evt_cmd.h" 4 | #include 5 | 6 | USERFUNC_DEF(evt_fade_entry); -------------------------------------------------------------------------------- /include/evt/evt_johoya.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "evt/evt_cmd.h" 4 | #include 5 | 6 | typedef struct { 7 | s16 unk0; //0x0 8 | s16 labelId; //0x2 9 | s32 initEndPos; //0x4 10 | s16 tagEndPos; //0x8 11 | s16 unkA; //0xA 12 | s16 storyId; //0xC 13 | s16 unkE; //0xE 14 | } InformantInfo; 15 | 16 | typedef struct { 17 | u8 unk0[0xD]; //0x0 18 | u8 unkD[0xD]; //0xD 19 | u8 unk1A[0xD]; //0x1A 20 | u8 unk27[0x4]; //0x27 21 | } InformantUnknown; 22 | 23 | typedef struct { 24 | InformantInfo* info; //0x0 25 | s32 count; //0x4 26 | const char* prefix; //0x8 27 | InformantInfo *infoEnd; //0xC 28 | u8 unk10[0x14 - 0x10]; //0x10 29 | InformantUnknown unk14; //0x14 30 | u8 unk3F[0x40 - 0x3F]; //0x3F 31 | } InformantWork; 32 | 33 | USERFUNC_DEF(johoya_data_alloc); 34 | USERFUNC_DEF(johoya_data_free); 35 | void johoya_init(void); 36 | s32 search_evt_no(const char* label); -------------------------------------------------------------------------------- /include/evt/evt_lottery.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct lottery_info { 6 | u16 mFlags; //0x0 7 | u8 field_0x2[0x40 - 0x2]; //0x2 8 | } lottery_info; 9 | 10 | lottery_info* lotteryGetPtr(void); -------------------------------------------------------------------------------- /include/evt/evt_msg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void evt_msg_init(void); -------------------------------------------------------------------------------- /include/evt/evt_npc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/npcdrv.h" 5 | #include "evt/evt_cmd.h" 6 | #include "mgr/evtmgr.h" 7 | 8 | typedef struct NpcSetupInfo { 9 | const char* name; //0x0 10 | s32 flags; //0x4 11 | s32 reactionFlags; //0x8 12 | void* initEvent; //0xC 13 | void* regularEvent; //0x10, TODO: rename? 14 | void* talkEvent; //0x14 15 | void* deadEvent; //0x18 16 | void* findEvent; //0x1C 17 | void* lostEvent; //0x20 18 | void* returnEvent; //0x24 19 | void* blowEvent; //0x28 20 | NpcTerritoryType territoryType; //0x2C 21 | Vec territoryBase; //0x30 22 | Vec territoryLoiter; //0x3C 23 | f32 searchRange; //0x48 24 | f32 searchAngle; //0x4C 25 | f32 homingRange; //0x50 26 | f32 homingAngle; //0x54 27 | s32 battleInfoId; //0x58, TODO: rename? 28 | } NpcSetupInfo; 29 | 30 | USERFUNC_DEF(evt_npc_entry); 31 | USERFUNC_DEF(evt_npc_slave_entry); 32 | USERFUNC_DEF(evt_npc_delete); 33 | USERFUNC_DEF(evt_npc_check_delete); 34 | USERFUNC_DEF(evt_npc_get_ReactionOfLivingBody); 35 | USERFUNC_DEF(evt_npc_setup); 36 | USERFUNC_DEF(evt_npc_set_position); 37 | USERFUNC_DEF(evt_npc_set_width); 38 | USERFUNC_DEF(evt_npc_set_height); 39 | USERFUNC_DEF(evt_npc_get_height); 40 | USERFUNC_DEF(evt_npc_set_scale); 41 | USERFUNC_DEF(evt_npc_get_scale); 42 | USERFUNC_DEF(evt_npc_get_position); 43 | USERFUNC_DEF(evt_npc_get_home_position); 44 | USERFUNC_DEF(evt_npc_set_home_position); 45 | USERFUNC_DEF(evt_npc_get_rotate); 46 | USERFUNC_DEF(evt_npc_set_rotate); 47 | USERFUNC_DEF(evt_npc_add_rotate); 48 | USERFUNC_DEF(evt_npc_set_rotate_offset); 49 | USERFUNC_DEF(evt_npc_move_position); 50 | 51 | 52 | 53 | 54 | NpcEntry* evtNpcNameToPtr(EventEntry* evt, const char* name); 55 | NpcEntry* evtNpcNameToPtr_NoAssert(EventEntry* evt, const char* name); 56 | 57 | 58 | 59 | 60 | 61 | USERFUNC_DEF(evt_npc_flag_onoff); 62 | 63 | 64 | 65 | USERFUNC_DEF(evt_npc_change_fbat_mode); 66 | -------------------------------------------------------------------------------- /include/evt/evt_seq.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/seqdrv.h" 4 | #include "evt/evt_cmd.h" 5 | #include 6 | 7 | USERFUNC_DEF(evt_seq_set_seq); 8 | USERFUNC_DEF(evt_seq_wait); 9 | -------------------------------------------------------------------------------- /include/evt/evt_shop.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "evt/evt_cmd.h" 5 | 6 | typedef struct evt_shop_work { 7 | u32 field_0x0; //0x0 8 | s32 field_0x4; //0x4 9 | s32 field_0x8; //0x8 10 | s32 field_0xC; //0xC 11 | s32 field_0x10; //0x10 12 | u8 field_0x14[0x20 - 0x14]; //0x14 13 | s32 field_0x20; //0x20 14 | u8 field_0x24[0xD8 - 0x24]; //0x24 15 | } evt_shop_work; 16 | 17 | USERFUNC_DEF(evt_shop_setup); -------------------------------------------------------------------------------- /include/evt/evt_snd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "evt/evt_cmd.h" 5 | 6 | USERFUNC_DEF(evt_snd_bgmon); 7 | 8 | 9 | 10 | USERFUNC_DEF(evt_snd_sfxon_3d); 11 | -------------------------------------------------------------------------------- /include/evt/evt_yuugijou.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct PiantaParlorWork { 6 | u32 field_0x0; //0x00 7 | u32 field_0x4; //0x04 8 | s32 tokens; //0x08 9 | u32 field_0xC; //0x0C 10 | u32 field_0x10; //0x10 11 | u32 field_0x14; //0x14 12 | u32 field_0x18; //0x18 13 | u32 field_0x1C; //0x1C 14 | u32 field_0x20; //0x20 15 | u32 field_0x24; //0x24 16 | u32 field_0x28; //0x28 17 | u32 field_0x2C; //0x2C 18 | u32 field_0x30; //0x30 19 | u32 field_0x34; //0x34 20 | u32 field_0x38; //0x38 21 | u32 field_0x3C; //0x3C 22 | u32 field_0x40; //0x40 23 | u32 field_0x44; //0x44 24 | u32 field_0x48; //0x48 25 | u32 field_0x4C; //0x4C 26 | u32 field_0x50; //0x50 27 | u32 field_0x54; //0x54 28 | u32 field_0x58; //0x58 29 | u32 field_0x5C; //0x5C 30 | u32 field_0x60; //0x60 31 | u32 field_0x64; //0x64 32 | u32 field_0x68; //0x68 33 | u32 field_0x6C; //0x6C 34 | u32 field_0x70; //0x70 35 | u32 field_0x74; //0x74 36 | u32 field_0x78; //0x78 37 | u32 field_0x7C; //0x7C 38 | u32 field_0x80; //0x80 39 | u32 field_0x84; //0x84 40 | u32 field_0x88; //0x88 41 | u32 field_0x8C; //0x8C 42 | u32 field_0x90; //0x90 43 | u32 field_0x94; //0x94 44 | u32 field_0x98; //0x98 45 | u32 field_0x9C; //0x9C 46 | u32 field_0xA0; //0xA0 47 | u32 field_0xA4; //0xA4 48 | u32 field_0xA8; //0xA8 49 | u32 field_0xAC; //0xAC 50 | u32 field_0xB0; //0xB0 51 | u32 field_0xB4; //0xB4 52 | u32 field_0xB8; //0xB8 53 | u32 field_0xBC; //0xBC 54 | u32 field_0xC0; //0xC0 55 | u32 field_0xC4; //0xC4 56 | u32 field_0xC8; //0xC8 57 | u32 field_0xCC; //0xCC 58 | u32 field_0xD0; //0xD0 59 | u32 field_0xD4; //0xD4 60 | u32 field_0xD8; //0xD8 61 | u32 field_0xDC; //0xDC 62 | u32 field_0xE0; //0xE0 63 | u32 field_0xE4; //0xE4 64 | u32 field_0xE8; //0xE8 65 | u32 field_0xEC; //0xEC 66 | u32 field_0xF0; //0xF0 67 | u32 field_0xF4; //0xF4 68 | u32 field_0xF8; //0xF8 69 | u32 field_0xFC; //0xFC 70 | u32 field_0x100; //0x100 71 | u32 field_0x104; //0x104 72 | u32 field_0x108; //0x108 73 | u32 field_0x10C; //0x10C 74 | u32 field_0x110; //0x110 75 | u32 field_0x114; //0x114 76 | u32 field_0x118; //0x118 77 | u32 field_0x11C; //0x11C 78 | u32 field_0x120; //0x120 79 | u32 field_0x124; //0x124 80 | u32 field_0x128; //0x128 81 | u32 field_0x12C; //0x12C 82 | u32 field_0x130; //0x130 83 | u32 field_0x134; //0x134 84 | } PiantaParlorWork; 85 | 86 | void yuugijou_init(void); 87 | 88 | -------------------------------------------------------------------------------- /include/gxsub.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | -------------------------------------------------------------------------------- /include/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "mario/mariost.h" -------------------------------------------------------------------------------- /include/mario/mario_cam.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | s32 marioGetCamId(void); -------------------------------------------------------------------------------- /include/mario/mario_party.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "mario/mario_pouch.h" 5 | 6 | void partyJoin(MarioPartner partnerId); 7 | 8 | 9 | s32 marioGetPartyId(void); 10 | s32 marioGetExtraPartyId(void); 11 | -------------------------------------------------------------------------------- /include/mario/mario_sbr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void marioSetBottomlessResetPosition(f32 x, f32 y, f32 z); -------------------------------------------------------------------------------- /include/mario/mariost.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/fadedrv.h" 5 | #include "drv/npcdrv.h" 6 | #include "evt/evt_lottery.h" 7 | #include "countdown.h" 8 | 9 | typedef struct GlobalWork { 10 | s32 flags; //0x0 11 | s32 framerate; //0x4 12 | s32 unk8; //0x8 13 | s32 unkC; //0xC 14 | BOOL dvdError; //0x10 15 | s32 inBattle; //0x14, verified s32 16 | s32 systemLevelFlags; //0x18 17 | u32 retraceCount; //0x1C 18 | OSTime retraceLocalTime; //0x20 19 | OSTime retraceDeltaTime; //0x28 20 | OSTime retraceTime; //0x30 21 | OSTime renderTime; //0x38, time since boot, minus menus 22 | OSTime renderFieldTime; //0x40, time outside battle, minus menus 23 | OSTime systemLv0Time; //0x48 24 | OSTime systemLv1Time; //0x50 25 | OSTime systemLv2Time; //0x58 26 | OSTime systemLv3Time; //0x60 27 | CountdownWork countdown; //0x68 28 | lottery_info mLotteryInfo; //0xA8 29 | u8 field_0xE8[0xF8 - 0xE8]; //0xE8 30 | FadeType mapFadeOutType; //0xF8 31 | s32 mapFadeOutDuration; //0xFC 32 | FadeType mapFadeInType; //0x100 33 | s32 mapFadeInDuration; //0x104 34 | FadeType areaFadeOutType; //0x108 35 | s32 areaFadeOutDuration; //0x10C 36 | FadeType areaFadeInType; //0x110 37 | s32 areaFadeInDuration; //0x114 38 | BOOL didAreaChange; //0x118 39 | char beroEnterName[0x10]; //0x11C 40 | char currentMapName[0x10]; //0x12C 41 | char currentAreaName[0x20]; //0x13C 42 | void* relocationBase; //0x15C 43 | void* mapAlloc; //0x160 44 | u32 field_0x164; //0x164 45 | FieldBattleData* fbatData; //0x168 46 | s32 language; //0x16C 47 | u16 fbWidth; //0x170 48 | u16 efbHeight; //0x172 49 | s32 mGSW0; //0x174 50 | u32 mGSFW[0x100]; //0x178 51 | u8 mGSW[0x800]; //0x578 52 | u32 mLSWF[0x10]; //0xD78 53 | u8 mLSW[0x400]; //0xDB8 54 | s32 unk11B8; //0x11B8 55 | u8 field_0x11BC[0x11D4 - 0x11BC]; //0x11BC 56 | Vec savePlayerPos; //0x11D4 57 | s32 savePartyId[2]; //0x11E0 58 | OSTime saveTime; //0x11E8 59 | s32 saveCount; //0x11F0 60 | u8 field_0x11F4[0x1274 - 0x11F4]; //0x11F4 61 | s32 unk1274; //0x1274 62 | s32 resetType; //0x1278, 0 = no reset, 1 = soft reset, 2 = menu 63 | BOOL unk127C; //0x127C 64 | BOOL softResetWait; //0x1280 65 | u8 field_0x1284[0x1288 - 0x1284]; //0x1284 66 | OSTime softResetTimeout; //0x1288 67 | BOOL field_0x1290; //0x1290 68 | BOOL unk1294; //0x1294 69 | u8 field_0x1298[0x12E8 - 0x1298]; //0x1298 70 | u8 field_0x12E8[4]; //0x12E8 71 | u8 field_0x12EC[4]; //0x12EC 72 | OSTime field_0x12F0[4]; 73 | //u8 field_0x1300[0x1310 - 0x1300]; //0x1300 74 | u8 unk1310[4]; //0x1310 75 | OSTick mDeltaGame; //0x1314 76 | OSTick mDeltaRender; //0x1318 77 | u8 field_0x131C[0x1324 - 0x131C]; //0x131C 78 | // system.c "key" controller data, TODO sub-struct? 79 | BOOL unk1324; //0x1324 80 | u32 button[4]; //0x1328 81 | u32 buttonNew[4]; //0x1338 82 | u32 buttonRepeat[4]; //0x1348 83 | u32 buttonRepeatDelay[4]; //0x1358, 84 | u32 buttonUp[4]; //0x1368 85 | u32 dirs[4]; //0x1378 86 | u32 dirsNew[4]; //0x1388 87 | u32 dirsRepeat[4]; //0x1398 88 | u32 dirsRepeatDelay[4]; //0x13A8 89 | s8 stickX[4]; //0x13B8 90 | s8 stickY[4]; //0x13BC 91 | s8 substickX[4]; //0x13C0 92 | s8 substickY[4]; //0x13C4 93 | u8 triggerLeft[4]; //0x13C8 94 | u8 triggerRight[4]; //0x13CC 95 | u8 rumbleStatus[4]; //0x13D0 96 | u8 prevRumbleStatus[4]; //0x13D4 97 | } GlobalWork; 98 | 99 | void marioStInit(void); 100 | void marioStMain(void); 101 | void marioStDisp(void); 102 | void marioStSystemLevel(s32 level); 103 | s32 marioStGetSystemLevel(void); 104 | -------------------------------------------------------------------------------- /include/memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "mgr/filemgr.h" 5 | 6 | typedef enum HEAP_TYPE { 7 | HEAP_DEFAULT = 0, 8 | HEAP_MALLOC = 1, //for memInit/Clear to do its allocation 9 | HEAP_EXT = 2, //TODO: proper name for EXT 10 | HEAP_EFFECT = 3, 11 | HEAP_BATTLE = 4, 12 | HEAP_UNK5 = 5 13 | } HEAP_TYPE; 14 | 15 | typedef struct smartEntry { 16 | void* address; //0x0 17 | u32 size; //0x4 18 | FileEntry* field_0x8; //0x8 19 | u16 field_0xC; //0xC 20 | u8 type; //0xE, total guess, no way to know 21 | u8 field_0xF; //0xF 22 | u32 field_0x10; //0x10 23 | struct smartEntry* next; //0x14 24 | struct smartEntry* prev; //0x18 25 | } smartEntry; 26 | 27 | typedef struct SmartWork { 28 | void* ptr; //0x0 29 | smartEntry work[0x800]; //0x4-0xE004 30 | u32 bytesLeft; //0xE004 31 | smartEntry* field_0xE008; //0xE008 32 | smartEntry* field_0xE00C; //0xE00C 33 | smartEntry* head; //0xE010 34 | smartEntry* tail; //0xE014 35 | u32 waitsync; //0xE018 36 | } SmartWork; 37 | 38 | void memInit(void); 39 | void memClear(HEAP_TYPE heap); 40 | void* __memAlloc(HEAP_TYPE heap, u32 size); 41 | void __memFree(HEAP_TYPE heap, void* ptr); 42 | void* _mapAlloc(u32 size); 43 | void* _mapAllocTail(u32 size); 44 | void _mapFree(void* alloc); 45 | void smartInit(void); 46 | void smartReInit(void); 47 | void smartAutoFree(u32 a1); 48 | void smartFree(smartEntry* entry); 49 | smartEntry* smartAlloc(u32 size, u8 type); 50 | GXTexObj* smartTexObj(GXTexObj* obj, void** image_ptr); 51 | -------------------------------------------------------------------------------- /include/mgr/arammgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | typedef struct ARAMWork { 7 | u8 field_0x0[0x3C - 0x0]; //0x0 8 | ARQRequest request; //0x3C 9 | u8 field_0x5C[0x68 - 0x5C]; //0x5C 10 | } ARAMWork; 11 | 12 | void aramMgrInit(void); -------------------------------------------------------------------------------- /include/mgr/cardmgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "evt/evt_badgeshop.h" 4 | #include "evt/evt_johoya.h" 5 | #include "evt/evt_yuugijou.h" 6 | #include "mario/mario_pouch.h" 7 | #include "mario/mariost.h" 8 | #include 9 | #include 10 | 11 | typedef struct { 12 | struct { 13 | char fileName[0x20]; //0x0 14 | char dateString[0x20]; //0x20 15 | u8 bannerTex[0x1800]; //0x40 16 | u8 iconTex[0x400]; //0x1840 17 | u8 iconTlut[0x200]; //0x1C40 18 | u16 unk1E40; //0x1E40 19 | u16 unk1E42; //0x1E42 20 | u16 unk1E44; //0x1E44 21 | } data; 22 | u8 __align[0x1FF8 - 0x1E46]; //0x1E46 23 | u32 checksum1; //0x1FF8 24 | u32 checksum2; //0x1FFC 25 | } CardMetadata; 26 | 27 | typedef struct { 28 | struct { 29 | u16 flags; //0x0 30 | u8 unk2[0x8 - 0x2]; //0x2 31 | GlobalWork global; //0x8 32 | PouchData pouch; //0x13E0 33 | NpcDeadInfo deadInfo[64]; //0x19B4 34 | BadgeShopWork badgeShop; //0x1EB4 35 | PiantaParlorWork parlor; //0x1FD8 36 | InformantUnknown informant; //0x2110 37 | u8 unk213B[0x2140 - 0x213B]; //0x213B 38 | } data; 39 | u8 __align[0x3FF0 - 0x2140]; //0x2140 40 | char version[4]; //0x3FF0 41 | s32 size; //0x3FF4 42 | u32 checksum1; //0x3FF8 43 | u32 checksum2; //0x3FFC 44 | } CardSaveSlot; 45 | 46 | typedef struct { 47 | CardMetadata metadata; //0x0 48 | CardSaveSlot saves[4]; //0x2000 (+ 0x4000 * save_index) 49 | } CardData; 50 | 51 | typedef struct { 52 | vu16 flags; //0x0 53 | u8 unk2[0x4 - 0x2]; //0x2 54 | void* workArea; //0x4 55 | s32 chan; //0x8 56 | s32 fileNo; //0xC 57 | u64 serialNo; //0x10 58 | u8 unk18[0x1C - 0x18]; //0x18 59 | CARDFileInfo info; //0x1C 60 | CARDStat status; //0x30 61 | s32 result; //0x9C 62 | s32 currSlot; //0xA0 63 | s32 unkA4; //0xA4 64 | CardData* data; //0xA8 65 | void* unkAC; //0xAC, can be either metadata or save 66 | CardSaveSlot* unkB0; //0xB0 67 | BOOL validSave1; //0xB4, is main save valid? 68 | BOOL validSave2; //0xB8, is backup save valid? 69 | s32 unkBC; //0xBC 70 | s32 unkC0; //0xC0 71 | u8 unkC4[0xC8 - 0xC4]; //0xC4 72 | OSTime lastSaveTime1; //0xC8 73 | OSTime lastSaveTime2; //0xD0 74 | s32 unkD8; //0xD8 75 | u8 unkDC[0xE0 - 0xDC]; //0xDC 76 | s32 unkE0; //0xE0 77 | s32 unkE4; //0xE4 78 | u8 unkE8[0xEC - 0xE8]; //0xE8 79 | s32 unkEC; //0xEC 80 | } CardWork; 81 | 82 | CardData* cardGetFilePtr(void); 83 | void cardBufReset(void); 84 | void cardInit(void); 85 | void cardED0(void); //called by evt_memcard, TODO: rename 86 | void cardEAC(void); //called by evt_memcard, TODO: rename 87 | BOOL cardE80(void); //called by evt_memcard, TODO: rename 88 | BOOL cardIsExec(void); 89 | s32 cardGetCode(void); 90 | void cardMain(void); 91 | void cardCopy2Main(s32 slot); 92 | void cardErase(s32 slot); 93 | void cardCopy(s32 from, s32 to); 94 | void cardWrite(s32 slot); 95 | void cardWriteHeader(void); 96 | void cardReadAll(void); 97 | void cardCreate(void); 98 | void cardFormat(void); 99 | -------------------------------------------------------------------------------- /include/mgr/dvdmgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define DVDEntryCount 0x100 6 | 7 | typedef BOOL (*DVDMgrCallback)(void); 8 | 9 | typedef enum DVDFlags { 10 | DVDMGR_READING = (1 << 0), 11 | DVDMGR_FINISHED = (1 << 1), 12 | DVDMGR_CLOSED = (1 << 3), 13 | DVDMGR_UNK_ERROR1 = (1 << 5), 14 | DVDMGR_UNK_ERROR2 = (1 << 7), 15 | DVDMGR_INUSE = (1 << 15) 16 | } DVDFlags; 17 | 18 | typedef struct DVDEntry { 19 | char name[64]; //0x0 20 | DVDFileInfo info; //0x40 21 | void* address; //0x7C 22 | s32 bytesLeft; //0x80 23 | s32 offset; //0x84 24 | s32 position; //0x88 25 | DVDCallback callback; //0x8C, reuse SDK type 26 | u16 status; //0x90 27 | u16 priority; //0x92 28 | u16 unknown; //0x94 29 | u8 pad_96[2]; //0x96 30 | } DVDEntry; 31 | 32 | void DVDMgrInit(void); 33 | void DVDMgrDelete(void); 34 | void DVDMgrMain(void); 35 | DVDEntry* DVDMgrOpen(const char* path, u8 priority, u16 unknown); 36 | s32 DVDMgrRead(DVDEntry* entry, void* address, u32 size, s32 offset); 37 | void DVDMgrReadAsync(DVDEntry* entry, void* address, u32 size, s32 offset, DVDCallback callback); 38 | void DVDMgrClose(DVDEntry* entry); 39 | u32 DVDMgrGetLength(DVDEntry* entry); 40 | void DVDMgrSetupCallback(DVDMgrCallback callback); 41 | -------------------------------------------------------------------------------- /include/mgr/filemgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mgr/dvdmgr.h" 4 | #include 5 | 6 | typedef void (*FileCallback)(struct FileEntry* file); 7 | 8 | typedef struct FileEntry { 9 | u8 state; //0x0 10 | s8 field_0x1; //0x1, TODO enum archivetype/type 11 | u16 references; //0x2 12 | void* field_0x4; //0x4 13 | u8 field_0x8[0x20 - 0x8]; //0x8 14 | char filename[64]; //0x20 15 | u8 field_0x60[0xA0 - 0x60]; //0x60 16 | void** data; //0xA0 17 | struct FileEntry* next; //0xA4 18 | FileCallback callback; //0xA8 19 | DVDEntry* entry; //0xAC 20 | } FileEntry; 21 | 22 | typedef struct FileManagerWork { 23 | FileEntry* entries; //0x0 24 | s32 archiveType; //0x4 25 | FileEntry* firstused; //0x8 26 | FileEntry* lastused; //0xC 27 | FileEntry* firstavailable; //0x10 28 | FileEntry* lastavailable; //0x14 29 | } FileManagerWork; 30 | 31 | void fileInit(void); 32 | void fileGarbageMoveMem(void* data, FileEntry* file); 33 | void _fileGarbage(BOOL a1); 34 | FileEntry* fileAllocf(u8 type, const char* format, ...); 35 | FileEntry* fileAlloc(const char* filename, u8 type); 36 | void fileFree(FileEntry* handle); 37 | s32 fileAsyncf(u8 type, void (*callback)(FileEntry*), const char* format, ...); 38 | void fileSetCurrentArchiveType(s32 type); -------------------------------------------------------------------------------- /include/mgr/fontmgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef enum BinaryFontEncoding { 6 | SINGLE_BYTE_ENCODING = 0, 7 | DOUBLE_BYTE_ENCODING = 1, 8 | MULTI_BYTE_ENCODING = 2 9 | } BinaryFontEncoding; 10 | 11 | typedef enum BinaryFontMapping { 12 | LINEAR_CHARACTER_MAP = 0, 13 | SJIS_CHARACTER_MAP = 1, 14 | TABLE_CHARACTER_MAP = 2, 15 | MAP_CHARACTER_MAP = 3 16 | } BinaryFontMapping; 17 | 18 | typedef struct BinaryFontBlock { 19 | u32 magic; //0x0, FourCC 20 | u32 size; //0x4, full size of this block 21 | } BinaryFontBlock; 22 | 23 | //BFN = Binary FoNt 24 | typedef struct BinaryFontHeader { 25 | u32 magic; //0x0, "FONT" 26 | u32 version; //0x4, "bfn1" 27 | u32 size; //0x8, full size of the file 28 | u32 blockcount; //0xC, doesn't include header 29 | u8 align[16]; //0x10-0x1F 30 | } BinaryFontHeader; 31 | 32 | //INF1 section 33 | typedef struct BinaryFontInfo { 34 | u32 magic; //0x0, "INF1" 35 | u32 size; //0x4, full size of this block 36 | u16 encoding; //0x8, see BinaryFontEncoding 37 | u16 ascent; //0xA, how far above baseline 38 | u16 descent; //0xC, how far below baseline 39 | u16 width; //0xE, character width 40 | u16 leading; //0x10, "line height" 41 | u16 replace; //0x12, replacement code for unmapped characters 42 | u8 align[12]; //0x14-0x1F 43 | } BinaryFontInfo; 44 | 45 | //GLY1 section 46 | typedef struct BinaryFontGlyph { 47 | u32 magic; //0x0, "GLY1" 48 | u32 size; //0x4, full size of this block 49 | u16 firstcode; //0x8, first code in this glyph block (inclusive) 50 | u16 lastcode; //0xA, last code in this glyph block (inclusive) 51 | u16 cellwidth; //0xC 52 | u16 cellheight; //0xE 53 | u32 sheetsize; //0x10, includes padding 54 | u16 format; //0x14, GXTexFmt 55 | u16 sheetrows; //0x16 56 | u16 sheetcolumns; //0x18 57 | u16 sheetwidth; //0x1A 58 | u16 sheetheight; //0x1C 59 | u8 align[2]; //0x1E-0x1F 60 | } BinaryFontGlyph; 61 | 62 | typedef struct BinaryFontMap { 63 | u32 magic; //0x0, "MAP1" 64 | u32 size; //0x4, full size of this block 65 | u16 mapping; //0x8, see BinaryFontMapping 66 | u16 firstchar; //0xA, first character in this block (inclusive) 67 | u16 lastchar; //0xC, last character in this block (inclusive) 68 | u16 count; //0xE, number of mapping entries 69 | u16 table[]; //0x10, unknown size 70 | } BinaryFontMap; 71 | 72 | typedef struct BinaryFontWidth { 73 | u32 magic; //0x0, "WID1" 74 | u32 size; //0x4, full size of this block 75 | u16 firstcode; //0x8, first code for this block (inclusive) 76 | u16 lastcode; //0xA, last code for this block (inclusive) 77 | } BinaryFontWidth; 78 | 79 | void fontmgrInit(void); 80 | void fontmgrTexSetup(void); 81 | void FontDrawStart(void); 82 | void FontDrawStart_alpha(u8 alpha); 83 | 84 | 85 | 86 | 87 | u16 kanjiSearch(u16 code); 88 | u16 kanjiGetWidth(u16 code); -------------------------------------------------------------------------------- /include/mgr/winmgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/dispdrv.h" 4 | #include 5 | 6 | typedef struct WinMgrDesc WinMgrDesc; 7 | typedef struct WinMgrEntry WinMgrEntry; 8 | 9 | struct WinMgrDesc { 10 | u8 field_0x0[0x8 - 0x0]; //0x0 11 | s32 cameraId; //0x8, CameraId 12 | s32 field_0xC; //0xC, entry->field_0x18 13 | s32 field_0x10; //0x10, entry->field_0x1C 14 | s32 field_0x14; //0x14, entry->field_0x20 15 | s32 field_0x18; //0x18, entry->field_0x24 16 | u8 field_0x1C[0x20 - 0x1C]; //0x1C 17 | void (*main)(WinMgrEntry* entry); //0x20 18 | void* disp; //0x24 19 | }; 20 | 21 | struct WinMgrEntry { 22 | s32 flags; //0x0 23 | s32 field_0x4; //0x4 24 | s32 field_0x8; //0x8 25 | u8 field_0xC[0x10 - 0xC]; //0xC 26 | f32 scale; //0x10 27 | f32 rotation; //0x14 28 | s32 field_0x18; //0x18, desc->field_0xC 29 | s32 field_0x1C; //0x1C, desc->field_0x10 30 | s32 field_0x20; //0x20, desc->field_0x14 31 | s32 field_0x24; //0x24, desc->field_0x18 32 | WinMgrDesc* description; //0x28 33 | void* param; //0x2C 34 | s32 priority; //0x30, gets cast to float for dispEntry 35 | s32 field_0x34; //0x34 36 | s32 field_0x38; //0x38 37 | s32 field_0x3C; //0x3C 38 | u8 field_0x40[0x44 - 0x40]; //0x40 39 | }; 40 | 41 | typedef struct WinMgrWork { 42 | u32 mNumEntries; //0x0 43 | WinMgrEntry* mEntries; 44 | } WinMgrWork; 45 | 46 | typedef struct WinMgrSelect { 47 | s16 flags; //0x0 48 | s16 pad_2; //0x2, TODO: not pad? 49 | s32 field_0x4; //0x4 50 | u8 field_0x8[0xC - 0x8]; //0x8 51 | s32 field_0xC; //0xC 52 | s32 field_0x10; //0x10 53 | f32 field_0x14; //0x14, TODO: Vec? 54 | f32 field_0x18; //0x18 55 | f32 field_0x1C; //0x1C 56 | s32 numDescriptors; //0x20 57 | s32 descriptorId[3]; //0x24 58 | s32 field_0x30; //0x30 59 | s32 field_0x34; //0x34 60 | s32 field_0x38; //0x38 61 | } WinMgrSelect; 62 | 63 | void winMgrInit(void); 64 | void winMgrReInit(void); 65 | void winMgrMain(void); 66 | s32 winMgrEntry(WinMgrDesc* desc); 67 | void winMgrSetParam(s32 id, void* param); 68 | void winMgrOpen(s32 id); 69 | void winMgrClose(s32 id); 70 | void winMgrCloseAutoDelete(s32 id); 71 | void winMgrDelete(s32 id); 72 | BOOL winMgrAction(s32 id); 73 | void winMgrSetSize(s32 id, s32 a2, s32 a3, s32 a4, s32 a5); //TODO: x0, y0, x1, y1? 74 | void winMgrSetPriority(s32 id, s32 priority); 75 | WinMgrEntry* winMgrGetPtr(s32 id); 76 | void winMgrHelpInit(WinMgrEntry* entry); 77 | void winMgrHelpMain(WinMgrEntry* entry); 78 | void winMgrHelpDraw(WinMgrEntry* entry); 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /include/mot/mot_plane.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct MotionPlaneData { 6 | s32 flags; //0x0 7 | u8 field_0x4[0x28 - 0x4]; //0x4 8 | s32 field_0x28; //0x28, some sfxId 9 | u8 field_0x2C[0x48 - 0x2C]; //0x2C 10 | } MotionPlaneData; 11 | 12 | void flyMain(void); -------------------------------------------------------------------------------- /include/nameent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mgr/filemgr.h" 4 | #include 5 | 6 | typedef struct NameEntryWork { 7 | u16 field_0x0; //0x0 8 | u8 field_0x2[2]; //0x2, padding? 9 | s32 field_0x4; //0x4 10 | s32 field_0x8; //0x8 11 | s32 field_0xC; //0xC 12 | s32 field_0x10; //0x10 13 | s32 field_0x14; //0x14 14 | s32 field_0x18; //0x18 15 | f32 x1; //0x1C 16 | f32 y1; //0x20 17 | f32 x2; //0x24 18 | f32 y2; //0x28 19 | f32 field_0x2C; //0x2C 20 | f32 field_0x30; //0x30 21 | f32 field_0x34; //0x34 22 | f32 field_0x38; //0x38 23 | char field_0x3C[16]; //0x3C, TODO: determine full size 24 | u8 field_0x4C[0x50 - 0x4C]; //0x4C 25 | const char** field_0x50; //0x50, currentTable? 26 | f32 field_0x54; //0x54 27 | u8 field_0x58[0x5C - 0x58]; //0x58 28 | s32 field_0x5C; //0x5C 29 | FileEntry* field_0x60; //0x60, tpl assets 30 | } NameEntryWork; 31 | 32 | void nameEntInit(void); 33 | void nameEntReInit(void); 34 | void nameEntMain(void); -------------------------------------------------------------------------------- /include/parse.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct ParseWork { 6 | void* ptr; //0x0, TODO: rename 7 | s32 field_0x4; //0x4 8 | u8 field_0x8[0x2C - 0x8]; //0x8 9 | u32 size; //0x2C, TODO: rename 10 | u8 field_0x30[0x54 - 0x30]; //0x30 11 | s32 field_0x54; //0x54 12 | } ParseWork; 13 | -------------------------------------------------------------------------------- /include/party.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mario/mario.h" 4 | #include 5 | 6 | #pragma enumsalwaysint off 7 | typedef enum PartyMembers { 8 | kPartyNone, //0x0 9 | kPartyGoombella, //0x1 10 | kPartyKoops, //0x2 11 | kPartyBobbery, //0x3 12 | kPartyYoshi, //0x4 13 | kPartyFlurrie, //0x5 14 | kPartyVivian, //0x6 15 | kPartyMsMowz, //0x7 16 | kPartyEgg, //0x8 17 | kPartyFlavio, //0x9 18 | kPartyPunio, //0xA 19 | kPartyFrankly, //0xB 20 | kPartyGus, //0xC 21 | kPartyGoombellaFollower, //0xD 22 | kPartyKoopsFollower, //0xE 23 | kPartyBobberyFollower, //0xF 24 | kPartyYoshiFollower, //0x10 25 | kPartyFlurrieFollower, //0x11 26 | kPartyVivianFollower, //0x12 27 | kPartyMsMowzFollower //0x13 28 | } PartyMembers; 29 | #pragma enumsalwaysint on 30 | 31 | typedef struct PartyEntry { 32 | u32 flags; //0x0 33 | u32 flags2; //0x4 34 | u32 field_0x8; //0x8 35 | s32 field_0xC; //0xC, poseGroup? poseId2? 36 | s32 field_0x10; //0x10 37 | s32 field_0x14; //0x14, TODO paperPoseId? 38 | u8 field_0x18[0x2F - 0x18]; //0x18 39 | s8 currentSlotId; //0x2F 40 | u8 field_0x30; //0x30 41 | s8 currentMemberId; //0x31, PartyMembers 42 | u8 field_0x32[0x160 - 0x32]; //0x32 43 | MarioWork* playerPtr; //0x160 44 | s32 camId; //0x164 45 | u8 field_0x168[0x188 - 0x168]; //0x168 46 | } PartyEntry; 47 | 48 | PartyEntry* partyGetPtr(s32 id); 49 | PartyEntry* anotherPartyGetPtr(s32 id); 50 | BOOL partyPaperOn(PartyEntry* entry, char* anim); 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | s32 partyEntry2(s32 memberId); -------------------------------------------------------------------------------- /include/party/party_vivian.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | s32 vivianGetStatus(void); -------------------------------------------------------------------------------- /include/pmario_sound.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | /* 6 | typedef union SoundData { 7 | const char* name; 8 | s32 value; 9 | } SoundData;*/ 10 | 11 | #pragma warn_padding off 12 | typedef struct SoundEnvList { 13 | u16 field_0x0; //0x0 14 | u16 field_0x2; //0x2 15 | u8 field_0x4; //0x4 16 | u8 field_0x5; //0x5 17 | u8 field_0x6; //0x6 18 | u8 field_0x7; //0x7 19 | u8 field_0x8; //0x8 20 | //pad 3 bytes 21 | u32 field_0xC; //0xC 22 | u32 field_0x10; //0x10 23 | u32 field_0x14; //0x14 24 | u8 field_0x18; //0x18 25 | u8 field_0x19; //0x19 26 | u8 field_0x1A; //0x1A 27 | //pad 1 byte 28 | } SoundEnvList; 29 | #pragma warn_padding on 30 | 31 | typedef enum SoundEffectFlags { 32 | SFX_FLAG_2 = (1 << 29), 33 | SFX_FLAG_4 = (1 << 30), 34 | SFX_FLAG_8 = (1 << 31) 35 | } SoundEffectFlags; 36 | 37 | //most are translated in __psndSFXOn, TODO 38 | typedef struct SoundEffectList { 39 | const char* name; //0x0, sfx name 40 | u32 field_0x4; //0x4, lower 2 bytes are SND_FXID 41 | const char* field_0x8; //0x8, .stm name 42 | u8 field_0xC; //0xC 43 | u8 field_0xD; //0xD 44 | u8 field_0xE; //0xE 45 | u8 field_0xF; //0xF, reverb 46 | u8 field_0x10; //0x10 47 | u8 field_0x11; //0x11 48 | u16 field_0x12; //0x12 49 | } SoundEffectList; 50 | 51 | typedef struct PaperSoundBGM { 52 | s32 unk0; //0x0 53 | s32 streamId; //0x4, TODO verify re: seq_title 54 | u8 unk8[0x20 - 0x8]; //0x8 55 | s8 unk20; //0x20 56 | u8 unk21[0x38 - 0x21]; //0x21 57 | } PaperSoundBGM; 58 | 59 | typedef struct PaperSoundEffect { 60 | s32 unk0; //0x0 61 | u8 unk4[0x6 - 0x4]; //0x4 62 | s16 unk6; //0x6 63 | u8 unk8[0x18 - 0x8]; //0x8 64 | s32 unk18; //0x0 65 | u8 unk1C[0x28 - 0x1C]; //0x1C 66 | } PaperSoundEffect; 67 | 68 | typedef struct PaperSoundEnv { 69 | u8 unk0[0x4 - 0x0]; //0x0 70 | s16 unk4; //0x4 71 | u8 unk6[0x24 - 0x6]; //0x6 72 | } PaperSoundEnv; 73 | 74 | typedef struct PaperSoundWork { 75 | s8 unk0; //0x0 76 | u8 unk1[0xC - 0x1]; //0x1 77 | s8 unkC; //0xC 78 | u8 unkD[0x18 - 0xD]; //0xD 79 | s16 unk18; //0x18 80 | s16 unk1A; //0x1A 81 | u8 unk1C[0x30 - 0x1C]; //0x1C 82 | Vec position; //0x30 83 | f32 direction; //0x3C 84 | char unk40[0x10]; //0x40 85 | s16 unk50; //0x50 86 | u8 unk52[0x54 - 0x52]; //0x52 87 | s16 unk54; //0x54 88 | u16 unk56; //0x56, verified u16 89 | s8 unk58; //0x58 90 | s8 unk59; //0x59 91 | s8 unk5A; //0x5A 92 | u8 unk5B[0x5C - 0x5B]; //0x5B 93 | s8 unk5C; //0x5C 94 | u8 unk5D[0x60 - 0x5D]; //0x5D 95 | } PaperSoundWork; 96 | 97 | s32 searchPSSFXList(const char* name); 98 | void psndInit(void); 99 | void psndMain(void); 100 | void psndMainInt(void); 101 | void psndExit(void); 102 | 103 | 104 | 105 | 106 | BOOL psndPushGroup(void); 107 | 108 | 109 | BOOL psndBGMOn(u32 r3, char* bgm_name); 110 | void psndStopAllFadeOut(void); 111 | BOOL psndENVOff(u32 r3); 112 | void psndSFXAllOff(void); 113 | 114 | 115 | void psndSFXOn(const char* name); 116 | 117 | 118 | BOOL psndBGMOff_f_d(s32 flags, u16 fadetime, BOOL someswitch); 119 | BOOL psndBGMStartCheck(s32 id); 120 | 121 | void psndSetFlag(s32 flag); 122 | void psndClearFlag(s32 flag); 123 | 124 | void psndSetPosDirListener(Vec* position, f32 direction); -------------------------------------------------------------------------------- /include/romfont.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct romFontWork { 6 | void* field_0x0; //0x0 7 | u32 field_0x4; //0x4 8 | u32 mLanguage; //0x8, TODO different name? 0 = SJIS, 1 = ASCII 9 | } romFontWork; 10 | 11 | const char* romFontGetMessage(s32 msg); 12 | void romFontInit(void); 13 | 14 | 15 | void romFontPrintGX(f32 x, f32 y, f32 scale, GXColor color, const char* msg); 16 | s32 romFontGetWidth(const char* message); 17 | 18 | -------------------------------------------------------------------------------- /include/sdk/DEMOInit.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void DEMOInit(GXRenderModeObj* mode); 6 | void DEMOReInit(GXRenderModeObj* mode); 7 | void DEMOBeforeRender(void); 8 | void DEMODoneRender(void); 9 | void DEMOSwapBuffers(void); 10 | GXRenderModeObj* DEMOGetRenderModeObj(void); 11 | void* DEMOGetCurrentBuffer(void); 12 | void DEMOEnableGPHangWorkaround(u32 timeoutFrames); 13 | void DEMOSetGPHangMetric(GXBool enable); -------------------------------------------------------------------------------- /include/sdk/arc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct ARCHeader { 6 | u32 magic; 7 | s32 fstStart; 8 | u32 fstSize; 9 | s32 fileStart; 10 | s32 reserved[4]; 11 | } ARCHeader; 12 | 13 | typedef struct ARCHandle { 14 | void* archiveStartAddr; 15 | void* FSTStart; 16 | void* fileStart; 17 | u32 entryNum; 18 | char* FSTStringStart; 19 | u32 FSTLength; 20 | u32 currDir; 21 | } ARCHandle; 22 | 23 | typedef struct ARCFileInfo { 24 | ARCHandle* handle; 25 | u32 startOffset; 26 | u32 length; 27 | } ARCFileInfo; 28 | 29 | s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path); 30 | BOOL ARCOpen(ARCHandle* handle, const char* filename, ARCFileInfo* info); 31 | BOOL ARCInitHandle(void* arcStart, ARCHandle* handle); 32 | 33 | 34 | 35 | void* ARCGetStartAddrInMem(ARCFileInfo* info); 36 | u32 ARCGetLength(ARCFileInfo* info); 37 | void ARCClose(void); 38 | 39 | -------------------------------------------------------------------------------- /include/seq/seq_e3.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/seqdrv.h" 5 | #include "mgr/filemgr.h" 6 | 7 | typedef struct seq_e3_work { 8 | FileEntry* handle; //0x00 9 | u32 field_0x4; //0x04 10 | u32 field_0x8; //0x08 11 | u32 field_0xC; //0x0C 12 | u32 field_0x10; //0x10 13 | u32 field_0x14; //0x14 14 | u32 field_0x18; //0x18 15 | u32 field_0x1C; //0x1C 16 | OSAlarm alarm; //0x20 17 | OSTime field_0x48; //0x48 18 | u32 field_0x50; //0x50 19 | u32 field_0x54; //0x54 20 | u32 field_0x58; //0x58 21 | u32 field_0x5C; //0x5C 22 | u32 field_0x60; //0x60 23 | f32 field_0x64; //0x64 24 | } seq_e3_work; 25 | 26 | void seq_e3Init(SequenceWork* work); 27 | void seq_e3Main(SequenceWork* work); 28 | void seq_e3Exit(SequenceWork* work); -------------------------------------------------------------------------------- /include/seq/seq_game.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "drv/seqdrv.h" 5 | 6 | void seq_gameInit(SequenceWork* work); 7 | void seq_gameMain(SequenceWork* work); -------------------------------------------------------------------------------- /include/seq/seq_logo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/seqdrv.h" 4 | #include "mgr/filemgr.h" 5 | #include 6 | 7 | typedef struct LogoWork { 8 | BOOL progressive; //0x0 9 | s32 field_0x4; //0x4 10 | s32 toggle; //0x8, 0 = yes, 1 = no 11 | FileEntry* texture; //0xC 12 | s32 field_0x10; //0x10 13 | u8 field_0x14[0x18 - 0x14]; //0x14 14 | OSTime field_0x18; //0x18 15 | BOOL skipStory; //0x20 16 | u8 field_0x24[0x28 - 0x24]; //0x24 17 | } LogoWork; 18 | 19 | void seq_logoInit(SequenceWork* work); 20 | void seq_logoMain(SequenceWork* work); 21 | void seq_logoExit(SequenceWork* work); 22 | -------------------------------------------------------------------------------- /include/seq/seq_mapchange.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/seqdrv.h" 4 | 5 | //for seqdrv 6 | void seq_mapChangeInit(SequenceWork* work); 7 | void seq_mapChangeMain(SequenceWork* work); 8 | void seq_mapChangeExit(SequenceWork* work); -------------------------------------------------------------------------------- /include/seq/seq_title.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "drv/seqdrv.h" 4 | #include "mgr/filemgr.h" 5 | #include 6 | 7 | typedef struct TitleWork { 8 | FileEntry* texture; //0x0 9 | u8 field_0x4[0x8 - 0x4]; //0x4 10 | s32 field_0x8; //0x8 11 | f32 field_0xC; //0xC 12 | f32 field_0x10; //0x10 13 | f32 field_0x14; //0x14 14 | f32 field_0x18; //0x18 15 | f32 field_0x1C; //0x1C 16 | u8 field_0x20[0x30 - 0x20]; //0x20 17 | s32 debug; //0x30 18 | } TitleWork; 19 | 20 | const char* DbgBtlSel_GetMsgDataPtr(void); 21 | s32 getDebugMode(void); 22 | void seq_titleInit(SequenceWork* work); 23 | void seq_titleMain(SequenceWork* work); 24 | void seq_titleExit(SequenceWork* work); 25 | -------------------------------------------------------------------------------- /include/statuswindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct StatusWindowWork { 6 | u8 field_0x0[0x4 - 0x0]; //0x0 7 | s16 field_0x4; //0x4 8 | u8 align_0x6[2]; //0x6 9 | f32 field_0x8; //0x8 10 | f32 field_0xC; //0xC 11 | f32 field_0x10; //0x10 12 | u8 field_0x14[0x18 - 0x14]; //0x14 13 | f32 field_0x18; //0x18 14 | f32 field_0x1C; //0x1C 15 | f32 field_0x20; //0x20, iconxbase? 16 | f32 field_0x24; //0x24, iconybase? 17 | u8 field_0x28[0x30 - 0x28]; //0x28 18 | f32 field_0x30; //0x30 19 | f32 field_0x34; //0x34 20 | u8 field_0x38[0x40 - 0x38]; //0x38 21 | f32 field_0x40; //0x40 22 | f32 field_0x44; //0x44 23 | u8 field_0x48[0x62 - 0x48]; //0x48 24 | s16 field_0x62; //0x62 25 | u8 field_0x64[0x68 - 0x64]; //0x64 26 | Vec field_0x68; //0x68 27 | s32 field_0x74; //0x74 28 | s32 field_0x78; //0x78 29 | s32 field_0x7C; //0x7C 30 | s32 field_0x80; //0x80 31 | u8 field_0x84[0x88 - 0x84]; //0x84 32 | s32 field_0x88; //0x88 33 | } StatusWindowWork; 34 | 35 | void statusWinInit(void); 36 | void statusWinReInit(void); 37 | void statusWinMain(void); -------------------------------------------------------------------------------- /include/system.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | const char* getMarioStDvdRoot(void); 6 | f32 reviseAngle(f32 angle); 7 | f32 distABf(f32 x1, f32 y1, f32 x2, f32 y2); 8 | f32 compAngle(f32 angle1, f32 angle2); 9 | f32 angleABf(f32 x1, f32 y1, f32 x2, f32 y2); 10 | f32 intplGetValue(s32 mode, s32 currStep, s32 steps, f32 start, f32 end); 11 | void qqsort(void* array, s32 num_elements, s32 element_size, s32(*compare)(const void**, const void**)); 12 | void makeKey(void); 13 | u32 keyGetButton(u32 chan); 14 | u32 keyGetButtonTrg(u32 chan); 15 | u32 keyGetButtonRep(u32 chan); 16 | u32 keyGetDir(u32 chan); 17 | u32 keyGetDirTrg(u32 chan); 18 | u32 keyGetDirRep(u32 chan); 19 | s8 keyGetStickX(u32 chan); 20 | s8 keyGetStickY(u32 chan); 21 | s8 keyGetSubStickX(u32 chan); 22 | s8 keyGetSubStickY(u32 chan); 23 | void padRumbleOff(u32 chan); 24 | void padRumbleOn(u32 chan); 25 | void padRumbleHardOff(u32 chan); 26 | u8 padGetRumbleStatus(u32 chan); 27 | void sincosf(f32* ret_sin, f32* ret_cos, f32 degree); 28 | void movePos(float* ret_sin, float* ret_cos, f32 a3, f32 degree); 29 | s32 irand(s32 scalar); 30 | u16 sysGetToken(void); 31 | void sysWaitDrawSync(void); 32 | void sysDummyDraw(Mtx mtx); 33 | f32 getV60FPS(f32 a1, s64 a2, s64 a3); 34 | f32 sysFrame2SecFloat(f32 frame); 35 | s32 sysMsec2Frame(s32 msec); 36 | f32 sysMsec2FrameFloat(f32 msec); 37 | void mtxGetRotationElement(Mtx arg0, Mtx arg1, char arg2, char arg3); 38 | s32 LZ77Decode(u8* input, u8* output); 39 | void* memcpy_as4(void* dest, const void* src, u32 count); 40 | 41 | inline Vec initializeVec(Vec* input); 42 | -------------------------------------------------------------------------------- /include/texPalette.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct TPLPaletteHeader { 6 | u16 entryCount; 7 | u8 unpacked; 8 | u8 align; 9 | GXTlutFmt format; 10 | union { 11 | u32 dataOffset; 12 | void* data; 13 | }; 14 | } TPLPaletteHeader; 15 | 16 | typedef struct TPLImageHeader { 17 | u16 height; 18 | u16 width; 19 | GXTexFmt format; 20 | union { 21 | u32 dataOffset; 22 | void* data; 23 | }; 24 | GXTexWrapMode wrapS; 25 | GXTexWrapMode wrapT; 26 | GXTexFilter minFilter; 27 | GXTexFilter magFilter; 28 | float LODBias; 29 | u8 edgeLODEnable; 30 | u8 minLOD; 31 | u8 maxLOD; 32 | u8 unpacked; 33 | } TPLImageHeader; 34 | 35 | typedef struct TPLImageEntry { 36 | union { 37 | u32 imageOffset; 38 | TPLImageHeader* image; 39 | }; 40 | union { 41 | u32 paletteOffset; 42 | TPLPaletteHeader* palette; 43 | }; 44 | } TPLImageEntry; 45 | 46 | typedef struct TPLHeader { 47 | u32 version; // 0x0020AF30 48 | u32 imageCount; 49 | union { 50 | u32 imageTableOffset; 51 | TPLImageEntry* imageTable; 52 | }; 53 | } TPLHeader; 54 | 55 | void TEXGetGXTexObjFromPalette(TPLHeader* header, GXTexObj* obj, u32 id); 56 | TPLImageEntry* TEXGet(TPLHeader* header, u32 id); 57 | void UnpackTexPalette(TPLHeader* header); -------------------------------------------------------------------------------- /include/win/win_main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "evt/evt_cmd.h" 5 | 6 | typedef struct WindowWork { 7 | s16 flags; //0x0 8 | u8 align_2[2]; //0x2 9 | u32 buttonTrg; //0x4 10 | u32 buttonRep; //0x8 11 | u32 dirTrg; //0xC 12 | u32 dirRep; //0x10 13 | u8 field_0x14[0x20 - 0x14]; //0x14 14 | s32 menuState; //0x20, TODO: rename? 15 | u8 field_0x24[0x1210 - 0x24]; //0x24 16 | } WindowWork; 17 | 18 | typedef struct WindowPartyDt { 19 | s32 field_0x0; //0x0 20 | s32 field_0x4; //0x4 21 | const char* field_0x8; //0x8 22 | const char* field_0xC; //0xC 23 | const char* field_0x10; //0x10 24 | const char* field_0x14; //0x14 25 | const char* field_0x18; //0x18 26 | const char* field_0x1C; //0x1C 27 | const char* field_0x20; //0x20 28 | } WindowPartyDt; //TODO: rename 29 | 30 | WindowWork* winGetPtr(void); 31 | void winInit(void); 32 | void winReInit(void); 33 | BOOL winCheck(void); 34 | void winOpenEnable(void); 35 | void winOpenDisable(void); 36 | USERFUNC_DEF(itemUseFunc); 37 | 38 | 39 | 40 | void winMain(void); 41 | 42 | 43 | void winTexInit(TPLHeader* texture); 44 | void winTexSet(u32 textureId, Vec translate, Vec scale, GXColor color); 45 | -------------------------------------------------------------------------------- /module/aaa/include/aaa_00.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "evt/evt_cmd.h" 4 | #include 5 | 6 | USERFUNC_DEF(mapdraw); 7 | void mapdelete(void); -------------------------------------------------------------------------------- /module/aaa/source/aaa.c: -------------------------------------------------------------------------------- 1 | #include "aaa_00.h" 2 | #include "data/mapdata.h" 3 | 4 | #ifdef __MWERKS__ 5 | #define RELMODULE_EXPORT __declspec(export) 6 | typedef void (*voidfunctionptr) (void); 7 | __declspec(section ".init") extern voidfunctionptr _ctors[]; 8 | __declspec(section ".init") extern voidfunctionptr _dtors[]; 9 | #else 10 | #define RELMODULE_EXPORT 11 | typedef void (*voidfunctionptr) (void); 12 | extern voidfunctionptr _ctors[]; 13 | extern voidfunctionptr _dtors[]; 14 | #endif 15 | 16 | extern s32 aaa_00_init_evt[]; 17 | 18 | //local prototypes 19 | void _prolog(void); 20 | void _epilog(void); 21 | void _unresolved(void); 22 | 23 | RELMODULE_EXPORT void _prolog(void) { 24 | voidfunctionptr* constructor; 25 | 26 | for (constructor = _ctors; *constructor; constructor++) { 27 | (*constructor)(); 28 | } 29 | relSetEvtAddr("aaa_00", aaa_00_init_evt); 30 | } 31 | 32 | RELMODULE_EXPORT void _epilog(void) { 33 | voidfunctionptr* destructor; 34 | 35 | mapdelete(); 36 | for (destructor = _dtors; *destructor; destructor++) { 37 | (*destructor)(); 38 | } 39 | } 40 | 41 | RELMODULE_EXPORT void _unresolved(void) { 42 | ; //stubbed in retail 43 | } -------------------------------------------------------------------------------- /module/aaa/source/aaa_00.c: -------------------------------------------------------------------------------- 1 | #include "aaa_00.h" 2 | #include "drv/dispdrv.h" 3 | #include "evt/evt_bero.h" 4 | #include "evt/evt_npc.h" 5 | #include "mgr/filemgr.h" 6 | #include "win/win_main.h" 7 | #include "system.h" 8 | #include 9 | 10 | typedef struct MarioHouseWork { 11 | FileEntry* texture; //0x0 12 | s32 alpha; //0x4 13 | } MarioHouseWork; 14 | 15 | NpcSetupInfo npcEnt[] = { 16 | {"パレッタ", 0x40000600, 0, 0, 0, 0, 0, 0, 0, 0, 0, NPC_TERRITORY_TYPE_NOTHING, {0}, {0}, 0.0f, 0.0f, 0.0f, 0.0f, 0}, //Parakarry 17 | {"ルイージ", 0x40000600, 0, 0, 0, 0, 0, 0, 0, 0, 0, NPC_TERRITORY_TYPE_NOTHING, {0}, {0}, 0.0f, 0.0f, 0.0f, 0.0f, 0}, //Luigi 18 | {0} 19 | }; 20 | 21 | BeroEntry bero_entry_data = { 22 | "dokan_1", 23 | 2, 0, 9, 24 | 0x186A0, 0, 0, 25 | -1, NULL, 6, NULL, 26 | 0, "dokan_1", 27 | 1, 1, 0, 0 28 | }; 29 | 30 | EVT_BEGIN(aaa_00_init_evt) 31 | SET(LW(0), PTR(&bero_entry_data)) 32 | USER_FUNC(evt_bero_get_info) 33 | RUN_SCRIPT(evt_bero_info_run) 34 | USER_FUNC(evt_npc_setup, PTR(npcEnt)) 35 | EVT_END() 36 | 37 | //.bss 38 | MarioHouseWork* wp; 39 | 40 | 41 | static void draw(CameraId cameraId, void* param) { 42 | MarioHouseWork* work = param; 43 | 44 | //stack data 45 | CameraEntry camera; 46 | f32 viewport[GX_VIEWPORT_SZ]; 47 | f32 projection[GX_PROJECTION_SZ]; 48 | Vec translate, scale; 49 | GXColor color; 50 | 51 | GXGetViewportv(viewport); 52 | GXGetProjectionv(projection); 53 | GXSetProjection(camGetPtr(CAMERA_2D)->projection, camGetPtr(CAMERA_2D)->type); 54 | camera = *camGetCurPtr(); 55 | *camGetCurPtr() = *camGetPtr(CAMERA_2D); 56 | winTexInit(*wp->texture->data); 57 | color = (GXColor){0xFF, 0xFF, 0xFF, (u8)wp->alpha}; 58 | scale = (Vec){1.0f, 1.0f, 1.0f}; 59 | translate = (Vec){0.0f, 0.0f, 0.0f}; 60 | winTexSet(3, translate, scale, color); 61 | *camGetCurPtr() = camera; 62 | GXSetViewportv(viewport); 63 | GXSetProjectionv(projection); 64 | } 65 | 66 | USERFUNC_DEF(mapdraw) { 67 | if (isFirstCall) { 68 | wp = _mapAlloc(8); 69 | memset(wp, 0, sizeof(MarioHouseWork)); 70 | wp->texture = fileAllocf(4, "%s/mariost.tpl", getMarioStDvdRoot()); 71 | wp->alpha = 0; 72 | } 73 | wp->alpha += 2; 74 | if (wp->alpha > 255) { 75 | wp->alpha = 255; 76 | evtSetValue(event, GF(0), 1); //done rolling in 77 | } 78 | dispEntry(CAMERA_3D, 7, draw, wp, 1000.0f); 79 | return EVT_RETURN_BLOCK; 80 | } 81 | 82 | void mapdelete(void) { 83 | if (wp && wp->texture) { 84 | fileFree(wp->texture); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /module/aji/include/aji.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include -------------------------------------------------------------------------------- /module/aji/include/aji_00.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "evt/evt_cmd.h" 5 | 6 | EVT_DEF(aji_00_init_evt); -------------------------------------------------------------------------------- /module/aji/include/aji_01.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "evt/evt_cmd.h" 4 | 5 | -------------------------------------------------------------------------------- /module/aji/source/aji.c: -------------------------------------------------------------------------------- 1 | #include "aji.h" 2 | #include "aji_00.h" 3 | #include "data/mapdata.h" 4 | 5 | #ifdef __MWERKS__ 6 | #define RELMODULE_EXPORT __declspec(export) 7 | typedef void (*voidfunctionptr) (void); 8 | __declspec(section ".init") extern voidfunctionptr _ctors[]; 9 | __declspec(section ".init") extern voidfunctionptr _dtors[]; 10 | #else 11 | #define RELMODULE_EXPORT 12 | typedef void (*voidfunctionptr) (void); 13 | extern voidfunctionptr _ctors[]; 14 | extern voidfunctionptr _dtors[]; 15 | #endif 16 | 17 | extern s32 aaa_00_init_evt[]; 18 | 19 | //local prototypes 20 | void _prolog(void); 21 | void _epilog(void); 22 | void _unresolved(void); 23 | 24 | RELMODULE_EXPORT void _prolog(void) { 25 | voidfunctionptr* constructor; 26 | 27 | for (constructor = _ctors; *constructor; constructor++) { 28 | (*constructor)(); 29 | } 30 | relSetEvtAddr("aji_00", aji_00_init_evt); 31 | /* 32 | code **ppcVar1; 33 | 34 | for (ppcVar1 = (code **)&DAT_80431cec; *ppcVar1 != (code *)0x0; ppcVar1 = ppcVar1 + 1) { 35 | (**ppcVar1)(); 36 | } 37 | relSetEvtAddr("aji_00",&aji_00_init_evt); 38 | relSetEvtAddr("aji_01",&aji_01_init_evt); 39 | relSetEvtAddr("aji_02",&aji_02_init_evt); 40 | relSetEvtAddr("aji_03",&aji_03_init_evt); 41 | relSetEvtAddr("aji_04",&aji_04_init_evt); 42 | relSetEvtAddr("aji_05",&aji_05_init_evt); 43 | relSetEvtAddr("aji_06",&aji_06_init_evt); 44 | relSetEvtAddr("aji_07",&aji_07_init_evt); 45 | relSetEvtAddr("aji_08",&aji_08_init_evt); 46 | relSetEvtAddr("aji_09",&aji_09_init_evt); 47 | relSetEvtAddr("aji_10",&aji_10_init_evt); 48 | relSetEvtAddr("aji_11",&aji_11_init_evt); 49 | relSetEvtAddr("aji_12",&aji_12_init_evt); 50 | relSetEvtAddr("aji_13",&aji_13_init_evt); 51 | relSetEvtAddr("aji_14",&aji_14_init_evt); 52 | relSetEvtAddr("aji_15",&aji_15_init_evt); 53 | relSetEvtAddr("aji_16",&aji_16_init_evt); 54 | relSetEvtAddr("aji_17",&aji_17_init_evt); 55 | relSetEvtAddr("aji_18",&aji_18_init_evt); 56 | relSetEvtAddr("aji_19",&aji_19_init_evt); 57 | relSetBtlAddr("aji",&btlsetup_aji_tbl,&btl_aji_setup_no_tbl); 58 | */ 59 | } 60 | 61 | RELMODULE_EXPORT void _epilog(void) { 62 | voidfunctionptr* destructor; 63 | 64 | //mapdelete(); 65 | for (destructor = _dtors; *destructor; destructor++) { 66 | (*destructor)(); 67 | } 68 | } 69 | 70 | RELMODULE_EXPORT void _unresolved(void) { 71 | ; //stubbed in retail 72 | } -------------------------------------------------------------------------------- /module/aji/source/aji_00.c: -------------------------------------------------------------------------------- 1 | #include "aji_00.h" 2 | #include "evt/evt_snd.h" 3 | 4 | EVT_BEGIN(aji_00_init_evt) 5 | IF_LESS(GSW(0), 0x169) 6 | USER_FUNC(evt_snd_bgmon, 0x200, STRING("BGM_STG7_DUN1")) 7 | EVT_END() -------------------------------------------------------------------------------- /module/aji/source/aji_01.c: -------------------------------------------------------------------------------- 1 | #include "aji_01.h" 2 | 3 | USERFUNC_DEF(peach_evt_toumei) { 4 | 5 | } -------------------------------------------------------------------------------- /source/battle/ac/ac_table.c: -------------------------------------------------------------------------------- 1 | #include "battle/ac/ac_table.h" 2 | 3 | ActionCommandEntry ActionCommandList[] = { 4 | /*{1, battleAcMain_TimingA, battleAcResult_TimingA, battleAcDisp_TimingA, battleAcDelete_TimingA}, 5 | {11, battleAcMain_TimingWide, battleAcResult_TimingWide, battleAcDisp_TimingWide, battleAcDelete_TimingWide}, 6 | {3, battleAcMain_StickKeepLeft, battleAcResult_StickKeepLeft, battleAcDisp_StickKeepLeft, battleAcDelete_StickKeepLeft}, 7 | {4, battleAcMain_LstRcKeep, battleAcResult_LstRcKeep, battleAcDisp_LstRcKeep, battleAcDelete_LstRcKeep}, 8 | {5, battleAcMain_Repeatedly, battleAcResult_Repeatedly, battleAcDisp_Repeatedly, battleAcDelete_Repeatedly}, 9 | {6, battleAcMain_RepeatedlyLv, battleAcResult_RepeatedlyLv, battleAcDisp_RepeatedlyLv, battleAcDelete_RepeatedlyLv}, 10 | {7, battleAcMain_Shot, battleAcResult_Shot, battleAcDisp_Shot, battleAcDelete_Shot}, 11 | {8, battleAcMain_ShotTarget, battleAcResult_ShotTarget, battleAcDisp_ShotTarget, battleAcDelete_ShotTarget}, 12 | {9, battleAcMain_StickRotate, battleAcResult_StickRotate, battleAcDisp_StickRotate, battleAcDelete_StickRotate}, 13 | {10, battleAcMain_ButtonDown, battleAcResult_ButtonDown, battleAcDisp_ButtonDown, battleAcDelete_ButtonDown}, 14 | {12, battleAcMain_PendulumCraneTiming, battleAcResult_PendulumCraneTiming, battleAcDisp_PendulumCraneTiming, battleAcDelete_PendulumCraneTiming}, 15 | {13, battleAcMain_CraneTiming, battleAcResult_CraneTiming, battleAcDisp_CraneTiming, battleAcDelete_CraneTiming}, 16 | {14, battleAcMain_AirGauge, battleAcResult_AirGauge, battleAcDisp_AirGauge, battleAcDelete_AirGauge}, 17 | {15, battleAcMain_PowerGauge, battleAcResult_PowerGauge, battleAcDisp_PowerGauge, battleAcDelete_PowerGauge}, 18 | {16, battleAcMain_PowerGaugeLv, battleAcResult_PowerGaugeLv, battleAcDisp_PowerGaugeLv, battleAcDelete_PowerGaugeLv}, 19 | {17, battleAcMain_PowerGaugeLv2, battleAcResult_PowerGaugeLv2, battleAcDisp_PowerGaugeLv2, battleAcDelete_PowerGaugeLv2}, 20 | {18, battleAcMain_SignalTiming, battleAcResult_SignalTiming, battleAcDisp_SignalTiming, battleAcDelete_SignalTiming}, 21 | {19, battleAcMain_GaugeTiming, battleAcResult_GaugeTiming, battleAcDisp_GaugeTiming, battleAcDelete_GaugeTiming}, 22 | {20, battleAcMain_GaugeTiming2, battleAcResult_GaugeTiming2, battleAcDisp_GaugeTiming2, battleAcDelete_GaugeTiming2}, 23 | {21, battleAcMain_MonosiriTarget, battleAcResult_MonosiriTarget, battleAcDisp_MonosiriTarget, battleAcDelete_MonosiriTarget},*/ 24 | {0, NULL, NULL, NULL, NULL} 25 | }; 26 | -------------------------------------------------------------------------------- /source/battle/ac/ac_timing_a.c: -------------------------------------------------------------------------------- 1 | #include "battle/ac/ac_timing_a.h" 2 | 3 | s32 battleAcMain_TimingA(BattleWork* work) { 4 | switch (work->actionCommands.mAcState) { //decimal values 5 | case 0: 6 | break; 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /source/battle/battle_ac_help.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_ac_help.h" 2 | 3 | void BattleAcHelpInit(void) { 4 | //stubbed in retail 5 | } 6 | 7 | void BattleAcHelpMain(void) { 8 | 9 | } -------------------------------------------------------------------------------- /source/battle/battle_acrobat.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_acrobat.h" 2 | #include "battle/battle_unit.h" 3 | #include "drv/dispdrv.h" 4 | 5 | //local prototypes 6 | void accrobat_timing_icon_disp(CameraId cameraId, void* param); 7 | 8 | s32 BattleAcrobatStart(BattleWork* work, s32 unitId, s32 windowStartFrame, 9 | s32 windowEndFrame, s32 endFrame, s32 earlyFrames) { 10 | (work->actionCommands).mStylishCurFrame = 0; 11 | (work->actionCommands).mStylishWindowStart = windowStartFrame; 12 | (work->actionCommands).mStylishWindowEnd = windowEndFrame; 13 | (work->actionCommands).mStylishEndFrame = endFrame; 14 | (work->actionCommands).mStylishUnitId = unitId; 15 | (work->actionCommands).mStylishResult = 0; 16 | (work->actionCommands).mStylishEarlyFrames = earlyFrames; 17 | return 0; //??? 18 | } 19 | 20 | s32 BattleAcrobatMain(BattleWork* work) { 21 | BattleACManager* manager; 22 | BattleWorkUnit* unit; 23 | BOOL doSimplified; 24 | s32 i; 25 | 26 | manager = &work->actionCommands; 27 | unit = BattleGetUnitPtr(work, manager->mStylishUnitId); 28 | doSimplified = FALSE; 29 | manager->mStylishCurFrame++; 30 | if (!unit) { 31 | manager->mStylishResult = 1; 32 | return EVT_RETURN_YIELD; 33 | } 34 | if (unit->mTokenFlags & kConfusedAction) { 35 | manager->mStylishResult = 1; 36 | return EVT_RETURN_YIELD; 37 | } 38 | if ((work->mBadgeEquippedFlags & 4) && (manager->mStylishWindowStart < manager->mStylishCurFrame <= manager->mStylishWindowEnd)) { 39 | Vec v11 = { 0 }; 40 | v11.x = unit->mPosition.x; 41 | v11.y = unit->mPosition.y; 42 | v11.z = 15.0f + unit->mPosition.z; 43 | dispEntry(CAMERA_3D, 1, accrobat_timing_icon_disp, unit, dispCalcZ(&v11)); 44 | } 45 | if (unit->mBadgesEquipped.mAutoCommandBadge && (manager->mStylishWindowStart < manager->mStylishCurFrame <= manager->mStylishWindowEnd)) { 46 | doSimplified = TRUE; 47 | } 48 | if (manager->mStylishCurFrame <= 1 && manager->mStylishEarlyFrames > 0) { 49 | for (i = 0; i < manager->mStylishEarlyFrames; ++i) { 50 | if (BattlePadCheckRecordTrigger(i, 0x100)) { 51 | manager->mStylishResult = -1; 52 | return EVT_RETURN_YIELD; 53 | } 54 | } 55 | } 56 | if (BattlePadCheckTrigger(0x100) || doSimplified) { 57 | if (manager->mStylishCurFrame <= manager->mStylishWindowStart) { 58 | manager->mStylishResult = -1; 59 | return EVT_RETURN_YIELD; 60 | } 61 | else if (manager->mStylishCurFrame > manager->mStylishWindowEnd) { 62 | manager->mStylishResult = -2; 63 | return EVT_RETURN_YIELD; 64 | } 65 | else { 66 | manager->mStylishResult = 2; 67 | return EVT_RETURN_YIELD; 68 | } 69 | } 70 | else if (manager->mStylishCurFrame < manager->mStylishEndFrame) { 71 | return EVT_RETURN_BLOCK; 72 | } 73 | else { 74 | work->actionCommands.mStylishResult = 1; 75 | return EVT_RETURN_YIELD; 76 | } 77 | } 78 | 79 | //param = BattleWorkUnit* unit; 80 | void accrobat_timing_icon_disp(CameraId cameraId, void* param) { 81 | BattleWorkUnit* unit = param; //cast to proper type 82 | f32 x, y, z; //sp 8, c, 10 83 | 84 | BtlUnit_GetPos(unit, &x, &y, &z); 85 | x += 15.0f; 86 | y += (f32)(BtlUnit_GetHeight(unit) + 5); 87 | //iconDispGx(); 88 | } 89 | 90 | s32 BattleAcrobatGetResult(BattleWork* work, s32* result, s32* curFrame) { 91 | *result = work->actionCommands.mStylishResult; 92 | *curFrame = work->actionCommands.mStylishCurFrame; 93 | return EVT_RETURN_DONE; 94 | } -------------------------------------------------------------------------------- /source/battle/battle_actrecord.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_actrecord.h" 2 | 3 | -------------------------------------------------------------------------------- /source/battle/battle_break_slot.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_break_slot.h" 2 | 3 | void BattleBreakSlot_Init(void) { 4 | 5 | } 6 | 7 | void BattleBreakSlot_Main(void) { 8 | 9 | } 10 | 11 | void BattleBreakSlot_End(void) { 12 | //stubbed in retail 13 | } -------------------------------------------------------------------------------- /source/battle/battle_camera.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_camera.h" 2 | #include "battle/battle.h" 3 | #include 4 | 5 | extern BattleWork* _battleWorkPointer; 6 | 7 | //this file uses -O4,s 8 | void battleCameraInit(void) { 9 | BattleWork* wp = _battleWorkPointer; 10 | BattleCameraWork* camera; 11 | 12 | camera = &wp->cameraWork; 13 | memset(camera, 0, sizeof(BattleCameraWork)); 14 | camera->flags = 0; 15 | switch (wp->fbatInfo->partyId) { 16 | case 1: 17 | case 2: 18 | case 3: 19 | case 4: 20 | case 5: 21 | case 6: 22 | case 7: 23 | case 8: 24 | camera->mode = 15; 25 | break; 26 | case 9: 27 | camera->mode = 16; 28 | break; 29 | case 0: 30 | camera->mode = 14; 31 | break; 32 | } 33 | camera->priLimit = 0; 34 | camera->zoom = 0.0f; 35 | camera->moveSpeedLv = 1; 36 | camera->zoomSpeedLv = 1; 37 | camera->position = (Vec){0.0f, 0.0f, 0.0f}; 38 | camera->unk4 = 0; 39 | } 40 | -------------------------------------------------------------------------------- /source/battle/battle_damage.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_damage.h" 2 | #include "battle/battle.h" 3 | #include "battle/battle_unit.h" 4 | 5 | s32 BattleCheckDamage(BattleWorkUnit* unit1, BattleWorkUnit* unit2, BattleWorkUnitPart* part, BattleWeapon* weapon, s32 flags) { 6 | 7 | if (!unit2) { 8 | return 18; 9 | } 10 | if (part) { 11 | unit2->currentTarget = part; 12 | } 13 | 14 | 15 | } -------------------------------------------------------------------------------- /source/battle/battle_information.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_information.h" 2 | 3 | void BattleInformationSetMode(FieldBattleInfo* info, u32 mode) { 4 | info->mode = mode; 5 | } 6 | 7 | void BattleInformationSetParty(FieldBattleInfo* info, BattleUnitType party) { 8 | info->party = party; 9 | } 10 | 11 | void BattleInformationSetFirstAttack(FieldBattleInfo* info, u32 partyId) { 12 | info->partyId = partyId; 13 | } 14 | 15 | void BattleInformationInit(FieldBattleInfo* info) { 16 | 17 | } 18 | 19 | void BattleInfomationSetBattleSetupInfo(FieldBattleInfo* info, NpcBattleInfo* setup) { 20 | info->setup = setup; 21 | } 22 | 23 | void BattleInformationSetResult(FieldBattleInfo* info, u32 result) { 24 | info->result = result; 25 | } 26 | 27 | u32 BattleInformationGetResult(FieldBattleInfo* info) { 28 | return info->result; 29 | } -------------------------------------------------------------------------------- /source/battle/battle_item_data.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_item_data.h" 2 | 3 | USERFUNC_DEF(_full_ap_recover) { 4 | return EVT_RETURN_DONE; 5 | } -------------------------------------------------------------------------------- /source/battle/battle_menu_disp.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_menu_disp.h" 2 | #include "system.h" 3 | 4 | extern BattleWork* _battleWorkPointer; 5 | extern int sprintf(char* str, const char* format, ...); 6 | 7 | //.sbss 8 | s8 seq; 9 | 10 | //.sdata 11 | GXColor seleItemCoordCol = {0xFF, 0xC0, 0xC0, 0xCF}; 12 | 13 | void SelectedItemCoordinateColorUpDate(void) { 14 | switch (seq) { 15 | case 0: 16 | if (++seleItemCoordCol.g == 0xFF) { 17 | seq = 1; 18 | } 19 | break; 20 | case 1: 21 | if (--seleItemCoordCol.r == 0xC0) { 22 | seq = 2; 23 | } 24 | break; 25 | case 2: 26 | if (++seleItemCoordCol.b == 0xFF) { 27 | seq = 3; 28 | } 29 | break; 30 | case 3: 31 | if (--seleItemCoordCol.g == 0xC0) { 32 | seq = 4; 33 | } 34 | break; 35 | case 4: 36 | if (++seleItemCoordCol.r == 0xFF) { 37 | seq = 5; 38 | } 39 | break; 40 | case 5: 41 | if (--seleItemCoordCol.b == 0xC0) { 42 | seq = 0; 43 | } 44 | break; 45 | } 46 | } 47 | 48 | BOOL BattleMenuKeyOKInACT(BattleWork* wp) { 49 | return FALSE; //TODO: finish when I get the struct more done 50 | } 51 | 52 | void battleMenuDispInit(void) { 53 | BattleWork* wp = _battleWorkPointer; 54 | char path[256]; 55 | 56 | sprintf(path, "%s/battle/common/battle_common.tpl", getMarioStDvdRoot()); 57 | wp->menuTex = fileAlloc(path, 4); 58 | } 59 | 60 | void battleMenuDispEnd(void) { 61 | fileFree(_battleWorkPointer->menuTex); 62 | } -------------------------------------------------------------------------------- /source/battle/battle_party.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_party.h" 2 | #include "battle/battle_unit.h" 3 | #include "battle/unit/unit_party_nokotarou.h" 4 | 5 | /* 6 | BattleUnitSetup entryunit_party[] = { 7 | {unitdata_Party_Nokotarou} 8 | };*/ 9 | -------------------------------------------------------------------------------- /source/battle/battle_seq_command.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_seq_command.h" 2 | #include "battle/battle.h" 3 | #include "battle/battle_monosiri.h" 4 | #include "battle/battle_unit.h" 5 | #include "drv/camdrv.h" 6 | #include "drv/dispdrv.h" 7 | 8 | //TODO: move into battle/seq/? 9 | 10 | //local prototypes 11 | void BattleDrawEnemyHP(CameraId cameraId, void* param); 12 | 13 | void BattleDrawEnemyHP(CameraId cameraId, void* param) { 14 | BattleWork* wp = param; 15 | BattleWorkUnit* unit; 16 | Vec position; 17 | int i; 18 | 19 | camGetPtr(CAMERA_2D); //unused, probably just stored 20 | 21 | for (i = 0; i < 64; i++) { 22 | unit = wp->mUnits[i]; 23 | if (unit) { 24 | if (!BtlUnit_CheckStatus(unit, kStatusInstantKill)) { 25 | if (battleCheckUnitMonosiriFlag(unit)) { 26 | if (!unit->mAttributeFlags & 0x2000000) { 27 | if (wp->commandMenu.unk4 & 0x1000000) { 28 | if (unit->mFlags & 1) { 29 | position.x = unit->mPosition.x; 30 | position.y = unit->mPosition.y; 31 | position.z = unit->mPosition.z; 32 | if (wp->flags & 0x80) { 33 | position.x = unit->mHomePosition.x; 34 | position.y = unit->mHomePosition.y; 35 | position.z = unit->mHomePosition.z; 36 | } 37 | position.x += (f32)unit->mHpGaugeOffset[0]; 38 | position.y += (f32)unit->mHpGaugeOffset[1]; 39 | } 40 | } 41 | } 42 | } 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /source/battle/battle_stage.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_stage.h" 2 | #include "battle/battle.h" 3 | 4 | extern BattleWork* _battleWorkPointer; 5 | 6 | //.sbss 7 | static BattleStageSpotWork work; 8 | 9 | //.sdata 10 | static BattleStageSpotWork* wp = &work; 11 | 12 | BattleStage* BattleStageGetPtr(void) { 13 | return &_battleWorkPointer->stage; 14 | } 15 | 16 | void BattleStageInit(void) { 17 | 18 | } 19 | 20 | void BattleStageMain(void) { 21 | 22 | } 23 | 24 | void BattleStageEnd(void) { 25 | 26 | } -------------------------------------------------------------------------------- /source/battle/battle_stage_object.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_stage_object.h" 2 | #include "battle/battle.h" 3 | #include "system.h" 4 | #include 5 | 6 | extern BattleWork* _battleWorkPointer; 7 | 8 | //local prototypes 9 | void BattleObjectConfig(void); 10 | 11 | BattleStageObject* BattleGetObjectPtr(s32 id) { 12 | BattleWork* wp = _battleWorkPointer; 13 | int i; 14 | 15 | for (i = 0; i < 32; i++) { 16 | if (wp->stageObjects[i].id == id) { 17 | return &wp->stageObjects[i]; 18 | } 19 | } 20 | return NULL; //if none of the IDs match 21 | } 22 | 23 | BattleStageObject* BattleSearchObjectPtr(const char* name) { 24 | BattleWork* wp = _battleWorkPointer; 25 | BattleStageObject* object; 26 | int i; 27 | 28 | for (i = 0; i < 32; i++) { 29 | object = &wp->stageObjects[i]; 30 | if (object->id && !strcmp(object->data->name, name)) { 31 | return object; 32 | } 33 | } 34 | return NULL; //if name not found 35 | } 36 | 37 | void BattleStageObjectInit(void) { 38 | 39 | } 40 | 41 | 42 | 43 | 44 | 45 | USERFUNC_DEF(_set_mobj_shake_init) { 46 | BattleStageObject* obj; 47 | int i, layer; 48 | u8 position; 49 | 50 | //get the layer this object is on 51 | layer = evtGetValue(event, *event->args); 52 | 53 | for (i = 0; i < 32; i++) { 54 | obj = &_battleWorkPointer->stageObjects[i]; 55 | if (obj->id > 0 && obj->data->mLayer == layer) { 56 | obj->field_0x72 = 0; 57 | obj->mShakePeriodLength = (u8)(irand(10) + 60); 58 | if (irand(100) & 1) { 59 | position = 0; 60 | } 61 | else { 62 | position = (u8)(obj->mShakePeriodLength / 2); 63 | } 64 | obj->mShakePeriodPosition = position; 65 | obj->mShakeAngle = 0.0f; 66 | } 67 | } 68 | return EVT_RETURN_DONE; 69 | } 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | void BattleObjectConfig(void) { 78 | //stubbed in retail 79 | } 80 | 81 | void BattleStageObjectMain(void) { 82 | 83 | } 84 | -------------------------------------------------------------------------------- /source/battle/battle_status_effect.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_status_effect.h" 2 | #include "battle/battle_unit.h" 3 | 4 | //.sdata 5 | //Status Type Priority Data 6 | s8 _st_pri_data[] = { 7 | kStatusCharge, //charge is elevated 8 | kStatusPoison, //poison is elevated 9 | kStatusSleep, 10 | kStatusStop, 11 | kStatusDizzy, 12 | kStatusConfuse, 13 | kStatusElectric, 14 | kStatusDodgy, 15 | kStatusBurn, 16 | kStatusFreeze, 17 | kStatusHuge, 18 | kStatusTiny, 19 | kStatusAttackUp, 20 | kStatusAttackDown, 21 | kStatusDefenseUp, 22 | kStatusDefenseDown, 23 | kStatusAllergic, 24 | kStatusInvisible, 25 | kStatusFast, 26 | kStatusSlow, 27 | kStatusPayback, 28 | kStatusHoldFast, 29 | kStatusHpRegen, 30 | kStatusFpRegen, 31 | -1 32 | }; 33 | 34 | //local prototypes 35 | void BSE_Sleep(BattleWorkUnit* unit); 36 | void BSE_SleepDelete(BattleWorkUnit* unit); 37 | void BSE_Biribiri(BattleWorkUnit* unit); 38 | void BSE_BiribiriDelete(BattleWorkUnit* unit); 39 | void BSE_Fire(BattleWorkUnit* unit); 40 | void BSE_FireDelete(BattleWorkUnit* unit); 41 | void BSE_Freeze(BattleWorkUnit* unit); 42 | void BSE_FreezeDelete(BattleWorkUnit* unit); 43 | void BSE_Kagegakure(BattleWorkUnit* unit); 44 | void BSE_KagegakureDelete(BattleWorkUnit* unit); 45 | s32 _get_pri(s8 type); 46 | 47 | void BattleStatusEffectInit(BattleWorkUnit* unit) { 48 | ; //stubbed in retail 49 | } 50 | 51 | void BattleStatusEffectMain(BattleWorkUnit* unit) { 52 | BSE_Sleep(unit); 53 | BSE_Biribiri(unit); 54 | BSE_Fire(unit); 55 | BSE_Freeze(unit); 56 | BSE_Kagegakure(unit); 57 | } 58 | 59 | void BattleStatusEffectDelete(BattleWorkUnit* unit) { 60 | BSE_SleepDelete(unit); 61 | BSE_BiribiriDelete(unit); 62 | BSE_FireDelete(unit); 63 | BSE_FreezeDelete(unit); 64 | BSE_KagegakureDelete(unit); 65 | } 66 | 67 | void BSE_Sleep(BattleWorkUnit* unit) { 68 | 69 | } 70 | 71 | void BSE_SleepDelete(BattleWorkUnit* unit) { 72 | 73 | } 74 | 75 | void BSE_Biribiri(BattleWorkUnit* unit) { 76 | 77 | } 78 | 79 | void BSE_BiribiriDelete(BattleWorkUnit* unit) { 80 | 81 | } 82 | 83 | void BSE_Fire(BattleWorkUnit* unit) { 84 | 85 | } 86 | 87 | void BSE_FireDelete(BattleWorkUnit* unit) { 88 | 89 | } 90 | 91 | void BSE_Freeze(BattleWorkUnit* unit) { 92 | 93 | } 94 | 95 | void BSE_FreezeDelete(BattleWorkUnit* unit) { 96 | 97 | } 98 | 99 | void BSE_Kagegakure(BattleWorkUnit* unit) { 100 | 101 | } 102 | 103 | void BSE_KagegakureDelete(BattleWorkUnit* unit) { 104 | 105 | } 106 | 107 | void BSE_TurnFirstProcessEffectEntry(BattleWorkUnit* unit, s16 active) { 108 | unit->mBurnDamageFlameState = 1; 109 | unit->mbBurnDamageFlameActive = active; 110 | } 111 | 112 | BOOL BSE_TurnFirstProcessEffectMain(BattleWorkUnit* unit) { 113 | BattleWorkUnitPart* part; 114 | 115 | part = BtlUnit_GetPartsPtr(unit, BtlUnit_GetBodyPartsId(unit)); 116 | if (!unit->mBurnDamageFlameState) { 117 | return FALSE; 118 | } 119 | if (!unit->mbBurnDamageFlameActive) { 120 | return FALSE; 121 | } 122 | if (unit->mbBurnDamageFlameActive != 1) { 123 | return FALSE; 124 | } 125 | //TODO: finish 126 | return FALSE; 127 | } 128 | 129 | void BattleStatusChangeInfoWorkInit(BattleWorkUnit* unit) { 130 | 131 | } 132 | 133 | //should be StatusEffectType, TODO fix for s8 134 | s32 _get_pri(s8 type) { 135 | s8* val; 136 | s32 priority = 24; //TODO: #define? 137 | 138 | for (val = _st_pri_data;; val++, priority--) { 139 | if (*val == -1) { 140 | return -1; //reached end of list 141 | } 142 | if (*val == type) { 143 | return priority; 144 | } 145 | } 146 | return -1; 147 | } 148 | 149 | 150 | void BattleStatusChangeMsgWorkInit(void) { 151 | 152 | } -------------------------------------------------------------------------------- /source/battle/battle_status_icon.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_status_icon.h" 2 | #include "battle/battle.h" 3 | #include 4 | 5 | extern BattleWork* _battleWorkPointer; 6 | 7 | typedef struct IconDispTableEntry IconDispTableEntry; 8 | struct IconDispTableEntry { 9 | s32 id; 10 | BOOL (*callback)(BattleWorkUnit* unit, IconDispTableEntry* disp, BattleWorkStatusIconEntry* entry); //0x4 11 | s32 something; 12 | s32 something2; 13 | }; 14 | 15 | IconDispTableEntry _disp_table[] = { 16 | {1, NULL, 15, 1} 17 | }; 18 | 19 | //local prototypes 20 | void BattleStatusIconDisp(CameraId cameraId, void* param); 21 | 22 | void BattleStatusIconInit(BattleWorkUnit* unit) { 23 | memset(&unit->mStatusIconWork, 0, sizeof(BattleWorkStatusIcon)); 24 | } 25 | 26 | void BattleStatusIconMain(BattleWorkUnit* unit) { 27 | BattleWorkStatusIcon* icon = &unit->mStatusIconWork; 28 | BattleWork* work = _battleWorkPointer; 29 | int i; 30 | 31 | icon->mNumStatusIcons = 0; 32 | if (work->flags & 0x10000 || work->mIconFlags & 1) { 33 | BtlUnit_GetPos(unit, &icon->mPosition.x, &icon->mPosition.y, &icon->mPosition.z); 34 | icon->mPosition.x += ((f32)(unit->mStatusIconOffset[0]) * unit->mSizeMultiplier); 35 | icon->mPosition.y += ((f32)(unit->mStatusIconOffset[1]) * unit->mSizeMultiplier); 36 | icon->mScreenSpaceOffset.x = 13.440001f; 37 | icon->mScreenSpaceOffset.z = 0.0f; 38 | icon->mFlags = 0; 39 | if (unit->mAttributeFlags & kCeiling) { 40 | icon->mDistanceBetweenIcons = 25.6f; 41 | icon->mScreenSpaceOffset.y = 0.0f; 42 | } 43 | else { 44 | icon->mDistanceBetweenIcons = 25.6f; 45 | icon->mScreenSpaceOffset.y = 19.200001f; 46 | } 47 | 48 | for (i = 0; i < 0x17; i++) { 49 | if (_disp_table[i].id == -1) break; 50 | if (_disp_table[i].callback(unit, &_disp_table[i], &icon->mIcons[i])) { 51 | icon->mNumStatusIcons++; 52 | } 53 | } 54 | if (icon->mNumStatusIcons > 0) { 55 | dispEntry(CAMERA_2D, 1, BattleStatusIconDisp, unit, 901.0f); 56 | } 57 | } 58 | } 59 | 60 | void BattleStatusIconDelete(BattleWorkUnit* unit) { 61 | ; //stubbed in retail 62 | } 63 | 64 | void BattleStatusIconDisp(CameraId cameraId, void* param) { 65 | BattleWorkUnit* unit = param; //cast to proper type 66 | } -------------------------------------------------------------------------------- /source/battle/battle_sub.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_sub.h" 2 | #include "battle/battle_unit.h" 3 | 4 | extern BattleWork* _battleWorkPointer; 5 | 6 | void btlsubResetMoveColorLvAll(BattleWork* work) { 7 | BattleWorkUnit* unit; 8 | int i; 9 | 10 | for (i = 0; i < 64; i++) { 11 | unit = BattleGetUnitPtr(work, i); 12 | if (unit) { 13 | unit->mMoveColorLv = 0xFF; 14 | } 15 | } 16 | } 17 | 18 | s32 BattleTransID(EventEntry* evt, s32 type) { 19 | BattleWorkUnit* unit; 20 | 21 | switch (type) { 22 | case -1: 23 | return -1; 24 | case -3: 25 | unit = BattleGetMarioPtr(_battleWorkPointer); 26 | return unit->mUnitId; 27 | case -4: 28 | unit = BattleGetPartyPtr(_battleWorkPointer); 29 | if (unit) { 30 | return unit->mUnitId; 31 | } 32 | else { 33 | return -1; 34 | } 35 | case -5: 36 | unit = BattleGetSystemPtr(_battleWorkPointer); 37 | return unit->mUnitId; 38 | case -6: 39 | return _battleWorkPointer->field_0x424; 40 | default: 41 | return type; 42 | } 43 | } -------------------------------------------------------------------------------- /source/battle/battle_unit_event.c: -------------------------------------------------------------------------------- 1 | //finished, need to check 1:1 2 | #include "battle/battle_unit_event.h" 3 | 4 | BOOL BattleCheckEndUnitInitEvent(BattleWork* wp) { 5 | BattleWorkUnit* unit; 6 | s32 i, eventId; 7 | BOOL valid; 8 | 9 | valid = TRUE; 10 | for (i = 0; i < 64; i++) { 11 | unit = BattleGetUnitPtr(wp, i); 12 | if (unit) { 13 | eventId = unit->initEventId; 14 | if (eventId) { 15 | if (evtCheckID(eventId)) { 16 | valid = FALSE; 17 | } 18 | else { 19 | unit->initEventId = 0; 20 | } 21 | } 22 | } 23 | } 24 | return valid; 25 | } 26 | 27 | s32 BattleRunHitEventDirect(BattleWorkUnit* unit, s32 damageCode, void* code) { 28 | EventEntry* evt; 29 | s32 id, newId; 30 | 31 | newId = 0; 32 | id = unit->damageEventId; 33 | if (id) { 34 | evtDeleteID(id); 35 | unit->damageEventId = 0; 36 | } 37 | 38 | id = unit->waitEventId; 39 | if (id) { 40 | evtDeleteID(id); 41 | unit->waitEventId = 0; 42 | } 43 | 44 | id = unit->phaseEventId; 45 | if (id) { 46 | evtDeleteID(id); 47 | unit->phaseEventId = 0; 48 | } 49 | 50 | id = unit->attackEventId; 51 | if (id) { 52 | evtDeleteID(id); 53 | unit->attackEventId = 0; 54 | } 55 | 56 | if (code) { 57 | evt = evtEntry(code, 0xA, 0x20); 58 | evt->unitId = unit->mUnitId; 59 | unit->damageCode = damageCode; 60 | newId = evt->eventId; 61 | unit->damageEventId = newId; 62 | } 63 | return newId; 64 | } 65 | 66 | s32 BattleRunHitEvent(BattleWorkUnit* unit, s32 damageCode) { 67 | void* code; 68 | BOOL valid; 69 | s32 id; 70 | 71 | id = 0; 72 | valid = TRUE; 73 | if (damageCode == 0x28 && !BtlUnit_CheckData(unit, 0x2E)) { 74 | valid = FALSE; 75 | } 76 | if (!valid) { 77 | return 0; 78 | } 79 | code = unit->damageEventCode; 80 | if (code) { 81 | id = BattleRunHitEventDirect(unit, damageCode, code); 82 | } 83 | return id; 84 | } 85 | 86 | s32 BattleRunPhaseEvent(BattleWorkUnit* unit, BOOL isUnison) { 87 | EventEntry* evt = NULL; 88 | s32 id = 0; 89 | void* code; 90 | 91 | if (isUnison) { 92 | code = unit->unisonPhaseEventCode; 93 | if (!code) { 94 | evt = evtEntry(code, 0xA, 0x20); 95 | } 96 | } 97 | else { 98 | code = unit->phaseEventCode; 99 | if (!code) { 100 | evt = evtEntry(code, 0xA, 0x20); 101 | } 102 | } 103 | if (evt) { 104 | evt->unitId = unit->mUnitId; 105 | id = evt->eventId; 106 | unit->phaseEventId = id; 107 | } 108 | return id; 109 | } 110 | 111 | void BattlePhaseEventStartDeclare(BattleWorkUnit* unit) { 112 | s32 id; 113 | 114 | id = unit->damageEventId; 115 | if (id) { 116 | evtDeleteID(id); 117 | unit->damageEventId = 0; 118 | } 119 | 120 | id = unit->waitEventId; 121 | if (id) { 122 | evtDeleteID(id); 123 | unit->waitEventId = 0; 124 | } 125 | 126 | id = unit->attackEventId; 127 | if (id) { 128 | evtDeleteID(id); 129 | unit->attackEventId = 0; 130 | } 131 | } 132 | 133 | s32 BattleRunWaitEvent(BattleWorkUnit* unit) { 134 | EventEntry* evt; 135 | void* code; 136 | s32 id; 137 | 138 | id = unit->waitEventId; 139 | if (id) { 140 | evtDeleteID(id); 141 | unit->waitEventId = 0; 142 | } 143 | 144 | code = unit->waitEventCode; 145 | if (code) { 146 | evt = evtEntry(code, 0xA, 0); 147 | evt->unitId = unit->mUnitId; 148 | unit->waitEventId = evt->eventId; 149 | } 150 | return 0; //unused 151 | } 152 | -------------------------------------------------------------------------------- /source/battle/battle_weapon_power.c: -------------------------------------------------------------------------------- 1 | #include "battle/battle_weapon_power.h" 2 | 3 | -------------------------------------------------------------------------------- /source/battle/sac/sac_bakugame.c: -------------------------------------------------------------------------------- 1 | #include "battle/sac/sac_bakugame.h" 2 | #include "battle/battle.h" 3 | 4 | extern BattleWork* _battleWorkPointer; 5 | 6 | BattleACExtraParams* GetBakuGamePtr(void) { 7 | return &_battleWorkPointer->actionCommands.extraParams; 8 | } -------------------------------------------------------------------------------- /source/battle/unit/unit_party_nokotarou.c: -------------------------------------------------------------------------------- 1 | #include "battle/unit/unit_party_nokotarou.h" 2 | 3 | -------------------------------------------------------------------------------- /source/countdown.c: -------------------------------------------------------------------------------- 1 | #include "countdown.h" 2 | #include "mario/mariost.h" 3 | #include 4 | 5 | extern GlobalWork* gp; 6 | 7 | //.sbss 8 | static CountdownWork* wp; 9 | 10 | void countDownInit(void) { 11 | wp = &gp->countdown; 12 | memset(&gp->countdown, 0, sizeof(CountdownWork)); 13 | } 14 | 15 | void countDownSaveReStart(void) { 16 | 17 | } 18 | 19 | void countDownMain(void) { 20 | 21 | } -------------------------------------------------------------------------------- /source/data/item_data.c: -------------------------------------------------------------------------------- 1 | //EXTREMELY Work-in-Progress cuz of how connected battle_item_data is 2 | #include "data/item_data.h" 3 | 4 | ItemData itemDataTable[1] = { 5 | {"むこうアイテム", "in_unknown_item", "msg_unknown_item", "msg_unknown_item", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL} 6 | }; -------------------------------------------------------------------------------- /source/data/mapdata.c: -------------------------------------------------------------------------------- 1 | #include "data/mapdata.h" 2 | 3 | void relSetEvtAddr(const char* name, s32* script) { 4 | 5 | } -------------------------------------------------------------------------------- /source/database.c: -------------------------------------------------------------------------------- 1 | #include "database.h" 2 | #include "drv/arcdrv.h" 3 | #include "mgr/evtmgr.h" 4 | #include "memory.h" 5 | #include "system.h" 6 | #include 7 | 8 | extern int sprintf(char* str, const char* format, ...); 9 | 10 | //.sbss 11 | void* ptr; //but why 12 | u32 size; 13 | 14 | void setupDataLoad(const char* mapName) { 15 | char path[64]; 16 | DVDEntry* dvd; 17 | u32 filesize; 18 | 19 | ptr = NULL; 20 | sprintf(path, "%s/m/%s/s", getMarioStDvdRoot(), mapName); 21 | if (strcmp(mapName, "muj_20") || evtGetValue(NULL, GSW(0)) != 2) { 22 | arcOpen(path, &ptr, &size); 23 | if (!ptr) { 24 | dvd = DVDMgrOpen(path, 2, 0); 25 | if (dvd) { 26 | filesize = DVDMgrGetLength(dvd); 27 | size = filesize; 28 | if (filesize) { 29 | ptr = _mapAlloc(OSRoundUp32B(filesize)); 30 | DVDMgrRead(dvd, ptr, OSRoundUp32B(size), 0); 31 | } 32 | DVDMgrClose(dvd); 33 | } 34 | } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /source/drv/arcdrv.c: -------------------------------------------------------------------------------- 1 | #include "drv/arcdrv.h" 2 | #include 3 | 4 | //.bss 5 | static ArchiveEntry work[4]; 6 | 7 | 8 | 9 | 10 | //void* arcOpen(char* filename, ) 11 | 12 | 13 | //BOOL arcDataCheck() 14 | 15 | void arcInit(void) { 16 | int i; 17 | 18 | for (i = 0; i < 4; i++) { 19 | memset(&work[i], 0, sizeof(ArchiveEntry)); 20 | } 21 | } 22 | 23 | void* arcOpen(const char* filename, void** addr, u32* length) { 24 | ARCFileInfo info; 25 | void* startAddr; 26 | int i; 27 | 28 | for (i = 0; i < 4; i++) { 29 | if ((work[i].flags & 1) && ARCOpen(&work[i].handle, filename, &info)) { 30 | startAddr = ARCGetStartAddrInMem(&info); 31 | if (addr) { 32 | *addr = startAddr; 33 | } 34 | if (length) { 35 | *length = ARCGetLength(&info); 36 | } 37 | ARCClose(); 38 | return startAddr; 39 | } 40 | } 41 | if (addr) { 42 | *addr = NULL; 43 | } 44 | if (length) { 45 | *length = 0; 46 | } 47 | return NULL; 48 | } 49 | 50 | void arcEntry(s32 id, void* data, u32 size) { 51 | 52 | } -------------------------------------------------------------------------------- /source/drv/casedrv.c: -------------------------------------------------------------------------------- 1 | #include "drv/casedrv.h" 2 | #include "memory.h" 3 | #include 4 | 5 | typedef struct CaseEntry { 6 | u16 flags; //0x0 7 | u8 pad_2[2]; //0x2 8 | s32 activeConditionId; //0x4, TODO rename 9 | char hitObjName[0x40]; //0x8 10 | s32 caseId; //0x48 11 | u32 swFlag; //0x4C 12 | void* activeFunc; //0x50 13 | s32 lwData[16]; //0x54 14 | u8 field_0x94[4]; //0x94 15 | void* evtCode; //0x98, TODO re-type 16 | s32 priority; //0x9C 17 | } CaseEntry; 18 | 19 | typedef struct CaseWork { 20 | s32 count; //0x0 21 | CaseEntry* entries; //0x4 22 | } CaseWork; 23 | 24 | //.sbss 25 | static CaseWork work; 26 | static CaseWork* wp = &work; 27 | 28 | 29 | void caseInit(void) { 30 | wp->count = 64; 31 | wp->entries = __memAlloc(HEAP_DEFAULT, wp->count * sizeof(CaseEntry)); 32 | memset(wp->entries, 0, wp->count * sizeof(CaseEntry)); 33 | } 34 | 35 | void caseReInit(void) { 36 | int i; 37 | 38 | for (i = 0; i < wp->count; i++) { 39 | wp->entries[i].flags &= ~1; 40 | } 41 | } 42 | 43 | s32 caseEntry(CaseSetup* setup) { 44 | CaseEntry* entry; 45 | int i; 46 | if (wp->count > 0) { 47 | for (i = 0; i < wp->count; i++) { 48 | entry = &wp->entries[i]; 49 | if (!(entry->flags & 1)) { 50 | break; //unused entry 51 | } 52 | } 53 | } 54 | memset(entry, 0, sizeof(CaseEntry)); 55 | entry->caseId = i; 56 | entry->flags = 0; 57 | entry->activeConditionId = setup->activeConditionId & 0x7FFF; 58 | if (setup->activeConditionId & 0x8000) { 59 | entry->flags |= 4u; 60 | } 61 | entry->flags |= 1u; 62 | strcpy(entry->hitObjName, setup->hitObjName); 63 | entry->swFlag = setup->swFlag; 64 | entry->activeFunc = setup->activeFunc; 65 | entry->evtCode = setup->evtCode; 66 | entry->priority = setup->priority; 67 | entry->lwData[16] = 0; 68 | memcpy(entry->lwData, setup->lwData, sizeof(entry->lwData)); 69 | return i; 70 | } 71 | 72 | void caseDelete(s32 caseId) { 73 | wp->entries[caseId].flags &= ~1u; 74 | } 75 | 76 | void caseMain(void) { 77 | 78 | } -------------------------------------------------------------------------------- /source/drv/extdrv.c: -------------------------------------------------------------------------------- 1 | #include "drv/extdrv.h" 2 | #include "drv/dispdrv.h" 3 | #include "mario/mariost.h" 4 | 5 | extern GlobalWork* gp; 6 | 7 | static ExtWork work[2]; 8 | 9 | #define extGetWork() (gp->inBattle ? &work[1] : &work[0]) 10 | 11 | void extInit(void) { 12 | ExtWork* wp = extGetWork(); 13 | wp->poseNum = 0; 14 | wp->field_0x8 = 0; 15 | } 16 | 17 | void extMain(void) { 18 | 19 | } 20 | 21 | 22 | 23 | 24 | 25 | void extMakeTexture(CameraId cameraId, void* param) { 26 | 27 | } -------------------------------------------------------------------------------- /source/drv/itemdrv.c: -------------------------------------------------------------------------------- 1 | #include "drv/itemdrv.h" 2 | #include "drv/icondrv.h" 3 | #include "drv/swdrv.h" 4 | #include "mgr/evtmgr_cmd.h" 5 | #include "mario/mario_pouch.h" 6 | #include "mario/mariost.h" 7 | #include "memory.h" 8 | #include 9 | 10 | extern GlobalWork* gp; 11 | extern int sprintf(char* str, const char* format, ...); 12 | 13 | //.bss 14 | static ItemWork work[2]; 15 | 16 | //TODO: inline function? I see nothing in the symbol map 17 | #define itemGetWork() (gp->inBattle ? &work[1] : &work[0]) 18 | 19 | inline void itemCheckBadge(ItemEntry* entry) { 20 | if (!gp->inBattle) { 21 | if (BADGE_MIN <= entry->itemId && entry->itemId < BADGE_MAX) { 22 | if (entry->flags & 0x100) { 23 | pouchArriveBadge(entry->itemId); 24 | } 25 | } 26 | } 27 | } 28 | 29 | void itemInit(void) { // 1:1 30 | ItemWork* wp; 31 | 32 | wp = &work[0]; 33 | wp->count = 32; 34 | wp->entries = __memAlloc(HEAP_DEFAULT, sizeof(ItemEntry) * wp->count); 35 | memset(wp->entries, 0, sizeof(ItemEntry) * wp->count); 36 | wp->currId = 0; 37 | 38 | wp = &work[1]; 39 | wp->count = 32; 40 | wp->entries = __memAlloc(HEAP_DEFAULT, sizeof(ItemEntry) * wp->count); 41 | memset(wp->entries, 0, sizeof(ItemEntry) * wp->count); 42 | wp->currId = 0; 43 | } 44 | 45 | void itemReInit(void) { 46 | ItemWork* wp = itemGetWork(); 47 | ItemEntry* entry; 48 | int i; 49 | 50 | if (!gp->inBattle) { 51 | for (entry = wp->entries, i = 0; i < wp->count; i++, entry++) { 52 | if (entry->flags & 1) { //flush all current badges 53 | itemCheckBadge(entry); 54 | } 55 | } 56 | } 57 | 58 | //clear all existing entries 59 | for (entry = wp->entries, i = 0; i < wp->count; i++, entry++) { 60 | iconDelete(entry->name); 61 | entry->flags &= ~1; 62 | memset(entry->name, 0, sizeof(entry->name)); 63 | } 64 | } 65 | 66 | 67 | 68 | 69 | 70 | 71 | ItemEntry* itemEntry(const char* name, ItemType type, s32 a3, s32 evtId, s32 a5, f32 a6, f32 a7, f32 a8) { 72 | ItemWork* wp = itemGetWork(); 73 | ItemEntry* entry; 74 | s32 evtVar; 75 | int i; 76 | char itemName[64]; 77 | 78 | 79 | evtVar = evtId; 80 | if (evtId != -1) { 81 | if (evtId >= GSWF(0) && evtId <= EVTDAT_GSWF_MAX) { 82 | evtVar = evtId + EVTDAT_GSWF_BASE; 83 | if (swGet(evtId + EVTDAT_GSWF_BASE)) { 84 | return NULL; 85 | } 86 | } 87 | else { 88 | if (evtId >= LSWF(0) && evtId <= EVTDAT_LSWF_MAX) { 89 | evtVar = evtId + EVTDAT_LSWF_BASE; 90 | if (_swGet(evtId + EVTDAT_LSWF_BASE)) { 91 | return NULL; 92 | } 93 | } 94 | } 95 | } 96 | 97 | if (name == NULL) { 98 | if (++wp->currId >= 0xFFFFF) { //fix overflow 99 | wp->currId = 1; 100 | } 101 | sprintf(itemName, "_i%05x", wp->currId); 102 | name = itemName; 103 | } 104 | 105 | entry = wp->entries; 106 | for (i = 0; i < wp->count; i++, entry++) { 107 | if (entry->flags & 1 && !strcmp(entry->name, name)) { 108 | break; 109 | } 110 | } 111 | 112 | entry = wp->entries; 113 | if (wp->count > 0) { //TODO: redundant check? 114 | for (i = 0; i < wp->count; i++, entry++) { 115 | if (!(entry->flags & 1)) { 116 | break; 117 | } 118 | } 119 | } 120 | } 121 | 122 | 123 | void itemMain(void) { 124 | 125 | } -------------------------------------------------------------------------------- /source/drv/mobjdrv.c: -------------------------------------------------------------------------------- 1 | #include "drv/mobjdrv.h" 2 | #include "drv/animdrv.h" 3 | #include "mario/mariost.h" 4 | #include "memory.h" 5 | #include 6 | 7 | extern GlobalWork* gp; 8 | 9 | //.sbss 10 | BOOL koopaRunFlag; 11 | 12 | //.bss 13 | static MapObjectWork work[3]; 14 | 15 | #define mobjGetWorkFlag(flag) (flag ? &work[1] : &work[0]) 16 | 17 | void mobjKoopaOn(void) { 18 | if (!koopaRunFlag) { 19 | koopaRunFlag = TRUE; 20 | work[2].count = 128; 21 | work[2].entries = _mapAlloc(sizeof(MapObjectEntry) * work[2].count); 22 | memset(work[2].entries, 0, sizeof(MapObjectEntry) * work[2].count); 23 | } 24 | } 25 | 26 | inline MapObjectWork* mobjGetWork(void) { 27 | if (koopaRunFlag) { 28 | return &work[2]; 29 | } 30 | else { 31 | return mobjGetWorkFlag(gp->inBattle); 32 | } 33 | } 34 | 35 | inline void calcMtx(MapObjectEntry* entry, Mtx dest, Vec position) { // guessing, always inlined 36 | Mtx trans, scale, xrot, yrot, zrot; 37 | 38 | MTXTrans(trans, position.x, position.y, position.z); 39 | MTXScale(scale, entry->scale2.x, entry->scale2.y, entry->scale2.z); 40 | MTXRotRad(xrot, 'x', MTXDegToRad(entry->rotation.x)); 41 | MTXRotRad(yrot, 'y', MTXDegToRad(entry->rotation.y)); 42 | MTXRotRad(zrot, 'z', MTXDegToRad(entry->rotation.z)); 43 | MTXConcat(trans, zrot, trans); 44 | MTXConcat(trans, yrot, trans); 45 | MTXConcat(trans, xrot, trans); 46 | MTXConcat(trans, scale, dest); 47 | } 48 | 49 | void mobjDispXLU(CameraId cameraId, void* param) { 50 | MapObjectEntry* entry = param; //cast to correct type 51 | 52 | } 53 | 54 | void mobjDisp(CameraId cameraId, void* param) { 55 | MapObjectEntry* entry = param; //cast to correct type 56 | 57 | } 58 | 59 | void mobjDisp_OffscreenXLU(CameraId cameraId, void* param) { 60 | MapObjectEntry* entry = param; //cast to correct type 61 | 62 | } 63 | 64 | void mobjInit(void) { 65 | work[0].count = 16; 66 | work[0].entries = __memAlloc(HEAP_DEFAULT, sizeof(MapObjectEntry) * work[0].count); 67 | memset(work[0].entries, 0, sizeof(MapObjectEntry) * work[0].count); 68 | 69 | work[1].count = 8; 70 | work[1].entries = __memAlloc(HEAP_DEFAULT, sizeof(MapObjectEntry) * work[1].count); 71 | memset(work[1].entries, 0, sizeof(MapObjectEntry) * work[1].count); 72 | 73 | koopaRunFlag = FALSE; 74 | } 75 | 76 | void mobjReset(BOOL inBattle) { 77 | MapObjectWork* wp = mobjGetWorkFlag(inBattle); 78 | memset(wp->entries, 0, sizeof(MapObjectEntry) * wp->count); 79 | koopaRunFlag = FALSE; 80 | } 81 | 82 | void mobjHitEntry(MapObjectEntry* entry, s32 type) { 83 | AnimationPoseData* pose; 84 | Vec bboxMin, bboxMax; 85 | 86 | pose = animPoseGetAnimBaseDataPtr(entry->poseId); 87 | bboxMin = pose->bboxMin; 88 | bboxMax = pose->bboxMax; 89 | 90 | 91 | 92 | 93 | } 94 | 95 | 96 | 97 | 98 | 99 | 100 | void mobjMain(void) { 101 | 102 | } -------------------------------------------------------------------------------- /source/drv/seqdrv.c: -------------------------------------------------------------------------------- 1 | /* "seqdrv" - Sequence Driver 2 | * Status: Mostly complete, need function pointers in seq_data and 3 | * proper names for seqdrv_work 4 | * 5 | * Function: used for swapping between game states (logo, game, battle, demo/e3) 6 | */ 7 | #include "drv/seqdrv.h" 8 | #include "system.h" 9 | #include //memset prototype 10 | 11 | extern SequenceCallback seq_data[8][3]; 12 | 13 | //.sdata 14 | SequenceType prev_seq = SEQ_UNDEFINED; 15 | SequenceType next_seq = SEQ_UNDEFINED; 16 | SequenceType now_seq = SEQ_UNDEFINED; 17 | 18 | //.sbss 19 | SequenceWork seqWork; 20 | const char* next_p1; 21 | const char* next_p0; 22 | 23 | void seqInit_MARIOSTORY(void) { 24 | memset(&seqWork, 0, sizeof(SequenceWork)); 25 | now_seq = SEQ_UNDEFINED; 26 | next_seq = SEQ_UNDEFINED; 27 | prev_seq = SEQ_UNDEFINED; 28 | } 29 | 30 | void seqMain(void) { 31 | if (next_seq != now_seq) { 32 | if (now_seq != SEQ_UNDEFINED) { 33 | sysWaitDrawSync(); 34 | seq_data[now_seq][2](&seqWork); //call Exit function 35 | } 36 | prev_seq = now_seq; //store previous 37 | memset(&seqWork, 0, sizeof(SequenceWork)); 38 | now_seq = next_seq; 39 | seqWork.sequence = next_seq; 40 | seqWork.state = 0; 41 | seqWork.mapName = next_p0; 42 | seqWork.beroName = next_p1; 43 | seq_data[next_seq][0](&seqWork); //call Init function 44 | } 45 | seq_data[now_seq][1](&seqWork); //call Main function 46 | } 47 | 48 | void seqSetSeq(SequenceType seq, const char* map, const char* bero) { 49 | next_seq = seq; 50 | next_p0 = map; 51 | next_p1 = bero; 52 | } 53 | 54 | SequenceType seqGetSeq(void) { 55 | return now_seq; 56 | } 57 | 58 | SequenceType seqGetPrevSeq(void) { 59 | return prev_seq; 60 | } 61 | 62 | SequenceType seqGetNextSeq(void) { 63 | return next_seq; 64 | } 65 | 66 | BOOL seqCheckSeq(void) { 67 | return next_seq != now_seq; 68 | } 69 | -------------------------------------------------------------------------------- /source/drv/shadowdrv.c: -------------------------------------------------------------------------------- 1 | #include "drv/shadowdrv.h" 2 | #include 3 | 4 | //.bss 5 | CharShadowWork char_shadow_work; 6 | ProjShadowWork proj_shadow_work; 7 | DepthShadowWork depth_shadow_work; 8 | 9 | //.sbss 10 | GXTexObj rampTex8; 11 | GXTexObj rampTex16; 12 | 13 | //.sdata 14 | u16 ShadowSizeTbl[4] = {0x190, 0x100, 0x80, 0x40}; 15 | DepthShadowWork* dswp = &depth_shadow_work; 16 | ProjShadowWork* pswp = &proj_shadow_work; 17 | CharShadowWork* cswp = &char_shadow_work; 18 | 19 | void shadowInit(void) { //almost 1:1, minor regalloc 20 | u8* ramp8; 21 | u16* ramp16; 22 | u32 i; 23 | u32 bufferSize; 24 | CharShadowWork* wp; 25 | 26 | cswp->unk0 = 0; 27 | cswp->unk4 = 0; 28 | cswp->unk8 = 1; 29 | cswp->unk100 = (GXColor){0, 0, 0, 0x6E}; 30 | cswp->unk10C = 1; 31 | cswp->unk110 = 2; 32 | cswp->unk114 = 20.0f; 33 | cswp->unk118 = 1; 34 | cswp->unk104 = 0; 35 | cswp->entries = __memAlloc(HEAP_DEFAULT, sizeof(ShadowEntry) * 64); 36 | memset(cswp->entries, 0, sizeof(ShadowEntry) * 64); 37 | wp = cswp; 38 | wp->unkFC = smartAlloc(GXGetTexBufferSize(ShadowSizeTbl[0], ShadowSizeTbl[0], 2, 0, 0), 0); 39 | dswp->unk0 = 2; 40 | dswp->unk4 = 0; 41 | dswp->unk8 = 0; 42 | dswp->unk100 = (GXColor){0, 0, 0, 0x40}; 43 | 44 | bufferSize = GXGetTexBufferSize(0x10, 0x10, GX_TF_I8, GX_FALSE, 0); 45 | ramp8 = __memAlloc(HEAP_DEFAULT, GXGetTexBufferSize(0x10, 0x10, GX_TF_I8, GX_FALSE, 0)); 46 | for (i = 0; i < 256; i++) { 47 | ramp8[(((i & 0x3) * 8) + (((i & 0xC) * 16) + (((i & 0x80) / 4) + ((i & 0x70) / 16))))] = i; 48 | } 49 | GXInitTexObj(&rampTex8, ramp8, 0x10, 0x10, GX_TF_I8, GX_CLAMP, GX_REPEAT, GX_FALSE); 50 | GXInitTexObjLOD(&rampTex8, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1); 51 | DCFlushRange(ramp8, bufferSize); 52 | 53 | bufferSize = GXGetTexBufferSize(0x100, 0x100, GX_TF_IA8, GX_FALSE, 0); 54 | ramp16 = __memAlloc(HEAP_DEFAULT, GXGetTexBufferSize(0x100, 0x100, GX_TF_IA8, GX_FALSE, 0)); 55 | for (i = 0; i < 0x10000; i++) { 56 | ramp16[(((i & 0x3) * 4) + (((i & 0xFC) * 256) + (((i & 0xFC00) / 64) + ((i & 0x300) / 256))))] = i; 57 | } 58 | GXInitTexObj(&rampTex16, ramp16, 0x100, 0x100, GX_TF_IA8, GX_CLAMP, GX_REPEAT, GX_FALSE); 59 | GXInitTexObjLOD(&rampTex16, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1); 60 | DCFlushRange(ramp16, bufferSize); 61 | 62 | pswp->unk0 = 2; 63 | pswp->unk4 = 0; 64 | pswp->unk8 = 0; 65 | pswp->unk100 = (GXColor){0, 0, 0, 0x40}; 66 | } 67 | 68 | void shadowMain(void) { 69 | 70 | } -------------------------------------------------------------------------------- /source/drv/swdrv.c: -------------------------------------------------------------------------------- 1 | /* "swdrv" - Saved Work Driver (for evt) 2 | * Status: Complete, 1:1, aside from unused (_)swToggle which is...unused 3 | * 4 | * Function: Helper driver for accessing the "saved work" data for evt 5 | * scripts 6 | */ 7 | #include "drv/swdrv.h" 8 | #include "mario/mariost.h" 9 | #include 10 | 11 | extern GlobalWork* gp; 12 | 13 | //Local Saved Work --------------------------------------------- 14 | s32 _swByteGet(s32 index) { 15 | return gp->mLSW[index]; 16 | } 17 | 18 | void _swByteSet(s32 index, u8 value) { 19 | gp->mLSW[index] = value; 20 | } 21 | 22 | //Local Saved Work Flags --------------------------------------- 23 | void _swClear(s32 index) { //clear specific bit 24 | gp->mLSWF[index / 32] &= ~(1 << (index % 32)); 25 | } 26 | 27 | BOOL _swGet(s32 index) { //get specific bit 28 | return (gp->mLSWF[index / 32] & (1 << (index % 32))) != 0; 29 | } 30 | 31 | void _swSet(s32 index) { //set specific bit 32 | gp->mLSWF[index / 32] |= (1 << (index % 32)); 33 | } 34 | 35 | //Global Saved Work -------------------------------------------- 36 | s32 swByteGet(s32 index) { 37 | if (index == 0) { 38 | return gp->mGSW0; 39 | } 40 | else { 41 | return gp->mGSW[index]; 42 | } 43 | } 44 | 45 | void swByteSet(s32 index, s32 value) { 46 | if (index == 0) { 47 | gp->mGSW0 = value; 48 | } 49 | else { 50 | gp->mGSW[index] = (u8)value; 51 | } 52 | } 53 | 54 | //Global Saved Work Flags -------------------------------------- 55 | void swClear(s32 index) { //clear specific bit 56 | gp->mGSFW[index / 32] &= ~(1 << (index % 32)); 57 | } 58 | 59 | BOOL swGet(s32 index) { //get specific bit 60 | return (gp->mGSFW[index / 32] & (1 << (index % 32))) != 0; 61 | } 62 | 63 | void swSet(s32 index) { //set specific bit 64 | gp->mGSFW[index / 32] |= (1 << (index % 32)); 65 | } 66 | 67 | void swReInit(void) { 68 | memset(gp->mLSWF, 0, sizeof(gp->mLSWF)); 69 | memset(gp->mLSW, 0, sizeof(gp->mLSW)); 70 | } 71 | 72 | void swInit(void) { 73 | memset(gp->mGSFW, 0, sizeof(gp->mGSFW)); 74 | memset(gp->mGSW, 0, sizeof(gp->mGSW)); 75 | memset(gp->mLSWF, 0, sizeof(gp->mLSWF)); 76 | memset(gp->mLSW, 0, sizeof(gp->mLSW)); 77 | gp->mGSW0 = 0; 78 | } -------------------------------------------------------------------------------- /source/eff/eff_kemuri.c: -------------------------------------------------------------------------------- 1 | #include "eff/eff_kemuri.h" 2 | #include "drv/dispdrv.h" 3 | #include "memory.h" 4 | 5 | typedef struct effKemuriData { 6 | s32 field_0x0; //0x0 7 | f32 field_0x4; //0x4 8 | f32 field_0x8; //0x8 9 | f32 field_0xC; //0xC 10 | u8 field_0x10[0x40 - 0x10]; //0x10 11 | s32 field_0x40; //0x40 12 | f32 field_0x44; //0x44 13 | f32 field_0x48; //0x48 14 | f32 field_0x4C; //0x4C 15 | u8 field_0x50[0x58 - 0x50]; //0x50 16 | f32 field_0x58; //0x58 17 | f32 field_0x5C; //0x5C 18 | u8 field_0x60[0x74 - 0x60]; //0x60 19 | f32 field_0x74; //0x74 20 | u8 field_0x78[0x80 - 0x78]; //0x78 21 | s32 field_0x80; //0x80 22 | s32 field_0x84; //0x84 23 | s32 field_0x88; //0x88 24 | } effKemuriData; 25 | 26 | EffectEntry* effKemuriEntry(s32 int2, f32 float3, f32 float4, f32 float5) { 27 | effKemuriData* data; 28 | s32 numEffects, i; 29 | 30 | EffectEntry* entry = effEntry(); 31 | numEffects = 1; 32 | switch (int2) { 33 | case 0: 34 | numEffects = 3; 35 | break; 36 | case 1: 37 | numEffects = 2; 38 | break; 39 | case 2: 40 | numEffects = 2; 41 | break; 42 | } 43 | entry->type = "Kemuri"; 44 | entry->count = numEffects; 45 | data = (effKemuriData*)__memAlloc(HEAP_EFFECT, sizeof(effKemuriData) * numEffects); 46 | entry->userdata = data; 47 | entry->callback = effKemuriMain; 48 | 49 | data->field_0x0 = int2; 50 | data->field_0x4 = float3; 51 | data->field_0x8 = float4; 52 | data->field_0xC = float5; 53 | 54 | data->field_0x40 = 0; 55 | 56 | data->field_0x44 = 1.0f; 57 | data->field_0x48 = 1.0f; 58 | data->field_0x74 = 1.0f; 59 | for (i = 1; i < entry->count; i++) { 60 | data[i].field_0x4 = 0.0f; 61 | data[i].field_0x8 = 0.0f; 62 | data[i].field_0xC = 0.0f; 63 | 64 | data[i].field_0x44 = 1.0f; 65 | data[i].field_0x48 = 1.0f; 66 | data[i].field_0x74 = 1.0f; 67 | 68 | data[i].field_0x58 = 0.0f; 69 | data[i].field_0x5C = 0.0f; 70 | 71 | data[i].field_0x40 = 0; 72 | data[i].field_0x80 = 0; 73 | data[i].field_0x84 = 0; 74 | 75 | switch (int2) { 76 | case 0: 77 | data[i].field_0x4C = i & 1 ? 3.0f : -3.0f; 78 | data[i].field_0x88 = 32; 79 | break; 80 | case 1: 81 | data[i].field_0x4C = 0.0f; 82 | data[i].field_0x88 = 32; 83 | break; 84 | case 2: 85 | data[i].field_0x4C = 0.0f; 86 | data[i].field_0x88 = 64; 87 | break; 88 | } 89 | } 90 | return entry; 91 | } 92 | 93 | void effKemuriMain(EffectEntry* effect) { 94 | 95 | } 96 | 97 | void effKemuriDisp(CameraId cameraId, void* param) { 98 | EffectEntry* entry = param; 99 | } -------------------------------------------------------------------------------- /source/eff/eff_mahorn2.c: -------------------------------------------------------------------------------- 1 | /* Mahon = Wizzerd */ 2 | 3 | #include "eff/eff_mahorn2.h" 4 | #include "memory.h" 5 | #include 6 | #include 7 | 8 | #define TWO_PI 6.283185307179586f 9 | 10 | EffectEntry *effMahorn2Entry(BOOL unused, f32 posX, f32 posY, f32 posZ, f32 dstX, f32 dstY, f32 dstZ, f32 scale, f32 radius) { 11 | EffectEntry *effect; 12 | effMahorn2Data *data; 13 | f32 temp; 14 | int i; 15 | 16 | effect = effEntry(); 17 | effect->type = "Mahorn2"; 18 | effect->count = 14; 19 | data = __memAlloc(HEAP_EFFECT, sizeof(effMahorn2Data) * 14); 20 | effect->userdata = data; 21 | //effect->callback = effMahorn2Main; 22 | data->unused = unused; 23 | data->unused2 = 0; 24 | data->intplStep = 0; 25 | data->position.x = posX; 26 | data->position.y = posY; 27 | data->position.z = posZ; 28 | data->target.x = dstX; 29 | data->target.y = dstY; 30 | data->target.z = dstZ; 31 | data->scale = scale; 32 | data->hitDistance = radius; 33 | data->alpha = 255; 34 | data->type = 0; 35 | data->hasHit = FALSE; 36 | data++; 37 | 38 | for (i = 1; i < 4; i++, data++) { 39 | memset(data, 0, sizeof(effMahorn2Data)); 40 | data->type = 1; 41 | data->position.x = 0.0f; 42 | data->position.y = 0.0f; 43 | data->position.z = 0.0f; 44 | data->scale = 6.0f; 45 | data->alpha = 0; 46 | data->counter = 15 * (i - 1); 47 | } 48 | 49 | for (i = 4; i < 5; i++, data++) { 50 | memset(data, 0, sizeof(effMahorn2Data)); 51 | data->type = 2; 52 | data->position.x = 0.0f; 53 | data->position.y = 0.0f; 54 | data->position.z = 0.0f; 55 | data->scale = 0.0f; 56 | data->alpha = 153; 57 | data->counter = 15; 58 | } 59 | 60 | for (i = 5; i < 6; i++, data++) { 61 | memset(data, 0, sizeof(effMahorn2Data)); 62 | data->type = 3; 63 | data->position.x = 0.0f; 64 | data->position.y = 0.0f; 65 | data->position.z = 0.0f; 66 | data->scale = 0.0f; 67 | data->alpha = 153; 68 | data->counter = 60; 69 | } 70 | 71 | for (i = 6; i < effect->count; i++, data++) { 72 | memset(data, 0, sizeof(effMahorn2Data)); 73 | data->type = 4; 74 | data->position.x = dstX - posX; 75 | data->position.y = dstY - posY; 76 | data->position.z = dstZ - posZ; 77 | temp = TWO_PI * (f32)(i - 6); 78 | data->target.x = 6.0f * (f32)sin(temp / (f32)(effect->count - 6)); 79 | data->target.y = 6.0f * (f32)cos(temp / (f32)(effect->count - 6)); 80 | data->target.z = 0.0f; 81 | data->scale = 0.0f; 82 | data->alpha = 255; 83 | data->counter = 0; 84 | } 85 | 86 | return effect; 87 | } -------------------------------------------------------------------------------- /source/eff/eff_nice.c: -------------------------------------------------------------------------------- 1 | #include "eff/eff_nice.h" 2 | #include "drv/animdrv.h" 3 | #include "mario/mariost.h" 4 | #include "memory.h" 5 | #include 6 | 7 | extern GlobalWork* gp; 8 | 9 | //.sdata 10 | const char* anim_jp[] = { 11 | "EFF_nice", 12 | "EFF_good", 13 | "EFF_great", 14 | "EFF_wonderful", 15 | "EFF_excellent", 16 | NULL, 17 | "EFF_lucky" 18 | }; 19 | const char* anim_us[] = { 20 | "EFF_nice_us", 21 | "EFF_good_us", 22 | "EFF_great_us", 23 | "EFF_wonderful_us", 24 | "EFF_excellent_us", 25 | NULL, 26 | "EFF_lucky_us" 27 | }; 28 | const char** anim_tbl[2] = { anim_jp, anim_us }; 29 | s32 acrobat_jp[] = {179, 180, 181, 182, 183, 184, 185}; 30 | s32 acrobat_us[] = {183, 184, 185, 186, 187, 188}; //includes nonexistant textures 31 | s32* acrobal_tbl[2] = { acrobat_jp, acrobat_us }; 32 | 33 | //forward declarations 34 | static void rendermodeFunc(s32 wXluStage); 35 | void effNiceMain(EffectEntry* effect); 36 | 37 | BOOL effNiceAsync(s32 group) { 38 | const char* name; 39 | BOOL valid; 40 | int i; 41 | 42 | valid = TRUE; 43 | for (i = 0; i < 7; i++) { 44 | name = anim_tbl[gp->language][i]; 45 | if (name && !animGroupBaseAsync(name, group, NULL)) { 46 | valid = FALSE; 47 | } 48 | } 49 | return valid; 50 | } 51 | 52 | static void rendermodeFunc(s32 wXluStage) { 53 | AnimationWork* wp = animGetPtr(); 54 | 55 | GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR); 56 | GXSetZCompLoc(GX_TRUE); 57 | GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0); 58 | GXSetZMode(GX_FALSE, GX_LEQUAL, GX_FALSE); 59 | wp->currDispMode = wXluStage; 60 | } 61 | 62 | EffectEntry* effNiceEntry(s32 type, f32 x, f32 y, f32 z) { 63 | NiceEffectWork *userdata, *ptr; 64 | EffectEntry* effect; 65 | u32 size, count; 66 | int i; 67 | 68 | effect = effEntry(); 69 | if (type == 5) { //guard for unused slot 70 | type = 0; 71 | } 72 | if (type == 7) { 73 | if (gp->language) { //TODO: ternary? 74 | count = 7; 75 | } 76 | else { 77 | count = 8; 78 | } 79 | } 80 | else { 81 | count = 1; 82 | } 83 | effect->type = "Nice"; 84 | size = sizeof(NiceEffectWork) * count; 85 | effect->count = count; 86 | userdata = __memAlloc(HEAP_EFFECT, size); 87 | effect->userdata = userdata; 88 | memset(userdata, 0, size); 89 | effect->callback = effNiceMain; 90 | effect->flags |= 2; 91 | userdata->type = type; 92 | userdata->position.x = x; 93 | userdata->position.y = y; 94 | userdata->position.z = z; 95 | userdata->field_0x10 = 1.0f; 96 | userdata->field_0x14 = 1.0f; 97 | userdata->field_0x18 = 1.0f; 98 | userdata->field_0x1C = 1.0f; 99 | userdata->poseId = -1; 100 | if (type == 7) { //initialize other entries 101 | ptr = userdata + 1; 102 | for (i = 1; i < effect->count; i++, ptr++) { 103 | ptr->position.x = 1000.0f; 104 | ptr->position.y = 0.0f; 105 | ptr->position.z = 0.0f; 106 | ptr->field_0x10 = 1.0f; 107 | ptr->field_0x14 = 1.0f; 108 | ptr->field_0x18 = 1.0f; 109 | ptr->field_0x28 = 0; 110 | ptr->field_0x20 = 0; 111 | } 112 | } 113 | else { 114 | userdata->poseId = animPoseEntry(anim_tbl[gp->language][type], gp->inBattle != 0); 115 | animPoseSetAnim(userdata->poseId, "A_1", TRUE); 116 | animPoseSetMaterialFlagOn(userdata->poseId, 0x1800); 117 | animPoseSetGXFunc(userdata->poseId, rendermodeFunc, FALSE); 118 | } 119 | return effect; 120 | } 121 | 122 | void effNiceMain(EffectEntry* effect) { 123 | 124 | } -------------------------------------------------------------------------------- /source/eff/eff_scanning.c: -------------------------------------------------------------------------------- 1 | #include "eff/eff_scanning.h" 2 | #include "drv/animdrv.h" 3 | #include "drv/dispdrv.h" 4 | #include "mario/mariost.h" 5 | #include "memory.h" 6 | #include 7 | 8 | extern GlobalWork* gp; 9 | 10 | typedef struct effScanningData { 11 | s32 field_0x0; //0x0 12 | Vec position; //0x4 13 | f32 field_0x10; //0x10 14 | s32 animId; //0x14 15 | s32 field_0x18; //0x18 16 | s32 field_0x1C; //0x1C 17 | s32 field_0x20; //0x20 18 | } effScanningData; 19 | 20 | void effScanningMain(EffectEntry* effect); 21 | void effScanningDisp(CameraId cameraId, void* param); 22 | 23 | EffectEntry* effScanningEntry(s32 int2, f32 float3, f32 float4, f32 float5) { 24 | EffectEntry* entry; 25 | effScanningData* data; 26 | 27 | 28 | entry = effEntry(); 29 | entry->type = "Scanning"; 30 | entry->count = 1; 31 | data = __memAlloc(HEAP_EFFECT, sizeof(effScanningData) * entry->count); 32 | entry->userdata = data; 33 | entry->callback = effScanningMain; 34 | entry->flags |= 2; 35 | 36 | data->field_0x0 = int2; 37 | data->position.x = float3; 38 | data->position.y = float4; 39 | data->position.z = float5; 40 | data->field_0x10 = 1.0f; 41 | data->animId = -1; 42 | data->field_0x18 = 0; 43 | data->field_0x1C = 0; 44 | data->field_0x20 = 255; 45 | 46 | return entry; 47 | } 48 | 49 | void effScanningMain(EffectEntry* effect) { 50 | BOOL inBattle; 51 | Vec disp = { 0 }; //loads Vec from .rodata before being overwritten 52 | effScanningData* data = effect->userdata; 53 | disp.x = data->position.x; 54 | disp.y = data->position.y; 55 | disp.z = data->position.z; 56 | 57 | inBattle = gp->inBattle != 0; 58 | 59 | if (effect->flags & 4) { //soft delete 60 | effect->flags &= ~4; 61 | if (data->animId != -1) { 62 | animPoseRelease(data->animId); 63 | } 64 | effDelete(effect); 65 | } 66 | else { 67 | switch (data->field_0x18) { 68 | case 0: 69 | /*if (!animGroupBaseAsync("EFF_Scan", inBattle, 0)) { 70 | return; 71 | }*/ 72 | data->animId = animPoseEntry("EFF_Scan", (u32)inBattle); 73 | animPoseSetAnim(data->animId, "Z_1", 1); 74 | data->field_0x18++; 75 | break; 76 | case 1: 77 | if (animPoseGetLoopTimes(data->animId) > 1.0f) { 78 | animPoseRelease(data->animId); 79 | effDelete(effect); 80 | return; 81 | } 82 | break; 83 | } 84 | dispEntry(CAMERA_3D, 2, effScanningDisp, effect, dispCalcZ(&disp)); 85 | } 86 | } 87 | 88 | void effScanningDisp(CameraId cameraId, void* param) { 89 | 90 | } -------------------------------------------------------------------------------- /source/eff/eff_sleep.c: -------------------------------------------------------------------------------- 1 | #include "eff/eff_sleep.h" 2 | #include "drv/camdrv.h" 3 | #include "drv/dispdrv.h" 4 | #include "memory.h" 5 | #include 6 | 7 | //local prototypes 8 | void effSleepDisp(CameraId cameraId, EffectEntry* effect); 9 | 10 | EffectEntry* effSleepEntry(s32 a1, s32 a2, f32 x, f32 y, f32 z, f32 scale, f32 rotation) { 11 | EffectEntry* effect; 12 | effSleepData* data; 13 | f32 radians; 14 | s32 smth; 15 | int i; 16 | 17 | effect = effEntry(); 18 | effect->type = "Sleep"; 19 | effect->count = 4; 20 | data = __memAlloc(HEAP_EFFECT, effect->count * sizeof(effSleepData)); 21 | effect->userdata = data; 22 | effect->callback = effSleepMain; 23 | effect->flags |= 2; 24 | data->field_0x0 = a1; 25 | data->position.x = x; 26 | data->position.y = y; 27 | data->position.z = z; 28 | data->scale = scale; 29 | data->field_0x14 = 0; 30 | if (a2 <= 0) { 31 | data->field_0x18 = 1000; 32 | } 33 | else { 34 | data->field_0x18 = a2; 35 | } 36 | data->field_0x1C = 0; 37 | 38 | radians = (6.2831855f * rotation) / 360.0f; //TODO: get radians to f26 39 | for (smth = 16, i = 1; i < effect->count; smth += 16, i++) { 40 | data[i].position.x = (16.0f * (f32)i) * (f32)cos(radians); 41 | data[i].position.y = (16.0f * (f32)i) * (f32)sin(radians); 42 | data[i].position.z = 0.0f; 43 | data[i].scale = (0.2f * (f32)i) + 1.0f; 44 | data[i].field_0x14 = 0; 45 | data[i].field_0x20 = smth; 46 | } 47 | return effect; 48 | } 49 | 50 | void effSleepMain(EffectEntry* effect) { 51 | 52 | } 53 | 54 | void effSleepDisp(CameraId cameraId, EffectEntry* effect) { 55 | 56 | } -------------------------------------------------------------------------------- /source/eff/n64/eff_expbom_n64.c: -------------------------------------------------------------------------------- 1 | #include "eff/n64/eff_expbom_n64.h" 2 | #include "drv/dispdrv.h" 3 | #include "memory.h" 4 | #include 5 | #include 6 | #include 7 | 8 | typedef struct effExpBomData { 9 | s16 field_0x0; //0x0 10 | s16 field_0x2; //0x2 11 | s16 field_0x4; //0x4 12 | s16 field_0x6; //0x6 13 | s32 field_0x8; //0x8 14 | Vec position; //0xC 15 | f32 field_0x18; //0x18 16 | f32 field_0x1C; //0x1C 17 | f32 field_0x20; //0x20 18 | f32 field_0x24; //0x24 19 | u8 field_0x28[0x2C - 0x28]; //0x28 20 | } effExpBomData; 21 | 22 | //.sdata 23 | f32 bom_dir[10] = { 24 | 10.0f, 40.0f, 80.0f, 170.0f, 140.0f, 25 | 100.0f, 25.0f, 155.0f, 60.0f, 120.0f 26 | }; 27 | 28 | f32 bom_spd[] = { 29 | 2.2f, 2.7f, 3.0f, 2.2f, 2.7f, 30 | 3.0f, 1.9f, 1.9f, 1.5f, 1.5f 31 | }; 32 | 33 | f32 bom_scale[10] = { 34 | 1.4f, 1.3f, 1.2f, 1.3f, 1.4f, 35 | 1.3f, 1.6f, 1.6f, 1.6f, 1.6f 36 | }; 37 | 38 | f32 bom_ry[10] = { 39 | 0.0f, 234.0f, 468.0f, 702.0f, 936.0f, 40 | 1260.0f, 1404.0f, 1638.0f, 1902.0f, 1976.0f 41 | }; 42 | 43 | //local prototypes 44 | void effExpBomMain(EffectEntry* effect); 45 | void effExpBomDisp(CameraId cameraId, void* param); 46 | 47 | EffectEntry* effExpBomN64Entry(f32 x, f32 y, f32 z) { 48 | EffectEntry* effect; 49 | effExpBomData* data; 50 | s16 random; 51 | f32 *speed, *direction; 52 | f32 v28, v29; //TODO: rename 53 | int i; 54 | 55 | effect = effEntry(); 56 | effect->type = "ExpBomN64"; 57 | effect->count = 10; 58 | data = __memAlloc(HEAP_EFFECT, sizeof(effExpBomData) * effect->count); 59 | effect->userdata = data; 60 | effect->callback = effExpBomMain; 61 | direction = bom_dir; 62 | speed = bom_spd; 63 | for (i = 0; i < effect->count; i++, data++, speed++, direction++) { 64 | data->field_0x0 = 0; 65 | random = (s16)(rand() % 6) + 16; 66 | data->field_0x4 = random; 67 | data->field_0x2 = random; 68 | data->field_0x6 = 4; 69 | data->field_0x8 = 0; 70 | data->position.x = x; 71 | data->position.y = y; 72 | data->position.z = z; 73 | data->field_0x18 = 0.0f; 74 | data->field_0x1C = 0.0f; 75 | 76 | v28 = 2.0f * *speed; 77 | v29 = ((6.2831855f * (90.0f + *direction)) / 360.0f); 78 | data->field_0x20 = v28 * sinf(v29); 79 | data->field_0x24 = -v28 * cosf(v29); 80 | } 81 | return effect; 82 | } 83 | 84 | void effExpBomMain(EffectEntry* effect) { 85 | BOOL disp; 86 | effExpBomData* data; 87 | int i; 88 | Vec position; 89 | 90 | disp = FALSE; 91 | data = effect->userdata; 92 | position = data->position; //TODO: double check copies right 93 | 94 | for (i = 0; i < effect->count; i++, data++) { 95 | if (data->field_0x2 >= 0 && --data->field_0x8 < 0) { 96 | disp = TRUE; 97 | data->field_0x18 += data->field_0x20; 98 | data->field_0x1C += data->field_0x24; 99 | data->field_0x0++; 100 | if (--data->field_0x2 >= 0 && --data->field_0x6 < 0) { 101 | data->field_0x20 /= 1.25f; 102 | data->field_0x24 /= 1.25f; 103 | } 104 | } 105 | } 106 | if (disp) { 107 | dispEntry(CAMERA_3D, 2, effExpBomDisp, effect, dispCalcZ(&position)); 108 | } 109 | else { 110 | effDelete(effect); 111 | } 112 | } 113 | 114 | void effExpBomDisp(CameraId cameraId, void* param) { 115 | EffectEntry* effect = param; //cast to correct type 116 | 117 | } 118 | -------------------------------------------------------------------------------- /source/eff/n64/eff_kemuri1_n64.c: -------------------------------------------------------------------------------- 1 | #include "eff/n64/eff_kemuri1_n64.h" 2 | #include "memory.h" 3 | #include 4 | 5 | typedef struct effKemuri1Data { 6 | u16 type; //0x0 7 | u8 align_2[2]; //0x2, TODO: verify align 8 | Vec position; //0x4 9 | u8 field_0x10[0x38 - 0x10]; //0x10 10 | s32 field_0x38; //0x38 11 | s32 field_0x3C; //0x3C 12 | u8 field_0x40[0x4C - 0x40]; //0x40 13 | s32 field_0x4C; //0x4C 14 | } effKemuri1Data; 15 | 16 | //local prototypes 17 | void effKemuri1Main(EffectEntry* effect); 18 | 19 | EffectEntry* effKemuri1N64Entry(s32 type, f32 x, f32 y, f32 z, f32 a5) { 20 | EffectEntry* effect; 21 | s32 effCount; 22 | effKemuri1Data* data; 23 | 24 | effect = effEntry(); 25 | switch (type) { 26 | case 2: 27 | effCount = 1; 28 | break; 29 | case 3: 30 | effCount = 4; 31 | break; 32 | case 4: //TODO: -strict off, case 4 ... 7:? 33 | case 5: 34 | case 6: 35 | case 7: 36 | effCount = 9; 37 | break; 38 | default: 39 | effCount = 3; 40 | break; 41 | } 42 | 43 | effect->type = "Kemuri1N64"; 44 | effect->count = effCount; 45 | data = __memAlloc(HEAP_EFFECT, sizeof(effKemuri1Data) * effCount); 46 | effect->userdata = data; 47 | effect->callback = effKemuri1Main; 48 | switch (type) { 49 | case 0: 50 | case 1: 51 | data->field_0x38 = 0; 52 | data->field_0x4C = 15; 53 | break; 54 | case 2: 55 | data->field_0x38 = 3; 56 | data->field_0x4C = 65; 57 | break; 58 | case 3: 59 | data->field_0x38 = 2; 60 | data->field_0x4C = 129; 61 | case 4: //TODO: -strict off, case 4 ... 7:? 62 | case 5: 63 | case 6: 64 | case 7: 65 | data->field_0x38 = 3; 66 | data->field_0x4C = 65; 67 | break; 68 | default: 69 | break; 70 | } 71 | } 72 | 73 | void effKemuri1Main(EffectEntry* effect) { 74 | 75 | } -------------------------------------------------------------------------------- /source/evt/evt_door.c: -------------------------------------------------------------------------------- 1 | #include "evt/evt_door.h" 2 | #include "pmario_sound.h" 3 | 4 | USERFUNC_DEF(snd_door_in) { 5 | psndSetFlag(0x100); 6 | return EVT_RETURN_DONE; 7 | } 8 | 9 | USERFUNC_DEF(snd_door_out) { 10 | psndClearFlag(0x100); 11 | return EVT_RETURN_DONE; 12 | } 13 | 14 | USERFUNC_DEF(door_entry) { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /source/evt/evt_fade.c: -------------------------------------------------------------------------------- 1 | #include "evt/evt_fade.h" 2 | 3 | USERFUNC_DEF(evt_fade_entry) { 4 | s32* args = event->args; 5 | FadeType type; 6 | s32 duration; 7 | u8 r, g, b; 8 | 9 | type = evtGetValue(event, *args++); 10 | duration = evtGetValue(event, *args++); 11 | r = evtGetValue(event, *args++); 12 | g = evtGetValue(event, *args++); 13 | b = evtGetValue(event, *args++); 14 | fadeEntry(type, duration, (GXColor){r, g, b, 0xFF}); 15 | return EVT_RETURN_DONE; 16 | } -------------------------------------------------------------------------------- /source/evt/evt_lottery.c: -------------------------------------------------------------------------------- 1 | #include "evt/evt_lottery.h" 2 | #include "evt/evt_cmd.h" 3 | #include 4 | 5 | extern GlobalWork* gp; 6 | 7 | //.sbss 8 | BOOL dbg_lotteryinfo; 9 | 10 | //local prototypes 11 | USERFUNC_DEF(evt_lottery); 12 | 13 | lottery_info* lotteryGetPtr(void) { 14 | return &gp->mLotteryInfo; 15 | } 16 | 17 | USERFUNC_DEF(evt_lottery) { 18 | lottery_info* LotteryInfo; 19 | 20 | s32* args = event->args; 21 | s32 arg1 = evtGetValue(event, args[0]); //r25 22 | OSTime start = OSGetTime(); 23 | dbg_lotteryinfo = TRUE; 24 | 25 | LotteryInfo = &gp->mLotteryInfo; 26 | 27 | LotteryInfo->mFlags &= ~0x1000; 28 | LotteryInfo->mFlags &= ~0x2000; 29 | LotteryInfo->mFlags &= ~0x4000; 30 | LotteryInfo->mFlags &= ~0x8000; 31 | 32 | if (LotteryInfo->mFlags & 8) { 33 | 34 | } 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | return EVT_RETURN_DONE; 52 | } 53 | -------------------------------------------------------------------------------- /source/evt/evt_msg.c: -------------------------------------------------------------------------------- 1 | #include "evt/evt_msg.h" 2 | 3 | void evt_msg_init(void) { 4 | //stubbed in retail 5 | } -------------------------------------------------------------------------------- /source/evt/evt_seq.c: -------------------------------------------------------------------------------- 1 | //1:1, very short, TODO: better header 2 | #include "evt/evt_seq.h" 3 | #include "drv/seqdrv.h" 4 | 5 | USERFUNC_DEF(evt_seq_set_seq) { 6 | s32* args = event->args; 7 | SequenceType type; 8 | const char *map, *bero; 9 | 10 | type = evtGetValue(event, args[0]); 11 | map = (const char*)evtGetValue(event, args[1]); 12 | bero = (const char*)evtGetValue(event, args[2]); 13 | seqSetSeq(type, map, bero); 14 | return EVT_RETURN_BLOCK; 15 | } 16 | 17 | USERFUNC_DEF(evt_seq_wait) { 18 | SequenceType current, target; 19 | 20 | target = evtGetValue(event, *event->args); 21 | current = seqGetSeq(); 22 | return (current != target) ? EVT_RETURN_BLOCK : EVT_RETURN_DONE; 23 | } 24 | -------------------------------------------------------------------------------- /source/evt/evt_shop.c: -------------------------------------------------------------------------------- 1 | #include "evt/evt_shop.h" 2 | #include "mario/mariost.h" 3 | #include "memory.h" 4 | #include 5 | 6 | extern GlobalWork* gp; 7 | 8 | //.sbss 9 | char mapname[16]; 10 | static evt_shop_work* _wp; 11 | 12 | USERFUNC_DEF(evt_shop_setup) { 13 | evt_shop_work* work_ptr; 14 | s32 r25, r27, r28, r30; 15 | int i; 16 | 17 | r28 = evtGetValue(event, event->args[0]); 18 | r27 = evtGetValue(event, event->args[1]); 19 | r30 = evtGetValue(event, event->args[2]); 20 | r25 = evtGetValue(event, event->args[3]); 21 | work_ptr = _mapAlloc(sizeof(evt_shop_work)); 22 | memset(work_ptr, 0, sizeof(evt_shop_work)); 23 | _wp = work_ptr; 24 | strncpy(mapname, gp->currentMapName, sizeof(gp->currentMapName) - 1); 25 | work_ptr->field_0x4 = r28; 26 | work_ptr->field_0x8 = r27; 27 | work_ptr->field_0xC = r30; 28 | work_ptr->field_0x10 = r25; 29 | work_ptr->field_0x20 = 6; 30 | for (i = 0; i < work_ptr->field_0x20; i++) { 31 | 32 | } 33 | return EVT_RETURN_DONE; 34 | } -------------------------------------------------------------------------------- /source/evt/evt_snd.c: -------------------------------------------------------------------------------- 1 | #include "evt/evt_snd.h" 2 | #include "pmario_sound.h" 3 | 4 | USERFUNC_DEF(evt_snd_bgmon) { 5 | //psndBGMOn((u32)evt->args[0], (const char*)evt->args[1]); 6 | return EVT_RETURN_DONE; 7 | } 8 | 9 | 10 | 11 | USERFUNC_DEF(evt_snd_sfxon_3d) { 12 | s32* args = event->args; 13 | Vec position; 14 | const char* name; 15 | s32 index; 16 | 17 | name = (const char*)args[0]; 18 | position.x = evtGetFloat(event, args[1]); 19 | position.y = evtGetFloat(event, args[2]); 20 | position.z = evtGetFloat(event, args[3]); 21 | index = args[4]; 22 | if ((index == 0) || ((u32)(index + 0x0EE70000) == 0x4D80U)) { 23 | psndSFXOn_3D(name, &position); 24 | } else { 25 | evtSetValue(event, index, psndSFXOn_3D(name, &position)); 26 | } 27 | return EVT_RETURN_DONE; 28 | } 29 | -------------------------------------------------------------------------------- /source/evt/evt_yuugijou.c: -------------------------------------------------------------------------------- 1 | #include "evt/evt_yuugijou.h" 2 | #include 3 | 4 | PiantaParlorWork yuugijouwork; 5 | PiantaParlorWork* yuwp; 6 | 7 | void yuugijou_init(void) { 8 | yuwp = &yuugijouwork; 9 | memset(yuwp, 0, sizeof(PiantaParlorWork)); 10 | 11 | yuwp->field_0x14 = 1; 12 | yuwp->field_0x18 = 1; 13 | yuwp->field_0x1C = 1; 14 | yuwp->field_0x20 = 1; 15 | yuwp->field_0x24 = 1; 16 | 17 | yuwp->field_0x74 = 0x5B964; 18 | yuwp->field_0x78 = 0x5825A; 19 | yuwp->field_0x7C = 0x4F826; 20 | yuwp->field_0x80 = 0x4C3D8; 21 | yuwp->field_0x84 = 0x4237E; 22 | 23 | yuwp->field_0xD4 = 0xE; 24 | yuwp->field_0xD8 = 0xC; 25 | yuwp->field_0xDC = 0xF; 26 | yuwp->field_0xE0 = 0xB; 27 | yuwp->field_0xE4 = 0xA; 28 | 29 | yuwp->field_0x2C = 1; 30 | yuwp->field_0x30 = 1; 31 | yuwp->field_0x34 = 1; 32 | yuwp->field_0x38 = 1; 33 | yuwp->field_0x3C = 1; 34 | 35 | yuwp->field_0x8C = 2; 36 | yuwp->field_0x90 = 5; 37 | yuwp->field_0x94 = 0x12; 38 | yuwp->field_0x98 = 0x1B; 39 | yuwp->field_0x9C = 0x8A; 40 | 41 | yuwp->field_0xEC = 0xF; 42 | yuwp->field_0xF0 = 0xE; 43 | yuwp->field_0xF4 = 0xE; 44 | yuwp->field_0xF8 = 0xE; 45 | yuwp->field_0xFC = 0xC; 46 | 47 | yuwp->field_0x44 = 1; 48 | yuwp->field_0x48 = 1; 49 | yuwp->field_0x4C = 1; 50 | yuwp->field_0x50 = 1; 51 | yuwp->field_0x54 = 1; 52 | 53 | yuwp->field_0xA4 = 0x20850; 54 | yuwp->field_0xA8 = 0x20436; 55 | yuwp->field_0xAC = 0x20184; 56 | yuwp->field_0xB0 = 0x1F91E; 57 | yuwp->field_0xB4 = 0x1E3AC; 58 | 59 | yuwp->field_0x104 = 0x13; 60 | yuwp->field_0x108 = 0x11; 61 | yuwp->field_0x10C = 0xF; 62 | yuwp->field_0x110 = 0xE; 63 | yuwp->field_0x114 = 8; 64 | 65 | yuwp->field_0x5C = 1; 66 | yuwp->field_0x60 = 1; 67 | yuwp->field_0x64 = 1; 68 | yuwp->field_0x68 = 1; 69 | yuwp->field_0x6C = 1; 70 | 71 | yuwp->field_0xBC = 0x16BDE; 72 | yuwp->field_0xC0 = 0x16968; 73 | yuwp->field_0xC4 = 0x16382; 74 | yuwp->field_0xC8 = 0x1627E; 75 | yuwp->field_0xCC = 0x15950; 76 | 77 | yuwp->field_0x11C = 0x10; 78 | yuwp->field_0x120 = 0xF; 79 | yuwp->field_0x124 = 0xC; 80 | yuwp->field_0x128 = 0xB; 81 | yuwp->field_0x12C = 0xB; 82 | } -------------------------------------------------------------------------------- /source/gxsub.c: -------------------------------------------------------------------------------- 1 | #include "gxsub.h" 2 | 3 | //.sdata 4 | f32 queen_uv[4] = {0.0f, -0.0016000001f, 0.0f, -0.00080000004f}; 5 | 6 | -------------------------------------------------------------------------------- /source/main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "sdk/DEMOInit.h" 3 | #include "system.h" 4 | #include "texPalette.h" 5 | 6 | extern GlobalWork* gp; 7 | 8 | void main(void) { 9 | OSTick base_tick; 10 | 11 | marioStInit(); 12 | marioStMain(); 13 | while (1) { 14 | base_tick = OSGetTick(); 15 | DEMOBeforeRender(); 16 | marioStDisp(); 17 | marioStMain(); 18 | gp->mDeltaGame = OSGetTick() - base_tick; 19 | DEMODoneRender(); 20 | gp->mDeltaRender = OSGetTick() - base_tick; 21 | } 22 | } -------------------------------------------------------------------------------- /source/mario/mario_cam.c: -------------------------------------------------------------------------------- 1 | #include "mario/mario_cam.h" 2 | #include "mario/mario.h" 3 | 4 | s32 marioGetCamId(void) { 5 | return marioGetPtr()->camId; 6 | } -------------------------------------------------------------------------------- /source/mario/mario_party.c: -------------------------------------------------------------------------------- 1 | // the best Mario Party, partners with actual abilities in Paper Mario, 2 | // something Nintendo's forgotten about 3 | #include "mario/mario_party.h" 4 | #include "mario/mario.h" 5 | #include "party.h" 6 | 7 | void partyJoin(MarioPartner partnerId) { 8 | if (partnerId < 8) { 9 | pouchGetPtr()->partyData[partnerId].flags |= 1; //obtained 10 | } 11 | } 12 | 13 | s32 marioGetPartyId(void) { 14 | MarioWork* wp = marioGetPtr(); 15 | PartyEntry* party; 16 | s32 partyId; 17 | 18 | partyId = wp->currPartySlotId[0]; 19 | if (partyId >= 0) { 20 | party = partyGetPtr(partyId); 21 | if ((party != NULL) && !(party->flags & 8)) { 22 | return partyId; 23 | } 24 | } 25 | partyId = wp->currPartySlotId[1]; 26 | if (partyId >= 0) { 27 | party = partyGetPtr(partyId); 28 | if ((party != NULL) && !(party->flags & 8)) { 29 | return partyId; 30 | } 31 | } 32 | return -1; 33 | } 34 | 35 | s32 marioGetExtraPartyId(void) { 36 | MarioWork* wp = marioGetPtr(); 37 | PartyEntry* party; 38 | s32 partyId; 39 | 40 | partyId = wp->currPartySlotId[0]; 41 | if (partyId >= 0) { 42 | party = partyGetPtr(partyId); 43 | if ((party != NULL) && (party->flags & 8)) { 44 | return partyId; 45 | } 46 | } 47 | 48 | partyId = wp->currPartySlotId[1]; 49 | if (partyId >= 0) { 50 | party = partyGetPtr(partyId); 51 | if ((party != NULL) && (party->flags & 8)) { 52 | return partyId; 53 | } 54 | } 55 | return -1; 56 | } -------------------------------------------------------------------------------- /source/mario/mario_sbr.c: -------------------------------------------------------------------------------- 1 | #include "mario/mario_sbr.h" 2 | #include "mario/mario.h" 3 | 4 | //new in retail 5 | void marioSetBottomlessResetPosition(f32 x, f32 y, f32 z) { 6 | MarioWork* wp = marioGetPtr(); 7 | Vec position; 8 | 9 | position = (Vec){x, y + 37.0f, z}; 10 | wp->bottomlessResetPosition = position; 11 | } -------------------------------------------------------------------------------- /source/mgr/arammgr.c: -------------------------------------------------------------------------------- 1 | #include "mgr/arammgr.h" 2 | 3 | //.bss 4 | static ARAMWork work; 5 | 6 | //.sdata 7 | static ARAMWork* wp; 8 | 9 | void aramMgrInit(void) { 10 | 11 | } -------------------------------------------------------------------------------- /source/mot/mot_plane.c: -------------------------------------------------------------------------------- 1 | #include "mot/mot_plane.h" 2 | #include "evt/evt_cmd.h" 3 | #include "evt/evt_snd.h" 4 | #include "mario/mario.h" 5 | #include "memory.h" 6 | #include 7 | 8 | EVT_BEGIN(sound_evt) 9 | USER_FUNC(evt_snd_sfxon_3d, STRING("SFX_MARIO_AIRPLANE1"), LW(0), LW(1), LW(2), 0) 10 | WAIT_FRAMES(12) 11 | USER_FUNC(evt_snd_sfxon_3d, STRING("SFX_MARIO_AIRPLANE1"), LW(0), LW(1), LW(2), 0) 12 | WAIT_FRAMES(12) 13 | USER_FUNC(evt_snd_sfxon_3d, STRING("SFX_MARIO_AIRPLANE1"), LW(0), LW(1), LW(2), 0) 14 | WAIT_FRAMES(12) 15 | USER_FUNC(evt_snd_sfxon_3d, STRING("SFX_MARIO_AIRPLANE1"), LW(0), LW(1), LW(2), 0) 16 | RETURN() 17 | EVT_END() 18 | 19 | void mot_plane(void) { 20 | MarioWork* mario; 21 | MotionPlaneData* data; 22 | 23 | mario = marioGetPtr(); 24 | if (mario->trigFlags & 1) { 25 | mario->trigFlags &= ~1; 26 | mario->motStruct = __memAlloc(HEAP_DEFAULT, sizeof(MotionPlaneData)); 27 | memset(mario->motStruct, 0, sizeof(MotionPlaneData)); 28 | data = marioGetPtr()->motStruct; 29 | data->field_0x28 = -1; 30 | mario->currSubMotionId = 0; 31 | } 32 | switch (mario->currSubMotionId) { 33 | case 0: 34 | //inline start? 35 | mario = marioGetPtr(); 36 | 37 | //inline end? 38 | //marioPreJump(); 39 | break; 40 | } 41 | } 42 | 43 | void flyMain(void) { 44 | MarioWork* mario; 45 | 46 | mario = marioGetPtr(); 47 | switch (mario->currSubMotionId) { 48 | case 0xC: 49 | if (mario->wCamVal1 >= mario->position.y) { 50 | mario->currSubMotionId = 14; 51 | } 52 | //inlined? 53 | mario = marioGetPtr(); 54 | } 55 | } -------------------------------------------------------------------------------- /source/nameent.c: -------------------------------------------------------------------------------- 1 | #include "nameent.h" 2 | #include "system.h" 3 | #include 4 | 5 | //.data 6 | const char* katakana_tbl[] = { 7 | "\x83\x41", "\x83\x43", "\x83\x45", "\x83\x47", "\x83\x49", "\x83\x8F", 8 | "\x81\x40", "\x83\x92", "\x81\x40", "\x83\x93", "\x82\x4F", "\x82\x50", 9 | "\x82\x51", "\x82\x52", "\x83\x4A", "\x83\x4C", "\x83\x4E", "\x83\x50", 10 | "\x83\x52", "\x83\x4B", "\x83\x4D", "\x83\x4F", "\x83\x51", "\x83\x53", 11 | "\x82\x53", "\x82\x54", "\x82\x55", "\x82\x56", "\x83\x54", "\x83\x56", 12 | "\x83\x58", "\x83\x5A", "\x83\x5C", "\x83\x55", "\x83\x57", "\x83\x59", 13 | "\x83\x5B", "\x83\x5D", "\x82\x57", "\x82\x58", "\x81\x49", "\x81\x48", 14 | "\x83\x5E", "\x83\x60", "\x83\x63", "\x83\x65", "\x83\x67", "\x83\x5F", 15 | "\x83\x61", "\x83\x64", "\x83\x66", "\x83\x68", "\x81\x40", "\x94\xB5", 16 | "\x81\x99", "\x81\xF4", "\x83\x69", "\x83\x6A", "\x83\x6B", "\x83\x6C", 17 | "\x83\x6D", "\x83\x6F", "\x83\x72", "\x83\x75", "\x83\x78", "\x83\x7B", 18 | NULL, NULL, NULL, NULL, "\x83\x6E", "\x83\x71", 19 | "\x83\x74", "\x83\x77", "\x83\x7A", "\x83\x70", "\x83\x73", "\x83\x76", 20 | "\x83\x79", "\x83\x7C", NULL, NULL, NULL, NULL, 21 | "\x83\x7D", "\x83\x7E", "\x83\x80", "\x83\x81", "\x83\x82", "\x83\x40", 22 | "\x83\x42", "\x83\x44", "\x83\x46", "\x83\x48", NULL, NULL, 23 | NULL, NULL, "\x83\x84", "\x81\x40", "\x83\x86", "\x81\x40", 24 | "\x83\x88", "\x83\x83", "\x83\x85", "\x83\x87", "\x83\x62", "\x83\x94", 25 | NULL, NULL, NULL, NULL, "\x83\x89", "\x83\x8A", 26 | "\x83\x8B", "\x83\x8C", "\x83\x8D", "\x81\x7C", "\x81\x60", "\x81\x45", 27 | "\x81\x44", "\x81\x40", NULL, NULL, NULL, NULL 28 | }; 29 | const char* hiragana_tbl[] = { 30 | "\x82\xA0", "\x82\xA2", "\x82\xA4", "\x82\xA6", "\x82\xA8", "\x82\xED", 31 | "\x81\x40", "\x82\xF0", "\x81\x40", "\x82\xF1", "\x82\x4F", "\x82\x50", 32 | "\x82\x51", "\x82\x52", "\x82\xA9", "\x82\xAB", "\x82\xAD", "\x82\xAF", 33 | "\x82\xB1", "\x82\xAA", "\x82\xAC", "\x82\xAE", "\x82\xB0", "\x82\xB2", 34 | "\x82\x53", "\x82\x54", "\x82\x55", "\x82\x56", "\x82\xB3", "\x82\xB5", 35 | "\x82\xB7", "\x82\xB9", "\x82\xBB", "\x82\xB4", "\x82\xB6", "\x82\xB8", 36 | "\x82\xBA", "\x82\xBC", "\x82\x57", "\x82\x58", "\x81\x49", "\x81\x48", 37 | "\x82\xBD", "\x82\xBF", "\x82\xC2", "\x82\xC4", "\x82\xC6", "\x82\xBE", 38 | "\x82\xC0", "\x82\xC3", "\x82\xC5", "\x82\xC7", "\x81\x40", "\x94\xB5", 39 | "\x81\x99", "\x81\xF4", "\x82\xC8", "\x82\xC9", "\x82\xCA", "\x82\xCB", 40 | "\x82\xCC", "\x82\xCE", "\x82\xD1", "\x82\xD4", "\x82\xD7", "\x82\xDA", 41 | NULL, NULL, NULL, NULL, "\x82\xCD", "\x82\xD0", 42 | "\x82\xD3", "\x82\xD6", "\x82\xD9", "\x82\xCF", "\x82\xD2", "\x82\xD5", 43 | "\x82\xD8", "\x82\xDB", NULL, NULL, NULL, NULL, 44 | "\x82\xDC", "\x82\xDD", "\x82\xDE", "\x82\xDF", "\x82\xE0", "\x82\x9F", 45 | "\x82\xA1", "\x82\xA3", "\x82\xA5", "\x82\xA7", NULL, NULL, 46 | NULL, NULL, "\x82\xE2", "\x81\x40", "\x82\xE4", "\x81\x40", 47 | "\x82\xE6", "\x82\xE1", "\x82\xE3", "\x82\xE5", "\x82\xC1", "\x89\x4C", 48 | NULL, NULL, NULL, NULL, "\x82\xE7", "\x82\xE8", 49 | "\x82\xE9", "\x82\xEA", "\x82\xEB", "\x81\x7C", "\x81\x60", "\x81\x45", 50 | "\x81\x44", "\x81\x40", NULL, NULL, NULL, NULL 51 | }; 52 | 53 | //.bss 54 | static NameEntryWork work; 55 | 56 | //.sdata 57 | static const char* msg_tbl[] = { 58 | "msg_nameent_1", 59 | "msg_nameent_2", 60 | "msg_nameent_3", 61 | "msg_nameent_3", 62 | "msg_nameent_4" 63 | }; 64 | static NameEntryWork* wp = &work; 65 | 66 | void nameEntInit(void) { 67 | memset(wp, 0, sizeof(NameEntryWork)); 68 | } 69 | 70 | void nameEntReInit(void) { 71 | wp->field_0x4 = 3; 72 | } 73 | 74 | BOOL nameEntPrepare(void) { 75 | return fileAsyncf(4, NULL, "%s/w/jp/name.tpl", getMarioStDvdRoot()) != 0; 76 | } 77 | 78 | void nameEntMain(void) { 79 | 80 | } -------------------------------------------------------------------------------- /source/parse.c: -------------------------------------------------------------------------------- 1 | #include "parse.h" 2 | 3 | //.bss 4 | ParseWork parse; 5 | static u8 buf[128]; 6 | 7 | void parseInit(void* ptr, u32 size) { 8 | parse.ptr = ptr; 9 | parse.field_0x54 = 0; 10 | parse.field_0x4 = 0; 11 | parse.size = size; 12 | } 13 | 14 | 15 | 16 | 17 | 18 | BOOL parsePush(const char* tag) { 19 | 20 | } 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | BOOL parseGet1Next(s32 type, void* data) { 29 | BOOL result; 30 | 31 | if (type == 3) { 32 | result = parseGet1Next(2, data); 33 | result *= parseGet1Next(2, (void*)((u32)data + 4)); 34 | result *= parseGet1Next(2, (void*)((u32)data + 4)); 35 | } 36 | else { 37 | 38 | switch (type) { 39 | default: 40 | return TRUE; 41 | } 42 | } 43 | return result; 44 | } 45 | -------------------------------------------------------------------------------- /source/party/party_vivian.c: -------------------------------------------------------------------------------- 1 | #include "party/party_vivian.h" 2 | 3 | 4 | 5 | 6 | 7 | s32 vivianGetStatus(void) { 8 | return 0; 9 | } -------------------------------------------------------------------------------- /source/sdk/arc.c: -------------------------------------------------------------------------------- 1 | #include "sdk/arc.h" 2 | #include 3 | 4 | typedef struct FSTEntry { 5 | u32 entryInfo; //top byte is 0 file 1 dir, u24 string offset 6 | u32 entryOffsetOrParent; //file = offset, dir = parent index 7 | u32 entrySizeOrNext; //file = size, dir = next entry 8 | } FSTEntry; 9 | 10 | s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path) { 11 | FSTEntry* entry; 12 | u32 currDir, i; 13 | char* ptr; 14 | 15 | currDir = handle->currDir; 16 | entry = (FSTEntry*)handle->FSTStart; 17 | while (1) { 18 | if (*path == '\0') { 19 | return (s32)currDir; 20 | } 21 | else if (*path == '/') { 22 | currDir = 0; 23 | path++; 24 | continue; 25 | } 26 | else if (*path == '.') { 27 | if (*(path + 1) == '.') { 28 | if (*(path + 2) == '/') { 29 | currDir = entry[currDir].entryOffsetOrParent; 30 | path += 3; 31 | continue; 32 | } 33 | else if (*(path + 2) == '\0') { 34 | return (s32)entry[currDir].entryOffsetOrParent; 35 | } 36 | } 37 | else if (*(path + 1) == '/') { 38 | path += 2; 39 | continue; 40 | } 41 | else if (*(path + 1) == '\0') { 42 | return (s32)currDir; 43 | } 44 | } 45 | 46 | for (ptr = (char*)path; (*ptr != '\0') && (*ptr != '/'); ptr++) { 47 | ; 48 | } 49 | 50 | 51 | for (i = entry[currDir++].entryOffsetOrParent; i > currDir; i++) { 52 | 53 | } 54 | return -1; 55 | } 56 | } 57 | 58 | BOOL ARCOpen(ARCHandle* handle, const char* filename, ARCFileInfo* info) { 59 | return FALSE; 60 | } 61 | 62 | BOOL ARCInitHandle(void* arcStart, ARCHandle* handle) { 63 | FSTEntry* entry; 64 | ARCHeader* header; 65 | 66 | header = (ARCHeader*)arcStart; 67 | if (header->magic != 0x55AA382D) { 68 | OSHalt("ARCInitHandle: bad archive format"); 69 | } 70 | handle->archiveStartAddr = arcStart; 71 | entry = (FSTEntry*)((u32)arcStart + header->fstStart); 72 | handle->FSTStart = (void*)entry; //relative->absolute 73 | handle->fileStart = (void*)((u32)arcStart + header->fileStart); //relative->absolute 74 | handle->entryNum = entry->entrySizeOrNext; //entry 0 size is entry count 75 | handle->FSTStringStart = (char*)&entry[handle->entryNum]; 76 | handle->FSTLength = header->fstSize; 77 | handle->currDir = 0; 78 | return TRUE; 79 | } 80 | 81 | void* ARCGetStartAddrInMem(ARCFileInfo* info) { 82 | return NULL; 83 | } 84 | 85 | u32 ARCGetLength(ARCFileInfo* info) { 86 | return 0; 87 | } 88 | 89 | void ARCClose(void) { 90 | 91 | } 92 | -------------------------------------------------------------------------------- /source/seq/seq_e3.c: -------------------------------------------------------------------------------- 1 | #include "seq/seq_e3.h" 2 | #include "drv/fadedrv.h" 3 | #include "mario/mariost.h" 4 | #include "pmario_sound.h" 5 | #include "system.h" 6 | 7 | extern GlobalWork* gp; 8 | 9 | static seq_e3_work work; 10 | static seq_e3_work* wp; 11 | 12 | //local prototypes 13 | void alarm_handler(OSAlarm* alarm, OSContext* context); 14 | 15 | void alarm_handler(OSAlarm* alarm, OSContext* context) { 16 | gp->flags |= 0x2000; 17 | } 18 | 19 | void seq_e3Init(SequenceWork* work) { 20 | wp->handle = fileAllocf(4, "%s/monthry.tpl", getMarioStDvdRoot()); 21 | wp->field_0x4 = 0; 22 | wp->field_0x8 = 0; 23 | wp->field_0xC = 0; 24 | wp->field_0x64 = 270.0f; 25 | OSCreateAlarm(&wp->alarm); 26 | OSSetAlarm(&wp->alarm, OSSecondsToTicks(600), alarm_handler); 27 | wp->field_0x48 = OSGetTime(); //initTime? 28 | gp->flags &= ~2; 29 | gp->flags |= 0x20; 30 | gp->flags |= 0x1000; 31 | gp->flags &= ~0x2000; 32 | fadeEntry(9, 200, (GXColor) {0x00, 0x00, 0x00, 0xFF}); 33 | fadeReset(1); 34 | psndStopAllFadeOut(); 35 | psndBGMOn(0x200, "BGM_FILE_MENU1"); 36 | work->state = 0; 37 | //animGroupBaseAsync("OFF_d_meku", 0, 0); 38 | } 39 | 40 | void seq_e3Exit(SequenceWork* work) { 41 | fileFree(wp->handle); 42 | psndStopAllFadeOut(); 43 | } 44 | 45 | void seq_e3Main(SequenceWork* work) { 46 | 47 | } -------------------------------------------------------------------------------- /source/seq/seq_game.c: -------------------------------------------------------------------------------- 1 | /* "seq_game" - Main Game Sequence 2 | * Status: 1:1, theoretically finished 3 | * 4 | * Function: the sequence running when on the overworld 5 | * 6 | * Last Update: 7/8/2022, finish seq_game 7 | */ 8 | 9 | #include "seq/seq_game.h" 10 | #include "drv/fadedrv.h" 11 | #include "evt/evt_fade.h" 12 | #include "mario/mario.h" 13 | #include "mario/mariost.h" 14 | #include "pmario_sound.h" 15 | 16 | extern GlobalWork* gp; 17 | 18 | static OSTime none_key; 19 | 20 | //.sdata 21 | EVT_BEGIN(maku_spread) 22 | WAIT_MSEC(2000) 23 | USER_FUNC(evt_fade_entry, TITLE_SCREEN_CURTAIN_LEAVE_GRADUAL2, 0, 0, 0, 0) 24 | RETURN() 25 | EVT_END() 26 | 27 | void seq_gameInit(SequenceWork* wp) { 28 | none_key = OSGetTime(); 29 | gp->systemLevelFlags &= ~0x10; 30 | } 31 | 32 | void seq_gameMain(SequenceWork* wp) { 33 | CameraEntry *camera, *camera2; 34 | Vec position; 35 | 36 | switch (wp->state) { 37 | case 0: 38 | if ((gp->flags & 0x10) != 0) { 39 | fadeEntry(FADE_IN_WHITE2, 900, (GXColor){0, 0, 0, 0xFF}); 40 | evtEntryType(maku_spread, 0, 0, 0); 41 | gp->flags &= ~0x10; 42 | } else if (!gp->didAreaChange) { 43 | fadeEntry(gp->mapFadeOutType, gp->mapFadeOutDuration, (GXColor){0, 0, 0, 0xFF}); 44 | } else { 45 | fadeEntry(gp->areaFadeOutType, gp->areaFadeOutDuration, (GXColor){0, 0, 0, 0xFF}); 46 | } 47 | gp->mapFadeOutType = FADE_IN_BLACK; 48 | gp->mapFadeOutDuration = 300; 49 | gp->areaFadeOutType = FADE_IN_BLACK; 50 | gp->areaFadeOutDuration = 300; 51 | wp->state++; 52 | break; 53 | 54 | case 1: 55 | if (gp->flags & 0x1000 && gp->flags & 0x2000 && fadeIsFinish() && seqCheckSeq() == SEQ_LOGO) { 56 | gp->flags &= ~0x2000; 57 | seqSetSeq(SEQ_GAME_OVER, 0, 0); 58 | } 59 | marioGetPtr(); //unused 60 | camera = camGetPtr(CAMERA_3D); 61 | position = camera->cameraPos; 62 | camera2 = camGetPtr(CAMERA_3D); 63 | psndSetPosDirListener(&position, camera2->field_0x114); 64 | break; 65 | } 66 | } 67 | 68 | void seq_gameExit(SequenceWork* wp) { 69 | gp->flags &= ~2; 70 | } -------------------------------------------------------------------------------- /source/seq/seq_mapchange.c: -------------------------------------------------------------------------------- 1 | #include "seq/seq_mapchange.h" 2 | #include "drv/fadedrv.h" 3 | #include "evt/evt_badgeshop.h" 4 | #include "mgr/filemgr.h" 5 | #include "mario/mariost.h" 6 | #include "pmario_sound.h" 7 | #include "system.h" 8 | #include 9 | #include 10 | 11 | extern BadgeShopWork* bdsw; 12 | extern GlobalWork* gp; 13 | extern BOOL dbg_lotteryinfo; //evt_lottery 14 | 15 | //.sbss 16 | char _next_bero[0x20]; 17 | char _next_map[0x20]; 18 | char _next_area[0x20]; 19 | 20 | void seq_mapChangeMain(SequenceWork* work) { 21 | /* 22 | BOOL newarea; 23 | char* area_name; 24 | 25 | newarea = strcmp(_next_area, gp->mCurrentAreaName) != 0; 26 | switch (work->field_0x4) { 27 | case 0: 28 | if (strcmp(_next_map, "sys_01")) { 29 | if (newarea) { 30 | fadeEntry(gp->mNextAreaChangeFadeInType, gp->mNextAreaChangeFadeInDuration, (GXColor) { 0, 0, 0, 0xFF }); 31 | } 32 | else { 33 | fadeEntry(gp->mNextMapChangeFadeInType, gp->mNextMapChangeFadeInDuration, (GXColor) { 0, 0, 0, 0xFF }); 34 | } 35 | } 36 | else { 37 | if (gp->mNextAreaChangeFadeInType != 10) { 38 | fadeEntry(gp->mNextAreaChangeFadeInType, gp->mNextAreaChangeFadeInDuration, (GXColor) { 0, 0, 0, 0xFF }); 39 | } 40 | fadeEntry(17, 2000, (GXColor) { 0, 0, 0, 0xFF }); 41 | } 42 | gp->mNextMapChangeFadeInType = 10; 43 | gp->mNextMapChangeFadeInDuration = 300; 44 | gp->mNextAreaChangeFadeInType = 10; 45 | gp->mNextAreaChangeFadeInDuration = 300; 46 | psndSFXAllOff(); 47 | gp->mbAreaChanged = newarea; 48 | if (strcmp(_next_map, "tou_03")) { 49 | area_name = _next_area; 50 | if (!strcmp(_next_area, "tou")) { 51 | if (seqGetSeq() == 1) { 52 | area_name = "tou2"; 53 | } 54 | else if (!strcmp(_next_map, "tou_03")) { 55 | area_name = "tou2"; 56 | } 57 | } 58 | fileAsyncf(0, 0, "%s/rel/%s.rel", getMarioStDvdRoot(), area_name); 59 | } 60 | work->field_0x4++; 61 | break; 62 | 63 | case 1: 64 | psndSFXAllOff(); 65 | if (fadeIsFinish()) { 66 | if (gp->mpRelFileBase) { 67 | ((void(*)(void))gp->mpRelFileBase->epilog)(); 68 | OSUnlink(&gp->mpRelFileBase->info); 69 | } 70 | } 71 | break; 72 | }*/ 73 | } 74 | 75 | void seq_mapChangeExit(SequenceWork* work) { 76 | GXResetOverflowCount(); 77 | dbg_lotteryinfo = FALSE; 78 | } 79 | 80 | void seq_mapChangeInit(SequenceWork* work) { 81 | strcpy(_next_area, ""); 82 | strcpy(_next_map, ""); 83 | strcpy(_next_bero, ""); 84 | if (work->mapName) { 85 | strncpy(_next_area, work->mapName, 3); 86 | strncpy(_next_map, work->mapName, 0x20); 87 | } 88 | if (work->beroName) { 89 | strncpy(_next_bero, work->beroName, 0x20); 90 | } 91 | psndENVOff(0x200); 92 | psndENVOff(0x201); 93 | if (strcmp(gp->currentMapName, "") && 94 | strcmp(gp->currentMapName, "gor_01") && 95 | strcmp(_next_map, "gor_01")) 96 | { 97 | bdsw->field_0x114 |= 1; 98 | } 99 | else if (!strcmp(_next_map, "gor_01") && 100 | bdsw->field_0x114 & 1) 101 | { 102 | badgeShop_bargainGeneration(); 103 | badgeShop_bottakuruGeneration(); 104 | bdsw->field_0x114 &= 0xFFFE; 105 | } 106 | } -------------------------------------------------------------------------------- /source/seq/seq_title.c: -------------------------------------------------------------------------------- 1 | #include "seq/seq_title.h" 2 | #include "drv/animdrv.h" 3 | #include "drv/camdrv.h" 4 | #include "mario/mariost.h" 5 | #include "pmario_sound.h" 6 | #include "sound.h" 7 | #include "system.h" 8 | #include 9 | #include 10 | 11 | extern SoundWork sound; 12 | extern PaperSoundBGM psbgm[2]; 13 | extern GlobalWork* gp; 14 | 15 | TitleWork work2; 16 | TitleWork* wp2 = &work2; 17 | 18 | //local prototypes 19 | void titleInit(SequenceWork* work); 20 | void titleMain(SequenceWork* work); 21 | 22 | const char* DbgBtlSel_GetMsgDataPtr(void) { 23 | return NULL; 24 | } 25 | 26 | void seq_titleInit(SequenceWork* work) { 27 | titleInit(work); 28 | gp->flags &= ~2; 29 | gp->flags &= ~0x40; 30 | gp->flags &= ~0x20; 31 | gp->flags &= ~0x1000; 32 | } 33 | 34 | void seq_titleExit(SequenceWork* work) { 35 | fileFree(wp2->texture); 36 | if (seqGetNextSeq() != SEQ_LOAD) { 37 | psndStopAllFadeOut(); 38 | } 39 | } 40 | 41 | void seq_titleMain(SequenceWork* work) { 42 | titleMain(work); 43 | } 44 | 45 | s32 getDebugMode(void) { 46 | return wp2->debug; 47 | } 48 | 49 | void titleInit(SequenceWork* work) { 50 | memset(wp2, 0, sizeof(TitleWork)); 51 | wp2->texture = fileAllocf(4, "%s/mariost.tpl", getMarioStDvdRoot()); 52 | wp2->field_0xC = 0.0f; 53 | wp2->field_0x10 = 1000.0f; 54 | wp2->field_0x14 = 0.0f; 55 | wp2->field_0x18 = -1000.0f; 56 | wp2->field_0x1C = 0.0f; 57 | wp2->debug = 0; 58 | if (seqGetPrevSeq() == SEQ_LOAD) { 59 | psndSFXAllOff(); 60 | } 61 | else if (seqGetPrevSeq() != SEQ_LOGO) { 62 | if (seqGetPrevSeq() == SEQ_MAP_CHANGE) { 63 | psndBGMOff_f_d(512, 3000, 0); 64 | psndBGMOff_f_d(513, 3000, 0); 65 | psndSFXAllOff(); 66 | } 67 | else if (seqGetPrevSeq() == SEQ_GAME_OVER) { 68 | psndStopAllFadeOut(); 69 | } 70 | } 71 | if (seqGetPrevSeq() != SEQ_LOAD) { 72 | if (seqGetPrevSeq() == SEQ_GAME_OVER) { 73 | if (OSGetSoundMode()) { 74 | SoundSetOutputMode(SND_OUTPUTMODE_STEREO); 75 | } 76 | else { 77 | SoundSetOutputMode(SND_OUTPUTMODE_MONO); 78 | } 79 | psndBGMOn(0x200, "BGM_DIGEST1"); 80 | if (psbgm[0].streamId != -1) { 81 | sound.streams[psbgm[0].streamId].flags |= 0x8000; 82 | } 83 | } 84 | else { 85 | psndBGMOn(0x200, "BGM_TITLE1"); 86 | if (psbgm[0].streamId != -1) { 87 | sound.streams[psbgm[0].streamId].flags |= 0x8000; 88 | } 89 | } 90 | } 91 | camGetPtr(CAMERA_2D)->flags &= ~0x100; 92 | camGetPtr(CAMERA_2D)->flags |= 0x400; 93 | } 94 | 95 | void titleMain(SequenceWork* work) { 96 | switch (wp2->field_0x8) { 97 | case 0: 98 | if (psndBGMStartCheck(0) 99 | && animGroupBaseAsync("OFF_d_maku_left_right", 2, 0) 100 | && animGroupBaseAsync("OFF_d_maku_center", 2, 0)) 101 | { 102 | 103 | } 104 | break; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /source/seq/seqdef.c: -------------------------------------------------------------------------------- 1 | #include "drv/seqdrv.h" 2 | #include "seq/seq_logo.h" 3 | 4 | extern void seq_gameInit(SequenceWork* work); //2 5 | extern void seq_gameMain(SequenceWork* work); 6 | 7 | extern void seq_e3Init(SequenceWork* work); //7 8 | extern void seq_e3Main(SequenceWork* work); 9 | extern void seq_e3Exit(SequenceWork* work); 10 | 11 | SequenceCallback seq_data[8][3] = { 12 | {seq_logoInit, seq_logoMain, seq_logoExit}, 13 | {NULL, NULL, NULL}, 14 | {seq_gameInit, seq_gameMain, NULL}, 15 | {NULL, NULL, NULL}, 16 | {NULL, NULL, NULL}, 17 | {NULL, NULL, NULL}, 18 | {NULL, NULL, NULL}, 19 | {seq_e3Init, seq_e3Main, seq_e3Exit}, 20 | }; -------------------------------------------------------------------------------- /source/texPalette.c: -------------------------------------------------------------------------------- 1 | /* "texPalette" - Texture Palette Library (TPL) 2 | * Status: Complete, not 1:1 (need to remove entry in UnpackTexPalette? and 3 | * add inlining for TEXGet in first line of TEXGetGXTexObjFromPalette and 4 | * add perfect line numbering for OSHalt, technically) 5 | * 6 | * Function: used for parsing TPL files 7 | */ 8 | #include "texPalette.h" 9 | 10 | void TEXGetGXTexObjFromPalette(TPLHeader* header, GXTexObj* obj, u32 id) { 11 | TPLImageHeader* image = TEXGet(header, id)->image; 12 | 13 | GXInitTexObj( 14 | obj, 15 | image->data, 16 | image->width, 17 | image->height, 18 | image->format, 19 | image->wrapS, 20 | image->wrapT, 21 | (GXBool)(image->minLOD != image->maxLOD) 22 | ); 23 | 24 | GXInitTexObjLOD( 25 | obj, 26 | image->minFilter, 27 | image->magFilter, 28 | image->minLOD, 29 | image->maxLOD, 30 | image->LODBias, 31 | GX_DISABLE, 32 | image->edgeLODEnable, 33 | GX_ANISO_1 34 | ); 35 | } 36 | 37 | TPLImageEntry* TEXGet(TPLHeader* header, u32 id) { 38 | return &header->imageTable[id]; 39 | } 40 | 41 | void UnpackTexPalette(TPLHeader* header) { 42 | TPLImageEntry* entry; 43 | u16 i; //not int 44 | 45 | if (header->version != 0x0020AF30) { 46 | OSHalt("invalid version number for texture palette"); 47 | } 48 | if (header->imageTableOffset <= 0x80000000) { //max file size 49 | header->imageTableOffset += (u32)header; //absolute position 50 | for (i = 0; i < header->imageCount; i++) { 51 | entry = &header->imageTable[i]; 52 | if (entry->image != NULL) { 53 | entry->imageOffset += (u32)header; //absolute position 54 | if (!entry->image->unpacked) { 55 | entry->image->dataOffset += (u32)header; 56 | entry->image->unpacked = TRUE; 57 | } 58 | } 59 | if (entry->palette != NULL) { 60 | entry->paletteOffset += (u32)header; //absolute position 61 | if (!entry->palette->unpacked) { 62 | entry->palette->dataOffset += (u32)header; 63 | entry->palette->unpacked = TRUE; 64 | } 65 | } 66 | } 67 | } 68 | } --------------------------------------------------------------------------------