├── .gitattributes ├── .github └── workflows │ ├── build.yml │ ├── frogress.yml │ └── progress.yml ├── .gitignore ├── README.md ├── config ├── checksum.sha1 ├── readme.md ├── sly1.yaml ├── sly1_may19.yaml ├── symbol_addrs.txt ├── symbol_addrs_may19.txt └── symbol_addrs_old.txt ├── configure.py ├── disc └── readme.md ├── docs ├── BEGINNERSGUIDE.md ├── CONTRIBUTING.md ├── STYLEGUIDE.md └── logo.png ├── include ├── 989snd.h ├── ac.h ├── act.h ├── actseg.h ├── alarm.h ├── alo.h ├── aseg.h ├── asega.h ├── barrier.h ├── bas.h ├── basic.h ├── bbmark.h ├── bez.h ├── binoc.h ├── bis.h ├── blend.h ├── blip.h ├── bomb.h ├── bq.h ├── break.h ├── brx.h ├── bsp.h ├── button.h ├── cat.h ├── cd.h ├── chkpnt.h ├── cid.h ├── clip.h ├── clock.h ├── cm.h ├── cnvo.h ├── coin.h ├── common.h ├── cplcy.h ├── credit.h ├── crout.h ├── crusher.h ├── crv.h ├── dart.h ├── dartgun.h ├── dialog.h ├── difficulty.h ├── dl.h ├── dmas.h ├── dysh.h ├── dzg.h ├── emitter.h ├── ensure.h ├── eyes.h ├── fader.h ├── find.h ├── flash.h ├── fly.h ├── font.h ├── freeze.h ├── frm.h ├── frzg.h ├── game.h ├── gcc │ └── math.h ├── geom.h ├── gifs.h ├── glbs.h ├── glob.h ├── gomer.h ├── gs.h ├── hide.h ├── hnd.h ├── ik.h ├── include_asm.h ├── jlo.h ├── joy.h ├── jsg.h ├── jt.h ├── jump.h ├── keyhole.h ├── labels.inc ├── landing.h ├── lgn.h ├── lib │ └── libkernl │ │ └── filestub.h ├── light.h ├── lo.h ├── lookat.h ├── macro.inc ├── mark.h ├── mat.h ├── mb.h ├── memcard.h ├── memory.h ├── missile.h ├── mpeg.h ├── mq.h ├── mrkv.h ├── ms.h ├── murray.h ├── oid.h ├── path.h ├── phasemem.h ├── pipe.h ├── pnt.h ├── po.h ├── prog.h ├── proxy.h ├── puffer.h ├── pzo.h ├── rail.h ├── rat.h ├── rchm.h ├── render.h ├── rip.h ├── rog.h ├── rs.h ├── rumble.h ├── rwm.h ├── save.h ├── sb.h ├── sce │ ├── libdma.h │ ├── memset.h │ └── rand.h ├── screen.h ├── sdk │ ├── ee │ │ ├── eekernel.h │ │ ├── eestruct.h │ │ ├── libpad.h │ │ └── sifrpc.h │ └── libcdvd.h ├── sensor.h ├── shadow.h ├── shape.h ├── shd.h ├── shdanim.h ├── sky.h ├── slotheap.h ├── sm.h ├── smartguard.h ├── so.h ├── solve.h ├── sort.h ├── sound.h ├── spaprops.h ├── speaker.h ├── spire.h ├── splice │ ├── bif.h │ ├── eval.h │ ├── frame.h │ ├── gc.h │ ├── method.h │ ├── pair.h │ ├── proc.h │ ├── ref.h │ ├── serialize.h │ ├── sidebag.h │ ├── spliceutils.h │ ├── splotheap.h │ └── vecmat.h ├── splicemap.h ├── spliceobj.h ├── sprbuf.h ├── sqtr.h ├── step.h ├── stepact.h ├── stepcane.h ├── stepguard.h ├── stephang.h ├── stephide.h ├── steppipe.h ├── steppower.h ├── steprail.h ├── steprun.h ├── stepside.h ├── stepzap.h ├── stream.h ├── suv.h ├── sw.h ├── tail.h ├── tank.h ├── target.h ├── text.h ├── thread.h ├── tn.h ├── transition.h ├── turret.h ├── tv.h ├── types.h ├── ub.h ├── ui.h ├── update.h ├── util.h ├── vb.h ├── vec.h ├── vifs.h ├── vis.h ├── vol.h ├── vtables.h ├── water.h ├── waypoint.h ├── wipe.h ├── wm.h ├── wr.h ├── xform.h └── zap.h ├── reference ├── include │ ├── alo.h │ ├── aseg.h │ ├── bif.h │ ├── bis.h │ ├── cat.h │ ├── dl.h │ ├── font.h │ ├── frm.h │ ├── game.h │ ├── gc.h │ ├── gs.h │ ├── joy.h │ ├── lo.h │ ├── mpeg.h │ ├── readme.txt │ ├── ref.h │ ├── screen.h │ ├── sensor.h │ ├── so.h │ ├── sound.h │ ├── speaker.h │ ├── sw.h │ ├── transition.h │ ├── vec.h │ └── wipe.h ├── readme.md └── src │ └── P2 │ ├── cat.c │ ├── cd.c │ ├── mpeg.c │ └── wipe.c ├── requirements.txt ├── scripts ├── build.sh ├── checks.sh ├── codematcher │ ├── match_all.sh │ ├── match_file.sh │ └── match_function_live.sh ├── frogress │ ├── mapfile_progress.sh │ └── upload_progress.py ├── quickstart.sh ├── readme.md ├── run.sh ├── setup_prodg_linux.sh └── windows │ ├── backup_registry.bat │ ├── prodg_env.reg │ ├── run.bat │ └── setup_prodg_windows.bat ├── src ├── P2 │ ├── 989snd.c │ ├── ac.c │ ├── act.c │ ├── actseg.c │ ├── alarm.c │ ├── alo.c │ ├── aseg.c │ ├── asega.c │ ├── barrier.c │ ├── bas.c │ ├── basic.c │ ├── bbmark.c │ ├── bez.c │ ├── binoc.c │ ├── bis.c │ ├── blend.c │ ├── blip.c │ ├── bomb.c │ ├── bq.c │ ├── break.c │ ├── brx.c │ ├── bsp.c │ ├── button.c │ ├── cat.c │ ├── cd.c │ ├── chkpnt.c │ ├── clip.c │ ├── clock.c │ ├── cm.c │ ├── cnvo.c │ ├── coin.c │ ├── cplcy.c │ ├── credit.c │ ├── crout.c │ ├── crusher.c │ ├── crv.c │ ├── dart.c │ ├── dartgun.c │ ├── dialog.c │ ├── difficulty.c │ ├── dl.c │ ├── dmas.c │ ├── dysh.c │ ├── dzg.c │ ├── emitter.c │ ├── eyes.c │ ├── fader.c │ ├── find.c │ ├── flash.c │ ├── fly.c │ ├── font.c │ ├── freeze.c │ ├── frm.c │ ├── frzg.c │ ├── game.c │ ├── geom.c │ ├── gifs.c │ ├── glbs.c │ ├── glob.c │ ├── gomer.c │ ├── gs.c │ ├── hide.c │ ├── hnd.c │ ├── ik.c │ ├── jlo.c │ ├── joy.c │ ├── jsg.c │ ├── jt.c │ ├── jump.c │ ├── keyhole.c │ ├── landing.c │ ├── lgn.c │ ├── light.c │ ├── lo.c │ ├── lookat.c │ ├── main.c │ ├── mark.c │ ├── mat.c │ ├── mb.c │ ├── memory.c │ ├── missile.c │ ├── mpeg.c │ ├── mrkv.c │ ├── ms.c │ ├── murray.c │ ├── path.c │ ├── phasemem.c │ ├── pipe.c │ ├── pnt.c │ ├── po.c │ ├── prog.c │ ├── proxy.c │ ├── puffer.c │ ├── pzo.c │ ├── rail.c │ ├── rat.c │ ├── rchm.c │ ├── render.c │ ├── rip.c │ ├── rog.c │ ├── rumble.c │ ├── rwm.c │ ├── screen.c │ ├── sensor.c │ ├── shadow.c │ ├── shape.c │ ├── shd.c │ ├── shdanim.c │ ├── sky.c │ ├── slotheap.c │ ├── sm.c │ ├── smartguard.c │ ├── so.c │ ├── solve.c │ ├── sort.c │ ├── sound.c │ ├── speaker.c │ ├── spire.c │ ├── splice │ │ ├── bif.cpp │ │ ├── eval.cpp │ │ ├── gc.cpp │ │ ├── method.cpp │ │ ├── pair.cpp │ │ ├── proc.cpp │ │ ├── ref.cpp │ │ ├── serialize.cpp │ │ ├── sidebag.cpp │ │ ├── spliceutils.cpp │ │ ├── splotheap.cpp │ │ └── vecmat.cpp │ ├── splicemap.c │ ├── spliceobj.c │ ├── sprbuf.c │ ├── sqtr.c │ ├── step.c │ ├── stepact.c │ ├── stepcane.c │ ├── stepguard.c │ ├── stephang.c │ ├── stephide.c │ ├── steppipe.c │ ├── steppower.c │ ├── steprail.c │ ├── steprun.c │ ├── stepside.c │ ├── stream.c │ ├── suv.c │ ├── sw.c │ ├── tail.c │ ├── tank.c │ ├── target.c │ ├── text.c │ ├── thread.c │ ├── tn.c │ ├── transition.c │ ├── turret.c │ ├── tv.c │ ├── ub.c │ ├── ui.c │ ├── update.c │ ├── util.c │ ├── vec.c │ ├── vifs.c │ ├── vis.c │ ├── water.c │ ├── waypoint.c │ ├── wipe.c │ ├── wm.c │ ├── wr.c │ ├── xform.c │ └── zap.c └── readme.md └── tools ├── codematcher ├── CodeMatcher.exe ├── LICENSE.txt ├── README.md ├── codematcher ├── ghidra_tips.txt ├── match_all.cmd └── match_single.cmd └── objdiff ├── LICENSE ├── objdiff-cli └── objdiff-cli-linux-x86_64 /.gitattributes: -------------------------------------------------------------------------------- 1 | *.h linguist-language=C++ 2 | *.c linguist-language=C++ 3 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build project and validate checksum 2 | 3 | on: 4 | push: 5 | branches: 6 | - "*" 7 | 8 | jobs: 9 | build: 10 | if: github.repository_owner == 'theonlyzac' 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: "3.x" 20 | 21 | - name: Install dependencies 22 | run: | 23 | python -m pip install --upgrade pip 24 | pip install -U -r requirements.txt 25 | 26 | - name: Setup wine 27 | run: | 28 | sudo dpkg --add-architecture i386 29 | sudo apt-get update 30 | sudo apt-get install wine32 31 | 32 | - name: Setup build environment 33 | run: | 34 | sudo apt-get install binutils-mips-linux-gnu 35 | scripts/setup_prodg_linux.sh 36 | curl -o disc/SCUS_971.98 "${{ secrets.FILE_URL }}" 37 | 38 | - name: Run build script 39 | run: | 40 | python configure.py 41 | ninja 42 | -------------------------------------------------------------------------------- /.github/workflows/frogress.yml: -------------------------------------------------------------------------------- 1 | name: Post mapfile_parser progress to Frogress endpoint 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - progress 8 | 9 | jobs: 10 | frogress-upload: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: "3.9.x" 20 | 21 | - name: Install dependencies 22 | run: | 23 | python -m pip install --upgrade pip 24 | pip install -U -r requirements.txt 25 | 26 | - name: Setup wine 27 | run: | 28 | sudo dpkg --add-architecture i386 29 | sudo apt-get update 30 | sudo apt-get install wine32 31 | 32 | - name: Setup build environment 33 | run: | 34 | sudo apt-get install binutils-mips-linux-gnu 35 | scripts/setup_prodg_linux.sh 36 | curl -o disc/SCUS_971.98 "${{ secrets.FILE_URL }}" 37 | 38 | - name: Run build script 39 | run: | 40 | python configure.py 41 | ninja 42 | 43 | - name: Post to frogress endpoint 44 | run: | 45 | python3 scripts/frogress/upload_progress.py --frogress_api_key ${{ secrets.FROGRESS_API_KEY }} 46 | -------------------------------------------------------------------------------- /.github/workflows/progress.yml: -------------------------------------------------------------------------------- 1 | name: Upload objdiff report for Decomp.dev bot 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - progress 8 | 9 | jobs: 10 | report-upload: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Checkout Repository 15 | uses: actions/checkout@v4 16 | 17 | - name: Set up Python 18 | uses: actions/setup-python@v2 19 | with: 20 | python-version: "3.9.x" 21 | 22 | - name: Install dependencies 23 | run: | 24 | python -m pip install --upgrade pip 25 | pip install -U -r requirements.txt 26 | 27 | - name: Setup wine 28 | run: | 29 | sudo dpkg --add-architecture i386 30 | sudo apt-get update 31 | sudo apt-get install wine32 32 | 33 | - name: Setup build environment 34 | run: | 35 | sudo apt-get install binutils-mips-linux-gnu 36 | scripts/setup_prodg_linux.sh 37 | curl -o disc/SCUS_971.98 "${{ secrets.FILE_URL }}" 38 | 39 | - name: Configure and generate report 40 | run: | 41 | python configure.py --objects 42 | ninja 43 | ./tools/objdiff/objdiff-cli report generate > report.json 44 | 45 | - name: Upload Artifact 46 | uses: actions/upload-artifact@v4 47 | with: 48 | name: SCUS_971.98_report 49 | path: ./report.json 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Project-specific files 2 | SCUS_971.98 3 | *[Ss][Cc][Uu][Ss]* 4 | *971*98* 5 | SCUS_*.* 6 | *.elf 7 | disc/* 8 | reference/* 9 | 10 | # Objdiff 11 | objdiff.json 12 | report.json 13 | 14 | # Compiler 15 | prodg* 16 | tools/cc/ 17 | usr/ 18 | 19 | # Splat 20 | splat/ 21 | assets/ 22 | asm/ 23 | undefined_funcs_auto.txt 24 | undefined_syms_auto.txt 25 | .splache 26 | .ninja_log 27 | *.ninja 28 | permuter_settings.toml 29 | 30 | # Documentation 31 | html/ 32 | 33 | ## MacOS 34 | .DS_Store 35 | 36 | ## Linux 37 | *.swp 38 | 39 | ## WSL 40 | *:Zone.Identifier 41 | 42 | ## Binary/object products 43 | **/bin/ 44 | **/obj/ 45 | 46 | ## Clang-tooling things 47 | **/compile_commands.json 48 | 49 | # Compiled Object files 50 | *.slo 51 | *.lo 52 | *.o 53 | *.obj 54 | 55 | # Precompiled Headers 56 | *.gch 57 | *.pch 58 | 59 | # Compiled Dynamic libraries 60 | *.so 61 | *.dylib 62 | *.dll 63 | 64 | # Compiled Static libraries 65 | *.lai 66 | *.la 67 | *.a 68 | *.lib 69 | 70 | # Executables 71 | *.exe 72 | *.out 73 | *.app 74 | *.elf 75 | 76 | # Linker scripts 77 | *.ld 78 | 79 | # Python 80 | env/ 81 | __pycache__/ 82 | *.pyc 83 | 84 | # Miscellaneous 85 | .vscode 86 | temp/ 87 | *.diff 88 | -------------------------------------------------------------------------------- /config/checksum.sha1: -------------------------------------------------------------------------------- 1 | 57dc305db57932ad3f1122966cdb695d2e62a47a out/SCUS_971.98 2 | -------------------------------------------------------------------------------- /disc/readme.md: -------------------------------------------------------------------------------- 1 | # Disc Files 2 | 3 | This directory is intentionally left empty. It is where you should place files you extract from your own copy of the game. The files you will need are: 4 | - `SCUS_971.98` - The original executable of the game. This file is required to build the project. 5 | 6 | Extract your original ELF file and place it in this directory before building the project. 7 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheOnlyZac/sly1/83bca036bf791a41262a037fa8fd45edfaf2db8a/docs/logo.png -------------------------------------------------------------------------------- /include/actseg.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file actseg.h 3 | * 4 | * @brief Declarations for actor segments. 5 | */ 6 | #ifndef ACTSEG_H 7 | #define ACTSEG_H 8 | 9 | #include "common.h" 10 | 11 | // ... 12 | 13 | #endif // ACTSEG_H 14 | -------------------------------------------------------------------------------- /include/asega.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file asega.h 3 | */ 4 | #ifndef ASEGA_H 5 | #define ASEGA_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @class ANIMATION_SEGMENT_APPLICATION 12 | * @brief Unknown. 13 | */ 14 | struct ASEGA : public BASIC 15 | { 16 | /* 0x08 */ STRUCT_PADDING(7); 17 | /* 0x24 */ char fHandsOff; 18 | // ... 19 | }; 20 | 21 | // ... 22 | 23 | void RetractAsega(ASEGA *pasega); 24 | 25 | #endif // ASEGA_H 26 | -------------------------------------------------------------------------------- /include/barrier.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file barrier.h 3 | */ 4 | #ifndef BARRIER_H 5 | #define BARRIER_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | // Forward. 11 | struct XP; 12 | 13 | /** 14 | * @brief Barrier. 15 | * @todo Implement the struct. 16 | */ 17 | struct BARRIER : public SO 18 | { 19 | // ... 20 | /* 0x554 */ int coid; 21 | /* 0x558 */ OID aoid[4]; 22 | /* 0x568 */ int ccid; 23 | /* 0x56c */ CID acid[4]; 24 | // ... 25 | }; 26 | 27 | void InitBarrier(BARRIER *pbarrier); 28 | 29 | void CloneBarrier(BARRIER *pbarrier, BARRIER *pbarrierBase); 30 | 31 | void PostBarrierLoad(BARRIER *pbarrier); 32 | 33 | void UpdateBarrier(BARRIER *pbarrier, float dt); 34 | 35 | int FIgnoreBarrierIntersection(BARRIER *pbarrier, SO *psoOther); 36 | 37 | void NotifyBarrierImpact(BARRIER *pbarrier, XP *pxp, int ixpd); 38 | 39 | void AddBarrierObject(BARRIER *pbarrier, OID oid); 40 | 41 | void AddBarrierClass(BARRIER *pbarrier, CID cid); 42 | 43 | #endif // BARRIER_H 44 | -------------------------------------------------------------------------------- /include/basic.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file basic.h 3 | * 4 | * @brief Basic object. 5 | */ 6 | #ifndef BASIC_H 7 | #define BASIC_H 8 | 9 | #include "common.h" 10 | #include 11 | 12 | /** 13 | * @class BASIC 14 | * @brief Base object for most other kinds of objects. 15 | */ 16 | struct BASIC 17 | { 18 | union 19 | { 20 | /* 0x00 */ VTBASIC *pvtbasic; 21 | /* 0x00 */ VTLO *pvtlo; 22 | }; 23 | /* 0x04 */ CSidebag *psidebag; 24 | }; 25 | 26 | /** 27 | * @brief Check if the basic object is derived from the given class ID. 28 | * 29 | * @param pbasic The object. 30 | * @param cid The class ID to check. 31 | * 32 | * @retval 1 if the object is derived from the class. 33 | * @retval 0 if the object is not derived from the class. 34 | */ 35 | int FIsBasicDerivedFrom(BASIC *pbasic, CID cid); 36 | 37 | /** 38 | * @brief Check if the basic has a sidebag, and if not, create one. 39 | * 40 | * @param pbasic The object. 41 | */ 42 | void EnsureBasicSidebag(BASIC *pbasic); 43 | 44 | /** 45 | * @brief Get the basic object's CID. 46 | * 47 | * @param pbasic The object. 48 | * @param pcid Return CID. 49 | */ 50 | void GetBasicCid(BASIC *pbasic, CID *pcid); 51 | 52 | #endif // BASIC_H 53 | -------------------------------------------------------------------------------- /include/bbmark.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file bbmark.h 3 | */ 4 | #ifndef BBMARK_H 5 | #define BBMARK_H 6 | 7 | #include "common.h" 8 | 9 | typedef int GRFPVA; 10 | 11 | // Forward. 12 | struct SW; 13 | struct SO; 14 | 15 | // TODO: Implement structs. 16 | struct XP; 17 | struct OXA; 18 | struct OXF; 19 | 20 | /** 21 | * @brief Unknown. 22 | */ 23 | struct OX 24 | { 25 | XP *pxp; 26 | OX *poxNext; 27 | OX *poxOther; 28 | SO *psoOther; 29 | }; 30 | 31 | /** 32 | * @brief Unknown. 33 | */ 34 | struct OXA 35 | { 36 | OX *pox; 37 | SO *pso; 38 | OXA *poxaNext; 39 | OXA *poxaPrev; 40 | }; 41 | 42 | void UpdateSwPox(SW *psw, OXA *poxa0, OXA *poxa1, OXF oxfAdd, OXF oxfRemove); 43 | 44 | OX *PoxAddSw(SW *psw, OXA *poxa, OXA *poxaOther); 45 | 46 | OX *PoxRemoveSw(SW *psw, OXA *poxa, OXA *poxaOther); 47 | 48 | OX *PoxFromSoSo(SO *pso, SO *psoOther); 49 | 50 | XP *PxpFirstFromSoSo(SO *pso, SO *psoOther); 51 | 52 | void AddSwAaobrObject(SW *psw, SO *pso); 53 | 54 | void RemoveSwAaobrObject(SW *psw, SO *pso); 55 | 56 | void InvalidateSwAaox(SW *psw); 57 | 58 | void UpdateSwAaox(SW *psw); 59 | 60 | void InvalidateSwXpForObject(SW *psw, SO *pso, GRFPVA grfpvaInvalid); 61 | 62 | void RecalcSwXpAll(SW *psw, int fCenterXp); 63 | 64 | void RecalcSwOxfFilterForObject(SW *psw, SO *pso); 65 | 66 | #endif // BBMARK_H 67 | -------------------------------------------------------------------------------- /include/bez.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file bez.h 3 | * 4 | * @brief Bezier curves. 5 | * 6 | * @todo Add function parameters and documentation. 7 | */ 8 | #ifndef BEZ_H 9 | #define BEZ_H 10 | 11 | #include "common.h" 12 | #include 13 | #include 14 | 15 | void EvaluateBezierWeightedFloat(float, float, float, float, float, float, float, float, float, float *, float *, float *); 16 | void EvaluateBezierFloat(float, float, float, float, float, float, float, float *, float *, float *); 17 | void EvaluateBezierPos(float, float, float, VECTOR *, VECTOR *, VECTOR *, VECTOR *, VECTOR *, VECTOR *, VECTOR *); 18 | void EvaluateBezierMat(float, float, float, MATRIX3 *, VECTOR *, MATRIX3 *, VECTOR *, MATRIX3 *, VECTOR *, VECTOR *); 19 | void TesselateBezier(float, float, float, VECTOR *, VECTOR *, VECTOR *, VECTOR *, int, VECTOR *); 20 | float SBezierPosLength(float, float, VECTOR *, VECTOR *, VECTOR *, VECTOR *); 21 | 22 | void LimitBezierMulti(int c, ...); 23 | 24 | #endif // BEZ_H 25 | -------------------------------------------------------------------------------- /include/blend.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file blend.h 3 | */ 4 | #ifndef BLEND_H 5 | #define BLEND_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | 11 | // Forward. 12 | struct ASEGBL; 13 | struct EA; 14 | 15 | /** 16 | * @brief Unknown. 17 | */ 18 | struct MRSG 19 | { 20 | float t; 21 | float dt; 22 | }; 23 | 24 | void VerifyAeaEquivalence(int cea0, EA *aea0, int cea1, EA *aea1); 25 | 26 | void EnsureAsegBlendDynamic(ALO *palo, int cbBl, int cbl, void *abl, int cmrsgc, int *mpimrsgcib, int *mpimrsgccmrsg, ASEGBL **ppasegbl); 27 | 28 | void FillBlAmrsg(int cbBl, int cbl, void *abl, int ibMrsg, int coid, OID *aoid); 29 | 30 | void CalculateBlendAmrsg(int cbBl, int cbl, void *abl, int ibMrsg, int cmrsg, MRSG *amrsg, float *ptMax); 31 | 32 | int ImrsgLookUp(float t, float tMax, int cmrsg, MRSG *amrsg, float *pdtBest); 33 | 34 | void ReblendAsegbl(ASEGBL *pasegbl, int cbBl, int cbl, void *abl); 35 | 36 | void SetAsegblSlerp(ASEGBL *pasegbl, ALO *palo); 37 | 38 | #endif // BLEND_H 39 | -------------------------------------------------------------------------------- /include/bomb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file bomb.h 3 | */ 4 | #ifndef BOMB_H 5 | #define BOMB_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | // Forward. 15 | struct WKR; 16 | 17 | /** 18 | * @class BOMB 19 | * @brief Bomb (?). 20 | * @todo Implement the struct. 21 | */ 22 | struct BOMB : public SO 23 | { 24 | // ... 25 | }; 26 | 27 | void InitBomb(BOMB *pbomb); 28 | 29 | void LoadBombFromBrx(BOMB *pbomb, CBinaryInputStream *pbis); 30 | 31 | void CloneBomb(BOMB *pbomb, BOMB *pbombBase); 32 | 33 | void PostBombLoad(BOMB *pbomb); 34 | 35 | void HandleBombMessage(BOMB *pbomb, MSGID msgid, void *pv); 36 | 37 | void UpdateBomb(BOMB *pbomb, float dt); 38 | 39 | int FAbsorbBombWkr(BOMB *pbomb, WKR *pwkr); 40 | 41 | void PrimeBomb(BOMB *pbomb, float dt); 42 | 43 | void ApplyBombThrow(BOMB *pbomb, PO *ppo); 44 | 45 | void DetonateBomb(BOMB *pbomb); 46 | 47 | SFX *PsfxEnsureBomb(BOMB *pbomb, ENSK ensk); 48 | 49 | #endif // BOMB_H 50 | -------------------------------------------------------------------------------- /include/cat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file cat.h 3 | * 4 | * @brief WAL catalog. 5 | */ 6 | #ifndef CAT_H 7 | #define CAT_H 8 | 9 | #include "common.h" 10 | 11 | /** 12 | * @brief Related to file location. 13 | */ 14 | struct FCL 15 | { 16 | uint isector; 17 | uint cb; 18 | }; 19 | 20 | /** 21 | * @brief File Key. 22 | * 23 | * Used to identify the file type. 24 | */ 25 | enum FK 26 | { 27 | FK_Nil = -1, 28 | FK_BrxWorld = 0, // Level File 29 | FK_IcoIcon = 1, // Icon File 30 | FK_BnkEffects = 2, // Sound Effect File 31 | FK_BnkMusic = 3, // Music File 32 | FK_VagDialog = 4, // Dialog File 33 | FK_VagAnimation = 5, 34 | FK_PssMovie = 6, // Video File 35 | FK_Max = 7 36 | }; 37 | 38 | /** 39 | * @brief WAL Entry. 40 | * 41 | * Stores the file key and file location & size. 42 | */ 43 | struct WALE 44 | { 45 | char *pchzKey; // File Name used for searching for file to load 46 | struct FCL *pfcl; // File location and size. 47 | }; 48 | 49 | /** 50 | * @brief File location. 51 | */ 52 | class CFileLocation 53 | { 54 | public: 55 | FCL m_fcl; // File sector and size. 56 | 57 | // void Clear(); 58 | }; 59 | 60 | /** 61 | * @brief Used to startup the catalog system, 62 | * now it only sets the CD state to ready. 63 | */ 64 | void StartupCatalog(); 65 | 66 | /** 67 | * @brief Unknown purpose. Returns the second integer of the given array. 68 | * Called only once in FUN_0018C1E8 near P2/memcard (?). 69 | */ 70 | int FUN_001407A0(uint *pui); 71 | 72 | #endif // CAT_H 73 | -------------------------------------------------------------------------------- /include/cnvo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file cnvo.h 3 | */ 4 | #ifndef CNVO_H 5 | #define CNVO_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | // TODO: What is this? Where should this be defined? 11 | struct XP; 12 | 13 | /** 14 | * @class CONVERYOR 15 | * @brief Conveyor belt (probably used in Fire Down Below). 16 | * @todo Implement the struct. 17 | */ 18 | struct CNVO : public SO 19 | { 20 | // ... 21 | /* 0x550 */ float svBelt; 22 | /* 0x554 */ float svuAvg; 23 | /* 0x558 */ float svvAvg; 24 | // ... 25 | }; 26 | 27 | void InitCnvo(CNVO *pcnvo); 28 | 29 | void LoadCnvoFromBrx(CNVO *pcnvo, CBinaryInputStream *pbis); 30 | 31 | void PostCnvoLoad(CNVO *pcnvo); 32 | 33 | void AdjustCnvoXpVelocity(CNVO *pcnvo, XP *pxp, int ixpd); 34 | 35 | void SetCnvoBeltSpeed(CNVO *pcnvo, float svBelt); 36 | 37 | void MatchCnvoScrollerToBeltSpeed(CNVO *pcnvo); 38 | 39 | #endif // CNVO_H 40 | -------------------------------------------------------------------------------- /include/cplcy.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file cplcy.h 3 | * 4 | * @brief Camera policy. 5 | * 6 | * @todo Either move the camera policy structs from cm.h here, or delete this header. 7 | */ 8 | #ifndef CPLCY_H 9 | #define CPLCY_H 10 | 11 | #include "common.h" 12 | #include 13 | 14 | void PushCplookLookk(CPLOOK *pcplook, LOOKK lookk); 15 | 16 | LOOKK LookkPopCplook(CPLOOK *pcplook); 17 | 18 | LOOKK LookkCurCplook(CPLOOK *pcplook); 19 | 20 | #endif // CPLCY_H 21 | -------------------------------------------------------------------------------- /include/credit.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file credit.h 3 | * 4 | * @brief Credit UI blot. 5 | */ 6 | #ifndef CREDIT_H 7 | #define CREDIT_H 8 | 9 | #include "common.h" 10 | 11 | // ... 12 | 13 | #endif // CREDIT_H 14 | -------------------------------------------------------------------------------- /include/crout.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file crout.h 3 | */ 4 | #ifndef CROUT_H 5 | #define CROUT_H 6 | 7 | #include "common.h" 8 | 9 | // ... 10 | 11 | #endif // CROUT_H 12 | -------------------------------------------------------------------------------- /include/crusher.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file crusher.h 3 | */ 4 | #ifndef CRUSHER_H 5 | #define CRUSHER_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | 11 | // Forward. 12 | struct WKR; 13 | 14 | /** 15 | * @brief Unknown. 16 | * @todo Implement the struct. 17 | */ 18 | struct CRFOD : public STEPGUARD 19 | { 20 | // ... 21 | }; 22 | 23 | /** 24 | * @brief Unknown. 25 | * @todo Implement the struct. 26 | */ 27 | struct CRFODB : public STEPGUARD 28 | { 29 | // ... 30 | }; 31 | 32 | /** 33 | * @brief Unknown. 34 | * @todo Implement the struct. 35 | */ 36 | struct CRFODK : public CRFOD 37 | { 38 | // ... 39 | }; 40 | 41 | /** 42 | * @brief Unknown. 43 | * @todo Implement the struct. 44 | */ 45 | struct CRBRAIN : public ALO 46 | { 47 | // ... 48 | }; 49 | 50 | void OnCrfodAdd(CRFOD *pcrfod); 51 | 52 | void OnCrfodRemove(CRFOD *pcrfod); 53 | 54 | void CloneCrfod(CRFOD *pcrfod, CRFOD *pcrfodBase); 55 | 56 | void InitCrfodb(CRFODB *pcrfodb); 57 | 58 | void CalcHeadingVector(float rad, VECTOR *pvector); 59 | 60 | void UpdateCrfodbGoal(CRFODB *pcrfodb, int fEnter); 61 | 62 | int FDetectCrfodb(CRFODB *pcrfodb); 63 | 64 | int FAbsorbCrfodbWkr(CRFODB *pcrfodb, WKR *pwkr); 65 | 66 | SGS SgsNextCrfodkAI(CRFODK *pcrfodk); 67 | 68 | int FDetectCrfodk(CRFODK *pcrfodk); 69 | 70 | int FAbsorbCrfodkWkr(CRFODK *pcrfodk, WKR *pwkr); 71 | 72 | void InitCrbrain(CRBRAIN *pcrbrain); 73 | 74 | // TODO: Add unknown functions here. 75 | 76 | #endif // CRUSHER_H 77 | -------------------------------------------------------------------------------- /include/crv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file crv.h 3 | */ 4 | #ifndef CRV_H 5 | #define CRV_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @brief (?) kind. 12 | */ 13 | enum CRVK 14 | { 15 | CRVK_Nil = -1, 16 | CRVK_Linear = 0, 17 | CRVK_Cubic = 1, 18 | CRVK_Max = 2 19 | }; 20 | 21 | /** 22 | * @brief Unknown. 23 | */ 24 | struct CRV 25 | { 26 | undefined4 unknown; 27 | CRVK crvk; 28 | int fClosed; 29 | int ccv; 30 | float *mpicvu; 31 | float *mpicvs; 32 | VECTOR *mpicvpos; 33 | }; 34 | 35 | // ... 36 | 37 | #endif // CRV_H 38 | -------------------------------------------------------------------------------- /include/dart.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file dart.h 3 | * 4 | * @brief Dartgun projectiles. 5 | */ 6 | #ifndef DART_H 7 | #define DART_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | // Forward. 16 | struct EXPL; 17 | 18 | /** 19 | * @brief Dart State. 20 | */ 21 | enum DARTS 22 | { 23 | DARTS_Nil = -1, 24 | DARTS_AvailToFire = 0, 25 | DARTS_ReadyToFire = 1, 26 | DARTS_Airborne = 2, 27 | DARTS_Sticking = 3, 28 | DARTS_Stuck = 4, 29 | DARTS_Fading = 5, 30 | DARTS_Max = 6 31 | }; 32 | 33 | /** 34 | * @class DART 35 | * @brief Projectile for dartguns. 36 | * @todo Implement the struct. 37 | */ 38 | struct DART : public SO 39 | { 40 | // ... 41 | /* 0x56c */ DLE dleDartFree; 42 | // ... 43 | /* 0x58c */ EXPL *pexpl; 44 | // ... 45 | }; 46 | 47 | void InitDart(DART *pdart); 48 | 49 | void OnDartAdd(DART *pdart); 50 | 51 | void RemoveDart(DART *pdart); 52 | 53 | void CloneDart(DART *pdart, DART *pdartBase); 54 | 55 | void LoadDartFromBrx(DART *pdart, CBinaryInputStream *pbis); 56 | 57 | void HandleDartMessage(DART *pdart, MSGID msgid, void *pv); 58 | 59 | void PostDartLoad(DART *pdart); 60 | 61 | void UpdateDart(DART *pdart, float dt); 62 | 63 | void SetDartDarts(DART *pdart, DARTS darts); 64 | 65 | void ApplyDartThrow(DART *pdart, PO *ppo); 66 | 67 | void UpdateDartAirborne(DART *pdart, float dt); 68 | 69 | #endif // DART_H 70 | -------------------------------------------------------------------------------- /include/dartgun.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file dartgun.h 3 | */ 4 | #ifndef DARTGUN_H 5 | #define DARTGUN_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | /** 16 | * @class DARTGUN 17 | * @brief Dart gun used in High Class Heist? 18 | */ 19 | struct DARTGUN : public BRK 20 | { 21 | // ... 22 | }; 23 | 24 | void InitDartgun(DARTGUN *pdartgun); 25 | 26 | void HandleDartgunMessage(DARTGUN *pdartgun, MSGID msgid, void *pv); 27 | 28 | void BindDartgun(DARTGUN *pdartgun); 29 | 30 | void PostDartgunLoad(DARTGUN *pdartgun); 31 | 32 | void UpdateDartgun(DARTGUN *pdartgun, float dt); 33 | 34 | int FIgnoreDartgunIntersection(DARTGUN *pdartgun, SO *psoOther); 35 | 36 | void BreakDartgun(DARTGUN *pdartgun); 37 | 38 | void SetDartgunGoalState(DARTGUN *pdartgun, OID oidStateGoal); 39 | 40 | void TrackDartgun(DARTGUN *pdartgun, OID *poidStateGoal); 41 | 42 | int FPrepareDartgunToFire(DARTGUN *pdartgun); 43 | 44 | void FireDartgun(DARTGUN *pdartgun); 45 | 46 | void AgeDartgunStuckDart(DARTGUN *pdartgun); 47 | 48 | RAT *PratGetDartgunRatTarget(DARTGUN *pdartgun); 49 | 50 | void AddDartgunRatTarget(DARTGUN *pdartgun, OID oid); 51 | 52 | void StartDartgunTargetAreaChange(DARTGUN *pdartgun); 53 | 54 | void AddDartgunTargetAreaTarget(DARTGUN *pdartgun, ALO *paloTarget); 55 | 56 | #endif // DARTGUN_H 57 | -------------------------------------------------------------------------------- /include/dmas.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file dmas.h 3 | * 4 | * @brief Direct memory access. 5 | */ 6 | #ifndef DMAS_H 7 | #define DMAS_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | 14 | extern sceDmaChan *g_pdcVif0; 15 | extern sceDmaChan *g_pdcVif1; 16 | extern sceDmaChan *g_pdcGif; 17 | extern sceDmaChan *g_pdcFromSpr; 18 | extern sceDmaChan *g_pdcToSpr; 19 | 20 | /** 21 | * @brief Union for 16-byte aligned data. 22 | */ 23 | union QW 24 | { 25 | VECTOR vec; 26 | VECTOR4 vec4; 27 | ulong ull; 28 | ulong aul[2]; 29 | uint aun[4]; 30 | ushort aus[8]; 31 | uchar ab[16]; 32 | long ll; 33 | long al[2]; 34 | int an[4]; 35 | short as[8]; 36 | float ag[4]; 37 | }; 38 | 39 | class DMAS 40 | { 41 | public: 42 | uchar* m_pbMax; 43 | uchar* m_ab; 44 | QW* m_pqwCnt; 45 | uchar* m_pb; 46 | int m_fPad; 47 | int m_fEndPrim; 48 | //STRUCT_PADDING(276); 49 | 50 | DMAS(); 51 | 52 | void Clear(); 53 | void Reset(); 54 | void AllocGlobal(int); 55 | void AllocSw(int, int); 56 | void AllocStack(int); 57 | void AllocStatic(int, QW *); 58 | void Detach(int *, QW **); 59 | void DetachCopySw(int *, QW **, QW *, int); 60 | void Send(sceDmaChan *chan); 61 | void AddDmaCnt(); 62 | void AddDmaRefs(int cqw, QW *aqw); 63 | void AddDmaCall(QW *); 64 | void AddDmaRet(); 65 | void AddDmaBulk(int, QW *); 66 | void AddDmaEnd(); 67 | void EndDmaCnt(); 68 | 69 | virtual void EndPrim(); 70 | }; 71 | 72 | void StartupDma(); 73 | 74 | #endif // DMAS_H 75 | -------------------------------------------------------------------------------- /include/dysh.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file dysh.h 3 | * 4 | * @brief Dynamic shadow(?) 5 | */ 6 | #ifndef DYSH_H 7 | #define DYSH_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | // Forward. 16 | struct RPL; 17 | 18 | /** 19 | * @class DYNAMIC_SHADOW 20 | * @brief Unknown. 21 | * @todo Implement the struct. 22 | */ 23 | struct DYSH 24 | { 25 | // ... 26 | }; 27 | 28 | void InitDysh(DYSH *pdysh); 29 | 30 | void SetDyshShadow(DYSH *pdysh, SHADOW *pshadow); 31 | 32 | void RenderDyshSelf(DYSH *pdysh, CM *pcm, RO *pro); 33 | 34 | void DrawDysh(RPL *prpl); 35 | 36 | extern MATRIX4 s_matUvToClip; 37 | 38 | #endif // DYSH_H 39 | -------------------------------------------------------------------------------- /include/dzg.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file dzg.h 3 | */ 4 | #ifndef DZG_H 5 | #define DZG_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | 11 | // Forward. 12 | struct XP; 13 | 14 | typedef int GRFSG; 15 | 16 | /** 17 | * @brief Unknown. 18 | * @todo Implement the struct. 19 | */ 20 | struct DZ 21 | { 22 | // ... 23 | }; 24 | 25 | /** 26 | * @brief Unknown. 27 | */ 28 | struct DZG 29 | { 30 | int cdzMax; 31 | int cdz; 32 | DZ *adz; 33 | DL dlPos; 34 | DL dlZero; 35 | DL dlMax; 36 | DL dlUncat; 37 | int cdzPos; 38 | float *aagPos; 39 | float *aagPosCrout; 40 | float *asdv; 41 | float *adsfPos; 42 | }; 43 | 44 | void InitDzg(DZG *pdzg, int cpxp); 45 | 46 | void ClearDzgSolution(DZG *pdzg); 47 | 48 | void AppendDzgDz(DZG *pdzg, DZ *pdzOther); 49 | 50 | void FillDzgDz(DZG *pdzg, GRFSG grfsg, DZ *pdzForce, int cpxp, XP **apxp, int *acpso, SO ***aapso); 51 | 52 | void EnforceDzgDz(DZG *pdzg, DZ *pdzAdd); 53 | 54 | void SolveDzg(DZG *pdzg, GRFSG grfsg, int cpxp, XP **apxp, int *acpso, SO ***aapso); 55 | 56 | void SolveDzgFric(DZG *pdzg, GRFSG grfsg, int cpxp, XP **apxp, int *acpso, SO ***aapso, float dt); 57 | 58 | void ApplyDzg(DZG *pdzg, int cpsoRoot, int *acpso, SO ***aapso, float sdvMax, float sdwMax); 59 | 60 | void SolveInequalities(int c, float *aag, float *ag, float *agSoln); 61 | 62 | #endif // DZG_H 63 | -------------------------------------------------------------------------------- /include/ensure.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file ensure.h 3 | * 4 | * @brief Dynamic difficulty system. 5 | * 6 | * @todo Possibly merge this into another header, if appropriate. 7 | */ 8 | #ifndef ENSURE_H 9 | #define ENSURE_H 10 | 11 | /** 12 | * @brief Ensure kind. Further research needed. 13 | */ 14 | enum ENSK 15 | { 16 | ENSK_Get, 17 | ENSK_Set 18 | }; 19 | 20 | #endif // ENSURE_H 21 | -------------------------------------------------------------------------------- /include/eyes.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file eyes.h 3 | */ 4 | #ifndef EYES_H 5 | #define EYES_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @brief Eyes state. 12 | */ 13 | enum EYESS 14 | { 15 | EYESS_Nil = -1, 16 | EYESS_Open = 0, 17 | EYESS_Closing = 1, 18 | EYESS_Closed = 2, 19 | EYESS_Opening = 3, 20 | EYESS_Max = 4 21 | }; 22 | 23 | /** 24 | * @brief Eyes. 25 | */ 26 | struct EYES : public SAA 27 | { 28 | // ... 29 | }; 30 | 31 | void InitEyes(EYES *peyes, SAAF *psaaf); 32 | 33 | void PostEyesLoad(EYES *peyes); 34 | 35 | void SetEyesEyess(EYES *peyes, EYESS eyess); 36 | 37 | void UpdateEyes(EYES *peyes, float dt); 38 | 39 | void SetEyesClosed(EYES *peyes, float uClosed); 40 | 41 | SAI *PsaiFromEyesShd(EYES *peyes, SHD *pshd); 42 | 43 | #endif // EYES_H 44 | -------------------------------------------------------------------------------- /include/fader.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file fader.h 3 | */ 4 | #ifndef FADER_H 5 | #define FADER_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @todo Implement the struct. 12 | */ 13 | struct FADER 14 | { 15 | // ... 16 | }; 17 | 18 | /** 19 | * @brief Update the fader. 20 | */ 21 | void UpdateFader(FADER *pfader, float dt); 22 | 23 | /** 24 | * @brief Create a new fader. 25 | */ 26 | FADER *PfaderNew(ALO *palo); 27 | 28 | /** 29 | * @brief Remove the fader. 30 | */ 31 | void RemoveFader(FADER *pfader); 32 | 33 | #endif // FADER_H 34 | -------------------------------------------------------------------------------- /include/font.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file font.h 3 | * 4 | * @brief Font system. 5 | */ 6 | #ifndef FONT_H 7 | #define FONT_H 8 | 9 | #include "common.h" 10 | 11 | /** 12 | * @brief Scaled font ratio. 13 | */ 14 | struct SFR 15 | { 16 | float rx, ry; 17 | }; 18 | 19 | class CFont 20 | { 21 | int m_dxCharUnscaled; 22 | int m_dxSpaceUnscaled; 23 | int m_dyUnscaled; 24 | int m_csfr; 25 | SFR m_asfr[4]; 26 | int m_fGstest; 27 | undefined4 unk_1; 28 | ulong m_gstest; 29 | uint m_z; 30 | float m_rxScale; 31 | float m_ryScale; 32 | }; 33 | 34 | extern CFont *g_pfont; 35 | 36 | #endif // FONT_H 37 | -------------------------------------------------------------------------------- /include/freeze.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file freeze.h 3 | */ 4 | #ifndef FREEZE_H 5 | #define FREEZE_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | /** 14 | * @brief Merge (?) 15 | * @todo Should this be defined elsewhere? 16 | */ 17 | struct MRG 18 | { 19 | DLE dle; 20 | int cpalo; 21 | ALO **apalo; 22 | }; 23 | 24 | void RemergeSwObject(SW *psw, ALO *palo); 25 | 26 | void MergeSwFreezeGroups(SW *psw, ALO *paloFreezeGroup1, ALO *paloFreezeGroup2); 27 | 28 | void SplinterSwFreezeGroup(SW *psw, ALO *paloFreezeRoot); 29 | 30 | void MergeSwGroup(SW *psw, MRG *pmrg); 31 | 32 | void AddSwMergeGroup(SW *psw, MRG *pmrg); 33 | 34 | void RemoveFromArray(int *pcpv, void **apv, void *pv); 35 | 36 | void RemoveSwMergeGroup(SW *psw, MRG *pmrg); 37 | 38 | void RemergeSwObjects(SW *psw); 39 | 40 | void FreezeAloHierarchy(ALO *palo, int fFreeze); 41 | 42 | void GetAloFrozen(ALO *palo, int *pfFrozen); 43 | 44 | void FreezeAlo(ALO *palo, int fFreeze); 45 | 46 | void FreezeSo(SO *pso, int fFreeze); 47 | 48 | void RefreezeSwObjects(SW *psw); 49 | 50 | void UpdateSwBusyList(SW *psw); 51 | 52 | #endif // FREEZE_H 53 | -------------------------------------------------------------------------------- /include/frm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file frm.h 3 | * 4 | * @brief Frame manager. 5 | */ 6 | #ifndef FRM_H 7 | #define FRM_H 8 | 9 | #include "common.h" 10 | #include 11 | 12 | // Forward. 13 | class VIFS; 14 | struct GIFS; 15 | 16 | /** 17 | * @brief Frame. 18 | * @todo Add the rest of the fields. 19 | */ 20 | struct FRM 21 | { 22 | /* 0x00 */ int cqwGifs; 23 | /* 0x04 */ QW *aqwGifs; 24 | /* 0x08 */ int cqwVifs; 25 | /* 0x0c */ QW *aqwVifs; 26 | /* 0x10 */ SLI *asli; 27 | /* 0x14 */ int cframe; 28 | /* 0x18 */ int grffont; 29 | /* 0x1c */ int fBackgroundUploadRequired; 30 | STRUCT_PADDING(9); 31 | /* 0x44 */ GRFZON grfzon; 32 | // ... 33 | }; 34 | 35 | void StartupFrame(); 36 | 37 | void OpenFrame(); 38 | 39 | void EnsureVu1Code(VIFS *pvifs, void *pvStart, void *pvEnd); 40 | 41 | void FinalizeFrameVifs(VIFS *pvifs, int *pcqwVifs, QW **ppqwVifs); 42 | 43 | void FinalizeFrameGifs(GIFS *pgifs, int *pcqwGifs, QW **ppqwGifs); 44 | 45 | void CloseFrame(); 46 | 47 | void PrepareGsForFrameRender(FRM *pfrm); 48 | 49 | void FrameRenderLoop(void *); 50 | 51 | void RenderFrame(FRM *pfrm, int fRenderGifs); 52 | 53 | void ClearPendingFrame(FRM *pfrm); 54 | 55 | void FlushFrames(int fFreeze); 56 | 57 | void BlendPrevFrame(); 58 | 59 | extern uchar g_abRenderLoopStack[0x20000]; 60 | extern int g_cframe; 61 | 62 | #endif // FRM_H 63 | -------------------------------------------------------------------------------- /include/frzg.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file frzg.h 3 | */ 4 | #ifndef FRZG_H 5 | #define FRZG_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | 12 | /** 13 | * @class FREEZE_GROUP 14 | * @brief Group of freeze objects. 15 | */ 16 | struct FRZG : public LO 17 | { 18 | int coid; 19 | OID aoid[8]; 20 | MRG mrg; 21 | }; 22 | 23 | void PostFrzgLoad(FRZG *pfrzg); 24 | 25 | void AddFrzgObject(FRZG *pfrzg, OID oid); 26 | 27 | #endif // FRZG_H 28 | -------------------------------------------------------------------------------- /include/gcc/math.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file math.h 3 | * 4 | * @brief Library math functions. 5 | */ 6 | #ifndef MATH_H 7 | #define MATH_H 8 | 9 | extern "C" 10 | { 11 | float tanf(float x); 12 | float atan2f(float x, float y); 13 | float fmodf(float x, float y); 14 | float cosf(float x); 15 | } 16 | 17 | #endif // MATH_H 18 | -------------------------------------------------------------------------------- /include/geom.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file geom.h 3 | * 4 | * @brief Geometry. 5 | */ 6 | #ifndef GEOM_H 7 | #define GEOM_H 8 | 9 | #include 10 | #include 11 | 12 | /** 13 | * @todo Define struct 14 | */ 15 | struct TBSP; 16 | 17 | /** 18 | * @brief Edge in a geometry. 19 | */ 20 | struct EDGE 21 | { 22 | ushort aipos[2]; 23 | ushort aisurf[2]; 24 | EDGE *pedgeNext; 25 | EDGE *pedgeOtherNext; 26 | }; 27 | 28 | /** 29 | * @brief Unknown. 30 | */ 31 | struct SUR 32 | { 33 | int cb; 34 | void *pvSrc; 35 | void *pvDst; 36 | int cvtx; 37 | }; 38 | 39 | /** 40 | * @brief Unknown. 41 | */ 42 | struct SURF 43 | { 44 | VECTOR normal; 45 | float gDot; 46 | EDGE *pedge; 47 | EDGE *pedgeOther; 48 | short grfsurf; 49 | short ipos; 50 | }; 51 | 52 | /** 53 | * @brief Unknown. 54 | */ 55 | struct TSURF 56 | { 57 | float gDot; 58 | undefined4 unk1; 59 | undefined4 unk2; 60 | undefined4 unk3; 61 | VECTOR normal; 62 | }; 63 | 64 | /** 65 | * @brief Geometry. 66 | */ 67 | struct GEOM 68 | { 69 | float sRadius; 70 | 71 | int cpos; 72 | VECTOR *apos; 73 | 74 | int csurf; 75 | SURF *asurf; 76 | 77 | int cedge; 78 | EDGE *aedge; 79 | 80 | int *mpiposiiedgeMac; 81 | int *aiedge; 82 | VECTOR *mpisurfposCenter; 83 | float *mpisurfsRadius; 84 | }; 85 | 86 | /** 87 | * @brief Initializes the geometry struct. 88 | */ 89 | void InitGeom(GEOM *pgeom); 90 | 91 | /** 92 | * @brief Clones the geometry struct. 93 | */ 94 | void CloneGeom(GEOM *pgeomSrc, MATRIX4 *pdmat, GEOM *pgeomDst); 95 | 96 | #endif // GEOM_H 97 | -------------------------------------------------------------------------------- /include/gifs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gifs.h 3 | */ 4 | #ifndef GIFS_H 5 | #define GIFS_H 6 | 7 | #include 8 | 9 | /** 10 | * @brief Unknown. Constructs primitives for rendering? 11 | */ 12 | struct GIFS : public DMAS 13 | { 14 | QW *m_pqwPrim; 15 | uint m_creg; 16 | uint m_cregAll; 17 | 18 | GIFS(); 19 | 20 | void AddPrimEnd(); 21 | void EndPrim(int fEOP); 22 | void CheckReg(int fExpectPack, int regExpect); 23 | void AddPrimBulk(int prim, int c, int creg, ulong regs, QW **paqwBulk); 24 | void AddPrimPack(int prim, int creg, unsigned long regs); 25 | void PackRGBA(uint rgba); 26 | void PackUV(int u, int v); 27 | void PackSTQ(float s, float t, float q); 28 | void PackXYZ(int x, int y, int z); 29 | void PackXYZF(int x, int y, int z, int fog); 30 | void PackXYZFNoKick(int x, int y, int z, int fog); 31 | void PackAD(long int a, long int d); 32 | void AddPrimList(int creg, ulong regs); 33 | void ListRGBAQ(uint rgba, float q); 34 | void ListUV(int u, int v); 35 | void ListXYZF(int x, int y, int z, int fog); 36 | void AddImage(int cqw); 37 | }; 38 | 39 | #endif // GIFS_H 40 | -------------------------------------------------------------------------------- /include/glbs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file glbs.h 3 | */ 4 | #ifndef GLBS_H 5 | #define GLBS_H 6 | 7 | #include "common.h" 8 | 9 | /** 10 | * @todo Implement struct. 11 | */ 12 | struct GLBS 13 | { 14 | // ... 15 | }; 16 | 17 | #endif // GLBS_H 18 | -------------------------------------------------------------------------------- /include/gomer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gomer.h 3 | */ 4 | #ifndef GOMER_H 5 | #define GOMER_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @brief Gomer state. 12 | * 13 | * @todo Populate enum values. 14 | */ 15 | enum GOMERS 16 | { 17 | GOMERS_Nil = -1 18 | // ... 19 | }; 20 | 21 | /** 22 | * @class GOMER 23 | * @brief Unknown, related to bosses. 24 | * @todo Implement the struct. 25 | */ 26 | struct GOMER : public STEPGUARD 27 | { 28 | // ... 29 | }; 30 | 31 | #endif // GOMER_H 32 | -------------------------------------------------------------------------------- /include/gs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gs.h 3 | * 4 | * @brief Graphics synthesizer. 5 | * 6 | * @note Note to be confused with GS (game state), declared in game.h. 7 | */ 8 | #ifndef GS_H 9 | #define GS_H 10 | 11 | #include "common.h" 12 | #include 13 | #include 14 | 15 | struct GSB 16 | { 17 | int igsMin; 18 | int igsMac; 19 | int igsMax; 20 | }; 21 | 22 | /** 23 | * @brief Initializes a GSB with the given values. 24 | * 25 | * @param pgsb The GSB to initialize. 26 | * @param igsMin The minimum index. 27 | * @param igsMax The maximum index. 28 | */ 29 | void InitGsb(GSB *pgsb, int igsMin, int igsMax); 30 | 31 | /** 32 | * @brief Resets the igsMac to the minimum index. 33 | * 34 | * @param pGsb The GSB to reset. 35 | */ 36 | void ResetGsb(GSB *pGsb); 37 | 38 | /** 39 | * @brief Allocates a range of indices in the GSB. 40 | * 41 | * @param pgsb The GSB to allocate from. 42 | * @param iCount The number of indices to allocate. 43 | * 44 | * @return The old value of igsMac. 45 | */ 46 | int IgsAllocGsb(GSB *pgsb, int iCount); 47 | 48 | void BlastAqwGifsBothFrames(QW *); 49 | 50 | void ClearFrameBuffers(); 51 | 52 | void SendDmaSyncGsFinish(sceDmaChan *pdc,QW *pqw); 53 | 54 | #endif // GS_H 55 | -------------------------------------------------------------------------------- /include/hide.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file hide.h 3 | */ 4 | #ifndef HIDE_H 5 | #define HIDE_H 6 | 7 | #include "common.h" 8 | 9 | // ... 10 | 11 | #endif // HIDE_H 12 | -------------------------------------------------------------------------------- /include/hnd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file hnd.h 3 | */ 4 | #ifndef HND_H 5 | #define HND_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | 11 | /** 12 | * @class HANDLE 13 | * @brief Unknown. 14 | * @todo Implement the struct. 15 | */ 16 | struct HND : public TARGET 17 | { 18 | // ... 19 | }; 20 | 21 | void InitHnd(HND *phnd); 22 | 23 | void LoadHndFromBrx(HND *phnd, CBinaryInputStream *pbis); 24 | 25 | #endif // HND_H 26 | -------------------------------------------------------------------------------- /include/ik.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file ik.h 3 | */ 4 | #ifndef IK_H 5 | #define IK_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | 12 | // Forward. 13 | struct RO; 14 | 15 | /** 16 | * @class IK_HANDLE 17 | * @brief Inverse kinematics handle. 18 | * @todo Implement the struct. 19 | */ 20 | struct IKH : public SO 21 | { 22 | // ... 23 | }; 24 | 25 | /** 26 | * @class LIGHTWEIGHT_IK_HAN 27 | * @brief Lightweight(?) inverse kinematics handle. 28 | * @todo Implement the struct. 29 | */ 30 | struct LIKH : public ALO 31 | { 32 | // ... 33 | }; 34 | 35 | void RenderIkhSelf(IKH *pikh, CM pcm, RO *pro); 36 | 37 | void RenderLikhSelf(LIKH *plikh, CM *pcm, RO *pro); 38 | 39 | void SolveAloIK(ALO *palo); 40 | 41 | #endif // IK_H 42 | -------------------------------------------------------------------------------- /include/include_asm.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ASM_H 2 | #define INCLUDE_ASM_H 3 | 4 | #if !defined(M2CTX) && !defined(PERMUTER) && !defined(SKIP_ASM) 5 | 6 | #ifndef INCLUDE_ASM 7 | #define INCLUDE_ASM(FOLDER, NAME) \ 8 | __asm__( \ 9 | ".section .text\n" \ 10 | " .set noat\n" \ 11 | " .set noreorder\n" \ 12 | " .include \"" FOLDER "/" #NAME ".s\"\n" \ 13 | " .set reorder\n" \ 14 | " .set at\n" \ 15 | ) 16 | #endif 17 | #ifndef INCLUDE_RODATA 18 | #define INCLUDE_RODATA(FOLDER, NAME) \ 19 | __asm__( \ 20 | ".section .rodata\n" \ 21 | " .include \"" FOLDER "/" #NAME ".s\"\n" \ 22 | ".section .text" \ 23 | ) 24 | #endif 25 | __asm__(".include \"include/labels.inc\"\n"); 26 | 27 | #else 28 | 29 | #ifndef INCLUDE_ASM 30 | #define INCLUDE_ASM(FOLDER, NAME) 31 | #endif 32 | #ifndef INCLUDE_RODATA 33 | #define INCLUDE_RODATA(FOLDER, NAME) 34 | #endif 35 | 36 | #endif /* !defined(M2CTX) && !defined(PERMUTER) && !defined(SKIP_ASM) */ 37 | 38 | #endif /* INCLUDE_ASM_H */ 39 | -------------------------------------------------------------------------------- /include/keyhole.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file keyhole.h 3 | */ 4 | #ifndef KEYHOLE_H 5 | #define KEYHOLE_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | 11 | /** 12 | * @class KEYHOLE 13 | * @brief Spot where keys are inserted into locks? 14 | * @todo Implement the struct. 15 | */ 16 | struct KEYHOLE : public LO 17 | { 18 | // ... 19 | }; 20 | 21 | void InitKeyhole(KEYHOLE *pkeyhole); 22 | 23 | void LoadKeyholeFromBrx(KEYHOLE *pkeyhole, CBinaryInputStream *pbis); 24 | 25 | void DrawKeyholeMask(KEYHOLE *pkeyhole, float x, float y, float rScale, float uAlpha); 26 | 27 | void DrawKeyhole(KEYHOLE *pkeyhole, float uClosed); 28 | 29 | #endif // KEYHOLE_H 30 | -------------------------------------------------------------------------------- /include/labels.inc: -------------------------------------------------------------------------------- 1 | # This file is used by the original compiler/assembler. 2 | # Defines the expected assembly macros. 3 | 4 | # A function symbol. 5 | .macro glabel label, visibility=global 6 | .\visibility \label 7 | .type \label, @function 8 | \label: 9 | .ent \label 10 | .endm 11 | 12 | # The end of a function symbol. 13 | .macro endlabel label 14 | .size \label, . - \label 15 | .end \label 16 | .endm 17 | 18 | # An alternative entry to a function. 19 | .macro alabel label, visibility=global 20 | .\visibility \label 21 | .type \label, @function 22 | \label: 23 | .endm 24 | 25 | # A label referenced by an error handler table. 26 | .macro ehlabel label, visibility=global 27 | .\visibility \label 28 | \label: 29 | .endm 30 | 31 | 32 | # A label referenced by a jumptable. 33 | .macro jlabel label, visibility=global 34 | .\visibility \label 35 | \label: 36 | .endm 37 | 38 | 39 | # A data symbol. 40 | .macro dlabel label, visibility=global 41 | .\visibility \label 42 | .type \label, @object 43 | \label: 44 | .endm 45 | 46 | # End of a data symbol. 47 | .macro enddlabel label 48 | .size \label, . - \label 49 | .endm 50 | 51 | 52 | # Label to signal the symbol haven't been matched yet. 53 | .macro nonmatching label, size=1 54 | .global \label\().NON_MATCHING 55 | .type \label\().NON_MATCHING, @object 56 | .size \label\().NON_MATCHING, \size 57 | \label\().NON_MATCHING: 58 | .endm 59 | -------------------------------------------------------------------------------- /include/landing.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file landing.h 3 | */ 4 | #ifndef LANDING_H 5 | #define LANDING_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | 11 | /** 12 | * @class LANDING 13 | * @brief Unknown. 14 | */ 15 | struct LANDING : public SHAPE 16 | { 17 | undefined1 unknown[0x04]; 18 | DLE dleLanding; 19 | }; 20 | 21 | void OnLandingAdd(LANDING *planding); 22 | void OnLandingRemove(LANDING *planding); 23 | void CloneLanding(LANDING *planding, LANDING *plandingBase); 24 | 25 | #endif // LANDING_H 26 | -------------------------------------------------------------------------------- /include/lib/libkernl/filestub.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file include/lib/libkernl/filestub.h 3 | * @note src/lib/libkernl/filestub.c 4 | */ 5 | #ifndef FILESTUB_H 6 | #define FILESTUB_H 7 | 8 | extern "C" 9 | { 10 | int sceClose(int fd); 11 | int sceRead(int fd, void *pv, int cb); 12 | int sceIoctl(int, int, void *); 13 | }; 14 | 15 | #endif // FILESTUB_H 16 | -------------------------------------------------------------------------------- /include/lookat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lookat.h 3 | */ 4 | #ifndef LOOKAT_H 5 | #define LOOKAT_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | /** 14 | * @brief Actor Look At (?) 15 | */ 16 | struct ACTLA 17 | { 18 | int fUseTarget; 19 | ALO *paloTarget; 20 | VECTOR posTargetLocal; 21 | float sIgnore; 22 | int nPriorityEnabled; 23 | int nPriorityDisabled; 24 | int fPaused; 25 | CLQ clqPanToPan; 26 | LM lmPan; 27 | CLQ clqTiltToTilt; 28 | LM lmTilt; 29 | }; 30 | 31 | void InitActla(ACTLA *pactla, ALO *palo); 32 | 33 | void SetActlaTarget(ACTLA *pactla, ALO *paloTarget, VECTOR *pposLocal); 34 | 35 | ALO *PaloGetActlaTarget(ACTLA *pactla); 36 | 37 | void UpdateActla(ACTLA *pactla, float dt); 38 | 39 | void GetActlaRotationGoal(ACTLA *pactla, float dtOffset, MATRIX3 *pmat, VECTOR *pw); 40 | 41 | #endif // LOOKAT_H 42 | -------------------------------------------------------------------------------- /include/macro.inc: -------------------------------------------------------------------------------- 1 | # This file is used by modern gas. 2 | # Defines the expected assembly macros 3 | 4 | # Evaluate this file only once in case it's included more than once 5 | .ifndef _MACRO_INC_GUARD 6 | .internal _MACRO_INC_GUARD 7 | .set _MACRO_INC_GUARD, 1 8 | 9 | # A function symbol. 10 | .macro glabel label, visibility=global 11 | .\visibility "\label" 12 | .type "\label", @function 13 | "\label": 14 | .ent "\label" 15 | .endm 16 | 17 | # The end of a function symbol. 18 | .macro endlabel label 19 | .size "\label", . - "\label" 20 | .end "\label" 21 | .endm 22 | 23 | # An alternative entry to a function. 24 | .macro alabel label, visibility=global 25 | .\visibility "\label" 26 | .type "\label", @function 27 | "\label": 28 | .endm 29 | 30 | # A label referenced by an error handler table. 31 | .macro ehlabel label, visibility=global 32 | .\visibility "\label" 33 | "\label": 34 | .endm 35 | 36 | 37 | # A label referenced by a jumptable. 38 | .macro jlabel label, visibility=global 39 | .\visibility "\label" 40 | "\label": 41 | .endm 42 | 43 | 44 | # A data symbol. 45 | .macro dlabel label, visibility=global 46 | .\visibility "\label" 47 | .type "\label", @object 48 | "\label": 49 | .endm 50 | 51 | # End of a data symbol. 52 | .macro enddlabel label 53 | .size "\label", . - "\label" 54 | .endm 55 | 56 | 57 | # Label to signal the symbol haven't been matched yet. 58 | .macro nonmatching label, size=1 59 | .global "\label\().NON_MATCHING" 60 | .type "\label\().NON_MATCHING", @object 61 | .size "\label\().NON_MATCHING", \size 62 | "\label\().NON_MATCHING": 63 | .endm 64 | 65 | .endif 66 | -------------------------------------------------------------------------------- /include/mb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mb.h 3 | * 4 | * @brief Mesa boss. 5 | */ 6 | #ifndef MB_H 7 | #define MB_H 8 | 9 | #include 10 | 11 | /** 12 | * @class MS_BOSS_GUARD 13 | * @brief Mesa boss guard (Muggshot). 14 | */ 15 | struct MBG : public STEPGUARD 16 | { 17 | // ... 18 | }; 19 | 20 | #endif // MB_H 21 | -------------------------------------------------------------------------------- /include/memcard.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file memcard.h 3 | */ 4 | #ifndef MEMCARD_H 5 | #define MEMCARD_H 6 | 7 | #include "common.h" 8 | 9 | /** 10 | * @todo Incomplete. 11 | */ 12 | struct MEMCARD 13 | { 14 | int semaphoreId; 15 | int threadId; 16 | int field_0x08; 17 | int field_0x0c; 18 | int field_0x10; 19 | }; 20 | 21 | /** 22 | * @note Judging from the memset in InitSave, 23 | * this struct could be over 20k bytes long. 24 | */ 25 | struct SAVE 26 | { 27 | int field_0x00; 28 | // ... 29 | }; 30 | 31 | /** 32 | * @brief Startup the memory card system. 33 | */ 34 | void StartupMemcard(); 35 | 36 | #endif // MEMCARD_H 37 | -------------------------------------------------------------------------------- /include/mpeg.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mpeg.h 3 | * 4 | * @brief Mpeg video. 5 | */ 6 | #ifndef MPEG_H 7 | #define MPEG_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | 13 | class CMpeg 14 | { 15 | public: 16 | OID oid_1; 17 | OID oid_2; 18 | // todo 19 | 20 | void ExecuteOids(); 21 | void Execute(OID *poid); 22 | void Start(CBinaryAsyncStream *pbas); 23 | void Update(); 24 | void Finish(); 25 | }; 26 | 27 | extern CMpeg g_mpeg; 28 | 29 | #endif // MPEG_H 30 | -------------------------------------------------------------------------------- /include/mq.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mq.h 3 | * 4 | * @brief Message queue. 5 | */ 6 | #ifndef MQ_H 7 | #define MQ_H 8 | 9 | #include "common.h" 10 | 11 | typedef int GRFCMQ; // TODO: Does this belong to mq.h? 12 | 13 | /** 14 | * @brief Message ID 15 | * 16 | * @note Based on values from May 19, may not be accurate to release. 17 | */ 18 | enum MSGID 19 | { 20 | MSGID_Nil = -1, 21 | MSGID_callback = 0, 22 | MSGID_added = 1, 23 | MSGID_removed = 2, 24 | MSGID_translated = 3, 25 | MSGID_rotated = 4, 26 | MSGID_asega_limit = 5, 27 | MSGID_asega_retracted = 6, 28 | MSGID_asega_wrapped = 7, 29 | MSGID_sfx_start = 8, 30 | MSGID_sfx_end = 9, 31 | MSGID_water_entered = 10, 32 | MSGID_water_left = 11, 33 | MSGID_button_trigger = 12, 34 | MSGID_button_untrigger = 13, 35 | MSGID_break_break = 14, 36 | MSGID_break_piece = 15, 37 | MSGID_rip_removed = 16, 38 | MSGID_color_change = 17, 39 | MSGID_user_message = 18, 40 | MSGID_label = 19, 41 | MSGID_sma_transition = 20, 42 | MSGID_waypoint = 21, 43 | MSGID_waypoint_transition = 22, 44 | MSGID_damaged = 23, 45 | MSGID_param_read = 24, 46 | MSGID_param_write = 25, 47 | MSGID_Max = 26 48 | }; 49 | 50 | typedef void (*PFNMQ)(void *, MSGID, void *); 51 | 52 | /** 53 | * @brief Message queue(?) 54 | */ 55 | struct MQ 56 | { 57 | PFNMQ pfnmq; 58 | void *pvContext; 59 | MSGID msgid; 60 | void *pvCallbackData; 61 | MQ *pmqnext; 62 | }; 63 | 64 | #endif // MQ_H 65 | -------------------------------------------------------------------------------- /include/mrkv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mrkv.h 3 | */ 4 | #ifndef MRKV_H 5 | #define MRKV_H 6 | 7 | #include "common.h" 8 | 9 | // ... 10 | 11 | #endif // MRKV_H 12 | -------------------------------------------------------------------------------- /include/ms.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Unknown. 3 | */ 4 | 5 | #include "common.h" 6 | #include 7 | 8 | struct RO; // todo define this struct somewhere 9 | 10 | /** 11 | * @class MERGED_STATICS 12 | * @brief Unknown. 13 | */ 14 | struct MS 15 | { 16 | // ... 17 | }; 18 | 19 | void RenderMsGlobset(MS *pms, CM *pcm, RO *pro); 20 | -------------------------------------------------------------------------------- /include/murray.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file murray.h 3 | * 4 | * @brief "The Murray". 5 | */ 6 | #ifndef MURRAY_H 7 | #define MURRAY_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | 14 | // Forward. 15 | struct WKR; 16 | 17 | /** 18 | * @class MURRAY 19 | * @brief Used for Murray in Murray's Big Gamble and King of the Hill. 20 | * @todo Implement the struct. 21 | */ 22 | struct MURRAY : public STEPGUARD 23 | { 24 | // ... 25 | }; 26 | 27 | void InitMurray(MURRAY *pmurray); 28 | 29 | void PostMurrayLoad(MURRAY *pmurray); 30 | 31 | void OnMurrayEnteringSgs(MURRAY *pmurray, SGS sgsPrev, ASEG *pasegOverride); 32 | 33 | void OnMurrayExitingSgs(MURRAY *pmurray, SGS sgs); 34 | 35 | void UpdateMurrayGoal(MURRAY *pmurray, int fEnter); 36 | 37 | void UpdateMurraySgs(MURRAY *pmurray); 38 | 39 | int FAbsorbMurrayWkr(MURRAY *pmurray, WKR *pwkr); 40 | 41 | int FDetectMurray(MURRAY *pmurray); 42 | 43 | /** 44 | * @brief Always returns false and never gets called anywhere. 45 | */ 46 | int FCanMurrayAttack(MURRAY *pmurray); 47 | 48 | void AddMurrayEnemy(MURRAY *pmurray, ALO *paloEnemy); 49 | 50 | void SetMurrayPursueXfm(MURRAY *pmurray, XFM *pxfm); 51 | 52 | void SetMurrayPatrolXfm(MURRAY *pmurray, XFM *pxfm); 53 | 54 | void CollectMurrayPrize(MURRAY *pmurray, PCK pck, ALO *paloOther); 55 | 56 | #endif // MURRAY_H 57 | -------------------------------------------------------------------------------- /include/oid.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file oid.h 3 | * 4 | * @brief Object IDs. 5 | */ 6 | #ifndef OID_H 7 | #define OID_H 8 | 9 | #include "common.h" 10 | 11 | /** 12 | * @brief Object ID. 13 | */ 14 | enum OID { 15 | OID_Nil = -1, 16 | OID_Unknown = 0x0, 17 | OID__MERGED_STATICS = 0x1, 18 | OID__VISIBILITY_MAP = 0x2, 19 | OID__WORLD = 0x3, 20 | OID__CAMERA = 0x4, 21 | OID_jt = 0x5, 22 | OID_bentley = 0x6, 23 | OID_murray = 0x7, 24 | 25 | // ... 26 | 27 | OID_shd_stock_shadow = 0x2c, 28 | 29 | // ... 30 | 31 | OID_rat = 0x269 32 | 33 | // ... 34 | }; 35 | 36 | 37 | #endif // OID_H 38 | -------------------------------------------------------------------------------- /include/path.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file path.h 3 | */ 4 | #ifndef PATH_H 5 | #define PATH_H 6 | 7 | #include "common.h" 8 | 9 | // ... 10 | 11 | #endif // PATH_H 12 | -------------------------------------------------------------------------------- /include/phasemem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file phasemem.h 3 | */ 4 | #ifndef PHASEMEM_H 5 | #define PHASEMEM_H 6 | 7 | #include "common.h" 8 | 9 | /** 10 | * @brief Engine phase. 11 | */ 12 | enum PHASE 13 | { 14 | PHASE_Nil = -1, 15 | PHASE_None = 0, 16 | PHASE_Startup = 1, 17 | PHASE_Load = 2, 18 | PHASE_Main = 3, 19 | PHASE_Mpeg = 4, 20 | PHASE_Max = 5 21 | }; 22 | 23 | extern PHASE g_phase; 24 | 25 | /** 26 | * @brief Set the current engine phase. 27 | */ 28 | void SetPhase(PHASE phase); 29 | 30 | /** 31 | * @brief Clear the current engine phase. 32 | */ 33 | void ClearPhase(PHASE phase); 34 | 35 | #endif // PHASEMEM_H 36 | -------------------------------------------------------------------------------- /include/pipe.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file pipe.h 3 | */ 4 | #ifndef PIPE_H 5 | #define PIPE_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @class PIPE 12 | * @brief Pipe that JT can climb on. 13 | * @todo Implement the struct. 14 | */ 15 | struct PIPE : public LO 16 | { 17 | // ... 18 | }; 19 | 20 | void StartupPipe(); 21 | 22 | void ResetPipeList(); 23 | 24 | void InitPipe(PIPE *ppipe); 25 | 26 | void OnPipeAdd(PIPE *ppipe); 27 | 28 | void OnPipeRemove(PIPE *ppipe); 29 | 30 | // void PostPipeLoad(); // TODO 31 | 32 | void ClonePipe(PIPE *ppipe, PIPE *ppipeBase); 33 | 34 | #endif // PIPE_H 35 | -------------------------------------------------------------------------------- /include/pnt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file pnt.h 3 | * 4 | * @brief Points. 5 | */ 6 | #ifndef PNT_H 7 | #define PNT_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | /** 17 | * @class POINT 18 | * @brief Object defined only by a point in space. 19 | */ 20 | struct PNT : public LO 21 | { 22 | /* 0x34 */ STRUCT_PADDING(3); // This could be a vector, something like posGlobal? 23 | /* 0x40 */ VECTOR posLocal; 24 | }; 25 | 26 | /** 27 | * @class POINT_WITH_SPEED 28 | * @brief Object defined by a point in space with a velocity. 29 | */ 30 | struct PNTSV : PNT 31 | { 32 | // ... 33 | }; 34 | 35 | /** 36 | * @class POINT_WITH_DISTANCE 37 | * @brief Object defined by a point in space with a distance. 38 | */ 39 | struct PNTS : PNT 40 | { 41 | // ... 42 | }; 43 | 44 | /** 45 | * @class POINT_WITH_VECTOR 46 | * @brief Object defined by a point in space with a vector. 47 | */ 48 | struct PNTVEC : PNT 49 | { 50 | // ... 51 | }; 52 | 53 | void LoadPntFromBrx(PNT *ppnt, CBinaryInputStream *pbis); 54 | 55 | void GetPntPos(PNT *ppnt, VECTOR *ppos); 56 | 57 | void SetPntParent(PNT *ppnt, ALO *paloParent); 58 | 59 | void ApplyPntProxy(PNT *ppnt, PROXY *pproxyApply); 60 | 61 | #endif // PNT_H 62 | -------------------------------------------------------------------------------- /include/prog.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file prog.h 3 | * 4 | * @brief Progress bar. 5 | */ 6 | #ifndef PROG_H 7 | #define PROG_H 8 | 9 | #include "common.h" 10 | #include 11 | 12 | class CProg 13 | { 14 | int m_fActive; 15 | int m_nMax; 16 | int m_nTarget; 17 | int m_nRemain; 18 | int m_cRetry; 19 | 20 | RGBA m_rgbaComplete; 21 | RGBA m_rgbaRemain; 22 | RGBA m_rgbaWarning; 23 | RGBA m_rgbaTrouble; 24 | 25 | public: 26 | /** 27 | * @brief Initializes CProg with RGBA values. 28 | * 29 | * @param rgbaComplete Color of the filled portion of the bar (e.g. blue or green). 30 | * @param rgbaRemain Color of the unfilled portion of the bar (e.g. gray). 31 | * @param rgbaWarning Color of the bar if there's a warning (e.g. yellow). 32 | * @param rgbaTrouble Color of the bar if there's trouble (e.g. red) 33 | */ 34 | CProg(RGBA *rgbaComplete, RGBA *rgbaRemain, RGBA *rgbaWarning, RGBA *rgbaTrouble); 35 | 36 | /** 37 | * @brief Zeroes out the variables. 38 | * 39 | */ 40 | void Begin(); 41 | 42 | /** 43 | * @brief Clear's Frame Buffers, updates remain and calls draw. 44 | * 45 | * @param nRemain new Remain value. 46 | */ 47 | void SetRemain(int nRemain); 48 | 49 | /** 50 | * @brief Zeroes out the variables. 51 | * 52 | */ 53 | void End(); 54 | 55 | /** 56 | * @brief Draws the progress bar on the screen with the current colors. 57 | */ 58 | void Draw(); 59 | }; 60 | 61 | #endif // PROG_H 62 | -------------------------------------------------------------------------------- /include/proxy.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file proxy.h 3 | */ 4 | #ifndef PROXY_H 5 | #define PROXY_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | 12 | /** 13 | * @brief Unknown. 14 | */ 15 | struct PROXY : public ALO 16 | { 17 | DL dlProxyRoot; 18 | DLE dleProxy; 19 | undefined4 unk_0x8; 20 | undefined4 unk_0xC; 21 | undefined4 unk_0x10; 22 | }; 23 | 24 | void InitProxy(PROXY *pproxy); 25 | 26 | void LoadProxyFromBrx(PROXY *pproxy, CBinaryInputStream *pbis); 27 | 28 | void CloneProxy(PROXY *pproxy, PROXY *pproxyBase); 29 | 30 | void PostProxyLoad(PROXY *pproxy); 31 | 32 | #endif // PROXY_H 33 | -------------------------------------------------------------------------------- /include/rail.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file rail.h 3 | */ 4 | #ifndef RAIL_H 5 | #define RAIL_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | 11 | /** 12 | * @class RAIL 13 | * @brief Rail that JT can walk/slide on. 14 | * @todo Check if the field names are correct. 15 | */ 16 | struct RAIL : public SHAPE 17 | { 18 | /* 0x38 */ DLE dleRail; 19 | /* 0x40 */ int fSlippery; 20 | /* 0x44 */ float svMax; 21 | /* 0x48 */ float rdvGravity; 22 | /* 0x4c */ float unk1; 23 | /* 0x50 */ undefined4 unk2; 24 | /* 0x54 */ OID oid; 25 | /* 0x58 */ LO *plo; 26 | }; 27 | 28 | void InitRail(RAIL *prail); 29 | 30 | void OnRailAdd(RAIL *prail); 31 | 32 | void OnRailRemove(RAIL *prail); 33 | 34 | void PostLoadRail(RAIL *prail); 35 | 36 | void CloneRail(RAIL *prail, RAIL *prailBase); 37 | 38 | #endif // RAIL_H 39 | -------------------------------------------------------------------------------- /include/rs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file rs.h 3 | * 4 | * @note No functions are declared here. 5 | */ 6 | #ifndef RS_H 7 | #define RS_H 8 | 9 | #include "common.h" 10 | #include 11 | 12 | /** 13 | * @brief Unknown. 14 | * 15 | * @todo Figure out what this struct represents. 16 | */ 17 | struct RSMG 18 | { 19 | OID oidRoot; 20 | OID oidSM; 21 | OID oidTriggerGoal; 22 | OID oidUntriggerGoal; 23 | }; 24 | 25 | #endif // RS_H 26 | -------------------------------------------------------------------------------- /include/save.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file save.h 3 | * 4 | * @brief Save data struct. 5 | * 6 | * @note Not in May proto, so is based on guesswork. 7 | */ 8 | #ifndef SAVE_H 9 | #define SAVE_H 10 | 11 | #include "common.h" 12 | 13 | /** 14 | * @brief Save data struct. 15 | */ 16 | struct SAVE 17 | { 18 | // todo 19 | }; 20 | 21 | void UpdateSave(SAVE *psave); 22 | 23 | extern SAVE g_save; 24 | 25 | #endif // SAVE_H 26 | -------------------------------------------------------------------------------- /include/sb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sb.h 3 | * 4 | * @brief Snow boss. 5 | */ 6 | #ifndef SB_H 7 | #define SB_H 8 | 9 | #include 10 | 11 | /** 12 | * @class S_BOSS_GUARD 13 | * @brief Snow boss guard (Panda King). 14 | */ 15 | struct SBG : public STEPGUARD 16 | { 17 | // ... 18 | }; 19 | 20 | #endif // SB_H 21 | -------------------------------------------------------------------------------- /include/sce/memset.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file memset.h 3 | * 4 | * @brief Memset. 5 | */ 6 | #ifndef MEMSET_H 7 | #define MEMSET_H 8 | #include 9 | 10 | extern "C" 11 | { 12 | void* memset(void* ptr, int value, size_t num); 13 | } 14 | 15 | #endif // MEMSET_H 16 | -------------------------------------------------------------------------------- /include/sce/rand.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file rand.h 3 | * @note /sce/ee/gcc/src/newlib/libc/stdlib/rand.c 4 | * 5 | * @brief Random number generation. 6 | */ 7 | #ifndef RAND_H 8 | #define RAND_H 9 | 10 | typedef unsigned int undefined4; 11 | typedef unsigned int u_int; 12 | 13 | extern "C" 14 | { 15 | struct RNG { 16 | undefined4 field0_0x0; 17 | undefined4 field1_0x4; 18 | undefined4 field2_0x8; 19 | undefined4 field3_0xc; 20 | undefined4 field4_0x10; 21 | undefined4 field5_0x14; 22 | undefined4 field6_0x18; 23 | undefined4 field7_0x1c; 24 | undefined4 field8_0x20; 25 | undefined4 field9_0x24; 26 | undefined4 field10_0x28; 27 | undefined4 field11_0x2c; 28 | undefined4 field12_0x30; 29 | undefined4 field13_0x34; 30 | undefined4 field14_0x38; 31 | undefined4 field15_0x3c; 32 | undefined4 field16_0x40; 33 | undefined4 field17_0x44; 34 | undefined4 field18_0x48; 35 | undefined4 field19_0x4c; 36 | undefined4 field20_0x50; 37 | undefined4 field21_0x54; 38 | u_int next; 39 | }; 40 | 41 | /** 42 | * @brief Seed the random number generator. 43 | */ 44 | void srand(u_int seed); 45 | 46 | /** 47 | * @brief Generate a random number. 48 | */ 49 | u_int rand(); 50 | }; 51 | 52 | #endif // RAND_H 53 | -------------------------------------------------------------------------------- /include/sdk/ee/eestruct.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file include/sdk/ee/eestruct.h 3 | * 4 | * @brief Graphics synthesizer. 5 | */ 6 | #ifndef SCE_EESTRUCT_H 7 | #define SCE_EESTRUCT_H 8 | 9 | // TODO: Remove this. 10 | #include "types.h" 11 | 12 | extern "C" 13 | { 14 | struct sceGsTex0 15 | { 16 | undefined4 unk_0x0; 17 | undefined4 unk_0x4; 18 | }; 19 | 20 | struct sceGsTex2 21 | { 22 | undefined4 unk_0x0; 23 | undefined4 unk_0x4; 24 | }; 25 | 26 | /** 27 | * @todo Figure out is this in the right place. 28 | */ 29 | void sceGsResetPath(); 30 | } 31 | 32 | #endif // SCE_EESTRUCT_H 33 | -------------------------------------------------------------------------------- /include/sdk/ee/libpad.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file include/sdk/ee/libpad.h 3 | * 4 | * @brief Joypad (controller) library. 5 | */ 6 | #ifndef PAD_H 7 | #define PAD_H 8 | 9 | typedef unsigned char u_char; 10 | 11 | extern "C" 12 | { 13 | int scePadInit(int mode); 14 | int scePadPortOpen(int port, int slot, void *data); 15 | int scePadGetState(int port, int slot); 16 | int scePadInfoAct(int port, int slot, int actno, int term); 17 | int scePadInfoMode(int port, int slow, int term, int offs); 18 | int scePadSetMainMode(int port, int slow, int offs, int lock); 19 | int scePadSetActDirect(int port, int slot, const u_char *data); 20 | int scePadSetActAlign(int port, int slow, const u_char *data); 21 | int scePadInfoPressMode(int port, int slot); 22 | int scePadEnterPressMode(int port, int slot); 23 | int scePadExitPressMode(int port, int slot); 24 | } 25 | 26 | #endif // PAD_H 27 | -------------------------------------------------------------------------------- /include/sdk/libcdvd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file include/sdk/libcdvd.h 3 | * 4 | * @brief DVD handler. 5 | */ 6 | #ifndef EEDVD_H 7 | #define EEDVD_H 8 | 9 | typedef unsigned char u_char; 10 | typedef unsigned int u_int; 11 | 12 | extern "C" 13 | { 14 | struct sceCdRMode { 15 | u_char trycount; 16 | u_char spindlctrl; 17 | u_char datapattern; 18 | u_char pad; 19 | }; 20 | 21 | enum SCECdvdMediaType { 22 | SCECdGDTFUNCFAIL = -1, 23 | SCECdNODISC = 0x00, 24 | SCECdDETCT, 25 | SCECdDETCTCD, 26 | SCECdDETCTDVDS, 27 | SCECdDETCTDVDD, 28 | SCECdUNKNOWN, 29 | 30 | SCECdPSCD = 0x10, 31 | SCECdPSCDDA, 32 | SCECdPS2CD, 33 | SCECdPS2CDDA, 34 | SCECdPS2DVD, 35 | 36 | SCECdDVDVR = 0xFC, 37 | SCECdCDDA = 0xFD, 38 | SCECdDVDV, 39 | SCECdIllegalMedia 40 | }; 41 | 42 | int sceCdMmode(int mode); 43 | int sceCdGetError(void); 44 | int sceCdBreak(void); 45 | int sceCdSync(int mode); 46 | int sceCdRead(u_int lbn, u_int sectors, void *buf, sceCdRMode *mode); 47 | int sceCdGetDiskType(void); 48 | }; 49 | 50 | #endif // EEDVD_H 51 | -------------------------------------------------------------------------------- /include/shape.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file shape.h 3 | */ 4 | #ifndef SHAPE_H 5 | #define SHAPE_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | /** 15 | * @class SHAPE 16 | * @brief Unknown. 17 | */ 18 | struct SHAPE : public LO 19 | { 20 | CRV *pcrv; 21 | }; 22 | 23 | void LoadShapeFromBrx(SHAPE *pshape, CBinaryInputStream *pbis); 24 | 25 | void SetShapeParent(SHAPE *pshape, ALO *paloParent); 26 | 27 | #endif // SHAPE_H 28 | -------------------------------------------------------------------------------- /include/sky.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sky.h 3 | * 4 | * @brief Skyboxes. 5 | */ 6 | #ifndef SKY_H 7 | #define SKY_H 8 | 9 | #include "common.h" 10 | 11 | /** 12 | * @class SKY 13 | * @brief Skyboxes. 14 | * 15 | * @todo Fill out the structure. 16 | */ 17 | struct SKY 18 | { 19 | // ... 20 | }; 21 | 22 | /** 23 | * @brief Initializes the sky with default values. 24 | * Calls super function PostAloLoad(). 25 | * 26 | * @param psky Pointer to the sky. 27 | */ 28 | void PostSkyLoad(SKY *psky); 29 | 30 | /** 31 | * @brief Updates the given sky. 32 | * 33 | * @param psky Pointer to the sky. 34 | * @param dt Delta time. 35 | */ 36 | void UpdateSky(SKY *psky, float dt); 37 | 38 | #endif // SKY_H 39 | -------------------------------------------------------------------------------- /include/smartguard.h: -------------------------------------------------------------------------------- 1 | #ifndef SMARTGUARD_H 2 | #define SMARTGUARD_H 3 | 4 | #include "common.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | /** 12 | * @class SMART_GUARD 13 | * @brief non-flashlight guard. 14 | */ 15 | struct SMARTGUARD : public STEPGUARD 16 | { 17 | // ... 18 | }; 19 | 20 | void InitSmartguard(SMARTGUARD *psmartguard); 21 | 22 | void PostSmartguardLoadFlashlight(SMARTGUARD *psmartguard); 23 | 24 | void UseSmartguardFlashlightTarget(SMARTGUARD *psmartguard, SGS sgs, OID oidTarget); 25 | 26 | void PostSmartguardLoad(SMARTGUARD *psmartguard); 27 | 28 | int FFilterSmartguardDetect(SMARTGUARD *psmartguard, SO *pso); 29 | 30 | int FDetectSmartguard(SMARTGUARD *psmartguard); 31 | 32 | void UpdateSmartguard(SMARTGUARD *psmartguard, float dt); 33 | 34 | void UpdateSmartguardFlashlight(SMARTGUARD *psmartguard); 35 | 36 | void OnSmartguardEnteringSgs(SMARTGUARD *psmartguard, SGS sgsPrev, ASEG *pasegOverride); 37 | 38 | int FCanSmartguardAttack(SMARTGUARD *psmartguard); 39 | 40 | SGAS SgasGetSmartguard(SMARTGUARD *psmartguard); 41 | 42 | void HandleSmartguardMessage(SMARTGUARD *psmartguard, MSGID msgid, void *pv); 43 | 44 | void FreezeSmartguard(SMARTGUARD *psmartguard, int fFreeze); 45 | 46 | #endif // SMARTGUARD_H 47 | -------------------------------------------------------------------------------- /include/sort.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sort.h 3 | */ 4 | #ifndef SORT_H 5 | #define SORT_H 6 | 7 | #include "common.h" 8 | 9 | /** 10 | * @brief Comparison function pointer for sorting. 11 | */ 12 | typedef int (* PFNCMP)(void *, void *); 13 | 14 | /** 15 | * @brief Swaps two entries in an array. 16 | * The swap is performed using 4-bytes at a time. 17 | * 18 | * @param afoo Pointer to the array. 19 | * @param cb Size of each element in bytes. 20 | * @param i1 Index of the first element to swap. 21 | * @param i2 Index of the second element to swap. 22 | */ 23 | void SwapEntries(void *afoo, int cb, int i1, int i2); 24 | 25 | /** 26 | * @brief Sorts an array in-place using the heap sort algorithm. 27 | * 28 | * @param afoo Pointer to the array. 29 | * @param iMac Number of elements in the array. 30 | * @param cb Size of each element in bytes. 31 | * @param pfncmp Pointer to a comparison function. 32 | */ 33 | void HeapSort(void *afoo, int iMac, int cb, PFNCMP pfncmp); 34 | 35 | #endif // SORT_H 36 | -------------------------------------------------------------------------------- /include/spaprops.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file spaprops.h 3 | */ 4 | #ifndef SPAPROPS_H 5 | #define SPAPROPS_H 6 | 7 | #include "common.h" 8 | 9 | void BuildEopids(); 10 | 11 | #endif // SPAPROPS_H 12 | -------------------------------------------------------------------------------- /include/speaker.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file speaker.h 3 | * 4 | * @brief Sound speaker management. 5 | */ 6 | #ifndef SPEAKER_H 7 | #define SPEAKER_H 8 | 9 | #include "common.h" 10 | #include 11 | 12 | /** 13 | * @class SPEAKER 14 | * @brief Sound speaker. 15 | * @todo Implement the struct. 16 | */ 17 | struct SPEAKER : public ALO 18 | { 19 | // ... 20 | }; 21 | 22 | // ... 23 | 24 | #endif // SPEAKER_H 25 | -------------------------------------------------------------------------------- /include/spire.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file spire.h 3 | */ 4 | #ifndef SPIRE_H 5 | #define SPIRE_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @class SPIRE 12 | * @brief Spire point that JT can balance on. 13 | */ 14 | struct SPIRE : public PNT 15 | { 16 | DLE dleSpire; 17 | }; 18 | 19 | #endif // SPIRE_H 20 | -------------------------------------------------------------------------------- /include/splice/bif.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/bif.h 3 | */ 4 | #ifndef SPLICE_BIF_H 5 | #define SPLICE_BIF_H 6 | 7 | #include "common.h" 8 | 9 | /** 10 | * @enum BIFK 11 | * 12 | * @todo Fill in enum. 13 | */ 14 | enum BIFK 15 | { 16 | // ... 17 | }; 18 | 19 | #endif // SPLICE_BIF_H 20 | -------------------------------------------------------------------------------- /include/splice/eval.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/eval.h 3 | */ 4 | #ifndef SPLICE_EVAL_H 5 | #define SPLICE_EVAL_H 6 | 7 | #include "common.h" 8 | 9 | // ... 10 | 11 | #endif // SPLICE_EVAL_H 12 | -------------------------------------------------------------------------------- /include/splice/frame.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/frame.h 3 | */ 4 | #ifndef SPLICE_FRAME_H 5 | #define SPLICE_FRAME_H 6 | 7 | #include "common.h" 8 | 9 | // Forward. 10 | class CRef; 11 | 12 | class CFrame 13 | { 14 | public: 15 | void SetSingleParent(CFrame *pframeParent); 16 | void AddParent(CFrame *pframeParent); 17 | CFrame *RefAddBinding(int symid, CRef * pref); 18 | CFrame *RefSetBinding(int symid, CRef *pref); 19 | int FFindBinding(int symid, int fRecursive, CRef *pref); 20 | CRef *PrefFindBinding(int symid, int fRecursive); 21 | void CloneTo(CFrame *pframeClone); 22 | }; 23 | 24 | // ... 25 | 26 | CFrame *PframeNew(); 27 | 28 | /** 29 | * @brief Deletes the frame. 30 | */ 31 | void DeleteFrame(CFrame *pframe); 32 | 33 | #endif // SPLICE_FRAME_H 34 | -------------------------------------------------------------------------------- /include/splice/gc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/gc.h 3 | */ 4 | #ifndef SPLICE_GC_H 5 | #define SPLICE_GC_H 6 | 7 | #include "common.h" 8 | 9 | class CFrame; 10 | class CPair; 11 | class CProc; 12 | class CSidebag; 13 | 14 | class CGc 15 | { 16 | private: 17 | int m_cpframeRoot; 18 | CFrame *m_apframeRoot[256]; 19 | 20 | STRUCT_PADDING(64); 21 | 22 | int m_cpsidebagRoot; 23 | CSidebag *m_apsidebagRoot[128]; 24 | int m_cpframeStack; 25 | CFrame *m_apframeStack[512]; 26 | int m_cppairStack; 27 | CPair *m_appairStack[256]; 28 | int m_cpprocStack; 29 | CProc *m_approcStack[1024]; 30 | 31 | public: 32 | CGc(); 33 | ~CGc(); 34 | void Startup(); 35 | void Shutdown(); 36 | void AddRootFrame(CFrame *pframe); 37 | void AddRootSidebag(CSidebag *psidebag); 38 | void PushFrame(CFrame *pframe); 39 | CFrame *PframePop(); 40 | void PushPair(CPair *ppair); 41 | CPair *PpairPop(); 42 | void PushProc(CProc *pproc); 43 | CProc *PprocPop(); 44 | void UpdateRecyclable(); 45 | void MarkLiveObjects(); 46 | void Collect(); 47 | }; 48 | 49 | // static CGc g_gc; 50 | 51 | #endif // SPLICE_GC_H 52 | -------------------------------------------------------------------------------- /include/splice/method.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/method.h 3 | */ 4 | #ifndef SPLICE_METHOD_H 5 | #define SPLICE_METHOD_H 6 | 7 | #include "common.h" 8 | 9 | struct BASIC; 10 | 11 | /** 12 | * @class CMethod 13 | */ 14 | class CMethod 15 | { 16 | BASIC* m_pbasic; 17 | void* m_pfnthunk; //todo: fix type? 18 | int m_crefReq; 19 | }; 20 | 21 | CMethod* PmethodNew(); 22 | 23 | #endif // SPLICE_METHOD_H 24 | -------------------------------------------------------------------------------- /include/splice/pair.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/pair.h 3 | */ 4 | #ifndef SPLICE_PAIR_H 5 | #define SPLICE_PAIR_H 6 | 7 | #include "common.h" 8 | #include "splice/ref.h" 9 | 10 | /** 11 | * @class CPair 12 | * 13 | * @todo Fill in class. 14 | */ 15 | class CPair 16 | { 17 | CRef m_ref; 18 | CPair* m_ppairNext; 19 | 20 | public: 21 | void CloneTo(CPair* ppairClone, CFrame* pframeClone); 22 | }; 23 | 24 | CPair* PpairNew(); 25 | void DeletePair(CPair* ppair); 26 | 27 | #endif // SPLICE_PAIR_H 28 | -------------------------------------------------------------------------------- /include/splice/proc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/proc.h 3 | */ 4 | #ifndef SPLICE_PROC_H 5 | #define SPLICE_PROC_H 6 | 7 | #include "common.h" 8 | 9 | class CFrame; 10 | class CPair; 11 | 12 | /** 13 | * @class CProc 14 | * 15 | * @todo Fill in class. 16 | */ 17 | class CProc 18 | { 19 | private: 20 | CFrame *m_pframe; 21 | CPair *m_ppair; 22 | int m_crefReq; 23 | int m_fVarArg; 24 | CPair *m_ppairCodeExpr; 25 | 26 | public: 27 | void CloneTo(CProc *pprocClone, CFrame *pframeClone); 28 | }; 29 | 30 | CProc *PprocNew(); 31 | 32 | #endif // SPLICE_PROC_H 33 | -------------------------------------------------------------------------------- /include/splice/serialize.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/serialize.h 3 | */ 4 | #ifndef SPLICE_SERIALIZE_H 5 | #define SPLICE_SERIALIZE_H 6 | 7 | #include "common.h" 8 | 9 | // ... 10 | 11 | #endif // SPLICE_SERIALIZE_H 12 | -------------------------------------------------------------------------------- /include/splice/sidebag.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/sidebag.h 3 | * 4 | * @brief Sidebag for splice. 5 | */ 6 | #ifndef SPLICE_SIDEBAG_H 7 | #define SPLICE_SIDEBAG_H 8 | 9 | #include "common.h" 10 | 11 | class CRef; 12 | 13 | // todo Find where this struct should be implemented. 14 | struct SBB 15 | { 16 | }; 17 | 18 | class CSidebag 19 | { 20 | private: 21 | int m_csbb; 22 | SBB m_asbb[16]; 23 | 24 | public: 25 | CSidebag& RefAddBinding(int, CRef*); 26 | CSidebag& RefSetBinding(int, CRef*); 27 | bool FFindBinding(int, CRef*); 28 | void CloneTo(CSidebag*); 29 | 30 | }; 31 | 32 | /** 33 | * @brief Creates a new sidebag. 34 | * 35 | * @return A pointer to the newly created sidebag. 36 | */ 37 | CSidebag* PsidebagNew(); 38 | 39 | #endif // SPLICE_SIDEBAG_H 40 | -------------------------------------------------------------------------------- /include/splice/spliceutils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/spliceutils.h 3 | * 4 | * @brief Utility functions for the splice scripting engine. 5 | */ 6 | #ifndef SPLICE_SPLICEUTILS_H 7 | #define SPLICE_SPLICEUTILS_H 8 | 9 | #include "common.h" 10 | 11 | /** 12 | * @brief Splice startup function. 13 | */ 14 | void StartupSplice(); 15 | 16 | /** 17 | * @brief Startup function for the splice structured type factories. 18 | */ 19 | void StartupSpliceStructuredTypeFactories(); 20 | 21 | #endif // SPLICE_SPLICEUTILS_H 22 | -------------------------------------------------------------------------------- /include/splice/splotheap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/splotheap.h 3 | */ 4 | #ifndef SPLICE_SPLOTHEAP_H 5 | #define SPLICE_SPLOTHEAP_H 6 | 7 | #include "common.h" 8 | 9 | typedef void (*PFNDELETE)(void *); 10 | 11 | struct SPLOT 12 | { 13 | SPLOT *psplotNext; 14 | int fAlive; 15 | }; 16 | 17 | class CSplotheap 18 | { 19 | private: 20 | int m_cb; 21 | int m_c; 22 | byte *m_ab; 23 | SPLOT *m_psplotFree; 24 | SPLOT *m_psplotAlloc; 25 | SPLOT *m_psplotRecyclable; 26 | 27 | public: 28 | PFNDELETE m_pfndelete; 29 | 30 | void Startup(int cb, int c); 31 | void Shutdown(); 32 | int PvAllocUnsafe(); 33 | void *PvAllocClear(); 34 | int PsplotLookup(int); 35 | void UpdateRecyclable(); 36 | void UnmarkAll(); 37 | void FreeGarbage(); 38 | }; 39 | 40 | extern CSplotheap g_splotheapPair; 41 | extern CSplotheap g_splotheapFrame; 42 | extern CSplotheap g_splotheapUnk1; 43 | extern CSplotheap g_splotheapProc; 44 | extern CSplotheap g_splotheapMethod; 45 | 46 | static void *PvFromPsplot(SPLOT *psplot); 47 | static SPLOT *PsplotFromPv(void *pv); 48 | bool FIsPvGarbage(void *pv); 49 | void MarkPvAlive(void *pv); 50 | 51 | #endif // SPLICE_SPLOTHEAP_H 52 | -------------------------------------------------------------------------------- /include/splice/vecmat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splice/vecmat.h 3 | */ 4 | #ifndef SPLICE_VECMAT_H 5 | #define SPLICE_VECMAT_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | 12 | VECTOR *PvectorNew(); 13 | 14 | void IncrefVector(VECTOR *pvector); 15 | 16 | void DecrefVector(VECTOR *pvector); 17 | 18 | void IncrefMatrix(MATRIX4 *pmatrix); 19 | 20 | void DecrefMatrix(MATRIX4 *pmatrix); 21 | 22 | void IncrefClq(CLQ *pclq); 23 | 24 | void DecrefClq(CLQ *pclq); 25 | 26 | void IncrefLm(LM *plm); 27 | 28 | void DecrefLm(LM *plm); 29 | 30 | SMP *PsmpNew(); 31 | 32 | void IncrefSmp(SMP *psmp); 33 | 34 | void DecrefSmp(SMP *psmp); 35 | 36 | void StartupSpliceStructuredTypeFactories(); 37 | 38 | void ShutdownSpliceStructuredTypeFactories(); 39 | 40 | #endif // SPLICE_VECMAT_H 41 | -------------------------------------------------------------------------------- /include/splicemap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file splicemap.h 3 | * 4 | * @brief Splice maps. 5 | */ 6 | #ifndef SPLICEMAP_H 7 | #define SPLICEMAP_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | 14 | void LoadSwSpliceFromBrx(SW *psw, CBinaryInputStream *pbis); 15 | 16 | CFrame *PframeFromIsplice(int isplice, SW *psw); 17 | 18 | CRef RefEvalModule(int isplice, SW *psw); 19 | 20 | #endif // SPLICEMAP_H 21 | -------------------------------------------------------------------------------- /include/spliceobj.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file spliceobj.h 3 | * 4 | * @brief Splice objects. 5 | */ 6 | #ifndef SPLICEOBJ_H 7 | #define SPLICEOBJ_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | 14 | typedef void (*PFNGET)(OTYP); 15 | 16 | EOPID *PeopidFind(BASIC *pbasic, int optid); 17 | 18 | CRef RefGetObjectList(BASIC *pbasic, OTYP otyp, PFNGET pfnget); 19 | 20 | CRef RefGetPeopid(BASIC *pbasic, EOPID *peopid); 21 | 22 | int FAppendSpliceListElement(void *pvstate, void *pvdata); 23 | 24 | int FSpliceListElementExists(void *pvstate, void *pvdata); 25 | 26 | CRef RefSetPvsFromSplice(int cref, CRef *aref, OTYP *aotyp, void **apv); 27 | 28 | CRef RefSetArgListFromPvs(int cargs, OTYP *aotyp, void **apv); 29 | 30 | CRef RefSetPeopid(BASIC *pbasic, EOPID *peopid, CRef *prefValue); 31 | 32 | CRef RefGetOption(BASIC *pbasic, int optid); 33 | 34 | CRef RefSetOption(BASIC *pbasic, int optid, CRef *prefValue); 35 | 36 | CRef RefAddOption(BASIC *pbasic, int optid, CRef *prefValue); 37 | 38 | CRef RefEnsureOption(BASIC *pbasic, int optid, CRef *prefValue); 39 | 40 | CRef RefSetArgsFromSplice(int cref, CRef *aref, OTYP *aotyp); 41 | 42 | #endif // SPLICEOBJ_H 43 | -------------------------------------------------------------------------------- /include/sprbuf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sprbuf.h 3 | */ 4 | #ifndef SPRBUF_H 5 | #define SPRBUF_H 6 | 7 | #include "common.h" 8 | 9 | void LoadSprBuf(int cb); 10 | 11 | void SaveSprBuf(void *pv); 12 | 13 | #endif // SPRBUF_H 14 | -------------------------------------------------------------------------------- /include/sqtr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sqtr.h 3 | */ 4 | #ifndef SQTR_H 5 | #define SQTR_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | /** 14 | * @brief Unknown. 15 | * @todo Implement the struct. 16 | */ 17 | struct SQTRM 18 | { 19 | // ... 20 | }; 21 | 22 | void UpdateSqtrm(SQTRM *psqtrm, VECTOR *ppos, MATRIX3 *pmat, float swExtra, float dt); 23 | 24 | void RenderSqtrm(SQTRM *psqtrm, CM *pcm); 25 | 26 | void DrawSqtrm(RPL *prpl); 27 | 28 | #endif SQTR_H 29 | -------------------------------------------------------------------------------- /include/stepact.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file stepact.h 3 | */ 4 | #ifndef STEPACT_H 5 | #define STEPACT_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @brief Unknown. 12 | * @todo Implement the struct. 13 | */ 14 | struct ACTADD : public ACT 15 | { 16 | // ... 17 | }; 18 | 19 | void GetActaddPositionGoal(ACTADD *pactadd, float dtOffset, VECTOR *ppos, VECTOR *pv); 20 | void GetActaddRotationGoal(ACTADD *pactadd, float dtOffset, MATRIX3 *pmat, VECTOR *pw); 21 | 22 | #endif // STEPACT_H 23 | -------------------------------------------------------------------------------- /include/stepcane.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file stepcane.h 3 | */ 4 | #ifndef STEPCANE_H 5 | #define STEPCANE_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | // Forward. 14 | struct ASEGBL; 15 | 16 | /** 17 | * @brief Unknown. 18 | * @todo Implement the struct. 19 | */ 20 | struct BL 21 | { 22 | // ... 23 | }; 24 | 25 | void SetJtJtcs(JT *pjt, JTCS jtcs); 26 | 27 | void UpdateJtCane(JT *pjt); 28 | 29 | void UpdateJtActiveCane(JT *pjt, JOY *pjoy); 30 | 31 | void ChooseJtAttackTarget(JT *pjt, GRFTAK grftak, VECTOR *pposNaturalLocal, float dtProj, float dradMax, TARGET **pptarget, VECTOR *pdposProj); 32 | 33 | void ChooseJtSweepTarget(JT *pjt, BL *ablSweep, ASEGBL *pasegbl); 34 | 35 | void ChooseJtRushTarget(JT *pjt); 36 | 37 | void ChooseJtSmashTarget(JT *pjt); 38 | 39 | #endif // STEPCANE_H 40 | -------------------------------------------------------------------------------- /include/stephang.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file stephang.h 3 | */ 4 | #ifndef STEPHANG_H 5 | #define STEPHANG_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | 11 | // Forward. 12 | struct BL; 13 | struct FX; 14 | struct ASEGBL; 15 | 16 | typedef int GRFAHX; 17 | 18 | void PostJtLoadSwing(JT *pjt, BL *ablSwing, ASEGBL **ppasegbl); 19 | 20 | void AnticipateJtForce_(JT *pjt, SO *psoOther, VECTOR *pposOther, VECTOR *pdv, FX *afx); 21 | 22 | void CalculateJtHangAccel(JT *pjt); 23 | 24 | void PresetJtAccelHang(JT *pjt); 25 | 26 | void AddJtExternalAccelerations(JT *pjt, XA *pxa, float dt); 27 | 28 | void UpdateJtActiveHang(JT *pjt, JOY *pjoy); 29 | 30 | void CheckJtUnhook(JT *pjt); 31 | 32 | void UpdateJtHookOx(JT *pjt, LO *ploHook, int fHook); 33 | 34 | void AddJtHookXps(JT *pjt, GRFAHX grfahx, LO *ploHook, VECTOR *pposHook, VECTOR *pvecHook, VECTOR *pposHang); 35 | 36 | void GetJtHangHeading(JT *pjt, float *pradForward); 37 | 38 | void UpdateJtIkHang(JT *pjt); 39 | 40 | #endif // STEPHANG_H 41 | -------------------------------------------------------------------------------- /include/stephide.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file stephide.h 3 | */ 4 | #ifndef STEPHIDE_H 5 | #define STEPHIDE_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | // Forward. 11 | struct MJR; 12 | struct MJH; 13 | struct XMG; 14 | struct RAIL; 15 | struct ACTADJ; 16 | 17 | /** 18 | * @brief Unknown. 19 | */ 20 | enum HFDK 21 | { 22 | HFDK_Nil = -1, 23 | HFDK_Match = 0, 24 | HFDK_Left = 1, 25 | HFDK_Right = 2, 26 | HFDK_Stand = 3, 27 | HFDK_Max = 4 28 | }; 29 | 30 | JTBS JtbsChooseJtHide(JT *pjt, LO *ploForce, JTHK *pjthk); 31 | 32 | void MeasureJtJumpToTarget(JT *pjt, VECTOR *pvJump, ALO *palo, VECTOR *pposTarget, VECTOR *pdvTarget, float *pdtJump, float *pgInteg, VECTOR *pposPredict, VECTOR *pvPredict); 33 | 34 | void GetJtRailLanding(JT *pjt, RAIL *prail, float uRail, VECTOR *ppos, VECTOR *pv); 35 | 36 | float GMeasureJumpRail(MJR *pmjr, float u); 37 | 38 | float GMeasureJumpHshape(MJH *pmjh, float s); 39 | 40 | // TODO: Add unknown functions here. 41 | 42 | void UpdateJtActiveHide(JT *pjt, JOY *pjoy); 43 | 44 | void MatchJtXmgRail(JT *pjt, XMG *pxmg, ACTADJ *pactadj); 45 | 46 | void UpdateJtHide(JT *pjt); 47 | 48 | void UpdateJtInternalXpsHide(JT *pjt); 49 | 50 | void SetJtHfdk(JT *pjt, HFDK hfdk); 51 | 52 | void ResetJtDynamicTunnel(JT *pjt); 53 | 54 | void PresetJtAccelHide(JT *pjt); 55 | 56 | #endif // STEPHIDE_H 57 | -------------------------------------------------------------------------------- /include/steppipe.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file steppipe.h 3 | */ 4 | #ifndef STEPPIPE_H 5 | #define STEPPIPE_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | 12 | void PostJtLoadPipe(JT *pjt); 13 | 14 | void GetJtPipeGoalMat(JT *pjt, PIPE *ppipe, float s, MATRIX3 *pmat); 15 | 16 | void PresetJtAccelPipe(JT *pjt); 17 | 18 | void UpdateJtActivePipe(JT *pjt, JOY *pjoy); 19 | 20 | void UpdateJtInternalXpsPipe(JT *pjt); 21 | 22 | void SetJtJtpdk(JT *pjt, JTPDK jtpdk); 23 | 24 | void PlaceJtOnPipe(JT *pjt, PIPE *ppipe); 25 | 26 | #endif // STEPPIPE_H 27 | -------------------------------------------------------------------------------- /include/steprail.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file steprail.h 3 | * 4 | * @brief Rail behavior for STEP objects. 5 | */ 6 | #ifndef STEPRAIL_H 7 | #define STEPRAIL_H 8 | 9 | #include "common.h" 10 | #include 11 | 12 | /** 13 | * @brief Unknown function, more research needed. 14 | */ 15 | void func_001D31D0(LO *param_1, int param_2); 16 | 17 | /** 18 | * @brief Unknown function, more research needed. 19 | */ 20 | void func_001D32D8(int param_1, JT *param_2, long param_3); 21 | 22 | #endif // STEPRAIL_H 23 | -------------------------------------------------------------------------------- /include/steprun.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file steprun.h 3 | */ 4 | #ifndef STEPRUN_H 5 | #define STEPRUN_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | // Forward. 11 | struct MRSG; 12 | struct ASEGA; 13 | struct ASEGBL; 14 | 15 | /** 16 | * @brief Unknown. 17 | * @todo Implement the struct. 18 | */ 19 | struct BLRUN : public BL 20 | { 21 | // ... 22 | }; 23 | 24 | void PostStepLoadRun(STEP *pstep, BLRUN *ablrun, ASEGBL **ppasegbl); 25 | 26 | void CalculateBlrunV(int cblrun, BLRUN *ablrun, MRSG *amrsgBlend, VECTOR *pv); 27 | 28 | void ProjectStepRunPlant(STEP *pstep, BLRUN *ablrun, float uPlant, float rJt, int iblrunWalk, int iblrunRun, VECTOR *pposPlant); 29 | 30 | int FIntersectStepRunPlant(STEP *pstep, VECTOR *pposUp, VECTOR *pposDown, float *pu); 31 | 32 | int FReblendAbl2D(int cbBl, int c1, int c2, BL *abl); 33 | 34 | void AdjustStepRun(STEP *pstep, BLRUN *ablrun, ASEGBL *pasegbl, ASEGA *pasega); 35 | 36 | void SetStepRunTarget(STEP *pstep, float rad, float u, BLRUN *ablrun, ASEGBL *pasegbl); 37 | 38 | #endif // STEPRUN_H 39 | -------------------------------------------------------------------------------- /include/stepside.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file stepside.h 3 | */ 4 | #ifndef STEPSIDE_H 5 | #define STEPSIDE_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | // Forward. 11 | struct JT; 12 | struct ASEGBL; 13 | 14 | /** 15 | * @brief Unknown. 16 | * @todo Implement the struct. 17 | */ 18 | struct BLSS : public BL 19 | { 20 | // ... 21 | }; 22 | 23 | void PostJtLoadSidestep(JT *pjt, BLSS *ablss, ASEGBL **ppasegbl); 24 | 25 | void AdjustJtSidestep(JT *pjt, BLSS *ablss, ASEGBL *pasegbl); 26 | 27 | void SetJtSidestepTarget(JT *pjt, BLSS *ablss, ASEGBL *pasegbl, float rad, float u); 28 | 29 | #endif // STEPSIDE_H 30 | -------------------------------------------------------------------------------- /include/stepzap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file stepzap.h 3 | */ 4 | #ifndef STEPZAP_H 5 | #define STEPZAP_H 6 | 7 | #include "common.h" 8 | 9 | // ... 10 | 11 | #endif // STEPZAP_H 12 | -------------------------------------------------------------------------------- /include/stream.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file stream.h 3 | * 4 | * @brief Output stream. 5 | */ 6 | #ifndef STREAM_H 7 | #define STREAM_H 8 | 9 | #include "common.h" 10 | 11 | /** 12 | * @brief Output stream. 13 | */ 14 | struct OSTRM 15 | { 16 | uchar *m_abDest; 17 | int m_cbDest; 18 | int m_ibCur; 19 | int m_fd; 20 | int m_cbWritten; 21 | int m_cbBuffered; 22 | uchar m_abBuffered[1024]; 23 | 24 | /** 25 | * @brief Create a new output stream that writes to a file. 26 | * 27 | * @param fd File descriptor. 28 | */ 29 | OSTRM(int fd); 30 | 31 | /** 32 | * @brief Create a new output stream that writes to a buffer. 33 | * 34 | * @param abDest Pointer to the destination. 35 | * @param cbDest Size of the destination in bytes. 36 | */ 37 | OSTRM(void *abDest, int cbDest); 38 | 39 | ~OSTRM(); 40 | 41 | int CbWrite(void *ab, int cb); 42 | 43 | void Flush(); 44 | }; 45 | 46 | #endif // STREAM_H 47 | -------------------------------------------------------------------------------- /include/suv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file suv.h 3 | * 4 | * @brief Smash-up vehicle (the van and other racecars). 5 | */ 6 | #ifndef SUV_H 7 | #define SUV_H 8 | 9 | #include "common.h" 10 | 11 | /** 12 | * @class SMASHUP_VEHICLE 13 | * @brief Vehicles used in At the Dog Track, A Desperate Race, and Burning Rubber (not A Hazardous Path). 14 | * 15 | * @todo What is the base class? 16 | */ 17 | struct SUV // : TBD 18 | { 19 | // ... 20 | }; 21 | 22 | #endif // SUV_H 23 | -------------------------------------------------------------------------------- /include/tail.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file tail.h 3 | * 4 | * @brief JT tail physics. 5 | */ 6 | #ifndef TAIL_H 7 | #define TAIL_H 8 | 9 | #include "common.h" 10 | 11 | /** 12 | * @class TAIL 13 | * @brief Used for Sly's tail, and the accessory on top of the Cooper van. 14 | */ 15 | struct TAIL 16 | { 17 | // ... 18 | }; 19 | 20 | #endif // TAIL_H 21 | -------------------------------------------------------------------------------- /include/tank.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file tank.h 3 | */ 4 | #ifndef TANK_H 5 | #define TANK_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | // Forward. 17 | enum MSGID; 18 | 19 | /** 20 | * @brief Tank State. 21 | */ 22 | enum TANKS 23 | { 24 | TANKS_Nil = -1, 25 | TANKS_Passive = 0, 26 | TANKS_Active = 1, 27 | TANKS_Zap = 2, 28 | TANKS_Dead = 3, 29 | TANKS_Peek = 4, 30 | TANKS_Max = 5 31 | }; 32 | 33 | /** 34 | * @class HOVER_TANK 35 | * @brief Hover tank used in A Ghastly Voyage and Rapid Fire Assault. 36 | */ 37 | struct TANK : public STEP 38 | { 39 | // ... 40 | }; 41 | 42 | void InitTank(TANK *ptank); 43 | 44 | void PostTankLoad(TANK *ptank); 45 | 46 | void UpdateTank(TANK *ptank, float dt); 47 | 48 | void UseTankCharm(TANK *ptank); 49 | 50 | void UpdateTankActive(TANK *ptank, JOY *pjoy, float dt); 51 | 52 | void OnTankActive(TANK *ptank, int fActive, PO *ppoOther); 53 | 54 | void RenderTankAll(TANK *ptank, CM *pcm, RO *pro); 55 | 56 | void ImpactTank(TANK *ptank, int fParentDirty); 57 | 58 | int FInvulnerableTank(TANK *ptank, ZPK zpk); 59 | 60 | void ApplyTankThrow(TANK *ptank, PO *ppo); 61 | 62 | int FTakeTankDamage(TANK *ptank, ZPR *pzpr); 63 | 64 | // TODO: Define XP. 65 | // void AdjustTankNewXp(TANK *ptank, XP *pxp, int ixpd); 66 | 67 | void HandleTankMessage(TANK *ptank, MSGID msgid, void *pv); 68 | 69 | JTHS JthsCurrentTank(TANK *ptank); 70 | 71 | void SetTankTanks(TANK *ptank, TANKS tanks); 72 | 73 | #endif // TANK_H 74 | -------------------------------------------------------------------------------- /include/target.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file target.h 3 | */ 4 | #ifndef TARGET_H 5 | #define TARGET_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | 11 | /** 12 | * @class TARGET 13 | * @brief Target point defined by a transform, radius, and some other data. 14 | */ 15 | struct TARGET : public XFM 16 | { 17 | /* 0x80 */ DLE dleTarget; 18 | /* 0x88 */ int grftak; 19 | /* 0x8c */ float sRadiusTarget; 20 | /* 0x90 */ int fHitTest; 21 | undefined4 unk0; 22 | undefined4 unk1; 23 | undefined4 unk2; 24 | }; 25 | 26 | void StartupTarget(); 27 | 28 | void ResetTargetList(); 29 | 30 | void InitTarget(TARGET *ptarget); 31 | 32 | void OnTargetAdd(TARGET *ptarget); 33 | 34 | void OnTargetRemove(TARGET *ptarget); 35 | 36 | void CloneTarget(TARGET *ptarget, TARGET *ptargetBase); 37 | 38 | #endif // TARGET_H 39 | -------------------------------------------------------------------------------- /include/thread.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file thread.h 3 | * 4 | * @brief Semaphore, thread, and critical section utilities. 5 | */ 6 | #ifndef THREAD_H 7 | #define THREAD_H 8 | 9 | #include "common.h" 10 | 11 | /** 12 | * @brief Details for a critical section 13 | */ 14 | struct CRITSECT 15 | { 16 | int cEnter; 17 | int thread; 18 | int sema; 19 | }; 20 | 21 | /** 22 | * @brief Create a semaphore. 23 | * 24 | * @param initCount Initial count. 25 | * @param maxCount Maximum count. 26 | * @return The semaphore ID. 27 | */ 28 | int SemaCreate(int initCount, int maxCount); 29 | 30 | /** 31 | * @brief Initialize a critical section. 32 | * 33 | * @param pcritsect Critical section. 34 | */ 35 | void InitCritSect(CRITSECT* pcritsect); 36 | 37 | /** 38 | * @brief Enter a critical section. 39 | * 40 | * @param pcritsect Critical section. 41 | */ 42 | void EnterCritSect(CRITSECT* pcritsect); 43 | 44 | /** 45 | * @brief Leave a critical section. 46 | * 47 | * @param pcritsect Critical section. 48 | */ 49 | void LeaveCritSect(CRITSECT* pcritsect); 50 | 51 | /** 52 | * @brief Initialize parameters for a rendering thread. 53 | */ 54 | void StartupThread(); 55 | 56 | extern CRITSECT g_athread; 57 | 58 | #endif // THREAD_H 59 | -------------------------------------------------------------------------------- /include/turret.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file turret.h 3 | * 4 | * @brief Stationary turret from Murray levels(?). 5 | */ 6 | #ifndef TURRET_H 7 | #define TURRET_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | /** 18 | * @class TURRET 19 | * @brief Stationary turret (maybe the one used in the murray levels). 20 | */ 21 | struct TURRET : public PO 22 | { 23 | // ... 24 | }; 25 | 26 | void InitTurret(TURRET *pturret); 27 | 28 | void PostTurretLoad(TURRET *pturret); 29 | 30 | void UpdateTurret(TURRET *pturret, float dt); 31 | 32 | void UpdateTurretActive(TURRET *pturret, JOY *pjoy, float dt); 33 | 34 | void OnTurretActive(TURRET *pturret, int fActive, PO *ppoOther); 35 | 36 | int FFilterTurret(TURRET *pturret, SO *psoOther); 37 | 38 | void UpdateTurretAim(TURRET *pturret); 39 | 40 | void FireTurret(TURRET *pturret); 41 | 42 | void HandleTurretMessage(TURRET *pturret, MSGID msgid, void *pv); 43 | 44 | int FIgnoreTurretIntersection(TURRET *pturret, SO *psoOther); 45 | 46 | void CollectTurretPrize(TURRET *pturret, PCK pck, ALO *paloOther); 47 | 48 | void GetTurretDiapi(TURRET *pturret, DIALOG *pdialog, DIAPI *pdiapi); 49 | 50 | #endif // TURRET_H 51 | -------------------------------------------------------------------------------- /include/tv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file tv.h 3 | */ 4 | #ifndef TV_H 5 | #define TV_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | // Forward. 14 | struct RPL; 15 | 16 | /** 17 | * @brief TV State. 18 | */ 19 | enum TVS 20 | { 21 | TVS_Nil = -1, 22 | TVS_Listen = 0, 23 | TVS_Talk = 1, 24 | TVS_Max = 2 25 | }; 26 | 27 | /** 28 | * @brief TV (?) State. 29 | */ 30 | enum TVGS 31 | { 32 | TVGS_Nil = -1, 33 | TVGS_Opening = 0, 34 | TVGS_Open = 1, 35 | TVGS_Closing = 2, 36 | TVGS_Closed = 3, 37 | TVGS_Max = 4 38 | }; 39 | 40 | /** 41 | * @brief Unknown. 42 | * @todo Implement the struct. 43 | */ 44 | struct TV : public BLOT 45 | { 46 | // ... 47 | }; 48 | 49 | void InitTv(TV *ptv, BLOTK blotk); 50 | 51 | void PostTvLoad(TV *ptv); 52 | 53 | void GetTvItvbMinMax(TV *ptv, int *pitvbDrawMin, int *pitvbDrawMax); 54 | 55 | void DrawTvArea(TV *ptv, GIFS *gifs, int z); 56 | 57 | void DrawTvBands(TV *ptv, GIFS *gifs); 58 | 59 | void DrawTvOutline(TV *ptv, GIFS *gifs); 60 | 61 | void DrawTv(TV *ptv); 62 | 63 | void SetTvTvs(TV *ptv, TVS tvs); 64 | 65 | void AcceptTvSpeaker(TV *ptv); 66 | 67 | void SetTvTvgs(TV *ptv, TVGS tvgs); 68 | 69 | void SetTvBlots(TV *ptv, BLOTS blots); 70 | 71 | void UpdateTv(TV *ptv); 72 | 73 | void RenderTv(TV *ptv); 74 | 75 | void PreTvContext(RPL *prpl); 76 | 77 | void PostTvContext(RPL *prpl); 78 | 79 | void SetTvSpeaker(TV *ptv, SPEAKER *pspeaker); 80 | 81 | void SetTvReplace(TV *ptv, ALO *paloReplace); 82 | 83 | void OnTvReset(TV *ptv); 84 | 85 | #endif // TV_H 86 | -------------------------------------------------------------------------------- /include/types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file types.h 3 | * 4 | * @brief Common types used across the codebase. 5 | */ 6 | #ifndef TYPES_H 7 | #define TYPES_H 8 | 9 | // Exact-width integers (don't use these in most cases) 10 | typedef signed char int8_t; 11 | typedef short int16_t; 12 | typedef int int32_t; 13 | typedef long long int64_t; 14 | 15 | typedef unsigned char uint8_t; 16 | typedef unsigned short uint16_t; 17 | typedef unsigned int uint32_t; 18 | typedef unsigned long long uint64_t; 19 | 20 | // Unsigned aliases 21 | typedef uint8_t uchar; 22 | typedef uint16_t ushort; 23 | typedef uint32_t uint; 24 | typedef uint64_t ulong; 25 | 26 | // Helper types for unknown struct fields 27 | typedef uchar undefined1; 28 | typedef ushort undefined2; 29 | typedef uint undefined4; 30 | typedef ulong undefined8; 31 | 32 | // Misc 33 | typedef uchar byte; 34 | #define nullptr (void *)0x0 35 | typedef union QW; 36 | 37 | #endif // TYPES_H 38 | -------------------------------------------------------------------------------- /include/ub.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file ub.h 3 | * 4 | * @brief Underwater boss. 5 | */ 6 | #ifndef UB_H 7 | #define UB_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | 14 | // Forward. 15 | struct ASEG; 16 | 17 | /** 18 | * @class UW_BOSS_GOMER 19 | * @brief Underwater boss gomer (Raleigh). 20 | */ 21 | struct UBG : public GOMER 22 | { 23 | // ... 24 | }; 25 | 26 | void InitUbg(UBG *pubg); 27 | 28 | void PostUbgLoad(UBG *pubg); 29 | 30 | SO *PsoPadUbgClosest(UBG *pubg, VECTOR *ppos); 31 | 32 | void OnUbgEnteringSgs(UBG *pubg, SGS sgsPrev, ASEG *pasegOverride); 33 | 34 | SGS SgsNextUbgAI(UBG *pubg); 35 | 36 | int FDetectUbg(UBG *pubg); 37 | 38 | int FCanUbgAttack(UBG *pubg); 39 | 40 | void DoUbgFreefallJump(UBG *pubg); 41 | 42 | void DoUbgFreefallLanding(UBG *pubg); 43 | 44 | void UpdateUbgGoal(UBG *pubg, int fEnter); 45 | 46 | void UpdateUbgSgs(UBG *pubg); 47 | 48 | int FIgnoreUbgIntersection(UBG *pubg, SO *psoOther); 49 | 50 | #endif // UB_H 51 | -------------------------------------------------------------------------------- /include/update.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file update.h 3 | */ 4 | #ifndef UPDATE_H 5 | #define UPDATE_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @brief Updates all objects in the given SW. 12 | * 13 | * @param psw The SW to update. 14 | * @param dt Delta time. 15 | */ 16 | void UpdateSwObjects(SW *psw, float dt); 17 | 18 | void UpdateSwPosWorldPrev(SW *psw); 19 | 20 | void UpdateSwRealClock(SW *psw, float dt); 21 | 22 | void UpdateSwDarkening(SW *psw, float dt); 23 | 24 | /** 25 | * @brief Updates the given SW. 26 | * 27 | * @param psw The SW to update. 28 | * @param dt Delta time. 29 | */ 30 | void UpdateSw(SW *psw, float dt); 31 | 32 | #endif // UPDATE_H 33 | -------------------------------------------------------------------------------- /include/vb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file vb.h 3 | * 4 | * @brief Voodoo boss. 5 | */ 6 | #ifndef VB_H 7 | #define VB_H 8 | 9 | #include 10 | 11 | /** 12 | * @class V_BOSS_GUARD 13 | * @brief Voodoo boss guard (Mz Ruby). 14 | */ 15 | struct VBG : public STEPGUARD 16 | { 17 | // ... 18 | }; 19 | 20 | #endif // VB_H 21 | -------------------------------------------------------------------------------- /include/vifs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file vifs.h 3 | */ 4 | #ifndef VIFS_H 5 | #define VIFS_H 6 | 7 | #include "common.h" 8 | #include 9 | 10 | /** 11 | * @brief Unknown. 12 | * @todo Implement the class. 13 | */ 14 | class VIFS : public DMAS 15 | { 16 | // ... 17 | }; 18 | 19 | // ... 20 | 21 | #endif // VIFS_H 22 | -------------------------------------------------------------------------------- /include/vis.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file vis.h 3 | * 4 | * @brief Visibility map. 5 | */ 6 | #ifndef VIS_H 7 | #define VIS_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | typedef int GRFZON; 16 | 17 | /** 18 | * @class VISMAP 19 | * @brief Visibility map. 20 | */ 21 | struct VISMAP : public LO 22 | { 23 | int cvbsp; 24 | VBSP *avbsp; 25 | int cgrfzon; 26 | GRFZON *agrfzonOneHop; 27 | }; 28 | 29 | void InitVismap(VISMAP *pvismap); 30 | 31 | void LoadVismapFromBrx(VISMAP *pvismap, CBinaryInputStream *pbis); 32 | 33 | GRFZON GrfzonOneHop(VISMAP *pvismap, VBSP *pvbsp); 34 | 35 | void ClipVbspSphereOneHop(VISMAP *pvismap, VBSP *pvbsp, VU_VECTOR pos, float sRadius, GRFZON *pgrfzon); 36 | 37 | void ClipVismapSphereOneHop(VISMAP *pvismap, VECTOR *ppos, float sRadius, GRFZON *pgrfzon); 38 | 39 | void ClipVismapPointNoHop(VISMAP *pvismap, VECTOR *ppos, GRFZON *pgrfzon); 40 | 41 | #endif // VIS_H 42 | -------------------------------------------------------------------------------- /include/vol.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file vol.h 3 | * 4 | * @brief Volume object. 5 | * 6 | * @note Not referenced in any debug symbols, but it doesn't make sense 7 | * to put the VOL struct anywhere else. 8 | */ 9 | #ifndef VOL_H 10 | #define VOL_H 11 | 12 | #include "common.h" 13 | #include 14 | 15 | /** 16 | * @class VOLUME 17 | * @brief Volume in space defined by transform, tsurf, and tbsp. 18 | */ 19 | struct VOL : public XFM 20 | { 21 | int ctsurf; 22 | TSURF *atsurf; 23 | int ctbsp; 24 | TBSP *atbsp; 25 | }; 26 | 27 | #endif // VOL_H 28 | -------------------------------------------------------------------------------- /include/water.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file water.h 3 | * 4 | * @brief Good ol' H20. 5 | */ 6 | #ifndef WATER_H 7 | #define WATER_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | // Forward. 16 | struct XA; 17 | struct XP; 18 | 19 | /** 20 | * @class WATER 21 | * @brief Water? 22 | */ 23 | struct WATER : public SO 24 | { 25 | // ... 26 | }; 27 | 28 | void InitWater(WATER *pwater); 29 | 30 | void PostWaterLoad(WATER *pwater); 31 | 32 | void CalculateWaterCurrent(WATER *pwater, VECTOR *ppos, VECTOR *pv, VECTOR *pw); 33 | 34 | void UpdateSwXaList(SW *psw, XA **ppxa); 35 | 36 | void UpdateWater(WATER *pwater, float dt); 37 | 38 | void AddWaterExternalAccelerations(WATER *pwater, XA *pxa, float dt); 39 | 40 | void HandleWaterMessage(WATER *pwater, MSGID msgid, void *pv); 41 | 42 | void UpdateWaterMergeGroup(WATER *pwater); 43 | 44 | float UGetWaterSubmerged(WATER *pwater, SO *pso, VECTOR *pposSurface, VECTOR *pnormalSurface); 45 | 46 | void UpdateWaterBounds(WATER *pwater); 47 | 48 | int FInflictWaterZap(WATER *pwater, XP *pxp, ZPR *pzpr); 49 | 50 | ZPD *PzpdEnsureWater(WATER *pwater, ENSK ensk); 51 | 52 | #endif // WATER_H 53 | -------------------------------------------------------------------------------- /include/waypoint.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file waypoint.h 3 | */ 4 | #ifndef WAYPOINT_H 5 | #define WAYPOINT_H 6 | 7 | #include "common.h" 8 | #include 9 | #include 10 | #include 11 | 12 | // Forward. 13 | struct SGG; 14 | 15 | /** 16 | * @brief Waypoint state. 17 | */ 18 | enum WPS 19 | { 20 | WPS_Nil = -1, 21 | WPS_Passive = 0, 22 | WPS_Sync = 1, 23 | WPS_Active = 2, 24 | WPS_Max = 3 25 | }; 26 | 27 | /** 28 | * @class WAY_POINT 29 | * @brief Waypoint. 30 | */ 31 | struct WAYPOINT : public ALO 32 | { 33 | undefined1 unknown[2]; 34 | WPS wps; 35 | float tWps; 36 | float dtPause; 37 | // ... 38 | }; 39 | 40 | /** 41 | * @brief Stepguard waypoint? 42 | */ 43 | struct WPSG 44 | { 45 | /* 0x00 */ VTWPSG *pvtwpsg; 46 | /* 0x04 */ uint cpwaypoint; 47 | /* 0x08 */ WAYPOINT *apwaypoint[8]; 48 | /* 0x28 */ int fCallback; 49 | /* 0x2c */ SGG *psgg; 50 | }; 51 | 52 | void InitWaypoint(WAYPOINT *pwaypoint); 53 | 54 | void PostWaypointLoad(WAYPOINT *pwaypoint); 55 | 56 | void SetWaypointRsmg(WAYPOINT *pwaypoint, int fOnTrigger, OID oidRoot, OID oidSm, OID oidGoal); 57 | 58 | void UpdateWaypoint(WAYPOINT *pwaypoint, float dt); 59 | 60 | void SetWaypointWps(WAYPOINT *pwaypoint, WPS wps); 61 | 62 | void HandleWaypointMessage(WAYPOINT *pwaypoint, MSGID msgid, void *pv); 63 | 64 | WPSG *PwpsgNew(); 65 | 66 | void AddWpsgWaypoint(WPSG *pwpsg, WAYPOINT *pwaypoint); 67 | 68 | void RemoveWpsgWaypoint(WPSG *pwpsg, WAYPOINT *pwaypoint); 69 | 70 | void UpdateWpsgCallback(WPSG *pwpsg, MSGID msgid, void *pv); 71 | 72 | void EnsureWpsgCallback(WPSG *pwpsg); 73 | 74 | #endif // WAYPOINT_H 75 | -------------------------------------------------------------------------------- /include/wipe.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file wipe.h 3 | * 4 | * @brief Screen wipes. 5 | * 6 | * @todo Figure out if the function signatures are correct. 7 | */ 8 | #ifndef WIPE_H 9 | #define WIPE_H 10 | 11 | #include "common.h" 12 | #include 13 | #include 14 | #include 15 | 16 | /** 17 | * @brief Wipe Kind. 18 | */ 19 | enum WIPEK 20 | { 21 | WIPEK_Fade = 0, 22 | WIPEK_Keyhole = 1, 23 | WIPEK_WorldMap = 2, 24 | WIPEK_Frozen = 3, 25 | WIPEK_Max = 4 26 | }; 27 | 28 | /** 29 | * @brief Wipe State. 30 | */ 31 | enum WIPES 32 | { 33 | WIPES_Nil = -1, 34 | WIPES_Idle = 0, 35 | WIPES_WipingOut = 1, 36 | WIPES_Black = 2, 37 | WIPES_WipingIn = 3, 38 | WIPES_Max = 4 39 | }; 40 | 41 | /** 42 | * @brief Screen wipe. 43 | */ 44 | struct WIPE 45 | { 46 | undefined4 unk_0x0; 47 | WIPES wipes; 48 | float tWipes; 49 | float uBlack; 50 | TRANS transButton; 51 | WIPEK wipek; 52 | WIPEK wipekButton; 53 | }; 54 | 55 | extern WIPE *g_pwipe; 56 | extern WIPE g_wipe; 57 | 58 | void InitWipe(WIPE *pwipe); 59 | 60 | void UpdateWipe(WIPE *pwipe, JOY *pjoy); 61 | 62 | void DrawWipe(WIPE *pwipe); 63 | 64 | void ActivateWipe(WIPE *pwipe, TRANS *ptrans, WIPEK wipek); 65 | 66 | void SetWipeButtonTrans(WIPE *pwipe, TRANS *ptrans, WIPEK wipek); 67 | 68 | int FCatchWipeButtonTrans(WIPE *pwipe, JOY *pjoy, WIPES wipesNew); 69 | 70 | void SetWipeWipes(WIPE *pwipe, WIPES wipes); 71 | 72 | extern "C" void WipeToWorldWarp(const void *pchzWorld, OID oidWarp, WIPEK wipek); 73 | 74 | #endif // WIPE_H 75 | -------------------------------------------------------------------------------- /include/zap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file zap.h 3 | * 4 | * @brief Zap (damage) system. 5 | */ 6 | #ifndef ZAP_H 7 | #define ZAP_H 8 | 9 | #include "common.h" 10 | #include 11 | #include 12 | #include 13 | 14 | /** 15 | * @brief Zap kind. 16 | */ 17 | enum ZPK 18 | { 19 | ZPK_Nil = -1, 20 | ZPK_Blunt = 0, 21 | ZPK_Electric = 1, 22 | ZPK_Fire = 2, 23 | ZPK_Water = 3, 24 | ZPK_Crush = 4, 25 | ZPK_Pit = 5, 26 | ZPK_Max = 6 27 | }; 28 | 29 | /** 30 | * @brief Zap _?_ Kind 31 | * 32 | * @todo Figure out what the O stands for. 33 | */ 34 | enum ZOK 35 | { 36 | ZOK_Nil = -1, 37 | ZOK_Inherit = 0, 38 | ZOK_Zap = 1, 39 | ZOK_NoZap = 2, 40 | ZOK_Ignore = 3, 41 | ZOK_ZapAndIgnore = 4, 42 | ZOK_Max = 5 43 | }; 44 | 45 | /** 46 | * @brief Unknown. 47 | */ 48 | struct ZPD 49 | { 50 | SO *pso; 51 | ZPK zpk; 52 | float dzThrow; 53 | int fThrowCut; 54 | int coidThrow; 55 | OID aoidThrow[32]; 56 | int cploThrow; 57 | LO *aploThrow[32]; 58 | }; 59 | 60 | /** 61 | * @brief Zap. 62 | */ 63 | struct ZAP 64 | { 65 | // ... 66 | }; 67 | 68 | /** 69 | * @brief TOUCH_ZAPPER 70 | * @brief Zapper trigger on touching the player. 71 | * 72 | * @todo Does it inherit from ZAP? 73 | */ 74 | struct TZP 75 | { 76 | // ... 77 | }; 78 | 79 | /** 80 | * @brief Unknown. 81 | */ 82 | struct ZPR 83 | { 84 | ZPK zpk; 85 | LO *ploSource; 86 | void *pv; 87 | void *pfnzap; // NOTE: This is a function pointer. 88 | }; 89 | 90 | #endif // ZAP_H 91 | -------------------------------------------------------------------------------- /reference/include/alo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file alo.h 3 | */ 4 | #ifndef ALO_H 5 | #define ALO_H 6 | 7 | struct ALO { 8 | //LO field0_0x0; 9 | //DL dlChild; 10 | //DLE dleBusy; 11 | //DLE dleMRD; 12 | //ALO* paloRoot; 13 | ALO* paloFreezeRoot; 14 | //DLE dleFreeze; 15 | //DL dlFreeze; 16 | int cpmrg; 17 | //MRG* apmrg[4]; 18 | float sMRD; 19 | float sCelBorderMRD; 20 | int grfzon; 21 | float dsMRDSnap; 22 | //FRZ frz; 23 | //XF xf; 24 | //VECTOR posOrig; 25 | //MATRIX3 matOrig; 26 | //VECTOR eulOrig; 27 | //DL dlAct; 28 | //ACT* pactPos; 29 | //ACT* pactRot; 30 | //ACT* pactScale; 31 | //ACT** apactPose; 32 | //ACT* pactRestore; 33 | //ACTLA* pactla; 34 | //ACTBANK* pactbank; 35 | //IKH* pikh; 36 | //CLQ* pclqPosSpring; 37 | //CLQ* pclqPosDamping; 38 | //CLQ* pclqRotSpring; 39 | //CLQ* pclqRotDamping; 40 | //SMPA* psmpaPos; 41 | //SMPA* psmpaRot; 42 | //ALOX* palox; 43 | int cframeStatic; 44 | //GLOBSET globset; 45 | //SHADOW* pshadow; 46 | //THROB* pthrob; 47 | float sFastShadowRadius; 48 | float sFastShadowDepth; 49 | int fRealClock; 50 | //FADER* pfader; 51 | float dtUpdatePause; 52 | //ASEGD* pasegd; 53 | float sRadiusRenderSelf; 54 | float sRadiusRenderAll; 55 | //SFX* psfx; 56 | //FICG ficg; 57 | int cposec; 58 | //POSEC* aposec; 59 | //ACTREF* pactrefCombo; 60 | //DLR* pdlrFirst; 61 | //ACK ackRot; 62 | }; 63 | 64 | #endif // ALO_H 65 | -------------------------------------------------------------------------------- /reference/include/aseg.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file aseg.h 3 | * 4 | * @brief Declarations for animation segments. 5 | */ 6 | #ifndef ASEG_H 7 | #define ASEG_H 8 | 9 | #include 10 | #include 11 | 12 | /** 13 | * @brief Animation Segment 14 | */ 15 | struct ASEG 16 | { 17 | int padding[15]; 18 | 19 | float tMax; 20 | int cchn; 21 | //CHN* achn; 22 | OID oidRoot; 23 | //SEGRPT segrpt; 24 | int fDefault; 25 | int fHandsOff; 26 | int fRealClock; 27 | int ceaApply; 28 | int field_0x64; 29 | int ceaframe; 30 | int field_0x6c; 31 | int ceaRetract; 32 | int field_0x74; 33 | //DL dlAsega; 34 | int nPriotity; 35 | float svtMaster; 36 | int field_0x8c; 37 | //CLQ clqMasterSuck; 38 | LM lmMasterSuck; 39 | float svtMasterSuck; 40 | //CHN* pchnStrip; 41 | int coidSearchRoot; 42 | OID* aoidSearchRoot; 43 | }; 44 | 45 | #endif // ASEG_H 46 | -------------------------------------------------------------------------------- /reference/include/bif.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file bif.h 3 | */ 4 | #ifndef BIF_H 5 | #define BIF_H 6 | 7 | #include 8 | #include 9 | 10 | struct VU_VECTOR 11 | { 12 | // todo 13 | //VU_VECTOR(VECTOR* vec); 14 | }; 15 | 16 | #endif // BIF_H 17 | -------------------------------------------------------------------------------- /reference/include/frm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file frm.h 3 | * 4 | * @brief Declarations for the frame system. 5 | */ 6 | #ifndef FRM_H 7 | #define FRM_H 8 | 9 | /** 10 | * @brief Frame 11 | */ 12 | struct FRM 13 | { 14 | // todo 15 | // ... 16 | }; 17 | 18 | // Global variables 19 | static int g_ifrmMax; // Maximum number of frames 20 | static FRM* g_pfrmOpen; // Pointer to the open frame 21 | static int g_cframe; // Current frame count 22 | 23 | /** 24 | * @brief Opens a new frame. 25 | * 26 | * Additionally increments the frame count. 27 | */ 28 | void OpenFrame(); 29 | 30 | /** 31 | * @brief Closes the current frame. 32 | */ 33 | void CloseFrame(); 34 | 35 | /** 36 | * @brief Clears the pending frame. 37 | * 38 | * @param pfrm Pointer to the frame. 39 | */ 40 | void ClearPendingFrame(FRM* pfrm); 41 | 42 | #endif // FRM_H 43 | -------------------------------------------------------------------------------- /reference/include/gc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file gc.h 3 | */ 4 | #ifndef GC_H 5 | #define GC_H 6 | 7 | #include 8 | 9 | /** 10 | * @brief Unknown, needs more research 11 | */ 12 | struct SBB { 13 | int n; 14 | struct CRef ref; 15 | }; 16 | 17 | #endif // GC_H 18 | -------------------------------------------------------------------------------- /reference/include/lo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lo.h 3 | * 4 | * @brief Declares Level Object struct. 5 | */ 6 | #ifndef LO_H 7 | #define LO_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | /** 14 | * @brief Level Object 15 | */ 16 | struct LO { 17 | struct BASIC field0_0x0; 18 | enum OID oid; 19 | struct DLE dleOid; 20 | struct SW* psw; 21 | struct ALO* paloParent; 22 | struct DLE dleChild; 23 | struct LO* ploCidNext; 24 | struct MQ* pmqFirst; 25 | char* pchzName; 26 | struct CFrame* pframe; 27 | struct PXR* ppxr; 28 | unsigned long dtickPerf; 29 | }; 30 | 31 | #endif // LO_H 32 | -------------------------------------------------------------------------------- /reference/include/readme.txt: -------------------------------------------------------------------------------- 1 | This file contains the headers for the game engine. The following files are known to have inline functions (not exhaustive): 2 | 3 | memory.h 4 | -------------------------------------------------------------------------------- /reference/include/ref.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file ref.h 3 | * 4 | * @brief 5 | */ 6 | #ifndef REF_H 7 | #define REF_H 8 | #include 9 | 10 | /** 11 | * @brief Unknown, needs more research 12 | * 13 | * todo: implement 14 | */ 15 | class CRef 16 | { 17 | public: 18 | //todo 19 | }; 20 | 21 | struct SMP 22 | { 23 | undefined4 field_0x0; 24 | float svSlow; 25 | float dtFast; 26 | }; 27 | 28 | struct SMPA 29 | { 30 | float svFast; 31 | float svSlow; 32 | float dtFast; 33 | float sdvMax; 34 | }; 35 | 36 | #endif // REF_H 37 | -------------------------------------------------------------------------------- /reference/include/screen.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file screen.h 3 | * 4 | * @brief Declarations for the screen blot system. 5 | */ 6 | #ifndef SCREEN_H 7 | #define SCREEN_H 8 | 9 | /** 10 | * @brief Blot State 11 | */ 12 | enum BLOTS 13 | { 14 | BLOTS_Hidden = 0, 15 | BLOTS_Appearing = 1, 16 | BLOTS_Visible = 2, 17 | BLOTS_Disappearing = 3, 18 | BLOTS_Max = 4 19 | }; 20 | 21 | /** 22 | * @brief Blot 23 | * 24 | * Used to draw screen objects. 25 | */ 26 | struct BLOT 27 | { 28 | // todo 29 | int padding[0x280]; 30 | }; 31 | 32 | /** 33 | * @brief Sets the BLOT state. 34 | * 35 | * @param pblot Pointer to the blot to set. 36 | * @param blots The state to set. 37 | * 38 | * @todo Implement this function. 39 | */ 40 | void SetBlotBlots(BLOT* pblot, BLOTS blots); 41 | 42 | /** 43 | * @brief Renders the BLOT object. 44 | * 45 | * @todo Implement this function. 46 | */ 47 | void RenderBlots(); 48 | 49 | /** 50 | * @brief Draws the BLOT object. 51 | * 52 | * @todo Implement this function. 53 | */ 54 | void DrawBlots(); 55 | 56 | #endif // SCREEN_H 57 | -------------------------------------------------------------------------------- /reference/include/sensor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sensor.h 3 | * 4 | * @brief Declarations for the sensor system. 5 | */ 6 | #ifndef SENSOR_H 7 | #define SENSOR_H 8 | 9 | #include 10 | 11 | typedef unsigned char byte; 12 | 13 | /** 14 | * @brief Sensor State 15 | */ 16 | enum SENSORS 17 | { 18 | MAX 19 | }; 20 | 21 | /** 22 | * @brief Sensor 23 | * 24 | * @todo Fix missing fields and rewrite struct 25 | */ 26 | struct SENSOR 27 | { 28 | undefined4 field_0x0; 29 | int field_0x4; 30 | int field_0x8; 31 | char padding[0x57c]; 32 | SENSORS sensors; 33 | float tSensors; 34 | SENSORS sensorsInitial; 35 | int coidTrigger; 36 | undefined4 field_0x598; 37 | undefined4 field_0x59c; 38 | undefined4 field_0x5a0; 39 | undefined4 field_0x5a4; 40 | int coidNoTrigger; 41 | undefined4 field_0x5ac; 42 | undefined4 field_0x5b0; 43 | undefined4 field_0x5b4; 44 | undefined4 field_0x5b8; 45 | int ccidTrigger; 46 | undefined4 field_0x5c0; 47 | undefined4 field_0x5c4; 48 | undefined4 field_0x5c8; 49 | undefined4 field_0x5cc; 50 | int ccidNoTrigger; 51 | undefined4 field_0x5d4; 52 | undefined4 field_0x5d8; 53 | undefined4 field_0x5dc; 54 | undefined4 field_0x5e0; 55 | int fTriggerAll; 56 | float dtEnabling; 57 | float dtDisabling; 58 | int fRemainDisabledIndefinite; 59 | undefined4 field_0x5f4; 60 | undefined4 field_0x5f8; 61 | float svtRestore; 62 | }; 63 | 64 | #endif // SENSOR_H 65 | -------------------------------------------------------------------------------- /reference/include/speaker.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file speaker.h 3 | * 4 | * @brief Declarations for the speaker system. 5 | */ 6 | #ifndef SPEAKER_H 7 | #define SPEAKER_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | typedef int GRFPVA; 17 | 18 | /** 19 | * @brief Speaker 20 | * 21 | * Either represents a speaker that emits sound in the game world, or a 22 | * physical speaker in the real world. More research is needed. 23 | * 24 | * @todo Figure out exactly what this struct represents. 25 | * @todo Identify missing fields on this struct. 26 | */ 27 | struct SPEAKER 28 | { 29 | char padding[0x2e0]; 30 | struct RGBA rgbaText; 31 | float radFOV; 32 | float sDistCm; 33 | float uxTv; 34 | float uyTv; 35 | undefined4 field_0x2f4; 36 | undefined4 field_0x2f8; 37 | undefined4 field_0x2fc; 38 | struct VECTOR dposLight; 39 | struct VECTOR dposLightConfront; 40 | float uxTvConfront; 41 | float uyTvConfront; 42 | OID oidSmIdle; 43 | struct SM_conflict* psmIdle; 44 | struct SMA* psmaIdle; 45 | }; 46 | 47 | /** 48 | * @brief Dialog Player 49 | */ 50 | struct DP 51 | { 52 | uint grfdp; 53 | DPK dpk; 54 | SPEAKER* pspeakerLeft; 55 | SPEAKER* pspeakerRight; 56 | ASEGA* pasegaLipsync; 57 | float tPauseMin; 58 | }; 59 | 60 | #endif // SPEAKER_H 61 | -------------------------------------------------------------------------------- /reference/readme.md: -------------------------------------------------------------------------------- 1 | # Reference files 2 | 3 | This directory contains source code that doesn't build, and pertains to source code files which are either partially matched, or not yet started. If you want to get started with decompiling those files you can use them as a starting point. They are all source code files we wrote by hand before we started using Splat to compile a matching executable. 4 | 5 | It is organized as follows: 6 | 7 | * `include/` contains header files for the game engine. Most function signatures are probably correct. Many of the very short structs/enums are correct, but the longer ones are probably not correct (missing fields, wrong field types, etc), though they can be used as a starting point. 8 | * `src/P2/` contains source code files for the game engine. None of the code is matching, though we tried to make them resemble the original code as closely as possible, so they may help you understand the logic and control flow of certain functions. 9 | -------------------------------------------------------------------------------- /reference/src/P2/cd.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file cd.cpp 3 | * 4 | * @brief Implements the cd system. 5 | */ 6 | #include 7 | 8 | // Global variables 9 | CDS g_cds; 10 | 11 | void UpdateCd(void) 12 | { 13 | CDS cdsNew; 14 | 15 | if (g_cds == CDS_Waiting) 16 | { 17 | 18 | } 19 | else 20 | { 21 | 22 | } 23 | 24 | g_cds = cdsNew; 25 | } 26 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | splat64[mips]>=0.36.0,<1.0.0 2 | spimdisasm>=1.36.1,<2.0.0 3 | rabbitizer==1.13.0 4 | tqdm 5 | n64img 6 | pygfxd 7 | crunch64 8 | ninja 9 | ninja_syntax 10 | mapfile_parser 11 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Get directory of this script 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 5 | 6 | # CD into project dir 7 | cd $DIR/.. 8 | 9 | # Ensure disc/SCUS_971.98 exists 10 | if [ ! -f disc/SCUS_971.98 ]; then 11 | echo "Error: SCUS_971.98 not found. Copy it from your own game disc to the 'disc' directory of this project." 12 | exit 13 | fi 14 | 15 | # Configure and build 16 | python3 configure.py --clean 17 | ninja 18 | -------------------------------------------------------------------------------- /scripts/checks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | script_dir=$(dirname $0) 6 | pushd $script_dir/.. > /dev/null 7 | 8 | python3 configure.py --clean && ninja 9 | python3 configure.py --clean --objects && ninja 10 | ./tools/objdiff/objdiff-cli report generate > /dev/null 11 | -------------------------------------------------------------------------------- /scripts/codematcher/match_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set working dir to codematcher directory 4 | project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." 5 | codematcher_path="$project_dir/tools/codematcher" 6 | pushd $codematcher_path > /dev/null 7 | 8 | # Invoke codematcher to compile and match source tree 9 | echo "Matching source tree..." 10 | source_tree_path="$project_dir/src/P2" 11 | ./codematcher may_proto.elf --compile $source_tree_path 12 | 13 | # Done 14 | popd > /dev/null 15 | -------------------------------------------------------------------------------- /scripts/codematcher/match_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Get the name of the source file as a parameter 4 | source_file="$1" 5 | 6 | # Check if the source file parameter is empty 7 | if [ -z "$source_file" ]; then 8 | echo "No source file specified!" 9 | echo " Usage: $0 " 10 | exit 1 11 | fi 12 | 13 | # Strip the extension from the source file 14 | source_basename="$(basename "$source_file" | cut -d. -f1)" 15 | 16 | # Set working dir to project dir and make object file 17 | project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." 18 | codematcher_path="$project_dir/tools/codematcher" 19 | pushd $project_dir > /dev/null 20 | echo "Compiling $source_basename.o..." 21 | make clean > /dev/null 22 | make obj/debug/$source_basename.o > /dev/null 23 | 24 | # CD to codematcher directory and invoke codematcher with the compiled object file 25 | echo "Matching $source_basename.o..." 26 | cd tools/codematcher >/dev/null 27 | ./codematcher may_proto.elf --match "$project_dir/obj/debug/$source_basename.o" 28 | 29 | # Move back to the original directory 30 | popd >/dev/null 31 | popd >/dev/null 32 | -------------------------------------------------------------------------------- /scripts/codematcher/match_function_live.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Get name of source file and target function as parameters 4 | source_file="$1" 5 | target_function="$2" 6 | 7 | # Check if the source file parameter is empty 8 | if [ -z "$source_file" ]; then 9 | echo "No source file specified!" 10 | echo " Usage: $0 " 11 | exit 1 12 | fi 13 | 14 | # Check if the target function parameter is empty 15 | if [ -z "$target_function" ]; then 16 | echo "No target function specified!" 17 | echo " Usage: $0 " 18 | exit 1 19 | fi 20 | 21 | # Strip the extension from the source file 22 | source_basename="$(basename "$source_file" | cut -d. -f1)" 23 | 24 | # Match command: match_file script grepped with relevant lines 25 | match_cmd="./match_file.sh $source_file | grep -e'------------' -e'+' -e'$target_function'" 26 | 27 | # Print command: ee-objdump grepped with regex matching everything from the function name to a blank line 28 | objdump_cmd="wine ~/.wine/drive_c/usr/local/sce/ee/gcc/bin/ee-objdump.exe -d ../obj/debug/$source_basename.o | grep -e'$target_function' -A1000 -e'^$'" 29 | 30 | # Watch the match_single script with the source file and dump file commands 31 | watch -n 1 --color "( $match_cmd && $objdump_cmd )" 32 | -------------------------------------------------------------------------------- /scripts/frogress/mapfile_progress.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | script_dir=$(dirname $0) 6 | pushd $script_dir/.. > /dev/null 7 | 8 | if [[ "$1" == "--help" || "$1" == "-h" ]]; then 9 | echo "Usage: $0 [--skip-build]" 10 | echo " --skip-build: Skip building and just check progress" 11 | exit 0 12 | fi 13 | 14 | if [[ "$1" != "--skip-build" ]]; then 15 | ./scripts/build.sh 16 | fi 17 | 18 | python3 -m mapfile_parser progress out/SCUS_971.98.map asm asm/nonmatchings/ 19 | 20 | popd > /dev/null 21 | -------------------------------------------------------------------------------- /scripts/quickstart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Get script directory 6 | script_dir=$(dirname $0) 7 | pushd $script_dir > /dev/null 8 | 9 | pip install -U -r ../requirements.txt 10 | 11 | # Elevate privileges 12 | sudo -v 13 | 14 | # Check if sudo 15 | if [ "$EUID" -ne 0 ] 16 | then echo "Installing dependencies requires sudo. Please enter your password." 17 | fi 18 | 19 | # Update apt packages 20 | sudo apt-get update 21 | 22 | # Setup wine 23 | sudo dpkg --add-architecture i386 24 | sudo apt-get update 25 | sudo apt-get install wine32 26 | 27 | # Install MIPS assembler 28 | sudo apt-get install binutils-mips-linux-gnu 29 | 30 | # Setup compiler 31 | sudo ./setup_progd_linux.sh 32 | 33 | # Check if disc/SCUS_971.98 exists 34 | echo "Setup complete!" 35 | if [ ! -f ../disc/SCUS_971.98 ]; then 36 | echo "Now, copy SCUS_971.98 from your copy of the game to the 'disc' directory of this project." 37 | echo "Then build the project by running the 'build.sh' script." 38 | exit 39 | fi 40 | echo "To build the project, run the 'build.sh' script." 41 | 42 | popd > /dev/null 43 | -------------------------------------------------------------------------------- /scripts/readme.md: -------------------------------------------------------------------------------- 1 | # Scripts 2 | 3 | This directory contains the following scripts used to setup and build the project. There are a few others, but they are not used in the normal contributing workflow. 4 | 5 | ## Setup scripts 6 | 7 | ### quickstart.sh 8 | 9 | Installs the necessary dependencies using pip/apt and sets up the build environment. This will run all the other setup scripts for you. You only need to run this script once. 10 | 11 | ### setup_progd_linux.sh 12 | 13 | Installs the compiler needed to build the project on Linux. `quickstart.h` will run this script for you, so you don't need to run both. 14 | 15 | There is an equivalent script for Windows, but the assembler does not work on Windows, so you can't build the project on Windows. You must use Linux or WSL. 16 | 17 | ## Utility scripts 18 | 19 | ### build.sh 20 | 21 | Runs a clean reconfigure (deletes build files and splits the binary), then builds the project. Will warn you if `disc/SCUS_971.98` is not present. 22 | 23 | ### run.sh 24 | 25 | Runs the project in an emulator. Before using, you must edit the script to point to your PCSX2 installation, and the path to your mounted game disc (or backup copy). The script will boot them emulator using the compiled elf, and load the assets from your game disc. 26 | 27 | ### checks.sh 28 | 29 | Runs the same build commands that GitHub actions uses to verify that the project builds successfully. This must pass before a pull request will be merged. 30 | -------------------------------------------------------------------------------- /scripts/setup_prodg_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Sets up the ProDG compilers + SCE Runtime Library to build the project. 4 | 5 | set -e 6 | 7 | WINE_ROOT=~/.wine/drive_c 8 | TOP=$(cd "$(dirname "$0")"; pwd)/.. 9 | 10 | # The SDK (Runtime Library) version to install. 11 | SDK_VER=242 12 | 13 | die() { # perl-style `die` expressions. 14 | echo "Error: $@" 15 | exit 1 16 | } 17 | 18 | # downloads files without checking integrity 19 | download() { 20 | echo "Downloading $1..." 21 | wget -qP /tmp $1 22 | 23 | BASENAME=$(basename $1) 24 | 25 | #echo "moving files out of /tmp" 26 | #mv /tmp/$BASENAME $TOP 27 | } 28 | 29 | echo Starting ProDG setup script... 30 | 31 | # download required files (registry + SDK package) 32 | download "https://github.com/TheOnlyZac/compilers/releases/download/ee-gcc2.95.2-SN-v2.73a/ee-gcc2.95.2-SN-v2.73a.tar.gz" 33 | 34 | # apply environment variables from the registry file 35 | # wine regedit prodg_env.reg 36 | 37 | # Extract the compiler into the tools dir 38 | echo "Extracting compiler to $TOP/tools..." 39 | tar -xzf /tmp/ee-gcc2.95.2-SN-v2.73a.tar.gz -C $TOP/tools 40 | 41 | echo "Removing temporary files..." 42 | rm /tmp/ee-gcc2.95.2-SN-v2.73a.tar.gz 43 | 44 | echo "Setup complete!" 45 | -------------------------------------------------------------------------------- /scripts/windows/backup_registry.bat: -------------------------------------------------------------------------------- 1 | REM backup registry to C:\usr\local\sce\regbackup.reg 2 | echo Backing up registry, please accept the UAC prompt 3 | regedit /E C:\usr\local\sce\regbackup.reg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 4 | -------------------------------------------------------------------------------- /scripts/windows/prodg_env.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment] 4 | "PS2_CPATH"="C:\\usr/local/sce/ee/gcc/lib/gcc-lib/ee/2.95.3/include;C:\\usr/local/sce/ee/gcc/ee/include;C:\\usr/local/sce/ee/gcc/include/g++-2;C:\\usr/local/sce/ee/include" 5 | "PS2_DRIVE"="C" 6 | -------------------------------------------------------------------------------- /scripts/windows/run.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM ############################################################################## 4 | REM Set these paths to point to your PCSX2 1.7 executable and your copy of the game 5 | set PCSX2_PATH="C:\path\to\pcsx2.exe" 6 | set ISO_PATH="" 7 | REM ############################################################################## 8 | 9 | goto :start 10 | 11 | REM die: MESSAGE 12 | REM perl-style `die` expressions. 13 | :die 14 | echo run.bat: error: %* 15 | exit /b 1 16 | 17 | REM start 18 | REM main entrypoint 19 | :start 20 | if not defined PCSX2_PATH ( 21 | call :die "PCSX2 path is empty, please edit the paths in 'run.bat'" 22 | ) 23 | if not defined ISO_PATH ( 24 | echo Warning: ISO path is empty, please edit the paths in 'run.bat' 25 | ) 26 | if not exist "!ISO_PATH!" ( 27 | call :die "Game ISO not found at '!ISO_PATH!'" 28 | ) 29 | if not exist "!PCSX2_PATH!" ( 30 | call :die "PCSX2 executable not found at '!PCSX2_PATH!'" 31 | ) 32 | if not "!PCSX2_PATH:~-4!"==".exe" ( 33 | call :die "PCSX2 exe is not executable" 34 | ) 35 | 36 | REM Switch to the project root directory 37 | pushd "%~dp0..\.." > nul 38 | 39 | REM Build the game 40 | echo Compiling ELF... 41 | ::make clean > nul 42 | make > nul 43 | 44 | REM Run the game 45 | echo Booting ELF in PCSX2... 46 | "%PCSX2_PATH%" -elf ".\bin\debug\SCUS_971.98" %ISO_PATH% 47 | 48 | REM Switch back to the original directory 49 | popd > nul 50 | echo Done. 51 | -------------------------------------------------------------------------------- /scripts/windows/setup_prodg_windows.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | REM The SDK (Runtime Library) version to install. 5 | set SDK_VER=242 6 | 7 | echo Starting ProDG setup script... 8 | goto :start 9 | 10 | 11 | REM die: MESSAGE 12 | REM perl-style `die` expressions. 13 | :die 14 | echo Error: %* 15 | exit /b 1 16 | 17 | 18 | REM download_file: URL 19 | REM downloads file using curl 20 | :download_file 21 | echo Downloading %~1... 22 | set output_file=%TEMP%\progd.zip 23 | curl -L %~1 -o %output_file% 24 | if exist "%output_file%" ( 25 | echo File downloaded to %output_file% 26 | ) else ( 27 | call :die Failed to download file 28 | ) 29 | goto :eof 30 | 31 | 32 | REM start 33 | REM main entrypoint 34 | :start 35 | echo NOTE This script is untested with the new build system and may not work as expected! 36 | echo Please report any issues on github or discord. 37 | echo 38 | 39 | REM download required files (registry + SDK package) 40 | call :download_file "https://github.com/TheOnlyZac/compilers/releases/download/ee-gcc2.95.2-SN-v2.73a/ee-gcc2.95.2-SN-v2.73a.zip" 41 | 42 | ::REM apply environment variables from the registry file 43 | ::echo Applying environment variables, please accept the UAC prompt 44 | ::regedit %TEMP%\prodg_env.reg 45 | 46 | REM Extract the compiler to the project/tools directory 47 | echo Extracting compiler to tools directory... 48 | 7z x -y %TEMP%\progd.zip -otools 49 | 50 | ::echo Removing temporary files 51 | echo Removing temporary files... 52 | ::del %TEMP%\ee-gcc2.95.2-SN-v2.73a.zip 53 | 54 | echo Setup complete! 55 | endlocal 56 | -------------------------------------------------------------------------------- /src/P2/actseg.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/actseg", RetractActseg__FP6ACTSEGi); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/actseg", CloneActseg__FP6ACTSEGT0); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/actseg", GetActsegPositionGoal__FP6ACTSEGfP6VECTORT2); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/actseg", GetActsegRotationGoal__FP6ACTSEGfP7MATRIX3P6VECTOR); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/actseg", GetActsegTwistGoal__FP6ACTSEGPfT1); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/actseg", GetActsegScale__FP6ACTSEGP7MATRIX3); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/actseg", GGetActsegPoseGoal__FP6ACTSEGi); 16 | -------------------------------------------------------------------------------- /src/P2/barrier.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void InitBarrier(BARRIER *pbarrier) 5 | { 6 | InitSo(pbarrier); 7 | SetSoConstraints(pbarrier, CT_Locked, (VECTOR *)nullptr, CT_Locked, (VECTOR *)nullptr); 8 | STRUCT_OFFSET(pbarrier, 0x590, OID) = OID_Nil; // pbarrier->barwarp.oidWarp 9 | } 10 | 11 | void CloneBarrier(BARRIER *pbarrier, BARRIER *pbarrierBase) 12 | { 13 | CloneSo(pbarrier, pbarrierBase); 14 | if (!pbarrier->paloParent) 15 | { 16 | RecalcSwOxfFilterForObject(pbarrier->psw, pbarrier); 17 | } 18 | } 19 | 20 | INCLUDE_ASM("asm/nonmatchings/P2/barrier", PostBarrierLoad__FP7BARRIER); 21 | 22 | INCLUDE_ASM("asm/nonmatchings/P2/barrier", UpdateBarrier__FP7BARRIERf); 23 | 24 | INCLUDE_ASM("asm/nonmatchings/P2/barrier", FIgnoreBarrierIntersection__FP7BARRIERP2SO); 25 | 26 | INCLUDE_ASM("asm/nonmatchings/P2/barrier", NotifyBarrierImpact__FP7BARRIERP2XPi); 27 | 28 | void AddBarrierObject(BARRIER *pbarrier, OID oid) 29 | { 30 | int coid = STRUCT_OFFSET(pbarrier, 0x554, int); // pbarrier->coid 31 | OID *aoid = &STRUCT_OFFSET(pbarrier, 0x558, OID); // pbarrier->aoid 32 | aoid[coid] = oid; 33 | STRUCT_OFFSET(pbarrier, 0x554, int) = coid + 1; // pbarrier->coid 34 | } 35 | 36 | void AddBarrierClass(BARRIER *pbarrier, CID cid) 37 | { 38 | int ccid = STRUCT_OFFSET(pbarrier, 0x568, int); // pbarrier->ccid 39 | CID *acid = &STRUCT_OFFSET(pbarrier, 0x56c, CID); // pbarrier->acid 40 | acid[ccid] = cid; 41 | STRUCT_OFFSET(pbarrier, 0x568, int) = ccid + 1; // pbarrier->ccid 42 | } 43 | -------------------------------------------------------------------------------- /src/P2/basic.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern CGc g_gc; 6 | 7 | int FIsBasicDerivedFrom(BASIC *pbasic, CID cid) 8 | { 9 | VT *vt = (VT *)pbasic->pvtbasic; 10 | while (vt) 11 | { 12 | if (vt->cid == cid) return 1; 13 | vt = vt->pvtSuper; 14 | } 15 | 16 | return 0; 17 | } 18 | 19 | void EnsureBasicSidebag(BASIC *pbasic) 20 | { 21 | if (!pbasic->psidebag) 22 | { 23 | CSidebag *psidebag = PsidebagNew(); 24 | pbasic->psidebag = psidebag; 25 | g_gc.AddRootSidebag(psidebag); 26 | } 27 | } 28 | 29 | void GetBasicCid(BASIC *pbasic, CID* pcid) 30 | { 31 | *pcid = pbasic->pvtbasic->cid; 32 | } 33 | -------------------------------------------------------------------------------- /src/P2/bbmark.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/bbmark", UpdateSwPox__FP2SWP3OXAT1UcUc); 6 | 7 | OX *PoxAddSw(SW *psw, OXA *poxa, OXA *poxaOther) 8 | { 9 | OX *pox = (OX *)PvAllocSlotheapImpl(&psw->slotheapOx); 10 | pox->pxp = (XP *)nullptr; 11 | pox->psoOther = poxaOther->pso; 12 | pox->poxNext = poxa->pox; 13 | poxa->pox = pox; 14 | return pox; 15 | } 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/bbmark", PoxRemoveSw__FP2SWP3OXAT1); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/bbmark", PoxFromSoSo__FP2SOT0); 20 | 21 | XP *PxpFirstFromSoSo(SO *pso, SO *psoOther) 22 | { 23 | OX *pox = PoxFromSoSo(pso, psoOther); 24 | return pox ? pox->pxp : (XP *)nullptr; 25 | } 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/bbmark", AddSwAaobrObject__FP2SWP2SO); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/bbmark", RemoveSwAaobrObject__FP2SWP2SO); 30 | 31 | void InvalidateSwAaox(SW *psw) 32 | { 33 | psw->fAaoxValid = 0; 34 | } 35 | 36 | INCLUDE_ASM("asm/nonmatchings/P2/bbmark", UpdateSwAaox__FP2SW); 37 | 38 | INCLUDE_ASM("asm/nonmatchings/P2/bbmark", InvalidateSwXpForObject__FP2SWP2SOi); 39 | 40 | INCLUDE_ASM("asm/nonmatchings/P2/bbmark", RecalcSwXpAll__FP2SWi); 41 | 42 | INCLUDE_ASM("asm/nonmatchings/P2/bbmark", RecalcSwOxfFilterForObject__FP2SWP2SO); 43 | -------------------------------------------------------------------------------- /src/P2/bez.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/bez", EvaluateBezierWeightedFloat__FfffffffffPfN29); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/bez", EvaluateBezierFloat__FfffffffPfN27); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/bez", EvaluateBezierPos__FfffP6VECTORN63); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/bez", EvaluateBezierMat__FfffP7MATRIX3P6VECTORT3T4T3T4T4); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/bez", TesselateBezier__FfffP6VECTORN33iT3); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/bez", SBezierPosLength__FffP6VECTORN32); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/bez", LimitBezierMulti__Fie); 16 | -------------------------------------------------------------------------------- /src/P2/blend.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/blend", VerifyAeaEquivalence__FiP2EAiT1); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/blend", EnsureAsegBlendDynamic__FP3ALOiiPviPiT5PP6ASEGBL); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/blend", FillBlAmrsg__FiiPviiP3OID); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/blend", CalculateBlendAmrsg__FiiPviiP4MRSGPf); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/blend", ImrsgLookUp__FffiP4MRSGPf); 12 | 13 | JUNK_ADDIU(90); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/blend", ReblendAsegbl__FP6ASEGBLiiPv); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/blend", SetAsegblSlerp__FP6ASEGBLP3ALO); 18 | -------------------------------------------------------------------------------- /src/P2/bomb.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", InitBomb__FP4BOMB); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", LoadBombFromBrx__FP4BOMBP18CBinaryInputStream); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", CloneBomb__FP4BOMBT0); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", PostBombLoad__FP4BOMB); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", HandleBombMessage__FP4BOMB5MSGIDPv); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", UpdateBomb__FP4BOMBf); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", FUN_0013b828); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", FUN_0013b9d8); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", FUN_0013ba70); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", FAbsorbBombWkr__FP4BOMBP3WKR); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", FUN_0013bc80); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", PrimeBomb__FP4BOMBf); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", ApplyBombThrow__FP4BOMBP2PO); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", DetonateBomb__FP4BOMB); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/bomb", PsfxEnsureBomb__FP4BOMB4ENSK); 32 | -------------------------------------------------------------------------------- /src/P2/bq.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void CByteQueue::Init(int cb, void *pv) 4 | { 5 | m_cb = cb; 6 | m_ab = (byte *)pv; 7 | Reset(); 8 | } 9 | 10 | void CByteQueue::Reset() 11 | { 12 | m_cbFree = m_cb; 13 | m_cbDrain = 0; 14 | m_cbAlloc = 0; 15 | m_ibAlloc = 0; 16 | m_ibFree = 0; 17 | m_cbTotal = 0; 18 | } 19 | 20 | INCLUDE_ASM("asm/nonmatchings/P2/bq", CbFill__10CByteQueueiP11CQueueInput); 21 | 22 | INCLUDE_ASM("asm/nonmatchings/P2/bq", CbDrain__10CByteQueueiP12CQueueOutput); 23 | 24 | INCLUDE_ASM("asm/nonmatchings/P2/bq", CbFill__10CByteQueueiPUc); 25 | 26 | void CByteQueue::FreeDrain(int cb) 27 | { 28 | if (cb == 0) 29 | { 30 | cb = m_cbDrain; 31 | if (cb == 0) 32 | { 33 | return; 34 | } 35 | } 36 | 37 | m_cbFree += cb; 38 | m_cbDrain -= cb; 39 | } 40 | 41 | INCLUDE_ASM("asm/nonmatchings/P2/bq", CbRead__17CQueueInputMemoryiPv); 42 | 43 | INCLUDE_ASM("asm/nonmatchings/P2/bq", CbRead__15CQueueInputFileiPv); 44 | 45 | JUNK_WORD(0xAC80000C); 46 | -------------------------------------------------------------------------------- /src/P2/brx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern EOPID g_aeopid[]; 5 | 6 | void StartupBrx() 7 | { 8 | BuildEopids(); 9 | } 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/brx", PloNew__F3CIDP2SWP3ALO3OIDi); 12 | #ifdef SKIP_ASM 13 | /** 14 | * @todo 2.19% matched. 15 | */ 16 | LO *PloNew(CID cid, SW *psw, ALO *paloParent, OID oid, int isplice) 17 | { 18 | return psw; 19 | } 20 | #endif 21 | 22 | INCLUDE_ASM("asm/nonmatchings/P2/brx", LoadOptionFromBrx__FPvP5EOPIDP18CBinaryInputStream); 23 | 24 | void LoadOptionsFromBrx(void *pvStruct, CBinaryInputStream *pbis) 25 | { 26 | while (true) 27 | { 28 | short eopid = pbis->S16Read(); 29 | if (eopid < 0) 30 | { 31 | break; 32 | } 33 | LoadOptionFromBrx(pvStruct, &g_aeopid[eopid], pbis); 34 | } 35 | } 36 | 37 | uint IploFromStockOid(int oid) 38 | { 39 | int iplo; 40 | 41 | // Ensure oid is a stock object (OID between 12 and 42) 42 | if (oid >= 12 && oid <= 42) 43 | { 44 | iplo = oid - 12; 45 | } 46 | else 47 | { 48 | iplo = -1; 49 | } 50 | 51 | return iplo; 52 | } 53 | 54 | INCLUDE_ASM("asm/nonmatchings/P2/brx", LoadSwObjectsFromBrx__FP2SWP3ALOP18CBinaryInputStream); 55 | 56 | INCLUDE_ASM("asm/nonmatchings/P2/brx", SetLoDefaults__FP2LO); 57 | -------------------------------------------------------------------------------- /src/P2/bsp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/bsp", ClsgClipEdgeToBsp__FP3BSPP6VECTORT1PiiP3LSG); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/bsp", PruneBsp__FP3BSPP6VECTORfPP3BSP); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/bsp", PbspPointInBspQuick__FP6VECTORP3BSP); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/bsp", CloneBspc__FP4GEOMP4BSPCT0T1); 10 | -------------------------------------------------------------------------------- /src/P2/cat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern CDS g_cds; 5 | 6 | void StartupCatalog() 7 | { 8 | g_cds = CDS_Ready; 9 | } 10 | 11 | int FUN_001407A0(uint *pui) 12 | { 13 | return pui[1]; 14 | } 15 | -------------------------------------------------------------------------------- /src/P2/clip.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/clip", PsoHitTestLineObjects__FiP6VECTORT1iPP2SOP3LSG); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/clip", FUN_00141b48); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/clip", ClsgClipEdgeToObject__FP2SOP6VECTORT1iP3LSG); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/clip", ClsgClipEdgeToObjectPruned__FP2SOP3BSPP6VECTORT2iP3LSG); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/clip", ClsgClipCylinderToObject__FP2SOP6VECTORT1fiP3LSG); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/clip", ClsgClipLineToSphere__FP6VECTORfT0T0iP3LSG); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/clip", ClsgClipEdgeToSphere__FP6VECTORfT0T0iP3LSG); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/clip", ClsgClipCylinderToSphere__FP6VECTORfT0T0fiP3LSG); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/clip", ClsgClipEdgeToCylinder__FP6VECTORT0fT0T0iP3LSG); 20 | 21 | JUNK_WORD(0x27BD01C0); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/clip", SgnCompareMaa__FP3MAAT0); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/clip", ClsgMergeAlsg__FiP3LSG); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/clip", ClsgClipCylinderToBsp__FP4BSPCP4GEOMP6VECTORT2fiP3LSG); 28 | 29 | JUNK_WORD(0x27BD0120); 30 | -------------------------------------------------------------------------------- /src/P2/cnvo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void InitCnvo(CNVO *pcnvo) 5 | { 6 | InitSo(pcnvo); 7 | STRUCT_OFFSET(pcnvo, 0x550, float) = 100.0f; // pcnvo->svBelt 8 | } 9 | 10 | void LoadCnvoFromBrx(CNVO *pcnvo, CBinaryInputStream *pbis) 11 | { 12 | LoadSoFromBrx(pcnvo, pbis); 13 | STRUCT_OFFSET(pcnvo, 0x554, float) = pbis->F32Read(); // pcnvo->svuAvg 14 | STRUCT_OFFSET(pcnvo, 0x558, float) = pbis->F32Read(); // pcnvo->svvAvg 15 | } 16 | 17 | void PostCnvoLoad(CNVO *pcnvo) 18 | { 19 | PostAloLoad(pcnvo); 20 | MatchCnvoScrollerToBeltSpeed(pcnvo); 21 | } 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/cnvo", AdjustCnvoXpVelocity__FP4CNVOP2XPi); 24 | 25 | void SetCnvoBeltSpeed(CNVO *pcnvo, float svBelt) 26 | { 27 | if (svBelt == STRUCT_OFFSET(pcnvo, 0x550, float)) // pcnvo->svBelt 28 | return; 29 | 30 | STRUCT_OFFSET(pcnvo, 0x550, float) = svBelt; // pcnvo->svBelt 31 | InvalidateSwXpForObject(pcnvo->psw, pcnvo, 7); 32 | MatchCnvoScrollerToBeltSpeed(pcnvo); 33 | ResolveAlo(pcnvo); 34 | } 35 | 36 | INCLUDE_ASM("asm/nonmatchings/P2/cnvo", MatchCnvoScrollerToBeltSpeed__FP4CNVO); 37 | -------------------------------------------------------------------------------- /src/P2/cplcy.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @todo Mangle all function names in INCLUDE_ASM macros. 3 | */ 4 | #include 5 | 6 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", InitCplcy); 7 | 8 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", FActiveCplcy); 9 | 10 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", SetCpmanCpmt); 11 | 12 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", FUN_001493c0); 13 | 14 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", PosCplookAnchor); 15 | 16 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", FUN_00149458); 17 | 18 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", plays_binoc_sfx); 19 | 20 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", PushCplookLookk__FP6CPLOOK5LOOKK); 21 | 22 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", LookkPopCplook__FP6CPLOOK); 23 | 24 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", LookkCurCplook__FP6CPLOOK); 25 | 26 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", InitCplook); 27 | 28 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", FUN_001496c0); 29 | 30 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", UpdateCplook); 31 | 32 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", FUN_0014a7b8); 33 | 34 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", InitCpalign); 35 | 36 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", FUN_0014a8d0); 37 | 38 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", UpdateCpalign); 39 | 40 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", FUN_0014aa90); 41 | 42 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", FUN_0014aa98); 43 | 44 | INCLUDE_ASM("asm/nonmatchings/P2/cplcy", UpdateCpaseg); 45 | -------------------------------------------------------------------------------- /src/P2/credit.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/credit", InitCredit__FP6CREDIT5BLOTK); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/credit", PostCreditLoad__FP6CREDIT); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/credit", SetCreditClock__FP6CREDITPf); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/credit", UpdateCredit__FP6CREDIT); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/credit", DrawCredit__FP6CREDIT); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/credit", PlaceCredit__FP6CREDITffi); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/credit", VacateCredit__FP6CREDIT); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/credit", SetCreditLine__FP6CREDITiPcf); 18 | -------------------------------------------------------------------------------- /src/P2/crout.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/crout", CroutDecomp__FiPfT1); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/crout", CroutSolve__FiPfN21); 6 | -------------------------------------------------------------------------------- /src/P2/dartgun.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void InitDartgun(DARTGUN *pdartgun) 4 | { 5 | InitBreak((BREAK *)pdartgun); 6 | STRUCT_OFFSET(pdartgun, 0x6c0, OID) = OID_Nil; // pdartgun->oidDart 7 | } 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", HandleDartgunMessage__FP7DARTGUN5MSGIDPv); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", BindDartgun__FP7DARTGUN); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", FUN_0014f900); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", PostDartgunLoad__FP7DARTGUN); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", UpdateDartgun__FP7DARTGUNf); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", FIgnoreDartgunIntersection__FP7DARTGUNP2SO); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", BreakDartgun__FP7DARTGUN); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", SetDartgunGoalState__FP7DARTGUN3OID); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", TrackDartgun__FP7DARTGUNP3OID); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", FPrepareDartgunToFire__FP7DARTGUN); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", FireDartgun__FP7DARTGUN); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", AgeDartgunStuckDart__FP7DARTGUN); 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", PratGetDartgunRatTarget__FP7DARTGUN); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", AddDartgunRatTarget__FP7DARTGUN3OID); 36 | 37 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", StartDartgunTargetAreaChange__FP7DARTGUN); 38 | 39 | INCLUDE_ASM("asm/nonmatchings/P2/dartgun", AddDartgunTargetAreaTarget__FP7DARTGUNP3ALO); 40 | -------------------------------------------------------------------------------- /src/P2/dysh.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/dysh", InitDysh__FP4DYSH); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/dysh", SetDyshShadow__FP4DYSHP6SHADOW); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/dysh", RenderDyshSelf__FP4DYSHP2CMP2RO); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/dysh", DrawDysh__FP3RPL); 10 | -------------------------------------------------------------------------------- /src/P2/dzg.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/dzg", InitDzg__FP3DZGi); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/dzg", ClearDzgSolution__FP3DZG); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/dzg", AppendDzgDz__FP3DZGP2DZ); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/dzg", FillDzgDz__FP3DZGiP2DZiPP2XPPiPPP2SO); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/dzg", EnforceDzgDz__FP3DZGP2DZ); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/dzg", SolveDzg__FP3DZGiiPP2XPPiPPP2SO); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/dzg", SolveDzgFric__FP3DZGiiPP2XPPiPPP2SOf); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/dzg", ApplyDzg__FP3DZGiPiPPP2SOff); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/dzg", SolveInequalities__FiPfN21); 20 | -------------------------------------------------------------------------------- /src/P2/eyes.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/eyes", InitEyes__FP4EYESP4SAAF); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/eyes", PostEyesLoad__FP4EYES); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/eyes", SetEyesEyess__FP4EYES5EYESS); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/eyes", UpdateEyes__FP4EYESf); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/eyes", SetEyesClosed__FP4EYESf); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/eyes", PsaiFromEyesShd__FP4EYESP3SHD); 14 | -------------------------------------------------------------------------------- /src/P2/fader.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/fader", UpdateFader__FP5FADERf); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/fader", PfaderNew__FP3ALO); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/fader", RemoveFader__FP5FADER); 8 | -------------------------------------------------------------------------------- /src/P2/flash.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // NOTE: Could also belong to P2/find.c. 6 | JUNK_ADDIU(60); 7 | 8 | void InitFlash(FLASH *pflash) 9 | { 10 | InitAlo(pflash); 11 | 12 | pflash->gScaleTarget = 1.0f; 13 | pflash->gScaleCur = 1.0f; 14 | 15 | SMP *psmpScale = &pflash->smpScale; 16 | psmpScale->svFast = 1.0f; 17 | psmpScale->svSlow = 0.2f; 18 | psmpScale->dtFast = 0.1f; 19 | } 20 | 21 | void LoadFlashFromBrx(FLASH *pflash, CBinaryInputStream *pbis) 22 | { 23 | LoadAloFromBrx(pflash, pbis); 24 | LoadTbspFromBrx(pbis, &pflash->ctsurf, &pflash->atsurf, &pflash->ctbsp, &pflash->atbsp); 25 | } 26 | 27 | void UpdateFlash(FLASH *pflash, float dt) 28 | { 29 | UpdateAlo(pflash, dt); 30 | pflash->gScaleCur = GSmooth(pflash->gScaleCur, pflash->gScaleTarget, g_clock.dt, &pflash->smpScale, 0); 31 | } 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/flash", RenderFlashSelf__FP5FLASHP2CMP2RO); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/flash", FPosFlashWithin__FP5FLASHP6VECTOR); 36 | -------------------------------------------------------------------------------- /src/P2/fly.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/fly", InitFly__FP3FLY); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/fly", LoadFlyFromBrx__FP3FLYP18CBinaryInputStream); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/fly", CloneFly__FP3FLYT0); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/fly", FreezeFly__FP3FLYi); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/fly", PostFlyLoad__FP3FLY); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/fly", PresetFlyAccel__FP3FLYf); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/fly", UpdateFly__FP3FLYf); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/fly", RenderFlySelf__FP3FLYP2CMP2RO); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/fly", FAbsorbFlyWkr__FP3FLYP3WKR); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/fly", SetFlyFlys__FP3FLY4FLYS); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/fly", EmitFlyDroppings__FP3FLY); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/fly", FFindFlyClosestLandingPos__FP3FLYP6VECTOR); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/fly", FlysAttemptedFlyLanding__FP3FLY); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/fly", FShouldFlyFlee__FP3FLY); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/fly", FFilterFly__FPvP2SO); 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/fly", FCheckFlyOpenSpaceBelow__FP3FLY); 34 | -------------------------------------------------------------------------------- /src/P2/freeze.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", RemergeSwObject__FP2SWP3ALO); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", MergeSwFreezeGroups__FP2SWP3ALOT1); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", SplinterSwFreezeGroup__FP2SWP3ALO); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", MergeSwGroup__FP2SWP3MRG); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", AddSwMergeGroup__FP2SWP3MRG); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", RemoveFromArray__FPiPPvPv); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", RemoveSwMergeGroup__FP2SWP3MRG); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", RemergeSwObjects__FP2SW); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", FreezeAloHierarchy__FP3ALOi); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", GetAloFrozen__FP3ALOPi); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", FreezeAlo__FP3ALOi); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", FreezeSo__FP2SOi); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", RefreezeSwObjects__FP2SW); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/freeze", UpdateSwBusyList__FP2SW); 30 | -------------------------------------------------------------------------------- /src/P2/frzg.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/frzg", PostFrzgLoad__FP4FRZG); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/frzg", AddFrzgObject__FP4FRZG3OID); 6 | -------------------------------------------------------------------------------- /src/P2/geom.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void InitGeom(GEOM *pgeom) 4 | { 5 | pgeom->cpos = 0; 6 | pgeom->apos = (VECTOR *)nullptr; 7 | 8 | pgeom->csurf = 0; 9 | pgeom->asurf = (SURF *)nullptr; 10 | 11 | pgeom->cedge = 0; 12 | pgeom->aedge = (EDGE *)nullptr; 13 | } 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/geom", CloneGeom__FP4GEOMP7MATRIX4T0); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/geom", FUN_00161028); 18 | -------------------------------------------------------------------------------- /src/P2/glbs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", __4GLBS); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", _$_4GLBS); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", SetTransform__4GLBSP6VECTORP7MATRIX3); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", FindLights__4GLBSP6VECTORf); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", ResetStrip__4GLBS); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", BeginStrip__4GLBSP3SHD); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", DrawPrelit__4GLBS); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", DrawThreeWay__4GLBS); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", EndStrip__4GLBS); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", SetNormal__4GLBSP6VECTOR); 22 | 23 | JUNK_WORD(0xE4800110); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", SetRgba__4GLBSG4RGBA); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", SetUv__4GLBSP3UVF); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/glbs", AddVtx__4GLBSi); 30 | -------------------------------------------------------------------------------- /src/P2/hnd.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern float D_0024A7DC; 4 | 5 | void InitHnd(HND *phnd) 6 | { 7 | InitTarget(phnd); 8 | 9 | float val = D_0024A7DC; 10 | STRUCT_OFFSET(phnd, 0x88, int) = 1; // phnd->grftak 11 | STRUCT_OFFSET(phnd, 0xa8, int) = 8; // Likely phnd->sfxidRelease 12 | STRUCT_OFFSET(phnd, 0xac, int) = 9; // Likely phnd->sfxidGrab 13 | STRUCT_OFFSET(phnd, 0xb4, float) = val; 14 | } 15 | 16 | /** 17 | * @todo Objdiff reports a 100% match, but checksum check still fails. 18 | */ 19 | INCLUDE_ASM("asm/nonmatchings/P2/hnd", LoadHndFromBrx__FP3HNDP18CBinaryInputStream); 20 | #ifdef SKIP_ASM 21 | void LoadHndFromBrx(HND *phnd, CBinaryInputStream *pbis) 22 | { 23 | LoadXfmFromBrx(phnd, pbis); 24 | } 25 | #endif // SKIP_ASM 26 | 27 | JUNK_ADDIU(A0); 28 | JUNK_ADDIU(E0); 29 | -------------------------------------------------------------------------------- /src/P2/ik.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void RenderIkhSelf(IKH *pikh, CM *pcm, RO *pro) 4 | { 5 | RenderSoSelf(pikh, pcm, pro); 6 | } 7 | 8 | void RenderLikhSelf(LIKH *plikh, CM *pcm, RO *pro) 9 | { 10 | RenderAloSelf(plikh, pcm, pro); 11 | } 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/ik", SolveAloIK__FP3ALO); 14 | -------------------------------------------------------------------------------- /src/P2/keyhole.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern KEYHOLE *g_pkeyhole; 4 | 5 | void InitKeyhole(KEYHOLE *pkeyhole) 6 | { 7 | InitLo(pkeyhole); 8 | g_pkeyhole = pkeyhole; 9 | } 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/keyhole", LoadKeyholeFromBrx__FP7KEYHOLEP18CBinaryInputStream); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/keyhole", DrawKeyholeMask__FP7KEYHOLEffff); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/keyhole", DrawKeyhole__FP7KEYHOLEf); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/keyhole", keyhole__static_initialization_and_destruction_0); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/keyhole", _GLOBAL_$I$InitKeyhole__FP7KEYHOLE); 20 | -------------------------------------------------------------------------------- /src/P2/landing.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/landing", OnLandingAdd__FP7LANDING); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/landing", OnLandingRemove__FP7LANDING); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/landing", CloneLanding__FP7LANDINGT0); 8 | -------------------------------------------------------------------------------- /src/P2/lookat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/lookat", InitActla__FP5ACTLAP3ALO); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/lookat", SetActlaTarget__FP5ACTLAP3ALOP6VECTOR); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/lookat", PaloGetActlaTarget__FP5ACTLA); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/lookat", UpdateActla__FP5ACTLAf); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/lookat", GetActlaRotationGoal__FP5ACTLAfP7MATRIX3P6VECTOR); 12 | -------------------------------------------------------------------------------- /src/P2/mb.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void InitMbg(MBG *pmbg) 4 | { 5 | InitStepguard(pmbg); 6 | STRUCT_OFFSET(pmbg, 0xe3c, int) = -1; 7 | } 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/mb", LoadMbgFromBrx__FP3MBGP18CBinaryInputStream); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/mb", PostMbgLoad__FP3MBG); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FUN_0018a510); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FUN_0018a628); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/mb", PsoHitTestCylinderObjects__FiP6VECTORT1fiPP2SOP3LSG); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FFilterMbgAttackObjects__FP3MBGP2SO); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FObstructedMbg__FP3MBGP6VECTORT1); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FCanMbgAttack__FP3MBG); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FDetectMbg__FP3MBG); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FUN_0018ab88__Fi); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FUN_0018abf0__Fi); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FUN_0018ac58__Fi); 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FUN_0018acd0__Fv); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FUN_0018acf0); 36 | 37 | INCLUDE_ASM("asm/nonmatchings/P2/mb", UpdateMbgGoal__FP3MBGi); 38 | 39 | INCLUDE_ASM("asm/nonmatchings/P2/mb", UpdateMbgSgs__FP3MBG); 40 | 41 | INCLUDE_ASM("asm/nonmatchings/P2/mb", OnMgExitingSgs__FP3MBG3SGS); 42 | 43 | INCLUDE_ASM("asm/nonmatchings/P2/mb", HandleMbgMessage__FP3MBG5MSGIDPv); 44 | 45 | INCLUDE_ASM("asm/nonmatchings/P2/mb", FUN_0018b460); 46 | -------------------------------------------------------------------------------- /src/P2/missile.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/missile", InitMissile__FP7MISSILE); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/missile", LoadMissileFromBrx__FP7MISSILEP18CBinaryInputStream); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/missile", OnMissileRemove__FP7MISSILE); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/missile", ProjectMissileTransform__FP7MISSILEfi); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/missile", FireMissile__FP7MISSILEP3ALOP6VECTOR); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/missile", RenderMissileAll__FP7MISSILEP2CMP2RO); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/missile", FUN_0018dc88); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/missile", FUN_0018dd50); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/missile", FUN_0018dd78); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/missile", InitAccmiss__FP7ACCMISS); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/missile", FireAccmiss__FP7ACCMISSP3ALOP6VECTOR); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/missile", PresetAccmissAccel__FP7ACCMISSf); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/missile", FireSplmiss__FP7SPLMISSP3ALOP6VECTOR); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/missile", ProjectSplmissTransform__FP7SPLMISSfi); 30 | -------------------------------------------------------------------------------- /src/P2/mrkv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/mrkv", InitMrkv__FP4MRKV); 4 | -------------------------------------------------------------------------------- /src/P2/ms.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/ms", RenderMsGlobset__FP2MSP2CMP2RO); 4 | -------------------------------------------------------------------------------- /src/P2/path.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/path", PcbspExtract__FP4CBSP); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/path", PcgtExtract__FP3CGT); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/path", PcgtPointInCbspQuick__FP4CBSPP6VECTOR); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/path", PcgtPointInCbspSafe__FP4CBSPP6VECTOR); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/path", CbskFromG__Ff); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/path", ClsgClipEdgeToCbsp__FP4CBSPP6VECTORT1iP3LSG); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/path", FClipEdgeToCbsp__FP4CBSPP6VECTORT1); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/path", IcgvFromPcgv__FP2CGP3CGV); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/path", FindPathAStar__FP2CGP3CGVT1iPiPP3CGV); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/path", SimplifyApcgvNeighbor__FP4CBSPPiPP3CGV); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/path", CposFindPath__FP2CGP6VECTORT1iT1); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/path", FindClosestPointInCg__FP2CGP6VECTORT1); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/path", LoadPathzoneFromBrx__FP8PATHZONEP18CBinaryInputStream); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/path", HookupCg__FP2CG); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/path", CposFindPathzonePath__FP8PATHZONEP6VECTORT1iT1); 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/path", FindPathzoneClosestPoint__FP8PATHZONEP6VECTORT1); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/path", FUN_00191aa8); 36 | 37 | INCLUDE_ASM("asm/nonmatchings/P2/path", FUN_00191ac8); 38 | 39 | INCLUDE_ASM("asm/nonmatchings/P2/path", ChoosePathzoneRandomPoint__FP8PATHZONEP6VECTOR); 40 | -------------------------------------------------------------------------------- /src/P2/phasemem.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // PHASE g_phase = PHASE_None; // TODO: There may be other data in this file. 5 | 6 | void SetPhase(PHASE phase) 7 | { 8 | if (g_phase == phase) 9 | return; 10 | 11 | FlushCache(0); 12 | g_phase = phase; 13 | } 14 | 15 | void ClearPhase(PHASE phase) 16 | { 17 | g_phase = PHASE_None; 18 | } 19 | -------------------------------------------------------------------------------- /src/P2/pipe.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern DL g_dlPipe; 5 | 6 | void StartupPipe() 7 | { 8 | InitDl(&g_dlPipe, 0x38); 9 | } 10 | 11 | void ResetPipeList() 12 | { 13 | ClearDl(&g_dlPipe); 14 | } 15 | 16 | INCLUDE_ASM("asm/nonmatchings/P2/pipe", InitPipe__FP4PIPE); 17 | 18 | void OnPipeAdd(PIPE *ppipe) 19 | { 20 | OnLoAdd(ppipe); 21 | AppendDlEntry(&g_dlPipe, ppipe); 22 | } 23 | 24 | void OnPipeRemove(PIPE *ppipe) 25 | { 26 | OnLoRemove(ppipe); 27 | RemoveDlEntry(&g_dlPipe, ppipe); 28 | } 29 | 30 | INCLUDE_ASM("asm/nonmatchings/P2/pipe", PostPipeLoad); 31 | 32 | INCLUDE_ASM("asm/nonmatchings/P2/pipe", ClonePipe__FP4PIPET0); 33 | -------------------------------------------------------------------------------- /src/P2/pnt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void LoadPntFromBrx(PNT *ppnt, CBinaryInputStream *pbis) 5 | { 6 | pbis->ReadVector(&ppnt->posLocal); 7 | LoadOptionsFromBrx(ppnt, pbis); 8 | } 9 | 10 | void GetPntPos(PNT *ppnt, VECTOR *ppos) 11 | { 12 | ConvertAloPos(ppnt->paloParent, (ALO *)nullptr, &ppnt->posLocal, ppos); 13 | } 14 | 15 | void SetPntParent(PNT *ppnt, ALO *paloParent) 16 | { 17 | ConvertAloPos(ppnt->paloParent, paloParent, &ppnt->posLocal, &ppnt->posLocal); 18 | SetLoParent(ppnt, paloParent); 19 | } 20 | 21 | void ApplyPntProxy(PNT *ppnt, PROXY *pproxyApply) 22 | { 23 | ConvertAloPos((ALO *)pproxyApply, (ALO *)nullptr, &ppnt->posLocal, &ppnt->posLocal); 24 | } 25 | 26 | /** 27 | * @todo Rename function and figure out what does it actually do. 28 | */ 29 | void FUN_00192150(PNT *ppnt, CBinaryInputStream *pbis) 30 | { 31 | LoadPntFromBrx(ppnt, pbis); 32 | pbis->ReadStringSw(&STRUCT_OFFSET(ppnt, 0x50, char *)); 33 | } 34 | 35 | /** 36 | * @todo Rename function and figure out what does it actually do. 37 | */ 38 | void FUN_00192190(PNT *ppnt) 39 | { 40 | STRUCT_OFFSET(ppnt, 0x54, float) = 0.5f; 41 | STRUCT_OFFSET(ppnt, 0x58, float) = 0.5f; 42 | } 43 | -------------------------------------------------------------------------------- /src/P2/proxy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void InitProxy(PROXY *pproxy) 5 | { 6 | InitAlo(pproxy); 7 | AppendDlEntry(&pproxy->psw->dlProxy, pproxy); 8 | } 9 | 10 | INCLUDE_ASM("asm/nonmatchings/P2/proxy", LoadProxyFromBrx__FP5PROXYP18CBinaryInputStream); 11 | 12 | INCLUDE_ASM("asm/nonmatchings/P2/proxy", CloneProxy__FP5PROXYT0); 13 | 14 | void PostProxyLoad(PROXY *pproxy) 15 | { 16 | PostAloLoad(pproxy); 17 | pproxy->pvtlo->pfnRemoveLo(pproxy); 18 | } 19 | -------------------------------------------------------------------------------- /src/P2/rail.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern float D_0024C8C4; 6 | 7 | void InitRail(RAIL *prail) 8 | { 9 | InitLo(prail); 10 | prail->unk1 = D_0024C8C4; 11 | prail->oid = OID_Nil; 12 | } 13 | 14 | void OnRailAdd(RAIL *prail) 15 | { 16 | OnLoAdd(prail); 17 | AppendDlEntry(&prail->psw->dlRail, prail); 18 | } 19 | 20 | void OnRailRemove(RAIL *prail) 21 | { 22 | OnLoRemove(prail); 23 | RemoveDlEntry(&prail->psw->dlRail, prail); 24 | } 25 | 26 | void PostLoadRail(RAIL *prail) 27 | { 28 | PostLoLoad(prail); 29 | if (prail->oid != OID_Nil) 30 | { 31 | // TODO: Check if the field at 0x58 is LO or something that inherits from it. 32 | prail->plo = PloFindSwObject(prail->psw, 4, prail->oid, prail); 33 | } 34 | } 35 | 36 | void CloneRail(RAIL *prail, RAIL *prailBase) 37 | { 38 | DLE dleRail = prail->dleRail; 39 | CloneLo(prail, prailBase); 40 | prail->dleRail = dleRail; 41 | } 42 | -------------------------------------------------------------------------------- /src/P2/rchm.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void InitRchm(RCHM *prchm) 4 | { 5 | InitLo(prchm); 6 | prchm->oidTouch = OID_Nil; 7 | prchm->oidHost = OID_Nil; 8 | } 9 | 10 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", LoadRchmFromBrx__FP4RCHMP18CBinaryInputStream); 11 | 12 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", PostRchmLoad__FP4RCHM); 13 | 14 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", ReblendRchm__FP4RCHMP3TWRP6VECTOR); 15 | 16 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", BuildRchmCoefficients__FP4RCHMfffPf); 17 | 18 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", ConvertRchmIposToRclIoLhub__FP4RCHMiPfN22); 19 | 20 | void SetRchmNaturalCoefficients(RCHM *prchm, float rcl, float io, float lhub) 21 | { 22 | prchm->rclNatural = rcl; 23 | prchm->ioNatural = io; 24 | prchm->lhubNatural = lhub; 25 | } 26 | 27 | void SetRchmCenterCoefficients(RCHM *prchm, float rcl, float io, float lhub) 28 | { 29 | prchm->fCenterSet = 1; 30 | prchm->rclNatural = rcl; 31 | prchm->ioNatural = io; 32 | prchm->lhubNatural = lhub; 33 | } 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", PredictRchmTargetPos__FP4RCHMP6TARGETfP6VECTOR); 36 | 37 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", PredictRchmTargetLocalPos__FP4RCHMP6TARGETfP6VECTOR); 38 | 39 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", PtwrMapRchmSafe__FP4RCHMP3BSPP6VECTOR); 40 | 41 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", FindRchmClosestPoint__FP4RCHMP6VECTORT1PP3TWRPf); 42 | 43 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", TrackJtTarget__FP2JTP4RCHMP6TARGET); 44 | 45 | INCLUDE_ASM("asm/nonmatchings/P2/rchm", TrackJtPipe__FP2JTP4RCHMP4PIPEPf); 46 | -------------------------------------------------------------------------------- /src/P2/shape.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/shape", LoadShapeFromBrx__FP5SHAPEP18CBinaryInputStream); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/shape", SetShapeParent__FP5SHAPEP3ALO); 6 | -------------------------------------------------------------------------------- /src/P2/sky.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/sky", PostSkyLoad__FP3SKY); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/sky", UpdateSky__FP3SKYf); 6 | -------------------------------------------------------------------------------- /src/P2/smartguard.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", InitSmartguard__FP10SMARTGUARD); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", PostSmartguardLoadFlashlight__FP10SMARTGUARD); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", UseSmartguardFlashlightTarget__FP10SMARTGUARD3SGS3OID); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", FUN_001B7100); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", PostSmartguardLoad__FP10SMARTGUARD); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", FFilterSmartguardDetect__FP10SMARTGUARDP2SO); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", FDetectSmartguard__FP10SMARTGUARD); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", UpdateSmartguard__FP10SMARTGUARDf); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", FUN_001B7638); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", OnSmartguardEnteringSgs__FP10SMARTGUARD3SGSP4ASEG); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", FCanSmartguardAttack__FP10SMARTGUARD); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", SgasGetSmartguard__FP10SMARTGUARD); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", HandleSmartguardMessage__FP10SMARTGUARD5MSGIDPv); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/smartguard", FreezeSmartguard__FP10SMARTGUARDi); 30 | -------------------------------------------------------------------------------- /src/P2/solve.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/solve", RenumberSo__FP2SOPiPP2SO); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/solve", CalculateSoEffect__FP2SOP6VECTORP2FXT1); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/solve", PropagateSoForce__FP2SOiP2XPiP2DZP2FX); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/solve", DistributeSoEffects__FP2SOiiPP2SOP2FX); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/solve", SolveSwGroup__FP2SWiPP2SOiPP2XPfi); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/solve", CpxpBuildXpArray__FiPP2SOiPP2XP); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/solve", BuildContactGroup__FP2SOPiPP2SOT1T2); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/solve", SplitSoFreeze__FP2SOi); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/solve", SortSwGroup__FiPP2SO); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/solve", SplitSwGroup__FP2SWiPP2SOfi); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/solve", SolveSw__FP2SWfi); 24 | -------------------------------------------------------------------------------- /src/P2/sort.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void SwapEntries(void *afoo, int cb, int i1, int i2) 4 | { 5 | int *p1 = (int *)(i1 * cb + (int)afoo); 6 | int *p2 = (int *)(i2 * cb + (int)afoo); 7 | 8 | while (cb > 0) 9 | { 10 | int temp = *p1; 11 | *p1 = *p2; 12 | *p2 = temp; 13 | 14 | p1++; 15 | p2++; 16 | cb -= sizeof(int); 17 | } 18 | } 19 | 20 | INCLUDE_ASM("asm/nonmatchings/P2/sort", HeapSort__FPviiPFPvPv_i); 21 | -------------------------------------------------------------------------------- /src/P2/speaker.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/speaker", InitSpeaker__FP7SPEAKER); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/speaker", PostSpeakerLoad__FP7SPEAKER); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/speaker", SetSpeakerSmIdle__FP7SPEAKER3OID); 8 | -------------------------------------------------------------------------------- /src/P2/spire.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /** 5 | * @todo Rename. 6 | */ 7 | extern float DAT_0024d3b4; 8 | 9 | void InitSpire(SPIRE *pspire) 10 | { 11 | InitLo(pspire); 12 | STRUCT_OFFSET(pspire, 0x58, float) = DAT_0024d3b4; 13 | } 14 | 15 | void OnSpireAdd(SPIRE *pspire) 16 | { 17 | OnLoAdd(pspire); 18 | AppendDlEntry(&pspire->psw->dlSpire, pspire); 19 | } 20 | 21 | void OnSpireRemove(SPIRE *pspire) 22 | { 23 | OnLoRemove(pspire); 24 | RemoveDlEntry(&pspire->psw->dlSpire, pspire); 25 | } 26 | 27 | void CloneSpire(SPIRE *pspire, SPIRE *pspireBase) 28 | { 29 | // pspire->dleSpire 30 | DLE dleSpire = STRUCT_OFFSET(pspire, 0x50, DLE); 31 | CloneLo(pspire, pspireBase); 32 | STRUCT_OFFSET(pspire, 0x50, DLE) = dleSpire; 33 | } 34 | -------------------------------------------------------------------------------- /src/P2/splice/eval.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalSymbol__FP5CPairP6CFrame); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalSet__FP5CPairP6CFrame); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalDefine__FP5CPairP6CFrame); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalAssert__FP5CPairP6CFrame); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalIf__FP5CPairP6CFrame); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalOr__FP5CPairP6CFrame); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalAnd__FP5CPairP6CFrame); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalCond__FP5CPairP6CFrame); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalCase__FP5CPairP6CFrame); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalLet__FP5CPairP6CFrame); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalWhile__FP5CPairP6CFrame); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalLambda__FP5CPairP6CFrame); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalLambdaBody__FP5CPairP6CFrame); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalBegin__FP5CPairP6CFrame); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalApply__FP5CPairP6CFrame); 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEvalImport__FP5CPairP6CFrame); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/splice/eval", RefEval__FP5CPairP6CFrame); 36 | -------------------------------------------------------------------------------- /src/P2/splice/method.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // todo: matches but blocked by reference in 001c15d8 6 | // INCLUDE_ASM("asm/nonmatchings/P2/splice/method", PmethodNew__Fv); 7 | CMethod *PmethodNew() 8 | { 9 | CMethod *method = (CMethod *)g_splotheapMethod.PvAllocClear(); 10 | memset(method, 0, sizeof(CMethod)); 11 | return method; 12 | } 13 | -------------------------------------------------------------------------------- /src/P2/splice/pair.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/splice/pair", CloneTo__5CPairP5CPairP6CFrame); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/splice/pair", PpairNew__Fv); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/splice/pair", DeletePair__FP5CPair); 8 | -------------------------------------------------------------------------------- /src/P2/splice/proc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void CProc::CloneTo(CProc *pprocClone, CFrame *pframeClone) 6 | { 7 | if (pframeClone == nullptr) 8 | { 9 | pframeClone = m_pframe; 10 | } 11 | pprocClone->m_pframe = pframeClone; 12 | pprocClone->m_ppair = m_ppair; 13 | pprocClone->m_crefReq = m_crefReq; 14 | pprocClone->m_fVarArg = m_fVarArg; 15 | pprocClone->m_ppairCodeExpr = m_ppairCodeExpr; 16 | } 17 | 18 | CProc *PprocNew() 19 | { 20 | CProc *proc = (CProc *)g_splotheapProc.PvAllocClear(); 21 | memset(proc, 0, sizeof(CProc)); 22 | return proc; 23 | } 24 | -------------------------------------------------------------------------------- /src/P2/splice/serialize.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/splice/serialize", PpairSerializeIn__FP18CBinaryInputStream); 4 | -------------------------------------------------------------------------------- /src/P2/splice/sidebag.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/splice/sidebag", RefAddBinding__8CSidebagiP4CRef); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/splice/sidebag", RefSetBinding__8CSidebagiP4CRef); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/splice/sidebag", FFindBinding__8CSidebagiP4CRef); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/splice/sidebag", CloneTo__8CSidebagP8CSidebag); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/splice/sidebag", PsidebagNew__Fv); 12 | -------------------------------------------------------------------------------- /src/P2/splice/spliceutils.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | extern CGc g_gc; 9 | 10 | // todo: match and fix blocked references 11 | INCLUDE_ASM("asm/nonmatchings/P2/splice/spliceutils", StartupSplice__Fv); 12 | #ifdef SKIP_ASM 13 | void StartupSplice() 14 | { 15 | g_gc.Startup(); 16 | 17 | g_splotheapPair.Startup(0xc, 0x2000); 18 | g_splotheapPair.m_pfndelete = reinterpret_cast(DeletePair); 19 | 20 | g_splotheapFrame.Startup(0x1c, 0x190); 21 | g_splotheapFrame.m_pfndelete = reinterpret_cast(DeleteFrame); 22 | 23 | g_splotheapUnk1.Startup(0x10, 0x800); 24 | g_splotheapUnk1.m_pfndelete = reinterpret_cast(0x11C4E8); 25 | 26 | g_splotheapProc.Startup(0x14, 0x800); 27 | StartupSpliceStructuredTypeFactories(); 28 | 29 | g_splotheapMethod.Startup(0xc, 0x80); 30 | } 31 | #endif // SKIP_ASM 32 | 33 | void ShutdownSplice() 34 | { 35 | g_splotheapPair.Shutdown(); 36 | g_splotheapFrame.Shutdown(); 37 | g_splotheapUnk1.Shutdown(); 38 | g_splotheapProc.Shutdown(); 39 | ShutdownSpliceStructuredTypeFactories(); 40 | g_splotheapMethod.Shutdown(); 41 | g_gc.Shutdown(); 42 | } 43 | 44 | INCLUDE_ASM("asm/nonmatchings/P2/splice/spliceutils", spliceutils__static_initialization_and_destruction_0); 45 | 46 | INCLUDE_ASM("asm/nonmatchings/P2/splice/spliceutils", _GLOBAL_$I$g_splotheapPair); 47 | 48 | INCLUDE_ASM("asm/nonmatchings/P2/splice/spliceutils", _GLOBAL_$D$g_splotheapPair); 49 | -------------------------------------------------------------------------------- /src/P2/splice/splotheap.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/splice/splotheap", Startup__10CSplotheapii); 4 | 5 | void CSplotheap::Shutdown() 6 | { 7 | return; 8 | } 9 | 10 | INCLUDE_ASM("asm/nonmatchings/P2/splice/splotheap", PvAllocUnsafe__10CSplotheap); 11 | 12 | INCLUDE_ASM("asm/nonmatchings/P2/splice/splotheap", PvAllocClear__10CSplotheap); 13 | 14 | INCLUDE_ASM("asm/nonmatchings/P2/splice/splotheap", PsplotLookup__10CSplotheapi); 15 | 16 | void CSplotheap::UpdateRecyclable() 17 | { 18 | m_psplotRecyclable = m_psplotAlloc; 19 | } 20 | 21 | void CSplotheap::UnmarkAll() 22 | { 23 | SPLOT *psplot = m_psplotAlloc; 24 | while (psplot) 25 | { 26 | psplot->fAlive = 0; 27 | psplot = psplot->psplotNext; 28 | } 29 | } 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/splice/splotheap", FreeGarbage__10CSplotheap); 32 | 33 | static void *PvFromPsplot(SPLOT *psplot) 34 | { 35 | return (byte *)psplot + sizeof(SPLOT); 36 | } 37 | 38 | static SPLOT *PsplotFromPv(void *pv) 39 | { 40 | return (SPLOT *)((byte *)pv - sizeof(SPLOT)); 41 | } 42 | 43 | bool FIsPvGarbage(void *pv) 44 | { 45 | SPLOT *psplot = PsplotFromPv(pv); 46 | return psplot->fAlive == 0; 47 | } 48 | 49 | void MarkPvAlive(void *pv) 50 | { 51 | SPLOT *psplot = PsplotFromPv(pv); 52 | psplot->fAlive = 1; 53 | } 54 | 55 | INCLUDE_ASM("asm/nonmatchings/P2/splice/splotheap", FUN_0011C418); 56 | 57 | INCLUDE_ASM("asm/nonmatchings/P2/splice/splotheap", FUN_0011C498); 58 | 59 | INCLUDE_ASM("asm/nonmatchings/P2/splice/splotheap", FUN_0011C4E8); 60 | -------------------------------------------------------------------------------- /src/P2/splice/vecmat.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", PvectorNew__Fv); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", IncrefVector__FP6VECTOR); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", DecrefVector__FP6VECTOR); 8 | 9 | JUNK_ADDIU(10); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", PmatrixNew__Fv); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", IncrefMatrix__FP7MATRIX4); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", DecrefMatrix__FP7MATRIX4); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", DeleteMatrix__FP7MATRIX4); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", PclqNew__Fv); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", IncrefClq__FP3CLQ); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", DecrefClq__FP3CLQ); 24 | 25 | JUNK_ADDIU(10); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", PlmNew__Fv); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", IncrefLm__FP2LM); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", DecrefLm__FP2LM); 32 | 33 | JUNK_ADDIU(10); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", PsmpNew__Fv); 36 | 37 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", IncrefSmp__FP3SMP); 38 | 39 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", DecrefSmp__FP3SMP); 40 | 41 | INCLUDE_ASM("asm/nonmatchings/P2/splice/vecmat", StartupSpliceStructuredTypeFactories__Fv); 42 | 43 | void ShutdownSpliceStructuredTypeFactories() 44 | { 45 | return; 46 | } 47 | -------------------------------------------------------------------------------- /src/P2/splicemap.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/splicemap", LoadSwSpliceFromBrx__FP2SWP18CBinaryInputStream); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/splicemap", PframeFromIsplice__FiP2SW); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/splicemap", RefEvalModule__FiP2SW); 8 | -------------------------------------------------------------------------------- /src/P2/spliceobj.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", PeopidFind__FP5BASICi); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefGetObjectList__FP5BASIC4OTYPPFPv_v); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefGetPeopid__FP5BASICP5EOPID); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", FAppendSpliceListElement__FPvT0); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", FSpliceListElementExists__FPvT0); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefSetPvsFromSplice__FiP4CRefP4OTYPPPv); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefSetArgListFromPvs__FiP4OTYPPPv); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefSetPeopid__FP5BASICP5EOPIDP4CRef); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefGetOption__FP5BASICi); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefSetOption__FP5BASICiP4CRef); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefAddOption__FP5BASICiP4CRef); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefEnsureOption__FP5BASICiP4CRef); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/spliceobj", RefSetArgsFromSplice__FiP4CRefP4OTYPe); 28 | -------------------------------------------------------------------------------- /src/P2/sprbuf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/sprbuf", LoadSprBuf__Fie); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/sprbuf", SaveSprBuf__FPve); 6 | 7 | JUNK_ADDIU(A0); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/sprbuf", sprbuf__static_initialization_and_destruction_0); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/sprbuf", _GLOBAL_$I$g_asprbuf); 12 | -------------------------------------------------------------------------------- /src/P2/sqtr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/sqtr", FUN_001c29e8); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/sqtr", UpdateSqtrm__FP5SQTRMP6VECTORP7MATRIX3ff); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/sqtr", RenderSqtrm__FP5SQTRMP2CM); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/sqtr", DrawSqtrm__FP3RPL); 10 | -------------------------------------------------------------------------------- /src/P2/stepact.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/stepact", GetActaddPositionGoal__FP6ACTADDfP6VECTORT2); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/stepact", GetActaddRotationGoal__FP6ACTADDfP7MATRIX3P6VECTOR); 6 | -------------------------------------------------------------------------------- /src/P2/stepcane.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/stepcane", SetJtJtcs__FP2JT4JTCS); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/stepcane", UpdateJtCane__FP2JT); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/stepcane", UpdateJtActiveCane__FP2JTP3JOY); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/stepcane", ChooseJtAttackTarget__FP2JTiP6VECTORffPP6TARGETT2); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/stepcane", ChooseJtSweepTarget__FP2JTP2BLP6ASEGBL); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/stepcane", ChooseJtRushTarget__FP2JT); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/stepcane", ChooseJtSmashTarget__FP2JT); 16 | -------------------------------------------------------------------------------- /src/P2/stephang.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", PostJtLoadSwing__FP2JTP2BLPP6ASEGBL); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", AnticipateJtForce__FP2JTP2SOP6VECTORT2P2FX); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", CalculateJtHangAccel__FP2JT); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", PresetJtAccelHang__FP2JT); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", AddJtExternalAccelerations__FP2JTP2XAf); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", UpdateJtActiveHang__FP2JTP3JOY); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", CheckJtUnhook__FP2JT); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", UpdateJtHookOx__FP2JTP2LOi); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", AddJtHookXps__FP2JTiP2LOP6VECTORN23); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", GetJtHangHeading__FP2JTPf); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", UpdateJtIkHang__FP2JT); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", FUN_001cdd98); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/stephang", FUN_001cdf78); 28 | -------------------------------------------------------------------------------- /src/P2/stephide.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", JtbsChooseJtHide__FP2JTP2LOP4JTHK); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", MeasureJtJumpToTarget__FP2JTP6VECTORP3ALOT1T1PfT5T1T1); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", GetJtRailLanding__FP2JTP4RAILfP6VECTORT3); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", GMeasureJumpRail__FP3MJRf); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", FUN_001cea58); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", GMeasureJumpHshape__FP3MJHf); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", FUN_001ceb18); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", FUN_001cedf8); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", FUN_001cee30); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", FUN_001ceec8); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", FUN_001cf138); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", FUN_001cf158); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", UpdateJtActiveHide__FP2JTP3JOY); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", MatchJtXmgRail__FP2JTP3XMGP6ACTADJ); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", UpdateJtHide__FP2JT); 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", UpdateJtInternalXpsHide__FP2JT); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", SetJtHfdk__FP2JT4HFDK); 36 | 37 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", ResetJtDynamicTunnel__FP2JT); 38 | 39 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", PresetJtAccelHide__FP2JT); 40 | 41 | INCLUDE_ASM("asm/nonmatchings/P2/stephide", FUN_001d1478); 42 | -------------------------------------------------------------------------------- /src/P2/steppipe.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/steppipe", PostJtLoadPipe__FP2JT); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/steppipe", GetJtPipeGoalMat__FP2JTP4PIPEfP7MATRIX3); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/steppipe", PresetJtAccelPipe__FP2JT); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/steppipe", UpdateJtActivePipe__FP2JTP3JOY); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/steppipe", UpdateJtInternalXpsPipe__FP2JT); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/steppipe", SetJtJtpdk__FP2JT5JTPDK); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/steppipe", PlaceJtOnPipe__FP2JTP4PIPE); 16 | -------------------------------------------------------------------------------- /src/P2/steprail.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/steprail", func_001D31D0__FP2LOi); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/steprail", post_load_steprail); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/steprail", func_001D32D8__FiP2JTl); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/steprail", update_steprail); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/steprail", preset_steprail_accel); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/steprail", FUN_001d34e0); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/steprail", FUN_001d3500); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/steprail", FUN_001d35a8); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/steprail", update_steprail_message); 20 | -------------------------------------------------------------------------------- /src/P2/steprun.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/steprun", PostStepLoadRun__FP4STEPP5BLRUNPP6ASEGBL); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/steprun", CalculateBlrunV__FiP5BLRUNP4MRSGP6VECTOR); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/steprun", ProjectStepRunPlant__FP4STEPP5BLRUNffiiP6VECTOR); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/steprun", FIntersectStepRunPlant__FP4STEPP6VECTORT1Pf); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/steprun", FReblendAbl2D__FiiiP2BLe); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/steprun", AdjustStepRun__FP4STEPP5BLRUNP6ASEGBLP5ASEGA); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/steprun", SetStepRunTarget__FP4STEPffP5BLRUNP6ASEGBL); 16 | -------------------------------------------------------------------------------- /src/P2/stepside.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/stepside", PostJtLoadSidestep__FP2JTP4BLSSPP6ASEGBL); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/stepside", AdjustJtSidestep__FP2JTP4BLSSP6ASEGBL); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/stepside", SetJtSidestepTarget__FP2JTP4BLSSP6ASEGBLff); 8 | -------------------------------------------------------------------------------- /src/P2/stream.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | OSTRM::OSTRM(int fd) 4 | { 5 | m_fd = fd; 6 | m_abDest = 0; 7 | m_cbDest = 0; 8 | m_ibCur = 0; 9 | m_cbWritten = 0; 10 | m_cbBuffered = 0; 11 | } 12 | 13 | OSTRM::OSTRM(void *abDest, int cbDest) 14 | { 15 | m_abDest = (uchar *)abDest; 16 | m_cbDest = cbDest; 17 | m_fd = -1; 18 | m_ibCur = 0; 19 | m_cbWritten = 0; 20 | m_cbBuffered = 0; 21 | } 22 | 23 | OSTRM::~OSTRM() 24 | { 25 | Flush(); 26 | } 27 | 28 | INCLUDE_ASM("asm/nonmatchings/P2/stream", CbWrite__5OSTRMPvi); 29 | 30 | INCLUDE_ASM("asm/nonmatchings/P2/stream", Flush__5OSTRM); 31 | -------------------------------------------------------------------------------- /src/P2/tail.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/tail", InitTail__FP4TAIL); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/tail", PostTailLoad__FP4TAIL); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/tail", UpdateTailConstraints__FP4TAIL); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/tail", MatchTailOtherObject__FP4TAILP3ALO); 10 | -------------------------------------------------------------------------------- /src/P2/tank.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | INCLUDE_ASM("asm/nonmatchings/P2/tank", InitTank__FP4TANK); 5 | 6 | INCLUDE_ASM("asm/nonmatchings/P2/tank", PostTankLoad__FP4TANK); 7 | 8 | INCLUDE_ASM("asm/nonmatchings/P2/tank", UpdateTank__FP4TANKf); 9 | 10 | INCLUDE_ASM("asm/nonmatchings/P2/tank", FUN_001deb30); 11 | 12 | void UseTankCharm(TANK *ptank) 13 | { 14 | UsePoCharm(ptank); 15 | SetTankTanks(ptank, TANKS_Active); 16 | } 17 | 18 | INCLUDE_ASM("asm/nonmatchings/P2/tank", UpdateTankActive__FP4TANKP3JOYf); 19 | 20 | void OnTankActive(TANK *ptank, int fActive, PO *ppoOther) 21 | { 22 | OnPoActive(ptank, fActive, ppoOther); 23 | if (!fActive) 24 | { 25 | STRUCT_OFFSET(ptank, 0x728, int) = 0; // ptank->fFlash 26 | } 27 | } 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/tank", RenderTankAll__FP4TANKP2CMP2RO); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/tank", ImpactTank__FP4TANKi); 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/tank", FInvulnerableTank__FP4TANK3ZPK); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/tank", ApplyTankThrow__FP4TANKP2PO); 36 | 37 | INCLUDE_ASM("asm/nonmatchings/P2/tank", FTakeTankDamage__FP4TANKP3ZPR); 38 | 39 | INCLUDE_ASM("asm/nonmatchings/P2/tank", FUN_001dfa10); 40 | 41 | INCLUDE_ASM("asm/nonmatchings/P2/tank", AdjustTankNewXp__FP4TANKP2XPi); 42 | 43 | INCLUDE_ASM("asm/nonmatchings/P2/tank", HandleTankMessage__FP4TANK5MSGIDPv); 44 | 45 | JTHS JthsCurrentTank(TANK *ptank) 46 | { 47 | return (JTHS)(STRUCT_OFFSET(ptank, 0x728, int) != 0); // ptank->fFlash 48 | } 49 | 50 | INCLUDE_ASM("asm/nonmatchings/P2/tank", SetTankTanks__FP4TANK5TANKS); 51 | -------------------------------------------------------------------------------- /src/P2/target.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern DL g_dlTarget; 4 | 5 | void StartupTarget() 6 | { 7 | InitDl(&g_dlTarget, 0x80); 8 | } 9 | 10 | void ResetTargetList() 11 | { 12 | ClearDl(&g_dlTarget); 13 | } 14 | 15 | void InitTarget(TARGET *ptarget) 16 | { 17 | InitXfm(ptarget); 18 | STRUCT_OFFSET(ptarget, 0x88, int) = 0x1e; // ptarget->grftak 19 | STRUCT_OFFSET(ptarget, 0x8c, float) = 25.0f; // ptarget->sRadiusTarget 20 | } 21 | 22 | void OnTargetAdd(TARGET *ptarget) 23 | { 24 | OnLoAdd(ptarget); 25 | AppendDlEntry(&g_dlTarget, ptarget); 26 | } 27 | 28 | void OnTargetRemove(TARGET *ptarget) 29 | { 30 | OnLoRemove(ptarget); 31 | RemoveDlEntry(&g_dlTarget, ptarget); 32 | } 33 | 34 | void CloneTarget(TARGET *ptarget, TARGET *ptargetBase) 35 | { 36 | DLE dleTarget = STRUCT_OFFSET(ptarget, 0x80, DLE); // ptarget->dleTarget 37 | CloneLo(ptarget, ptargetBase); 38 | STRUCT_OFFSET(ptarget, 0x80, DLE) = dleTarget; // ptarget->dleTarget 39 | } 40 | -------------------------------------------------------------------------------- /src/P2/thread.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int SemaCreate(int initCount, int maxCount) 7 | { 8 | SemaParam sp; 9 | 10 | memset(&sp, 0, sizeof(SemaParam)); 11 | sp.initCount = initCount; 12 | sp.maxCount = maxCount; 13 | return CreateSema(&sp); 14 | } 15 | 16 | JUNK_NOP(); 17 | JUNK_ADDIU(50); 18 | 19 | void InitCritSect(CRITSECT *pcritsect) 20 | { 21 | pcritsect->thread = -1; 22 | pcritsect->sema = SemaCreate(1, 1); 23 | } 24 | 25 | void EnterCritSect(CRITSECT *pcritsect) 26 | { 27 | int threadId = GetThreadId(); 28 | 29 | if (threadId != pcritsect->thread) 30 | { 31 | WaitSema(pcritsect->sema); 32 | pcritsect->thread = threadId; 33 | pcritsect->cEnter = 1; 34 | } 35 | else 36 | { 37 | pcritsect->cEnter++; 38 | } 39 | } 40 | 41 | void LeaveCritSect(CRITSECT *pcritsect) 42 | { 43 | int critSects = pcritsect->cEnter - 1; 44 | pcritsect->cEnter = critSects; 45 | 46 | if (critSects == 0) { 47 | pcritsect->thread = -1; 48 | SignalSema(pcritsect->sema); 49 | } 50 | } 51 | 52 | JUNK_ADDIU(30); 53 | 54 | void StartupThread() 55 | { 56 | ThreadParam tp; 57 | 58 | g_athread.cEnter = GetThreadId(); 59 | ChangeThreadPriority(g_athread.cEnter, 4); 60 | memset(&tp, 0, sizeof(ThreadParam)); 61 | 62 | tp.stackSize = 0x20000; 63 | tp.stack = g_abRenderLoopStack; 64 | tp.initPriority = 2; 65 | tp.gpReg = &_gpReg; 66 | tp.entry = FrameRenderLoop; 67 | 68 | g_athread.thread = CreateThread(&tp); 69 | } 70 | -------------------------------------------------------------------------------- /src/P2/turret.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | INCLUDE_ASM("asm/nonmatchings/P2/turret", InitTurret__FP6TURRET); 5 | 6 | INCLUDE_ASM("asm/nonmatchings/P2/turret", FUN_001e53f8); 7 | 8 | INCLUDE_ASM("asm/nonmatchings/P2/turret", PostTurretLoad__FP6TURRET); 9 | 10 | INCLUDE_ASM("asm/nonmatchings/P2/turret", UpdateTurret__FP6TURRETf); 11 | 12 | INCLUDE_ASM("asm/nonmatchings/P2/turret", UpdateTurretActive__FP6TURRETP3JOYf); 13 | 14 | INCLUDE_ASM("asm/nonmatchings/P2/turret", OnTurretActive__FP6TURRETiP2PO); 15 | 16 | INCLUDE_ASM("asm/nonmatchings/P2/turret", FFilterTurret__FP6TURRETP2SO); 17 | 18 | INCLUDE_ASM("asm/nonmatchings/P2/turret", UpdateTurretAim__FP6TURRET); 19 | 20 | INCLUDE_ASM("asm/nonmatchings/P2/turret", FireTurret__FP6TURRET); 21 | 22 | INCLUDE_ASM("asm/nonmatchings/P2/turret", HandleTurretMessage__FP6TURRET5MSGIDPv); 23 | 24 | INCLUDE_ASM("asm/nonmatchings/P2/turret", FIgnoreTurretIntersection__FP6TURRETP2SO); 25 | 26 | INCLUDE_ASM("asm/nonmatchings/P2/turret", CollectTurretPrize__FP6TURRET3PCKP3ALO); 27 | 28 | void GetTurretDiapi(TURRET *pturret, DIALOG *pdialog, DIAPI *pdiapi) 29 | { 30 | pdiapi->fCallable = 0; 31 | pdiapi->fPlayable = 0; 32 | } 33 | 34 | INCLUDE_ASM("asm/nonmatchings/P2/turret", FUN_001e5e60); 35 | -------------------------------------------------------------------------------- /src/P2/tv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/tv", InitTv__FP2TV5BLOTK); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/tv", PostTvLoad__FP2TV); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/tv", GetTvItvbMinMax__FP2TVPiT1); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/tv", DrawTvArea__FP2TVR4GIFSi); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/tv", DrawTvBands__FP2TVR4GIFS); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/tv", DrawTvOutline__FP2TVR4GIFS); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/tv", DrawTv__FP2TV); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/tv", SetTvTvs__FP2TV3TVS); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/tv", AcceptTvSpeaker__FP2TV); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/tv", SetTvTvgs__FP2TV4TVGS); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/tv", SetTvBlots__FP2TV5BLOTS); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/tv", UpdateTv__FP2TV); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/tv", RenderTv__FP2TV); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/tv", PreTvContext__FP3RPL); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/tv", PostTvContext__FP3RPL); 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/tv", SetTvSpeaker__FP2TVP7SPEAKER); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/tv", SetTvReplace__FP2TVP3ALO); 36 | 37 | INCLUDE_ASM("asm/nonmatchings/P2/tv", OnTvReset__FP2TV); 38 | 39 | INCLUDE_ASM("asm/nonmatchings/P2/tv", tv__static_initialization_and_destruction_0); 40 | 41 | INCLUDE_ASM("asm/nonmatchings/P2/tv", _GLOBAL_$I$RGBA_Distortion); 42 | -------------------------------------------------------------------------------- /src/P2/ub.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/ub", InitUbg__FP3UBG); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/ub", PostUbgLoad__FP3UBG); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/ub", PsoPadUbgClosest__FP3UBGP6VECTOR); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/ub", OnUbgEnteringSgs__FP3UBG3SGSP4ASEG); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/ub", SgsNextUbgAI__FP3UBG); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/ub", FDetectUbg__FP3UBG); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/ub", FCanUbgAttack__FP3UBG); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/ub", DoUbgFreefallJump__FP3UBG); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/ub", DoUbgFreefallLanding__FP3UBG); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/ub", UpdateUbgGoal__FP3UBGi); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/ub", UpdateUbgSgs__FP3UBG); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/ub", FUN_001e8fe8); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/ub", FIgnoreUbgIntersection__FP3UBGP2SO); 28 | -------------------------------------------------------------------------------- /src/P2/ui.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void StartupUi() 5 | { 6 | InitUi(&g_ui); 7 | } 8 | 9 | void InitUi(UI *pui) 10 | { 11 | pui->unk6 = -1; 12 | pui->tUis = -1; 13 | SetUiUis(pui, UIS_Pausing); 14 | pui->cpblotActive = 0; 15 | pui->unk5 = 1; 16 | } 17 | 18 | void PostUiLoad(UI *pui) 19 | { 20 | SetUiUis(pui, UIS_Pausing); 21 | } 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/ui", UpdateUi__FP2UI); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/ui", PushUiActiveBlot__FP2UIP4BLOT); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/ui", PopUiActiveBlot__FP2UI); 28 | 29 | void DrawUi() 30 | { 31 | DrawBlots(); 32 | } 33 | 34 | void RenderUi() 35 | { 36 | RenderBlots(); 37 | } 38 | 39 | void ResetUi(UI *pui) 40 | { 41 | while (pui->unk5 >= 2) 42 | { 43 | PopUiActiveBlot(pui); 44 | } 45 | 46 | pui->unk5 = 1; 47 | pui->cpblotActive = 0; 48 | pui->unk6 = -1; 49 | 50 | SetRumbleRums(g_joy.prumble, RUMS_Stop); 51 | ResetBlots(); 52 | } 53 | 54 | INCLUDE_ASM("asm/nonmatchings/P2/ui", SetUiUis__FP2UI3UIS); 55 | 56 | INCLUDE_ASM("asm/nonmatchings/P2/ui", SetUiUPause__FP2UIf); 57 | 58 | INCLUDE_ASM("asm/nonmatchings/P2/ui", FUN_001e9970__Fv); 59 | 60 | INCLUDE_ASM("asm/nonmatchings/P2/ui", FUN_001e9a10__Fv); 61 | 62 | INCLUDE_ASM("asm/nonmatchings/P2/ui", FUN_001e9a68__Fv); 63 | 64 | INCLUDE_ASM("asm/nonmatchings/P2/ui", FUN_001e9ad8__Fv); 65 | 66 | INCLUDE_ASM("asm/nonmatchings/P2/ui", check_anticrack_collectibles_Fv); 67 | -------------------------------------------------------------------------------- /src/P2/update.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/update", UpdateSwObjects__FP2SWf); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/update", UpdateSwPosWorldPrev__FP2SW); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/update", UpdateSwRealClock__FP2SWf); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/update", UpdateSwDarkening__FP2SWf); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/update", UpdateSw__FP2SWf); 12 | -------------------------------------------------------------------------------- /src/P2/vifs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", __4VIFS); 4 | 5 | JUNK_ADDIU(10); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", Align__4VIFSi); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifBaseOffset__4VIFSii); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifMscal__4VIFSPv); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifMscalf__4VIFSPv); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifFlush__4VIFS); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifFlusha__4VIFS); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifFlushe__4VIFS); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifStcycl__4VIFSii); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifStrow__4VIFSP2QW); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifStmask__4VIFSUi); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", CbUnpackSetup__4VIFS3UPKii); 28 | 29 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", UnpackHelper__4VIFS3UPKiiPiPPUi); 30 | 31 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifUnpack__4VIFS3UPKiPvi); 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifUnpackRefs__4VIFS3UPKiPviPPPv); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifDirect__4VIFSiP2QWi); 36 | 37 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifDirectRefs__4VIFSiP2QWi); 38 | 39 | INCLUDE_ASM("asm/nonmatchings/P2/vifs", AddVifGifs__4VIFSP4GIFS); 40 | -------------------------------------------------------------------------------- /src/P2/vis.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/vis", InitVismap__FP6VISMAP); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/vis", LoadVismapFromBrx__FP6VISMAPP18CBinaryInputStream); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/vis", GrfzonOneHop__FP6VISMAPP4VBSP); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/vis", ClipVbspSphereOneHop__FP6VISMAPP4VBSPG9VU_VECTORfPi); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/vis", ClipVismapSphereOneHop__FP6VISMAPP6VECTORfPi); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/vis", ClipVismapPointNoHop__FP6VISMAPP6VECTORPi); 14 | -------------------------------------------------------------------------------- /src/P2/water.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/water", InitWater__FP5WATER); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/water", PostWaterLoad__FP5WATER); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/water", CalculateWaterCurrent__FP5WATERP6VECTORN21); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/water", UpdateSwXaList__FP2SWPP2XA); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/water", UpdateWater__FP5WATERf); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/water", AddWaterExternalAccelerations__FP5WATERP2XAf); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/water", HandleWaterMessage__FP5WATER5MSGIDPv); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/water", UpdateWaterMergeGroup__FP5WATER); 18 | 19 | INCLUDE_ASM("asm/nonmatchings/P2/water", UGetWaterSubmerged__FP5WATERP2SOP6VECTORT2); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/water", UpdateWaterBounds__FP5WATER); 22 | 23 | INCLUDE_ASM("asm/nonmatchings/P2/water", FInflictWaterZap__FP5WATERP2XPP3ZPR); 24 | 25 | INCLUDE_ASM("asm/nonmatchings/P2/water", PzpdEnsureWater__FP5WATER4ENSK); 26 | 27 | INCLUDE_ASM("asm/nonmatchings/P2/water", FUN_001ef830); 28 | -------------------------------------------------------------------------------- /src/P2/wipe.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void InitWipe(WIPE *pwipe) 4 | { 5 | pwipe->wipes = WIPES_Nil; 6 | SetWipeWipes(pwipe, WIPES_Idle); 7 | } 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/wipe", UpdateWipe__FP4WIPEP3JOY); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/wipe", DrawWipe__FP4WIPE); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/wipe", ActivateWipe__FP4WIPEP5TRANS5WIPEK); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/wipe", SetWipeButtonTrans__FP4WIPEP5TRANS5WIPEK); 16 | 17 | INCLUDE_ASM("asm/nonmatchings/P2/wipe", FCatchWipeButtonTrans__FP4WIPEP3JOY5WIPES); 18 | 19 | JUNK_WORD(0x00A0102D); 20 | 21 | INCLUDE_ASM("asm/nonmatchings/P2/wipe", SetWipeWipes__FP4WIPE5WIPES); 22 | 23 | void WipeToWorldWarp(const void *pchzWorld, OID oidWarp, WIPEK wipek) 24 | { 25 | TRANS trans; 26 | trans.fSet = 1; 27 | trans.grftrans = 0; 28 | trans.pchzWorld = (LevelTableStruct *)pchzWorld; 29 | trans.oidWarp = oidWarp; 30 | ActivateWipe(&g_wipe, &trans, wipek); 31 | } 32 | -------------------------------------------------------------------------------- /src/P2/zap.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | INCLUDE_ASM("asm/nonmatchings/P2/zap", InitTzp__FP3TZP); 4 | 5 | INCLUDE_ASM("asm/nonmatchings/P2/zap", FUN_001f4f70); 6 | 7 | INCLUDE_ASM("asm/nonmatchings/P2/zap", PostTzpLoad__FP3TZP); 8 | 9 | INCLUDE_ASM("asm/nonmatchings/P2/zap", FUN_001f5008); 10 | 11 | INCLUDE_ASM("asm/nonmatchings/P2/zap", CloneTzp__FP3TZPT0eTzp); 12 | 13 | INCLUDE_ASM("asm/nonmatchings/P2/zap", FUN_001f51c8); 14 | 15 | INCLUDE_ASM("asm/nonmatchings/P2/zap", FInflictTzpZap__FP3TZPP2XPP3ZPR); 16 | 17 | /** 18 | * @todo Rename function. 19 | */ 20 | ZPD *FUN_001F5208(TZP *ptzp) 21 | { 22 | return &STRUCT_OFFSET(ptzp, 0x550, ZPD); 23 | } 24 | 25 | /** 26 | * @todo This matches but what does it actually do? 27 | */ 28 | void PzpdEnsureTzp(TZP *ptzp, ENSK ensk) 29 | { 30 | STRUCT_OFFSET(ptzp, 0x5e4, int) = 0; 31 | } 32 | 33 | INCLUDE_ASM("asm/nonmatchings/P2/zap", InitVolzp__FP5VOLZP); 34 | 35 | INCLUDE_ASM("asm/nonmatchings/P2/zap", UpdateVolzp__FP5VOLZPf); 36 | 37 | void InitZpd(ZPD *pzpd, SO *pso) 38 | { 39 | pzpd->pso = pso; 40 | pzpd->zpk = ZPK_Blunt; 41 | pzpd->dzThrow = 150.0f; 42 | } 43 | 44 | INCLUDE_ASM("asm/nonmatchings/P2/zap", PostZpdLoad__FP3ZPD); 45 | 46 | INCLUDE_ASM("asm/nonmatchings/P2/zap", ApplyZpdThrow__FP3ZPDP2PO); 47 | 48 | INCLUDE_ASM("asm/nonmatchings/P2/zap", InflictZpdZap__FP3ZPDP2XPP3ZPR); 49 | 50 | INCLUDE_ASM("asm/nonmatchings/P2/zap", FUN_001F5840); 51 | 52 | INCLUDE_ASM("asm/nonmatchings/P2/zap", AddZpdZapLo__FP3ZPDP2LO); 53 | 54 | INCLUDE_ASM("asm/nonmatchings/P2/zap", RemoveZpdZapLo__FP3ZPDP2LO); 55 | -------------------------------------------------------------------------------- /tools/codematcher/CodeMatcher.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheOnlyZac/sly1/83bca036bf791a41262a037fa8fd45edfaf2db8a/tools/codematcher/CodeMatcher.exe -------------------------------------------------------------------------------- /tools/codematcher/LICENSE.txt: -------------------------------------------------------------------------------- 1 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 | + License for CodeMatcher 3 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 | 5 | MIT License 6 | 7 | Copyright (c) 2022 felinis 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in all 17 | copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. 26 | -------------------------------------------------------------------------------- /tools/codematcher/README.md: -------------------------------------------------------------------------------- 1 | # Code Matching Guide 2 | 3 | This guide will walk you through the process of matching your code against the Sly 1 May Prototype. 4 | 5 | ## 1. Clone the repository 6 | 7 | ```sh 8 | git clone https://github.com/TheOnlyZac/sly1.git 9 | ``` 10 | 11 | ## 2. Run the setup script 12 | 13 | The setup script will download and install the compiler needed to compile the code and run CodeMatcher. 14 | 15 | ### Linux 16 | ```sh 17 | cd sly1/scripts 18 | ./setup-progd-linux.sh 19 | ``` 20 | 21 | ### Windows 22 | ```powershell 23 | cd sly1\scripts 24 | .\setup-progd-windows.bat 25 | ``` 26 | 27 | ## 3. Get the Sly 1 May Prototype ELF 28 | 29 | You will need the Sly 1 May 2002 Prototype ELF for code matching. Download and and extract the ELF to the `tools/codematcher` folder (alongside `CodeMatcher.exe`). Rename it from `SCUS971.98` to `sly_proto.elf`. 30 | 31 | ## 4. Match your code 32 | 33 | After you have written your code, you can use the scripts in the `scripts` folder to compile the code and match functions. 34 | 35 | * `match_all.sh` will compile the complete source tree and match all functions. 36 | * `match_file.sh ` will compile a single file and match all functions in that file. 37 | * `match_function_live.sh ` will compile a single file and match a single function in that file. 38 | * It will continuously dump the function bytes and print the disassembly to the console so you can compare it against the original. 39 | 40 | These scripts will only work on Linux or WSL. If you are on Windows, you will have to run CodeMatcher manually from the command line. 41 | 42 | **Good luck, and have fun!** 43 | -------------------------------------------------------------------------------- /tools/codematcher/codematcher: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheOnlyZac/sly1/83bca036bf791a41262a037fa8fd45edfaf2db8a/tools/codematcher/codematcher -------------------------------------------------------------------------------- /tools/codematcher/ghidra_tips.txt: -------------------------------------------------------------------------------- 1 | Useful tips when decompiling with Ghidra: 2 | - Never, ever use floating-point numbers without the 'f' as it will produce a code that is more than twice as bigger. 3 | (example: write 1.0f, not 1.0 like Ghidra's decompiler likes to output) -------------------------------------------------------------------------------- /tools/codematcher/match_all.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | CodeMatcher.exe sly_proto.elf -compile ../src/P2 -------------------------------------------------------------------------------- /tools/codematcher/match_single.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM use this script to quickly match one source file, just drag it on this CMD file... 3 | C:\usr\local\sce\ee\gcc\bin\ee-gcc.exe -IC:\usr\local\sce\common\include -IC:\usr\local\sce\ee\gcc\include\g++-2 -g -O2 -x c++ -c %1 -o temp\%1.o -------------------------------------------------------------------------------- /tools/objdiff/objdiff-cli: -------------------------------------------------------------------------------- 1 | objdiff-cli-linux-x86_64 -------------------------------------------------------------------------------- /tools/objdiff/objdiff-cli-linux-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheOnlyZac/sly1/83bca036bf791a41262a037fa8fd45edfaf2db8a/tools/objdiff/objdiff-cli-linux-x86_64 --------------------------------------------------------------------------------