1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Decompile z_jpeg.c (#70)

* Decompile z_jpeg.c

- Decompile z_jpeg.c
- Move .bss variables from fault.c and fault_drawer.c into .s files to avoid bss reordering

* Rename JPEGWork to JpegWork and minor fix in Jpeg_GetU16
This commit is contained in:
Random 2020-04-14 01:03:10 +02:00 committed by GitHub
parent f3c945cc82
commit 298abfb128
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 577 additions and 629 deletions

View file

@ -186,11 +186,11 @@ glabel Graph_TaskSet00
/* B3D1B0 800C6010 AE090000 */ sw $t1, ($s0) /* B3D1B0 800C6010 AE090000 */ sw $t1, ($s0)
/* B3D1B4 800C6014 0C034B7C */ jal SysUcode_GetUCodeBoot /* B3D1B4 800C6014 0C034B7C */ jal SysUcode_GetUCodeBoot
/* B3D1B8 800C6018 AE0C0004 */ sw $t4, 4($s0) /* B3D1B8 800C6018 AE0C0004 */ sw $t4, 4($s0)
/* B3D1BC 800C601C 0C034B7F */ jal SysUcode_GetUcodeBootSize /* B3D1BC 800C601C 0C034B7F */ jal SysUcode_GetUCodeBootSize
/* B3D1C0 800C6020 AE020008 */ sw $v0, 8($s0) /* B3D1C0 800C6020 AE020008 */ sw $v0, 8($s0)
/* B3D1C4 800C6024 0C034B85 */ jal SysUcode_GetUcode /* B3D1C4 800C6024 0C034B85 */ jal SysUcode_GetUCode
/* B3D1C8 800C6028 AE02000C */ sw $v0, 0xc($s0) /* B3D1C8 800C6028 AE02000C */ sw $v0, 0xc($s0)
/* B3D1CC 800C602C 0C034B88 */ jal SysUcode_GetUcodeData /* B3D1CC 800C602C 0C034B88 */ jal SysUcode_GetUCodeData
/* B3D1D0 800C6030 AE020010 */ sw $v0, 0x10($s0) /* B3D1D0 800C6030 AE020010 */ sw $v0, 0x10($s0)
/* B3D1D4 800C6034 3C0F801B */ lui $t7, %hi(gGfxSPTaskStack) # $t7, 0x801b /* B3D1D4 800C6034 3C0F801B */ lui $t7, %hi(gGfxSPTaskStack) # $t7, 0x801b
/* B3D1D8 800C6038 3C19801A */ lui $t9, %hi(gGfxSPTaskOutputBuffer) # $t9, 0x801a /* B3D1D8 800C6038 3C19801A */ lui $t9, %hi(gGfxSPTaskOutputBuffer) # $t9, 0x801a

View file

@ -65,7 +65,7 @@ glabel D_8013C0A4
.balign 4 .balign 4
.text .text
glabel func_8006E418 glabel Jpeg_Decode
/* AE55B8 8006E418 27BDFD30 */ addiu $sp, $sp, -0x2d0 /* AE55B8 8006E418 27BDFD30 */ addiu $sp, $sp, -0x2d0
/* AE55BC 8006E41C AFBF003C */ sw $ra, 0x3c($sp) /* AE55BC 8006E41C AFBF003C */ sw $ra, 0x3c($sp)
/* AE55C0 8006E420 AFB70038 */ sw $s7, 0x38($sp) /* AE55C0 8006E420 AFB70038 */ sw $s7, 0x38($sp)
@ -133,7 +133,7 @@ glabel func_8006E418
/* AE56B4 8006E514 00000000 */ nop /* AE56B4 8006E514 00000000 */ nop
/* AE56B8 8006E518 AFB602BC */ sw $s6, 0x2bc($sp) /* AE56B8 8006E518 AFB602BC */ sw $s6, 0x2bc($sp)
/* AE56BC 8006E51C 02202025 */ move $a0, $s1 /* AE56BC 8006E51C 02202025 */ move $a0, $s1
/* AE56C0 8006E520 0C01B83B */ jal func_8006E0EC /* AE56C0 8006E520 0C01B83B */ jal Jpeg_ParseMarkers
/* AE56C4 8006E524 27A50208 */ addiu $a1, $sp, 0x208 /* AE56C4 8006E524 27A50208 */ addiu $a1, $sp, 0x208
/* AE56C8 8006E528 0C001A78 */ jal osGetTime /* AE56C8 8006E528 0C001A78 */ jal osGetTime
/* AE56CC 8006E52C 00000000 */ nop /* AE56CC 8006E52C 00000000 */ nop
@ -402,7 +402,7 @@ glabel func_8006E418
/* AE5ABC 8006E91C 10000016 */ b .L8006E978 /* AE5ABC 8006E91C 10000016 */ b .L8006E978
/* AE5AC0 8006E920 26B50004 */ addiu $s5, $s5, 4 /* AE5AC0 8006E920 26B50004 */ addiu $s5, $s5, 4
.L8006E924: .L8006E924:
/* AE5AC4 8006E924 0C01B78C */ jal func_8006DE30 /* AE5AC4 8006E924 0C01B78C */ jal Jpeg_SendTask
/* AE5AC8 8006E928 27A40208 */ addiu $a0, $sp, 0x208 /* AE5AC8 8006E928 27A40208 */ addiu $a0, $sp, 0x208
/* AE5ACC 8006E92C 8FA40040 */ lw $a0, 0x40($sp) /* AE5ACC 8006E92C 8FA40040 */ lw $a0, 0x40($sp)
/* AE5AD0 8006E930 0C001880 */ jal osInvalDCache /* AE5AD0 8006E930 0C001880 */ jal osInvalDCache
@ -413,7 +413,7 @@ glabel func_8006E418
/* AE5AE0 8006E940 02202025 */ move $a0, $s1 /* AE5AE0 8006E940 02202025 */ move $a0, $s1
/* AE5AE4 8006E944 02E02825 */ move $a1, $s7 /* AE5AE4 8006E944 02E02825 */ move $a1, $s7
/* AE5AE8 8006E948 02403025 */ move $a2, $s2 /* AE5AE8 8006E948 02403025 */ move $a2, $s2
/* AE5AEC 8006E94C 0C01B7DA */ jal func_8006DF68 /* AE5AEC 8006E94C 0C01B7DA */ jal Jpeg_CopyToZbuffer
/* AE5AF0 8006E950 02603825 */ move $a3, $s3 /* AE5AF0 8006E950 02603825 */ move $a3, $s3
/* AE5AF4 8006E954 26520001 */ addiu $s2, $s2, 1 /* AE5AF4 8006E954 26520001 */ addiu $s2, $s2, 1
/* AE5AF8 8006E958 2A410014 */ slti $at, $s2, 0x14 /* AE5AF8 8006E958 2A410014 */ slti $at, $s2, 0x14

View file

@ -1,81 +0,0 @@
glabel func_8006DE30
/* AE4FD0 8006DE30 27BDFFD8 */ addiu $sp, $sp, -0x28
/* AE4FD4 8006DE34 AFBF0014 */ sw $ra, 0x14($sp)
/* AE4FD8 8006DE38 8C8300B4 */ lw $v1, 0xb4($a0)
/* AE4FDC 8006DE3C 3C018000 */ lui $at, (0x800006C0 >> 16) # lui $at, 0x8000
/* AE4FE0 8006DE40 342106C0 */ ori $at, (0x800006C0 & 0xFFFF) # ori $at, $at, 0x6c0
/* AE4FE4 8006DE44 00617021 */ addu $t6, $v1, $at
/* AE4FE8 8006DE48 3C018000 */ lui $at, (0x80000220 >> 16) # lui $at, 0x8000
/* AE4FEC 8006DE4C 34210220 */ ori $at, (0x80000220 & 0xFFFF) # ori $at, $at, 0x220
/* AE4FF0 8006DE50 0061C821 */ addu $t9, $v1, $at
/* AE4FF4 8006DE54 3C018000 */ lui $at, (0x800002A0 >> 16) # lui $at, 0x8000
/* AE4FF8 8006DE58 AC6E0000 */ sw $t6, ($v1)
/* AE4FFC 8006DE5C 8C8F0028 */ lw $t7, 0x28($a0)
/* AE5000 8006DE60 342102A0 */ ori $at, (0x800002A0 & 0xFFFF) # ori $at, $at, 0x2a0
/* AE5004 8006DE64 00614821 */ addu $t1, $v1, $at
/* AE5008 8006DE68 3C018000 */ lui $at, (0x80000320 >> 16) # lui $at, 0x8000
/* AE500C 8006DE6C 34210320 */ ori $at, (0x80000320 & 0xFFFF) # ori $at, $at, 0x320
/* AE5010 8006DE70 24180004 */ li $t8, 4
/* AE5014 8006DE74 00615021 */ addu $t2, $v1, $at
/* AE5018 8006DE78 AC780004 */ sw $t8, 4($v1)
/* AE501C 8006DE7C AC79000C */ sw $t9, 0xc($v1)
/* AE5020 8006DE80 AC690010 */ sw $t1, 0x10($v1)
/* AE5024 8006DE84 AC6A0014 */ sw $t2, 0x14($v1)
/* AE5028 8006DE88 AC6F0008 */ sw $t7, 8($v1)
/* AE502C 8006DE8C 3C018012 */ lui $at, %hi(D_8011FA64) # $at, 0x8012
/* AE5030 8006DE90 AC20FA64 */ sw $zero, %lo(D_8011FA64)($at)
/* AE5034 8006DE94 AFA40028 */ sw $a0, 0x28($sp)
/* AE5038 8006DE98 0C034B7C */ jal SysUcode_GetUCodeBoot
/* AE503C 8006DE9C AFA30024 */ sw $v1, 0x24($sp)
/* AE5040 8006DEA0 3C018012 */ lui $at, %hi(D_8011FA68) # $at, 0x8012
/* AE5044 8006DEA4 0C034B7F */ jal SysUcode_GetUcodeBootSize
/* AE5048 8006DEA8 AC22FA68 */ sw $v0, %lo(D_8011FA68)($at)
/* AE504C 8006DEAC 8FA30024 */ lw $v1, 0x24($sp)
/* AE5050 8006DEB0 8FA70028 */ lw $a3, 0x28($sp)
/* AE5054 8006DEB4 3C018012 */ lui $at, %hi(D_8011FA6C) # $at, 0x8012
/* AE5058 8006DEB8 AC22FA6C */ sw $v0, %lo(D_8011FA6C)($at)
/* AE505C 8006DEBC 3C018012 */ lui $at, %hi(D_8011FA90) # $at, 0x8012
/* AE5060 8006DEC0 246B0020 */ addiu $t3, $v1, 0x20
/* AE5064 8006DEC4 AC2BFA98 */ sw $t3, %lo(D_8011FA98)($at)
/* AE5068 8006DEC8 AC23FA90 */ sw $v1, %lo(D_8011FA90)($at)
/* AE506C 8006DECC 3C0D8012 */ lui $t5, %hi(D_8011FA60) # $t5, 0x8012
/* AE5070 8006DED0 240C0002 */ li $t4, 2
/* AE5074 8006DED4 25ADFA60 */ addiu $t5, %lo(D_8011FA60) # addiu $t5, $t5, -0x5a0
/* AE5078 8006DED8 24E80098 */ addiu $t0, $a3, 0x98
/* AE507C 8006DEDC 25B9003C */ addiu $t9, $t5, 0x3c
/* AE5080 8006DEE0 ACE00030 */ sw $zero, 0x30($a3)
/* AE5084 8006DEE4 ACEC0038 */ sw $t4, 0x38($a3)
/* AE5088 8006DEE8 ACE80080 */ sw $t0, 0x80($a3)
/* AE508C 8006DEEC ACE00084 */ sw $zero, 0x84($a3)
/* AE5090 8006DEF0 ACE0003C */ sw $zero, 0x3c($a3)
/* AE5094 8006DEF4 00E0C025 */ move $t8, $a3
.L8006DEF8:
/* AE5098 8006DEF8 8DAF0000 */ lw $t7, ($t5)
/* AE509C 8006DEFC 25AD000C */ addiu $t5, $t5, 0xc
/* AE50A0 8006DF00 2718000C */ addiu $t8, $t8, 0xc
/* AE50A4 8006DF04 AF0F0034 */ sw $t7, 0x34($t8)
/* AE50A8 8006DF08 8DAEFFF8 */ lw $t6, -8($t5)
/* AE50AC 8006DF0C AF0E0038 */ sw $t6, 0x38($t8)
/* AE50B0 8006DF10 8DAFFFFC */ lw $t7, -4($t5)
/* AE50B4 8006DF14 15B9FFF8 */ bne $t5, $t9, .L8006DEF8
/* AE50B8 8006DF18 AF0F003C */ sw $t7, 0x3c($t8)
/* AE50BC 8006DF1C 8DAF0000 */ lw $t7, ($t5)
/* AE50C0 8006DF20 3C048016 */ lui $a0, %hi(gSchedContext+0x38) # $a0, 0x8016
/* AE50C4 8006DF24 248466A0 */ addiu $a0, %lo(gSchedContext+0x38) # addiu $a0, $a0, 0x66a0
/* AE50C8 8006DF28 AF0F0040 */ sw $t7, 0x40($t8)
/* AE50CC 8006DF2C AFA80018 */ sw $t0, 0x18($sp)
/* AE50D0 8006DF30 24E50030 */ addiu $a1, $a3, 0x30
/* AE50D4 8006DF34 0C000C18 */ jal osSendMesg
/* AE50D8 8006DF38 24060001 */ li $a2, 1
/* AE50DC 8006DF3C 3C048016 */ lui $a0, %hi(gSchedContext) # $a0, 0x8016
/* AE50E0 8006DF40 0C03257E */ jal func_800C95F8
/* AE50E4 8006DF44 24846668 */ addiu $a0, %lo(gSchedContext) # addiu $a0, $a0, 0x6668
/* AE50E8 8006DF48 8FA40018 */ lw $a0, 0x18($sp)
/* AE50EC 8006DF4C 00002825 */ move $a1, $zero
/* AE50F0 8006DF50 0C000CA0 */ jal osRecvMesg
/* AE50F4 8006DF54 24060001 */ li $a2, 1
/* AE50F8 8006DF58 8FBF0014 */ lw $ra, 0x14($sp)
/* AE50FC 8006DF5C 27BD0028 */ addiu $sp, $sp, 0x28
/* AE5100 8006DF60 03E00008 */ jr $ra
/* AE5104 8006DF64 00000000 */ nop

View file

@ -1,81 +0,0 @@
glabel func_8006DF68
/* AE5108 8006DF68 00077080 */ sll $t6, $a3, 2
/* AE510C 8006DF6C 01C77021 */ addu $t6, $t6, $a3
/* AE5110 8006DF70 000E7180 */ sll $t6, $t6, 6
/* AE5114 8006DF74 01C67821 */ addu $t7, $t6, $a2
/* AE5118 8006DF78 000FC140 */ sll $t8, $t7, 5
/* AE511C 8006DF7C 03051021 */ addu $v0, $t8, $a1
/* AE5120 8006DF80 24050010 */ li $a1, 16
/* AE5124 8006DF84 00001825 */ move $v1, $zero
.L8006DF88:
/* AE5128 8006DF88 94990000 */ lhu $t9, ($a0)
/* AE512C 8006DF8C 24630002 */ addiu $v1, $v1, 2
/* AE5130 8006DF90 24840040 */ addiu $a0, $a0, 0x40
/* AE5134 8006DF94 A4590000 */ sh $t9, ($v0)
/* AE5138 8006DF98 9488FFC2 */ lhu $t0, -0x3e($a0)
/* AE513C 8006DF9C 24420500 */ addiu $v0, $v0, 0x500
/* AE5140 8006DFA0 A448FB02 */ sh $t0, -0x4fe($v0)
/* AE5144 8006DFA4 9489FFC4 */ lhu $t1, -0x3c($a0)
/* AE5148 8006DFA8 A449FB04 */ sh $t1, -0x4fc($v0)
/* AE514C 8006DFAC 948AFFC6 */ lhu $t2, -0x3a($a0)
/* AE5150 8006DFB0 A44AFB06 */ sh $t2, -0x4fa($v0)
/* AE5154 8006DFB4 948BFFC8 */ lhu $t3, -0x38($a0)
/* AE5158 8006DFB8 A44BFB08 */ sh $t3, -0x4f8($v0)
/* AE515C 8006DFBC 948CFFCA */ lhu $t4, -0x36($a0)
/* AE5160 8006DFC0 A44CFB0A */ sh $t4, -0x4f6($v0)
/* AE5164 8006DFC4 948DFFCC */ lhu $t5, -0x34($a0)
/* AE5168 8006DFC8 A44DFB0C */ sh $t5, -0x4f4($v0)
/* AE516C 8006DFCC 948EFFCE */ lhu $t6, -0x32($a0)
/* AE5170 8006DFD0 A44EFB0E */ sh $t6, -0x4f2($v0)
/* AE5174 8006DFD4 948FFFD0 */ lhu $t7, -0x30($a0)
/* AE5178 8006DFD8 A44FFB10 */ sh $t7, -0x4f0($v0)
/* AE517C 8006DFDC 9498FFD2 */ lhu $t8, -0x2e($a0)
/* AE5180 8006DFE0 A458FB12 */ sh $t8, -0x4ee($v0)
/* AE5184 8006DFE4 9499FFD4 */ lhu $t9, -0x2c($a0)
/* AE5188 8006DFE8 A459FB14 */ sh $t9, -0x4ec($v0)
/* AE518C 8006DFEC 9488FFD6 */ lhu $t0, -0x2a($a0)
/* AE5190 8006DFF0 A448FB16 */ sh $t0, -0x4ea($v0)
/* AE5194 8006DFF4 9489FFD8 */ lhu $t1, -0x28($a0)
/* AE5198 8006DFF8 A449FB18 */ sh $t1, -0x4e8($v0)
/* AE519C 8006DFFC 948AFFDA */ lhu $t2, -0x26($a0)
/* AE51A0 8006E000 A44AFB1A */ sh $t2, -0x4e6($v0)
/* AE51A4 8006E004 948BFFDC */ lhu $t3, -0x24($a0)
/* AE51A8 8006E008 A44BFB1C */ sh $t3, -0x4e4($v0)
/* AE51AC 8006E00C 948CFFDE */ lhu $t4, -0x22($a0)
/* AE51B0 8006E010 A44CFB1E */ sh $t4, -0x4e2($v0)
/* AE51B4 8006E014 948DFFE0 */ lhu $t5, -0x20($a0)
/* AE51B8 8006E018 A44DFD80 */ sh $t5, -0x280($v0)
/* AE51BC 8006E01C 948EFFE2 */ lhu $t6, -0x1e($a0)
/* AE51C0 8006E020 A44EFD82 */ sh $t6, -0x27e($v0)
/* AE51C4 8006E024 948FFFE4 */ lhu $t7, -0x1c($a0)
/* AE51C8 8006E028 A44FFD84 */ sh $t7, -0x27c($v0)
/* AE51CC 8006E02C 9498FFE6 */ lhu $t8, -0x1a($a0)
/* AE51D0 8006E030 A458FD86 */ sh $t8, -0x27a($v0)
/* AE51D4 8006E034 9499FFE8 */ lhu $t9, -0x18($a0)
/* AE51D8 8006E038 A459FD88 */ sh $t9, -0x278($v0)
/* AE51DC 8006E03C 9488FFEA */ lhu $t0, -0x16($a0)
/* AE51E0 8006E040 A448FD8A */ sh $t0, -0x276($v0)
/* AE51E4 8006E044 9489FFEC */ lhu $t1, -0x14($a0)
/* AE51E8 8006E048 A449FD8C */ sh $t1, -0x274($v0)
/* AE51EC 8006E04C 948AFFEE */ lhu $t2, -0x12($a0)
/* AE51F0 8006E050 A44AFD8E */ sh $t2, -0x272($v0)
/* AE51F4 8006E054 948BFFF0 */ lhu $t3, -0x10($a0)
/* AE51F8 8006E058 A44BFD90 */ sh $t3, -0x270($v0)
/* AE51FC 8006E05C 948CFFF2 */ lhu $t4, -0xe($a0)
/* AE5200 8006E060 A44CFD92 */ sh $t4, -0x26e($v0)
/* AE5204 8006E064 948DFFF4 */ lhu $t5, -0xc($a0)
/* AE5208 8006E068 A44DFD94 */ sh $t5, -0x26c($v0)
/* AE520C 8006E06C 948EFFF6 */ lhu $t6, -0xa($a0)
/* AE5210 8006E070 A44EFD96 */ sh $t6, -0x26a($v0)
/* AE5214 8006E074 948FFFF8 */ lhu $t7, -8($a0)
/* AE5218 8006E078 A44FFD98 */ sh $t7, -0x268($v0)
/* AE521C 8006E07C 9498FFFA */ lhu $t8, -6($a0)
/* AE5220 8006E080 A458FD9A */ sh $t8, -0x266($v0)
/* AE5224 8006E084 9499FFFC */ lhu $t9, -4($a0)
/* AE5228 8006E088 A459FD9C */ sh $t9, -0x264($v0)
/* AE522C 8006E08C 9488FFFE */ lhu $t0, -2($a0)
/* AE5230 8006E090 1465FFBD */ bne $v1, $a1, .L8006DF88
/* AE5234 8006E094 A448FD9E */ sh $t0, -0x262($v0)
/* AE5238 8006E098 03E00008 */ jr $ra
/* AE523C 8006E09C 00000000 */ nop

View file

@ -1,23 +0,0 @@
glabel func_8006E0A0
/* AE5240 8006E0A0 308E0001 */ andi $t6, $a0, 1
/* AE5244 8006E0A4 55C00004 */ bnezl $t6, .L8006E0B8
/* AE5248 8006E0A8 90810001 */ lbu $at, 1($a0)
/* AE524C 8006E0AC 03E00008 */ jr $ra
/* AE5250 8006E0B0 94820000 */ lhu $v0, ($a0)
/* AE5254 8006E0B4 90810001 */ lbu $at, 1($a0)
.L8006E0B8:
/* AE5258 8006E0B8 908F0002 */ lbu $t7, 2($a0)
/* AE525C 8006E0BC 90990000 */ lbu $t9, ($a0)
/* AE5260 8006E0C0 00010A00 */ sll $at, $at, 8
/* AE5264 8006E0C4 01E17825 */ or $t7, $t7, $at
/* AE5268 8006E0C8 9081FFFF */ lbu $at, -1($a0)
/* AE526C 8006E0CC 000FC203 */ sra $t8, $t7, 8
/* AE5270 8006E0D0 00010A00 */ sll $at, $at, 8
/* AE5274 8006E0D4 0321C825 */ or $t9, $t9, $at
/* AE5278 8006E0D8 00194200 */ sll $t0, $t9, 8
/* AE527C 8006E0DC 03081025 */ or $v0, $t8, $t0
/* AE5280 8006E0E0 3042FFFF */ andi $v0, $v0, 0xffff
/* AE5284 8006E0E4 03E00008 */ jr $ra
/* AE5288 8006E0E8 00000000 */ nop

View file

@ -1,309 +0,0 @@
.rdata
glabel D_8013BD40
.asciz "MARKER_SOI\n"
.balign 4
glabel D_8013BD4C
.asciz "MARKER_APP0 %d\n"
.balign 4
glabel D_8013BD5C
.asciz "MARKER_APP1 %d\n"
.balign 4
glabel D_8013BD6C
.asciz "MARKER_APP2 %d\n"
.balign 4
glabel D_8013BD7C
.asciz "MARKER_DQT %d %d %02x\n"
.balign 4
glabel D_8013BD94
.asciz "MARKER_DHT %d %d %02x\n"
.balign 4
glabel D_8013BDAC
.asciz "MARKER_DRI %d\n"
.balign 4
glabel D_8013BDBC
.asciz "MARKER_SOF %d %02x %d %d compo%02x (1:Y)%d (H0=2,V0=1(422) or 2(420))%02x ()%02x (2:Cb)%d (H1=1,V1=1)%02x ()%02x (3:Cr)%d (H2=1,V2=1)%02x ()%02x\n"
# EUC-JP: %02x %d %d compo%02x (1:Y)%d (H0=2,V0=1(422) or 2(420))%02x ()%02x (2:Cb)%d (H1=1,V1=1)%02x ()%02x (3:Cr)%d (H2=1,V2=1)%02x ()%02x | Accuracy% 02x Vertical% d Horizontal% d compo% 02x (1: Y)% d (H0 = 2, V0 = 1 (422) or 2 (420))% 02x (quantization table)% 02x (2: Cb) % d (H1 = 1, V1 = 1)% 02x (quantization table)% 02x (3: Cr)% d (H2 = 1, V2 = 1)% 02x (quantization table)% 02x
.balign 4
glabel D_8013BE88
.asciz "MARKER_SOS %d\n"
.balign 4
glabel D_8013BE98
.asciz "MARKER_EOI\n"
.balign 4
glabel D_8013BEA4
.asciz " %02x\n"
# EUC-JP: | Unknown marker
.balign 4
.late_rodata
glabel jtbl_8013C0CC
.word L8006E2D0
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E258
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E3D8
.word L8006E17C
.word L8006E3C0
.word L8006E394
.word L8006E208
.word L8006E3D8
.word L8006E2A8
.word L8006E3D8
.word L8006E3D8
.word L8006E190
.word L8006E1B8
.word L8006E1E0
.text
glabel func_8006E0EC
/* AE528C 8006E0EC 27BDFFA0 */ addiu $sp, $sp, -0x60
/* AE5290 8006E0F0 AFB40058 */ sw $s4, 0x58($sp)
/* AE5294 8006E0F4 AFB30054 */ sw $s3, 0x54($sp)
/* AE5298 8006E0F8 AFB00048 */ sw $s0, 0x48($sp)
/* AE529C 8006E0FC AFBF005C */ sw $ra, 0x5c($sp)
/* AE52A0 8006E100 AFB20050 */ sw $s2, 0x50($sp)
/* AE52A4 8006E104 AFB1004C */ sw $s1, 0x4c($sp)
/* AE52A8 8006E108 00808025 */ move $s0, $a0
/* AE52AC 8006E10C 00A09825 */ move $s3, $a1
/* AE52B0 8006E110 0000A025 */ move $s4, $zero
/* AE52B4 8006E114 A0A00000 */ sb $zero, ($a1)
/* AE52B8 8006E118 A0A00010 */ sb $zero, 0x10($a1)
.L8006E11C:
/* AE52BC 8006E11C 568000B7 */ bnezl $s4, .L8006E3FC
/* AE52C0 8006E120 8FBF005C */ lw $ra, 0x5c($sp)
.L8006E124:
/* AE52C4 8006E124 92020000 */ lbu $v0, ($s0)
/* AE52C8 8006E128 26100001 */ addiu $s0, $s0, 1
/* AE52CC 8006E12C 384200FF */ xori $v0, $v0, 0xff
/* AE52D0 8006E130 2C420001 */ sltiu $v0, $v0, 1
/* AE52D4 8006E134 1040FFF9 */ beqz $v0, .L8006E11C
/* AE52D8 8006E138 00000000 */ nop
/* AE52DC 8006E13C 92020000 */ lbu $v0, ($s0)
/* AE52E0 8006E140 26100001 */ addiu $s0, $s0, 1
/* AE52E4 8006E144 18400009 */ blez $v0, .L8006E16C
/* AE52E8 8006E148 244EFF40 */ addiu $t6, $v0, -0xc0
/* AE52EC 8006E14C 2DC10023 */ sltiu $at, $t6, 0x23
/* AE52F0 8006E150 102000A1 */ beqz $at, .L8006E3D8
/* AE52F4 8006E154 000E7080 */ sll $t6, $t6, 2
/* AE52F8 8006E158 3C018014 */ lui $at, %hi(jtbl_8013C0CC)
/* AE52FC 8006E15C 002E0821 */ addu $at, $at, $t6
/* AE5300 8006E160 8C2EC0CC */ lw $t6, %lo(jtbl_8013C0CC)($at)
/* AE5304 8006E164 01C00008 */ jr $t6
/* AE5308 8006E168 00000000 */ nop
.L8006E16C:
/* AE530C 8006E16C 1040FFEB */ beqz $v0, .L8006E11C
/* AE5310 8006E170 00000000 */ nop
/* AE5314 8006E174 10000098 */ b .L8006E3D8
/* AE5318 8006E178 00000000 */ nop
glabel L8006E17C
/* AE531C 8006E17C 3C048014 */ lui $a0, %hi(D_8013BD40) # $a0, 0x8014
/* AE5320 8006E180 0C00084C */ jal osSyncPrintf
/* AE5324 8006E184 2484BD40 */ addiu $a0, %lo(D_8013BD40) # addiu $a0, $a0, -0x42c0
/* AE5328 8006E188 1000FFE4 */ b .L8006E11C
/* AE532C 8006E18C 00000000 */ nop
glabel L8006E190
/* AE5330 8006E190 0C01B828 */ jal func_8006E0A0
/* AE5334 8006E194 02002025 */ move $a0, $s0
/* AE5338 8006E198 3C048014 */ lui $a0, %hi(D_8013BD4C) # $a0, 0x8014
/* AE533C 8006E19C 2484BD4C */ addiu $a0, %lo(D_8013BD4C) # addiu $a0, $a0, -0x42b4
/* AE5340 8006E1A0 0C00084C */ jal osSyncPrintf
/* AE5344 8006E1A4 00402825 */ move $a1, $v0
/* AE5348 8006E1A8 0C01B828 */ jal func_8006E0A0
/* AE534C 8006E1AC 02002025 */ move $a0, $s0
/* AE5350 8006E1B0 1000FFDA */ b .L8006E11C
/* AE5354 8006E1B4 02028021 */ addu $s0, $s0, $v0
glabel L8006E1B8
/* AE5358 8006E1B8 0C01B828 */ jal func_8006E0A0
/* AE535C 8006E1BC 02002025 */ move $a0, $s0
/* AE5360 8006E1C0 3C048014 */ lui $a0, %hi(D_8013BD5C) # $a0, 0x8014
/* AE5364 8006E1C4 2484BD5C */ addiu $a0, %lo(D_8013BD5C) # addiu $a0, $a0, -0x42a4
/* AE5368 8006E1C8 0C00084C */ jal osSyncPrintf
/* AE536C 8006E1CC 00402825 */ move $a1, $v0
/* AE5370 8006E1D0 0C01B828 */ jal func_8006E0A0
/* AE5374 8006E1D4 02002025 */ move $a0, $s0
/* AE5378 8006E1D8 1000FFD0 */ b .L8006E11C
/* AE537C 8006E1DC 02028021 */ addu $s0, $s0, $v0
glabel L8006E1E0
/* AE5380 8006E1E0 0C01B828 */ jal func_8006E0A0
/* AE5384 8006E1E4 02002025 */ move $a0, $s0
/* AE5388 8006E1E8 3C048014 */ lui $a0, %hi(D_8013BD6C) # $a0, 0x8014
/* AE538C 8006E1EC 2484BD6C */ addiu $a0, %lo(D_8013BD6C) # addiu $a0, $a0, -0x4294
/* AE5390 8006E1F0 0C00084C */ jal osSyncPrintf
/* AE5394 8006E1F4 00402825 */ move $a1, $v0
/* AE5398 8006E1F8 0C01B828 */ jal func_8006E0A0
/* AE539C 8006E1FC 02002025 */ move $a0, $s0
/* AE53A0 8006E200 1000FFC6 */ b .L8006E11C
/* AE53A4 8006E204 02028021 */ addu $s0, $s0, $v0
glabel L8006E208
/* AE53A8 8006E208 0C01B828 */ jal func_8006E0A0
/* AE53AC 8006E20C 02002025 */ move $a0, $s0
/* AE53B0 8006E210 3C048014 */ lui $a0, %hi(D_8013BD7C) # $a0, 0x8014
/* AE53B4 8006E214 2484BD7C */ addiu $a0, %lo(D_8013BD7C) # addiu $a0, $a0, -0x4284
/* AE53B8 8006E218 92650000 */ lbu $a1, ($s3)
/* AE53BC 8006E21C 00403025 */ move $a2, $v0
/* AE53C0 8006E220 0C00084C */ jal osSyncPrintf
/* AE53C4 8006E224 92070002 */ lbu $a3, 2($s0)
/* AE53C8 8006E228 92780000 */ lbu $t8, ($s3)
/* AE53CC 8006E22C 260F0002 */ addiu $t7, $s0, 2
/* AE53D0 8006E230 02002025 */ move $a0, $s0
/* AE53D4 8006E234 0018C880 */ sll $t9, $t8, 2
/* AE53D8 8006E238 02794021 */ addu $t0, $s3, $t9
/* AE53DC 8006E23C AD0F0004 */ sw $t7, 4($t0)
/* AE53E0 8006E240 92690000 */ lbu $t1, ($s3)
/* AE53E4 8006E244 252A0001 */ addiu $t2, $t1, 1
/* AE53E8 8006E248 0C01B828 */ jal func_8006E0A0
/* AE53EC 8006E24C A26A0000 */ sb $t2, ($s3)
/* AE53F0 8006E250 1000FFB2 */ b .L8006E11C
/* AE53F4 8006E254 02028021 */ addu $s0, $s0, $v0
glabel L8006E258
/* AE53F8 8006E258 0C01B828 */ jal func_8006E0A0
/* AE53FC 8006E25C 02002025 */ move $a0, $s0
/* AE5400 8006E260 3C048014 */ lui $a0, %hi(D_8013BD94) # $a0, 0x8014
/* AE5404 8006E264 2484BD94 */ addiu $a0, %lo(D_8013BD94) # addiu $a0, $a0, -0x426c
/* AE5408 8006E268 92650010 */ lbu $a1, 0x10($s3)
/* AE540C 8006E26C 00403025 */ move $a2, $v0
/* AE5410 8006E270 0C00084C */ jal osSyncPrintf
/* AE5414 8006E274 92070002 */ lbu $a3, 2($s0)
/* AE5418 8006E278 926C0010 */ lbu $t4, 0x10($s3)
/* AE541C 8006E27C 260B0002 */ addiu $t3, $s0, 2
/* AE5420 8006E280 02002025 */ move $a0, $s0
/* AE5424 8006E284 000C6880 */ sll $t5, $t4, 2
/* AE5428 8006E288 026D7021 */ addu $t6, $s3, $t5
/* AE542C 8006E28C ADCB0014 */ sw $t3, 0x14($t6)
/* AE5430 8006E290 92780010 */ lbu $t8, 0x10($s3)
/* AE5434 8006E294 27190001 */ addiu $t9, $t8, 1
/* AE5438 8006E298 0C01B828 */ jal func_8006E0A0
/* AE543C 8006E29C A2790010 */ sb $t9, 0x10($s3)
/* AE5440 8006E2A0 1000FF9E */ b .L8006E11C
/* AE5444 8006E2A4 02028021 */ addu $s0, $s0, $v0
glabel L8006E2A8
/* AE5448 8006E2A8 0C01B828 */ jal func_8006E0A0
/* AE544C 8006E2AC 02002025 */ move $a0, $s0
/* AE5450 8006E2B0 3C048014 */ lui $a0, %hi(D_8013BDAC) # $a0, 0x8014
/* AE5454 8006E2B4 2484BDAC */ addiu $a0, %lo(D_8013BDAC) # addiu $a0, $a0, -0x4254
/* AE5458 8006E2B8 0C00084C */ jal osSyncPrintf
/* AE545C 8006E2BC 00402825 */ move $a1, $v0
/* AE5460 8006E2C0 0C01B828 */ jal func_8006E0A0
/* AE5464 8006E2C4 02002025 */ move $a0, $s0
/* AE5468 8006E2C8 1000FF94 */ b .L8006E11C
/* AE546C 8006E2CC 02028021 */ addu $s0, $s0, $v0
glabel L8006E2D0
/* AE5470 8006E2D0 0C01B828 */ jal func_8006E0A0
/* AE5474 8006E2D4 02002025 */ move $a0, $s0
/* AE5478 8006E2D8 3051FFFF */ andi $s1, $v0, 0xffff
/* AE547C 8006E2DC 0C01B828 */ jal func_8006E0A0
/* AE5480 8006E2E0 26040003 */ addiu $a0, $s0, 3
/* AE5484 8006E2E4 3052FFFF */ andi $s2, $v0, 0xffff
/* AE5488 8006E2E8 0C01B828 */ jal func_8006E0A0
/* AE548C 8006E2EC 26040005 */ addiu $a0, $s0, 5
/* AE5490 8006E2F0 92060002 */ lbu $a2, 2($s0)
/* AE5494 8006E2F4 AFA20010 */ sw $v0, 0x10($sp)
/* AE5498 8006E2F8 920F0007 */ lbu $t7, 7($s0)
/* AE549C 8006E2FC 3C048014 */ lui $a0, %hi(D_8013BDBC) # $a0, 0x8014
/* AE54A0 8006E300 2484BDBC */ addiu $a0, %lo(D_8013BDBC) # addiu $a0, $a0, -0x4244
/* AE54A4 8006E304 AFAF0014 */ sw $t7, 0x14($sp)
/* AE54A8 8006E308 92080008 */ lbu $t0, 8($s0)
/* AE54AC 8006E30C 02202825 */ move $a1, $s1
/* AE54B0 8006E310 02403825 */ move $a3, $s2
/* AE54B4 8006E314 AFA80018 */ sw $t0, 0x18($sp)
/* AE54B8 8006E318 92090009 */ lbu $t1, 9($s0)
/* AE54BC 8006E31C AFA9001C */ sw $t1, 0x1c($sp)
/* AE54C0 8006E320 920A000A */ lbu $t2, 0xa($s0)
/* AE54C4 8006E324 AFAA0020 */ sw $t2, 0x20($sp)
/* AE54C8 8006E328 920C000B */ lbu $t4, 0xb($s0)
/* AE54CC 8006E32C AFAC0024 */ sw $t4, 0x24($sp)
/* AE54D0 8006E330 920D000C */ lbu $t5, 0xc($s0)
/* AE54D4 8006E334 AFAD0028 */ sw $t5, 0x28($sp)
/* AE54D8 8006E338 920B000D */ lbu $t3, 0xd($s0)
/* AE54DC 8006E33C AFAB002C */ sw $t3, 0x2c($sp)
/* AE54E0 8006E340 920E000E */ lbu $t6, 0xe($s0)
/* AE54E4 8006E344 AFAE0030 */ sw $t6, 0x30($sp)
/* AE54E8 8006E348 9218000F */ lbu $t8, 0xf($s0)
/* AE54EC 8006E34C AFB80034 */ sw $t8, 0x34($sp)
/* AE54F0 8006E350 92190010 */ lbu $t9, 0x10($s0)
/* AE54F4 8006E354 0C00084C */ jal osSyncPrintf
/* AE54F8 8006E358 AFB90038 */ sw $t9, 0x38($sp)
/* AE54FC 8006E35C 92020009 */ lbu $v0, 9($s0)
/* AE5500 8006E360 24010021 */ li $at, 33
/* AE5504 8006E364 54410004 */ bnel $v0, $at, .L8006E378
/* AE5508 8006E368 24010022 */ li $at, 34
/* AE550C 8006E36C 10000005 */ b .L8006E384
/* AE5510 8006E370 AE600028 */ sw $zero, 0x28($s3)
/* AE5514 8006E374 24010022 */ li $at, 34
.L8006E378:
/* AE5518 8006E378 14410002 */ bne $v0, $at, .L8006E384
/* AE551C 8006E37C 240F0002 */ li $t7, 2
/* AE5520 8006E380 AE6F0028 */ sw $t7, 0x28($s3)
.L8006E384:
/* AE5524 8006E384 0C01B828 */ jal func_8006E0A0
/* AE5528 8006E388 02002025 */ move $a0, $s0
/* AE552C 8006E38C 1000FF63 */ b .L8006E11C
/* AE5530 8006E390 02028021 */ addu $s0, $s0, $v0
glabel L8006E394
/* AE5534 8006E394 0C01B828 */ jal func_8006E0A0
/* AE5538 8006E398 02002025 */ move $a0, $s0
/* AE553C 8006E39C 3C048014 */ lui $a0, %hi(D_8013BE88) # $a0, 0x8014
/* AE5540 8006E3A0 2484BE88 */ addiu $a0, %lo(D_8013BE88) # addiu $a0, $a0, -0x4178
/* AE5544 8006E3A4 0C00084C */ jal osSyncPrintf
/* AE5548 8006E3A8 00402825 */ move $a1, $v0
/* AE554C 8006E3AC 0C01B828 */ jal func_8006E0A0
/* AE5550 8006E3B0 02002025 */ move $a0, $s0
/* AE5554 8006E3B4 02028021 */ addu $s0, $s0, $v0
/* AE5558 8006E3B8 1000FF58 */ b .L8006E11C
/* AE555C 8006E3BC AE700024 */ sw $s0, 0x24($s3)
glabel L8006E3C0
/* AE5560 8006E3C0 3C048014 */ lui $a0, %hi(D_8013BE98) # $a0, 0x8014
/* AE5564 8006E3C4 2484BE98 */ addiu $a0, %lo(D_8013BE98) # addiu $a0, $a0, -0x4168
/* AE5568 8006E3C8 0C00084C */ jal osSyncPrintf
/* AE556C 8006E3CC 24140001 */ li $s4, 1
/* AE5570 8006E3D0 1000FF52 */ b .L8006E11C
/* AE5574 8006E3D4 00000000 */ nop
glabel L8006E3D8
.L8006E3D8:
/* AE5578 8006E3D8 3C048014 */ lui $a0, %hi(D_8013BEA4) # $a0, 0x8014
/* AE557C 8006E3DC 2484BEA4 */ addiu $a0, %lo(D_8013BEA4) # addiu $a0, $a0, -0x415c
/* AE5580 8006E3E0 0C00084C */ jal osSyncPrintf
/* AE5584 8006E3E4 9205FFFF */ lbu $a1, -1($s0)
/* AE5588 8006E3E8 0C01B828 */ jal func_8006E0A0
/* AE558C 8006E3EC 02002025 */ move $a0, $s0
/* AE5590 8006E3F0 1280FF4C */ beqz $s4, .L8006E124
/* AE5594 8006E3F4 02028021 */ addu $s0, $s0, $v0
/* AE5598 8006E3F8 8FBF005C */ lw $ra, 0x5c($sp)
.L8006E3FC:
/* AE559C 8006E3FC 8FB00048 */ lw $s0, 0x48($sp)
/* AE55A0 8006E400 8FB1004C */ lw $s1, 0x4c($sp)
/* AE55A4 8006E404 8FB20050 */ lw $s2, 0x50($sp)
/* AE55A8 8006E408 8FB30054 */ lw $s3, 0x54($sp)
/* AE55AC 8006E40C 8FB40058 */ lw $s4, 0x58($sp)
/* AE55B0 8006E410 03E00008 */ jr $ra
/* AE55B4 8006E414 27BD0060 */ addiu $sp, $sp, 0x60

View file

@ -224,7 +224,7 @@ glabel func_80096B6C
/* B0E010 80096E70 AE0A02C0 */ sw $t2, 0x2c0($s0) /* B0E010 80096E70 AE0A02C0 */ sw $t2, 0x2c0($s0)
/* B0E014 80096E74 AF2B0000 */ sw $t3, ($t9) /* B0E014 80096E74 AF2B0000 */ sw $t3, ($t9)
/* B0E018 80096E78 AFB90058 */ sw $t9, 0x58($sp) /* B0E018 80096E78 AFB90058 */ sw $t9, 0x58($sp)
/* B0E01C 80096E7C 0C034B88 */ jal SysUcode_GetUcodeData /* B0E01C 80096E7C 0C034B88 */ jal SysUcode_GetUCodeData
/* B0E020 80096E80 AFA80048 */ sw $t0, 0x48($sp) /* B0E020 80096E80 AFA80048 */ sw $t0, 0x48($sp)
/* B0E024 80096E84 8FA40058 */ lw $a0, 0x58($sp) /* B0E024 80096E84 8FA40058 */ lw $a0, 0x58($sp)
/* B0E028 80096E88 3C0DDD00 */ lui $t5, (0xDD0007FF >> 16) # lui $t5, 0xdd00 /* B0E028 80096E88 3C0DDD00 */ lui $t5, (0xDD0007FF >> 16) # lui $t5, 0xdd00
@ -234,7 +234,7 @@ glabel func_80096B6C
/* B0E038 80096E98 246C0008 */ addiu $t4, $v1, 8 /* B0E038 80096E98 246C0008 */ addiu $t4, $v1, 8
/* B0E03C 80096E9C AE0C02C0 */ sw $t4, 0x2c0($s0) /* B0E03C 80096E9C AE0C02C0 */ sw $t4, 0x2c0($s0)
/* B0E040 80096EA0 AC6D0000 */ sw $t5, ($v1) /* B0E040 80096EA0 AC6D0000 */ sw $t5, ($v1)
/* B0E044 80096EA4 0C034B85 */ jal SysUcode_GetUcode /* B0E044 80096EA4 0C034B85 */ jal SysUcode_GetUCode
/* B0E048 80096EA8 AFA30058 */ sw $v1, 0x58($sp) /* B0E048 80096EA8 AFA30058 */ sw $v1, 0x58($sp)
/* B0E04C 80096EAC 8FA40058 */ lw $a0, 0x58($sp) /* B0E04C 80096EAC 8FA40058 */ lw $a0, 0x58($sp)
/* B0E050 80096EB0 8FA80048 */ lw $t0, 0x48($sp) /* B0E050 80096EB0 8FA80048 */ lw $t0, 0x48($sp)

View file

@ -620,13 +620,13 @@ glabel func_8081D398
/* 0A4BC 8081DCDC 8FB101CC */ lw $s1, 0x01CC($sp) /* 0A4BC 8081DCDC 8FB101CC */ lw $s1, 0x01CC($sp)
/* 0A4C0 8081DCE0 26390008 */ addiu $t9, $s1, 0x0008 ## $t9 = 0C000008 /* 0A4C0 8081DCE0 26390008 */ addiu $t9, $s1, 0x0008 ## $t9 = 0C000008
/* 0A4C4 8081DCE4 AFB901CC */ sw $t9, 0x01CC($sp) /* 0A4C4 8081DCE4 AFB901CC */ sw $t9, 0x01CC($sp)
/* 0A4C8 8081DCE8 0C034B88 */ jal SysUcode_GetUcodeData /* 0A4C8 8081DCE8 0C034B88 */ jal SysUcode_GetUCodeData
/* 0A4CC 8081DCEC AE320000 */ sw $s2, 0x0000($s1) ## 0C000000 /* 0A4CC 8081DCEC AE320000 */ sw $s2, 0x0000($s1) ## 0C000000
/* 0A4D0 8081DCF0 AE220004 */ sw $v0, 0x0004($s1) ## 0C000004 /* 0A4D0 8081DCF0 AE220004 */ sw $v0, 0x0004($s1) ## 0C000004
/* 0A4D4 8081DCF4 8FB101CC */ lw $s1, 0x01CC($sp) /* 0A4D4 8081DCF4 8FB101CC */ lw $s1, 0x01CC($sp)
/* 0A4D8 8081DCF8 262E0008 */ addiu $t6, $s1, 0x0008 ## $t6 = 0C000008 /* 0A4D8 8081DCF8 262E0008 */ addiu $t6, $s1, 0x0008 ## $t6 = 0C000008
/* 0A4DC 8081DCFC AFAE01CC */ sw $t6, 0x01CC($sp) /* 0A4DC 8081DCFC AFAE01CC */ sw $t6, 0x01CC($sp)
/* 0A4E0 8081DD00 0C034B85 */ jal SysUcode_GetUcode /* 0A4E0 8081DD00 0C034B85 */ jal SysUcode_GetUCode
/* 0A4E4 8081DD04 AE330000 */ sw $s3, 0x0000($s1) ## 0C000000 /* 0A4E4 8081DD04 AE330000 */ sw $s3, 0x0000($s1) ## 0C000000
/* 0A4E8 8081DD08 AE220004 */ sw $v0, 0x0004($s1) ## 0C000004 /* 0A4E8 8081DD08 AE220004 */ sw $v0, 0x0004($s1) ## 0C000004
/* 0A4EC 8081DD0C 8FB801CC */ lw $t8, 0x01CC($sp) /* 0A4EC 8081DD0C 8FB801CC */ lw $t8, 0x01CC($sp)

23
data/fault.bss.s Normal file
View file

@ -0,0 +1,23 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purposee registers
.section .bss
glabel sFaultStructPtr
.space 4
glabel sFaultIsWaitingForInput
.space 4
glabel sFaultStack
.space 0x600
glabel sFaultThreadInfo
.space 0x20
glabel gFaultStruct
.space 0x850

14
data/fault_drawer.bss.s Normal file
View file

@ -0,0 +1,14 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purposee registers
.section .bss
glabel sFaultDrawerStruct
.space 0x3C
glabel D_8016B6C0
.space 0x20

View file

@ -25,4 +25,10 @@ glabel D_80155C70
.incbin "baserom.z64", 0xBCCE10, 0x2E0 .incbin "baserom.z64", 0xBCCE10, 0x2E0
glabel D_80155F50 glabel D_80155F50
.incbin "baserom.z64", 0xBCD0F0, 0x1E40 .incbin "baserom.z64", 0xBCD0F0, 0x1630
glabel D_80157580
.incbin "baserom.z64", 0xBCE720, 0x7B0
glabel D_80157D30
.incbin "baserom.z64", 0xBCEED0, 0x60

View file

@ -8,4 +8,10 @@
.section .text .section .text
glabel D_801120C0 glabel D_801120C0
.incbin "baserom.z64", 0xB89260, 0x3360 .incbin "baserom.z64", 0xB89260, 0xFB0
glabel D_80113070
.incbin "baserom.z64", 0xB8A210, 0x18C0
glabel D_80114930
.incbin "baserom.z64", 0xB8BAD0, 0xAF0

View file

@ -813,11 +813,11 @@ s32 func_8006C4A4(GlobalContext*, s32);
// ? func_8006D0EC(?); // ? func_8006D0EC(?);
// ? func_8006D684(?); // ? func_8006D684(?);
// ? func_8006DC68(?); // ? func_8006DC68(?);
// ? func_8006DE30(?); u32 Jpeg_SendTask(JpegContext* ctx);
// ? func_8006DF68(?); void Jpeg_CopyToZbuffer(u16* src, u16* zbuffer, s32 x, s32 y);
// ? func_8006E0A0(?); u16 Jpeg_GetU16(u8* ptr);
// ? func_8006E0EC(?); void Jpeg_ParseMarkers(u8* ptr, JpegContext* ctx);
// ? func_8006E418(?); s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize);
// ? func_8006EA30(?); // ? func_8006EA30(?);
// ? func_8006ECF4(?); // ? func_8006ECF4(?);
void func_8006EE48(UNK_TYPE); void func_8006EE48(UNK_TYPE);
@ -1710,10 +1710,10 @@ void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag);
void func_800D23FC(f32 f, Vec3f* vec, u8 mode); void func_800D23FC(f32 f, Vec3f* vec, u8 mode);
MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line); MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line);
void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6); void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6);
// ? SysUcode_GetUCodeBoot(?); u32 SysUcode_GetUCodeBoot();
// ? SysUcode_GetUcodeBootSize(?); u32 SysUcode_GetUCodeBootSize();
// ? SysUcode_GetUcode(?); u32 SysUcode_GetUCode();
// ? SysUcode_GetUcodeData(?); u32 SysUcode_GetUCodeData();
// ? func_800D2E30(?); // ? func_800D2E30(?);
// ? func_800D3140(?); // ? func_800D3140(?);
// ? func_800D3140(?); // ? func_800D3140(?);
@ -2316,14 +2316,14 @@ void Sleep_Nsec(u32 nsec);
void Sleep_Usec(u32 usec); void Sleep_Usec(u32 usec);
void Sleep_Msec(u32 ms); void Sleep_Msec(u32 ms);
void Sleep_Sec(u32 sec); void Sleep_Sec(u32 sec);
// ? func_800FF540(?); void func_800FF540(u8* dqt, JpegQuantizationTable* qtPtr, u8 count);
// ? func_800FF5A8(?); // ? func_800FF5A8(?);
// ? func_800FF62C(?); // ? func_800FF62C(?);
// ? func_800FF698(?); // ? func_800FF698(?);
// ? func_800FF740(?); // ? func_800FF740(?);
// ? func_800FF7FC(?); u32 func_800FF7FC(u8* data, JpegHuffmanTable* htPtr, void*, void*, u8 count);
// ? func_800FF8D4(?); // ? func_800FF8D4(?);
// ? func_800FFA50(?); u32 func_800FFA50(JpegDecoder* decoder, u16*, u32, u8, u32*);
// ? func_800FFC78(?); // ? func_800FFC78(?);
// ? func_800FFE14(?); // ? func_800FFE14(?);
// ? func_800FFF50(?); // ? func_800FFF50(?);

