| i | 0x10000 / i |
|---|---|
| 1 | 0x10000 |
| 2 | 0x8000 |
| 3 | 0x5555 |
| 4 | 0x4000 |
| 5 | 0x3333 |
| 6 | 0x2AAA |
| 7 | 0x2492 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Program to read and print the rtproc table sometimes included in IDO ELF files (e.g. as0, as1, nld). | |
| # | |
| # Section is divided into main table and string table. Entries in the main table have this format (from sym.h): | |
| # | |
| # /* | |
| # * The structure of the runtime procedure descriptor created by the loader | |
| # * for use by the static exception system. | |
| # */ |
If you've worked on a Nintendo 64 project, you're probably used to the floating-point registers in MIPS assembly being numbered, in a rather random-looking way, as the even numbers from 0-30. Some seem to be used for returns, some for arguments, some for temps, but there doesn't seem to be any much logic to it. And indeed there isn't, especially for the temp registers:
f0,f2are return values (likev0,v1)f12,f14are function arguments (likea0,a1,...)- The other even-numbered ones are temporary and saved registers
- Odd-numbered ones show up occasionally if doubles are about
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import argparse | |
| from typing import List | |
| import dataclasses # cursed | |
| @dataclasses.dataclass | |
| class Flag: | |
| mask: int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdint.h> | |
| #include <stdio.h> | |
| #define ARRAY_COUNT(arr) (sizeof(arr) / sizeof(arr[0])) | |
| // Test values for 0.05f | |
| // float test_mult[] = { | |
| // 5.0e-06f * 10000.0f, 5.0e-05f * 1000.0f, 0.0005f * 100.0f, 0.005f * 10.0f, 0.05f * 1.0f, | |
| // 0.5f * 0.1f, 5.0f * 0.01f, 50.0f * 0.001f, 500.0f * 0.0001f, | |
| // }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import argparse | |
| import dataclasses | |
| import struct | |
| import sys | |
| import typing | |
| @dataclasses.dataclass | |
| class StandardLimb: | |
| jointPosX: int |
We would like to understand this snippet of assembly code from OoT 1.2, in which we change the second 3C to a 3B to make Link small for smAll dungeons shenanigans:
...
/* 00FF78 80021658 3C053C23 */ lui $a1, (0x3C23D70A >> 16)
/* 00FF7C 8002165C 34A5D70A */ ori $a1, $a1, (0x3C23D70A & 0xFFFF)
/* 00FF80 80021660 0C008572 */ jal Actor_SetScale
/* 00FF84 80021664 02002025 */ move $a0, $s0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <math.h> | |
| #include <assert.h> | |
| typedef union { | |
| float f; | |
| int32_t h; | |
| } FloatHex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Symbol Name,Build,Expected,Status,Difference" ; awk 'NF==2 && 0x80099500 <= strtonum($1) && strtonum($1) < 0x8009f8b0 { arr[$2]=arr[$2]","strtonum($1) } END { for ( i in arr ) { printf "%s%s\n", i,arr[i] } }' build/mm.map expected/build/mm.map | sort -t , -k 3,3 | awk -F',' 'NF!=3 {print $0,"Symbol missing: renamed?"} NF==3 { printf "%s,%X,%X,%s,%s0x%X\n", $1,$2,$3,( $2==$3 ? "GOOD" : "BAD" ),( $2<$3 ? "-" : "" ), ( $2 < $3 ? $3-$2 : $2-$3 ) }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while read version ; do xxd -u -c4 -ps $version/ovl_Bg_Spot17_Bakudankabe | awk -v version=$version 'BEGIN { gsub(/baserom_/,"",version) ; printf("%12s\t",version) ; flag=2} flag && /^0C/ { printf("%X ",lshift(strtonum("0x"$0)-0x0C000000,2)+0x80000000) ; flag-- } END { print"" }' ; done < <( find baserom_* -type d ) |
NewerOlder