Merge pull request #432 from DavidSM64/nov3

This commit is contained in:
David Benepe
2023-11-04 19:45:01 -05:00
committed by GitHub
11 changed files with 878 additions and 3091 deletions
+181 -181
View File
@@ -1,181 +1,181 @@
# Diddy Kong Racing
This repo contains a work-in-progress decompilation of Diddy Kong Racing for the N64. You will need to have a original copy of the ROM to extract the game's assets.
Currently, only the US 1.0 version of the game is supported. US 1.1, EU 1.0, EU 1.1, and JP are not supported at this time.
<!-- README_SCORE_SUMMARY_BEGIN -->
As of October 31, 2023, this is our current score:
&emsp;&emsp;&emsp;&emsp;Decomp progress: 63.04%
&emsp;&emsp;&emsp;&emsp;Documentation progress: 35.21%
<!-- README_SCORE_SUMMARY_END -->
---
## Dependencies
* `libcapstone-dev`
* `gcc`, Version 8.0 or higher
* `make`, Version 4.2 or higher
* `python3`
* `wget`
`sudo apt install build-essential pkg-config git python3 wget libcapstone-dev`
### binutils
You are not required to install a binutils package, but it does speed up the initial setup if you do have it installed.
* Ubuntu/Debian (x86): `sudo apt install binutils-mips-linux-gnu`
## Setup / Building
1. Install the dependencies
2. Place the ROM file within the `baseroms` directory.
**a.** The name of the ROM file does not matter, but it must end with one of these extensions: `.z64`, `.v64`, `.n64`, or `.rom`. It will be detected automatically from an md5 checksum.
**b.** If you use a byte-swapped or little-endian ROM, then it will automatically be converted to a big-endian (.z64) ROM file.
3. Run `make` in the main directory.
**a.** Use the `-jN` argument to use `N` number of threads to speed up building. For example, if you have a system with 4 cores / 4 threads, you should do `make -j4`.
### Building on MacOS
1. `brew install gcc capstone coreutils`
2. Put GNU-coreutils `bin` on path using by adding `PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"` to your shell rcfile (or update any GNU-util usage in `Makefile` and `tools/Makefile` to use the `g`-prefixed versions).
3. Download latest `macos` build of `ido-static-recomp` from [here](https://github.com/decompals/ido-static-recomp/releases/), and add `cp` the binaries to `tools/ido-static-recomp/build5.3/out`.
4. Take a look at [this gist](https://gist.github.com/tonyspumoni/fc1b4c9217c5f2821a9fc4cbf69b51ef) to see what other updates are needed to get the build to pass, and apply them if they are relevant to your environment. You may need to add specific `-I` and `-L` flags to get things like `openssl` and `gcc-12` includes/libs included.
5. `make` from repository root should work now.
## Modding
If you are modifying the code in the repo, then you should add `NON_MATCHING=1` to the make command.
Example: `make NON_MATCHING=1 -j4`
The `NON_MATCHING` define will include the functions that don't exactly match one-to-one, but should be no different functionality-wise. If you do notice any bugs that occur in a `NON_MATCHING` build that are not in the vanilla game, then please file an issue describing the bug. It would be helpful if you can track down which function is causing the bug, but that is not required.
## Style Guide
The style guide for the project can be found here: https://docs.google.com/document/d/1euQf8nwynGcCZL1MfoMaLs-XRvx3ejjj8fIfykUZ-NQ
If you see variables/functions/structs/etc. that doesn't follow these rules, then file an issue and we'll try to fix them.
## Scripts
There are some useful scripts that should be kept in mind when working on this repo.
---
#### `./extract.sh <version>`
This script will extract all the assets from a DKR ROM and place them into `/assets/` folder according to the config file within the `/extract-ver/` folder. The version parameter should either be `us_1.0`, `us_1.1`, `eu_1.0`, `eu_1.1`, or `jp`.
Example: `./extract.sh us_1.0`
---
#### `./diff.sh <function_name>`
Compares the assembly output of a function from a built ROM to the base ROM. Useful for decompiling.
Example: `./diff.sh menu_init`
---
#### `./rename.sh <old_name> <new_name>`
This script will rename an existing symbol, file name, and/or folder name within the repo with a new one.
Example: `./rename.sh D_A4001000 SP_IMEM`
---
#### `./get_symbol.sh <ram_address>|<symbol>`
Given either a RAM address or symbol, returns its `(symbol, address)` pairing as defined in `/build/us_1.0/dkr.map`. If specified, the RAM address must be in base 16. The `0x` prefix is not required.
Example:
```
./get_symbol.sh 0xA4001000
0xA4001000 = SP_IMEM
./get_symbol.sh osCicId
0x80000310 = osCicId
```
---
#### `./score.sh`
Prints out the current completion percentage of the decomp. You do need to have an `OK` build for this to work properly.
The scoring is split into 2 sections:
1. Assembly to C Decompilation (Adventure One)
2. Cleanup and Documentation (Adventure Two)
Show scores for Adventure One & Adventure Two: `./score.sh`
Show score for Adventure One only: `./score.sh -a 1`
Show score for Adventure Two only: `./score.sh -a 2`
Show top 10 files remaining: `./score.sh -t 10`
To make progress in Adventure 2, a function must be properly named (must not start with `func_`) and also include a doxygen comment above it.
For example:
```c
/**
* Returns 1 if Drumstick is avaliable to use, or 0 if not.
*/
s32 is_drumstick_unlocked(void) {
return gActiveMagicCodes & 2;
}
```
<!-- README_SCORE_BEGIN -->
As of November 2nd, 2023, this is our current score:
```
========================================================================
ADVENTURE ONE (ASM -> C Decompilation)
--------------------------- 63.04% Complete ----------------------------
# Decompiled functions: 1661
# GLOBAL_ASM remaining: 184
# NON_MATCHING functions: 14
# NON_EQUIVALENT WIP functions: 52
----------------------------- Game Status ------------------------------
Balloons: 30/47, Keys: 3/4, Trophies: 2/5
T.T. Amulets: 3/4, Wizpig Amulets: 3/4
------------------------------------------------------------------------
We are participating in the Trophy Race of Sherbet Island. (Round Three)
========================================================================
ADVENTURE TWO (Cleanup & Documentation)
--------------------------- 35.21% Complete ----------------------------
# Documented functions: 825
# Undocumented remaining: 743
----------------------------- Game Status ------------------------------
Balloons: 17/47, Keys: 2/4, Trophies: 1/5
T.T. Amulets: 2/4, Wizpig Amulets: 1/4
------------------------------------------------------------------------
We are collecting silver coins in Everfrost Peak. (2/8 silver coins)
========================================================================
```
<!-- README_SCORE_END -->
---
## TODO list
### Major
What should be focused on.
* Decompiling the non-matching asm files into matching C functions.
* Documenting variables & functions
### Minor
What can be done, but not essential.
* Figuring out the formats for the assets in the /assets/ folder.
* Creating tools to modify assets
### Future
These features won't be complete anytime soon.
* Add support for the other 4 versions.
# Diddy Kong Racing
This repo contains a work-in-progress decompilation of Diddy Kong Racing for the N64. You will need to have a original copy of the ROM to extract the game's assets.
Currently, only the US 1.0 version of the game is supported. US 1.1, EU 1.0, EU 1.1, and JP are not supported at this time.
<!-- README_SCORE_SUMMARY_BEGIN -->
As of November 4, 2023, this is our current score:
&emsp;&emsp;&emsp;&emsp;Decomp progress: 64.12%
&emsp;&emsp;&emsp;&emsp;Documentation progress: 35.21%
<!-- README_SCORE_SUMMARY_END -->
---
## Dependencies
* `libcapstone-dev`
* `gcc`, Version 8.0 or higher
* `make`, Version 4.2 or higher
* `python3`
* `wget`
`sudo apt install build-essential pkg-config git python3 wget libcapstone-dev`
### binutils
You are not required to install a binutils package, but it does speed up the initial setup if you do have it installed.
* Ubuntu/Debian (x86): `sudo apt install binutils-mips-linux-gnu`
## Setup / Building
1. Install the dependencies
2. Place the ROM file within the `baseroms` directory.
**a.** The name of the ROM file does not matter, but it must end with one of these extensions: `.z64`, `.v64`, `.n64`, or `.rom`. It will be detected automatically from an md5 checksum.
**b.** If you use a byte-swapped or little-endian ROM, then it will automatically be converted to a big-endian (.z64) ROM file.
3. Run `make` in the main directory.
**a.** Use the `-jN` argument to use `N` number of threads to speed up building. For example, if you have a system with 4 cores / 4 threads, you should do `make -j4`.
### Building on MacOS
1. `brew install gcc capstone coreutils`
2. Put GNU-coreutils `bin` on path using by adding `PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"` to your shell rcfile (or update any GNU-util usage in `Makefile` and `tools/Makefile` to use the `g`-prefixed versions).
3. Download latest `macos` build of `ido-static-recomp` from [here](https://github.com/decompals/ido-static-recomp/releases/), and add `cp` the binaries to `tools/ido-static-recomp/build5.3/out`.
4. Take a look at [this gist](https://gist.github.com/tonyspumoni/fc1b4c9217c5f2821a9fc4cbf69b51ef) to see what other updates are needed to get the build to pass, and apply them if they are relevant to your environment. You may need to add specific `-I` and `-L` flags to get things like `openssl` and `gcc-12` includes/libs included.
5. `make` from repository root should work now.
## Modding
If you are modifying the code in the repo, then you should add `NON_MATCHING=1` to the make command.
Example: `make NON_MATCHING=1 -j4`
The `NON_MATCHING` define will include the functions that don't exactly match one-to-one, but should be no different functionality-wise. If you do notice any bugs that occur in a `NON_MATCHING` build that are not in the vanilla game, then please file an issue describing the bug. It would be helpful if you can track down which function is causing the bug, but that is not required.
## Style Guide
The style guide for the project can be found here: https://docs.google.com/document/d/1euQf8nwynGcCZL1MfoMaLs-XRvx3ejjj8fIfykUZ-NQ
If you see variables/functions/structs/etc. that doesn't follow these rules, then file an issue and we'll try to fix them.
## Scripts
There are some useful scripts that should be kept in mind when working on this repo.
---
#### `./extract.sh <version>`
This script will extract all the assets from a DKR ROM and place them into `/assets/` folder according to the config file within the `/extract-ver/` folder. The version parameter should either be `us_1.0`, `us_1.1`, `eu_1.0`, `eu_1.1`, or `jp`.
Example: `./extract.sh us_1.0`
---
#### `./diff.sh <function_name>`
Compares the assembly output of a function from a built ROM to the base ROM. Useful for decompiling.
Example: `./diff.sh menu_init`
---
#### `./rename.sh <old_name> <new_name>`
This script will rename an existing symbol, file name, and/or folder name within the repo with a new one.
Example: `./rename.sh D_A4001000 SP_IMEM`
---
#### `./get_symbol.sh <ram_address>|<symbol>`
Given either a RAM address or symbol, returns its `(symbol, address)` pairing as defined in `/build/us_1.0/dkr.map`. If specified, the RAM address must be in base 16. The `0x` prefix is not required.
Example:
```
./get_symbol.sh 0xA4001000
0xA4001000 = SP_IMEM
./get_symbol.sh osCicId
0x80000310 = osCicId
```
---
#### `./score.sh`
Prints out the current completion percentage of the decomp. You do need to have an `OK` build for this to work properly.
The scoring is split into 2 sections:
1. Assembly to C Decompilation (Adventure One)
2. Cleanup and Documentation (Adventure Two)
Show scores for Adventure One & Adventure Two: `./score.sh`
Show score for Adventure One only: `./score.sh -a 1`
Show score for Adventure Two only: `./score.sh -a 2`
Show top 10 files remaining: `./score.sh -t 10`
To make progress in Adventure 2, a function must be properly named (must not start with `func_`) and also include a doxygen comment above it.
For example:
```c
/**
* Returns 1 if Drumstick is avaliable to use, or 0 if not.
*/
s32 is_drumstick_unlocked(void) {
return gActiveMagicCodes & 2;
}
```
<!-- README_SCORE_BEGIN -->
As of November 4, 2023, this is our current score:
```
====================================================================
ADVENTURE ONE (ASM -> C Decompilation)
-------------- 64.12% Complete (67.03% NON_MATCHING) ---------------
# Decompiled functions: 1665
# GLOBAL_ASM remaining: 180
# NON_MATCHING functions: 16
# NON_EQUIVALENT WIP functions: 49
--------------------------- Game Status ----------------------------
Balloons: 30/47, Keys: 3/4, Trophies: 3/5
T.T. Amulets: 3/4, Wizpig Amulets: 3/4
--------------------------------------------------------------------
We are racing Taj in the Plane Challenge. (Lap 1/3)
====================================================================
ADVENTURE TWO (Cleanup & Documentation)
------------------------- 35.21% Complete --------------------------
# Documented functions: 825
# Undocumented remaining: 743
--------------------------- Game Status ----------------------------
Balloons: 17/47, Keys: 2/4, Trophies: 1/5
T.T. Amulets: 2/4, Wizpig Amulets: 1/4
--------------------------------------------------------------------
We are collecting silver coins in Everfrost Peak. (2/8 silver coins)
====================================================================
```
<!-- README_SCORE_END -->
---
## TODO list
### Major
What should be focused on.
* Decompiling the non-matching asm files into matching C functions.
* Documenting variables & functions
### Minor
What can be done, but not essential.
* Figuring out the formats for the assets in the /assets/ folder.
* Creating tools to modify assets
### Future
These features won't be complete anytime soon.
* Add support for the other 4 versions.
-475
View File
@@ -1,475 +0,0 @@
.late_rodata
glabel jpt_800E8418
.word L80086B54, L80086CDC, L80086D54, L80086F74, L80087084, L80087110, L800871C4, L800871C4, L800871C4, L80087158
.text
glabel func_80086AFC
/* 0876FC 80086AFC 27BDFFC0 */ addiu $sp, $sp, -0x40
/* 087700 80086B00 AFBF0014 */ sw $ra, 0x14($sp)
/* 087704 80086B04 0C01BAA4 */ jal get_settings
/* 087708 80086B08 00000000 */ nop
/* 08770C 80086B0C 3C0F8012 */ lui $t7, %hi(D_80126BD4) # $t7, 0x8012
/* 087710 80086B10 8DEF6BD4 */ lw $t7, %lo(D_80126BD4)($t7)
/* 087714 80086B14 3C0E8012 */ lui $t6, %hi(D_80126A0C) # $t6, 0x8012
/* 087718 80086B18 8DCE6A0C */ lw $t6, %lo(D_80126A0C)($t6)
/* 08771C 80086B1C 000FC100 */ sll $t8, $t7, 4
/* 087720 80086B20 01D83821 */ addu $a3, $t6, $t8
/* 087724 80086B24 90F90000 */ lbu $t9, ($a3)
/* 087728 80086B28 00403025 */ move $a2, $v0
/* 08772C 80086B2C 272AFFFF */ addiu $t2, $t9, -1
/* 087730 80086B30 2D41000A */ sltiu $at, $t2, 0xa
/* 087734 80086B34 102001A3 */ beqz $at, .L800871C4
/* 087738 80086B38 000A5080 */ sll $t2, $t2, 2
/* 08773C 80086B3C 3C01800F */ lui $at, %hi(jpt_800E8418) # $at, 0x800f
/* 087740 80086B40 002A0821 */ addu $at, $at, $t2
/* 087744 80086B44 8C2A8418 */ lw $t2, %lo(jpt_800E8418)($at)
/* 087748 80086B48 00000000 */ nop
/* 08774C 80086B4C 01400008 */ jr $t2
/* 087750 80086B50 00000000 */ nop
glabel L80086B54
/* 087754 80086B54 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 087758 80086B58 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 08775C 80086B5C 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 087760 80086B60 8D2C0000 */ lw $t4, ($t1)
/* 087764 80086B64 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 087768 80086B68 8D0B0000 */ lw $t3, ($t0)
/* 08776C 80086B6C 000C6900 */ sll $t5, $t4, 4
/* 087770 80086B70 016D1821 */ addu $v1, $t3, $t5
/* 087774 80086B74 90620000 */ lbu $v0, ($v1)
/* 087778 80086B78 24010001 */ li $at, 1
/* 08777C 80086B7C 10410007 */ beq $v0, $at, .L80086B9C
/* 087780 80086B80 24010007 */ li $at, 7
/* 087784 80086B84 10410043 */ beq $v0, $at, .L80086C94
/* 087788 80086B88 24010008 */ li $at, 8
/* 08778C 80086B8C 1041003C */ beq $v0, $at, .L80086C80
/* 087790 80086B90 00000000 */ nop
/* 087794 80086B94 1000018D */ b .L800871CC
/* 087798 80086B98 8FBF0014 */ lw $ra, 0x14($sp)
.L80086B9C:
/* 08779C 80086B9C 90640006 */ lbu $a0, 6($v1)
/* 0877A0 80086BA0 0C01BB06 */ jal force_mark_write_save_file
/* 0877A4 80086BA4 AFA60028 */ sw $a2, 0x28($sp)
/* 0877A8 80086BA8 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 0877AC 80086BAC 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 0877B0 80086BB0 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 0877B4 80086BB4 8D380000 */ lw $t8, ($t1)
/* 0877B8 80086BB8 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 0877BC 80086BBC 8D0E0000 */ lw $t6, ($t0)
/* 0877C0 80086BC0 0018C900 */ sll $t9, $t8, 4
/* 0877C4 80086BC4 01D95021 */ addu $t2, $t6, $t9
/* 0877C8 80086BC8 914C0006 */ lbu $t4, 6($t2)
/* 0877CC 80086BCC 3C038012 */ lui $v1, %hi(gSavefileData) # $v1, 0x8012
/* 0877D0 80086BD0 8FA60028 */ lw $a2, 0x28($sp)
/* 0877D4 80086BD4 24636530 */ addiu $v1, %lo(gSavefileData) # addiu $v1, $v1, 0x6530
/* 0877D8 80086BD8 000C5880 */ sll $t3, $t4, 2
/* 0877DC 80086BDC 006B6821 */ addu $t5, $v1, $t3
/* 0877E0 80086BE0 8DB80000 */ lw $t8, ($t5)
/* 0877E4 80086BE4 8CCF0010 */ lw $t7, 0x10($a2)
/* 0877E8 80086BE8 00000000 */ nop
/* 0877EC 80086BEC AF0F0010 */ sw $t7, 0x10($t8)
/* 0877F0 80086BF0 8D390000 */ lw $t9, ($t1)
/* 0877F4 80086BF4 8D0E0000 */ lw $t6, ($t0)
/* 0877F8 80086BF8 00195100 */ sll $t2, $t9, 4
/* 0877FC 80086BFC 01CA6021 */ addu $t4, $t6, $t2
/* 087800 80086C00 918B0006 */ lbu $t3, 6($t4)
/* 087804 80086C04 00000000 */ nop
/* 087808 80086C08 000B6880 */ sll $t5, $t3, 2
/* 08780C 80086C0C 006D7821 */ addu $t7, $v1, $t5
/* 087810 80086C10 8DF80000 */ lw $t8, ($t7)
/* 087814 80086C14 00000000 */ nop
/* 087818 80086C18 A300004B */ sb $zero, 0x4b($t8)
/* 08781C 80086C1C 8D2C0000 */ lw $t4, ($t1)
/* 087820 80086C20 8D0A0000 */ lw $t2, ($t0)
/* 087824 80086C24 000C5900 */ sll $t3, $t4, 4
/* 087828 80086C28 014B6821 */ addu $t5, $t2, $t3
/* 08782C 80086C2C 91AF0006 */ lbu $t7, 6($t5)
/* 087830 80086C30 8CD90000 */ lw $t9, ($a2)
/* 087834 80086C34 000FC080 */ sll $t8, $t7, 2
/* 087838 80086C38 872E0000 */ lh $t6, ($t9)
/* 08783C 80086C3C 0078C821 */ addu $t9, $v1, $t8
/* 087840 80086C40 8F2C0000 */ lw $t4, ($t9)
/* 087844 80086C44 00000000 */ nop
/* 087848 80086C48 8D8A0000 */ lw $t2, ($t4)
/* 08784C 80086C4C 00000000 */ nop
/* 087850 80086C50 A54E0000 */ sh $t6, ($t2)
/* 087854 80086C54 8D2F0000 */ lw $t7, ($t1)
/* 087858 80086C58 8D0D0000 */ lw $t5, ($t0)
/* 08785C 80086C5C 000FC100 */ sll $t8, $t7, 4
/* 087860 80086C60 01B8C821 */ addu $t9, $t5, $t8
/* 087864 80086C64 932C0006 */ lbu $t4, 6($t9)
/* 087868 80086C68 8CCB0050 */ lw $t3, 0x50($a2)
/* 08786C 80086C6C 000C7080 */ sll $t6, $t4, 2
/* 087870 80086C70 006E5021 */ addu $t2, $v1, $t6
/* 087874 80086C74 8D4F0000 */ lw $t7, ($t2)
/* 087878 80086C78 10000153 */ b .L800871C8
/* 08787C 80086C7C ADEB0050 */ sw $t3, 0x50($t7)
.L80086C80:
/* 087880 80086C80 90640006 */ lbu $a0, 6($v1)
/* 087884 80086C84 0C01CFD7 */ jal write_game_data_to_controller_pak
/* 087888 80086C88 00C02825 */ move $a1, $a2
/* 08788C 80086C8C 1000014E */ b .L800871C8
/* 087890 80086C90 AFA20038 */ sw $v0, 0x38($sp)
.L80086C94:
/* 087894 80086C94 90E40006 */ lbu $a0, 6($a3)
/* 087898 80086C98 0C01BB2B */ jal mark_save_file_to_erase
/* 08789C 80086C9C 00000000 */ nop
/* 0878A0 80086CA0 3C198012 */ lui $t9, %hi(D_80126BD4) # $t9, 0x8012
/* 0878A4 80086CA4 8F396BD4 */ lw $t9, %lo(D_80126BD4)($t9)
/* 0878A8 80086CA8 3C188012 */ lui $t8, %hi(D_80126A0C) # $t8, 0x8012
/* 0878AC 80086CAC 8F186A0C */ lw $t8, %lo(D_80126A0C)($t8)
/* 0878B0 80086CB0 00196100 */ sll $t4, $t9, 4
/* 0878B4 80086CB4 030C7021 */ addu $t6, $t8, $t4
/* 0878B8 80086CB8 91CA0006 */ lbu $t2, 6($t6)
/* 0878BC 80086CBC 3C038012 */ lui $v1, %hi(gSavefileData) # $v1, 0x8012
/* 0878C0 80086CC0 24636530 */ addiu $v1, %lo(gSavefileData) # addiu $v1, $v1, 0x6530
/* 0878C4 80086CC4 000A5880 */ sll $t3, $t2, 2
/* 0878C8 80086CC8 006B7821 */ addu $t7, $v1, $t3
/* 0878CC 80086CCC 8DF90000 */ lw $t9, ($t7)
/* 0878D0 80086CD0 240D0001 */ li $t5, 1
/* 0878D4 80086CD4 1000013C */ b .L800871C8
/* 0878D8 80086CD8 A32D004B */ sb $t5, 0x4b($t9)
glabel L80086CDC
/* 0878DC 80086CDC 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 0878E0 80086CE0 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 0878E4 80086CE4 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 0878E8 80086CE8 8D2C0000 */ lw $t4, ($t1)
/* 0878EC 80086CEC 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 0878F0 80086CF0 8D180000 */ lw $t8, ($t0)
/* 0878F4 80086CF4 000C7100 */ sll $t6, $t4, 4
/* 0878F8 80086CF8 030E1821 */ addu $v1, $t8, $t6
/* 0878FC 80086CFC 90620000 */ lbu $v0, ($v1)
/* 087900 80086D00 24010007 */ li $at, 7
/* 087904 80086D04 10410009 */ beq $v0, $at, .L80086D2C
/* 087908 80086D08 00C02025 */ move $a0, $a2
/* 08790C 80086D0C 24010008 */ li $at, 8
/* 087910 80086D10 1441012E */ bne $v0, $at, .L800871CC
/* 087914 80086D14 8FBF0014 */ lw $ra, 0x14($sp)
/* 087918 80086D18 90640006 */ lbu $a0, 6($v1)
/* 08791C 80086D1C 0C01D052 */ jal write_time_data_to_controller_pak
/* 087920 80086D20 00C02825 */ move $a1, $a2
/* 087924 80086D24 10000128 */ b .L800871C8
/* 087928 80086D28 AFA20038 */ sw $v0, 0x38($sp)
.L80086D2C:
/* 08792C 80086D2C 0C01B9DC */ jal clear_lap_records
/* 087930 80086D30 24050003 */ li $a1, 3
/* 087934 80086D34 0C01BAFF */ jal mark_to_write_flap_and_course_times
/* 087938 80086D38 00000000 */ nop
/* 08793C 80086D3C 3C0500FF */ lui $a1, (0x00FFFFF0 >> 16) # lui $a1, 0xff
/* 087940 80086D40 34A5FFF0 */ ori $a1, (0x00FFFFF0 & 0xFFFF) # ori $a1, $a1, 0xfff0
/* 087944 80086D44 0C027AAF */ jal unset_eeprom_settings_value
/* 087948 80086D48 24040000 */ li $a0, 0
/* 08794C 80086D4C 1000011F */ b .L800871CC
/* 087950 80086D50 8FBF0014 */ lw $ra, 0x14($sp)
glabel L80086D54
/* 087954 80086D54 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 087958 80086D58 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 08795C 80086D5C 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 087960 80086D60 8D2B0000 */ lw $t3, ($t1)
/* 087964 80086D64 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 087968 80086D68 8D0A0000 */ lw $t2, ($t0)
/* 08796C 80086D6C 000B7900 */ sll $t7, $t3, 4
/* 087970 80086D70 014F6821 */ addu $t5, $t2, $t7
/* 087974 80086D74 91A20000 */ lbu $v0, ($t5)
/* 087978 80086D78 24010001 */ li $at, 1
/* 08797C 80086D7C 10410007 */ beq $v0, $at, .L80086D9C
/* 087980 80086D80 24010007 */ li $at, 7
/* 087984 80086D84 10410075 */ beq $v0, $at, .L80086F5C
/* 087988 80086D88 24010008 */ li $at, 8
/* 08798C 80086D8C 1041005B */ beq $v0, $at, .L80086EFC
/* 087990 80086D90 3C038012 */ lui $v1, %hi(gSavefileData) # $v1, 0x8012
/* 087994 80086D94 1000010D */ b .L800871CC
/* 087998 80086D98 8FBF0014 */ lw $ra, 0x14($sp)
.L80086D9C:
/* 08799C 80086D9C 90E40006 */ lbu $a0, 6($a3)
/* 0879A0 80086DA0 8CE50008 */ lw $a1, 8($a3)
/* 0879A4 80086DA4 0C01CF87 */ jal read_game_data_from_controller_pak
/* 0879A8 80086DA8 AFA60028 */ sw $a2, 0x28($sp)
/* 0879AC 80086DAC 8FA60028 */ lw $a2, 0x28($sp)
/* 0879B0 80086DB0 AFA20038 */ sw $v0, 0x38($sp)
/* 0879B4 80086DB4 8CD90010 */ lw $t9, 0x10($a2)
/* 0879B8 80086DB8 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 0879BC 80086DBC 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 0879C0 80086DC0 332C0004 */ andi $t4, $t9, 4
/* 0879C4 80086DC4 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 0879C8 80086DC8 1180000B */ beqz $t4, .L80086DF8
/* 0879CC 80086DCC 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 0879D0 80086DD0 0C027B18 */ jal is_adventure_two_unlocked
/* 0879D4 80086DD4 AFA60028 */ sw $a2, 0x28($sp)
/* 0879D8 80086DD8 8FA60028 */ lw $a2, 0x28($sp)
/* 0879DC 80086DDC 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 0879E0 80086DE0 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 0879E4 80086DE4 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 0879E8 80086DE8 14400003 */ bnez $v0, .L80086DF8
/* 0879EC 80086DEC 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 0879F0 80086DF0 2418000A */ li $t8, 10
/* 0879F4 80086DF4 AFB80038 */ sw $t8, 0x38($sp)
.L80086DF8:
/* 0879F8 80086DF8 8FAE0038 */ lw $t6, 0x38($sp)
/* 0879FC 80086DFC 00000000 */ nop
/* 087A00 80086E00 15C000F2 */ bnez $t6, .L800871CC
/* 087A04 80086E04 8FBF0014 */ lw $ra, 0x14($sp)
/* 087A08 80086E08 8D2A0000 */ lw $t2, ($t1)
/* 087A0C 80086E0C 8D0B0000 */ lw $t3, ($t0)
/* 087A10 80086E10 000A7900 */ sll $t7, $t2, 4
/* 087A14 80086E14 016F6821 */ addu $t5, $t3, $t7
/* 087A18 80086E18 91A40006 */ lbu $a0, 6($t5)
/* 087A1C 80086E1C 0C01BB06 */ jal force_mark_write_save_file
/* 087A20 80086E20 AFA60028 */ sw $a2, 0x28($sp)
/* 087A24 80086E24 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 087A28 80086E28 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 087A2C 80086E2C 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 087A30 80086E30 8D380000 */ lw $t8, ($t1)
/* 087A34 80086E34 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 087A38 80086E38 8D0C0000 */ lw $t4, ($t0)
/* 087A3C 80086E3C 00187100 */ sll $t6, $t8, 4
/* 087A40 80086E40 018E5021 */ addu $t2, $t4, $t6
/* 087A44 80086E44 914B0006 */ lbu $t3, 6($t2)
/* 087A48 80086E48 3C038012 */ lui $v1, %hi(gSavefileData) # $v1, 0x8012
/* 087A4C 80086E4C 8FA60028 */ lw $a2, 0x28($sp)
/* 087A50 80086E50 24636530 */ addiu $v1, %lo(gSavefileData) # addiu $v1, $v1, 0x6530
/* 087A54 80086E54 000B7880 */ sll $t7, $t3, 2
/* 087A58 80086E58 006F6821 */ addu $t5, $v1, $t7
/* 087A5C 80086E5C 8DB80000 */ lw $t8, ($t5)
/* 087A60 80086E60 8CD90010 */ lw $t9, 0x10($a2)
/* 087A64 80086E64 00000000 */ nop
/* 087A68 80086E68 AF190010 */ sw $t9, 0x10($t8)
/* 087A6C 80086E6C 8D2E0000 */ lw $t6, ($t1)
/* 087A70 80086E70 8D0C0000 */ lw $t4, ($t0)
/* 087A74 80086E74 000E5100 */ sll $t2, $t6, 4
/* 087A78 80086E78 018A5821 */ addu $t3, $t4, $t2
/* 087A7C 80086E7C 916F0006 */ lbu $t7, 6($t3)
/* 087A80 80086E80 00000000 */ nop
/* 087A84 80086E84 000F6880 */ sll $t5, $t7, 2
/* 087A88 80086E88 006DC821 */ addu $t9, $v1, $t5
/* 087A8C 80086E8C 8F380000 */ lw $t8, ($t9)
/* 087A90 80086E90 00000000 */ nop
/* 087A94 80086E94 A300004B */ sb $zero, 0x4b($t8)
/* 087A98 80086E98 8D2B0000 */ lw $t3, ($t1)
/* 087A9C 80086E9C 8D0A0000 */ lw $t2, ($t0)
/* 087AA0 80086EA0 000B7900 */ sll $t7, $t3, 4
/* 087AA4 80086EA4 014F6821 */ addu $t5, $t2, $t7
/* 087AA8 80086EA8 91B90006 */ lbu $t9, 6($t5)
/* 087AAC 80086EAC 8CCE0000 */ lw $t6, ($a2)
/* 087AB0 80086EB0 0019C080 */ sll $t8, $t9, 2
/* 087AB4 80086EB4 85CC0000 */ lh $t4, ($t6)
/* 087AB8 80086EB8 00787021 */ addu $t6, $v1, $t8
/* 087ABC 80086EBC 8DCB0000 */ lw $t3, ($t6)
/* 087AC0 80086EC0 00000000 */ nop
/* 087AC4 80086EC4 8D6A0000 */ lw $t2, ($t3)
/* 087AC8 80086EC8 00000000 */ nop
/* 087ACC 80086ECC A54C0000 */ sh $t4, ($t2)
/* 087AD0 80086ED0 8D390000 */ lw $t9, ($t1)
/* 087AD4 80086ED4 8D0D0000 */ lw $t5, ($t0)
/* 087AD8 80086ED8 0019C100 */ sll $t8, $t9, 4
/* 087ADC 80086EDC 01B87021 */ addu $t6, $t5, $t8
/* 087AE0 80086EE0 91CB0006 */ lbu $t3, 6($t6)
/* 087AE4 80086EE4 8CCF0050 */ lw $t7, 0x50($a2)
/* 087AE8 80086EE8 000B6080 */ sll $t4, $t3, 2
/* 087AEC 80086EEC 006C5021 */ addu $t2, $v1, $t4
/* 087AF0 80086EF0 8D590000 */ lw $t9, ($t2)
/* 087AF4 80086EF4 100000B4 */ b .L800871C8
/* 087AF8 80086EF8 AF2F0050 */ sw $t7, 0x50($t9)
.L80086EFC:
/* 087AFC 80086EFC 24636530 */ addiu $v1, %lo(gSavefileData) # addiu $v1, $v1, 0x6530
/* 087B00 80086F00 8C66000C */ lw $a2, 0xc($v1)
/* 087B04 80086F04 90E40006 */ lbu $a0, 6($a3)
/* 087B08 80086F08 8CE50008 */ lw $a1, 8($a3)
/* 087B0C 80086F0C 0C01CF87 */ jal read_game_data_from_controller_pak
/* 087B10 80086F10 00000000 */ nop
/* 087B14 80086F14 3C038012 */ lui $v1, %hi(gSavefileData) # $v1, 0x8012
/* 087B18 80086F18 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 087B1C 80086F1C 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 087B20 80086F20 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 087B24 80086F24 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 087B28 80086F28 24636530 */ addiu $v1, %lo(gSavefileData) # addiu $v1, $v1, 0x6530
/* 087B2C 80086F2C 144000A6 */ bnez $v0, .L800871C8
/* 087B30 80086F30 AFA20038 */ sw $v0, 0x38($sp)
/* 087B34 80086F34 8D380000 */ lw $t8, ($t1)
/* 087B38 80086F38 8D0D0000 */ lw $t5, ($t0)
/* 087B3C 80086F3C 00187100 */ sll $t6, $t8, 4
/* 087B40 80086F40 01AE5821 */ addu $t3, $t5, $t6
/* 087B44 80086F44 91640006 */ lbu $a0, 6($t3)
/* 087B48 80086F48 8C65000C */ lw $a1, 0xc($v1)
/* 087B4C 80086F4C 0C01CFD7 */ jal write_game_data_to_controller_pak
/* 087B50 80086F50 00000000 */ nop
/* 087B54 80086F54 1000009C */ b .L800871C8
/* 087B58 80086F58 AFA20038 */ sw $v0, 0x38($sp)
.L80086F5C:
/* 087B5C 80086F5C 90E40006 */ lbu $a0, 6($a3)
/* 087B60 80086F60 90E50007 */ lbu $a1, 7($a3)
/* 087B64 80086F64 0C01D8B2 */ jal delete_file
/* 087B68 80086F68 00000000 */ nop
/* 087B6C 80086F6C 10000096 */ b .L800871C8
/* 087B70 80086F70 AFA20038 */ sw $v0, 0x38($sp)
glabel L80086F74
/* 087B74 80086F74 8CE40008 */ lw $a0, 8($a3)
/* 087B78 80086F78 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 087B7C 80086F7C 908C0000 */ lbu $t4, ($a0)
/* 087B80 80086F80 00001825 */ move $v1, $zero
/* 087B84 80086F84 11800006 */ beqz $t4, .L80086FA0
/* 087B88 80086F88 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 087B8C 80086F8C 00801025 */ move $v0, $a0
.L80086F90:
/* 087B90 80086F90 904A0001 */ lbu $t2, 1($v0)
/* 087B94 80086F94 24630001 */ addiu $v1, $v1, 1
/* 087B98 80086F98 1540FFFD */ bnez $t2, .L80086F90
/* 087B9C 80086F9C 24420001 */ addiu $v0, $v0, 1
.L80086FA0:
/* 087BA0 80086FA0 18600005 */ blez $v1, .L80086FB8
/* 087BA4 80086FA4 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 087BA8 80086FA8 00837821 */ addu $t7, $a0, $v1
/* 087BAC 80086FAC 91F9FFFF */ lbu $t9, -1($t7)
/* 087BB0 80086FB0 10000003 */ b .L80086FC0
/* 087BB4 80086FB4 A3B9002C */ sb $t9, 0x2c($sp)
.L80086FB8:
/* 087BB8 80086FB8 24180041 */ li $t8, 65
/* 087BBC 80086FBC A3B8002C */ sb $t8, 0x2c($sp)
.L80086FC0:
/* 087BC0 80086FC0 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 087BC4 80086FC4 8D2E0000 */ lw $t6, ($t1)
/* 087BC8 80086FC8 8D0D0000 */ lw $t5, ($t0)
/* 087BCC 80086FCC 000E5900 */ sll $t3, $t6, 4
/* 087BD0 80086FD0 A3A0002D */ sb $zero, 0x2d($sp)
/* 087BD4 80086FD4 01AB6021 */ addu $t4, $t5, $t3
/* 087BD8 80086FD8 91820000 */ lbu $v0, ($t4)
/* 087BDC 80086FDC 24010002 */ li $at, 2
/* 087BE0 80086FE0 10410007 */ beq $v0, $at, .L80087000
/* 087BE4 80086FE4 24010007 */ li $at, 7
/* 087BE8 80086FE8 10410020 */ beq $v0, $at, .L8008706C
/* 087BEC 80086FEC 24010008 */ li $at, 8
/* 087BF0 80086FF0 10410008 */ beq $v0, $at, .L80087014
/* 087BF4 80086FF4 27A5002C */ addiu $a1, $sp, 0x2c
/* 087BF8 80086FF8 10000074 */ b .L800871CC
/* 087BFC 80086FFC 8FBF0014 */ lw $ra, 0x14($sp)
.L80087000:
/* 087C00 80087000 90E40006 */ lbu $a0, 6($a3)
/* 087C04 80087004 0C01D006 */ jal read_time_data_from_controller_pak
/* 087C08 80087008 27A5002C */ addiu $a1, $sp, 0x2c
/* 087C0C 8008700C 1000006E */ b .L800871C8
/* 087C10 80087010 AFA20038 */ sw $v0, 0x38($sp)
.L80087014:
/* 087C14 80087014 90E40006 */ lbu $a0, 6($a3)
/* 087C18 80087018 0C01D006 */ jal read_time_data_from_controller_pak
/* 087C1C 8008701C AFA60028 */ sw $a2, 0x28($sp)
/* 087C20 80087020 8FA60028 */ lw $a2, 0x28($sp)
/* 087C24 80087024 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 087C28 80087028 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 087C2C 8008702C 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 087C30 80087030 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 087C34 80087034 14400009 */ bnez $v0, .L8008705C
/* 087C38 80087038 AFA20038 */ sw $v0, 0x38($sp)
/* 087C3C 8008703C 8D2F0000 */ lw $t7, ($t1)
/* 087C40 80087040 8D0A0000 */ lw $t2, ($t0)
/* 087C44 80087044 000FC900 */ sll $t9, $t7, 4
/* 087C48 80087048 0159C021 */ addu $t8, $t2, $t9
/* 087C4C 8008704C 93040006 */ lbu $a0, 6($t8)
/* 087C50 80087050 0C01D052 */ jal write_time_data_to_controller_pak
/* 087C54 80087054 00C02825 */ move $a1, $a2
/* 087C58 80087058 AFA20038 */ sw $v0, 0x38($sp)
.L8008705C:
/* 087C5C 8008705C 0C01BAD7 */ jal mark_to_read_flap_and_course_times
/* 087C60 80087060 00000000 */ nop
/* 087C64 80087064 10000059 */ b .L800871CC
/* 087C68 80087068 8FBF0014 */ lw $ra, 0x14($sp)
.L8008706C:
/* 087C6C 8008706C 90E40006 */ lbu $a0, 6($a3)
/* 087C70 80087070 90E50007 */ lbu $a1, 7($a3)
/* 087C74 80087074 0C01D8B2 */ jal delete_file
/* 087C78 80087078 00000000 */ nop
/* 087C7C 8008707C 10000052 */ b .L800871C8
/* 087C80 80087080 AFA20038 */ sw $v0, 0x38($sp)
glabel L80087084
/* 087C84 80087084 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 087C88 80087088 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 087C8C 8008708C 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 087C90 80087090 8D2D0000 */ lw $t5, ($t1)
/* 087C94 80087094 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 087C98 80087098 8D0E0000 */ lw $t6, ($t0)
/* 087C9C 8008709C 000D5900 */ sll $t3, $t5, 4
/* 087CA0 800870A0 01CB1821 */ addu $v1, $t6, $t3
/* 087CA4 800870A4 90620000 */ lbu $v0, ($v1)
/* 087CA8 800870A8 24010007 */ li $at, 7
/* 087CAC 800870AC 10410012 */ beq $v0, $at, .L800870F8
/* 087CB0 800870B0 24010008 */ li $at, 8
/* 087CB4 800870B4 10410009 */ beq $v0, $at, .L800870DC
/* 087CB8 800870B8 24010009 */ li $at, 9
/* 087CBC 800870BC 14410042 */ bne $v0, $at, .L800871C8
/* 087CC0 800870C0 240C0001 */ li $t4, 1
/* 087CC4 800870C4 3C01800E */ lui $at, %hi(gMenuDelay) # $at, 0x800e
/* 087CC8 800870C8 AC2CF47C */ sw $t4, %lo(gMenuDelay)($at)
/* 087CCC 800870CC 90EF0006 */ lbu $t7, 6($a3)
/* 087CD0 800870D0 3C018012 */ lui $at, %hi(D_801264D0) # $at, 0x8012
/* 087CD4 800870D4 1000003C */ b .L800871C8
/* 087CD8 800870D8 AC2F64D0 */ sw $t7, %lo(D_801264D0)($at)
.L800870DC:
/* 087CDC 800870DC 90E40006 */ lbu $a0, 6($a3)
/* 087CE0 800870E0 90E50007 */ lbu $a1, 7($a3)
/* 087CE4 800870E4 90660006 */ lbu $a2, 6($v1)
/* 087CE8 800870E8 0C01D8E2 */ jal copy_controller_pak_data
/* 087CEC 800870EC 00000000 */ nop
/* 087CF0 800870F0 10000035 */ b .L800871C8
/* 087CF4 800870F4 AFA20038 */ sw $v0, 0x38($sp)
.L800870F8:
/* 087CF8 800870F8 90E40006 */ lbu $a0, 6($a3)
/* 087CFC 800870FC 90E50007 */ lbu $a1, 7($a3)
/* 087D00 80087100 0C01D8B2 */ jal delete_file
/* 087D04 80087104 00000000 */ nop
/* 087D08 80087108 1000002F */ b .L800871C8
/* 087D0C 8008710C AFA20038 */ sw $v0, 0x38($sp)
glabel L80087110
/* 087D10 80087110 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 087D14 80087114 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 087D18 80087118 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 087D1C 8008711C 8D390000 */ lw $t9, ($t1)
/* 087D20 80087120 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 087D24 80087124 8D0A0000 */ lw $t2, ($t0)
/* 087D28 80087128 0019C100 */ sll $t8, $t9, 4
/* 087D2C 8008712C 01586821 */ addu $t5, $t2, $t8
/* 087D30 80087130 91AE0000 */ lbu $t6, ($t5)
/* 087D34 80087134 24010007 */ li $at, 7
/* 087D38 80087138 15C10024 */ bne $t6, $at, .L800871CC
/* 087D3C 8008713C 8FBF0014 */ lw $ra, 0x14($sp)
/* 087D40 80087140 90E40006 */ lbu $a0, 6($a3)
/* 087D44 80087144 90E50007 */ lbu $a1, 7($a3)
/* 087D48 80087148 0C01D8B2 */ jal delete_file
/* 087D4C 8008714C 00000000 */ nop
/* 087D50 80087150 1000001D */ b .L800871C8
/* 087D54 80087154 AFA20038 */ sw $v0, 0x38($sp)
glabel L80087158
/* 087D58 80087158 3C098012 */ lui $t1, %hi(D_80126BE4) # $t1, 0x8012
/* 087D5C 8008715C 25296BE4 */ addiu $t1, %lo(D_80126BE4) # addiu $t1, $t1, 0x6be4
/* 087D60 80087160 3C088012 */ lui $t0, %hi(D_80126A04) # $t0, 0x8012
/* 087D64 80087164 8D2C0000 */ lw $t4, ($t1)
/* 087D68 80087168 25086A04 */ addiu $t0, %lo(D_80126A04) # addiu $t0, $t0, 0x6a04
/* 087D6C 8008716C 8D0B0000 */ lw $t3, ($t0)
/* 087D70 80087170 000C7900 */ sll $t7, $t4, 4
/* 087D74 80087174 016FC821 */ addu $t9, $t3, $t7
/* 087D78 80087178 932A0000 */ lbu $t2, ($t9)
/* 087D7C 8008717C 24010007 */ li $at, 7
/* 087D80 80087180 15410011 */ bne $t2, $at, .L800871C8
/* 087D84 80087184 24040000 */ li $a0, 0
/* 087D88 80087188 3C0500FF */ lui $a1, (0x00FFFFF3 >> 16) # lui $a1, 0xff
/* 087D8C 8008718C 0C027AAF */ jal unset_eeprom_settings_value
/* 087D90 80087190 34A5FFF3 */ ori $a1, (0x00FFFFF3 & 0xFFFF) # ori $a1, $a1, 0xfff3
/* 087D94 80087194 3C03800E */ lui $v1, %hi(gActiveMagicCodes) # $v1, 0x800e
/* 087D98 80087198 3C05800E */ lui $a1, %hi(gUnlockedMagicCodes) # $a1, 0x800e
/* 087D9C 8008719C 24A5FD9C */ addiu $a1, %lo(gUnlockedMagicCodes) # addiu $a1, $a1, -0x264
/* 087DA0 800871A0 2463FD98 */ addiu $v1, %lo(gActiveMagicCodes) # addiu $v1, $v1, -0x268
/* 087DA4 800871A4 8C780000 */ lw $t8, ($v1)
/* 087DA8 800871A8 8CAE0000 */ lw $t6, ($a1)
/* 087DAC 800871AC 2404FFFC */ li $a0, -4
/* 087DB0 800871B0 03046824 */ and $t5, $t8, $a0
/* 087DB4 800871B4 01C46024 */ and $t4, $t6, $a0
/* 087DB8 800871B8 AC6D0000 */ sw $t5, ($v1)
/* 087DBC 800871BC 10000002 */ b .L800871C8
/* 087DC0 800871C0 ACAC0000 */ sw $t4, ($a1)
.L800871C4:
glabel L800871C4
/* 087DC4 800871C4 AFA00038 */ sw $zero, 0x38($sp)
.L800871C8:
/* 087DC8 800871C8 8FBF0014 */ lw $ra, 0x14($sp)
.L800871CC:
/* 087DCC 800871CC 8FA20038 */ lw $v0, 0x38($sp)
/* 087DD0 800871D0 03E00008 */ jr $ra
/* 087DD4 800871D4 27BD0040 */ addiu $sp, $sp, 0x40
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,178 +0,0 @@
.late_rodata
glabel D_800E6218
.float 0.01
.text
glabel obj_init_butterfly
/* 0415C8 800409C8 AFA50004 */ sw $a1, 4($sp)
/* 0415CC 800409CC 8C820064 */ lw $v0, 0x64($a0)
/* 0415D0 800409D0 14C0003B */ bnez $a2, .L80040AC0
/* 0415D4 800409D4 240E0180 */ li $t6, 384
/* 0415D8 800409D8 44800000 */ mtc1 $zero, $f0
/* 0415DC 800409DC 3C06800E */ lui $a2, %hi(D_800DCAA8) # $a2, 0x800e
/* 0415E0 800409E0 E4800020 */ swc1 $f0, 0x20($a0)
/* 0415E4 800409E4 3C03800E */ lui $v1, %hi(D_800DCB28) # $v1, 0x800e
/* 0415E8 800409E8 A04000FE */ sb $zero, 0xfe($v0)
/* 0415EC 800409EC AC400100 */ sw $zero, 0x100($v0)
/* 0415F0 800409F0 A4400104 */ sh $zero, 0x104($v0)
/* 0415F4 800409F4 A04000FD */ sb $zero, 0xfd($v0)
/* 0415F8 800409F8 A44E0106 */ sh $t6, 0x106($v0)
/* 0415FC 800409FC 2463CB28 */ addiu $v1, %lo(D_800DCB28) # addiu $v1, $v1, -0x34d8
/* 041600 80040A00 24C6CAA8 */ addiu $a2, %lo(D_800DCAA8) # addiu $a2, $a2, -0x3558
/* 041604 80040A04 00402825 */ move $a1, $v0
/* 041608 80040A08 E4400108 */ swc1 $f0, 0x108($v0)
.L80040A0C:
/* 04160C 80040A0C 90CF0000 */ lbu $t7, ($a2)
/* 041610 80040A10 24C60010 */ addiu $a2, $a2, 0x10
/* 041614 80040A14 A0AF0000 */ sb $t7, ($a1)
/* 041618 80040A18 90D8FFF1 */ lbu $t8, -0xf($a2)
/* 04161C 80040A1C 00C3082B */ sltu $at, $a2, $v1
/* 041620 80040A20 A0B80001 */ sb $t8, 1($a1)
/* 041624 80040A24 90D9FFF2 */ lbu $t9, -0xe($a2)
/* 041628 80040A28 24A50010 */ addiu $a1, $a1, 0x10
/* 04162C 80040A2C A0B9FFF2 */ sb $t9, -0xe($a1)
/* 041630 80040A30 90C9FFF3 */ lbu $t1, -0xd($a2)
/* 041634 80040A34 1420FFF5 */ bnez $at, .L80040A0C
/* 041638 80040A38 A0A9FFF3 */ sb $t1, -0xd($a1)
/* 04163C 80040A3C 3C06800E */ lui $a2, %hi(D_800DCB28) # $a2, 0x800e
/* 041640 80040A40 24C6CB28 */ addiu $a2, %lo(D_800DCB28) # addiu $a2, $a2, -0x34d8
/* 041644 80040A44 00001825 */ move $v1, $zero
/* 041648 80040A48 00402825 */ move $a1, $v0
/* 04164C 80040A4C 24080006 */ li $t0, 6
/* 041650 80040A50 240700FF */ li $a3, 255
.L80040A54:
/* 041654 80040A54 84CA0000 */ lh $t2, ($a2)
/* 041658 80040A58 24630001 */ addiu $v1, $v1, 1
/* 04165C 80040A5C A4AA0080 */ sh $t2, 0x80($a1)
/* 041660 80040A60 84CB0002 */ lh $t3, 2($a2)
/* 041664 80040A64 24A5000A */ addiu $a1, $a1, 0xa
/* 041668 80040A68 A4AB0078 */ sh $t3, 0x78($a1)
/* 04166C 80040A6C 84CC0004 */ lh $t4, 4($a2)
/* 041670 80040A70 A0A7007C */ sb $a3, 0x7c($a1)
/* 041674 80040A74 A0A7007D */ sb $a3, 0x7d($a1)
/* 041678 80040A78 A0A7007E */ sb $a3, 0x7e($a1)
/* 04167C 80040A7C A0A7007F */ sb $a3, 0x7f($a1)
/* 041680 80040A80 A4AC007A */ sh $t4, 0x7a($a1)
/* 041684 80040A84 84CD0000 */ lh $t5, ($a2)
/* 041688 80040A88 24C60006 */ addiu $a2, $a2, 6
/* 04168C 80040A8C A4AD00B2 */ sh $t5, 0xb2($a1)
/* 041690 80040A90 84CEFFFC */ lh $t6, -4($a2)
/* 041694 80040A94 00000000 */ nop
/* 041698 80040A98 A4AE00B4 */ sh $t6, 0xb4($a1)
/* 04169C 80040A9C 84CFFFFE */ lh $t7, -2($a2)
/* 0416A0 80040AA0 A0A700B8 */ sb $a3, 0xb8($a1)
/* 0416A4 80040AA4 A0A700B9 */ sb $a3, 0xb9($a1)
/* 0416A8 80040AA8 A0A700BA */ sb $a3, 0xba($a1)
/* 0416AC 80040AAC A0A700BB */ sb $a3, 0xbb($a1)
/* 0416B0 80040AB0 1468FFE8 */ bne $v1, $t0, .L80040A54
/* 0416B4 80040AB4 A4AF00B6 */ sh $t7, 0xb6($a1)
/* 0416B8 80040AB8 24180001 */ li $t8, 1
/* 0416BC 80040ABC A05800FC */ sb $t8, 0xfc($v0)
.L80040AC0:
/* 0416C0 80040AC0 8FB90004 */ lw $t9, 4($sp)
/* 0416C4 80040AC4 00402825 */ move $a1, $v0
/* 0416C8 80040AC8 9329000B */ lbu $t1, 0xb($t9)
/* 0416CC 80040ACC 3C06800E */ lui $a2, %hi(D_800DCAA8) # $a2, 0x800e
/* 0416D0 80040AD0 44892000 */ mtc1 $t1, $f4
/* 0416D4 80040AD4 05210005 */ bgez $t1, .L80040AEC
/* 0416D8 80040AD8 468021A0 */ cvt.s.w $f6, $f4
/* 0416DC 80040ADC 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000
/* 0416E0 80040AE0 44814000 */ mtc1 $at, $f8
/* 0416E4 80040AE4 00000000 */ nop
/* 0416E8 80040AE8 46083180 */ add.s $f6, $f6, $f8
.L80040AEC:
/* 0416EC 80040AEC 3C01800E */ lui $at, %hi(D_800E6218) # $at, 0x800e
/* 0416F0 80040AF0 C42A6218 */ lwc1 $f10, %lo(D_800E6218)($at)
/* 0416F4 80040AF4 8C8B0040 */ lw $t3, 0x40($a0)
/* 0416F8 80040AF8 460A3402 */ mul.s $f16, $f6, $f10
/* 0416FC 80040AFC 00003825 */ move $a3, $zero
/* 041700 80040B00 24C6CAA8 */ addiu $a2, %lo(D_800DCAA8) # addiu $a2, $a2, -0x3558
/* 041704 80040B04 E4900008 */ swc1 $f16, 8($a0)
/* 041708 80040B08 8FAA0004 */ lw $t2, 4($sp)
/* 04170C 80040B0C 816C0055 */ lb $t4, 0x55($t3)
/* 041710 80040B10 9143000A */ lbu $v1, 0xa($t2)
/* 041714 80040B14 00000000 */ nop
/* 041718 80040B18 006C082A */ slt $at, $v1, $t4
/* 04171C 80040B1C 10200007 */ beqz $at, .L80040B3C
/* 041720 80040B20 00000000 */ nop
/* 041724 80040B24 8C8D0068 */ lw $t5, 0x68($a0)
/* 041728 80040B28 00037080 */ sll $t6, $v1, 2
/* 04172C 80040B2C 01AE7821 */ addu $t7, $t5, $t6
/* 041730 80040B30 8DF80000 */ lw $t8, ($t7)
/* 041734 80040B34 10000006 */ b .L80040B50
/* 041738 80040B38 AC5800F8 */ sw $t8, 0xf8($v0)
.L80040B3C:
/* 04173C 80040B3C 8C990068 */ lw $t9, 0x68($a0)
/* 041740 80040B40 00000000 */ nop
/* 041744 80040B44 8F290000 */ lw $t1, ($t9)
/* 041748 80040B48 00000000 */ nop
/* 04174C 80040B4C AC4900F8 */ sw $t1, 0xf8($v0)
.L80040B50:
/* 041750 80040B50 8C4300F8 */ lw $v1, 0xf8($v0)
/* 041754 80040B54 3C02800E */ lui $v0, %hi(D_800DCB28) # $v0, 0x800e
/* 041758 80040B58 1060000A */ beqz $v1, .L80040B84
/* 04175C 80040B5C 2442CB28 */ addiu $v0, %lo(D_800DCB28) # addiu $v0, $v0, -0x34d8
/* 041760 80040B60 90670000 */ lbu $a3, ($v1)
/* 041764 80040B64 90640001 */ lbu $a0, 1($v1)
/* 041768 80040B68 24E7FFFF */ addiu $a3, $a3, -1
/* 04176C 80040B6C 2484FFFF */ addiu $a0, $a0, -1
/* 041770 80040B70 00075140 */ sll $t2, $a3, 5
/* 041774 80040B74 00045940 */ sll $t3, $a0, 5
/* 041778 80040B78 01403825 */ move $a3, $t2
/* 04177C 80040B7C 10000002 */ b .L80040B88
/* 041780 80040B80 01602025 */ move $a0, $t3
.L80040B84:
/* 041784 80040B84 00002025 */ move $a0, $zero
.L80040B88:
/* 041788 80040B88 84CC0004 */ lh $t4, 4($a2)
/* 04178C 80040B8C 24C60020 */ addiu $a2, $a2, 0x20
/* 041790 80040B90 01876824 */ and $t5, $t4, $a3
/* 041794 80040B94 A4AD0004 */ sh $t5, 4($a1)
/* 041798 80040B98 84CEFFE6 */ lh $t6, -0x1a($a2)
/* 04179C 80040B9C 24A50020 */ addiu $a1, $a1, 0x20
/* 0417A0 80040BA0 01C47824 */ and $t7, $t6, $a0
/* 0417A4 80040BA4 A4AFFFE6 */ sh $t7, -0x1a($a1)
/* 0417A8 80040BA8 84D8FFE8 */ lh $t8, -0x18($a2)
/* 0417AC 80040BAC 00000000 */ nop
/* 0417B0 80040BB0 0307C824 */ and $t9, $t8, $a3
/* 0417B4 80040BB4 A4B9FFE8 */ sh $t9, -0x18($a1)
/* 0417B8 80040BB8 84C9FFEA */ lh $t1, -0x16($a2)
/* 0417BC 80040BBC 00000000 */ nop
/* 0417C0 80040BC0 01245024 */ and $t2, $t1, $a0
/* 0417C4 80040BC4 A4AAFFEA */ sh $t2, -0x16($a1)
/* 0417C8 80040BC8 84CBFFEC */ lh $t3, -0x14($a2)
/* 0417CC 80040BCC 00000000 */ nop
/* 0417D0 80040BD0 01676024 */ and $t4, $t3, $a3
/* 0417D4 80040BD4 A4ACFFEC */ sh $t4, -0x14($a1)
/* 0417D8 80040BD8 84CDFFEE */ lh $t5, -0x12($a2)
/* 0417DC 80040BDC 00000000 */ nop
/* 0417E0 80040BE0 01A47024 */ and $t6, $t5, $a0
/* 0417E4 80040BE4 A4AEFFEE */ sh $t6, -0x12($a1)
/* 0417E8 80040BE8 84CFFFF4 */ lh $t7, -0xc($a2)
/* 0417EC 80040BEC 00000000 */ nop
/* 0417F0 80040BF0 01E7C024 */ and $t8, $t7, $a3
/* 0417F4 80040BF4 A4B8FFF4 */ sh $t8, -0xc($a1)
/* 0417F8 80040BF8 84D9FFF6 */ lh $t9, -0xa($a2)
/* 0417FC 80040BFC 00000000 */ nop
/* 041800 80040C00 03244824 */ and $t1, $t9, $a0
/* 041804 80040C04 A4A9FFF6 */ sh $t1, -0xa($a1)
/* 041808 80040C08 84CAFFF8 */ lh $t2, -8($a2)
/* 04180C 80040C0C 00000000 */ nop
/* 041810 80040C10 01475824 */ and $t3, $t2, $a3
/* 041814 80040C14 A4ABFFF8 */ sh $t3, -8($a1)
/* 041818 80040C18 84CCFFFA */ lh $t4, -6($a2)
/* 04181C 80040C1C 00000000 */ nop
/* 041820 80040C20 01846824 */ and $t5, $t4, $a0
/* 041824 80040C24 A4ADFFFA */ sh $t5, -6($a1)
/* 041828 80040C28 84CEFFFC */ lh $t6, -4($a2)
/* 04182C 80040C2C 00000000 */ nop
/* 041830 80040C30 01C77824 */ and $t7, $t6, $a3
/* 041834 80040C34 A4AFFFFC */ sh $t7, -4($a1)
/* 041838 80040C38 84D8FFFE */ lh $t8, -2($a2)
/* 04183C 80040C3C 00000000 */ nop
/* 041840 80040C40 0304C824 */ and $t9, $t8, $a0
/* 041844 80040C44 14C2FFD0 */ bne $a2, $v0, .L80040B88
/* 041848 80040C48 A4B9FFFE */ sh $t9, -2($a1)
/* 04184C 80040C4C 03E00008 */ jr $ra
/* 041850 80040C50 00000000 */ nop
+1 -1
View File
@@ -469,7 +469,7 @@ UNUSED u8 music_channel_volume(u8 channel) {
/**
* Set this channel to fade in over time.
*/
void music_channel_fade_set(u8 channel, u8 fade) {
void music_channel_fade_set(u8 channel, ALPan fade) {
if (channel < AUDIO_CHANNELS) {
alCSPSetFadeIn(gMusicPlayer, channel, fade);
}
+628 -321
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -261,7 +261,7 @@ typedef struct unk800861C8 {
/* 0x03 */ u8 unk3;
/* 0x04 */ s16 compressedFilename;
/* 0x06 */ u8 controllerIndex;
/* 0x07 */ u8 unk7;
/* 0x07 */ u8 saveFileNumber;
/* 0x08 */ char *unk8;
/* 0x0C */ u32 fileSize; // Game Data File Size
} unk800861C8;
+48 -55
View File
@@ -4798,78 +4798,71 @@ void obj_init_wavegenerator(Object *obj, UNUSED LevelObjectEntry_WaveGenerator *
func_800BF524(obj);
}
#ifdef NON_EQUIVALENT
void obj_init_butterfly(Object *obj, LevelObjectEntry_Butterfly *entry, s32 arg2) {
Object_Butterfly *obj64;
s32 i, j;
s32 uMask, vMask;
obj64 = &obj->unk64->butterfly;
void obj_init_butterfly(Object *butterflyObj, LevelObjectEntry_Butterfly *butterflyEntry, s32 arg2) {
Object_Butterfly *butterfly;
s32 uMask;
s32 vMask;
s32 i;
butterfly = &butterflyObj->unk64->butterfly;
if (arg2 == 0) {
obj->segment.y_velocity = 0.0f;
obj64->unkFE = 0;
obj64->unk100 = 0;
obj64->unk104 = 0;
obj64->unkFD = 0;
obj64->unk106 = 384;
obj64->unk108 = 0.0f;
// This loop is okay
butterflyObj->segment.y_velocity = 0.0f;
butterfly->unkFE = 0;
butterfly->unk100 = 0;
butterfly->unk104 = 0;
butterfly->unkFD = 0;
butterfly->unk106 = 0x180;
butterfly->unk108 = 0.0f;
for(i = 0; i < 8; i++) {
obj64->triangles[i].flags = D_800DCAA8[i].flags;
obj64->triangles[i].vi0 = D_800DCAA8[i].vi0;
obj64->triangles[i].vi1 = D_800DCAA8[i].vi1;
obj64->triangles[i].vi2 = D_800DCAA8[i].vi2;
butterfly->triangles[i].flags = D_800DCAA8[i].flags;
butterfly->triangles[i].vi0 = D_800DCAA8[i].vi0;
butterfly->triangles[i].vi1 = D_800DCAA8[i].vi1;
butterfly->triangles[i].vi2 = D_800DCAA8[i].vi2;
}
// This loop is not.
uMask = 0;
for(i = 0; i < 6; i++) {
//u32 j = i + 6;
obj64->vertices[i].x = D_800DCB28[i].x;
obj64->vertices[i].y = D_800DCB28[i+1].y;
obj64->vertices[i].z = D_800DCB28[i+1].z;
obj64->vertices[i].r = 255;
obj64->vertices[i].g = 255;
obj64->vertices[i].b = 255;
obj64->vertices[i].a = 255;
obj64->vertices[(u32)(i+6)].x = D_800DCB28[i+1].x;
obj64->vertices[i+6].y = D_800DCB28[i].y;
obj64->vertices[i+6].z = D_800DCB28[i].z;
obj64->vertices[i+6].r = 255;
obj64->vertices[i+6].g = 255;
obj64->vertices[i+6].b = 255;
obj64->vertices[i+6].a = 255;
butterfly->vertices[uMask].x = D_800DCB28[uMask].x;
butterfly->vertices[uMask].y = D_800DCB28[uMask].y;
butterfly->vertices[uMask].z = D_800DCB28[uMask].z;
butterfly->vertices[uMask].r = 255;
butterfly->vertices[uMask].g = 255;
butterfly->vertices[uMask].b = 255;
butterfly->vertices[uMask].a = 255;
butterfly->vertices[uMask+6].x = D_800DCB28[uMask].x;
butterfly->vertices[uMask+6].y = D_800DCB28[uMask].y;
butterfly->vertices[uMask+6].z = D_800DCB28[uMask].z;
butterfly->vertices[uMask+6].r = 255;
butterfly->vertices[uMask+6].g = 255;
butterfly->vertices[uMask+6].b = 255;
butterfly->vertices[uMask+6].a = 255;
uMask++;
}
obj64->unkFC = 1;
butterfly->unkFC = 1;
}
obj->segment.trans.scale = entry->unkB * 0.01f;
if (entry->unkA < obj->segment.header->numberOfModelIds) {
obj64->texture = (TextureHeader*)obj->unk68[entry->unkA];
butterflyObj->segment.trans.scale = butterflyEntry->unkB * 0.01f;
if (butterflyEntry->unkA < butterflyObj->segment.header->numberOfModelIds) {
butterfly->texture = (TextureHeader* ) butterflyObj->unk68[butterflyEntry->unkA];
} else {
obj64->texture = (TextureHeader*)obj->unk68[0];
butterfly->texture = (TextureHeader* ) butterflyObj->unk68[0];
}
if (obj64->texture) {
uMask = (obj64->texture->width - 1) << 5;
vMask = (obj64->texture->height - 1) << 5;
if (butterfly->texture != NULL) {
uMask = (butterfly->texture->width - 1) << 5;
vMask = (butterfly->texture->height - 1) << 5;
} else {
uMask = 0;
vMask = 0;
}
for(i = 0; i < 8; i++) {
obj64->triangles[i].uv0.u = D_800DCAA8[i].uv0.u & uMask;
obj64->triangles[i].uv0.v = D_800DCAA8[i].uv0.v & vMask;
obj64->triangles[i].uv1.u = D_800DCAA8[i].uv1.u & uMask;
obj64->triangles[i].uv1.v = D_800DCAA8[i].uv1.v & vMask;
obj64->triangles[i].uv2.u = D_800DCAA8[i].uv2.u & uMask;
obj64->triangles[i].uv2.v = D_800DCAA8[i].uv2.v & vMask;
butterfly->triangles[i].uv0.u = D_800DCAA8[i].uv0.u & uMask;
butterfly->triangles[i].uv0.v = D_800DCAA8[i].uv0.v & vMask;
butterfly->triangles[i].uv1.u = D_800DCAA8[i].uv1.u & uMask;
butterfly->triangles[i].uv1.v = D_800DCAA8[i].uv1.v & vMask;
butterfly->triangles[i].uv2.u = D_800DCAA8[i].uv2.u & uMask;
butterfly->triangles[i].uv2.v = D_800DCAA8[i].uv2.v & vMask;
}
}
#else
GLOBAL_ASM("asm/non_matchings/object_functions/obj_init_butterfly.s")
#endif
GLOBAL_ASM("asm/non_matchings/object_functions/obj_loop_butterfly.s")
//Scratch: https://decomp.me/scratch/h4CcJ
+17 -4
View File
@@ -52,7 +52,7 @@ LIB_SRC_DIRECTORY = './lib/src'
FUNCTION_REGEX = r'^(?<!static\s)(?:(\/[*][*!][*]*\n(?:[^/]*\n)+?\s*[*]\/\n)(?:\s*)*?)?(?:\s*UNUSED\s+)?([^\s]+)\s(?:\s|[*])*?([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{'
GLOBAL_ASM_REGEX = r'GLOBAL_ASM[(]".*(?=\/)\/([^.]+).s"[)]'
WIP_REGEX = r'#ifdef\s+(?:NON_MATCHING|NON_EQUIVALENT)(?:.|\n)*?#else\s*(GLOBAL_ASM[(][^)]*[)])(.|\n)*?#endif'
NON_MATCHING_REGEX = re.compile(r'^#ifdef[ ]+NON_MATCHING', re.MULTILINE)
NON_MATCHING_REGEX = re.compile(r'^#ifdef[ ]+NON_MATCHING(?:.|\n)*?(?:\s*UNUSED\s+)?(?:[^\s]+)\s(?:\s|[*])*?([0-9A-Za-z_]+)\s*[(][^)]*[)]\s*{', re.MULTILINE)
NON_EQUVIALENT_REGEX = re.compile(r'^#ifdef[ ]+NON_EQUIVALENT', re.MULTILINE)
CODE_START = 0x80000400
@@ -107,7 +107,11 @@ class ScoreFile:
def read_file(self):
with open(self.path, "r") as inFile:
self.text = inFile.read()
self.numNonMatchings = len(re.findall(NON_MATCHING_REGEX, self.text))
self.nonMatchings = re.findall(NON_MATCHING_REGEX, self.text)
self.nonMatchingsSizes = 0
for nonMatching in self.nonMatchings:
self.nonMatchingsSizes += MAP_FILE.functionSizes[nonMatching]
self.numNonMatchings = len(self.nonMatchings)
self.numNonEquivalents = len(re.findall(NON_EQUVIALENT_REGEX, self.text))
self.text = re.sub(WIP_REGEX, r"GLOBAL_ASM(\1)", self.text)
@@ -142,6 +146,9 @@ class ScoreFile:
size += func.size
return size
def get_size_of_functions_with_nonmatching(self):
return self.get_size_of_functions() + self.nonMatchingsSizes
def get_size_of_documented_functions(self):
size = 0
for func in self.functions:
@@ -170,6 +177,7 @@ def main():
totalNumberOfNonMatching = 0
totalNumberOfNonEquivalent = 0
totalSizeOfDecompiledFunctions = 0
totalSizeOfDecompiledAndNonMatchingFunctions = 0
totalSizeOfDocumentedFunctions = 0
ignoreNumberDocumentedFunctions = 0
ignoreSizeDocumentedFunctions = 0
@@ -190,6 +198,7 @@ def main():
totalNumberOfNonEquivalent += scoreFile.numNonEquivalents
totalNumberOfDocumentedFunctions += scoreFile.get_number_of_documented_functions()
totalSizeOfDecompiledFunctions += scoreFile.get_size_of_functions()
totalSizeOfDecompiledAndNonMatchingFunctions += scoreFile.get_size_of_functions_with_nonmatching()
totalSizeOfDocumentedFunctions += scoreFile.get_size_of_documented_functions()
scoreFiles.append(scoreFile)
# Get score properties of libultra functions.
@@ -201,6 +210,7 @@ def main():
#totalNumberOfDocumentedFunctions += scoreFile.get_number_of_documented_functions()
ignoreNumberDocumentedFunctions += scoreFile.get_number_of_functions()
totalSizeOfDecompiledFunctions += scoreFile.get_size_of_functions()
totalSizeOfDecompiledAndNonMatchingFunctions += scoreFile.get_size_of_functions_with_nonmatching()
#totalSizeOfDocumentedFunctions += scoreFile.get_size_of_documented_functions()
ignoreSizeDocumentedFunctions += scoreFile.get_size_of_functions()
scoreFiles.append(scoreFile)
@@ -209,9 +219,12 @@ def main():
totalNumberOfFunctions = totalNumberOfDecompiledFunctions + totalNumberOfGlobalAsms
for asm_function in ASM_LABELS:
if asm_function in MAP_FILE.functionSizes:
totalSizeOfDecompiledFunctions += MAP_FILE.functionSizes[asm_function]
asmFuncSize = MAP_FILE.functionSizes[asm_function]
totalSizeOfDecompiledFunctions += asmFuncSize
totalSizeOfDecompiledAndNonMatchingFunctions += asmFuncSize
adventureOnePercentage = (totalSizeOfDecompiledFunctions / CODE_SIZE) * 100
adventureOnePercentageWithNonMatching = (totalSizeOfDecompiledAndNonMatchingFunctions / CODE_SIZE) * 100
adventureTwoPercentage = (totalSizeOfDocumentedFunctions / (CODE_SIZE - ignoreSizeDocumentedFunctions)) * 100
if args.summary:
@@ -219,7 +232,7 @@ def main():
print(f"Documentation progress: {adventureTwoPercentage:5.2f}%")
sys.exit(0)
scoreDisplay = ScoreDisplay()
print(scoreDisplay.getDisplay(adventureOnePercentage, adventureTwoPercentage, adventureSelect, totalNumberOfDecompiledFunctions, totalNumberOfGlobalAsms, totalNumberOfNonMatching, totalNumberOfNonEquivalent, totalNumberOfDocumentedFunctions, (totalNumberOfFunctions - ignoreNumberDocumentedFunctions) - totalNumberOfDocumentedFunctions))
print(scoreDisplay.getDisplay(adventureOnePercentage, adventureOnePercentageWithNonMatching, adventureTwoPercentage, adventureSelect, totalNumberOfDecompiledFunctions, totalNumberOfGlobalAsms, totalNumberOfNonMatching, totalNumberOfNonEquivalent, totalNumberOfDocumentedFunctions, (totalNumberOfFunctions - ignoreNumberDocumentedFunctions) - totalNumberOfDocumentedFunctions))
if showTopFiles > 0:
if showTopFiles > len(scoreFiles):
+2 -2
View File
@@ -107,7 +107,7 @@ class ScoreDisplay:
out += self.makeLine(' ', dashLen, status['Msg'])
return [out, dashLen]
def getDisplay(self, advOnePer, advTwoPer, showFlags=3, totalDecompFunctions=0, totalGlobalAsm=0, totalNonMatching=0, totalNonEquivalent=0, totalDocumented=0, totalUndocumented=0):
def getDisplay(self, advOnePer, advOneNonMatchPer, advTwoPer, showFlags=3, totalDecompFunctions=0, totalGlobalAsm=0, totalNonMatching=0, totalNonEquivalent=0, totalDocumented=0, totalUndocumented=0):
advOneStatus = self.getStatus(advOnePer)
advTwoStatus = self.getStatus(advTwoPer)
if showFlags == 3:
@@ -127,7 +127,7 @@ class ScoreDisplay:
if advOnePer >= 100.0:
out += self.makeLine('-', dashLen, '{:5.1f}% Complete'.format(advOnePer))
else:
out += self.makeLine('-', dashLen, '{:5.2f}% Complete'.format(advOnePer))
out += self.makeLine('-', dashLen, '{:5.2f}% Complete ({:5.2f}% NON_MATCHING)'.format(advOnePer, advOneNonMatchPer))
out += self.makeLine(' ', dashLen, '# Decompiled functions: ' + str(totalDecompFunctions))
out += self.makeLine(' ', dashLen, '# GLOBAL_ASM remaining: ' + str(totalGlobalAsm))
out += self.makeLine(' ', dashLen, '# NON_MATCHING functions: ' + str(totalNonMatching))