phase12: match func_800580E4 (712 bodies / 721 regions)

This commit is contained in:
Christopher Williams
2026-09-25 07:36:28 -04:00
parent cd3031c3f9
commit 69b0ced912
3 changed files with 973 additions and 905 deletions
+904 -905
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -290,6 +290,7 @@
0x80057C30 0x80057C80 src/func_80057C30.c
0x80057C80 0x80057CD0 src/func_80057C80.c
0x80057DFC 0x80057E04 src/func_80057DFC.c
0x800580E4 0x80058190 src/func_800580E4.c
0x80058230 0x80058288 src/func_80058230.c
0x80058288 0x800582AC src/func_80058288.c
0x800582AC 0x800582EC src/func_800582AC.c
1 # Code-region registry: one C region per matched function.
290 0x80057C30
291 0x80057C80
292 0x80057DFC
293 0x800580E4
294 0x80058230
295 0x80058288
296 0x800582AC
+68
View File
@@ -0,0 +1,68 @@
/*
* func_800580E4 — 172 bytes at 0x800580E4..0x80058190
*
* Rejects a null output or an unsigned index >= 83, then reads a 16-byte entry
* from the absolute table at 0x80132084. It copies the entry's word and selected
* halfword/byte fields to the output offsets 0, 8, 10, 12, 14, 15, 16, 18, 24,
* and 26; the final two outputs are right-shifted copies of entry +8 and +10.
*
* The explicit unsigned comparison is byte-required for the target's `sltiu`.
* Raw output offsets are intentional: adjacent byte fields at +14/+15 and the
* later halfword fields do not form a simple contiguous C assignment, and the
* explicit stores reproduce the target's field order and widths.
*
* LIMITS: the table and output meanings are not inferred. The address 0x80132084,
* bound 83, stride 16, source offsets 0/4/6/7/8/10/12/14, output offsets, shifts,
* null checks, and return are byte evidence.
*/
typedef struct Entry {
int w0;
unsigned short h4;
unsigned char b6;
unsigned char b7;
unsigned short h8;
unsigned short h10;
unsigned short h12;
unsigned short h14;
} Entry;
typedef struct Out {
int w0;
char pad0[4];
unsigned short h8;
unsigned short h10;
unsigned short h12;
unsigned short h14;
unsigned short h16;
unsigned short h18;
char pad1[4];
unsigned short h24;
unsigned short h26;
} Out;
extern Entry D_80132084;
Out *func_800580E4(int a0, Out *a1)
{
Entry *e;
unsigned char *out;
if (a1 == 0)
return 0;
if ((unsigned int)a0 >= 83)
return 0;
e = (Entry *)((char *)&D_80132084 + a0 * 16);
out = (unsigned char *)a1;
*(int *)out = e->w0;
*(unsigned short *)(out + 12) = e->h4;
*(unsigned char *)(out + 14) = e->b6;
*(unsigned char *)(out + 15) = e->b7;
*(unsigned short *)(out + 8) = e->h8;
*(unsigned short *)(out + 10) = e->h10;
*(unsigned short *)(out + 16) = e->h12;
*(unsigned short *)(out + 18) = e->h14;
*(unsigned short *)(out + 24) = e->h8 >> 1;
*(unsigned short *)(out + 26) = e->h10 >> 1;
return a1;
}