View file

@ -138,6 +138,8 @@ extern OSPiHandle __CartRomHandle;
extern DmaEntry gDmaDataTable[0x60C]; extern DmaEntry gDmaDataTable[0x60C];
//extern ? D_800D7288; //extern ? D_800D7288;
extern u8 D_801120C0[]; extern u8 D_801120C0[];
extern u8 D_80113070[];
extern u8 D_80114930[];
//extern ? D_80115440; //extern ? D_80115440;
//extern ? D_80115760; //extern ? D_80115760;
//extern ? D_80115770; //extern ? D_80115770;
@ -265,12 +267,6 @@ extern s16 D_8011E0B0;
extern Color_RGBA8 D_8011E0B4[]; extern Color_RGBA8 D_8011E0B4[];
//extern ? D_8011E0D4; //extern ? D_8011E0D4;
extern GameStateOverlay gGameStateOverlayTable[6]; extern GameStateOverlay gGameStateOverlayTable[6];
//extern ? D_8011FA60;
//extern ? D_8011FA64;
//extern ? D_8011FA68;
//extern ? D_8011FA6C;
//extern ? D_8011FA90;
//extern ? D_8011FA98;
//extern ? D_8011FAF0; //extern ? D_8011FAF0;
extern u8 D_8011FB30; extern u8 D_8011FB30;
//extern ? D_8011FB34; //extern ? D_8011FB34;
@ -3299,6 +3295,8 @@ extern char D_80146238[];
//extern ? D_80155BF0; //extern ? D_80155BF0;
//extern ? D_80155C70; //extern ? D_80155C70;
extern u8 D_80155F50[]; extern u8 D_80155F50[];
extern u8 D_80157580[];
extern u8 D_80157D30[];
extern GlobalContext* D_80157DA0; extern GlobalContext* D_80157DA0;
//extern ? D_80157DA4; //extern ? D_80157DA4;
//extern ? D_80157DA8; //extern ? D_80157DA8;
@ -3576,12 +3574,7 @@ extern volatile OSTime D_8016A580;
//extern ? D_8016A750; //extern ? D_8016A750;
//extern ? D_8016A794; //extern ? D_8016A794;
//extern ? D_8016A7AC; //extern ? D_8016A7AC;
extern FaultThreadStruct* sFaultStructPtr;
extern u8 sFaultIsWaitingForInput;
extern char sFaultStack[0x600];
extern char sFaultThreadInfo[0x20];
extern FaultThreadStruct gFaultStruct; extern FaultThreadStruct gFaultStruct;
extern u32 D_8016B5F5;
//extern ? D_8016B5F6; //extern ? D_8016B5F6;
//extern ? D_8016B684; //extern ? D_8016B684;
//extern ? D_8016B690; //extern ? D_8016B690;

