mirror of
https://github.com/projectPiki/pikmin2.git
synced 2024-11-23 13:29:55 +00:00
Rework TRK_MINNOW headers + start linking
This commit is contained in:
parent
e79a1ee8bf
commit
5c9bb9cd46
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -39,6 +39,7 @@
|
||||
"osreboot.h": "c",
|
||||
"osreset.h": "c",
|
||||
"osfastcast.h": "c",
|
||||
"*.cp": "cpp"
|
||||
"*.cp": "cpp",
|
||||
"circlebuffer.h": "c"
|
||||
}
|
||||
}
|
@ -1,233 +0,0 @@
|
||||
.include "macros.inc"
|
||||
|
||||
.section .text, "ax" # 0x800056C0 - 0x80472F00
|
||||
.fn TRKSaveExtended1Block, global
|
||||
/* 800BFA60 000BC9A0 3C 40 80 4F */ lis r2, gTRKCPUState@h
|
||||
/* 800BFA64 000BC9A4 60 42 43 28 */ ori r2, r2, gTRKCPUState@l
|
||||
/* 800BFA68 000BC9A8 7E 00 04 A6 */ mfsr r16, 0
|
||||
/* 800BFA6C 000BC9AC 7E 21 04 A6 */ mfsr r17, 1
|
||||
/* 800BFA70 000BC9B0 7E 42 04 A6 */ mfsr r18, 2
|
||||
/* 800BFA74 000BC9B4 7E 63 04 A6 */ mfsr r19, 3
|
||||
/* 800BFA78 000BC9B8 7E 84 04 A6 */ mfsr r20, 4
|
||||
/* 800BFA7C 000BC9BC 7E A5 04 A6 */ mfsr r21, 5
|
||||
/* 800BFA80 000BC9C0 7E C6 04 A6 */ mfsr r22, 6
|
||||
/* 800BFA84 000BC9C4 7E E7 04 A6 */ mfsr r23, 7
|
||||
/* 800BFA88 000BC9C8 7F 08 04 A6 */ mfsr r24, 8
|
||||
/* 800BFA8C 000BC9CC 7F 29 04 A6 */ mfsr r25, 9
|
||||
/* 800BFA90 000BC9D0 7F 4A 04 A6 */ mfsr r26, 0xa
|
||||
/* 800BFA94 000BC9D4 7F 6B 04 A6 */ mfsr r27, 0xb
|
||||
/* 800BFA98 000BC9D8 7F 8C 04 A6 */ mfsr r28, 0xc
|
||||
/* 800BFA9C 000BC9DC 7F AD 04 A6 */ mfsr r29, 0xd
|
||||
/* 800BFAA0 000BC9E0 7F CE 04 A6 */ mfsr r30, 0xe
|
||||
/* 800BFAA4 000BC9E4 7F EF 04 A6 */ mfsr r31, 0xf
|
||||
/* 800BFAA8 000BC9E8 BE 02 01 A8 */ stmw r16, 0x1a8(r2)
|
||||
/* 800BFAAC 000BC9EC 7D 4C 42 E6 */ mftb r10, 0x10c
|
||||
/* 800BFAB0 000BC9F0 7D 6D 42 E6 */ mftbu r11
|
||||
/* 800BFAB4 000BC9F4 7D 90 FA A6 */ mfspr r12, 0x3f0
|
||||
/* 800BFAB8 000BC9F8 7D B1 FA A6 */ mfspr r13, 0x3f1
|
||||
/* 800BFABC 000BC9FC 7D DB 02 A6 */ mfspr r14, 0x1b
|
||||
/* 800BFAC0 000BCA00 7D FF 42 A6 */ mfpvr r15
|
||||
/* 800BFAC4 000BCA04 7E 10 82 A6 */ mfibatu r16, 0
|
||||
/* 800BFAC8 000BCA08 7E 31 82 A6 */ mfibatl r17, 0
|
||||
/* 800BFACC 000BCA0C 7E 52 82 A6 */ mfibatu r18, 1
|
||||
/* 800BFAD0 000BCA10 7E 73 82 A6 */ mfibatl r19, 1
|
||||
/* 800BFAD4 000BCA14 7E 94 82 A6 */ mfibatu r20, 2
|
||||
/* 800BFAD8 000BCA18 7E B5 82 A6 */ mfibatl r21, 2
|
||||
/* 800BFADC 000BCA1C 7E D6 82 A6 */ mfibatu r22, 3
|
||||
/* 800BFAE0 000BCA20 7E F7 82 A6 */ mfibatl r23, 3
|
||||
/* 800BFAE4 000BCA24 7F 18 82 A6 */ mfdbatu r24, 0
|
||||
/* 800BFAE8 000BCA28 7F 39 82 A6 */ mfdbatl r25, 0
|
||||
/* 800BFAEC 000BCA2C 7F 5A 82 A6 */ mfdbatu r26, 1
|
||||
/* 800BFAF0 000BCA30 7F 7B 82 A6 */ mfdbatl r27, 1
|
||||
/* 800BFAF4 000BCA34 7F 9C 82 A6 */ mfdbatu r28, 2
|
||||
/* 800BFAF8 000BCA38 7F BD 82 A6 */ mfdbatl r29, 2
|
||||
/* 800BFAFC 000BCA3C 7F DE 82 A6 */ mfdbatu r30, 3
|
||||
/* 800BFB00 000BCA40 7F FF 82 A6 */ mfdbatl r31, 3
|
||||
/* 800BFB04 000BCA44 BD 42 01 E8 */ stmw r10, 0x1e8(r2)
|
||||
/* 800BFB08 000BCA48 7E D9 02 A6 */ mfspr r22, 0x19
|
||||
/* 800BFB0C 000BCA4C 7E F3 02 A6 */ mfdar r23
|
||||
/* 800BFB10 000BCA50 7F 12 02 A6 */ mfdsisr r24
|
||||
/* 800BFB14 000BCA54 7F 30 42 A6 */ mfspr r25, 0x110
|
||||
/* 800BFB18 000BCA58 7F 51 42 A6 */ mfspr r26, 0x111
|
||||
/* 800BFB1C 000BCA5C 7F 72 42 A6 */ mfspr r27, 0x112
|
||||
/* 800BFB20 000BCA60 7F 93 42 A6 */ mfspr r28, 0x113
|
||||
/* 800BFB24 000BCA64 3B A0 00 00 */ li r29, 0
|
||||
/* 800BFB28 000BCA68 7F D2 FA A6 */ mfspr r30, 0x3f2
|
||||
/* 800BFB2C 000BCA6C 7F FA 42 A6 */ mfspr r31, 0x11a
|
||||
/* 800BFB30 000BCA70 BE C2 02 5C */ stmw r22, 0x25c(r2)
|
||||
/* 800BFB34 000BCA74 7E 90 E2 A6 */ mfspr r20, 0x390
|
||||
/* 800BFB38 000BCA78 7E B1 E2 A6 */ mfspr r21, 0x391
|
||||
/* 800BFB3C 000BCA7C 7E D2 E2 A6 */ mfspr r22, 0x392
|
||||
/* 800BFB40 000BCA80 7E F3 E2 A6 */ mfspr r23, 0x393
|
||||
/* 800BFB44 000BCA84 7F 14 E2 A6 */ mfspr r24, 0x394
|
||||
/* 800BFB48 000BCA88 7F 35 E2 A6 */ mfspr r25, 0x395
|
||||
/* 800BFB4C 000BCA8C 7F 56 E2 A6 */ mfspr r26, 0x396
|
||||
/* 800BFB50 000BCA90 7F 77 E2 A6 */ mfspr r27, 0x397
|
||||
/* 800BFB54 000BCA94 7F 98 E2 A6 */ mfspr r28, 0x398
|
||||
/* 800BFB58 000BCA98 7F B9 E2 A6 */ mfspr r29, 0x399
|
||||
/* 800BFB5C 000BCA9C 7F DA E2 A6 */ mfspr r30, 0x39a
|
||||
/* 800BFB60 000BCAA0 7F FB E2 A6 */ mfspr r31, 0x39b
|
||||
/* 800BFB64 000BCAA4 BE 82 02 FC */ stmw r20, 0x2fc(r2)
|
||||
/* 800BFB68 000BCAA8 48 00 00 48 */ b .L_800BFBB0
|
||||
/* 800BFB6C 000BCAAC 7E 00 EA A6 */ mfspr r16, 0x3a0
|
||||
/* 800BFB70 000BCAB0 7E 27 EA A6 */ mfspr r17, 0x3a7
|
||||
/* 800BFB74 000BCAB4 7E 48 EA A6 */ mfspr r18, 0x3a8
|
||||
/* 800BFB78 000BCAB8 7E 69 EA A6 */ mfspr r19, 0x3a9
|
||||
/* 800BFB7C 000BCABC 7E 8A EA A6 */ mfspr r20, 0x3aa
|
||||
/* 800BFB80 000BCAC0 7E AB EA A6 */ mfspr r21, 0x3ab
|
||||
/* 800BFB84 000BCAC4 7E CC EA A6 */ mfspr r22, 0x3ac
|
||||
/* 800BFB88 000BCAC8 7E ED EA A6 */ mfspr r23, 0x3ad
|
||||
/* 800BFB8C 000BCACC 7F 0E EA A6 */ mfspr r24, 0x3ae
|
||||
/* 800BFB90 000BCAD0 7F 2F EA A6 */ mfspr r25, 0x3af
|
||||
/* 800BFB94 000BCAD4 7F 50 EA A6 */ mfspr r26, 0x3b0
|
||||
/* 800BFB98 000BCAD8 7F 77 EA A6 */ mfspr r27, 0x3b7
|
||||
/* 800BFB9C 000BCADC 7F 9F EA A6 */ mfspr r28, 0x3bf
|
||||
/* 800BFBA0 000BCAE0 7F B6 FA A6 */ mfspr r29, 0x3f6
|
||||
/* 800BFBA4 000BCAE4 7F D7 FA A6 */ mfspr r30, 0x3f7
|
||||
/* 800BFBA8 000BCAE8 7F FF FA A6 */ mfspr r31, 0x3ff
|
||||
/* 800BFBAC 000BCAEC BE 02 02 B8 */ stmw r16, 0x2b8(r2)
|
||||
.L_800BFBB0:
|
||||
/* 800BFBB0 000BCAF0 7E 75 FA A6 */ mfspr r19, 0x3f5
|
||||
/* 800BFBB4 000BCAF4 7E 99 EA A6 */ mfspr r20, 0x3b9
|
||||
/* 800BFBB8 000BCAF8 7E BA EA A6 */ mfspr r21, 0x3ba
|
||||
/* 800BFBBC 000BCAFC 7E DD EA A6 */ mfspr r22, 0x3bd
|
||||
/* 800BFBC0 000BCB00 7E FE EA A6 */ mfspr r23, 0x3be
|
||||
/* 800BFBC4 000BCB04 7F 1B EA A6 */ mfspr r24, 0x3bb
|
||||
/* 800BFBC8 000BCB08 7F 38 EA A6 */ mfspr r25, 0x3b8
|
||||
/* 800BFBCC 000BCB0C 7F 5C EA A6 */ mfspr r26, 0x3bc
|
||||
/* 800BFBD0 000BCB10 7F 7C FA A6 */ mfspr r27, 0x3fc
|
||||
/* 800BFBD4 000BCB14 7F 9D FA A6 */ mfspr r28, 0x3fd
|
||||
/* 800BFBD8 000BCB18 7F BE FA A6 */ mfspr r29, 0x3fe
|
||||
/* 800BFBDC 000BCB1C 7F DB FA A6 */ mfspr r30, 0x3FB
|
||||
/* 800BFBE0 000BCB20 7F F9 FA A6 */ mfspr r31, 0x3f9
|
||||
/* 800BFBE4 000BCB24 BE 62 02 84 */ stmw r19, 0x284(r2)
|
||||
/* 800BFBE8 000BCB28 4E 80 00 20 */ blr
|
||||
/* 800BFBEC 000BCB2C 7F 30 F2 A6 */ mfspr r25, 0x3d0
|
||||
/* 800BFBF0 000BCB30 7F 51 F2 A6 */ mfspr r26, 0x3d1
|
||||
/* 800BFBF4 000BCB34 7F 72 F2 A6 */ mfspr r27, 0x3d2
|
||||
/* 800BFBF8 000BCB38 7F 93 F2 A6 */ mfspr r28, 0x3d3
|
||||
/* 800BFBFC 000BCB3C 7F B4 F2 A6 */ mfspr r29, 0x3D4
|
||||
/* 800BFC00 000BCB40 7F D5 F2 A6 */ mfspr r30, 0x3D5
|
||||
/* 800BFC04 000BCB44 7F F6 F2 A6 */ mfspr r31, 0x3d6
|
||||
/* 800BFC08 000BCB48 BF 22 02 40 */ stmw r25, 0x240(r2)
|
||||
/* 800BFC0C 000BCB4C 7F F6 02 A6 */ mfspr r31, 0x16
|
||||
/* 800BFC10 000BCB50 93 E2 02 78 */ stw r31, 0x278(r2)
|
||||
/* 800BFC14 000BCB54 4E 80 00 20 */ blr
|
||||
.endfn TRKSaveExtended1Block
|
||||
|
||||
.fn TRKRestoreExtended1Block, global
|
||||
/* 800BFC18 000BCB58 3C 40 80 4F */ lis r2, gTRKCPUState@h
|
||||
/* 800BFC1C 000BCB5C 60 42 43 28 */ ori r2, r2, gTRKCPUState@l
|
||||
/* 800BFC20 000BCB60 3C A0 80 4A */ lis r5, gTRKRestoreFlags@h
|
||||
/* 800BFC24 000BCB64 60 A5 68 B0 */ ori r5, r5, gTRKRestoreFlags@l
|
||||
/* 800BFC28 000BCB68 88 65 00 00 */ lbz r3, 0(r5)
|
||||
/* 800BFC2C 000BCB6C 88 C5 00 01 */ lbz r6, 1(r5)
|
||||
/* 800BFC30 000BCB70 38 00 00 00 */ li r0, 0
|
||||
/* 800BFC34 000BCB74 98 05 00 00 */ stb r0, 0(r5)
|
||||
/* 800BFC38 000BCB78 98 05 00 01 */ stb r0, 1(r5)
|
||||
/* 800BFC3C 000BCB7C 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 800BFC40 000BCB80 41 82 00 14 */ beq .L_800BFC54
|
||||
/* 800BFC44 000BCB84 83 02 01 E8 */ lwz r24, 0x1e8(r2)
|
||||
/* 800BFC48 000BCB88 83 22 01 EC */ lwz r25, 0x1ec(r2)
|
||||
/* 800BFC4C 000BCB8C 7F 1C 43 A6 */ mttbl r24
|
||||
/* 800BFC50 000BCB90 7F 3D 43 A6 */ mttbu r25
|
||||
.L_800BFC54:
|
||||
/* 800BFC54 000BCB94 BA 82 02 FC */ lmw r20, 0x2fc(r2)
|
||||
/* 800BFC58 000BCB98 7E 90 E3 A6 */ mtspr 0x390, r20
|
||||
/* 800BFC5C 000BCB9C 7E B1 E3 A6 */ mtspr 0x391, r21
|
||||
/* 800BFC60 000BCBA0 7E D2 E3 A6 */ mtspr 0x392, r22
|
||||
/* 800BFC64 000BCBA4 7E F3 E3 A6 */ mtspr 0x393, r23
|
||||
/* 800BFC68 000BCBA8 7F 14 E3 A6 */ mtspr 0x394, r24
|
||||
/* 800BFC6C 000BCBAC 7F 35 E3 A6 */ mtspr 0x395, r25
|
||||
/* 800BFC70 000BCBB0 7F 56 E3 A6 */ mtspr 0x396, r26
|
||||
/* 800BFC74 000BCBB4 7F 77 E3 A6 */ mtspr 0x397, r27
|
||||
/* 800BFC78 000BCBB8 7F 98 E3 A6 */ mtspr 0x398, r28
|
||||
/* 800BFC7C 000BCBBC 7F DA E3 A6 */ mtspr 0x39a, r30
|
||||
/* 800BFC80 000BCBC0 7F FB E3 A6 */ mtspr 0x39b, r31
|
||||
/* 800BFC84 000BCBC4 48 00 00 1C */ b .L_800BFCA0
|
||||
/* 800BFC88 000BCBC8 BB 42 02 E0 */ lmw r26, 0x2e0(r2)
|
||||
/* 800BFC8C 000BCBCC 7F 50 EB A6 */ mtspr 0x3b0, r26
|
||||
/* 800BFC90 000BCBD0 7F 77 EB A6 */ mtspr 0x3b7, r27
|
||||
/* 800BFC94 000BCBD4 7F B6 FB A6 */ mtspr 0x3f6, r29
|
||||
/* 800BFC98 000BCBD8 7F D7 FB A6 */ mtspr 0x3f7, r30
|
||||
/* 800BFC9C 000BCBDC 7F FF FB A6 */ mtspr 0x3ff, r31
|
||||
.L_800BFCA0:
|
||||
/* 800BFCA0 000BCBE0 BA 62 02 84 */ lmw r19, 0x284(r2)
|
||||
/* 800BFCA4 000BCBE4 7E 75 FB A6 */ mtspr 0x3f5, r19
|
||||
/* 800BFCA8 000BCBE8 7E 99 EB A6 */ mtspr 0x3b9, r20
|
||||
/* 800BFCAC 000BCBEC 7E BA EB A6 */ mtspr 0x3ba, r21
|
||||
/* 800BFCB0 000BCBF0 7E DD EB A6 */ mtspr 0x3bd, r22
|
||||
/* 800BFCB4 000BCBF4 7E FE EB A6 */ mtspr 0x3be, r23
|
||||
/* 800BFCB8 000BCBF8 7F 1B EB A6 */ mtspr 0x3bb, r24
|
||||
/* 800BFCBC 000BCBFC 7F 38 EB A6 */ mtspr 0x3b8, r25
|
||||
/* 800BFCC0 000BCC00 7F 5C EB A6 */ mtspr 0x3bc, r26
|
||||
/* 800BFCC4 000BCC04 7F 7C FB A6 */ mtspr 0x3fc, r27
|
||||
/* 800BFCC8 000BCC08 7F 9D FB A6 */ mtspr 0x3fd, r28
|
||||
/* 800BFCCC 000BCC0C 7F BE FB A6 */ mtspr 0x3fe, r29
|
||||
/* 800BFCD0 000BCC10 7F DB FB A6 */ mtictc r30
|
||||
/* 800BFCD4 000BCC14 7F F9 FB A6 */ mtspr 0x3f9, r31
|
||||
/* 800BFCD8 000BCC18 48 00 00 34 */ b .L_800BFD0C
|
||||
/* 800BFCDC 000BCC1C 2C 06 00 00 */ cmpwi r6, 0
|
||||
/* 800BFCE0 000BCC20 41 82 00 0C */ beq .L_800BFCEC
|
||||
/* 800BFCE4 000BCC24 83 42 02 78 */ lwz r26, 0x278(r2)
|
||||
/* 800BFCE8 000BCC28 7F 56 03 A6 */ mtspr 0x16, r26
|
||||
.L_800BFCEC:
|
||||
/* 800BFCEC 000BCC2C BB 22 02 40 */ lmw r25, 0x240(r2)
|
||||
/* 800BFCF0 000BCC30 7F 30 F3 A6 */ mtspr 0x3d0, r25
|
||||
/* 800BFCF4 000BCC34 7F 51 F3 A6 */ mtspr 0x3d1, r26
|
||||
/* 800BFCF8 000BCC38 7F 72 F3 A6 */ mtspr 0x3d2, r27
|
||||
/* 800BFCFC 000BCC3C 7F 93 F3 A6 */ mtspr 0x3d3, r28
|
||||
/* 800BFD00 000BCC40 7F B4 F3 A6 */ mtspr 0x3D4, r29
|
||||
/* 800BFD04 000BCC44 7F D5 F3 A6 */ mtspr 0x3D5, r30
|
||||
/* 800BFD08 000BCC48 7F F6 F3 A6 */ mtspr 0x3d6, r31
|
||||
.L_800BFD0C:
|
||||
/* 800BFD0C 000BCC4C BA 02 01 A8 */ lmw r16, 0x1a8(r2)
|
||||
/* 800BFD10 000BCC50 7E 00 01 A4 */ mtsr 0, r16
|
||||
/* 800BFD14 000BCC54 7E 21 01 A4 */ mtsr 1, r17
|
||||
/* 800BFD18 000BCC58 7E 42 01 A4 */ mtsr 2, r18
|
||||
/* 800BFD1C 000BCC5C 7E 63 01 A4 */ mtsr 3, r19
|
||||
/* 800BFD20 000BCC60 7E 84 01 A4 */ mtsr 4, r20
|
||||
/* 800BFD24 000BCC64 7E A5 01 A4 */ mtsr 5, r21
|
||||
/* 800BFD28 000BCC68 7E C6 01 A4 */ mtsr 6, r22
|
||||
/* 800BFD2C 000BCC6C 7E E7 01 A4 */ mtsr 7, r23
|
||||
/* 800BFD30 000BCC70 7F 08 01 A4 */ mtsr 8, r24
|
||||
/* 800BFD34 000BCC74 7F 29 01 A4 */ mtsr 9, r25
|
||||
/* 800BFD38 000BCC78 7F 4A 01 A4 */ mtsr 0xa, r26
|
||||
/* 800BFD3C 000BCC7C 7F 6B 01 A4 */ mtsr 0xb, r27
|
||||
/* 800BFD40 000BCC80 7F 8C 01 A4 */ mtsr 0xc, r28
|
||||
/* 800BFD44 000BCC84 7F AD 01 A4 */ mtsr 0xd, r29
|
||||
/* 800BFD48 000BCC88 7F CE 01 A4 */ mtsr 0xe, r30
|
||||
/* 800BFD4C 000BCC8C 7F EF 01 A4 */ mtsr 0xf, r31
|
||||
/* 800BFD50 000BCC90 B9 82 01 F0 */ lmw r12, 0x1f0(r2)
|
||||
/* 800BFD54 000BCC94 7D 90 FB A6 */ mtspr 0x3f0, r12
|
||||
/* 800BFD58 000BCC98 7D B1 FB A6 */ mtspr 0x3f1, r13
|
||||
/* 800BFD5C 000BCC9C 7D DB 03 A6 */ mtspr 0x1b, r14
|
||||
/* 800BFD60 000BCCA0 7D FF 43 A6 */ mtspr 0x11f, r15
|
||||
/* 800BFD64 000BCCA4 7E 10 83 A6 */ mtibatu 0, r16
|
||||
/* 800BFD68 000BCCA8 7E 31 83 A6 */ mtibatl 0, r17
|
||||
/* 800BFD6C 000BCCAC 7E 52 83 A6 */ mtibatu 1, r18
|
||||
/* 800BFD70 000BCCB0 7E 73 83 A6 */ mtibatl 1, r19
|
||||
/* 800BFD74 000BCCB4 7E 94 83 A6 */ mtibatu 2, r20
|
||||
/* 800BFD78 000BCCB8 7E B5 83 A6 */ mtibatl 2, r21
|
||||
/* 800BFD7C 000BCCBC 7E D6 83 A6 */ mtibatu 3, r22
|
||||
/* 800BFD80 000BCCC0 7E F7 83 A6 */ mtibatl 3, r23
|
||||
/* 800BFD84 000BCCC4 7F 18 83 A6 */ mtdbatu 0, r24
|
||||
/* 800BFD88 000BCCC8 7F 39 83 A6 */ mtdbatl 0, r25
|
||||
/* 800BFD8C 000BCCCC 7F 5A 83 A6 */ mtdbatu 1, r26
|
||||
/* 800BFD90 000BCCD0 7F 7B 83 A6 */ mtdbatl 1, r27
|
||||
/* 800BFD94 000BCCD4 7F 9C 83 A6 */ mtdbatu 2, r28
|
||||
/* 800BFD98 000BCCD8 7F BD 83 A6 */ mtdbatl 2, r29
|
||||
/* 800BFD9C 000BCCDC 7F DE 83 A6 */ mtdbatu 3, r30
|
||||
/* 800BFDA0 000BCCE0 7F FF 83 A6 */ mtdbatl 3, r31
|
||||
/* 800BFDA4 000BCCE4 BA C2 02 5C */ lmw r22, 0x25c(r2)
|
||||
/* 800BFDA8 000BCCE8 7E D9 03 A6 */ mtspr 0x19, r22
|
||||
/* 800BFDAC 000BCCEC 7E F3 03 A6 */ mtdar r23
|
||||
/* 800BFDB0 000BCCF0 7F 12 03 A6 */ mtdsisr r24
|
||||
/* 800BFDB4 000BCCF4 7F 30 43 A6 */ mtspr 0x110, r25
|
||||
/* 800BFDB8 000BCCF8 7F 51 43 A6 */ mtspr 0x111, r26
|
||||
/* 800BFDBC 000BCCFC 7F 72 43 A6 */ mtspr 0x112, r27
|
||||
/* 800BFDC0 000BCD00 7F 93 43 A6 */ mtspr 0x113, r28
|
||||
/* 800BFDC4 000BCD04 7F D2 FB A6 */ mtspr 0x3f2, r30
|
||||
/* 800BFDC8 000BCD08 7F FA 43 A6 */ mtspr 0x11a, r31
|
||||
/* 800BFDCC 000BCD0C 4E 80 00 20 */ blr
|
||||
.endfn TRKRestoreExtended1Block
|
@ -1,158 +0,0 @@
|
||||
.include "macros.inc"
|
||||
|
||||
.section .text, "ax" # 0x800056C0 - 0x80472F00
|
||||
.fn __close_console, global
|
||||
/* 800C0A0C 000BD94C 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 800C0A10 000BD950 7C 08 02 A6 */ mflr r0
|
||||
/* 800C0A14 000BD954 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 800C0A18 000BD958 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 800C0A1C 000BD95C 7C 7F 1B 78 */ mr r31, r3
|
||||
/* 800C0A20 000BD960 4B FF CB 1D */ bl GetTRKConnected
|
||||
/* 800C0A24 000BD964 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 800C0A28 000BD968 40 82 00 0C */ bne .L_800C0A34
|
||||
/* 800C0A2C 000BD96C 38 60 00 01 */ li r3, 1
|
||||
/* 800C0A30 000BD970 48 00 00 4C */ b .L_800C0A7C
|
||||
.L_800C0A34:
|
||||
/* 800C0A34 000BD974 7F E4 FB 78 */ mr r4, r31
|
||||
/* 800C0A38 000BD978 38 60 00 D3 */ li r3, 0xd3
|
||||
/* 800C0A3C 000BD97C 4B FF F0 15 */ bl TRKCloseFile
|
||||
/* 800C0A40 000BD980 54 60 06 3E */ clrlwi r0, r3, 0x18
|
||||
/* 800C0A44 000BD984 2C 00 00 01 */ cmpwi r0, 1
|
||||
/* 800C0A48 000BD988 41 82 00 30 */ beq .L_800C0A78
|
||||
/* 800C0A4C 000BD98C 40 80 00 10 */ bge .L_800C0A5C
|
||||
/* 800C0A50 000BD990 2C 00 00 00 */ cmpwi r0, 0
|
||||
/* 800C0A54 000BD994 40 80 00 14 */ bge .L_800C0A68
|
||||
/* 800C0A58 000BD998 48 00 00 20 */ b .L_800C0A78
|
||||
.L_800C0A5C:
|
||||
/* 800C0A5C 000BD99C 2C 00 00 03 */ cmpwi r0, 3
|
||||
/* 800C0A60 000BD9A0 40 80 00 18 */ bge .L_800C0A78
|
||||
/* 800C0A64 000BD9A4 48 00 00 0C */ b .L_800C0A70
|
||||
.L_800C0A68:
|
||||
/* 800C0A68 000BD9A8 38 60 00 00 */ li r3, 0
|
||||
/* 800C0A6C 000BD9AC 48 00 00 10 */ b .L_800C0A7C
|
||||
.L_800C0A70:
|
||||
/* 800C0A70 000BD9B0 38 60 00 02 */ li r3, 2
|
||||
/* 800C0A74 000BD9B4 48 00 00 08 */ b .L_800C0A7C
|
||||
.L_800C0A78:
|
||||
/* 800C0A78 000BD9B8 38 60 00 01 */ li r3, 1
|
||||
.L_800C0A7C:
|
||||
/* 800C0A7C 000BD9BC 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 800C0A80 000BD9C0 83 E1 00 0C */ lwz r31, 0xc(r1)
|
||||
/* 800C0A84 000BD9C4 7C 08 03 A6 */ mtlr r0
|
||||
/* 800C0A88 000BD9C8 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 800C0A8C 000BD9CC 4E 80 00 20 */ blr
|
||||
.endfn __close_console
|
||||
|
||||
.fn __TRK_write_console, global
|
||||
/* 800C0A90 000BD9D0 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||||
/* 800C0A94 000BD9D4 7C 08 02 A6 */ mflr r0
|
||||
/* 800C0A98 000BD9D8 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
/* 800C0A9C 000BD9DC 93 E1 00 1C */ stw r31, 0x1c(r1)
|
||||
/* 800C0AA0 000BD9E0 7C BF 2B 78 */ mr r31, r5
|
||||
/* 800C0AA4 000BD9E4 93 C1 00 18 */ stw r30, 0x18(r1)
|
||||
/* 800C0AA8 000BD9E8 7C 9E 23 78 */ mr r30, r4
|
||||
/* 800C0AAC 000BD9EC 4B FF FF 45 */ bl GetUseSerialIO
|
||||
/* 800C0AB0 000BD9F0 54 60 06 3F */ clrlwi. r0, r3, 0x18
|
||||
/* 800C0AB4 000BD9F4 40 82 00 0C */ bne .L_800C0AC0
|
||||
/* 800C0AB8 000BD9F8 38 60 00 01 */ li r3, 1
|
||||
/* 800C0ABC 000BD9FC 48 00 00 78 */ b .L_800C0B34
|
||||
.L_800C0AC0:
|
||||
/* 800C0AC0 000BDA00 4B FF CA 7D */ bl GetTRKConnected
|
||||
/* 800C0AC4 000BDA04 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 800C0AC8 000BDA08 40 82 00 0C */ bne .L_800C0AD4
|
||||
/* 800C0ACC 000BDA0C 38 60 00 01 */ li r3, 1
|
||||
/* 800C0AD0 000BDA10 48 00 00 64 */ b .L_800C0B34
|
||||
.L_800C0AD4:
|
||||
/* 800C0AD4 000BDA14 80 1F 00 00 */ lwz r0, 0(r31)
|
||||
/* 800C0AD8 000BDA18 7F C6 F3 78 */ mr r6, r30
|
||||
/* 800C0ADC 000BDA1C 38 A1 00 08 */ addi r5, r1, 8
|
||||
/* 800C0AE0 000BDA20 38 60 00 D0 */ li r3, 0xd0
|
||||
/* 800C0AE4 000BDA24 90 01 00 08 */ stw r0, 8(r1)
|
||||
/* 800C0AE8 000BDA28 38 80 00 01 */ li r4, 1
|
||||
/* 800C0AEC 000BDA2C 4B FF EF 55 */ bl TRKAccessFile
|
||||
/* 800C0AF0 000BDA30 54 60 06 3E */ clrlwi r0, r3, 0x18
|
||||
/* 800C0AF4 000BDA34 80 61 00 08 */ lwz r3, 8(r1)
|
||||
/* 800C0AF8 000BDA38 2C 00 00 01 */ cmpwi r0, 1
|
||||
/* 800C0AFC 000BDA3C 90 7F 00 00 */ stw r3, 0(r31)
|
||||
/* 800C0B00 000BDA40 41 82 00 30 */ beq .L_800C0B30
|
||||
/* 800C0B04 000BDA44 40 80 00 10 */ bge .L_800C0B14
|
||||
/* 800C0B08 000BDA48 2C 00 00 00 */ cmpwi r0, 0
|
||||
/* 800C0B0C 000BDA4C 40 80 00 14 */ bge .L_800C0B20
|
||||
/* 800C0B10 000BDA50 48 00 00 20 */ b .L_800C0B30
|
||||
.L_800C0B14:
|
||||
/* 800C0B14 000BDA54 2C 00 00 03 */ cmpwi r0, 3
|
||||
/* 800C0B18 000BDA58 40 80 00 18 */ bge .L_800C0B30
|
||||
/* 800C0B1C 000BDA5C 48 00 00 0C */ b .L_800C0B28
|
||||
.L_800C0B20:
|
||||
/* 800C0B20 000BDA60 38 60 00 00 */ li r3, 0
|
||||
/* 800C0B24 000BDA64 48 00 00 10 */ b .L_800C0B34
|
||||
.L_800C0B28:
|
||||
/* 800C0B28 000BDA68 38 60 00 02 */ li r3, 2
|
||||
/* 800C0B2C 000BDA6C 48 00 00 08 */ b .L_800C0B34
|
||||
.L_800C0B30:
|
||||
/* 800C0B30 000BDA70 38 60 00 01 */ li r3, 1
|
||||
.L_800C0B34:
|
||||
/* 800C0B34 000BDA74 80 01 00 24 */ lwz r0, 0x24(r1)
|
||||
/* 800C0B38 000BDA78 83 E1 00 1C */ lwz r31, 0x1c(r1)
|
||||
/* 800C0B3C 000BDA7C 83 C1 00 18 */ lwz r30, 0x18(r1)
|
||||
/* 800C0B40 000BDA80 7C 08 03 A6 */ mtlr r0
|
||||
/* 800C0B44 000BDA84 38 21 00 20 */ addi r1, r1, 0x20
|
||||
/* 800C0B48 000BDA88 4E 80 00 20 */ blr
|
||||
.endfn __TRK_write_console
|
||||
|
||||
.fn __read_console, global
|
||||
/* 800C0B4C 000BDA8C 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||||
/* 800C0B50 000BDA90 7C 08 02 A6 */ mflr r0
|
||||
/* 800C0B54 000BDA94 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
/* 800C0B58 000BDA98 93 E1 00 1C */ stw r31, 0x1c(r1)
|
||||
/* 800C0B5C 000BDA9C 7C BF 2B 78 */ mr r31, r5
|
||||
/* 800C0B60 000BDAA0 93 C1 00 18 */ stw r30, 0x18(r1)
|
||||
/* 800C0B64 000BDAA4 7C 9E 23 78 */ mr r30, r4
|
||||
/* 800C0B68 000BDAA8 4B FF FE 89 */ bl GetUseSerialIO
|
||||
/* 800C0B6C 000BDAAC 54 60 06 3F */ clrlwi. r0, r3, 0x18
|
||||
/* 800C0B70 000BDAB0 40 82 00 0C */ bne .L_800C0B7C
|
||||
/* 800C0B74 000BDAB4 38 60 00 01 */ li r3, 1
|
||||
/* 800C0B78 000BDAB8 48 00 00 78 */ b .L_800C0BF0
|
||||
.L_800C0B7C:
|
||||
/* 800C0B7C 000BDABC 4B FF C9 C1 */ bl GetTRKConnected
|
||||
/* 800C0B80 000BDAC0 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 800C0B84 000BDAC4 40 82 00 0C */ bne .L_800C0B90
|
||||
/* 800C0B88 000BDAC8 38 60 00 01 */ li r3, 1
|
||||
/* 800C0B8C 000BDACC 48 00 00 64 */ b .L_800C0BF0
|
||||
.L_800C0B90:
|
||||
/* 800C0B90 000BDAD0 80 1F 00 00 */ lwz r0, 0(r31)
|
||||
/* 800C0B94 000BDAD4 7F C6 F3 78 */ mr r6, r30
|
||||
/* 800C0B98 000BDAD8 38 A1 00 08 */ addi r5, r1, 8
|
||||
/* 800C0B9C 000BDADC 38 60 00 D1 */ li r3, 0xd1
|
||||
/* 800C0BA0 000BDAE0 90 01 00 08 */ stw r0, 8(r1)
|
||||
/* 800C0BA4 000BDAE4 38 80 00 00 */ li r4, 0
|
||||
/* 800C0BA8 000BDAE8 4B FF EE 99 */ bl TRKAccessFile
|
||||
/* 800C0BAC 000BDAEC 54 60 06 3E */ clrlwi r0, r3, 0x18
|
||||
/* 800C0BB0 000BDAF0 80 61 00 08 */ lwz r3, 8(r1)
|
||||
/* 800C0BB4 000BDAF4 2C 00 00 01 */ cmpwi r0, 1
|
||||
/* 800C0BB8 000BDAF8 90 7F 00 00 */ stw r3, 0(r31)
|
||||
/* 800C0BBC 000BDAFC 41 82 00 30 */ beq .L_800C0BEC
|
||||
/* 800C0BC0 000BDB00 40 80 00 10 */ bge .L_800C0BD0
|
||||
/* 800C0BC4 000BDB04 2C 00 00 00 */ cmpwi r0, 0
|
||||
/* 800C0BC8 000BDB08 40 80 00 14 */ bge .L_800C0BDC
|
||||
/* 800C0BCC 000BDB0C 48 00 00 20 */ b .L_800C0BEC
|
||||
.L_800C0BD0:
|
||||
/* 800C0BD0 000BDB10 2C 00 00 03 */ cmpwi r0, 3
|
||||
/* 800C0BD4 000BDB14 40 80 00 18 */ bge .L_800C0BEC
|
||||
/* 800C0BD8 000BDB18 48 00 00 0C */ b .L_800C0BE4
|
||||
.L_800C0BDC:
|
||||
/* 800C0BDC 000BDB1C 38 60 00 00 */ li r3, 0
|
||||
/* 800C0BE0 000BDB20 48 00 00 10 */ b .L_800C0BF0
|
||||
.L_800C0BE4:
|
||||
/* 800C0BE4 000BDB24 38 60 00 02 */ li r3, 2
|
||||
/* 800C0BE8 000BDB28 48 00 00 08 */ b .L_800C0BF0
|
||||
.L_800C0BEC:
|
||||
/* 800C0BEC 000BDB2C 38 60 00 01 */ li r3, 1
|
||||
.L_800C0BF0:
|
||||
/* 800C0BF0 000BDB30 80 01 00 24 */ lwz r0, 0x24(r1)
|
||||
/* 800C0BF4 000BDB34 83 E1 00 1C */ lwz r31, 0x1c(r1)
|
||||
/* 800C0BF8 000BDB38 83 C1 00 18 */ lwz r30, 0x18(r1)
|
||||
/* 800C0BFC 000BDB3C 7C 08 03 A6 */ mtlr r0
|
||||
/* 800C0C00 000BDB40 38 21 00 20 */ addi r1, r1, 0x20
|
||||
/* 800C0C04 000BDB44 4E 80 00 20 */ blr
|
||||
.endfn __read_console
|
@ -1,253 +0,0 @@
|
||||
.include "macros.inc"
|
||||
.section .rodata # 0x804732E0 - 0x8049E220
|
||||
.balign 8
|
||||
.obj lbl_80479740, local
|
||||
.asciz "TRK_Packet_Header \t %ld bytes\n"
|
||||
.endobj lbl_80479740
|
||||
.balign 4
|
||||
.obj lbl_80479764, local
|
||||
.asciz "TRK_CMD_ReadMemory %ld bytes\n"
|
||||
.endobj lbl_80479764
|
||||
.balign 4
|
||||
.obj lbl_80479788, local
|
||||
.asciz "TRK_CMD_WriteMemory %ld bytes\n"
|
||||
.endobj lbl_80479788
|
||||
.balign 4
|
||||
.obj lbl_804797AC, local
|
||||
.asciz "TRK_CMD_Connect \t %ld bytes\n"
|
||||
.endobj lbl_804797AC
|
||||
.balign 4
|
||||
.obj lbl_804797CC, local
|
||||
.asciz "TRK_CMD_ReplyAck\t %ld bytes\n"
|
||||
.endobj lbl_804797CC
|
||||
.balign 4
|
||||
.obj lbl_804797EC, local
|
||||
.asciz "TRK_CMD_ReadRegisters\t%ld bytes\n"
|
||||
.endobj lbl_804797EC
|
||||
.balign 4
|
||||
.obj lbl_80479810, local
|
||||
.asciz "TestForPacket : FreeBuffer is %ld\n"
|
||||
.endobj lbl_80479810
|
||||
.balign 4
|
||||
.obj lbl_80479834, local
|
||||
.asciz "Reading payload %ld bytes\n"
|
||||
.endobj lbl_80479834
|
||||
.balign 4
|
||||
.obj lbl_80479850, local
|
||||
.asciz "TestForPacket : Invalid size of packet hdr.size\n"
|
||||
.endobj lbl_80479850
|
||||
.balign 4
|
||||
.obj lbl_80479884, local
|
||||
.asciz "TestForPacket : Invalid size of packet\n"
|
||||
.endobj lbl_80479884
|
||||
.balign 4
|
||||
.obj lbl_804798AC, local
|
||||
.asciz "TestForPacket returning %ld\n"
|
||||
.endobj lbl_804798AC
|
||||
|
||||
.section .bss # 0x804EFC20 - 0x8051467C
|
||||
.obj gTRKFramingState, local
|
||||
.skip 0x14
|
||||
.endobj gTRKFramingState
|
||||
|
||||
.section .sbss # 0x80514D80 - 0x80516360
|
||||
.balign 8
|
||||
.obj gTRKInputPendingPtr, global
|
||||
.skip 0x4
|
||||
.endobj gTRKInputPendingPtr
|
||||
|
||||
.section .text, "ax" # 0x800056C0 - 0x80472F00
|
||||
.fn TRKTerminateSerialHandler, global
|
||||
/* 800BC0C8 000B9008 38 60 00 00 */ li r3, 0
|
||||
/* 800BC0CC 000B900C 4E 80 00 20 */ blr
|
||||
.endfn TRKTerminateSerialHandler
|
||||
|
||||
.fn TRKInitializeSerialHandler, global
|
||||
/* 800BC0D0 000B9010 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 800BC0D4 000B9014 7C 08 02 A6 */ mflr r0
|
||||
/* 800BC0D8 000B9018 3C 60 80 4F */ lis r3, gTRKFramingState@ha
|
||||
/* 800BC0DC 000B901C 3C 80 80 48 */ lis r4, lbl_80479740@ha
|
||||
/* 800BC0E0 000B9020 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 800BC0E4 000B9024 38 C3 42 60 */ addi r6, r3, gTRKFramingState@l
|
||||
/* 800BC0E8 000B9028 38 00 00 00 */ li r0, 0
|
||||
/* 800BC0EC 000B902C 38 60 FF FF */ li r3, -1
|
||||
/* 800BC0F0 000B9030 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 800BC0F4 000B9034 3B E4 97 40 */ addi r31, r4, lbl_80479740@l
|
||||
/* 800BC0F8 000B9038 38 9F 00 00 */ addi r4, r31, 0
|
||||
/* 800BC0FC 000B903C 38 A0 00 40 */ li r5, 0x40
|
||||
/* 800BC100 000B9040 90 66 00 00 */ stw r3, 0(r6)
|
||||
/* 800BC104 000B9044 38 60 00 01 */ li r3, 1
|
||||
/* 800BC108 000B9048 90 06 00 08 */ stw r0, 8(r6)
|
||||
/* 800BC10C 000B904C 90 06 00 0C */ stw r0, 0xc(r6)
|
||||
/* 800BC110 000B9050 4C C6 31 82 */ crclr 6
|
||||
/* 800BC114 000B9054 48 00 54 35 */ bl MWTRACE
|
||||
/* 800BC118 000B9058 38 9F 00 24 */ addi r4, r31, 0x24
|
||||
/* 800BC11C 000B905C 38 60 00 01 */ li r3, 1
|
||||
/* 800BC120 000B9060 38 A0 00 40 */ li r5, 0x40
|
||||
/* 800BC124 000B9064 4C C6 31 82 */ crclr 6
|
||||
/* 800BC128 000B9068 48 00 54 21 */ bl MWTRACE
|
||||
/* 800BC12C 000B906C 38 9F 00 48 */ addi r4, r31, 0x48
|
||||
/* 800BC130 000B9070 38 60 00 01 */ li r3, 1
|
||||
/* 800BC134 000B9074 38 A0 00 40 */ li r5, 0x40
|
||||
/* 800BC138 000B9078 4C C6 31 82 */ crclr 6
|
||||
/* 800BC13C 000B907C 48 00 54 0D */ bl MWTRACE
|
||||
/* 800BC140 000B9080 38 9F 00 6C */ addi r4, r31, 0x6c
|
||||
/* 800BC144 000B9084 38 60 00 01 */ li r3, 1
|
||||
/* 800BC148 000B9088 38 A0 00 40 */ li r5, 0x40
|
||||
/* 800BC14C 000B908C 4C C6 31 82 */ crclr 6
|
||||
/* 800BC150 000B9090 48 00 53 F9 */ bl MWTRACE
|
||||
/* 800BC154 000B9094 38 9F 00 8C */ addi r4, r31, 0x8c
|
||||
/* 800BC158 000B9098 38 60 00 01 */ li r3, 1
|
||||
/* 800BC15C 000B909C 38 A0 00 40 */ li r5, 0x40
|
||||
/* 800BC160 000B90A0 4C C6 31 82 */ crclr 6
|
||||
/* 800BC164 000B90A4 48 00 53 E5 */ bl MWTRACE
|
||||
/* 800BC168 000B90A8 38 9F 00 AC */ addi r4, r31, 0xac
|
||||
/* 800BC16C 000B90AC 38 60 00 01 */ li r3, 1
|
||||
/* 800BC170 000B90B0 38 A0 00 40 */ li r5, 0x40
|
||||
/* 800BC174 000B90B4 4C C6 31 82 */ crclr 6
|
||||
/* 800BC178 000B90B8 48 00 53 D1 */ bl MWTRACE
|
||||
/* 800BC17C 000B90BC 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 800BC180 000B90C0 38 60 00 00 */ li r3, 0
|
||||
/* 800BC184 000B90C4 83 E1 00 0C */ lwz r31, 0xc(r1)
|
||||
/* 800BC188 000B90C8 7C 08 03 A6 */ mtlr r0
|
||||
/* 800BC18C 000B90CC 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 800BC190 000B90D0 4E 80 00 20 */ blr
|
||||
.endfn TRKInitializeSerialHandler
|
||||
|
||||
.fn TRKProcessInput, global
|
||||
/* 800BC194 000B90D4 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||||
/* 800BC198 000B90D8 7C 08 02 A6 */ mflr r0
|
||||
/* 800BC19C 000B90DC 38 80 00 02 */ li r4, 2
|
||||
/* 800BC1A0 000B90E0 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
/* 800BC1A4 000B90E4 93 E1 00 1C */ stw r31, 0x1c(r1)
|
||||
/* 800BC1A8 000B90E8 7C 7F 1B 78 */ mr r31, r3
|
||||
/* 800BC1AC 000B90EC 38 61 00 08 */ addi r3, r1, 8
|
||||
/* 800BC1B0 000B90F0 4B FF F2 FD */ bl TRKConstructEvent
|
||||
/* 800BC1B4 000B90F4 3C 60 80 4F */ lis r3, gTRKFramingState@ha
|
||||
/* 800BC1B8 000B90F8 38 00 FF FF */ li r0, -1
|
||||
/* 800BC1BC 000B90FC 38 83 42 60 */ addi r4, r3, gTRKFramingState@l
|
||||
/* 800BC1C0 000B9100 93 E1 00 10 */ stw r31, 0x10(r1)
|
||||
/* 800BC1C4 000B9104 38 61 00 08 */ addi r3, r1, 8
|
||||
/* 800BC1C8 000B9108 90 04 00 00 */ stw r0, 0(r4)
|
||||
/* 800BC1CC 000B910C 4B FF F2 F9 */ bl TRKPostEvent
|
||||
/* 800BC1D0 000B9110 80 01 00 24 */ lwz r0, 0x24(r1)
|
||||
/* 800BC1D4 000B9114 83 E1 00 1C */ lwz r31, 0x1c(r1)
|
||||
/* 800BC1D8 000B9118 7C 08 03 A6 */ mtlr r0
|
||||
/* 800BC1DC 000B911C 38 21 00 20 */ addi r1, r1, 0x20
|
||||
/* 800BC1E0 000B9120 4E 80 00 20 */ blr
|
||||
.endfn TRKProcessInput
|
||||
|
||||
.fn TRKGetInput, global
|
||||
/* 800BC1E4 000B9124 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||||
/* 800BC1E8 000B9128 7C 08 02 A6 */ mflr r0
|
||||
/* 800BC1EC 000B912C 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
/* 800BC1F0 000B9130 93 E1 00 1C */ stw r31, 0x1c(r1)
|
||||
/* 800BC1F4 000B9134 48 00 00 51 */ bl TRKTestForPacket
|
||||
/* 800BC1F8 000B9138 7C 7F 1B 78 */ mr r31, r3
|
||||
/* 800BC1FC 000B913C 2C 1F FF FF */ cmpwi r31, -1
|
||||
/* 800BC200 000B9140 41 82 00 30 */ beq .L_800BC230
|
||||
/* 800BC204 000B9144 4B FF FD 5D */ bl TRKGetBuffer
|
||||
/* 800BC208 000B9148 38 61 00 08 */ addi r3, r1, 8
|
||||
/* 800BC20C 000B914C 38 80 00 02 */ li r4, 2
|
||||
/* 800BC210 000B9150 4B FF F2 9D */ bl TRKConstructEvent
|
||||
/* 800BC214 000B9154 3C 60 80 4F */ lis r3, gTRKFramingState@ha
|
||||
/* 800BC218 000B9158 38 00 FF FF */ li r0, -1
|
||||
/* 800BC21C 000B915C 38 83 42 60 */ addi r4, r3, gTRKFramingState@l
|
||||
/* 800BC220 000B9160 93 E1 00 10 */ stw r31, 0x10(r1)
|
||||
/* 800BC224 000B9164 38 61 00 08 */ addi r3, r1, 8
|
||||
/* 800BC228 000B9168 90 04 00 00 */ stw r0, 0(r4)
|
||||
/* 800BC22C 000B916C 4B FF F2 99 */ bl TRKPostEvent
|
||||
.L_800BC230:
|
||||
/* 800BC230 000B9170 80 01 00 24 */ lwz r0, 0x24(r1)
|
||||
/* 800BC234 000B9174 83 E1 00 1C */ lwz r31, 0x1c(r1)
|
||||
/* 800BC238 000B9178 7C 08 03 A6 */ mtlr r0
|
||||
/* 800BC23C 000B917C 38 21 00 20 */ addi r1, r1, 0x20
|
||||
/* 800BC240 000B9180 4E 80 00 20 */ blr
|
||||
.endfn TRKGetInput
|
||||
|
||||
.fn TRKTestForPacket, global
|
||||
/* 800BC244 000B9184 94 21 F7 20 */ stwu r1, -0x8e0(r1)
|
||||
/* 800BC248 000B9188 7C 08 02 A6 */ mflr r0
|
||||
/* 800BC24C 000B918C 3C 60 80 48 */ lis r3, lbl_80479740@ha
|
||||
/* 800BC250 000B9190 90 01 08 E4 */ stw r0, 0x8e4(r1)
|
||||
/* 800BC254 000B9194 93 E1 08 DC */ stw r31, 0x8dc(r1)
|
||||
/* 800BC258 000B9198 3B E3 97 40 */ addi r31, r3, lbl_80479740@l
|
||||
/* 800BC25C 000B919C 93 C1 08 D8 */ stw r30, 0x8d8(r1)
|
||||
/* 800BC260 000B91A0 48 00 43 F1 */ bl TRKPollUART
|
||||
/* 800BC264 000B91A4 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 800BC268 000B91A8 41 81 00 0C */ bgt .L_800BC274
|
||||
/* 800BC26C 000B91AC 38 60 FF FF */ li r3, -1
|
||||
/* 800BC270 000B91B0 48 00 00 F8 */ b .L_800BC368
|
||||
.L_800BC274:
|
||||
/* 800BC274 000B91B4 38 61 00 0C */ addi r3, r1, 0xc
|
||||
/* 800BC278 000B91B8 38 81 00 08 */ addi r4, r1, 8
|
||||
/* 800BC27C 000B91BC 4B FF FD 11 */ bl TRKGetFreeBuffer
|
||||
/* 800BC280 000B91C0 7C 7E 1B 78 */ mr r30, r3
|
||||
/* 800BC284 000B91C4 38 9F 00 D0 */ addi r4, r31, 0xd0
|
||||
/* 800BC288 000B91C8 38 60 00 04 */ li r3, 4
|
||||
/* 800BC28C 000B91CC 7F C5 F3 78 */ mr r5, r30
|
||||
/* 800BC290 000B91D0 4C C6 31 82 */ crclr 6
|
||||
/* 800BC294 000B91D4 48 00 52 B5 */ bl MWTRACE
|
||||
/* 800BC298 000B91D8 80 61 00 08 */ lwz r3, 8(r1)
|
||||
/* 800BC29C 000B91DC 38 80 00 00 */ li r4, 0
|
||||
/* 800BC2A0 000B91E0 4B FF FB ED */ bl TRKSetBufferPosition
|
||||
/* 800BC2A4 000B91E4 38 61 00 10 */ addi r3, r1, 0x10
|
||||
/* 800BC2A8 000B91E8 38 80 00 40 */ li r4, 0x40
|
||||
/* 800BC2AC 000B91EC 48 00 43 69 */ bl TRKReadUARTN
|
||||
/* 800BC2B0 000B91F0 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 800BC2B4 000B91F4 40 82 00 80 */ bne .L_800BC334
|
||||
/* 800BC2B8 000B91F8 80 61 00 08 */ lwz r3, 8(r1)
|
||||
/* 800BC2BC 000B91FC 38 81 00 10 */ addi r4, r1, 0x10
|
||||
/* 800BC2C0 000B9200 38 A0 00 40 */ li r5, 0x40
|
||||
/* 800BC2C4 000B9204 4B FF F9 35 */ bl TRKAppendBuffer_ui8
|
||||
/* 800BC2C8 000B9208 80 61 00 10 */ lwz r3, 0x10(r1)
|
||||
/* 800BC2CC 000B920C 83 C1 00 0C */ lwz r30, 0xc(r1)
|
||||
/* 800BC2D0 000B9210 34 A3 FF C0 */ addic. r5, r3, -64
|
||||
/* 800BC2D4 000B9214 40 81 00 7C */ ble .L_800BC350
|
||||
/* 800BC2D8 000B9218 38 9F 00 F4 */ addi r4, r31, 0xf4
|
||||
/* 800BC2DC 000B921C 38 60 00 01 */ li r3, 1
|
||||
/* 800BC2E0 000B9220 4C C6 31 82 */ crclr 6
|
||||
/* 800BC2E4 000B9224 48 00 52 65 */ bl MWTRACE
|
||||
/* 800BC2E8 000B9228 80 81 00 10 */ lwz r4, 0x10(r1)
|
||||
/* 800BC2EC 000B922C 38 61 00 50 */ addi r3, r1, 0x50
|
||||
/* 800BC2F0 000B9230 38 84 FF C0 */ addi r4, r4, -64
|
||||
/* 800BC2F4 000B9234 48 00 43 21 */ bl TRKReadUARTN
|
||||
/* 800BC2F8 000B9238 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 800BC2FC 000B923C 40 82 00 18 */ bne .L_800BC314
|
||||
/* 800BC300 000B9240 80 61 00 08 */ lwz r3, 8(r1)
|
||||
/* 800BC304 000B9244 38 81 00 50 */ addi r4, r1, 0x50
|
||||
/* 800BC308 000B9248 80 A1 00 10 */ lwz r5, 0x10(r1)
|
||||
/* 800BC30C 000B924C 4B FF F8 ED */ bl TRKAppendBuffer_ui8
|
||||
/* 800BC310 000B9250 48 00 00 40 */ b .L_800BC350
|
||||
.L_800BC314:
|
||||
/* 800BC314 000B9254 38 9F 01 10 */ addi r4, r31, 0x110
|
||||
/* 800BC318 000B9258 38 60 00 08 */ li r3, 8
|
||||
/* 800BC31C 000B925C 4C C6 31 82 */ crclr 6
|
||||
/* 800BC320 000B9260 48 00 52 29 */ bl MWTRACE
|
||||
/* 800BC324 000B9264 7F C3 F3 78 */ mr r3, r30
|
||||
/* 800BC328 000B9268 4B FF FB D5 */ bl TRKReleaseBuffer
|
||||
/* 800BC32C 000B926C 3B C0 FF FF */ li r30, -1
|
||||
/* 800BC330 000B9270 48 00 00 20 */ b .L_800BC350
|
||||
.L_800BC334:
|
||||
/* 800BC334 000B9274 38 9F 01 44 */ addi r4, r31, 0x144
|
||||
/* 800BC338 000B9278 38 60 00 08 */ li r3, 8
|
||||
/* 800BC33C 000B927C 4C C6 31 82 */ crclr 6
|
||||
/* 800BC340 000B9280 48 00 52 09 */ bl MWTRACE
|
||||
/* 800BC344 000B9284 7F C3 F3 78 */ mr r3, r30
|
||||
/* 800BC348 000B9288 4B FF FB B5 */ bl TRKReleaseBuffer
|
||||
/* 800BC34C 000B928C 3B C0 FF FF */ li r30, -1
|
||||
.L_800BC350:
|
||||
/* 800BC350 000B9290 7F C5 F3 78 */ mr r5, r30
|
||||
/* 800BC354 000B9294 38 9F 01 6C */ addi r4, r31, 0x16c
|
||||
/* 800BC358 000B9298 38 60 00 01 */ li r3, 1
|
||||
/* 800BC35C 000B929C 4C C6 31 82 */ crclr 6
|
||||
/* 800BC360 000B92A0 48 00 51 E9 */ bl MWTRACE
|
||||
/* 800BC364 000B92A4 7F C3 F3 78 */ mr r3, r30
|
||||
.L_800BC368:
|
||||
/* 800BC368 000B92A8 80 01 08 E4 */ lwz r0, 0x8e4(r1)
|
||||
/* 800BC36C 000B92AC 83 E1 08 DC */ lwz r31, 0x8dc(r1)
|
||||
/* 800BC370 000B92B0 83 C1 08 D8 */ lwz r30, 0x8d8(r1)
|
||||
/* 800BC374 000B92B4 7C 08 03 A6 */ mtlr r0
|
||||
/* 800BC378 000B92B8 38 21 08 E0 */ addi r1, r1, 0x8e0
|
||||
/* 800BC37C 000B92BC 4E 80 00 20 */ blr
|
||||
.endfn TRKTestForPacket
|
24
configure.py
24
configure.py
@ -431,10 +431,14 @@ LIBS = [
|
||||
],
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/msg", True],
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/msgbuf",
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/serpoll",
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/serpoll", True],
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/usr_put", True],
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/dispatch", True],
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/msghndlr",
|
||||
[
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/msghndlr",
|
||||
False,
|
||||
{"cflags": "$cflags_base -inline deferred -sdata 0 -sdata2 0"},
|
||||
],
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/support",
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/mutex_TRK", True],
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/notify", True],
|
||||
@ -446,22 +450,30 @@ LIBS = [
|
||||
True,
|
||||
{"cflags": "$cflags_base -inline deferred -func_align 32"},
|
||||
],
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/mpc_7xx_603e",
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/mpc_7xx_603e", True],
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/__exception",
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk",
|
||||
[
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk",
|
||||
False,
|
||||
{"cflags": "$cflags_base -inline deferred -sdata 0"},
|
||||
],
|
||||
[
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/main_TRK",
|
||||
True,
|
||||
{"cflags": "$cflags_base -inline deferred -sdata 0"},
|
||||
],
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk_glue",
|
||||
[
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk_glue",
|
||||
False,
|
||||
{"cflags": "$cflags_base -inline deferred -sdata 0 -sdata2 0"},
|
||||
],
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/targcont", True],
|
||||
[
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/target_options",
|
||||
True,
|
||||
{"cflags": "$cflags_base -inline deferred -sdata 0"},
|
||||
],
|
||||
"Dolphin/TRK_MINNOW_DOLPHIN/mslsupp",
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/mslsupp", True],
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/UDP_Stubs", True],
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/ddh/main", True],
|
||||
["Dolphin/TRK_MINNOW_DOLPHIN/CircleBuffer", True],
|
||||
|
@ -19,12 +19,11 @@
|
||||
### <section id="Dolphin">Dolphin</section>
|
||||
| File | Size (bytes) | File | Size (bytes) |
|
||||
| ---- | ---- | ---- | ---- |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXGeometry.c">gx/GXGeometry.c</a> | 3891 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/mslsupp.c">TRK_MINNOW_DOLPHIN/mslsupp.c</a> | 4555 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/serpoll.c">TRK_MINNOW_DOLPHIN/serpoll.c</a> | 4793 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/mpc_7xx_603e.c">TRK_MINNOW_DOLPHIN/mpc_7xx_603e.c</a> | 5554 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/os/OSReboot.c">os/OSReboot.c</a> | 9133 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c">TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c</a> | 10320 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk.c">TRK_MINNOW_DOLPHIN/dolphin_trk.c</a> | 11230 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/support.c">TRK_MINNOW_DOLPHIN/support.c</a> | 12046 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTransform.c">gx/GXTransform.c</a> | 12884 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXLight.c">gx/GXLight.c</a> | 14727 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTev.c">gx/GXTev.c</a> | 15536 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXPixel.c">gx/GXPixel.c</a> | 15816 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXGeometry.c">gx/GXGeometry.c</a> | 3891 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/os/OSReboot.c">os/OSReboot.c</a> | 9133 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c">TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c</a> | 10620 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTransform.c">gx/GXTransform.c</a> | 12884 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/support.c">TRK_MINNOW_DOLPHIN/support.c</a> | 13669 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXLight.c">gx/GXLight.c</a> | 14727 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTev.c">gx/GXTev.c</a> | 15536 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk.c">TRK_MINNOW_DOLPHIN/dolphin_trk.c</a> | 15591 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXPixel.c">gx/GXPixel.c</a> | 15816 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXPerf.c">gx/GXPerf.c</a> | 17608 |
|
||||
|
||||
### <section id="JSystem">JSystem</section>
|
||||
| File | Size (bytes) | File | Size (bytes) |
|
||||
@ -32,8 +31,8 @@
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAS/JASTrackInterrupt.cpp">JAudio/JAS/JASTrackInterrupt.cpp</a> | 2030 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAS/JASInstRand.cpp">JAudio/JAS/JASInstRand.cpp</a> | 2292 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/object-id.cpp">JStudio/object-id.cpp</a> | 2697 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAS/JASInstSense.cpp">JAudio/JAS/JASInstSense.cpp</a> | 3632 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio_JAudio/control.cpp">JStudio_JAudio/control.cpp</a> | 3648 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAS/JASCmdStack.cpp">JAudio/JAS/JASCmdStack.cpp</a> | 3709 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3DU/J3DUMtxCache.cpp">J3DU/J3DUMtxCache.cpp</a> | 3962 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAS/JASSeqCtrl.cpp">JAudio/JAS/JASSeqCtrl.cpp</a> | 4524 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialAnm.cpp">J3D/J3DMaterialAnm.cpp</a> | 4846 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JGadget/linklist.cpp">JGadget/linklist.cpp</a> | 5250 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3DU/J3DUMtxCache.cpp">J3DU/J3DUMtxCache.cpp</a> | 3962 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JGadget/linklist.cpp">JGadget/linklist.cpp</a> | 4370 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAS/JASSeqCtrl.cpp">JAudio/JAS/JASSeqCtrl.cpp</a> | 4524 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialAnm.cpp">J3D/J3DMaterialAnm.cpp</a> | 4846 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAU/JAUData.cpp">JAudio/JAU/JAUData.cpp</a> | 5463 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAI/JAISoundTable.cpp">JAudio/JAI/JAISoundTable.cpp</a> | 5690 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/dsp/dsptask.c">JAudio/dsp/dsptask.c</a> | 5880 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JGadget/std-list.cpp">JGadget/std-list.cpp</a> | 5990 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAudio/JAI/JAIFx.cpp">JAudio/JAI/JAIFx.cpp</a> | 6646 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DJointTree.cpp">J3D/J3DJointTree.cpp</a> | 6775 |
|
||||
|
@ -8,7 +8,7 @@ extern "C" {
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
// EXI callback function pointer type
|
||||
typedef void (*AmcEXICallback)(OSContext* context);
|
||||
typedef void (*AmcEXICallback)(s16 exception, OSContext* context);
|
||||
|
||||
// EXI error codes
|
||||
typedef enum {
|
||||
|
@ -114,10 +114,10 @@ void OSSetArenaHi(void* addr);
|
||||
void OSSetArenaLo(void* addr);
|
||||
|
||||
// targsupp
|
||||
extern void TRKAccessFile(void);
|
||||
extern void TRKOpenFile(void);
|
||||
extern void TRKCloseFile(void);
|
||||
extern void TRKPositionFile(void);
|
||||
extern u32 TRKAccessFile(u32, u32, u32*, u8*);
|
||||
extern u32 TRKOpenFile(u32, u32, u32*, u8*);
|
||||
extern u32 TRKCloseFile(u32, u32);
|
||||
extern u32 TRKPositionFile(u32, u32, u32*, u8*);
|
||||
|
||||
#define OS_SYS_CALL_HANDLER ((void*)0x80000C00)
|
||||
#define OS_HANDLER_SLOT_SIZE (0x100)
|
||||
|
242
include/PowerPC_EABI_Support/MetroTRK/ppc_reg.h
Normal file
242
include/PowerPC_EABI_Support/MetroTRK/ppc_reg.h
Normal file
@ -0,0 +1,242 @@
|
||||
#ifndef _PPC_REG_H
|
||||
#define _PPC_REG_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
typedef struct Default_PPC {
|
||||
u32 GPR[32];
|
||||
u32 PC;
|
||||
u32 LR;
|
||||
u32 CR;
|
||||
u32 CTR;
|
||||
u32 XER;
|
||||
} Default_PPC;
|
||||
|
||||
typedef struct Float_PPC {
|
||||
u64 FPR[32];
|
||||
u64 FPSCR;
|
||||
u64 FPECR;
|
||||
} Float_PPC;
|
||||
|
||||
typedef struct Extended1_PPC_6xx_7xx {
|
||||
u8 pad[0x168];
|
||||
// u32 SR[16];
|
||||
// u32 TBL;
|
||||
// u32 TBU;
|
||||
// u32 HID0;
|
||||
// u32 HID1;
|
||||
// u32 MSR;
|
||||
// u32 PVR;
|
||||
// u32 IBAT0U;
|
||||
// u32 IBAT0L;
|
||||
// u32 IBAT1U;
|
||||
// u32 IBAT1L;
|
||||
// u32 IBAT2U;
|
||||
// u32 IBAT2L;
|
||||
// u32 IBAT3U;
|
||||
// u32 IBAT3L;
|
||||
// u32 DBAT0U;
|
||||
// u32 DBAT0L;
|
||||
// u32 DBAT1U;
|
||||
// u32 DBAT1L;
|
||||
// u32 DBAT2U;
|
||||
// u32 DBAT2L;
|
||||
// u32 DBAT3U;
|
||||
// u32 DBAT3L;
|
||||
// u32 DMISS;
|
||||
// u32 DCMP;
|
||||
// u32 HASH1;
|
||||
// u32 HASH2;
|
||||
// u32 IMISS;
|
||||
// u32 ICMP;
|
||||
// u32 RPA;
|
||||
// u32 SDR1;
|
||||
// u32 DAR;
|
||||
// u32 DSISR;
|
||||
// u32 SPRG0;
|
||||
// u32 SPRG1;
|
||||
// u32 SPRG2;
|
||||
// u32 SPRG3;
|
||||
// u32 DEC;
|
||||
// u32 IABR;
|
||||
// u32 EAR;
|
||||
// u32 DABR;
|
||||
// u32 PMC1;
|
||||
// u32 PMC2;
|
||||
// u32 PMC3;
|
||||
// u32 PMC4;
|
||||
// u32 SIA;
|
||||
// u32 MMCR0;
|
||||
// u32 MMCR1;
|
||||
// u32 THRM1;
|
||||
// u32 THRM2;
|
||||
// u32 THRM3;
|
||||
// u32 ICTC;
|
||||
// u32 L2CR;
|
||||
// u32 UMMCR2;
|
||||
// u32 UBAMR;
|
||||
// u32 UMMCR0;
|
||||
// u32 UPMC1;
|
||||
// u32 UPMC2;
|
||||
// u32 USIA;
|
||||
// u32 UMMCR1;
|
||||
// u32 UPMC3;
|
||||
// u32 UPMC4;
|
||||
// u32 USDA;
|
||||
// u32 MMCR2;
|
||||
// u32 BAMR;
|
||||
// u32 SDA;
|
||||
// u32 MSSCR0;
|
||||
// u32 MSSCR1;
|
||||
// u32 PIR;
|
||||
// u32 exceptionID;
|
||||
// u32 GQR[8];
|
||||
// u32 HID_G;
|
||||
// u32 WPAR;
|
||||
// u32 DMA_U;
|
||||
// u32 DMA_L;
|
||||
} Extended1_PPC_6xx_7xx;
|
||||
|
||||
typedef struct Extended2_PPC_6xx_7xx {
|
||||
u32 PSR[32][2];
|
||||
} Extended2_PPC_6xx_7xx;
|
||||
|
||||
typedef struct ProcessorState_PPC_6xx_7xx {
|
||||
Default_PPC Default;
|
||||
Float_PPC Float;
|
||||
Extended1_PPC_6xx_7xx Extended1;
|
||||
Extended2_PPC_6xx_7xx Extended2;
|
||||
u32 transport_handler_saved_ra;
|
||||
} ProcessorState_PPC_6xx_7xx;
|
||||
|
||||
typedef ProcessorState_PPC_6xx_7xx ProcessorState_PPC;
|
||||
|
||||
#define SPR_XER 1
|
||||
#define SPR_LR 8
|
||||
#define SPR_CTR 9
|
||||
#define SPR_DSISR 18
|
||||
#define SPR_DAR 19
|
||||
#define SPR_DEC 22
|
||||
#define SPR_SDR1 25
|
||||
#define SPR_SRR0 26
|
||||
#define SPR_SRR1 27
|
||||
#define SPR_SPRG0 272
|
||||
#define SPR_SPRG1 273
|
||||
#define SPR_SPRG2 274
|
||||
#define SPR_SPRG3 275
|
||||
#define SPR_EAR 282
|
||||
#define SPR_TBL 284
|
||||
#define SPR_TBU 285
|
||||
#define SPR_PVR 287
|
||||
#define SPR_IBAT0U 528
|
||||
#define SPR_IBAT0L 529
|
||||
#define SPR_IBAT1U 530
|
||||
#define SPR_IBAT1L 531
|
||||
#define SPR_IBAT2U 532
|
||||
#define SPR_IBAT2L 533
|
||||
#define SPR_IBAT3U 534
|
||||
#define SPR_IBAT3L 535
|
||||
#define SPR_IBAT4U 560
|
||||
#define SPR_IBAT4L 561
|
||||
#define SPR_IBAT5U 562
|
||||
#define SPR_IBAT5L 563
|
||||
#define SPR_IBAT6U 564
|
||||
#define SPR_IBAT6L 565
|
||||
#define SPR_IBAT7U 566
|
||||
#define SPR_IBAT7L 567
|
||||
#define SPR_DBAT0U 536
|
||||
#define SPR_DBAT0L 537
|
||||
#define SPR_DBAT1U 538
|
||||
#define SPR_DBAT1L 539
|
||||
#define SPR_DBAT2U 540
|
||||
#define SPR_DBAT2L 541
|
||||
#define SPR_DBAT3U 542
|
||||
#define SPR_DBAT3L 543
|
||||
#define SPR_DBAT4U 568
|
||||
#define SPR_DBAT4L 569
|
||||
#define SPR_DBAT5U 570
|
||||
#define SPR_DBAT5L 571
|
||||
#define SPR_DBAT6U 572
|
||||
#define SPR_DBAT6L 573
|
||||
#define SPR_DBAT7U 574
|
||||
#define SPR_DBAT7L 575
|
||||
#define SPR_GQR0 912
|
||||
#define SPR_GQR1 913
|
||||
#define SPR_GQR2 914
|
||||
#define SPR_GQR3 915
|
||||
#define SPR_GQR4 916
|
||||
#define SPR_GQR5 917
|
||||
#define SPR_GQR6 918
|
||||
#define SPR_GQR7 919
|
||||
#define SPR_HID2 920
|
||||
#define SPR_WPAR 921
|
||||
#define SPR_DMA_U 922
|
||||
#define SPR_DMA_L 923
|
||||
#define SPR_UMMCR0 936
|
||||
#define SPR_UPMC1 937
|
||||
#define SPR_UPMC2 938
|
||||
#define SPR_USIA 939
|
||||
#define SPR_UMMCR1 940
|
||||
#define SPR_UPMC3 941
|
||||
#define SPR_UPMC4 942
|
||||
#define SPR_USDA 943
|
||||
#define SPR_MMCR0 952
|
||||
#define SPR_PMC1 953
|
||||
#define SPR_PMC2 954
|
||||
#define SPR_SIA 955
|
||||
#define SPR_MMCR1 956
|
||||
#define SPR_PMC3 957
|
||||
#define SPR_PMC4 958
|
||||
#define SPR_SDA 959
|
||||
#define SPR_HID0 1008
|
||||
#define SPR_HID1 1009
|
||||
#define SPR_IABR 1010
|
||||
#define SPR_HID4 1011
|
||||
#define SPR_DABR 1013
|
||||
#define SPR_L2CR 1017
|
||||
#define SPR_ICTC 1019
|
||||
#define SPR_THRM1 1020
|
||||
#define SPR_THRM2 1021
|
||||
#define SPR_FPECR 1022
|
||||
|
||||
// PPC exceptions
|
||||
// 0x000 is reserved
|
||||
#define PPC_SystemReset 0x100
|
||||
#define PPC_MachineCheck 0x200
|
||||
#define PPC_DataStorage 0x300
|
||||
#define PPC_InstructionStorage 0x400
|
||||
#define PPC_ExternalInterrupt 0x500
|
||||
#define PPC_Alignment 0x600
|
||||
#define PPC_Program 0x700
|
||||
#define PPC_FloatingPointUnavaiable 0x800
|
||||
#define PPC_Decrementer 0x900
|
||||
// 0xA00-0xB00 are reserved
|
||||
#define PPC_SystemCall 0xC00
|
||||
#define PPC_Trace 0xD00
|
||||
#define PPC_FloatingPointAssist 0xE00 // unimplemented in 750CL
|
||||
#define PPC_PerformanceMonitor 0xF00 // Dolphin/Broadway specific
|
||||
// 0x1000-0x1200 are unimplemented in 750CL
|
||||
#define PPC_InstructionAddressBreakpoint 0x1300 // Dolphin/Broadway specific
|
||||
// 0x1400-0x2F00 are reserved, but TRK uses some
|
||||
#define PPC_SystemManagementInterrupt 0x1400
|
||||
// 0x1500-0x1600 are unimplemented in 750CL
|
||||
#define PPC_ThermalManagementInterrupt 0x1700
|
||||
#define PPC_1800Exception 0x1800
|
||||
#define PPC_1900Exception 0x1900
|
||||
#define PPC_1A00Exception 0x1A00
|
||||
#define PPC_1B00Exception 0x1B00
|
||||
#define PPC_1C00Exception 0x1C00 // Data breakpoint?
|
||||
#define PPC_1D00Exception 0x1D00 // Instruction breakpoint?
|
||||
#define PPC_1E00Exception 0x1E00 // Peripheral breakpoint?
|
||||
#define PPC_1F00Exception 0x1F00 // Non maskable development port?
|
||||
#define PPC_2000Exception 0x2000
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
#endif
|
@ -2,34 +2,36 @@
|
||||
#define _DOLPHIN_TRK_H
|
||||
|
||||
#include "types.h"
|
||||
#include "Dolphin/db.h"
|
||||
#include "PowerPC_EABI_Support/MetroTRK/trktypes.h"
|
||||
#include "PowerPC_EABI_Support/MetroTRK/ppc_reg.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
////// MSG HANDLING FUNCTIONS //////
|
||||
u32 TRKDoConnect(MessageBuffer*);
|
||||
u32 TRKDoDisconnect(MessageBuffer*);
|
||||
u32 TRKDoReset(MessageBuffer*);
|
||||
u32 TRKDoVersions(MessageBuffer*);
|
||||
u32 TRKDoSupportMask(MessageBuffer*);
|
||||
u32 TRKDoOverride(MessageBuffer*);
|
||||
u32 TRKDoReadMemory(MessageBuffer*);
|
||||
u32 TRKDoWriteMemory(MessageBuffer*);
|
||||
u32 TRKDoReadRegisters(MessageBuffer*);
|
||||
u32 TRKDoWriteRegisters(MessageBuffer*);
|
||||
u32 TRKDoSetOption(MessageBuffer*);
|
||||
u32 TRKDoContinue(MessageBuffer*);
|
||||
u32 TRKDoStep(MessageBuffer*);
|
||||
u32 TRKDoStop(MessageBuffer*);
|
||||
DSError TRKDoConnect(MessageBuffer*);
|
||||
DSError TRKDoDisconnect(MessageBuffer*);
|
||||
DSError TRKDoReset(MessageBuffer*);
|
||||
DSError TRKDoVersions(MessageBuffer*);
|
||||
DSError TRKDoSupportMask(MessageBuffer*);
|
||||
DSError TRKDoOverride(MessageBuffer*);
|
||||
DSError TRKDoReadMemory(MessageBuffer*);
|
||||
DSError TRKDoWriteMemory(MessageBuffer*);
|
||||
DSError TRKDoReadRegisters(MessageBuffer*);
|
||||
DSError TRKDoWriteRegisters(MessageBuffer*);
|
||||
DSError TRKDoSetOption(MessageBuffer*);
|
||||
DSError TRKDoContinue(MessageBuffer*);
|
||||
DSError TRKDoStep(MessageBuffer*);
|
||||
DSError TRKDoStop(MessageBuffer*);
|
||||
|
||||
void SetBufferPosition(MessageBuffer*, u32);
|
||||
void SetTRKConnected(u32);
|
||||
u32 GetTRKConnected(void);
|
||||
void SetTRKConnected(int);
|
||||
int GetTRKConnected(void);
|
||||
|
||||
DSError TRKGetFreeBuffer(int*, MessageBuffer**);
|
||||
void OutputData(void* data, int length);
|
||||
void TRKResetBuffer(MessageBuffer* msg, BOOL keepData);
|
||||
////////////////////////////////////
|
||||
|
||||
/////// DOLPHIN TRK FUNCTIONS //////
|
||||
@ -37,16 +39,61 @@ void InitMetroTRK(void);
|
||||
void InitMetroTRK_BBA(void);
|
||||
void EnableMetroTRKInterrupts(void);
|
||||
|
||||
void TRKLoadContext(OSContext* ctx, u32);
|
||||
void TRKSaveExtended1Block();
|
||||
void TRKRestoreExtended1Block();
|
||||
int InitMetroTRKCommTable(int);
|
||||
void TRK_board_display(char*);
|
||||
////////////////////////////////////
|
||||
|
||||
////////// GDEV FUNCTIONS //////////
|
||||
// int gdev_cc_initialize(void* flagOut, __OSInterruptHandler handler);
|
||||
// int gdev_cc_shutdown();
|
||||
// int gdev_cc_open();
|
||||
// int gdev_cc_close();
|
||||
// int gdev_cc_read(u8* dest, int size);
|
||||
// int gdev_cc_write(const u8* src, int size);
|
||||
// int gdev_cc_pre_continue();
|
||||
// int gdev_cc_post_stop();
|
||||
// int gdev_cc_peek();
|
||||
// int gdev_cc_initinterrupts();
|
||||
////////////////////////////////////
|
||||
|
||||
/////////// UDP FUNCTIONS //////////
|
||||
int udp_cc_initialize(void* flagOut, __OSInterruptHandler handler);
|
||||
int udp_cc_shutdown();
|
||||
int udp_cc_open();
|
||||
int udp_cc_close();
|
||||
int udp_cc_read(u8* dest, int size);
|
||||
int udp_cc_write(const u8* src, int size);
|
||||
int udp_cc_pre_continue();
|
||||
int udp_cc_post_stop();
|
||||
int udp_cc_peek();
|
||||
int udp_cc_initinterrupts();
|
||||
////////////////////////////////////
|
||||
|
||||
/////////// DDH FUNCTIONS //////////
|
||||
// int ddh_cc_initialize(void* flagOut, __OSInterruptHandler handler);
|
||||
// int ddh_cc_shutdown();
|
||||
// int ddh_cc_open();
|
||||
// int ddh_cc_close();
|
||||
// int ddh_cc_read(u8* dest, int size);
|
||||
// int ddh_cc_write(const u8* src, int size);
|
||||
// int ddh_cc_pre_continue();
|
||||
// int ddh_cc_post_stop();
|
||||
// int ddh_cc_peek();
|
||||
// int ddh_cc_initinterrupts();
|
||||
////////////////////////////////////
|
||||
|
||||
////////// EVENT FUNCTIONS /////////
|
||||
void TRKDestructEvent(TRKEvent*);
|
||||
void TRKConstructEvent(TRKEvent* event, int eventType);
|
||||
void TRKDestructEvent(TRKEvent* event);
|
||||
DSError TRKPostEvent(TRKEvent* event);
|
||||
BOOL TRKGetNextEvent(TRKEvent* event);
|
||||
DSError TRKDispatchMessage(MessageBuffer*);
|
||||
void* TRKGetBuffer(int);
|
||||
void TRKReleaseBuffer(int);
|
||||
void TRKGetInput();
|
||||
BOOL TRKGetNextEvent(TRKEvent*);
|
||||
////////////////////////////////////
|
||||
|
||||
///////// TARGET FUNCTIONS /////////
|
||||
@ -58,12 +105,11 @@ DSError TRKTargetSupportRequest();
|
||||
////////////////////////////////////
|
||||
|
||||
////// NUB AND MEM FUNCTIONS ///////
|
||||
DSError TRKAppendBuffer_ui8(MessageBuffer*, u8*, int);
|
||||
DSError TRKAppendBuffer_ui8(MessageBuffer*, const u8*, int);
|
||||
DSError TRKSetBufferPosition(MessageBuffer*, u32);
|
||||
|
||||
DSError TRKMessageSend(MessageBuffer*);
|
||||
void TRKSwapAndGo(void);
|
||||
DSError TRKWriteUARTN(const void* bytes, u32 length);
|
||||
DSError TRKInitializeNub(void);
|
||||
DSError TRKTerminateNub(void);
|
||||
void TRKNubWelcome(void);
|
||||
@ -97,11 +143,16 @@ void MWTRACE(u8, char*, ...);
|
||||
|
||||
//////// SUPPORT FUNCTIONS /////////
|
||||
DSError TRKRequestSend();
|
||||
u32 TRKAccessFile(u32, u32, u32*, u8*);
|
||||
////////////////////////////////////
|
||||
|
||||
////////// OTHER FUNCTIONS /////////
|
||||
DSError TRK_main(void);
|
||||
UARTError InitializeUART(UARTBaudRate baudRate);
|
||||
DSError TRKInitializeIntDrivenUART(unknown, unknown, unknown, void*);
|
||||
DSError TRKInitializeIntDrivenUART(u32, u32, u32, void*);
|
||||
int TRKPollUART();
|
||||
UARTError TRKReadUARTN(void*, u32);
|
||||
UARTError TRKWriteUARTN(const void* bytes, u32 length);
|
||||
void usr_put_initialize();
|
||||
void TRKTargetSetInputPendingPtr(void*);
|
||||
void SetUseSerialIO(u8);
|
||||
@ -109,11 +160,31 @@ u8 GetUseSerialIO(void);
|
||||
|
||||
DSError TRKTargetAddStopInfo(MessageBuffer*);
|
||||
void TRKTargetAddExceptionInfo(MessageBuffer*);
|
||||
void TRKInterruptHandler();
|
||||
BOOL usr_puts_serial(const char* msg);
|
||||
////////////////////////////////////
|
||||
|
||||
//////// EXTERNAL DECLARES /////////
|
||||
extern BOOL gTRKBigEndian;
|
||||
extern void* gTRKInputPendingPtr;
|
||||
extern ProcessorState_PPC gTRKCPUState;
|
||||
extern ProcessorRestoreFlags_PPC gTRKRestoreFlags;
|
||||
extern u8 gTRKInterruptVectorTable[];
|
||||
extern TRKState gTRKState;
|
||||
extern MessageBuffer gTRKMsgBufs[3];
|
||||
////////////////////////////////////
|
||||
|
||||
////////// USEFUL STATICS //////////
|
||||
static inline DSError TRKAppendBuffer1_ui8(MessageBuffer* buffer, const u8 data)
|
||||
{
|
||||
if (buffer->position >= 0x880) {
|
||||
return DS_MessageBufferOverflow;
|
||||
}
|
||||
|
||||
buffer->data[buffer->position++] = data;
|
||||
buffer->length++;
|
||||
return DS_NoError;
|
||||
}
|
||||
////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -10,9 +10,9 @@ extern "C" {
|
||||
//////////// TRK ENUMS /////////////
|
||||
// Hardware types.
|
||||
typedef enum {
|
||||
HARDWARE_GDEV = 0,
|
||||
HARDWARE_NDEV = 1,
|
||||
HARDWARE_BBA = 2,
|
||||
HARDWARE_AMC_DDH = 0,
|
||||
HARDWARE_GDEV = 1,
|
||||
HARDWARE_BBA = 2,
|
||||
} HardwareType;
|
||||
|
||||
// DS Error returns.
|
||||
@ -129,6 +129,13 @@ typedef enum {
|
||||
DSREPLY_DebugSecurityError = 0x23,
|
||||
} DSReplyError;
|
||||
|
||||
typedef enum {
|
||||
DSRECV_Wait = 0,
|
||||
DSRECV_Found = 1,
|
||||
DSRECV_InFrame = 2,
|
||||
DSRECV_FrameOverflow = 3,
|
||||
} ReceiverState;
|
||||
|
||||
typedef enum {
|
||||
NUBEVENT_Null = 0,
|
||||
NUBEVENT_Shutdown = 1,
|
||||
|
@ -30,8 +30,8 @@ typedef int UARTError;
|
||||
|
||||
// Struct for sending and receiving messages (size 0x88C).
|
||||
typedef struct MessageBuffer {
|
||||
BOOL isInUse; // _00
|
||||
u32 _04; // _04, might be swapped with _00
|
||||
u32 _00; // _00, unknown
|
||||
BOOL isInUse; // _04
|
||||
u32 length; // _08
|
||||
u32 position; // _0C
|
||||
u8 data[TRKMSGBUF_SIZE]; // _0C
|
||||
@ -65,14 +65,28 @@ typedef struct TRKPacketSeq {
|
||||
u8 _02[6]; // _02, unknown
|
||||
} TRKPacketSeq;
|
||||
|
||||
// Struct for receiving packets from serial poll (size 0x14).
|
||||
typedef struct TRKFramingState {
|
||||
MessageBufferID msgBufID; // _00
|
||||
MessageBuffer* buffer; // _04
|
||||
ReceiverState receiveState; // _08
|
||||
BOOL isEscape; // _0C
|
||||
u8 fcsType; // _10
|
||||
} TRKFramingState;
|
||||
|
||||
// Command reply information (size 0x40).
|
||||
typedef struct CommandReply {
|
||||
u32 _00; // _00
|
||||
u8 commandID; // _04, use MessageCommandID enum - should be enum type?
|
||||
u8 replyError; // _05, use DSReplyError enum - should be enum type? check size.
|
||||
u32 _08; // _08, unsure if this should be here or be one of the above
|
||||
u32 _0C; // _0C
|
||||
u8 _10[0x30]; // _10, unknown
|
||||
u32 _00; // _00
|
||||
union {
|
||||
u8 b;
|
||||
MessageCommandID m;
|
||||
} commandID; // _04, use MessageCommandID enum
|
||||
union {
|
||||
u8 b;
|
||||
DSReplyError r;
|
||||
} replyError; // _08, use DSReplyError enum - should be enum type? check size.
|
||||
u32 _0C; // _0C
|
||||
u8 _10[0x30]; // _10, unknown
|
||||
} CommandReply;
|
||||
|
||||
// Nub event information (size 0xC).
|
||||
@ -93,52 +107,40 @@ typedef struct TRKEventQueue {
|
||||
|
||||
// Struct for state information (size 0xB0).
|
||||
typedef struct TRKState {
|
||||
u32 _00; // _00
|
||||
u32 _04; // _04
|
||||
u32 _08; // _08
|
||||
u32 _0C; // _0C
|
||||
u32 _10; // _10
|
||||
u32 _14; // _14
|
||||
u32 _18; // _18
|
||||
u32 _1C; // _1C
|
||||
u32 _20; // _20
|
||||
u32 _24; // _24
|
||||
u32 _28; // _28
|
||||
u32 _2C; // _2C
|
||||
u32 _30; // _30
|
||||
u32 _34; // _34
|
||||
u32 _38; // _38
|
||||
u32 _3C; // _3C
|
||||
u32 _40; // _40
|
||||
u32 _44; // _44
|
||||
u32 _48; // _48
|
||||
u32 _4C; // _4C
|
||||
u32 _50; // _50
|
||||
u32 _54; // _54
|
||||
u32 _58; // _58
|
||||
u32 _5C; // _5C
|
||||
u32 _60; // _60
|
||||
u32 _64; // _64
|
||||
u32 _68; // _68
|
||||
u32 _6C; // _6C
|
||||
u32 _70; // _70
|
||||
u32 _74; // _74
|
||||
u32 _78; // _78
|
||||
u32 _7C; // _7C
|
||||
u32 _80; // _80
|
||||
u32 _84; // _84
|
||||
u32 _88; // _88
|
||||
u32 _8C; // _8C
|
||||
u32 _90; // _90
|
||||
u32 _94; // _94
|
||||
BOOL mIsStopped; // _98
|
||||
u32 _9C; // _9C
|
||||
u32 _A0; // _A0
|
||||
u32 _A4; // _A4
|
||||
u32 _A8; // _A8
|
||||
u32 _AC; // _AC
|
||||
u32 gpr[32]; // _00
|
||||
u32 lr; // _80
|
||||
u32 ctr; // _84
|
||||
u32 xer; // _88
|
||||
u32 msr; // _8C
|
||||
u32 dar; // _90
|
||||
u32 dsisr; // _94
|
||||
BOOL isStopped; // _98
|
||||
u32 inputActivated; // _9C
|
||||
u32 inputPendingPtr; // _A0
|
||||
u32 _A4; // _A4
|
||||
u32 _A8; // _A8
|
||||
u32 _AC; // _AC
|
||||
} TRKState;
|
||||
|
||||
typedef struct TRKState_PPC {
|
||||
u32 GPR[32]; // 0x0
|
||||
u32 LR; // 0x80
|
||||
u32 CTR; // 0x84
|
||||
u32 XER; // 0x88
|
||||
u32 MSR; // 0x8c
|
||||
u32 DAR; // 0x90
|
||||
u32 DSISR; // 0x94
|
||||
BOOL stopped; // 0x98
|
||||
BOOL inputActivated; // 0x9c
|
||||
u8* inputPendingPtr; // 0xA0
|
||||
} TRKState_PPC;
|
||||
|
||||
typedef struct ProcessorRestoreFlags_PPC {
|
||||
u8 TBR;
|
||||
u8 DEC;
|
||||
u8 linker_padding[0x9 - 0x2];
|
||||
} ProcessorRestoreFlags_PPC;
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -4,7 +4,7 @@ TRK_MINNOW_DOLPHIN_FILES:=\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/nubinit.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/msg.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/TRK_MINNOW_DOLPHIN/msgbuf.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/TRK_MINNOW_DOLPHIN/serpoll.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/serpoll.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/usr_put.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/dispatch.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/TRK_MINNOW_DOLPHIN/msghndlr.o\
|
||||
@ -15,14 +15,14 @@ TRK_MINNOW_DOLPHIN_FILES:=\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/mem_TRK.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/TRK_MINNOW_DOLPHIN/targimpl.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/targsupp.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/TRK_MINNOW_DOLPHIN/mpc_7xx_603e.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/mpc_7xx_603e.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/TRK_MINNOW_DOLPHIN/__exception.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/main_TRK.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk_glue.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/targcont.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/target_options.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/TRK_MINNOW_DOLPHIN/mslsupp.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/mslsupp.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/UDP_Stubs.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/ddh/main.o\
|
||||
$(BUILD_DIR)/src/Dolphin/TRK_MINNOW_DOLPHIN/CircleBuffer.o\
|
||||
|
@ -1,11 +1,12 @@
|
||||
#include "types.h"
|
||||
#include "Dolphin/OS/OSInterrupt.h"
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C0C48
|
||||
* Size: 000008
|
||||
*/
|
||||
int udp_cc_initialize(void) { return -1; }
|
||||
int udp_cc_initialize(void* flagOut, __OSInterruptHandler handler) { return -1; }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
@ -33,14 +34,14 @@ int udp_cc_close(void) { return -1; }
|
||||
* Address: 800C0C28
|
||||
* Size: 000008
|
||||
*/
|
||||
int udp_cc_read(void) { return 0; }
|
||||
int udp_cc_read(u8* dest, int size) { return 0; }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C0C20
|
||||
* Size: 000008
|
||||
*/
|
||||
int udp_cc_write(void) { return 0; }
|
||||
int udp_cc_write(const u8* src, int size) { return 0; }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
|
@ -1,61 +1,51 @@
|
||||
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
|
||||
|
||||
extern void OSResetSystem(BOOL reset, u32 resetCode, BOOL forceMenu);
|
||||
|
||||
static u32 lc_base;
|
||||
|
||||
static u32 TRK_ISR_OFFSETS[15] = { PPC_SystemReset,
|
||||
PPC_MachineCheck,
|
||||
PPC_DataStorage,
|
||||
PPC_InstructionStorage,
|
||||
PPC_ExternalInterrupt,
|
||||
PPC_Alignment,
|
||||
PPC_Program,
|
||||
PPC_FloatingPointUnavaiable,
|
||||
PPC_Decrementer,
|
||||
PPC_SystemCall,
|
||||
PPC_Trace,
|
||||
PPC_PerformanceMonitor,
|
||||
PPC_InstructionAddressBreakpoint,
|
||||
PPC_SystemManagementInterrupt,
|
||||
PPC_ThermalManagementInterrupt };
|
||||
|
||||
__declspec(section ".init") void __TRK_reset() { OSResetSystem(FALSE, 0, FALSE); }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C03EC
|
||||
* Size: 000020
|
||||
*/
|
||||
void EnableMetroTRKInterrupts(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
stw r0, 0x14(r1)
|
||||
bl 0x288
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
}
|
||||
void EnableMetroTRKInterrupts(void) { EnableEXI2Interrupts(); }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C0394
|
||||
* Size: 000058
|
||||
*/
|
||||
void TRKTargetTranslate(void)
|
||||
u32 TRKTargetTranslate(u32 val)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
lis r4, 0x804F
|
||||
addi r4, r4, 0x4800
|
||||
lwz r4, 0x0(r4)
|
||||
cmplw r3, r4
|
||||
blt- .loc_0x34
|
||||
addi r0, r4, 0x4000
|
||||
cmplw r3, r0
|
||||
bge- .loc_0x34
|
||||
lis r4, 0x804F
|
||||
addi r4, r4, 0x4328
|
||||
lwz r0, 0x238(r4)
|
||||
rlwinm. r0,r0,0,30,31
|
||||
bnelr-
|
||||
if (val >= lc_base && val < lc_base + 0x4000) {
|
||||
if (((u32*)(&gTRKCPUState.Extended1))[36] & 3)
|
||||
return val;
|
||||
}
|
||||
|
||||
.loc_0x34:
|
||||
lis r0, 0x7E00
|
||||
cmplw r3, r0
|
||||
blt- .loc_0x4C
|
||||
lis r0, 0x8000
|
||||
cmplw r3, r0
|
||||
blelr-
|
||||
if (val >= 0x7E000000 && val <= 0x80000000) {
|
||||
return val;
|
||||
}
|
||||
|
||||
.loc_0x4C:
|
||||
rlwinm r0,r3,0,2,31
|
||||
oris r3, r0, 0x8000
|
||||
blr
|
||||
*/
|
||||
return (val & 0x3FFFFFFF) | 0x80000000;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -63,9 +53,11 @@ void TRKTargetTranslate(void)
|
||||
* Address: ........
|
||||
* Size: 0000B0
|
||||
*/
|
||||
void TRK_copy_vector(void)
|
||||
void TRK_copy_vector(u32 offset)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
void* destPtr = (void*)TRKTargetTranslate(offset);
|
||||
TRK_memcpy(destPtr, (void*)(gTRKInterruptVectorTable + offset), 0x100);
|
||||
TRK_flush_cache(destPtr, 0x100);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -75,6 +67,29 @@ void TRK_copy_vector(void)
|
||||
*/
|
||||
void __TRK_copy_vectors(void)
|
||||
{
|
||||
u32 r3 = lc_base;
|
||||
u32* isrOffsetPtr;
|
||||
int i;
|
||||
u32 r29;
|
||||
|
||||
if (r3 <= 0x44 && r3 + 0x4000 > 0x44 && ((u32*)(&gTRKCPUState.Extended1))[36] & 3) {
|
||||
r3 = 0x44;
|
||||
} else {
|
||||
r3 = 0x80000044;
|
||||
}
|
||||
|
||||
isrOffsetPtr = TRK_ISR_OFFSETS;
|
||||
i = 0;
|
||||
r29 = *(u32*)r3;
|
||||
|
||||
do {
|
||||
if ((r29 & (1 << i)) && i != 4) {
|
||||
TRK_copy_vector(*isrOffsetPtr);
|
||||
}
|
||||
|
||||
i++;
|
||||
isrOffsetPtr++;
|
||||
} while (i <= 14);
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
@ -174,30 +189,12 @@ void __TRK_copy_vectors(void)
|
||||
* Address: 800C021C
|
||||
* Size: 00004C
|
||||
*/
|
||||
void TRKInitializeTarget(void)
|
||||
DSError TRKInitializeTarget()
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r3, 0x804F
|
||||
stw r0, 0x14(r1)
|
||||
li r0, 0x1
|
||||
addi r3, r3, 0x4284
|
||||
stw r0, 0x98(r3)
|
||||
bl -0x2390
|
||||
lis r5, 0x804F
|
||||
lis r4, 0x804F
|
||||
addi r5, r5, 0x4284
|
||||
lis r0, 0xE000
|
||||
stw r3, 0x8C(r5)
|
||||
li r3, 0
|
||||
stw r0, 0x4800(r4)
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
gTRKState.isStopped = TRUE;
|
||||
gTRKState.msr = __TRK_get_MSR();
|
||||
lc_base = 0xE0000000;
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -477,8 +474,64 @@ void TRK__write_aram(void)
|
||||
* Address: 800BFE68
|
||||
* Size: 000094
|
||||
*/
|
||||
void InitMetroTRK_BBA(void)
|
||||
asm void InitMetroTRK_BBA(void)
|
||||
{
|
||||
// clang-format off
|
||||
nofralloc
|
||||
addi r1, r1, -4
|
||||
stw r3, 0(r1)
|
||||
lis r3, gTRKCPUState@h
|
||||
ori r3, r3, gTRKCPUState@l
|
||||
stmw r0, ProcessorState_PPC.Default.GPR(r3) //Save the gprs
|
||||
lwz r4, 0(r1)
|
||||
addi r1, r1, 4
|
||||
stw r1, ProcessorState_PPC.Default.GPR[1](r3)
|
||||
stw r4, ProcessorState_PPC.Default.GPR[3](r3)
|
||||
mflr r4
|
||||
stw r4, ProcessorState_PPC.Default.LR(r3)
|
||||
stw r4, ProcessorState_PPC.Default.PC(r3)
|
||||
mfcr r4
|
||||
stw r4, ProcessorState_PPC.Default.CR(r3)
|
||||
//Turn on external interrupts
|
||||
mfmsr r4
|
||||
ori r3, r4, (1 << (31 - 16))
|
||||
mtmsr r3
|
||||
mtsrr1 r4 //Copy original msr to srr1
|
||||
//Save misc registers to gTRKCPUState
|
||||
bl TRKSaveExtended1Block
|
||||
lis r3, gTRKCPUState@h
|
||||
ori r3, r3, gTRKCPUState@l
|
||||
lmw r0, ProcessorState_PPC.Default.GPR(r3) //Restore the gprs
|
||||
//Reset IABR and DABR
|
||||
li r0, 0
|
||||
mtspr 0x3f2, r0
|
||||
mtspr 0x3f5, r0
|
||||
//Restore the stack pointer
|
||||
// lis r1, _db_stack_addr@h
|
||||
// ori r1, r1, _db_stack_addr@l
|
||||
li r3, 2
|
||||
bl InitMetroTRKCommTable //Initialize comm table as BBA hardware
|
||||
/*
|
||||
If InitMetroTRKCommTable returned 1 (failure), something went wrong
|
||||
or whatever reason. If everything goes as expected, we proceed with
|
||||
starting up TRK.
|
||||
*/
|
||||
cmpwi r3, 1
|
||||
bne initCommTableSuccess
|
||||
/*
|
||||
BUG: The code probably orginally reloaded gTRKCPUState here, but
|
||||
as is it will read the returned value of InitMetroTRKCommTable
|
||||
as a TRKCPUState struct pointer, causing the CPU to return to
|
||||
a garbage code address.
|
||||
*/
|
||||
lwz r4, ProcessorState_PPC.Default.LR(r3)
|
||||
mtlr r4
|
||||
lmw r0, ProcessorState_PPC.Default.GPR(r3)
|
||||
blr
|
||||
initCommTableSuccess:
|
||||
b TRK_main //Jump to TRK_main
|
||||
blr
|
||||
// clang-format on
|
||||
/*
|
||||
.loc_0x0:
|
||||
subi r1, r1, 0x4
|
||||
@ -528,8 +581,66 @@ void InitMetroTRK_BBA(void)
|
||||
* Address: 800BFDD0
|
||||
* Size: 000098
|
||||
*/
|
||||
void InitMetroTRK(void)
|
||||
asm void InitMetroTRK(void)
|
||||
{
|
||||
// clang-format off
|
||||
nofralloc
|
||||
addi r1, r1, -4
|
||||
stw r3, 0(r1)
|
||||
lis r3, gTRKCPUState@h
|
||||
ori r3, r3, gTRKCPUState@l
|
||||
stmw r0, ProcessorState_PPC.Default.GPR(r3) //Save the gprs
|
||||
lwz r4, 0(r1)
|
||||
addi r1, r1, 4
|
||||
stw r1, ProcessorState_PPC.Default.GPR[1](r3)
|
||||
stw r4, ProcessorState_PPC.Default.GPR[3](r3)
|
||||
mflr r4
|
||||
stw r4, ProcessorState_PPC.Default.LR(r3)
|
||||
stw r4, ProcessorState_PPC.Default.PC(r3)
|
||||
mfcr r4
|
||||
stw r4, ProcessorState_PPC.Default.CR(r3)
|
||||
//???
|
||||
mfmsr r4
|
||||
ori r3, r4, (1 << (31 - 16))
|
||||
xori r3, r3, (1 << (31 - 16))
|
||||
mtmsr r3
|
||||
mtsrr1 r4 //Copy msr to srr1
|
||||
//Save misc registers to gTRKCPUState
|
||||
bl TRKSaveExtended1Block
|
||||
lis r3, gTRKCPUState@h
|
||||
ori r3, r3, gTRKCPUState@l
|
||||
lmw r0, ProcessorState_PPC.Default.GPR(r3) //Restore the gprs
|
||||
//Reset IABR and DABR
|
||||
li r0, 0
|
||||
mtspr 0x3f2, r0
|
||||
mtspr 0x3f5, r0
|
||||
//Restore stack pointer
|
||||
// lis r1, _db_stack_addr@h
|
||||
// ori r1, r1, _db_stack_addr@l
|
||||
mr r3, r5
|
||||
bl InitMetroTRKCommTable //Initialize comm table
|
||||
/*
|
||||
If InitMetroTRKCommTable returned 1 (failure), an invalid hardware
|
||||
id or the id for GDEV was somehow passed. Since only BBA or NDEV
|
||||
are supported, we return early. Otherwise, we proceed with
|
||||
starting up TRK.
|
||||
*/
|
||||
cmpwi r3, 1
|
||||
bne initCommTableSuccess
|
||||
/*
|
||||
BUG: The code probably orginally reloaded gTRKCPUState here, but
|
||||
as is it will read the returned value of InitMetroTRKCommTable
|
||||
as a TRKCPUState struct pointer, causing the CPU to return to
|
||||
a garbage code address.
|
||||
*/
|
||||
lwz r4, ProcessorState_PPC.Default.LR(r3)
|
||||
mtlr r4
|
||||
lmw r0, ProcessorState_PPC.Default.GPR(r3) //Restore the gprs
|
||||
blr
|
||||
initCommTableSuccess:
|
||||
b TRK_main //Jump to TRK_main
|
||||
blr
|
||||
// clang-format on
|
||||
/*
|
||||
.loc_0x0:
|
||||
subi r1, r1, 0x4
|
||||
|
@ -1,29 +1,20 @@
|
||||
#include "types.h"
|
||||
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
|
||||
#include "Dolphin/os.h"
|
||||
|
||||
u8 TRK_Use_BBA;
|
||||
BOOL _MetroTRK_Has_Framing;
|
||||
|
||||
DBCommTable gDBCommTable = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C0984
|
||||
* Size: 000038
|
||||
*/
|
||||
void TRKEXICallBack(void)
|
||||
void TRKEXICallBack(s16 r3, OSContext* ctx)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
stw r0, 0x14(r1)
|
||||
stw r31, 0xC(r1)
|
||||
mr r31, r4
|
||||
bl 0x310AC
|
||||
mr r3, r31
|
||||
li r4, 0x500
|
||||
bl -0x540
|
||||
lwz r0, 0x14(r1)
|
||||
lwz r31, 0xC(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
OSEnableScheduler();
|
||||
TRKLoadContext(ctx, 0x500);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -31,8 +22,68 @@ void TRKEXICallBack(void)
|
||||
* Address: 800C0718
|
||||
* Size: 00026C
|
||||
*/
|
||||
void InitMetroTRKCommTable(void)
|
||||
int InitMetroTRKCommTable(int hwId)
|
||||
{
|
||||
int result = 1;
|
||||
OSReport("Devkit set to : %ld\n", hwId);
|
||||
TRK_Use_BBA = 0;
|
||||
|
||||
if (hwId == HARDWARE_BBA) { // BBA hardware
|
||||
OSReport("MetroTRK : Set to BBA\n");
|
||||
// Initialize gDBCommTable
|
||||
TRK_Use_BBA = 1;
|
||||
gDBCommTable.initialize_func = udp_cc_initialize;
|
||||
gDBCommTable.open_func = udp_cc_open;
|
||||
gDBCommTable.close_func = udp_cc_close;
|
||||
gDBCommTable.read_func = udp_cc_read;
|
||||
gDBCommTable.write_func = udp_cc_write;
|
||||
gDBCommTable.shutdown_func = udp_cc_shutdown;
|
||||
gDBCommTable.peek_func = udp_cc_peek;
|
||||
gDBCommTable.pre_continue_func = udp_cc_pre_continue;
|
||||
gDBCommTable.post_stop_func = udp_cc_post_stop;
|
||||
gDBCommTable.init_interrupts_func = nullptr;
|
||||
return 0;
|
||||
|
||||
} else if (hwId == HARDWARE_GDEV) { // NDEV hardware
|
||||
OSReport("MetroTRK : Set to GDEV hardware\n");
|
||||
// Initialize gDBCommTable
|
||||
// need to work out what the deal with the typedef is for these functions
|
||||
// gDBCommTable.initialize_func = gdev_cc_initialize;
|
||||
// gDBCommTable.open_func = gdev_cc_open;
|
||||
// gDBCommTable.close_func = gdev_cc_close;
|
||||
// gDBCommTable.read_func = gdev_cc_read;
|
||||
// gDBCommTable.write_func = gdev_cc_write;
|
||||
// gDBCommTable.shutdown_func = gdev_cc_shutdown;
|
||||
// gDBCommTable.peek_func = gdev_cc_peek;
|
||||
// gDBCommTable.pre_continue_func = gdev_cc_pre_continue;
|
||||
// gDBCommTable.post_stop_func = gdev_cc_post_stop;
|
||||
// gDBCommTable.init_interrupts_func = gdev_cc_initinterrupts;
|
||||
result = 0;
|
||||
|
||||
} else if (hwId == HARDWARE_AMC_DDH) {
|
||||
OSReport("MetroTRK : Set to AMC DDH hardware\n");
|
||||
// Initialize gDBCommTable
|
||||
// need to make these ddh functions
|
||||
// gDBCommTable.initialize_func = gdev_cc_initialize;
|
||||
// gDBCommTable.open_func = gdev_cc_open;
|
||||
// gDBCommTable.close_func = gdev_cc_close;
|
||||
// gDBCommTable.read_func = gdev_cc_read;
|
||||
// gDBCommTable.write_func = gdev_cc_write;
|
||||
// gDBCommTable.shutdown_func = gdev_cc_shutdown;
|
||||
// gDBCommTable.peek_func = gdev_cc_peek;
|
||||
// gDBCommTable.pre_continue_func = gdev_cc_pre_continue;
|
||||
// gDBCommTable.post_stop_func = gdev_cc_post_stop;
|
||||
// gDBCommTable.init_interrupts_func = gdev_cc_initinterrupts;
|
||||
result = 0;
|
||||
|
||||
} else { // unknown hardware
|
||||
OSReport("MetroTRK : Set to UNKNOWN hardware. (%ld)\n", hwId);
|
||||
OSReport("MetroTRK : Invalid hardware ID passed from OS\n");
|
||||
OSReport("MetroTRK : Defaulting to GDEV Hardware\n");
|
||||
result = 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
@ -208,31 +259,11 @@ void InitMetroTRKCommTable(void)
|
||||
* Address: 800C06C8
|
||||
* Size: 000050
|
||||
*/
|
||||
void TRKInitializeIntDrivenUART(void)
|
||||
DSError TRKInitializeIntDrivenUART(u32, u32, u32, void* r5)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r4, 0x800C
|
||||
lis r3, 0x804A
|
||||
stw r0, 0x14(r1)
|
||||
addi r4, r4, 0x984
|
||||
lwz r12, 0x6920(r3)
|
||||
mr r3, r6
|
||||
mtctr r12
|
||||
bctrl
|
||||
lis r3, 0x804A
|
||||
addi r3, r3, 0x6920
|
||||
lwz r12, 0x18(r3)
|
||||
mtctr r12
|
||||
bctrl
|
||||
lwz r0, 0x14(r1)
|
||||
li r3, 0
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
gDBCommTable.initialize_func(r5, TRKEXICallBack);
|
||||
gDBCommTable.open_func();
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -242,29 +273,11 @@ void TRKInitializeIntDrivenUART(void)
|
||||
*/
|
||||
void EnableEXI2Interrupts(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r3, 0x804F
|
||||
stw r0, 0x14(r1)
|
||||
lbz r0, 0x4810(r3)
|
||||
cmplwi r0, 0
|
||||
bne- .loc_0x38
|
||||
lis r3, 0x804A
|
||||
addi r3, r3, 0x6920
|
||||
lwz r12, 0x4(r3)
|
||||
cmplwi r12, 0
|
||||
beq- .loc_0x38
|
||||
mtctr r12
|
||||
bctrl
|
||||
|
||||
.loc_0x38:
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
if (!TRK_Use_BBA) {
|
||||
if (gDBCommTable.init_interrupts_func != nullptr) {
|
||||
gDBCommTable.init_interrupts_func();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -272,50 +285,17 @@ void EnableEXI2Interrupts(void)
|
||||
* Address: 800C0650
|
||||
* Size: 000030
|
||||
*/
|
||||
void TRKPollUART(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r3, 0x804A
|
||||
stw r0, 0x14(r1)
|
||||
addi r3, r3, 0x6920
|
||||
lwz r12, 0xC(r3)
|
||||
mtctr r12
|
||||
bctrl
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
}
|
||||
int TRKPollUART(void) { return gDBCommTable.peek_func(); }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C0614
|
||||
* Size: 00003C
|
||||
*/
|
||||
void TRKReadUARTN(void)
|
||||
UARTError TRKReadUARTN(void* bytes, u32 length)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r5, 0x804A
|
||||
stw r0, 0x14(r1)
|
||||
addi r5, r5, 0x6920
|
||||
lwz r12, 0x10(r5)
|
||||
mtctr r12
|
||||
bctrl
|
||||
neg r0, r3
|
||||
or r0, r0, r3
|
||||
srawi r3, r0, 0x1F
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
int readErr = gDBCommTable.read_func(bytes, length);
|
||||
return ((-readErr | readErr) >> 31);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -323,26 +303,10 @@ void TRKReadUARTN(void)
|
||||
* Address: 800C05D8
|
||||
* Size: 00003C
|
||||
*/
|
||||
void TRKWriteUARTN(void)
|
||||
UARTError TRKWriteUARTN(const void* bytes, u32 length)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r5, 0x804A
|
||||
stw r0, 0x14(r1)
|
||||
addi r5, r5, 0x6920
|
||||
lwz r12, 0x14(r5)
|
||||
mtctr r12
|
||||
bctrl
|
||||
neg r0, r3
|
||||
or r0, r0, r3
|
||||
srawi r3, r0, 0x1F
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
int writeErr = gDBCommTable.write_func(bytes, length);
|
||||
return ((-writeErr | writeErr) >> 31);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -380,105 +344,36 @@ void TRKReadUARTPoll(void)
|
||||
* Address: 800C05A8
|
||||
* Size: 000030
|
||||
*/
|
||||
void ReserveEXI2Port(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r3, 0x804A
|
||||
stw r0, 0x14(r1)
|
||||
addi r3, r3, 0x6920
|
||||
lwz r12, 0x24(r3)
|
||||
mtctr r12
|
||||
bctrl
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
}
|
||||
void ReserveEXI2Port(void) { gDBCommTable.post_stop_func(); }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C0578
|
||||
* Size: 000030
|
||||
*/
|
||||
void UnreserveEXI2Port(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r3, 0x804A
|
||||
stw r0, 0x14(r1)
|
||||
addi r3, r3, 0x6920
|
||||
lwz r12, 0x20(r3)
|
||||
mtctr r12
|
||||
bctrl
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
}
|
||||
void UnreserveEXI2Port(void) { gDBCommTable.pre_continue_func(); }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C0548
|
||||
* Size: 000030
|
||||
*/
|
||||
void TRK_board_display(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r5, 0x8048
|
||||
mr r4, r3
|
||||
stw r0, 0x14(r1)
|
||||
subi r3, r5, 0x63B4
|
||||
crclr 6, 0x6
|
||||
bl 0x2D188
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
}
|
||||
void TRK_board_display(char* str) { OSReport("%s\n", str); }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C04F0
|
||||
* Size: 000058
|
||||
*/
|
||||
void InitializeProgramEndTrap(void)
|
||||
DSError InitializeProgramEndTrap(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r4, 0x800D
|
||||
lis r3, 0x8048
|
||||
stw r0, 0x14(r1)
|
||||
li r5, 0x4
|
||||
stw r31, 0xC(r1)
|
||||
addi r31, r4, 0x4598
|
||||
subi r4, r3, 0x63B8
|
||||
addi r3, r31, 0x4
|
||||
bl -0xBD3E8
|
||||
addi r3, r31, 0x4
|
||||
li r4, 0x4
|
||||
bl 0x2C2D8
|
||||
addi r3, r31, 0x4
|
||||
li r4, 0x4
|
||||
bl 0x2C1E8
|
||||
lwz r0, 0x14(r1)
|
||||
lwz r31, 0xC(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
static const char EndofProgramInstruction[] = "\0END";
|
||||
|
||||
u8* endOfProgramInstructionBytes = (u8*)&EndofProgramInstruction;
|
||||
u8* ppcHaltPtr = (u8*)PPCHalt;
|
||||
TRK_memcpy(ppcHaltPtr + 4, endOfProgramInstructionBytes, 4);
|
||||
ICInvalidateRange(ppcHaltPtr + 4, 4);
|
||||
DCFlushRange(ppcHaltPtr + 4, 4);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -493,47 +388,45 @@ void TRKUARTInterruptHandler(void) { }
|
||||
* Address: 800C0464
|
||||
* Size: 000088
|
||||
*/
|
||||
void TRKLoadContext(void)
|
||||
asm void TRKLoadContext(OSContext* ctx, u32 r4)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
lwz r0, 0x0(r3)
|
||||
lwz r1, 0x4(r3)
|
||||
lwz r2, 0x8(r3)
|
||||
lhz r5, 0x1A2(r3)
|
||||
rlwinm. r6,r5,0,30,30
|
||||
beq- .loc_0x28
|
||||
rlwinm r5,r5,0,31,29
|
||||
sth r5, 0x1A2(r3)
|
||||
lmw r5, 0x14(r3)
|
||||
b .loc_0x2C
|
||||
|
||||
.loc_0x28:
|
||||
lmw r13, 0x34(r3)
|
||||
|
||||
.loc_0x2C:
|
||||
mr r31, r3
|
||||
mr r3, r4
|
||||
lwz r4, 0x80(r31)
|
||||
mtcr r4
|
||||
lwz r4, 0x84(r31)
|
||||
mtlr r4
|
||||
lwz r4, 0x88(r31)
|
||||
mtctr r4
|
||||
lwz r4, 0x8C(r31)
|
||||
mtxer r4
|
||||
mfmsr r4
|
||||
rlwinm r4,r4,0,17,15
|
||||
rlwinm r4,r4,0,31,29
|
||||
mtmsr r4
|
||||
mtsprg 1, r2
|
||||
lwz r4, 0xC(r31)
|
||||
mtsprg 2, r4
|
||||
lwz r4, 0x10(r31)
|
||||
mtsprg 3, r4
|
||||
lwz r2, 0x198(r31)
|
||||
lwz r4, 0x19C(r31)
|
||||
lwz r31, 0x7C(r31)
|
||||
b -0x25F4
|
||||
*/
|
||||
// clang-format off
|
||||
nofralloc
|
||||
lwz r0, OSContext.gpr[0](r3)
|
||||
lwz r1, OSContext.gpr[1](r3)
|
||||
lwz r2, OSContext.gpr[2](r3)
|
||||
lhz r5, OSContext.state(r3)
|
||||
rlwinm. r6, r5, 0, 0x1e, 0x1e
|
||||
beq L_802CC24C
|
||||
rlwinm r5, r5, 0, 0x1f, 0x1d
|
||||
sth r5, OSContext.state(r3)
|
||||
lmw r5, OSContext.gpr[5](r3)
|
||||
b L_802CC250
|
||||
L_802CC24C:
|
||||
lmw r13, OSContext.gpr[13](r3)
|
||||
L_802CC250:
|
||||
mr r31, r3
|
||||
mr r3, r4
|
||||
lwz r4, OSContext.cr(r31)
|
||||
mtcrf 0xff, r4
|
||||
lwz r4, OSContext.lr(r31)
|
||||
mtlr r4
|
||||
lwz r4, OSContext.ctr(r31)
|
||||
mtctr r4
|
||||
lwz r4, OSContext.xer(r31)
|
||||
mtxer r4
|
||||
mfmsr r4
|
||||
rlwinm r4, r4, 0, 0x11, 0xf //Turn off external exceptions
|
||||
rlwinm r4, r4, 0, 0x1f, 0x1d //Turn off recoverable exception flag
|
||||
mtmsr r4
|
||||
mtsprg 1, r2
|
||||
lwz r4, OSContext.gpr[3](r31)
|
||||
mtsprg 2, r4
|
||||
lwz r4, OSContext.gpr[4](r31)
|
||||
mtsprg 3, r4
|
||||
lwz r2, OSContext.srr0(r31)
|
||||
lwz r4, OSContext.srr1(r31)
|
||||
lwz r31, OSContext.gpr[31](r31)
|
||||
b TRKInterruptHandler
|
||||
// clang-format on
|
||||
}
|
||||
|
@ -1,13 +1,128 @@
|
||||
|
||||
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: ........
|
||||
* Size: 000008
|
||||
* Address: 800BFA60
|
||||
* Size: 0001B8
|
||||
*/
|
||||
void TRKTargetCPUMinorType(void)
|
||||
asm void TRKSaveExtended1Block(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
// clang-format off
|
||||
nofralloc
|
||||
lis r2, gTRKCPUState@h
|
||||
ori r2, r2, gTRKCPUState@l
|
||||
mfsr r16, 0
|
||||
mfsr r17, 0x1
|
||||
mfsr r18, 0x2
|
||||
mfsr r19, 0x3
|
||||
mfsr r20, 0x4
|
||||
mfsr r21, 0x5
|
||||
mfsr r22, 0x6
|
||||
mfsr r23, 0x7
|
||||
mfsr r24, 0x8
|
||||
mfsr r25, 0x9
|
||||
mfsr r26, 0xA
|
||||
mfsr r27, 0xB
|
||||
mfsr r28, 0xC
|
||||
mfsr r29, 0xD
|
||||
mfsr r30, 0xE
|
||||
mfsr r31, 0xF
|
||||
stmw r16, 0x1A8(r2)
|
||||
mftb r10, 0x10c
|
||||
mftbu r11
|
||||
mfspr r12, 0x3F0
|
||||
mfspr r13, 0x3F1
|
||||
mfspr r14, 0x1b
|
||||
mfspr r15, 0x11F
|
||||
mfibatu r16, 0
|
||||
mfibatl r17, 0
|
||||
mfibatu r18, 0x1
|
||||
mfibatl r19, 0x1
|
||||
mfibatu r20, 0x2
|
||||
mfibatl r21, 0x2
|
||||
mfibatu r22, 0x3
|
||||
mfibatl r23, 0x3
|
||||
mfdbatu r24, 0
|
||||
mfdbatl r25, 0
|
||||
mfdbatu r26, 0x1
|
||||
mfdbatl r27, 0x1
|
||||
mfdbatu r28, 0x2
|
||||
mfdbatl r29, 0x2
|
||||
mfdbatu r30, 0x3
|
||||
mfdbatl r31, 0x3
|
||||
stmw r10, 0x1E8(r2)
|
||||
mfsdr1 r22
|
||||
mfdar r23
|
||||
mfdsisr r24
|
||||
mfsprg r25, 0
|
||||
mfsprg r26, 0x1
|
||||
mfsprg r27, 0x2
|
||||
mfsprg r28, 0x3
|
||||
li r29, 0
|
||||
mfspr r30, 0x3F2
|
||||
mfear r31
|
||||
stmw r22, 0x25C(r2)
|
||||
mfspr r20, 0x390
|
||||
mfspr r21, 0x391
|
||||
mfspr r22, 0x392
|
||||
mfspr r23, 0x393
|
||||
mfspr r24, 0x394
|
||||
mfspr r25, 0x395
|
||||
mfspr r26, 0x396
|
||||
mfspr r27, 0x397
|
||||
mfspr r28, 0x398
|
||||
mfspr r29, 0x399
|
||||
mfspr r30, 0x39A
|
||||
mfspr r31, 0x39B
|
||||
stmw r20, 0x2FC(r2)
|
||||
b loc_0x150
|
||||
|
||||
mfspr r16, 0x3A0
|
||||
mfspr r17, 0x3A7
|
||||
mfspr r18, 0x3A8
|
||||
mfspr r19, 0x3A9
|
||||
mfspr r20, 0x3AA
|
||||
mfspr r21, 0x3AB
|
||||
mfspr r22, 0x3AC
|
||||
mfspr r23, 0x3AD
|
||||
mfspr r24, 0x3AE
|
||||
mfspr r25, 0x3AF
|
||||
mfspr r26, 0x3B0
|
||||
mfspr r27, 0x3B7
|
||||
mfspr r28, 0x3BF
|
||||
mfspr r29, 0x3F6
|
||||
mfspr r30, 0x3F7
|
||||
mfspr r31, 0x3FF
|
||||
stmw r16, 0x2B8(r2)
|
||||
|
||||
loc_0x150:
|
||||
mfspr r19, 0x3F5
|
||||
mfspr r20, 0x3B9
|
||||
mfspr r21, 0x3BA
|
||||
mfspr r22, 0x3BD
|
||||
mfspr r23, 0x3BE
|
||||
mfspr r24, 0x3BB
|
||||
mfspr r25, 0x3B8
|
||||
mfspr r26, 0x3BC
|
||||
mfspr r27, 0x3FC
|
||||
mfspr r28, 0x3FD
|
||||
mfspr r29, 0x3FE
|
||||
mfspr r30, 0x3FB
|
||||
mfspr r31, 0x3F9
|
||||
stmw r19, 0x284(r2)
|
||||
blr
|
||||
mfspr r25, 0x3D0
|
||||
mfspr r26, 0x3D1
|
||||
mfspr r27, 0x3D2
|
||||
mfspr r28, 0x3D3
|
||||
mfspr r29, 0x3D4
|
||||
mfspr r30, 0x3D5
|
||||
mfspr r31, 0x3D6
|
||||
stmw r25, 0x240(r2)
|
||||
mfdec r31
|
||||
stw r31, 0x278(r2)
|
||||
blr
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
/*
|
||||
@ -15,251 +130,127 @@ void TRKTargetCPUMinorType(void)
|
||||
* Address: 800BFC18
|
||||
* Size: 0001B8
|
||||
*/
|
||||
void TRKRestoreExtended1Block(void)
|
||||
asm void TRKRestoreExtended1Block()
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
lis r2, 0x804F
|
||||
ori r2, r2, 0x4328
|
||||
lis r5, 0x804A
|
||||
ori r5, r5, 0x68B0
|
||||
lbz r3, 0x0(r5)
|
||||
lbz r6, 0x1(r5)
|
||||
li r0, 0
|
||||
stb r0, 0x0(r5)
|
||||
stb r0, 0x1(r5)
|
||||
cmpwi r3, 0
|
||||
beq- .loc_0x3C
|
||||
lwz r24, 0x1E8(r2)
|
||||
lwz r25, 0x1EC(r2)
|
||||
mttbl r24
|
||||
mttbu r25
|
||||
// clang-format off
|
||||
nofralloc
|
||||
lis r2, gTRKCPUState@h
|
||||
ori r2, r2, gTRKCPUState@l
|
||||
lis r5, gTRKRestoreFlags@h
|
||||
ori r5, r5, gTRKRestoreFlags@l
|
||||
lbz r3, 0x0(r5)
|
||||
lbz r6, 0x1(r5)
|
||||
li r0, 0
|
||||
stb r0, 0x0(r5)
|
||||
stb r0, 0x1(r5)
|
||||
cmpwi r3, 0
|
||||
beq- loc_0x3C
|
||||
lwz r24, 0x1E8(r2)
|
||||
lwz r25, 0x1EC(r2)
|
||||
mttbl r24
|
||||
mttbu r25
|
||||
|
||||
.loc_0x3C:
|
||||
lmw r20, 0x2FC(r2)
|
||||
mtspr 912, r20
|
||||
mtspr 913, r21
|
||||
mtspr 914, r22
|
||||
mtspr 915, r23
|
||||
mtspr 916, r24
|
||||
mtspr 917, r25
|
||||
mtspr 918, r26
|
||||
mtspr 919, r27
|
||||
mtspr 920, r28
|
||||
mtspr 922, r30
|
||||
mtspr 923, r31
|
||||
b .loc_0x88
|
||||
lmw r26, 0x2E0(r2)
|
||||
mtspr 944, r26
|
||||
mtspr 951, r27
|
||||
mtspr 1014, r29
|
||||
mtspr 1015, r30
|
||||
mtspr 1023, r31
|
||||
loc_0x3C:
|
||||
lmw r20, 0x2FC(r2)
|
||||
mtspr 912, r20
|
||||
mtspr 913, r21
|
||||
mtspr 914, r22
|
||||
mtspr 915, r23
|
||||
mtspr 916, r24
|
||||
mtspr 917, r25
|
||||
mtspr 918, r26
|
||||
mtspr 919, r27
|
||||
mtspr 920, r28
|
||||
mtspr 922, r30
|
||||
mtspr 923, r31
|
||||
b loc_0x88
|
||||
lmw r26, 0x2E0(r2)
|
||||
mtspr 944, r26
|
||||
mtspr 951, r27
|
||||
mtspr 1014, r29
|
||||
mtspr 1015, r30
|
||||
mtspr 1023, r31
|
||||
|
||||
.loc_0x88:
|
||||
lmw r19, 0x284(r2)
|
||||
mtdabr r19
|
||||
mtspr 953, r20
|
||||
mtspr 954, r21
|
||||
mtspr 957, r22
|
||||
mtspr 958, r23
|
||||
mtspr 955, r24
|
||||
mtspr 952, r25
|
||||
mtspr 956, r26
|
||||
mtspr 1020, r27
|
||||
mtspr 1021, r28
|
||||
mtspr 1022, r29
|
||||
mtspr 1019, r30
|
||||
mtspr 1017, r31
|
||||
b .loc_0xF4
|
||||
cmpwi r6, 0
|
||||
beq- .loc_0xD4
|
||||
lwz r26, 0x278(r2)
|
||||
mtdec r26
|
||||
loc_0x88:
|
||||
lmw r19, 0x284(r2)
|
||||
mtspr 1013, r19
|
||||
mtspr 953, r20
|
||||
mtspr 954, r21
|
||||
mtspr 957, r22
|
||||
mtspr 958, r23
|
||||
mtspr 955, r24
|
||||
mtspr 952, r25
|
||||
mtspr 956, r26
|
||||
mtspr 1020, r27
|
||||
mtspr 1021, r28
|
||||
mtspr 1022, r29
|
||||
mtspr 1019, r30
|
||||
mtspr 1017, r31
|
||||
b loc_0xF4
|
||||
cmpwi r6, 0
|
||||
beq- loc_0xD4
|
||||
lwz r26, 0x278(r2)
|
||||
mtdec r26
|
||||
|
||||
.loc_0xD4:
|
||||
lmw r25, 0x240(r2)
|
||||
mtspr 976, r25
|
||||
mtspr 977, r26
|
||||
mtspr 978, r27
|
||||
mtspr 979, r28
|
||||
mtspr 980, r29
|
||||
mtspr 981, r30
|
||||
mtspr 982, r31
|
||||
loc_0xD4:
|
||||
lmw r25, 0x240(r2)
|
||||
mtspr 976, r25
|
||||
mtspr 977, r26
|
||||
mtspr 978, r27
|
||||
mtspr 979, r28
|
||||
mtspr 980, r29
|
||||
mtspr 981, r30
|
||||
mtspr 982, r31
|
||||
|
||||
.loc_0xF4:
|
||||
lmw r16, 0x1A8(r2)
|
||||
mtsr 0, r16
|
||||
mtsr 1, r17
|
||||
mtsr 2, r18
|
||||
mtsr 3, r19
|
||||
mtsr 4, r20
|
||||
mtsr 5, r21
|
||||
mtsr 6, r22
|
||||
mtsr 7, r23
|
||||
mtsr 8, r24
|
||||
mtsr 9, r25
|
||||
mtsr 10, r26
|
||||
mtsr 11, r27
|
||||
mtsr 12, r28
|
||||
mtsr 13, r29
|
||||
mtsr 14, r30
|
||||
mtsr 15, r31
|
||||
lmw r12, 0x1F0(r2)
|
||||
mtspr 1008, r12
|
||||
mtspr 1009, r13
|
||||
mtsrr1 r14
|
||||
mtspr 287, r15
|
||||
mtibatu 0, r16
|
||||
mtibatl 0, r17
|
||||
mtibatu 1, r18
|
||||
mtibatl 1, r19
|
||||
mtibatu 2, r20
|
||||
mtibatl 2, r21
|
||||
mtibatu 3, r22
|
||||
mtibatl 3, r23
|
||||
mtdbatu 0, r24
|
||||
mtdbatl 0, r25
|
||||
mtdbatu 1, r26
|
||||
mtdbatl 1, r27
|
||||
mtdbatu 2, r28
|
||||
mtdbatl 2, r29
|
||||
mtdbatu 3, r30
|
||||
mtdbatl 3, r31
|
||||
lmw r22, 0x25C(r2)
|
||||
mtsdr1 r22
|
||||
mtdar r23
|
||||
mtdsisr r24
|
||||
mtsprg 0, r25
|
||||
mtsprg 1, r26
|
||||
mtsprg 2, r27
|
||||
mtsprg 3, r28
|
||||
mtspr 1010, r30
|
||||
mtear r31
|
||||
blr
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800BFA60
|
||||
* Size: 0001B8
|
||||
*/
|
||||
void TRKSaveExtended1Block(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
lis r2, 0x804F
|
||||
ori r2, r2, 0x4328
|
||||
mfsr r16, 0
|
||||
mfsr r17, 0x1
|
||||
mfsr r18, 0x2
|
||||
mfsr r19, 0x3
|
||||
mfsr r20, 0x4
|
||||
mfsr r21, 0x5
|
||||
mfsr r22, 0x6
|
||||
mfsr r23, 0x7
|
||||
mfsr r24, 0x8
|
||||
mfsr r25, 0x9
|
||||
mfsr r26, 0xA
|
||||
mfsr r27, 0xB
|
||||
mfsr r28, 0xC
|
||||
mfsr r29, 0xD
|
||||
mfsr r30, 0xE
|
||||
mfsr r31, 0xF
|
||||
stmw r16, 0x1A8(r2)
|
||||
mftbl r10
|
||||
mftbu r11
|
||||
mfspr r12, 0x3F0
|
||||
mfspr r13, 0x3F1
|
||||
mfsrr1 r14
|
||||
mfspr r15, 0x11F
|
||||
mfibatu r16, 0
|
||||
mfibatl r17, 0
|
||||
mfibatu r18, 0x1
|
||||
mfibatl r19, 0x1
|
||||
mfibatu r20, 0x2
|
||||
mfibatl r21, 0x2
|
||||
mfibatu r22, 0x3
|
||||
mfibatl r23, 0x3
|
||||
mfdbatu r24, 0
|
||||
mfdbatl r25, 0
|
||||
mfdbatu r26, 0x1
|
||||
mfdbatl r27, 0x1
|
||||
mfdbatu r28, 0x2
|
||||
mfdbatl r29, 0x2
|
||||
mfdbatu r30, 0x3
|
||||
mfdbatl r31, 0x3
|
||||
stmw r10, 0x1E8(r2)
|
||||
mfsdr1 r22
|
||||
mfdar r23
|
||||
mfdsisr r24
|
||||
mfsprg r25, 0
|
||||
mfsprg r26, 0x1
|
||||
mfsprg r27, 0x2
|
||||
mfsprg r28, 0x3
|
||||
li r29, 0
|
||||
mfspr r30, 0x3F2
|
||||
mfear r31
|
||||
stmw r22, 0x25C(r2)
|
||||
mfspr r20, 0x390
|
||||
mfspr r21, 0x391
|
||||
mfspr r22, 0x392
|
||||
mfspr r23, 0x393
|
||||
mfspr r24, 0x394
|
||||
mfspr r25, 0x395
|
||||
mfspr r26, 0x396
|
||||
mfspr r27, 0x397
|
||||
mfspr r28, 0x398
|
||||
mfspr r29, 0x399
|
||||
mfspr r30, 0x39A
|
||||
mfspr r31, 0x39B
|
||||
stmw r20, 0x2FC(r2)
|
||||
b .loc_0x150
|
||||
mfspr r16, 0x3A0
|
||||
mfspr r17, 0x3A7
|
||||
mfspr r18, 0x3A8
|
||||
mfspr r19, 0x3A9
|
||||
mfspr r20, 0x3AA
|
||||
mfspr r21, 0x3AB
|
||||
mfspr r22, 0x3AC
|
||||
mfspr r23, 0x3AD
|
||||
mfspr r24, 0x3AE
|
||||
mfspr r25, 0x3AF
|
||||
mfspr r26, 0x3B0
|
||||
mfspr r27, 0x3B7
|
||||
mfspr r28, 0x3BF
|
||||
mfspr r29, 0x3F6
|
||||
mfspr r30, 0x3F7
|
||||
mfspr r31, 0x3FF
|
||||
stmw r16, 0x2B8(r2)
|
||||
|
||||
.loc_0x150:
|
||||
mfdabr r19
|
||||
mfspr r20, 0x3B9
|
||||
mfspr r21, 0x3BA
|
||||
mfspr r22, 0x3BD
|
||||
mfspr r23, 0x3BE
|
||||
mfspr r24, 0x3BB
|
||||
mfspr r25, 0x3B8
|
||||
mfspr r26, 0x3BC
|
||||
mfspr r27, 0x3FC
|
||||
mfspr r28, 0x3FD
|
||||
mfspr r29, 0x3FE
|
||||
mfspr r30, 0x3FB
|
||||
mfspr r31, 0x3F9
|
||||
stmw r19, 0x284(r2)
|
||||
blr
|
||||
mfspr r25, 0x3D0
|
||||
mfspr r26, 0x3D1
|
||||
mfspr r27, 0x3D2
|
||||
mfspr r28, 0x3D3
|
||||
mfspr r29, 0x3D4
|
||||
mfspr r30, 0x3D5
|
||||
mfspr r31, 0x3D6
|
||||
stmw r25, 0x240(r2)
|
||||
mfdec r31
|
||||
stw r31, 0x278(r2)
|
||||
blr
|
||||
*/
|
||||
loc_0xF4:
|
||||
lmw r16, 0x1A8(r2)
|
||||
mtsr 0, r16
|
||||
mtsr 1, r17
|
||||
mtsr 2, r18
|
||||
mtsr 3, r19
|
||||
mtsr 4, r20
|
||||
mtsr 5, r21
|
||||
mtsr 6, r22
|
||||
mtsr 7, r23
|
||||
mtsr 8, r24
|
||||
mtsr 9, r25
|
||||
mtsr 10, r26
|
||||
mtsr 11, r27
|
||||
mtsr 12, r28
|
||||
mtsr 13, r29
|
||||
mtsr 14, r30
|
||||
mtsr 15, r31
|
||||
lmw r12, 0x1F0(r2)
|
||||
mtspr 1008, r12
|
||||
mtspr 1009, r13
|
||||
mtsrr1 r14
|
||||
mtspr 287, r15
|
||||
mtibatu 0, r16
|
||||
mtibatl 0, r17
|
||||
mtibatu 1, r18
|
||||
mtibatl 1, r19
|
||||
mtibatu 2, r20
|
||||
mtibatl 2, r21
|
||||
mtibatu 3, r22
|
||||
mtibatl 3, r23
|
||||
mtdbatu 0, r24
|
||||
mtdbatl 0, r25
|
||||
mtdbatu 1, r26
|
||||
mtdbatl 1, r27
|
||||
mtdbatu 2, r28
|
||||
mtdbatl 2, r29
|
||||
mtdbatu 3, r30
|
||||
mtdbatl 3, r31
|
||||
lmw r22, 0x25C(r2)
|
||||
mtsdr1 r22
|
||||
mtdar r23
|
||||
mtdsisr r24
|
||||
mtsprg 0, r25
|
||||
mtsprg 1, r26
|
||||
mtsprg 2, r27
|
||||
mtsprg 3, r28
|
||||
mtspr 1010, r30
|
||||
mtear r31
|
||||
blr
|
||||
// clang-format on
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
|
||||
|
||||
MessageBuffer gTRKMsgBufs[3];
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void TRKSetBufferUsed(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
}
|
||||
void TRKSetBufferUsed(MessageBuffer* msg, BOOL state) { msg->isInUse = state; }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
@ -17,40 +16,15 @@ void TRKSetBufferUsed(void)
|
||||
*/
|
||||
DSError TRKInitializeMessageBuffers(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
lis r3, 0x804F
|
||||
stw r0, 0x24(r1)
|
||||
stw r31, 0x1C(r1)
|
||||
li r31, 0
|
||||
stw r30, 0x18(r1)
|
||||
addi r30, r3, 0x28B0
|
||||
stw r29, 0x14(r1)
|
||||
li r29, 0
|
||||
int i;
|
||||
for (i = 0; i < 3; i++) {
|
||||
TRKInitializeMutex(&gTRKMsgBufs[i]);
|
||||
TRKAcquireMutex(&gTRKMsgBufs[i]);
|
||||
TRKSetBufferUsed(&gTRKMsgBufs[i], FALSE);
|
||||
TRKReleaseMutex(&gTRKMsgBufs[i]);
|
||||
}
|
||||
|
||||
.loc_0x28:
|
||||
mr r3, r30
|
||||
bl 0x1C98
|
||||
mr r3, r30
|
||||
bl 0x1C88
|
||||
stw r31, 0x4(r30)
|
||||
mr r3, r30
|
||||
bl 0x1C74
|
||||
addi r29, r29, 0x1
|
||||
addi r30, r30, 0x890
|
||||
cmpwi r29, 0x3
|
||||
blt+ .loc_0x28
|
||||
lwz r0, 0x24(r1)
|
||||
li r3, 0
|
||||
lwz r31, 0x1C(r1)
|
||||
lwz r30, 0x18(r1)
|
||||
lwz r29, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
*/
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -58,71 +32,34 @@ DSError TRKInitializeMessageBuffers(void)
|
||||
* Address: 800BBF8C
|
||||
* Size: 0000C8
|
||||
*/
|
||||
void TRKGetFreeBuffer(void)
|
||||
DSError TRKGetFreeBuffer(int* msgID, MessageBuffer** outMsg)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
stw r0, 0x24(r1)
|
||||
li r0, 0
|
||||
stmw r27, 0xC(r1)
|
||||
mr r28, r4
|
||||
mr r27, r3
|
||||
li r30, 0x300
|
||||
li r29, 0
|
||||
stw r0, 0x0(r4)
|
||||
b .loc_0x94
|
||||
MessageBuffer* buf;
|
||||
DSError error = DS_NoMessageBufferAvailable;
|
||||
int i;
|
||||
|
||||
.loc_0x2C:
|
||||
cmpwi r29, 0
|
||||
li r31, 0
|
||||
blt- .loc_0x50
|
||||
cmpwi r29, 0x3
|
||||
bge- .loc_0x50
|
||||
mulli r4, r29, 0x890
|
||||
lis r3, 0x804F
|
||||
addi r0, r3, 0x28B0
|
||||
add r31, r0, r4
|
||||
*outMsg = nullptr;
|
||||
|
||||
.loc_0x50:
|
||||
mr r3, r31
|
||||
bl 0x1D30
|
||||
lwz r0, 0x4(r31)
|
||||
cmpwi r0, 0
|
||||
bne- .loc_0x88
|
||||
li r3, 0
|
||||
li r0, 0x1
|
||||
stw r3, 0x8(r31)
|
||||
li r30, 0
|
||||
stw r3, 0xC(r31)
|
||||
stw r0, 0x4(r31)
|
||||
stw r31, 0x0(r28)
|
||||
stw r29, 0x0(r27)
|
||||
li r29, 0x3
|
||||
for (i = 0; i < 3; i++) {
|
||||
buf = TRKGetBuffer(i);
|
||||
|
||||
.loc_0x88:
|
||||
mr r3, r31
|
||||
bl 0x1CF0
|
||||
addi r29, r29, 0x1
|
||||
TRKAcquireMutex(buf);
|
||||
if (!buf->isInUse) {
|
||||
TRKResetBuffer(buf, TRUE);
|
||||
TRKSetBufferUsed(buf, TRUE);
|
||||
error = DS_NoError;
|
||||
*outMsg = buf;
|
||||
*msgID = i;
|
||||
i = 3; // why not break? weird choice
|
||||
}
|
||||
TRKReleaseMutex(buf);
|
||||
}
|
||||
|
||||
.loc_0x94:
|
||||
cmpwi r29, 0x3
|
||||
blt+ .loc_0x2C
|
||||
cmpwi r30, 0x300
|
||||
bne- .loc_0xB0
|
||||
lis r3, 0x8048
|
||||
subi r3, r3, 0x68E0
|
||||
bl 0x34C
|
||||
if (error == DS_NoMessageBufferAvailable) {
|
||||
usr_puts_serial("ERROR : No buffer available\n");
|
||||
}
|
||||
|
||||
.loc_0xB0:
|
||||
mr r3, r30
|
||||
lmw r27, 0xC(r1)
|
||||
lwz r0, 0x24(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
*/
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -130,24 +67,14 @@ void TRKGetFreeBuffer(void)
|
||||
* Address: 800BBF60
|
||||
* Size: 00002C
|
||||
*/
|
||||
void* TRKGetBuffer(int p1)
|
||||
void* TRKGetBuffer(int idx)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
cmpwi r3, 0
|
||||
li r0, 0
|
||||
blt- .loc_0x24
|
||||
cmpwi r3, 0x3
|
||||
bge- .loc_0x24
|
||||
mulli r4, r3, 0x890
|
||||
lis r3, 0x804F
|
||||
addi r0, r3, 0x28B0
|
||||
add r0, r0, r4
|
||||
MessageBuffer* buf = nullptr;
|
||||
if (idx >= 0 && idx < 3) {
|
||||
buf = &gTRKMsgBufs[idx];
|
||||
}
|
||||
|
||||
.loc_0x24:
|
||||
mr r3, r0
|
||||
blr
|
||||
*/
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -155,38 +82,15 @@ void* TRKGetBuffer(int p1)
|
||||
* Address: 800BBEFC
|
||||
* Size: 000064
|
||||
*/
|
||||
void TRKReleaseBuffer(int p1)
|
||||
void TRKReleaseBuffer(int idx)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
cmpwi r3, -0x1
|
||||
stw r0, 0x14(r1)
|
||||
stw r31, 0xC(r1)
|
||||
beq- .loc_0x50
|
||||
cmpwi r3, 0
|
||||
blt- .loc_0x50
|
||||
cmpwi r3, 0x3
|
||||
bge- .loc_0x50
|
||||
mulli r4, r3, 0x890
|
||||
lis r3, 0x804F
|
||||
addi r0, r3, 0x28B0
|
||||
add r31, r0, r4
|
||||
mr r3, r31
|
||||
bl 0x1DD8
|
||||
li r0, 0
|
||||
mr r3, r31
|
||||
stw r0, 0x4(r31)
|
||||
bl 0x1DC0
|
||||
|
||||
.loc_0x50:
|
||||
lwz r0, 0x14(r1)
|
||||
lwz r31, 0xC(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
MessageBuffer* msg;
|
||||
if (idx != -1 && idx >= 0 && idx < 3) {
|
||||
msg = &gTRKMsgBufs[idx];
|
||||
TRKAcquireMutex(msg);
|
||||
TRKSetBufferUsed(msg, FALSE);
|
||||
TRKReleaseMutex(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -194,29 +98,14 @@ void TRKReleaseBuffer(int p1)
|
||||
* Address: 800BBEBC
|
||||
* Size: 000040
|
||||
*/
|
||||
void TRKResetBuffer(void)
|
||||
void TRKResetBuffer(MessageBuffer* msg, BOOL keepData)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
cmpwi r4, 0
|
||||
stw r0, 0x14(r1)
|
||||
li r0, 0
|
||||
stw r0, 0x8(r3)
|
||||
stw r0, 0xC(r3)
|
||||
bne- .loc_0x30
|
||||
addi r3, r3, 0x10
|
||||
li r4, 0
|
||||
li r5, 0x880
|
||||
bl -0xB8DE8
|
||||
msg->length = 0;
|
||||
msg->position = 0;
|
||||
|
||||
.loc_0x30:
|
||||
lwz r0, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
if (!keepData) {
|
||||
TRK_memset(msg->data, 0, 0x880);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -224,27 +113,22 @@ void TRKResetBuffer(void)
|
||||
* Address: 800BBE8C
|
||||
* Size: 000030
|
||||
*/
|
||||
DSError TRKSetBufferPosition(MessageBuffer* buffer, u32 p2)
|
||||
DSError TRKSetBufferPosition(MessageBuffer* msg, u32 pos)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
cmplwi r4, 0x880
|
||||
li r5, 0
|
||||
ble- .loc_0x14
|
||||
li r5, 0x301
|
||||
b .loc_0x28
|
||||
DSError error = DS_NoError;
|
||||
|
||||
.loc_0x14:
|
||||
stw r4, 0xC(r3)
|
||||
lwz r0, 0x8(r3)
|
||||
cmplw r4, r0
|
||||
ble- .loc_0x28
|
||||
stw r4, 0x8(r3)
|
||||
if (pos > 0x880) {
|
||||
error = DS_MessageBufferOverflow;
|
||||
} else {
|
||||
msg->position = pos;
|
||||
// If the new position is past the current length,
|
||||
// update the length
|
||||
if (pos > msg->length) {
|
||||
msg->length = pos;
|
||||
}
|
||||
}
|
||||
|
||||
.loc_0x28:
|
||||
mr r3, r5
|
||||
blr
|
||||
*/
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -252,62 +136,38 @@ DSError TRKSetBufferPosition(MessageBuffer* buffer, u32 p2)
|
||||
* Address: 800BBDE8
|
||||
* Size: 0000A4
|
||||
*/
|
||||
void TRKAppendBuffer(void)
|
||||
DSError TRKAppendBuffer(MessageBuffer* msg, const void* data, size_t length)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
stw r0, 0x24(r1)
|
||||
stw r31, 0x1C(r1)
|
||||
li r31, 0
|
||||
stw r30, 0x18(r1)
|
||||
mr. r30, r5
|
||||
stw r29, 0x14(r1)
|
||||
mr r29, r3
|
||||
bne- .loc_0x30
|
||||
li r3, 0
|
||||
b .loc_0x88
|
||||
DSError error = DS_NoError; // r31
|
||||
u32 bytesLeft;
|
||||
|
||||
.loc_0x30:
|
||||
lwz r3, 0xC(r29)
|
||||
subfic r0, r3, 0x880
|
||||
cmplw r0, r30
|
||||
bge- .loc_0x48
|
||||
li r31, 0x301
|
||||
mr r30, r0
|
||||
// Return if no bytes to append
|
||||
if (length == 0) {
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
.loc_0x48:
|
||||
cmplwi r30, 0x1
|
||||
bne- .loc_0x60
|
||||
lbz r0, 0x0(r4)
|
||||
add r3, r29, r3
|
||||
stb r0, 0x10(r3)
|
||||
b .loc_0x70
|
||||
bytesLeft = 0x880 - msg->position;
|
||||
|
||||
.loc_0x60:
|
||||
addi r3, r3, 0x10
|
||||
mr r5, r30
|
||||
add r3, r29, r3
|
||||
bl -0xB8D24
|
||||
// If there isn't enough space left in the buffer, change the number
|
||||
// of bytes to append to the remaning number of bytes
|
||||
if (bytesLeft < length) {
|
||||
error = DS_MessageBufferOverflow;
|
||||
length = bytesLeft;
|
||||
}
|
||||
|
||||
.loc_0x70:
|
||||
lwz r0, 0xC(r29)
|
||||
mr r3, r31
|
||||
add r0, r0, r30
|
||||
stw r0, 0xC(r29)
|
||||
lwz r0, 0xC(r29)
|
||||
stw r0, 0x8(r29)
|
||||
if (length == 1) {
|
||||
// If the length of bytes to append is 1, just copy the byte over
|
||||
msg->data[msg->position] = ((u8*)data)[0];
|
||||
} else {
|
||||
// Otherwise, use memcpy
|
||||
TRK_memcpy(msg->data + msg->position, data, length);
|
||||
}
|
||||
|
||||
.loc_0x88:
|
||||
lwz r0, 0x24(r1)
|
||||
lwz r31, 0x1C(r1)
|
||||
lwz r30, 0x18(r1)
|
||||
lwz r29, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
*/
|
||||
// Update the position and length
|
||||
msg->position += length;
|
||||
msg->length = msg->position;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -315,52 +175,28 @@ void TRKAppendBuffer(void)
|
||||
* Address: 800BBD5C
|
||||
* Size: 00008C
|
||||
*/
|
||||
void TRKReadBuffer(void)
|
||||
DSError TRKReadBuffer(MessageBuffer* msg, void* data, int length)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
stw r0, 0x24(r1)
|
||||
stw r31, 0x1C(r1)
|
||||
li r31, 0
|
||||
stw r30, 0x18(r1)
|
||||
mr. r30, r5
|
||||
stw r29, 0x14(r1)
|
||||
mr r29, r3
|
||||
mr r3, r4
|
||||
bne- .loc_0x34
|
||||
li r3, 0
|
||||
b .loc_0x70
|
||||
DSError error = DS_NoError;
|
||||
int bytesLeft;
|
||||
|
||||
.loc_0x34:
|
||||
lwz r4, 0xC(r29)
|
||||
lwz r0, 0x8(r29)
|
||||
sub r0, r0, r4
|
||||
cmplw r30, r0
|
||||
ble- .loc_0x50
|
||||
li r31, 0x302
|
||||
mr r30, r0
|
||||
// Return if no bytes to read
|
||||
if (length == 0) {
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
.loc_0x50:
|
||||
addi r4, r4, 0x10
|
||||
mr r5, r30
|
||||
add r4, r29, r4
|
||||
bl -0xB8C88
|
||||
lwz r0, 0xC(r29)
|
||||
mr r3, r31
|
||||
add r0, r0, r30
|
||||
stw r0, 0xC(r29)
|
||||
bytesLeft = msg->length - msg->position;
|
||||
|
||||
.loc_0x70:
|
||||
lwz r0, 0x24(r1)
|
||||
lwz r31, 0x1C(r1)
|
||||
lwz r30, 0x18(r1)
|
||||
lwz r29, 0x14(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
*/
|
||||
// If the number of bytes to read exceeds the buffer length, change
|
||||
// the length to the remaining number of bytes
|
||||
if (length > bytesLeft) {
|
||||
error = DS_MessageBufferReadError;
|
||||
length = bytesLeft;
|
||||
}
|
||||
|
||||
TRK_memcpy(data, msg->data + msg->position, length);
|
||||
msg->position += length;
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -378,9 +214,25 @@ void TRKAppendBuffer1_ui16(void)
|
||||
* Address: ........
|
||||
* Size: 0000D8
|
||||
*/
|
||||
void TRKAppendBuffer1_ui32(void)
|
||||
DSError TRKAppendBuffer1_ui32(MessageBuffer* buffer, const u32 data)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
u8* bigEndianData;
|
||||
u8* byteData;
|
||||
u8 swapBuffer[sizeof(data)];
|
||||
|
||||
if (gTRKBigEndian) {
|
||||
bigEndianData = (u8*)&data;
|
||||
} else {
|
||||
byteData = (u8*)&data;
|
||||
bigEndianData = swapBuffer;
|
||||
|
||||
bigEndianData[0] = byteData[3];
|
||||
bigEndianData[1] = byteData[2];
|
||||
bigEndianData[2] = byteData[1];
|
||||
bigEndianData[3] = byteData[0];
|
||||
}
|
||||
|
||||
return TRKAppendBuffer(buffer, (const void*)bigEndianData, sizeof(data));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -388,8 +240,28 @@ void TRKAppendBuffer1_ui32(void)
|
||||
* Address: 800BBC60
|
||||
* Size: 0000FC
|
||||
*/
|
||||
void TRKAppendBuffer1_ui64(void)
|
||||
DSError TRKAppendBuffer1_ui64(MessageBuffer* buffer, const u64 data)
|
||||
{
|
||||
u8* bigEndianData;
|
||||
u8* byteData;
|
||||
u8 swapBuffer[sizeof(data)];
|
||||
if (gTRKBigEndian) {
|
||||
bigEndianData = (u8*)&data;
|
||||
} else {
|
||||
byteData = (u8*)&data;
|
||||
bigEndianData = swapBuffer;
|
||||
|
||||
bigEndianData[0] = byteData[7];
|
||||
bigEndianData[1] = byteData[6];
|
||||
bigEndianData[2] = byteData[5];
|
||||
bigEndianData[3] = byteData[4];
|
||||
bigEndianData[4] = byteData[3];
|
||||
bigEndianData[5] = byteData[2];
|
||||
bigEndianData[6] = byteData[1];
|
||||
bigEndianData[7] = byteData[0];
|
||||
}
|
||||
|
||||
return TRKAppendBuffer(buffer, (const void*)bigEndianData, sizeof(data));
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x30(r1)
|
||||
@ -483,47 +355,16 @@ void TRKAppendBuffer1_ui128(void)
|
||||
* Address: 800BBBF8
|
||||
* Size: 000068
|
||||
*/
|
||||
DSError TRKAppendBuffer_ui8(MessageBuffer* buffer, u8* p2, int p3)
|
||||
DSError TRKAppendBuffer_ui8(MessageBuffer* buffer, const u8* data, int count)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
li r9, 0
|
||||
li r0, 0
|
||||
b .loc_0x50
|
||||
DSError err;
|
||||
int i;
|
||||
|
||||
.loc_0xC:
|
||||
lwz r7, 0xC(r3)
|
||||
lbz r8, 0x0(r4)
|
||||
cmplwi r7, 0x880
|
||||
blt- .loc_0x24
|
||||
li r7, 0x301
|
||||
b .loc_0x44
|
||||
for (i = 0, err = DS_NoError; err == DS_NoError && i < count; i++) {
|
||||
err = TRKAppendBuffer1_ui8(buffer, data[i]);
|
||||
}
|
||||
|
||||
.loc_0x24:
|
||||
addi r6, r7, 0x1
|
||||
addi r0, r7, 0x10
|
||||
stw r6, 0xC(r3)
|
||||
li r7, 0
|
||||
stbx r8, r3, r0
|
||||
lwz r6, 0x8(r3)
|
||||
addi r0, r6, 0x1
|
||||
stw r0, 0x8(r3)
|
||||
|
||||
.loc_0x44:
|
||||
mr r0, r7
|
||||
addi r9, r9, 0x1
|
||||
addi r4, r4, 0x1
|
||||
|
||||
.loc_0x50:
|
||||
cmpwi r0, 0
|
||||
bne- .loc_0x60
|
||||
cmpw r9, r5
|
||||
blt+ .loc_0xC
|
||||
|
||||
.loc_0x60:
|
||||
mr r3, r0
|
||||
blr
|
||||
*/
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -541,8 +382,16 @@ void TRKAppendBuffer_ui16(void)
|
||||
* Address: 800BBAFC
|
||||
* Size: 0000FC
|
||||
*/
|
||||
void TRKAppendBuffer_ui32(void)
|
||||
DSError TRKAppendBuffer_ui32(MessageBuffer* buffer, const u32* data, int count)
|
||||
{
|
||||
DSError err;
|
||||
int i;
|
||||
|
||||
for (i = 0, err = DS_NoError; err == DS_NoError && i < count; i++) {
|
||||
err = TRKAppendBuffer1_ui32(buffer, data[i]);
|
||||
}
|
||||
|
||||
return err;
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x30(r1)
|
||||
@ -652,10 +501,7 @@ void TRKAppendBuffer_ui128(void)
|
||||
* Address: ........
|
||||
* Size: 000080
|
||||
*/
|
||||
void TRKReadBuffer1_ui8(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
}
|
||||
DSError TRKReadBuffer1_ui8(MessageBuffer* buffer, u8* data) { return TRKReadBuffer(buffer, (void*)data, 1); }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
@ -672,8 +518,32 @@ void TRKReadBuffer1_ui16(void)
|
||||
* Address: ........
|
||||
* Size: 0000C8
|
||||
*/
|
||||
void TRKReadBuffer1_ui32(void)
|
||||
DSError TRKReadBuffer1_ui32(MessageBuffer* buffer, u32* data)
|
||||
{
|
||||
DSError err;
|
||||
|
||||
u8* bigEndianData;
|
||||
u8* byteData;
|
||||
u8 swapBuffer[sizeof(data)];
|
||||
|
||||
if (gTRKBigEndian) {
|
||||
bigEndianData = (u8*)data;
|
||||
} else {
|
||||
bigEndianData = swapBuffer;
|
||||
}
|
||||
|
||||
err = TRKReadBuffer(buffer, (void*)bigEndianData, sizeof(*data));
|
||||
|
||||
if (!gTRKBigEndian && err == DS_NoError) {
|
||||
byteData = (u8*)data;
|
||||
|
||||
byteData[0] = bigEndianData[3];
|
||||
byteData[1] = bigEndianData[2];
|
||||
byteData[2] = bigEndianData[1];
|
||||
byteData[3] = bigEndianData[0];
|
||||
}
|
||||
|
||||
return err;
|
||||
// UNUSED FUNCTION
|
||||
}
|
||||
|
||||
@ -682,31 +552,59 @@ void TRKReadBuffer1_ui32(void)
|
||||
* Address: 800BBA14
|
||||
* Size: 0000E8
|
||||
*/
|
||||
DSError TRKReadBuffer1_ui64(MessageBuffer* buffer, u8* p2)
|
||||
DSError TRKReadBuffer1_ui64(MessageBuffer* buffer, u64* data)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
DSError result = DS_NoError;
|
||||
u32 diff;
|
||||
u32 byteCount;
|
||||
u8* p;
|
||||
u8 littleEndianBuffer[20];
|
||||
p = (gTRKBigEndian ? p2 : littleEndianBuffer);
|
||||
result = DS_NoError;
|
||||
diff = buffer->_08 - buffer->_0C;
|
||||
byteCount = 8;
|
||||
if (diff < 8) {
|
||||
result = TRKError302;
|
||||
byteCount = diff;
|
||||
DSError err;
|
||||
|
||||
u8* bigEndianData;
|
||||
u8* byteData;
|
||||
u8 swapBuffer[sizeof(data)];
|
||||
|
||||
if (gTRKBigEndian) {
|
||||
bigEndianData = (u8*)data;
|
||||
} else {
|
||||
bigEndianData = swapBuffer;
|
||||
}
|
||||
TRK_memcpy(p, buffer->mBuffer + (buffer->_0C - 4), byteCount);
|
||||
buffer->_0C += byteCount;
|
||||
if (gTRKBigEndian == FALSE && result == DS_NoError) {
|
||||
for (i = 7, j = 0; j < 8; j++, i--) {
|
||||
p2[j] = littleEndianBuffer[i];
|
||||
}
|
||||
|
||||
err = TRKReadBuffer(buffer, (void*)bigEndianData, sizeof(*data));
|
||||
|
||||
if (!gTRKBigEndian && err == 0) {
|
||||
byteData = (u8*)data;
|
||||
|
||||
byteData[0] = bigEndianData[7];
|
||||
byteData[1] = bigEndianData[6];
|
||||
byteData[2] = bigEndianData[5];
|
||||
byteData[3] = bigEndianData[4];
|
||||
byteData[4] = bigEndianData[3];
|
||||
byteData[5] = bigEndianData[2];
|
||||
byteData[6] = bigEndianData[1];
|
||||
byteData[7] = bigEndianData[0];
|
||||
}
|
||||
return result;
|
||||
|
||||
return err;
|
||||
// int i;
|
||||
// int j;
|
||||
// DSError result = DS_NoError;
|
||||
// u32 diff;
|
||||
// u32 byteCount;
|
||||
// u8* p;
|
||||
// u8 littleEndianBuffer[20];
|
||||
// p = (gTRKBigEndian ? p2 : littleEndianBuffer);
|
||||
// result = DS_NoError;
|
||||
// diff = buffer->_08 - buffer->_0C;
|
||||
// byteCount = 8;
|
||||
// if (diff < 8) {
|
||||
// result = TRKError302;
|
||||
// byteCount = diff;
|
||||
// }
|
||||
// TRK_memcpy(p, buffer->mBuffer + (buffer->_0C - 4), byteCount);
|
||||
// buffer->_0C += byteCount;
|
||||
// if (gTRKBigEndian == FALSE && result == DS_NoError) {
|
||||
// for (i = 7, j = 0; j < 8; j++, i--) {
|
||||
// p2[j] = littleEndianBuffer[i];
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x30(r1)
|
||||
@ -793,24 +691,32 @@ void TRKReadBuffer1_ui128(MessageBuffer* buffer, u8* p2, int p3)
|
||||
* Address: 800BB97C
|
||||
* Size: 000098
|
||||
*/
|
||||
DSError TRKReadBuffer_ui8(MessageBuffer* buffer, u8* p2, int count)
|
||||
DSError TRKReadBuffer_ui8(MessageBuffer* buffer, u8* data, int count)
|
||||
{
|
||||
DSError result = DS_NoError;
|
||||
DSError err;
|
||||
int i;
|
||||
u32 diff;
|
||||
u32 byteCount;
|
||||
for (i = 0; (result == DS_NoError && i < count); i++) {
|
||||
result = DS_NoError;
|
||||
diff = buffer->_08 - buffer->_0C;
|
||||
byteCount = 1;
|
||||
if (diff == 0) {
|
||||
result = TRKError302;
|
||||
byteCount = diff;
|
||||
}
|
||||
TRK_memcpy(p2 + i, buffer->mBuffer + (buffer->_0C - 4), byteCount);
|
||||
buffer->_0C += byteCount;
|
||||
|
||||
for (i = 0, err = DS_NoError; err == DS_NoError && i < count; i++) {
|
||||
err = TRKReadBuffer1_ui8(buffer, &(data[i]));
|
||||
}
|
||||
return result;
|
||||
|
||||
return err;
|
||||
// DSError result = DS_NoError;
|
||||
// int i;
|
||||
// u32 diff;
|
||||
// u32 byteCount;
|
||||
// for (i = 0; (result == DS_NoError && i < count); i++) {
|
||||
// result = DS_NoError;
|
||||
// diff = buffer->_08 - buffer->_0C;
|
||||
// byteCount = 1;
|
||||
// if (diff == 0) {
|
||||
// result = TRKError302;
|
||||
// byteCount = diff;
|
||||
// }
|
||||
// TRK_memcpy(p2 + i, buffer->mBuffer + (buffer->_0C - 4), byteCount);
|
||||
// buffer->_0C += byteCount;
|
||||
// }
|
||||
// return result;
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
@ -877,34 +783,42 @@ void TRKReadBuffer_ui16(MessageBuffer* buffer, u8* p2, int p3)
|
||||
* Address: 800BB88C
|
||||
* Size: 0000F0
|
||||
*/
|
||||
DSError TRKReadBuffer_ui32(MessageBuffer* buffer, u8* p2, int count)
|
||||
DSError TRKReadBuffer_ui32(MessageBuffer* buffer, u32* data, int count)
|
||||
{
|
||||
DSError result = DS_NoError;
|
||||
u32 diff;
|
||||
DSError err;
|
||||
int i;
|
||||
u32 byteCount;
|
||||
u8* p;
|
||||
u8 littleEndianBuffer[4];
|
||||
for (i = 0; (result == DS_NoError && i < count); i++) {
|
||||
p = (gTRKBigEndian ? p2 : littleEndianBuffer);
|
||||
result = DS_NoError;
|
||||
diff = buffer->_08 - buffer->_0C;
|
||||
byteCount = 4;
|
||||
if (diff < 4) {
|
||||
result = TRKError302;
|
||||
byteCount = diff;
|
||||
}
|
||||
TRK_memcpy(p, buffer->mBuffer + (buffer->_0C - 4), byteCount);
|
||||
buffer->_0C += byteCount;
|
||||
if (gTRKBigEndian == FALSE && result == DS_NoError) {
|
||||
p2[0] = littleEndianBuffer[3];
|
||||
p2[1] = littleEndianBuffer[2];
|
||||
p2[2] = littleEndianBuffer[1];
|
||||
p2[3] = littleEndianBuffer[0];
|
||||
}
|
||||
p2 += 4;
|
||||
|
||||
for (i = 0, err = DS_NoError; err == DS_NoError && i < count; i++) {
|
||||
err = TRKReadBuffer1_ui32(buffer, &(data[i]));
|
||||
}
|
||||
return result;
|
||||
|
||||
return err;
|
||||
// DSError result = DS_NoError;
|
||||
// u32 diff;
|
||||
// int i;
|
||||
// u32 byteCount;
|
||||
// u8* p;
|
||||
// u8 littleEndianBuffer[4];
|
||||
// for (i = 0; (result == DS_NoError && i < count); i++) {
|
||||
// p = (gTRKBigEndian ? p2 : littleEndianBuffer);
|
||||
// result = DS_NoError;
|
||||
// diff = buffer->_08 - buffer->_0C;
|
||||
// byteCount = 4;
|
||||
// if (diff < 4) {
|
||||
// result = TRKError302;
|
||||
// byteCount = diff;
|
||||
// }
|
||||
// TRK_memcpy(p, buffer->mBuffer + (buffer->_0C - 4), byteCount);
|
||||
// buffer->_0C += byteCount;
|
||||
// if (gTRKBigEndian == FALSE && result == DS_NoError) {
|
||||
// p2[0] = littleEndianBuffer[3];
|
||||
// p2[1] = littleEndianBuffer[2];
|
||||
// p2[2] = littleEndianBuffer[1];
|
||||
// p2[3] = littleEndianBuffer[0];
|
||||
// }
|
||||
// p2 += 4;
|
||||
// }
|
||||
// return result;
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x30(r1)
|
||||
|
@ -1,12 +1,25 @@
|
||||
#include "types.h"
|
||||
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
|
||||
|
||||
static BOOL IsTRKConnected;
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800BD54C
|
||||
* Size: 0000A8
|
||||
*/
|
||||
void OutputData(void)
|
||||
void OutputData(void* data, int length)
|
||||
{
|
||||
// u8 byte;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
MWTRACE(8, "%02x ", ((u8*)data)[i]);
|
||||
if (i % 16 == 15) {
|
||||
MWTRACE(8, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
MWTRACE(8, "\n");
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
@ -65,31 +78,14 @@ void OutputData(void)
|
||||
* Address: 800BD53C
|
||||
* Size: 000010
|
||||
*/
|
||||
void GetTRKConnected(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
lis r3, 0x804F
|
||||
addi r3, r3, 0x4278
|
||||
lwz r3, 0x0(r3)
|
||||
blr
|
||||
*/
|
||||
}
|
||||
int GetTRKConnected(void) { return IsTRKConnected; }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800BD530
|
||||
* Size: 00000C
|
||||
*/
|
||||
void SetTRKConnected(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
lis r4, 0x804F
|
||||
stw r3, 0x4278(r4)
|
||||
blr
|
||||
*/
|
||||
}
|
||||
void SetTRKConnected(int isConnected) { IsTRKConnected = isConnected; }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
@ -106,9 +102,13 @@ void TRKMessageIntoReply(void)
|
||||
* Address: ........
|
||||
* Size: 000064
|
||||
*/
|
||||
void TRKSendACK(void)
|
||||
DSError TRKSendACK(MessageBuffer* buffer)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
DSError err;
|
||||
MWTRACE(1, "SendACK : Calling MessageSend\n");
|
||||
err = TRKMessageSend(buffer);
|
||||
MWTRACE(1, "MessageSend err : %ld\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -116,9 +116,17 @@ void TRKSendACK(void)
|
||||
* Address: ........
|
||||
* Size: 000064
|
||||
*/
|
||||
void TRKStandardACK(void)
|
||||
DSError TRKStandardACK(MessageBuffer* buffer, MessageCommandID commandID, DSReplyError replyError)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
CommandReply reply;
|
||||
u32 nextSequence;
|
||||
|
||||
memset((void*)&reply, 0, sizeof(CommandReply));
|
||||
reply.commandID.b = commandID;
|
||||
reply._00 = 0x40;
|
||||
reply.replyError.b = replyError;
|
||||
TRKWriteUARTN((void*)&reply, sizeof(CommandReply));
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -146,36 +154,10 @@ void TRKDoUnsupported(void)
|
||||
* Address: 800BD4CC
|
||||
* Size: 000064
|
||||
*/
|
||||
void TRKDoConnect(void)
|
||||
DSError TRKDoConnect(MessageBuffer* buffer)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x50(r1)
|
||||
mflr r0
|
||||
lis r3, 0x804F
|
||||
li r5, 0x40
|
||||
stw r0, 0x54(r1)
|
||||
addi r4, r3, 0x4278
|
||||
li r0, 0x1
|
||||
addi r3, r1, 0x8
|
||||
stw r0, 0x0(r4)
|
||||
li r4, 0
|
||||
bl -0xB8440
|
||||
li r3, 0x80
|
||||
li r5, 0x40
|
||||
li r0, 0
|
||||
stb r3, 0xC(r1)
|
||||
addi r3, r1, 0x8
|
||||
li r4, 0x40
|
||||
stw r5, 0x8(r1)
|
||||
stb r0, 0x10(r1)
|
||||
bl 0x30C0
|
||||
lwz r0, 0x54(r1)
|
||||
li r3, 0
|
||||
mtlr r0
|
||||
addi r1, r1, 0x50
|
||||
blr
|
||||
*/
|
||||
IsTRKConnected = TRUE;
|
||||
return TRKStandardACK(buffer, 0x80, DSREPLY_NoError);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -183,41 +165,15 @@ void TRKDoConnect(void)
|
||||
* Address: 800BD454
|
||||
* Size: 000078
|
||||
*/
|
||||
void TRKDoDisconnect(void)
|
||||
DSError TRKDoDisconnect(MessageBuffer* buffer)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x60(r1)
|
||||
mflr r0
|
||||
lis r3, 0x804F
|
||||
li r5, 0x40
|
||||
stw r0, 0x64(r1)
|
||||
addi r4, r3, 0x4278
|
||||
li r0, 0
|
||||
addi r3, r1, 0x14
|
||||
stw r0, 0x0(r4)
|
||||
li r4, 0
|
||||
bl -0xB83C8
|
||||
li r3, 0x80
|
||||
li r5, 0x40
|
||||
li r0, 0
|
||||
stb r3, 0x18(r1)
|
||||
addi r3, r1, 0x14
|
||||
li r4, 0x40
|
||||
stw r5, 0x14(r1)
|
||||
stb r0, 0x1C(r1)
|
||||
bl 0x3138
|
||||
addi r3, r1, 0x8
|
||||
li r4, 0x1
|
||||
bl -0x2000
|
||||
addi r3, r1, 0x8
|
||||
bl -0x1FF0
|
||||
lwz r0, 0x64(r1)
|
||||
li r3, 0
|
||||
mtlr r0
|
||||
addi r1, r1, 0x60
|
||||
blr
|
||||
*/
|
||||
TRKEvent event;
|
||||
|
||||
IsTRKConnected = FALSE;
|
||||
TRKStandardACK(buffer, 0x80, DSREPLY_NoError);
|
||||
TRKConstructEvent(&event, 1);
|
||||
TRKPostEvent(&event);
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -225,33 +181,11 @@ void TRKDoDisconnect(void)
|
||||
* Address: 800BD3FC
|
||||
* Size: 000058
|
||||
*/
|
||||
void TRKDoReset(void)
|
||||
DSError TRKDoReset(MessageBuffer* buffer)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x50(r1)
|
||||
mflr r0
|
||||
li r4, 0
|
||||
li r5, 0x40
|
||||
stw r0, 0x54(r1)
|
||||
addi r3, r1, 0x8
|
||||
bl -0xB8360
|
||||
li r3, 0x80
|
||||
li r5, 0x40
|
||||
li r0, 0
|
||||
stb r3, 0xC(r1)
|
||||
addi r3, r1, 0x8
|
||||
li r4, 0x40
|
||||
stw r5, 0x8(r1)
|
||||
stb r0, 0x10(r1)
|
||||
bl 0x31A0
|
||||
bl -0xB83B4
|
||||
lwz r0, 0x54(r1)
|
||||
li r3, 0
|
||||
mtlr r0
|
||||
addi r1, r1, 0x50
|
||||
blr
|
||||
*/
|
||||
TRKStandardACK(buffer, 0x80, DSREPLY_NoError);
|
||||
__TRK_reset();
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -259,33 +193,11 @@ void TRKDoReset(void)
|
||||
* Address: 800BD3A4
|
||||
* Size: 000058
|
||||
*/
|
||||
void TRKDoOverride(void)
|
||||
DSError TRKDoOverride(MessageBuffer* buffer)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x50(r1)
|
||||
mflr r0
|
||||
li r4, 0
|
||||
li r5, 0x40
|
||||
stw r0, 0x54(r1)
|
||||
addi r3, r1, 0x8
|
||||
bl -0xB8308
|
||||
li r3, 0x80
|
||||
li r5, 0x40
|
||||
li r0, 0
|
||||
stb r3, 0xC(r1)
|
||||
addi r3, r1, 0x8
|
||||
li r4, 0x40
|
||||
stw r5, 0x8(r1)
|
||||
stb r0, 0x10(r1)
|
||||
bl 0x31F8
|
||||
bl 0x2E84
|
||||
lwz r0, 0x54(r1)
|
||||
li r3, 0
|
||||
mtlr r0
|
||||
addi r1, r1, 0x50
|
||||
blr
|
||||
*/
|
||||
TRKStandardACK(buffer, 0x80, DSREPLY_NoError);
|
||||
__TRK_copy_vectors();
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -293,14 +205,14 @@ void TRKDoOverride(void)
|
||||
* Address: 800BD39C
|
||||
* Size: 000008
|
||||
*/
|
||||
u32 TRKDoVersions(void) { return 0x0; }
|
||||
DSError TRKDoVersions(MessageBuffer*) { return DS_NoError; }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800BD394
|
||||
* Size: 000008
|
||||
*/
|
||||
u32 TRKDoSupportMask(void) { return 0x0; }
|
||||
DSError TRKDoSupportMask(MessageBuffer*) { return DS_NoError; }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
@ -317,8 +229,75 @@ void TRKDoCPUType(void)
|
||||
* Address: 800BD150
|
||||
* Size: 000244
|
||||
*/
|
||||
void TRKDoReadMemory(void)
|
||||
DSError TRKDoReadMemory(MessageBuffer* buffer)
|
||||
{
|
||||
DSError result = DS_NoError;
|
||||
DSReplyError replyError;
|
||||
u8 options;
|
||||
u32 test;
|
||||
u32 start;
|
||||
u32 length;
|
||||
CommandReply reply3;
|
||||
|
||||
options = buffer->data[8];
|
||||
start = *(u32*)(buffer->data + 16);
|
||||
length = *(u16*)(buffer->data + 12);
|
||||
|
||||
MWTRACE(1, "ReadMemory (0x%02x) : 0x%08x 0x%08x 0x%08x\n", buffer->data[4], start, length, options);
|
||||
|
||||
if (options & 2) {
|
||||
return TRKStandardACK(buffer, DSMSG_ReplyACK, DSREPLY_UnsupportedOptionError);
|
||||
}
|
||||
|
||||
if (result == 0) {
|
||||
u8 buf[0x820];
|
||||
|
||||
size_t tempLength = length;
|
||||
|
||||
result = TRKTargetAccessMemory(buf, start, &tempLength, options & 0x8 ? 0 : 1, TRUE);
|
||||
TRKResetBuffer(buffer, 0);
|
||||
|
||||
if (result == DS_NoError) {
|
||||
memset(&reply3, 0, sizeof(CommandReply));
|
||||
reply3.replyError.b = result;
|
||||
reply3._00 = tempLength + 0x40;
|
||||
reply3.commandID.m = DSMSG_ReplyACK;
|
||||
TRKAppendBuffer(buffer, (u8*)&reply3, sizeof(CommandReply));
|
||||
|
||||
if (options & 0x40) {
|
||||
result = TRKAppendBuffer(buffer, buf + (start & 0x1F), tempLength);
|
||||
} else {
|
||||
result = TRKAppendBuffer(buffer, buf, tempLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result != DS_NoError) {
|
||||
switch (result) {
|
||||
case DS_CWDSException:
|
||||
replyError = DSREPLY_CWDSException;
|
||||
break;
|
||||
case DS_InvalidMemory:
|
||||
replyError = DSREPLY_InvalidMemoryRange;
|
||||
break;
|
||||
case DS_InvalidProcessID:
|
||||
replyError = DSREPLY_InvalidProcessID;
|
||||
break;
|
||||
case DS_InvalidThreadID:
|
||||
replyError = DSREPLY_InvalidThreadID;
|
||||
break;
|
||||
case DS_OSError:
|
||||
replyError = DSREPLY_OSError;
|
||||
break;
|
||||
default:
|
||||
replyError = DSREPLY_CWDSError;
|
||||
break;
|
||||
}
|
||||
|
||||
return TRKStandardACK(buffer, DSMSG_ReplyACK, replyError);
|
||||
}
|
||||
|
||||
return TRKSendACK(buffer);
|
||||
/*
|
||||
.loc_0x0:
|
||||
rlwinm r11,r1,0,27,31
|
||||
@ -492,7 +471,7 @@ void TRKDoReadMemory(void)
|
||||
* Address: 800BCF14
|
||||
* Size: 00023C
|
||||
*/
|
||||
void TRKDoWriteMemory(void)
|
||||
DSError TRKDoWriteMemory(MessageBuffer*)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
@ -663,7 +642,7 @@ void TRKDoWriteMemory(void)
|
||||
* Address: 800BCC34
|
||||
* Size: 0002E0
|
||||
*/
|
||||
void TRKDoReadRegisters(void)
|
||||
DSError TRKDoReadRegisters(MessageBuffer*)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
@ -889,7 +868,7 @@ void TRKDoReadRegisters(void)
|
||||
* Address: 800BC9A4
|
||||
* Size: 000290
|
||||
*/
|
||||
void TRKDoWriteRegisters(void)
|
||||
DSError TRKDoWriteRegisters(MessageBuffer*)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
@ -1117,7 +1096,7 @@ void TRKDoFlushCache(void)
|
||||
* Address: 800BC8F4
|
||||
* Size: 0000B0
|
||||
*/
|
||||
void TRKDoContinue(void)
|
||||
DSError TRKDoContinue(MessageBuffer*)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
@ -1177,7 +1156,7 @@ void TRKDoContinue(void)
|
||||
* Address: 800BC6D4
|
||||
* Size: 000220
|
||||
*/
|
||||
void TRKDoStep(void)
|
||||
DSError TRKDoStep(MessageBuffer*)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
@ -1347,7 +1326,7 @@ void TRKDoStep(void)
|
||||
* Address: 800BC62C
|
||||
* Size: 0000A8
|
||||
*/
|
||||
void TRKDoStop(void)
|
||||
DSError TRKDoStop(MessageBuffer*)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
@ -1415,7 +1394,7 @@ void TRKDoStop(void)
|
||||
* Address: 800BC584
|
||||
* Size: 0000A8
|
||||
*/
|
||||
void TRKDoSetOption(void)
|
||||
DSError TRKDoSetOption(MessageBuffer*)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
|
@ -1,76 +1,22 @@
|
||||
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
|
||||
|
||||
// forward declares
|
||||
DSIOResult __read_file(u32 handle, u8* buffer, size_t* count, void* ref_con);
|
||||
DSIOResult __write_file(u32 handle, u8* buffer, size_t* count, void* ref_con);
|
||||
DSIOResult __close_file(u32 handle, u8* buffer, size_t* count, void* ref_con);
|
||||
DSIOResult __access_file(u32 handle, u8* buffer, size_t* count, void* ref_con, MessageCommandID cmd);
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800C0B4C
|
||||
* Size: 0000BC
|
||||
*/
|
||||
void __read_console(void)
|
||||
DSIOResult __read_console(u32 handle, u8* buffer, size_t* count, void* ref_con)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
stw r0, 0x24(r1)
|
||||
stw r31, 0x1C(r1)
|
||||
mr r31, r5
|
||||
stw r30, 0x18(r1)
|
||||
mr r30, r4
|
||||
bl -0x178
|
||||
rlwinm. r0,r3,0,24,31
|
||||
bne- .loc_0x30
|
||||
li r3, 0x1
|
||||
b .loc_0xA4
|
||||
|
||||
.loc_0x30:
|
||||
bl -0x3640
|
||||
cmpwi r3, 0
|
||||
bne- .loc_0x44
|
||||
li r3, 0x1
|
||||
b .loc_0xA4
|
||||
|
||||
.loc_0x44:
|
||||
lwz r0, 0x0(r31)
|
||||
mr r6, r30
|
||||
addi r5, r1, 0x8
|
||||
li r3, 0xD1
|
||||
stw r0, 0x8(r1)
|
||||
li r4, 0
|
||||
bl -0x1168
|
||||
rlwinm r0,r3,0,24,31
|
||||
lwz r3, 0x8(r1)
|
||||
cmpwi r0, 0x1
|
||||
stw r3, 0x0(r31)
|
||||
beq- .loc_0xA0
|
||||
bge- .loc_0x84
|
||||
cmpwi r0, 0
|
||||
bge- .loc_0x90
|
||||
b .loc_0xA0
|
||||
|
||||
.loc_0x84:
|
||||
cmpwi r0, 0x3
|
||||
bge- .loc_0xA0
|
||||
b .loc_0x98
|
||||
|
||||
.loc_0x90:
|
||||
li r3, 0
|
||||
b .loc_0xA4
|
||||
|
||||
.loc_0x98:
|
||||
li r3, 0x2
|
||||
b .loc_0xA4
|
||||
|
||||
.loc_0xA0:
|
||||
li r3, 0x1
|
||||
|
||||
.loc_0xA4:
|
||||
lwz r0, 0x24(r1)
|
||||
lwz r31, 0x1C(r1)
|
||||
lwz r30, 0x18(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
*/
|
||||
if (GetUseSerialIO() == 0) {
|
||||
return DS_IOError;
|
||||
}
|
||||
return __read_file(DS_Stdin, buffer, count, ref_con);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -78,72 +24,12 @@ void __read_console(void)
|
||||
* Address: 800C0A90
|
||||
* Size: 0000BC
|
||||
*/
|
||||
void __TRK_write_console(void)
|
||||
DSIOResult __TRK_write_console(u32 handle, u8* buffer, size_t* count, void* ref_con)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
stw r0, 0x24(r1)
|
||||
stw r31, 0x1C(r1)
|
||||
mr r31, r5
|
||||
stw r30, 0x18(r1)
|
||||
mr r30, r4
|
||||
bl -0xBC
|
||||
rlwinm. r0,r3,0,24,31
|
||||
bne- .loc_0x30
|
||||
li r3, 0x1
|
||||
b .loc_0xA4
|
||||
|
||||
.loc_0x30:
|
||||
bl -0x3584
|
||||
cmpwi r3, 0
|
||||
bne- .loc_0x44
|
||||
li r3, 0x1
|
||||
b .loc_0xA4
|
||||
|
||||
.loc_0x44:
|
||||
lwz r0, 0x0(r31)
|
||||
mr r6, r30
|
||||
addi r5, r1, 0x8
|
||||
li r3, 0xD0
|
||||
stw r0, 0x8(r1)
|
||||
li r4, 0x1
|
||||
bl -0x10AC
|
||||
rlwinm r0,r3,0,24,31
|
||||
lwz r3, 0x8(r1)
|
||||
cmpwi r0, 0x1
|
||||
stw r3, 0x0(r31)
|
||||
beq- .loc_0xA0
|
||||
bge- .loc_0x84
|
||||
cmpwi r0, 0
|
||||
bge- .loc_0x90
|
||||
b .loc_0xA0
|
||||
|
||||
.loc_0x84:
|
||||
cmpwi r0, 0x3
|
||||
bge- .loc_0xA0
|
||||
b .loc_0x98
|
||||
|
||||
.loc_0x90:
|
||||
li r3, 0
|
||||
b .loc_0xA4
|
||||
|
||||
.loc_0x98:
|
||||
li r3, 0x2
|
||||
b .loc_0xA4
|
||||
|
||||
.loc_0xA0:
|
||||
li r3, 0x1
|
||||
|
||||
.loc_0xA4:
|
||||
lwz r0, 0x24(r1)
|
||||
lwz r31, 0x1C(r1)
|
||||
lwz r30, 0x18(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
*/
|
||||
if (GetUseSerialIO() == 0) {
|
||||
return DS_IOError;
|
||||
}
|
||||
return __write_file(DS_Stdout, buffer, count, ref_con);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -151,56 +37,16 @@ void __TRK_write_console(void)
|
||||
* Address: 800C0A0C
|
||||
* Size: 000084
|
||||
*/
|
||||
void __close_console(void)
|
||||
DSIOResult __close_console(u32 handle, u8* buffer, size_t* count, void* ref_con) { return __close_file(handle, buffer, count, ref_con); }
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: ........
|
||||
* Size: 0000B4
|
||||
*/
|
||||
DSIOResult __read_file(u32 handle, u8* buffer, size_t* count, void* ref_con)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
stw r0, 0x14(r1)
|
||||
stw r31, 0xC(r1)
|
||||
mr r31, r3
|
||||
bl -0x34E4
|
||||
cmpwi r3, 0
|
||||
bne- .loc_0x28
|
||||
li r3, 0x1
|
||||
b .loc_0x70
|
||||
|
||||
.loc_0x28:
|
||||
mr r4, r31
|
||||
li r3, 0xD3
|
||||
bl -0xFEC
|
||||
rlwinm r0,r3,0,24,31
|
||||
cmpwi r0, 0x1
|
||||
beq- .loc_0x6C
|
||||
bge- .loc_0x50
|
||||
cmpwi r0, 0
|
||||
bge- .loc_0x5C
|
||||
b .loc_0x6C
|
||||
|
||||
.loc_0x50:
|
||||
cmpwi r0, 0x3
|
||||
bge- .loc_0x6C
|
||||
b .loc_0x64
|
||||
|
||||
.loc_0x5C:
|
||||
li r3, 0
|
||||
b .loc_0x70
|
||||
|
||||
.loc_0x64:
|
||||
li r3, 0x2
|
||||
b .loc_0x70
|
||||
|
||||
.loc_0x6C:
|
||||
li r3, 0x1
|
||||
|
||||
.loc_0x70:
|
||||
lwz r0, 0x14(r1)
|
||||
lwz r31, 0xC(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
return __access_file(handle, buffer, count, ref_con, DSMSG_ReadFile);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -208,19 +54,9 @@ void __close_console(void)
|
||||
* Address: ........
|
||||
* Size: 0000B4
|
||||
*/
|
||||
void __read_file(void)
|
||||
DSIOResult __write_file(u32 handle, u8* buffer, size_t* count, void* ref_con)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
}
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: ........
|
||||
* Size: 0000B4
|
||||
*/
|
||||
void __write_file(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
return __access_file(handle, buffer, count, ref_con, DSMSG_WriteFile);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -238,9 +74,24 @@ void __open_file(void)
|
||||
* Address: ........
|
||||
* Size: 000084
|
||||
*/
|
||||
void __close_file(void)
|
||||
DSIOResult __close_file(u32 handle, u8* buffer, size_t* count, void* ref_con)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
u32 r0;
|
||||
|
||||
if (GetTRKConnected() == DS_NoError) {
|
||||
return DS_IOError;
|
||||
}
|
||||
|
||||
r0 = TRKCloseFile(DSMSG_CloseFile, handle);
|
||||
|
||||
switch ((u8)r0) {
|
||||
case DS_IONoError:
|
||||
return DS_IONoError;
|
||||
case DS_IOEOF:
|
||||
return DS_IOEOF;
|
||||
}
|
||||
|
||||
return DS_IOError;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -268,9 +119,27 @@ void convertFileMode(void)
|
||||
* Address: ........
|
||||
* Size: 0000C0
|
||||
*/
|
||||
void __access_file(void)
|
||||
DSIOResult __access_file(u32 handle, u8* buffer, size_t* count, void* ref_con, MessageCommandID cmd)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
size_t countTemp;
|
||||
u32 r0;
|
||||
|
||||
if (GetTRKConnected() == DS_NoError) {
|
||||
return DS_IOError;
|
||||
}
|
||||
|
||||
countTemp = *count;
|
||||
r0 = TRKAccessFile(cmd, handle, &countTemp, buffer);
|
||||
*count = countTemp;
|
||||
|
||||
switch ((u8)r0) {
|
||||
case DS_IONoError:
|
||||
return DS_IONoError;
|
||||
case DS_IOEOF:
|
||||
return DS_IOEOF;
|
||||
}
|
||||
|
||||
return DS_IOError;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,104 +1,54 @@
|
||||
#include "types.h"
|
||||
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
|
||||
|
||||
static TRKFramingState gTRKFramingState;
|
||||
void* gTRKInputPendingPtr;
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800BC244
|
||||
* Size: 00013C
|
||||
*/
|
||||
void TRKTestForPacket(void)
|
||||
MessageBufferID TRKTestForPacket()
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x8E0(r1)
|
||||
mflr r0
|
||||
lis r3, 0x8048
|
||||
stw r0, 0x8E4(r1)
|
||||
stw r31, 0x8DC(r1)
|
||||
subi r31, r3, 0x68C0
|
||||
stw r30, 0x8D8(r1)
|
||||
bl 0x43F0
|
||||
cmpwi r3, 0
|
||||
bgt- .loc_0x30
|
||||
li r3, -0x1
|
||||
b .loc_0x124
|
||||
u8 payloadBuf[0x880];
|
||||
u8 packetBuf[0x40];
|
||||
int bufID;
|
||||
MessageBuffer* msg;
|
||||
MessageBufferID result;
|
||||
|
||||
.loc_0x30:
|
||||
addi r3, r1, 0xC
|
||||
addi r4, r1, 0x8
|
||||
bl -0x2F0
|
||||
mr r30, r3
|
||||
addi r4, r31, 0xD0
|
||||
li r3, 0x4
|
||||
mr r5, r30
|
||||
crclr 6, 0x6
|
||||
bl 0x52B4
|
||||
lwz r3, 0x8(r1)
|
||||
li r4, 0
|
||||
bl -0x414
|
||||
addi r3, r1, 0x10
|
||||
li r4, 0x40
|
||||
bl 0x4368
|
||||
cmpwi r3, 0
|
||||
bne- .loc_0xF0
|
||||
lwz r3, 0x8(r1)
|
||||
addi r4, r1, 0x10
|
||||
li r5, 0x40
|
||||
bl -0x6CC
|
||||
lwz r3, 0x10(r1)
|
||||
lwz r30, 0xC(r1)
|
||||
subic. r5, r3, 0x40
|
||||
ble- .loc_0x10C
|
||||
addi r4, r31, 0xF4
|
||||
li r3, 0x1
|
||||
crclr 6, 0x6
|
||||
bl 0x5264
|
||||
lwz r4, 0x10(r1)
|
||||
addi r3, r1, 0x50
|
||||
subi r4, r4, 0x40
|
||||
bl 0x4320
|
||||
cmpwi r3, 0
|
||||
bne- .loc_0xD0
|
||||
lwz r3, 0x8(r1)
|
||||
addi r4, r1, 0x50
|
||||
lwz r5, 0x10(r1)
|
||||
bl -0x714
|
||||
b .loc_0x10C
|
||||
if (TRKPollUART() <= 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
.loc_0xD0:
|
||||
addi r4, r31, 0x110
|
||||
li r3, 0x8
|
||||
crclr 6, 0x6
|
||||
bl 0x5228
|
||||
mr r3, r30
|
||||
bl -0x42C
|
||||
li r30, -0x1
|
||||
b .loc_0x10C
|
||||
result = TRKGetFreeBuffer(&bufID, &msg);
|
||||
|
||||
.loc_0xF0:
|
||||
addi r4, r31, 0x144
|
||||
li r3, 0x8
|
||||
crclr 6, 0x6
|
||||
bl 0x5208
|
||||
mr r3, r30
|
||||
bl -0x44C
|
||||
li r30, -0x1
|
||||
MWTRACE(4, "TestForPacket : FreeBuffer is %ld\n", result);
|
||||
|
||||
.loc_0x10C:
|
||||
mr r5, r30
|
||||
addi r4, r31, 0x16C
|
||||
li r3, 0x1
|
||||
crclr 6, 0x6
|
||||
bl 0x51E8
|
||||
mr r3, r30
|
||||
TRKSetBufferPosition(msg, 0);
|
||||
if (TRKReadUARTN(packetBuf, 0x40) == UART_NoError) {
|
||||
int readSize;
|
||||
|
||||
.loc_0x124:
|
||||
lwz r0, 0x8E4(r1)
|
||||
lwz r31, 0x8DC(r1)
|
||||
lwz r30, 0x8D8(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x8E0
|
||||
blr
|
||||
*/
|
||||
TRKAppendBuffer_ui8(msg, packetBuf, 0x40);
|
||||
readSize = ((u32*)packetBuf)[0] - 0x40;
|
||||
result = bufID;
|
||||
if (readSize > 0) {
|
||||
MWTRACE(1, "Reading payload %ld bytes\n", readSize);
|
||||
if (TRKReadUARTN(payloadBuf, ((u32*)packetBuf)[0] - 0x40) == UART_NoError) {
|
||||
TRKAppendBuffer_ui8(msg, payloadBuf, ((u32*)packetBuf)[0]);
|
||||
} else {
|
||||
MWTRACE(8, "TestForPacket : Invalid size of packet hdr.size\n");
|
||||
TRKReleaseBuffer(result);
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MWTRACE(8, "TestForPacket : Invalid size of packet\n");
|
||||
TRKReleaseBuffer(result);
|
||||
result = -1;
|
||||
}
|
||||
|
||||
MWTRACE(1, "TestForPacket returning %ld\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -108,37 +58,15 @@ void TRKTestForPacket(void)
|
||||
*/
|
||||
void TRKGetInput(void)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
stw r0, 0x24(r1)
|
||||
stw r31, 0x1C(r1)
|
||||
bl .loc_0x60
|
||||
mr r31, r3
|
||||
cmpwi r31, -0x1
|
||||
beq- .loc_0x4C
|
||||
bl -0x2A4
|
||||
addi r3, r1, 0x8
|
||||
li r4, 0x2
|
||||
bl -0xD64
|
||||
lis r3, 0x804F
|
||||
li r0, -0x1
|
||||
addi r4, r3, 0x4260
|
||||
stw r31, 0x10(r1)
|
||||
addi r3, r1, 0x8
|
||||
stw r0, 0x0(r4)
|
||||
bl -0xD68
|
||||
|
||||
.loc_0x4C:
|
||||
lwz r0, 0x24(r1)
|
||||
lwz r31, 0x1C(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
|
||||
.loc_0x60:
|
||||
*/
|
||||
MessageBufferID id = TRKTestForPacket();
|
||||
if (id != -1) {
|
||||
TRKEvent event;
|
||||
TRKGetBuffer(id);
|
||||
TRKConstructEvent(&event, NUBEVENT_Request);
|
||||
event.msgBufID = id;
|
||||
gTRKFramingState.msgBufID = -1;
|
||||
TRKPostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -146,31 +74,14 @@ void TRKGetInput(void)
|
||||
* Address: 800BC194
|
||||
* Size: 000050
|
||||
*/
|
||||
void TRKProcessInput(void)
|
||||
void TRKProcessInput(int bufferIdx)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
li r4, 0x2
|
||||
stw r0, 0x24(r1)
|
||||
stw r31, 0x1C(r1)
|
||||
mr r31, r3
|
||||
addi r3, r1, 0x8
|
||||
bl -0xD04
|
||||
lis r3, 0x804F
|
||||
li r0, -0x1
|
||||
addi r4, r3, 0x4260
|
||||
stw r31, 0x10(r1)
|
||||
addi r3, r1, 0x8
|
||||
stw r0, 0x0(r4)
|
||||
bl -0xD08
|
||||
lwz r0, 0x24(r1)
|
||||
lwz r31, 0x1C(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
*/
|
||||
TRKEvent event;
|
||||
|
||||
TRKConstructEvent(&event, NUBEVENT_Request);
|
||||
event.msgBufID = bufferIdx;
|
||||
gTRKFramingState.msgBufID = -1;
|
||||
TRKPostEvent(&event);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -178,60 +89,20 @@ void TRKProcessInput(void)
|
||||
* Address: 800BC0D0
|
||||
* Size: 0000C4
|
||||
*/
|
||||
void TRKInitializeSerialHandler(void)
|
||||
DSError TRKInitializeSerialHandler()
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
lis r3, 0x804F
|
||||
lis r4, 0x8048
|
||||
stw r0, 0x14(r1)
|
||||
addi r6, r3, 0x4260
|
||||
li r0, 0
|
||||
li r3, -0x1
|
||||
stw r31, 0xC(r1)
|
||||
subi r31, r4, 0x68C0
|
||||
addi r4, r31, 0
|
||||
li r5, 0x40
|
||||
stw r3, 0x0(r6)
|
||||
li r3, 0x1
|
||||
stw r0, 0x8(r6)
|
||||
stw r0, 0xC(r6)
|
||||
crclr 6, 0x6
|
||||
bl 0x5434
|
||||
addi r4, r31, 0x24
|
||||
li r3, 0x1
|
||||
li r5, 0x40
|
||||
crclr 6, 0x6
|
||||
bl 0x5420
|
||||
addi r4, r31, 0x48
|
||||
li r3, 0x1
|
||||
li r5, 0x40
|
||||
crclr 6, 0x6
|
||||
bl 0x540C
|
||||
addi r4, r31, 0x6C
|
||||
li r3, 0x1
|
||||
li r5, 0x40
|
||||
crclr 6, 0x6
|
||||
bl 0x53F8
|
||||
addi r4, r31, 0x8C
|
||||
li r3, 0x1
|
||||
li r5, 0x40
|
||||
crclr 6, 0x6
|
||||
bl 0x53E4
|
||||
addi r4, r31, 0xAC
|
||||
li r3, 0x1
|
||||
li r5, 0x40
|
||||
crclr 6, 0x6
|
||||
bl 0x53D0
|
||||
lwz r0, 0x14(r1)
|
||||
li r3, 0
|
||||
lwz r31, 0xC(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
*/
|
||||
gTRKFramingState.msgBufID = -1;
|
||||
gTRKFramingState.receiveState = DSRECV_Wait;
|
||||
gTRKFramingState.isEscape = FALSE;
|
||||
|
||||
MWTRACE(1, "TRK_Packet_Header \t %ld bytes\n", 0x40);
|
||||
MWTRACE(1, "TRK_CMD_ReadMemory %ld bytes\n", 0x40);
|
||||
MWTRACE(1, "TRK_CMD_WriteMemory %ld bytes\n", 0x40);
|
||||
MWTRACE(1, "TRK_CMD_Connect \t %ld bytes\n", 0x40);
|
||||
MWTRACE(1, "TRK_CMD_ReplyAck\t %ld bytes\n", 0x40);
|
||||
MWTRACE(1, "TRK_CMD_ReadRegisters\t%ld bytes\n", 0x40);
|
||||
|
||||
return DS_NoError;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -239,4 +110,4 @@ void TRKInitializeSerialHandler(void)
|
||||
* Address: 800BC0C8
|
||||
* Size: 000008
|
||||
*/
|
||||
u32 TRKTerminateSerialHandler(void) { return 0x0; }
|
||||
DSError TRKTerminateSerialHandler(void) { return DS_NoError; }
|
||||
|
@ -1,12 +1,85 @@
|
||||
|
||||
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: 800BDAE8
|
||||
* Size: 000220
|
||||
*/
|
||||
void TRKSuppAccessFile(void)
|
||||
DSError TRKSuppAccessFile(u32 file_handle, u8* data, size_t* count, DSIOResult* io_result, BOOL need_reply, BOOL read)
|
||||
{
|
||||
u32 length;
|
||||
DSError error;
|
||||
int replyBufferId;
|
||||
MessageBuffer* replyBuffer;
|
||||
int bufferId;
|
||||
MessageBuffer* buffer;
|
||||
u32 i;
|
||||
u8 replyIOResult;
|
||||
u32 replyLength;
|
||||
BOOL exit;
|
||||
CommandReply reply;
|
||||
|
||||
if (data == nullptr || *count == 0) {
|
||||
return DS_ParameterError;
|
||||
}
|
||||
|
||||
for (exit = FALSE, *io_result = DS_IONoError, i = 0, error = DS_NoError; !exit && i < *count && error == DS_NoError && *io_result == 0;
|
||||
i += length) {
|
||||
memset(&reply, 0, sizeof(CommandReply));
|
||||
|
||||
length = (*count - i <= 0x800) ? *count - i : 0x800;
|
||||
|
||||
reply.commandID.m = read ? DSMSG_ReadFile : DSMSG_WriteFile;
|
||||
|
||||
if (read) {
|
||||
reply._00 = 0x40;
|
||||
} else {
|
||||
reply._00 = length + 0x40;
|
||||
}
|
||||
|
||||
reply.replyError.r = file_handle;
|
||||
*(u16*)&reply._0C = length;
|
||||
|
||||
TRKGetFreeBuffer(&bufferId, &buffer);
|
||||
error = TRKAppendBuffer_ui8(buffer, (u8*)&reply, 0x40);
|
||||
|
||||
if (!read && error == DS_NoError) {
|
||||
error = TRKAppendBuffer_ui8(buffer, data + i, length);
|
||||
}
|
||||
|
||||
if (error == DS_NoError) {
|
||||
if (need_reply) {
|
||||
error = TRKRequestSend(buffer, &replyBufferId, 5, 3, need_reply == 0);
|
||||
if (error == DS_NoError) {
|
||||
replyBuffer = TRKGetBuffer(replyBufferId);
|
||||
}
|
||||
replyIOResult = (u8) * (u32*)(replyBuffer->data + 0x10);
|
||||
replyLength = *(u16*)(replyBuffer->data + 0x14);
|
||||
if (read && error == DS_NoError && replyLength <= length) {
|
||||
TRKSetBufferPosition(replyBuffer, 0x40);
|
||||
error = TRKReadBuffer_ui8(replyBuffer, data + i, replyLength);
|
||||
if (error == DS_MessageBufferReadError) {
|
||||
error = DS_NoError;
|
||||
}
|
||||
}
|
||||
|
||||
if (replyLength != length) {
|
||||
length = replyLength;
|
||||
exit = TRUE;
|
||||
}
|
||||
|
||||
*io_result = replyIOResult;
|
||||
TRKReleaseBuffer(replyBufferId);
|
||||
} else {
|
||||
error = TRKMessageSend(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
TRKReleaseBuffer(bufferId);
|
||||
}
|
||||
|
||||
*count = i;
|
||||
return error;
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x90(r1)
|
||||
@ -185,8 +258,70 @@ void TRKSuppAccessFile(void)
|
||||
* Address: 800BD908
|
||||
* Size: 0001E0
|
||||
*/
|
||||
void TRKRequestSend(void)
|
||||
DSError TRKRequestSend(MessageBuffer* msgBuf, int* bufferId, u32 p1, u32 p2, u32 p3)
|
||||
{
|
||||
DSError error = DS_NoError;
|
||||
MessageBuffer* buffer;
|
||||
u8 msgCmd;
|
||||
u8 msgReplyError;
|
||||
BOOL badReply;
|
||||
int count = p2 + 1;
|
||||
|
||||
*bufferId = -1;
|
||||
|
||||
while (count != 0 && *bufferId == -1 && error == DS_NoError) {
|
||||
MWTRACE(1, "Calling MessageSend\n");
|
||||
error = TRKMessageSend(msgBuf);
|
||||
if (error == DS_NoError) {
|
||||
badReply = FALSE;
|
||||
|
||||
while (TRUE) {
|
||||
do {
|
||||
*bufferId = TRKTestForPacket();
|
||||
} while (*bufferId == -1);
|
||||
|
||||
buffer = TRKGetBuffer(*bufferId);
|
||||
TRKSetBufferPosition(buffer, 0);
|
||||
OutputData(&buffer->data[0], buffer->length);
|
||||
msgCmd = buffer->data[4];
|
||||
MWTRACE(1, "msg_command : 0x%02x hdr->cmdID 0x%02x\n", msgCmd, msgCmd);
|
||||
|
||||
if (msgCmd >= DSMSG_ReplyACK)
|
||||
break;
|
||||
TRKProcessInput(*bufferId);
|
||||
*bufferId = -1;
|
||||
}
|
||||
|
||||
if (*bufferId != -1) {
|
||||
if (buffer->length < 0x40) {
|
||||
// OSReport("MetroTRK - bad reply size %ld\n", buffer->length);
|
||||
badReply = TRUE;
|
||||
}
|
||||
if (error == DS_NoError && !badReply) {
|
||||
msgReplyError = buffer->data[8];
|
||||
MWTRACE(1, "msg_error : 0x%02x\n", msgReplyError);
|
||||
}
|
||||
if (error == DS_NoError && !badReply) {
|
||||
if ((int)msgCmd != DSMSG_ReplyACK || msgReplyError != DSREPLY_NoError) {
|
||||
MWTRACE(8, "RequestSend : Bad ack or non ack received msg_command : 0x%02x msg_error 0x%02x\n", msgCmd,
|
||||
msgReplyError);
|
||||
badReply = TRUE;
|
||||
}
|
||||
}
|
||||
if (error != DS_NoError || badReply) {
|
||||
TRKReleaseBuffer(*bufferId);
|
||||
*bufferId = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
count--;
|
||||
}
|
||||
|
||||
if (*bufferId == -1) {
|
||||
error = DS_Error800;
|
||||
}
|
||||
|
||||
return error;
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x40(r1)
|
||||
@ -343,90 +478,42 @@ void TRKRequestSend(void)
|
||||
* Address: 800BD7EC
|
||||
* Size: 00011C
|
||||
*/
|
||||
void HandleOpenFileSupportRequest(void)
|
||||
DSError HandleOpenFileSupportRequest(const char* path, u8 replyError, u32* param_3, DSIOResult* ioResult)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x70(r1)
|
||||
mflr r0
|
||||
stw r0, 0x74(r1)
|
||||
stmw r27, 0x5C(r1)
|
||||
mr r27, r3
|
||||
mr r31, r4
|
||||
mr r28, r5
|
||||
mr r29, r6
|
||||
addi r3, r1, 0x14
|
||||
li r4, 0
|
||||
li r5, 0x40
|
||||
bl -0xB8764
|
||||
li r3, 0
|
||||
li r0, 0xD2
|
||||
stw r3, 0x0(r28)
|
||||
mr r3, r27
|
||||
stb r0, 0x18(r1)
|
||||
bl 0xD0E0
|
||||
addi r0, r3, 0x41
|
||||
stb r31, 0x1C(r1)
|
||||
mr r3, r27
|
||||
stw r0, 0x14(r1)
|
||||
bl 0xD0CC
|
||||
addi r0, r3, 0x1
|
||||
addi r3, r1, 0xC
|
||||
sth r0, 0x20(r1)
|
||||
addi r4, r1, 0x8
|
||||
bl -0x18CC
|
||||
lwz r3, 0x8(r1)
|
||||
addi r4, r1, 0x14
|
||||
li r5, 0x40
|
||||
bl -0x1C70
|
||||
mr. r31, r3
|
||||
bne- .loc_0xA8
|
||||
mr r3, r27
|
||||
bl 0xD098
|
||||
mr r5, r3
|
||||
lwz r3, 0x8(r1)
|
||||
mr r4, r27
|
||||
addi r5, r5, 0x1
|
||||
bl -0x1C94
|
||||
mr r31, r3
|
||||
DSError error;
|
||||
int bufferId2;
|
||||
int bufferId1;
|
||||
MessageBuffer* tempBuffer;
|
||||
MessageBuffer* buffer;
|
||||
CommandReply reply;
|
||||
|
||||
.loc_0xA8:
|
||||
cmpwi r31, 0
|
||||
bne- .loc_0xFC
|
||||
li r0, 0
|
||||
addi r4, r1, 0x10
|
||||
stw r0, 0x0(r29)
|
||||
li r5, 0x7
|
||||
li r6, 0x3
|
||||
li r7, 0
|
||||
lwz r3, 0x8(r1)
|
||||
bl .loc_0x11C
|
||||
mr. r31, r3
|
||||
bne- .loc_0xE4
|
||||
lwz r3, 0x10(r1)
|
||||
bl -0x1968
|
||||
mr r30, r3
|
||||
memset(&reply, 0, sizeof(CommandReply));
|
||||
*param_3 = 0;
|
||||
reply.commandID.b = DSMSG_OpenFile;
|
||||
reply._00 = strlen(path) + 0x40 + 1;
|
||||
reply.replyError.b = replyError;
|
||||
*(u16*)&reply._0C = strlen(path) + 1;
|
||||
TRKGetFreeBuffer(&bufferId1, &buffer);
|
||||
error = TRKAppendBuffer_ui8(buffer, (u8*)&reply, 0x40);
|
||||
|
||||
.loc_0xE4:
|
||||
lwz r0, 0x20(r30)
|
||||
stw r0, 0x0(r29)
|
||||
lwz r0, 0x18(r30)
|
||||
stw r0, 0x0(r28)
|
||||
lwz r3, 0x10(r1)
|
||||
bl -0x19E8
|
||||
if (error == DS_NoError) {
|
||||
error = TRKAppendBuffer_ui8(buffer, (u8*)path, strlen(path) + 1);
|
||||
}
|
||||
|
||||
.loc_0xFC:
|
||||
lwz r3, 0xC(r1)
|
||||
bl -0x19F0
|
||||
mr r3, r31
|
||||
lmw r27, 0x5C(r1)
|
||||
lwz r0, 0x74(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x70
|
||||
blr
|
||||
if (error == DS_NoError) {
|
||||
*ioResult = DS_IONoError;
|
||||
error = TRKRequestSend(buffer, &bufferId2, 7, 3, 0);
|
||||
|
||||
.loc_0x11C:
|
||||
*/
|
||||
if (error == DS_NoError) {
|
||||
tempBuffer = TRKGetBuffer(bufferId2);
|
||||
}
|
||||
|
||||
*ioResult = *(u32*)(tempBuffer->data + 0x10);
|
||||
*param_3 = *(u32*)(tempBuffer->data + 0x8);
|
||||
TRKReleaseBuffer(bufferId2);
|
||||
}
|
||||
TRKReleaseBuffer(bufferId1);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -434,77 +521,42 @@ void HandleOpenFileSupportRequest(void)
|
||||
* Address: 800BD704
|
||||
* Size: 0000E8
|
||||
*/
|
||||
void HandleCloseFileSupportRequest(void)
|
||||
DSError HandleCloseFileSupportRequest(int replyError, DSIOResult* ioResult)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x70(r1)
|
||||
mflr r0
|
||||
li r5, 0x40
|
||||
stw r0, 0x74(r1)
|
||||
stw r31, 0x6C(r1)
|
||||
mr r31, r3
|
||||
addi r3, r1, 0x14
|
||||
stw r30, 0x68(r1)
|
||||
stw r29, 0x64(r1)
|
||||
mr r29, r4
|
||||
li r4, 0
|
||||
bl -0xB867C
|
||||
li r3, 0xD3
|
||||
li r0, 0x40
|
||||
stb r3, 0x18(r1)
|
||||
addi r3, r1, 0xC
|
||||
addi r4, r1, 0x8
|
||||
stw r0, 0x14(r1)
|
||||
stw r31, 0x1C(r1)
|
||||
bl -0x17C4
|
||||
mr. r31, r3
|
||||
bne- .loc_0x6C
|
||||
lwz r3, 0x8(r1)
|
||||
addi r4, r1, 0x14
|
||||
li r5, 0x40
|
||||
bl -0x1B70
|
||||
mr r31, r3
|
||||
DSError error;
|
||||
int replyBufferId;
|
||||
int bufferId;
|
||||
MessageBuffer* buffer1;
|
||||
MessageBuffer* buffer2;
|
||||
CommandReply reply;
|
||||
|
||||
.loc_0x6C:
|
||||
cmpwi r31, 0
|
||||
bne- .loc_0xC0
|
||||
li r0, 0
|
||||
addi r4, r1, 0x10
|
||||
stw r0, 0x0(r29)
|
||||
li r5, 0x3
|
||||
li r6, 0x3
|
||||
li r7, 0
|
||||
lwz r3, 0x8(r1)
|
||||
bl 0x174
|
||||
mr. r31, r3
|
||||
bne- .loc_0xA8
|
||||
lwz r3, 0x10(r1)
|
||||
bl -0x1844
|
||||
mr r30, r3
|
||||
memset(&reply, 0, sizeof(CommandReply));
|
||||
reply.commandID.b = DSMSG_CloseFile;
|
||||
reply._00 = 0x40;
|
||||
reply.replyError.r = replyError;
|
||||
error = TRKGetFreeBuffer(&bufferId, &buffer1);
|
||||
|
||||
.loc_0xA8:
|
||||
cmpwi r31, 0
|
||||
bne- .loc_0xB8
|
||||
lwz r0, 0x20(r30)
|
||||
stw r0, 0x0(r29)
|
||||
if (error == DS_NoError) {
|
||||
error = TRKAppendBuffer_ui8(buffer1, (u8*)&reply, sizeof(CommandReply));
|
||||
}
|
||||
|
||||
.loc_0xB8:
|
||||
lwz r3, 0x10(r1)
|
||||
bl -0x18C4
|
||||
if (error == DS_NoError) {
|
||||
*ioResult = DS_IONoError;
|
||||
error = TRKRequestSend(buffer1, &replyBufferId, 3, 3, 0);
|
||||
|
||||
.loc_0xC0:
|
||||
lwz r3, 0xC(r1)
|
||||
bl -0x18CC
|
||||
lwz r0, 0x74(r1)
|
||||
mr r3, r31
|
||||
lwz r31, 0x6C(r1)
|
||||
lwz r30, 0x68(r1)
|
||||
lwz r29, 0x64(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x70
|
||||
blr
|
||||
*/
|
||||
if (error == DS_NoError) {
|
||||
buffer2 = TRKGetBuffer(replyBufferId);
|
||||
}
|
||||
|
||||
if (error == DS_NoError) {
|
||||
*ioResult = *(u32*)(buffer2->data + 0x10);
|
||||
}
|
||||
|
||||
TRKReleaseBuffer(replyBufferId);
|
||||
}
|
||||
|
||||
TRKReleaseBuffer(bufferId);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -512,83 +564,44 @@ void HandleCloseFileSupportRequest(void)
|
||||
* Address: 800BD5F4
|
||||
* Size: 000110
|
||||
*/
|
||||
void HandlePositionFileSupportRequest(void)
|
||||
DSError HandlePositionFileSupportRequest(DSReplyError replyErr, u32* param_2, u8 param_3, DSIOResult* ioResult)
|
||||
{
|
||||
/*
|
||||
.loc_0x0:
|
||||
stwu r1, -0x70(r1)
|
||||
mflr r0
|
||||
stw r0, 0x74(r1)
|
||||
stw r31, 0x6C(r1)
|
||||
mr r31, r5
|
||||
li r5, 0x40
|
||||
stw r30, 0x68(r1)
|
||||
mr r30, r6
|
||||
stw r29, 0x64(r1)
|
||||
mr r29, r4
|
||||
li r4, 0
|
||||
stw r28, 0x60(r1)
|
||||
mr r28, r3
|
||||
addi r3, r1, 0x14
|
||||
bl -0xB8578
|
||||
li r3, 0xD4
|
||||
li r0, 0x40
|
||||
stb r3, 0x18(r1)
|
||||
addi r3, r1, 0xC
|
||||
addi r4, r1, 0x8
|
||||
stw r0, 0x14(r1)
|
||||
stw r28, 0x1C(r1)
|
||||
lwz r0, 0x0(r29)
|
||||
stw r0, 0x20(r1)
|
||||
stb r31, 0x24(r1)
|
||||
bl -0x16CC
|
||||
mr. r31, r3
|
||||
bne- .loc_0x84
|
||||
lwz r3, 0x8(r1)
|
||||
addi r4, r1, 0x14
|
||||
li r5, 0x40
|
||||
bl -0x1A78
|
||||
mr r31, r3
|
||||
DSError error;
|
||||
int bufferId2;
|
||||
int bufferId1;
|
||||
MessageBuffer* buffer1;
|
||||
MessageBuffer* buffer2;
|
||||
CommandReply reply;
|
||||
|
||||
.loc_0x84:
|
||||
cmpwi r31, 0
|
||||
bne- .loc_0xE4
|
||||
li r3, 0
|
||||
li r0, -0x1
|
||||
stw r3, 0x0(r30)
|
||||
addi r4, r1, 0x10
|
||||
li r5, 0x3
|
||||
li r6, 0x3
|
||||
stw r0, 0x0(r29)
|
||||
li r7, 0
|
||||
lwz r3, 0x8(r1)
|
||||
bl 0x264
|
||||
mr. r31, r3
|
||||
bne- .loc_0xDC
|
||||
lwz r3, 0x10(r1)
|
||||
bl -0x1754
|
||||
cmplwi r3, 0
|
||||
beq- .loc_0xDC
|
||||
lwz r0, 0x20(r3)
|
||||
stw r0, 0x0(r30)
|
||||
lwz r0, 0x28(r3)
|
||||
stw r0, 0x0(r29)
|
||||
memset(&reply, 0, sizeof(CommandReply));
|
||||
reply.commandID.b = DSMSG_PositionFile;
|
||||
reply._00 = 0x40;
|
||||
reply.replyError.r = replyErr;
|
||||
reply._0C = *param_2;
|
||||
reply._10[0] = param_3;
|
||||
error = TRKGetFreeBuffer(&bufferId1, &buffer1);
|
||||
|
||||
.loc_0xDC:
|
||||
lwz r3, 0x10(r1)
|
||||
bl -0x17D8
|
||||
if (error == DS_NoError) {
|
||||
error = TRKAppendBuffer_ui8(buffer1, (u8*)&reply, sizeof(CommandReply));
|
||||
}
|
||||
|
||||
.loc_0xE4:
|
||||
lwz r3, 0xC(r1)
|
||||
bl -0x17E0
|
||||
lwz r0, 0x74(r1)
|
||||
mr r3, r31
|
||||
lwz r31, 0x6C(r1)
|
||||
lwz r30, 0x68(r1)
|
||||
lwz r29, 0x64(r1)
|
||||
lwz r28, 0x60(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x70
|
||||
blr
|
||||
*/
|
||||
if (error == DS_NoError) {
|
||||
*ioResult = DS_IONoError;
|
||||
*param_2 = -1;
|
||||
error = TRKRequestSend(buffer1, &bufferId2, 3, 3, 0);
|
||||
|
||||
if (error == DS_NoError) {
|
||||
buffer2 = TRKGetBuffer(bufferId2);
|
||||
|
||||
if (buffer2 != nullptr) {
|
||||
*ioResult = *(u32*)(buffer2->data + 0x10);
|
||||
*param_2 = *(u32*)(buffer2->data + 0x18);
|
||||
}
|
||||
}
|
||||
|
||||
TRKReleaseBuffer(bufferId2);
|
||||
}
|
||||
|
||||
TRKReleaseBuffer(bufferId1);
|
||||
return error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user