View file

@ -1143,71 +1143,71 @@ typedef enum {
} MatrixMode; } MatrixMode;
typedef struct FaultClient { typedef struct FaultClient {
struct FaultClient* next; /* 0x00 */ struct FaultClient* next;
u32 callback; /* 0x04 */ u32 callback;
u32 param1; /* 0x08 */ u32 param1;
u32 param2; /* 0x0C */ u32 param2;
} FaultClient; } FaultClient; // size = 0x10
typedef struct FaultAddrConvClient { typedef struct FaultAddrConvClient {
struct FaultAddrConvClient* next; /* 0x00 */ struct FaultAddrConvClient* next;
u32 callback; /* 0x04 */ u32 callback;
u32 param; /* 0x08 */ u32 param;
} FaultAddrConvClient; } FaultAddrConvClient; // size = 0xC
typedef struct { typedef struct {
u32 (*callback)(u32, u32); /* 0x00 */ u32 (*callback)(u32, u32);
u32 param0; /* 0x04 */ u32 param0;
u32 param1; /* 0x08 */ u32 param1;
u32 ret; /* 0x0C */ u32 ret;
OSMesgQueue* queue; /* 0x10 */ OSMesgQueue* queue;
OSMesg msg; /* 0x14 */ OSMesg msg;
} FaultClientContext; } FaultClientContext; // size = 0x18
typedef struct FaultThreadStruct { typedef struct FaultThreadStruct {
OSThread thread; /* 0x000 */ OSThread thread;
u8 unk_1B0[0x600]; /* 0x1B0 */ u8 unk_1B0[0x600];
OSMesgQueue queue; /* 0x7B0 */ OSMesgQueue queue;
OSMesg msg; /* 0x7C8 */ OSMesg msg;
u8 exitDebugger; /* 0x7CC */ u8 exitDebugger;
u8 msgId; /* 0x7CD */ u8 msgId;
u8 faultHandlerEnabled; /* 0x7CE */ u8 faultHandlerEnabled;
u8 faultActive; /* 0x7CF */ u8 faultActive;
OSThread* faultedThread; /* 0x7D0 */ OSThread* faultedThread;
void(*padCallback)(Input*); /* 0x7D4 */ void(*padCallback)(Input*);
FaultClient* clients; /* 0x7D8 */ FaultClient* clients;
FaultAddrConvClient* addrConvClients; /* 0x7DC */ FaultAddrConvClient* addrConvClients;
u8 unk_7E0[4]; /* 0x7E0 */ u8 unk_7E0[4];
Input padInput; /* 0x7E4 */ Input padInput;
u16 colors[36]; /* 0x7FC */ u16 colors[36];
void* fb; /* 0x844 */ void* fb;
u32 currClientThreadSp; /* 0x848 */ u32 currClientThreadSp;
u8 unk_84C[4]; /* 0x84C */ u8 unk_84C[4];
} FaultThreadStruct; } FaultThreadStruct; // size = 0x850
typedef struct { typedef struct {
u16* fb; /* 0x00 */ u16* fb;
u16 w; /* 0x04 */ u16 w;
u16 h; /* 0x08 */ u16 h;
u16 yStart; /* 0x0A */ u16 yStart;
u16 yEnd; /* 0x0C */ u16 yEnd;
u16 xStart; /* 0x0E */ u16 xStart;
u16 xEnd; /* 0x10 */ u16 xEnd;
u16 foreColor; /* 0x12 */ u16 foreColor;
u16 backColor; /* 0x14 */ u16 backColor;
u16 cursorX; /* 0x14 */ u16 cursorX;
u16 cursorY; /* 0x16 */ u16 cursorY;
u32* fontData; /* 0x18 */ u32* fontData;
u8 charW; /* 0x1C */ u8 charW;
u8 charH; /* 0x1D */ u8 charH;
s8 charWPad; /* 0x1E */ s8 charWPad;
s8 charHPad; /* 0x1F */ s8 charHPad;
u16 printColors[10]; /* 0x20 */ u16 printColors[10];
u8 escCode; // bool /* 0x34 */ u8 escCode; // bool
u8 osSyncPrintfEnabled; /* 0x35 */ u8 osSyncPrintfEnabled;
void(*inputCallback)(); /* 0x38 */ void(*inputCallback)();
} FaultDrawer; } FaultDrawer; // size = 0x3C
typedef struct GfxPrint { typedef struct GfxPrint {
/* 0x00 */ struct GfxPrint*(*callback)(struct GfxPrint*, const char*, size_t); /* 0x00 */ struct GfxPrint*(*callback)(struct GfxPrint*, const char*, size_t);
@ -1255,9 +1255,9 @@ typedef struct {
} ISVDbg; } ISVDbg;
typedef struct { typedef struct {
char name[0x18]; /* 0x00 */ char name[0x18];
u32 mediaFormat; /* 0x18 */ u32 mediaFormat;
union { /* 0x1C */ union {
struct { struct {
u16 cartId; u16 cartId;
u8 countryCode; u8 countryCode;
@ -1265,15 +1265,15 @@ typedef struct {
}; };
u32 regionInfo; u32 regionInfo;
}; };
} LocaleCartInfo; } LocaleCartInfo; // size = 0x20
typedef struct { typedef struct {
char magic[4]; // Yaz0 /* 0x00 */ char magic[4]; // Yaz0
u32 decSize; /* 0x04 */ u32 decSize;
u32 compInfoOffset; // only used in yaz0_old.c /* 0x08 */ u32 compInfoOffset; // only used in yaz0_old.c
u32 uncompDataOffset; // only used in yaz0_old.c /* 0x0C */ u32 uncompDataOffset; // only used in yaz0_old.c
u32 data[1]; /* 0x10 */ u32 data[1];
} Yaz0Header; } Yaz0Header; // size = 0x10 ("data" is not part of the header)
#define OS_SC_RETRACE_MSG 1 #define OS_SC_RETRACE_MSG 1
#define OS_SC_DONE_MSG 2 #define OS_SC_DONE_MSG 2
@ -1281,13 +1281,13 @@ typedef struct {
#define OS_SC_PRE_NMI_MSG 4 #define OS_SC_PRE_NMI_MSG 4
typedef struct { typedef struct {
short type; /* 0x00 */ s16 type;
char misc[30]; /* 0x02 */ char misc[0x1E];
} OSScMsg; } OSScMsg; // size = 0x20
typedef struct IrqMgrClient { typedef struct IrqMgrClient {
struct IrqMgrClient* prev; /* 0x00 */ struct IrqMgrClient* prev;
OSMesgQueue* queue; /* 0x04 */ OSMesgQueue* queue;
} IrqMgrClient; } IrqMgrClient;
typedef struct { typedef struct {
@ -1446,4 +1446,55 @@ typedef struct {
/* 0x18 */ f32 yScale; /* 0x18 */ f32 yScale;
} CfbInfo; // size = 0x1C } CfbInfo; // size = 0x1C
typedef struct {
/* 0x00 */ u16 table[8*8];
} JpegQuantizationTable; // size = 0x80
typedef struct {
/* 0x00 */ u8 codeOffs[16];
/* 0x10 */ u16 codesA[16];
/* 0x30 */ u16 codesB[16];
/* 0x50 */ u8* symbols;
} JpegHuffmanTable; // size = 0x54
typedef struct {
/* 0x00 */ u32 unk_00;
/* 0x04 */ u32 unk_04;
/* 0x08 */ u32 unk_08;
/* 0x0C */ u32 qTablePtrs[3];
/* 0x18 */ char unk_18[0x8];
} JpegTaskData; // size = 0x20
typedef struct {
/* 0x000 */ JpegTaskData taskData;
/* 0x020 */ char yieldData[0x200];
/* 0x220 */ JpegQuantizationTable qTables[3];
/* 0x3A0 */ u8 codesLenghts[0x110];
/* 0x4B0 */ u16 codes[0x108];
/* 0x6C0 */ u16 unk_6C0[4][0x180];
} JpegWork; // size = 0x12C0
typedef struct {
/* 0x00 */ void* imageData;
/* 0x04 */ u8 unk_04;
/* 0x05 */ u8 unk_05;
/* 0x08 */ JpegHuffmanTable* hTablePtrs[4];
/* 0x18 */ u8 unk_18;
} JpegDecoder; // size = 0x1C
typedef struct {
/* 0x00 */ u8 dqtCount;
/* 0x04 */ u8* dqtPtr[3];
/* 0x10 */ u8 dhtCount;
/* 0x14 */ u8* dhtPtr[4];
/* 0x24 */ void* imageData;
/* 0x28 */ u32 unk_28; // 0 if Y V0 is 0 and 2 if Y V0 is 2
/* 0x2C */ char unk_2C[4];
/* 0x30 */ OSScTask scTask;
/* 0x88 */ char unk_88[0x10];
/* 0x98 */ OSMesgQueue mq;
/* 0xB0 */ OSMesg msg;
/* 0xB4 */ JpegWork* workBuf;
} JpegContext; // size = 0xB8
#endif #endif

3
spec
View file

@ -321,7 +321,6 @@ beginseg
include "build/src/code/z_game_dlftbls.o" include "build/src/code/z_game_dlftbls.o"
include "build/src/code/z_horse.o" include "build/src/code/z_horse.o"
include "build/src/code/z_jpeg.o" include "build/src/code/z_jpeg.o"
include "build/data/z_jpeg.data.o"
include "build/src/code/code_8006EA30.o" include "build/src/code/code_8006EA30.o"
include "build/data/code_8006EA30.data.o" include "build/data/code_8006EA30.data.o"
include "build/src/code/z_kanfont.o" include "build/src/code/z_kanfont.o"
@ -453,7 +452,9 @@ beginseg
include "build/src/code/irqmgr.o" include "build/src/code/irqmgr.o"
include "build/src/code/debug_malloc.o" include "build/src/code/debug_malloc.o"
include "build/src/code/fault.o" include "build/src/code/fault.o"
include "build/data/fault.bss.o"
include "build/src/code/fault_drawer.o" include "build/src/code/fault_drawer.o"
include "build/data/fault_drawer.bss.o"
include "build/asm/code_800D71F0.o" include "build/asm/code_800D71F0.o"
include "build/asm/code_800D7CD0.o" include "build/asm/code_800D7CD0.o"
include "build/data/code_800D7CD0.data.o" include "build/data/code_800D7CD0.data.o"

View file

@ -33,11 +33,11 @@ const char* sExceptionNames[] = {
}; };
// bss // bss
FaultThreadStruct* sFaultStructPtr; extern FaultThreadStruct* sFaultStructPtr;
u8 sFaultIsWaitingForInput; extern u8 sFaultIsWaitingForInput;
char sFaultStack[0x600]; extern char sFaultStack[0x600];
char sFaultThreadInfo[0x20]; extern StackEntry sFaultThreadInfo;
FaultThreadStruct gFaultStruct; extern FaultThreadStruct gFaultStruct;
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/pad_800D3F10.s") #pragma GLOBAL_ASM("asm/non_matchings/code/fault/pad_800D3F10.s")
@ -804,8 +804,8 @@ void Fault_Start(void) {
sFaultStructPtr->faultActive = false; sFaultStructPtr->faultActive = false;
gFaultStruct.faultHandlerEnabled = true; gFaultStruct.faultHandlerEnabled = true;
osCreateMesgQueue(&sFaultStructPtr->queue, &sFaultStructPtr->msg, 1); osCreateMesgQueue(&sFaultStructPtr->queue, &sFaultStructPtr->msg, 1);
StackCheck_Init(sFaultThreadInfo, &sFaultStack, sFaultStack + sizeof(sFaultStack), 0, 0x100, "fault"); StackCheck_Init(&sFaultThreadInfo, &sFaultStack, sFaultStack + sizeof(sFaultStack), 0, 0x100, "fault");
osCreateThread(&sFaultStructPtr->thread, 2, &Fault_ThreadEntry, 0, sFaultThreadInfo, 0x7f); osCreateThread(&sFaultStructPtr->thread, 2, &Fault_ThreadEntry, 0, sFaultStack + sizeof(sFaultStack), 0x7f);
osStartThread(&sFaultStructPtr->thread); osStartThread(&sFaultStructPtr->thread);
} }

View file

@ -58,8 +58,8 @@ FaultDrawer sFaultDrawerDefault = {
// clang-format on // clang-format on
// bss // bss
FaultDrawer sFaultDrawerStruct; extern FaultDrawer sFaultDrawerStruct;
char D_8016B6C0[0x20]; //? unused extern char D_8016B6C0[0x20]; // ? unused
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) { void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
sFaultDrawerStruct.osSyncPrintfEnabled = enabled; sFaultDrawerStruct.osSyncPrintfEnabled = enabled;

View file

@ -13,13 +13,19 @@ FaultClient sGraphFaultClient;
CfbInfo sGraphCfbInfos[3]; CfbInfo sGraphCfbInfos[3];
FaultClient sGraphUcodeFaultClient; FaultClient sGraphUcodeFaultClient;
// clang-format off
UCodeInfo D_8012D230[3] = { UCodeInfo D_8012D230[3] = {
{ 1, D_80155F50 }, { 2, NULL }, { 3, D_801120C0 + 0xFB0 }, // D_80113070 { 1, D_80155F50 },
{ 2, NULL },
{ 3, D_80113070 },
}; };
UCodeInfo D_8012D248[3] = { UCodeInfo D_8012D248[3] = {
{ 1, D_80155F50 }, { 2, NULL }, { 3, D_801120C0 + 0xFB0 }, // D_80113070 { 1, D_80155F50 },
{ 2, NULL },
{ 3, D_80113070 },
}; };
// clang-format on
void Graph_FaultClient() { void Graph_FaultClient() {
void* nextFb; void* nextFb;
@ -208,9 +214,9 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
task->type = M_GFXTASK; task->type = M_GFXTASK;
task->flags = OS_SC_DRAM_DLIST; task->flags = OS_SC_DRAM_DLIST;
task->ucode_boot = SysUcode_GetUCodeBoot(); task->ucode_boot = SysUcode_GetUCodeBoot();
task->ucode_boot_size = SysUcode_GetUcodeBootSize(); task->ucode_boot_size = SysUcode_GetUCodeBootSize();
task->ucode = SysUcode_GetUcode(); task->ucode = SysUcode_GetUCode();
task->ucode_data = SysUcode_GetUcodeData(); task->ucode_data = SysUcode_GetUCodeData();
task->ucode_size = 0x1000; task->ucode_size = 0x1000;
task->ucode_data_size = 0x800; task->ucode_data_size = 0x800;
task->dram_stack = gGfxSPTaskStack; task->dram_stack = gGfxSPTaskStack;

View file

@ -4,14 +4,14 @@ u32 SysUcode_GetUCodeBoot() {
return &D_80009320; return &D_80009320;
} }
u32 SysUcode_GetUcodeBootSize() { u32 SysUcode_GetUCodeBootSize() {
return (u32)&D_800093F0 - (u32)&D_80009320; return (u32)&D_800093F0 - (u32)&D_80009320;
} }
u32 SysUcode_GetUcode() { u32 SysUcode_GetUCode() {
return D_8012DBA0; return D_8012DBA0;
} }
u32 SysUcode_GetUcodeData() { u32 SysUcode_GetUCodeData() {
return D_8012DBA4; return D_8012DBA4;
} }

View file

@ -1,12 +1,354 @@
#include <ultra64.h> #include <ultra64.h>
#include <global.h> #include <global.h>
#include <sched.h>
#include <vt.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006DE30.s") #define MARKER_SOI 0xD8
#define MARKER_SOF 0xC0
#define MARKER_DHT 0xC4
#define MARKER_DQT 0xDB
#define MARKER_DRI 0xDD
#define MARKER_SOS 0xDA
#define MARKER_APP0 0xE0
#define MARKER_APP1 0xE1
#define MARKER_APP2 0xE2
#define MARKER_COM 0xFE
#define MARKER_EOI 0xD9
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006DF68.s") u32 Jpeg_SendTask(JpegContext* ctx) {
// clang-format off
static OSTask_t sJpegTask = {
M_NJPEGTASK, // type
0, //flags
NULL, // ucode_boot
0, // ucode_boot_size
D_80114930, // ucode
0x1000, // ucode_size
D_80157D30, // ucode_data
0x800, // ucode_data_size
NULL, // dram_stack
0, // dram_stack_size
NULL, // output_buff
0, // output_buff_size
NULL, // data_ptr
sizeof(JpegTaskData), // data_size
NULL, // yield_data_ptr
0x200, // yield_data_size
};
// clang-format on
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006E0A0.s") JpegWork* workBuf = ctx->workBuf;
u32 pad[2];
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006E0EC.s") workBuf->taskData.unk_00 = PHYSICAL_TO_VIRTUAL(&workBuf->unk_6C0);
workBuf->taskData.unk_08 = ctx->unk_28;
workBuf->taskData.unk_04 = 4;
workBuf->taskData.qTablePtrs[0] = PHYSICAL_TO_VIRTUAL(&workBuf->qTables[0]);
workBuf->taskData.qTablePtrs[1] = PHYSICAL_TO_VIRTUAL(&workBuf->qTables[1]);
workBuf->taskData.qTablePtrs[2] = PHYSICAL_TO_VIRTUAL(&workBuf->qTables[2]);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006E418.s") sJpegTask.flags = 0;
sJpegTask.ucode_boot = SysUcode_GetUCodeBoot();
sJpegTask.ucode_boot_size = SysUcode_GetUCodeBootSize();
sJpegTask.yield_data_ptr = &workBuf->yieldData;
sJpegTask.data_ptr = &workBuf->taskData;
ctx->scTask.next = NULL;
ctx->scTask.flags = OS_SC_NEEDS_RSP;
ctx->scTask.msgQ = &ctx->mq;
ctx->scTask.msg = NULL;
ctx->scTask.framebuffer = NULL;
ctx->scTask.list.t = sJpegTask;
osSendMesg(&gSchedContext.cmdQ, (OSMesg)&ctx->scTask, OS_MESG_BLOCK);
func_800C95F8(&gSchedContext); // osScKickEntryMsg
osRecvMesg(&ctx->mq, NULL, OS_MESG_BLOCK);
}
void Jpeg_CopyToZbuffer(u16* src, u16* zbuffer, s32 x, s32 y) {
u16* dst;
s32 i;
dst = zbuffer + (((y * SCREEN_WIDTH) + x) * 16);
for (i = 0; i < 16; i++) {
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
dst[3] = src[3];
dst[4] = src[4];
dst[5] = src[5];
dst[6] = src[6];
dst[7] = src[7];
dst[8] = src[8];
dst[9] = src[9];
dst[10] = src[10];
dst[11] = src[11];
dst[12] = src[12];
dst[13] = src[13];
dst[14] = src[14];
dst[15] = src[15];
src += 16;
dst += SCREEN_WIDTH;
}
}
u16 Jpeg_GetU16(u8* ptr) {
if (((u32)ptr & 1) == 0) { // if the address is aligned to 2
return *(u16*)ptr;
}
else {
return *(u16*)(ptr - 1) << 8 | (*(u16*)(ptr + 1) >> 8); // ?? it's exactly like *(16*)ptr
}
}
void Jpeg_ParseMarkers(u8* ptr, JpegContext* ctx) {
u32 exit;
exit = false;
ctx->dqtCount = 0;
ctx->dhtCount = 0;
while (true) {
if (exit) {
break;
}
if (*ptr++ == 0xFF) {
switch (*ptr++) {
case 0:
break;
case MARKER_SOI: {
osSyncPrintf("MARKER_SOI\n");
break;
}
case MARKER_APP0: {
osSyncPrintf("MARKER_APP0 %d\n", Jpeg_GetU16(ptr));
ptr += Jpeg_GetU16(ptr);
break;
}
case MARKER_APP1: {
osSyncPrintf("MARKER_APP1 %d\n", Jpeg_GetU16(ptr));
ptr += Jpeg_GetU16(ptr);
break;
}
case MARKER_APP2: {
osSyncPrintf("MARKER_APP2 %d\n", Jpeg_GetU16(ptr));
ptr += Jpeg_GetU16(ptr);
break;
}
case MARKER_DQT: {
osSyncPrintf("MARKER_DQT %d %d %02x\n", ctx->dqtCount, Jpeg_GetU16(ptr), ptr[2]);
ctx->dqtPtr[ctx->dqtCount++] = ptr + 2;
ptr += Jpeg_GetU16(ptr);
break;
}
case MARKER_DHT: {
osSyncPrintf("MARKER_DHT %d %d %02x\n", ctx->dhtCount, Jpeg_GetU16(ptr), ptr[2]);
ctx->dhtPtr[ctx->dhtCount++] = ptr + 2;
ptr += Jpeg_GetU16(ptr);
break;
}
case MARKER_DRI: {
osSyncPrintf("MARKER_DRI %d\n", Jpeg_GetU16(ptr));
ptr += Jpeg_GetU16(ptr);
break;
}
case MARKER_SOF: {
osSyncPrintf("MARKER_SOF %d "
"精度%02x " // accuracy
"垂直%d " // vertical
"水平%d " // horizontal
"compo%02x "
"(1:Y)%d (H0=2,V0=1(422) or 2(420))%02x (量子化テーブル)%02x "
"(2:Cb)%d (H1=1,V1=1)%02x (量子化テーブル)%02x "
"(3:Cr)%d (H2=1,V2=1)%02x (量子化テーブル)%02x\n",
Jpeg_GetU16(ptr),
ptr[2], // precision
Jpeg_GetU16(ptr + 3), // height
Jpeg_GetU16(ptr + 5), // width
ptr[7], // component count
ptr[8], ptr[9], ptr[10], // Y
ptr[11], ptr[12], ptr[13], // Cb
ptr[14], ptr[15], ptr[16] // Cr
);
if (ptr[9] == 0x21) // component Y : V0 == 1
{
ctx->unk_28 = 0;
} else if (ptr[9] == 0x22) // component Y : V0 == 2
{
ctx->unk_28 = 2;
}
ptr += Jpeg_GetU16(ptr);
break;
}
case MARKER_SOS: {
osSyncPrintf("MARKER_SOS %d\n", Jpeg_GetU16(ptr));
ptr += Jpeg_GetU16(ptr);
ctx->imageData = ptr;
break;
}
case MARKER_EOI: {
osSyncPrintf("MARKER_EOI\n");
exit = true;
break;
}
default: {
// Unknown marker
osSyncPrintf("マーカー不明 %02x\n", ptr[-1]);
ptr += Jpeg_GetU16(ptr);
break;
}
}
}
}
}
// the time diff isn't correct, workBuff->unk_6C0 is kept in a temp register instead of being stored in the stack and
// regalloc differences
#ifdef NON_MATCHING
s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize) {
s32 y;
s32 x;
u32 j;
u32 i;
JpegContext ctx; // 0x208
JpegHuffmanTable hTables[4]; // 0xB8
JpegDecoder decoder; // 0x9C
u32 unk[5]; // 0x88
u16(*src)[0x180];
OSTime diff; // 0x78
OSTime time; // 0x70
OSTime time2;
time = osGetTime();
if (workSize <
sizeof(JpegWork)) { // (?) I guess MB_SIZE=0x180, PROC_OF_MBS=5 which means unk_6C0 is not a part of JpegWork
__assert("worksize >= sizeof(JPEGWork) + MB_SIZE * (PROC_OF_MBS - 1)", "../z_jpeg.c", 527);
}
osCreateMesgQueue(&ctx.mq, &ctx.msg, 1);
MsgEvent_SendNullTask();
time2 = osGetTime();
diff = time2 - time;
if (1) {}
// Wait for synchronization of fifo buffer
osSyncPrintf("*** fifoバッファの同期待ち time = %6.3f ms ***\n", (f64)(OS_CYCLES_TO_USEC(diff) / 1000.0f));
ctx.workBuf = workBuff;
Jpeg_ParseMarkers(data, &ctx);
time = osGetTime();
diff = time - time2;
if (1) {}
// Check markers for each segment
osSyncPrintf("*** 各セグメントのマーカーのチェック time = %6.3f ms ***\n",
(f64)(OS_CYCLES_TO_USEC(diff) / 1000.0f));
switch (ctx.dqtCount) {
case 1: {
func_800FF540(ctx.dqtPtr[0], &workBuff->qTables[0], 3);
break;
}
case 2: {
func_800FF540(ctx.dqtPtr[0], &workBuff->qTables[0], 1);
func_800FF540(ctx.dqtPtr[1], &workBuff->qTables[1], 1);
func_800FF540(ctx.dqtPtr[1], &workBuff->qTables[2], 1);
break;
}
case 3: {
func_800FF540(ctx.dqtPtr[0], &workBuff->qTables[0], 1);
func_800FF540(ctx.dqtPtr[1], &workBuff->qTables[1], 1);
func_800FF540(ctx.dqtPtr[2], &workBuff->qTables[2], 1);
break;
}
default:
return -1;
}
time2 = osGetTime();
diff = time2 - time;
if (1) {}
// Create quantization table
osSyncPrintf("*** 量子化テーブル作成 time = %6.3f ms ***\n", (f64)(OS_CYCLES_TO_USEC(diff) / 1000.0f));
switch (ctx.dhtCount) {
case 1: {
if (func_800FF7FC(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLenghts, &workBuff->codes, 4)) {
osSyncPrintf("Error : Cant' make huffman table.\n");
}
break;
}
case 4: {
if (func_800FF7FC(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLenghts, &workBuff->codes, 1)) {
osSyncPrintf("Error : Cant' make huffman table.\n");
}
if (func_800FF7FC(ctx.dhtPtr[1], &hTables[1], &workBuff->codesLenghts, &workBuff->codes, 1)) {
osSyncPrintf("Error : Cant' make huffman table.\n");
}
if (func_800FF7FC(ctx.dhtPtr[2], &hTables[2], &workBuff->codesLenghts, &workBuff->codes, 1)) {
osSyncPrintf("Error : Cant' make huffman table.\n");
}
if (func_800FF7FC(ctx.dhtPtr[3], &hTables[3], &workBuff->codesLenghts, &workBuff->codes, 1)) {
osSyncPrintf("Error : Cant' make huffman table.\n");
}
break;
}
default:
return -1;
}
time = osGetTime();
diff = time - time2;
if (1) {}
// Huffman table creation
osSyncPrintf("*** ハフマンテーブル作成 time = %6.3f ms ***\n", (f64)(OS_CYCLES_TO_USEC(diff) / 1000.0f));
decoder.unk_05 = 2;
decoder.hTablePtrs[0] = &hTables[0];
decoder.hTablePtrs[1] = &hTables[1];
decoder.hTablePtrs[2] = &hTables[2];
decoder.hTablePtrs[3] = &hTables[3];
if (1) {}
decoder.unk_18 = 0;
decoder.imageData = ctx.imageData;
decoder.unk_04 = ctx.unk_28;
y = 0;
x = 0;
for (i = 0; i < 300; i += 4) {
if (func_800FFA50(&decoder, &workBuff->unk_6C0, 4, i != 0, unk)) {
osSyncPrintf(VT_FGCOL(RED));
osSyncPrintf("Error : Can't decode jpeg\n");
osSyncPrintf(VT_RST);
} else {
Jpeg_SendTask(&ctx);
osInvalDCache(&workBuff->unk_6C0, sizeof(workBuff->unk_6C0[0]));
src = &workBuff->unk_6C0;
for (j = 0; j < ARRAY_COUNT(workBuff->unk_6C0); j++) {
Jpeg_CopyToZbuffer(&src[j], zbuffer, x, y);
x++;
if (x >= 20) {
x = 0;
y++;
}
}
}
}
time2 = osGetTime();
diff = time2 - time;
if (1) {}
// Unfold & draw
osSyncPrintf("*** 展開 & 描画 time = %6.3f ms ***\n", (f64)(OS_CYCLES_TO_USEC(diff) / 1000.0f));
return 0;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/Jpeg_Decode.s")
#endif

View file

@ -242,7 +242,7 @@ s32 func_80096238(void* data) {
osSyncPrintf("ワークバッファアドレス(Zバッファ)%08x\n", gZBuffer); osSyncPrintf("ワークバッファアドレス(Zバッファ)%08x\n", gZBuffer);
time = osGetTime(); time = osGetTime();
if (!func_8006E418(data, gZBuffer, gGfxSPTaskOutputBuffer, sizeof(gGfxSPTaskOutputBuffer))) { if (!Jpeg_Decode(data, gZBuffer, gGfxSPTaskOutputBuffer, sizeof(gGfxSPTaskOutputBuffer))) {
time = osGetTime() - time; time = osGetTime() - time;
// Translates to: "SUCCESS... I THINK. time = %6.3f ms" // Translates to: "SUCCESS... I THINK. time = %6.3f ms"
@ -375,8 +375,8 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
gfxCtx->polyOpa.p = spA8; gfxCtx->polyOpa.p = spA8;
} }
// gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData())? // gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData())?
gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData(), 0x800); gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData(), 0x800);
} }
} }
@ -481,8 +481,8 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
gfxCtx->polyOpa.p = spA8; gfxCtx->polyOpa.p = spA8;
} }
// gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData())? // gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData())?
gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUcode(), SysUcode_GetUcodeData(), 0x800); gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData(), 0x800);
} }
} }