mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-13 04:39:36 +00:00
Decompile jpegdecoder.c, padsetup.c and code_800C3C20.c (#217)
* Decompile jpegdecoder.c, padsetup.c and code_800C3C20.c * change func_800C3C20's prototype and rename some fields in jpeg related structs * Fix comment in Jpeg_GetU16 and change func_800C3C20 * use a switch in padsetup.c
This commit is contained in:
parent
afce6a3c36
commit
ab1ec89f22
18 changed files with 389 additions and 653 deletions
1
Makefile
1
Makefile
|
@ -118,6 +118,7 @@ build/src/libultra_boot_O2/%.o: CC := $(CC_OLD)
|
|||
|
||||
build/src/libultra_code/%.o: CC := python3 tools/asm_processor/build.py $(CC_OLD) -- $(AS) $(ASFLAGS) --
|
||||
build/src/code/jpegutils.o: CC := python3 tools/asm_processor/build.py $(CC_OLD) -- $(AS) $(ASFLAGS) --
|
||||
build/src/code/jpegdecoder.o: CC := python3 tools/asm_processor/build.py $(CC_OLD) -- $(AS) $(ASFLAGS) --
|
||||
|
||||
build/src/boot/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
build/src/code/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
.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 purpose registers
|
||||
|
||||
.section .text
|
||||
|
||||
.balign 16
|
||||
|
||||
glabel func_800C3C20
|
||||
/* B3ADC0 800C3C20 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
/* B3ADC4 800C3C24 AFB10018 */ sw $s1, 0x18($sp)
|
||||
/* B3ADC8 800C3C28 AFB00014 */ sw $s0, 0x14($sp)
|
||||
/* B3ADCC 800C3C2C 3C108013 */ lui $s0, %hi(D_8012D200) # $s0, 0x8013
|
||||
/* B3ADD0 800C3C30 3C118013 */ lui $s1, %hi(D_8012D207) # $s1, 0x8013
|
||||
/* B3ADD4 800C3C34 AFBF001C */ sw $ra, 0x1c($sp)
|
||||
/* B3ADD8 800C3C38 2631D207 */ addiu $s1, %lo(D_8012D207) # addiu $s1, $s1, -0x2df9
|
||||
/* B3ADDC 800C3C3C 2610D200 */ addiu $s0, %lo(D_8012D200) # addiu $s0, $s0, -0x2e00
|
||||
.L800C3C40:
|
||||
/* B3ADE0 800C3C40 0C03E1E8 */ jal func_800F87A0
|
||||
/* B3ADE4 800C3C44 92040000 */ lbu $a0, ($s0)
|
||||
/* B3ADE8 800C3C48 26100001 */ addiu $s0, $s0, 1
|
||||
/* B3ADEC 800C3C4C 0211082B */ sltu $at, $s0, $s1
|
||||
/* B3ADF0 800C3C50 1420FFFB */ bnez $at, .L800C3C40
|
||||
/* B3ADF4 800C3C54 00000000 */ nop
|
||||
/* B3ADF8 800C3C58 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
/* B3ADFC 800C3C5C 8FB00014 */ lw $s0, 0x14($sp)
|
||||
/* B3AE00 800C3C60 8FB10018 */ lw $s1, 0x18($sp)
|
||||
/* B3AE04 800C3C64 03E00008 */ jr $ra
|
||||
/* B3AE08 800C3C68 27BD0020 */ addiu $sp, $sp, 0x20
|
|
@ -1,99 +0,0 @@
|
|||
.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 purpose registers
|
||||
|
||||
.section .text
|
||||
|
||||
.balign 16
|
||||
|
||||
glabel func_800FCD40
|
||||
/* B73EE0 800FCD40 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
/* B73EE4 800FCD44 AFBF001C */ sw $ra, 0x1c($sp)
|
||||
/* B73EE8 800FCD48 AFB00018 */ sw $s0, 0x18($sp)
|
||||
/* B73EEC 800FCD4C AFA40020 */ sw $a0, 0x20($sp)
|
||||
/* B73EF0 800FCD50 240E00FF */ li $t6, 255
|
||||
/* B73EF4 800FCD54 A0AE0000 */ sb $t6, ($a1)
|
||||
/* B73EF8 800FCD58 00C08025 */ move $s0, $a2
|
||||
/* B73EFC 800FCD5C AFA50024 */ sw $a1, 0x24($sp)
|
||||
/* B73F00 800FCD60 0C040304 */ jal osContInit
|
||||
/* B73F04 800FCD64 8FA40020 */ lw $a0, 0x20($sp)
|
||||
/* B73F08 800FCD68 10400003 */ beqz $v0, .L800FCD78
|
||||
/* B73F0C 800FCD6C 8FA70024 */ lw $a3, 0x24($sp)
|
||||
/* B73F10 800FCD70 1000003E */ b .L800FCE6C
|
||||
/* B73F14 800FCD74 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
.L800FCD78:
|
||||
/* B73F18 800FCD78 90EF0000 */ lbu $t7, ($a3)
|
||||
/* B73F1C 800FCD7C 240100FF */ li $at, 255
|
||||
/* B73F20 800FCD80 8FA40020 */ lw $a0, 0x20($sp)
|
||||
/* B73F24 800FCD84 55E10038 */ bnel $t7, $at, .L800FCE68
|
||||
/* B73F28 800FCD88 00001025 */ move $v0, $zero
|
||||
/* B73F2C 800FCD8C 0C040C84 */ jal osContStartQuery
|
||||
/* B73F30 800FCD90 AFA70024 */ sw $a3, 0x24($sp)
|
||||
/* B73F34 800FCD94 10400003 */ beqz $v0, .L800FCDA4
|
||||
/* B73F38 800FCD98 8FA70024 */ lw $a3, 0x24($sp)
|
||||
/* B73F3C 800FCD9C 10000032 */ b .L800FCE68
|
||||
/* B73F40 800FCDA0 24020001 */ li $v0, 1
|
||||
.L800FCDA4:
|
||||
/* B73F44 800FCDA4 8FA40020 */ lw $a0, 0x20($sp)
|
||||
/* B73F48 800FCDA8 00002825 */ move $a1, $zero
|
||||
/* B73F4C 800FCDAC 24060001 */ li $a2, 1
|
||||
/* B73F50 800FCDB0 0C000CA0 */ jal osRecvMesg
|
||||
/* B73F54 800FCDB4 AFA70024 */ sw $a3, 0x24($sp)
|
||||
/* B73F58 800FCDB8 0C040CA3 */ jal osContGetQuery
|
||||
/* B73F5C 800FCDBC 02002025 */ move $a0, $s0
|
||||
/* B73F60 800FCDC0 8FA70024 */ lw $a3, 0x24($sp)
|
||||
/* B73F64 800FCDC4 02001025 */ move $v0, $s0
|
||||
/* B73F68 800FCDC8 24030005 */ li $v1, 5
|
||||
/* B73F6C 800FCDCC A0E00000 */ sb $zero, ($a3)
|
||||
/* B73F70 800FCDD0 92180003 */ lbu $t8, 3($s0)
|
||||
/* B73F74 800FCDD4 17000008 */ bnez $t8, .L800FCDF8
|
||||
/* B73F78 800FCDD8 00000000 */ nop
|
||||
/* B73F7C 800FCDDC 96190000 */ lhu $t9, ($s0)
|
||||
/* B73F80 800FCDE0 24030005 */ li $v1, 5
|
||||
/* B73F84 800FCDE4 34090001 */ ori $t1, $zero, 1
|
||||
/* B73F88 800FCDE8 54790004 */ bnel $v1, $t9, .L800FCDFC
|
||||
/* B73F8C 800FCDEC 904A0007 */ lbu $t2, 7($v0)
|
||||
/* B73F90 800FCDF0 10000001 */ b .L800FCDF8
|
||||
/* B73F94 800FCDF4 A0E90000 */ sb $t1, ($a3)
|
||||
.L800FCDF8:
|
||||
/* B73F98 800FCDF8 904A0007 */ lbu $t2, 7($v0)
|
||||
.L800FCDFC:
|
||||
/* B73F9C 800FCDFC 55400008 */ bnezl $t2, .L800FCE20
|
||||
/* B73FA0 800FCE00 904E000B */ lbu $t6, 0xb($v0)
|
||||
/* B73FA4 800FCE04 944B0004 */ lhu $t3, 4($v0)
|
||||
/* B73FA8 800FCE08 546B0005 */ bnel $v1, $t3, .L800FCE20
|
||||
/* B73FAC 800FCE0C 904E000B */ lbu $t6, 0xb($v0)
|
||||
/* B73FB0 800FCE10 90EC0000 */ lbu $t4, ($a3)
|
||||
/* B73FB4 800FCE14 358D0002 */ ori $t5, $t4, 2
|
||||
/* B73FB8 800FCE18 A0ED0000 */ sb $t5, ($a3)
|
||||
/* B73FBC 800FCE1C 904E000B */ lbu $t6, 0xb($v0)
|
||||
.L800FCE20:
|
||||
/* B73FC0 800FCE20 55C00008 */ bnezl $t6, .L800FCE44
|
||||
/* B73FC4 800FCE24 9048000F */ lbu $t0, 0xf($v0)
|
||||
/* B73FC8 800FCE28 944F0008 */ lhu $t7, 8($v0)
|
||||
/* B73FCC 800FCE2C 546F0005 */ bnel $v1, $t7, .L800FCE44
|
||||
/* B73FD0 800FCE30 9048000F */ lbu $t0, 0xf($v0)
|
||||
/* B73FD4 800FCE34 90F80000 */ lbu $t8, ($a3)
|
||||
/* B73FD8 800FCE38 37190004 */ ori $t9, $t8, 4
|
||||
/* B73FDC 800FCE3C A0F90000 */ sb $t9, ($a3)
|
||||
/* B73FE0 800FCE40 9048000F */ lbu $t0, 0xf($v0)
|
||||
.L800FCE44:
|
||||
/* B73FE4 800FCE44 55000008 */ bnezl $t0, .L800FCE68
|
||||
/* B73FE8 800FCE48 00001025 */ move $v0, $zero
|
||||
/* B73FEC 800FCE4C 9449000C */ lhu $t1, 0xc($v0)
|
||||
/* B73FF0 800FCE50 54690005 */ bnel $v1, $t1, .L800FCE68
|
||||
/* B73FF4 800FCE54 00001025 */ move $v0, $zero
|
||||
/* B73FF8 800FCE58 90EA0000 */ lbu $t2, ($a3)
|
||||
/* B73FFC 800FCE5C 354B0008 */ ori $t3, $t2, 8
|
||||
/* B74000 800FCE60 A0EB0000 */ sb $t3, ($a3)
|
||||
/* B74004 800FCE64 00001025 */ move $v0, $zero
|
||||
.L800FCE68:
|
||||
/* B74008 800FCE68 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
.L800FCE6C:
|
||||
/* B7400C 800FCE6C 8FB00018 */ lw $s0, 0x18($sp)
|
||||
/* B74010 800FCE70 27BD0020 */ addiu $sp, $sp, 0x20
|
||||
/* B74014 800FCE74 03E00008 */ jr $ra
|
||||
/* B74018 800FCE78 00000000 */ nop
|
|
@ -1,433 +0,0 @@
|
|||
.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 purpose registers
|
||||
|
||||
.section .text
|
||||
|
||||
.balign 16
|
||||
|
||||
glabel func_800FFA50
|
||||
/* B76BF0 800FFA50 27BDFF98 */ addiu $sp, $sp, -0x68
|
||||
/* B76BF4 800FFA54 AFBF003C */ sw $ra, 0x3c($sp)
|
||||
/* B76BF8 800FFA58 AFBE0038 */ sw $fp, 0x38($sp)
|
||||
/* B76BFC 800FFA5C AFB70034 */ sw $s7, 0x34($sp)
|
||||
/* B76C00 800FFA60 AFB60030 */ sw $s6, 0x30($sp)
|
||||
/* B76C04 800FFA64 AFB5002C */ sw $s5, 0x2c($sp)
|
||||
/* B76C08 800FFA68 AFB40028 */ sw $s4, 0x28($sp)
|
||||
/* B76C0C 800FFA6C AFB30024 */ sw $s3, 0x24($sp)
|
||||
/* B76C10 800FFA70 AFB20020 */ sw $s2, 0x20($sp)
|
||||
/* B76C14 800FFA74 AFB1001C */ sw $s1, 0x1c($sp)
|
||||
/* B76C18 800FFA78 AFB00018 */ sw $s0, 0x18($sp)
|
||||
/* B76C1C 800FFA7C AFA70074 */ sw $a3, 0x74($sp)
|
||||
/* B76C20 800FFA80 AFA00058 */ sw $zero, 0x58($sp)
|
||||
/* B76C24 800FFA84 8C8F0000 */ lw $t7, ($a0)
|
||||
/* B76C28 800FFA88 3C018017 */ lui $at, %hi(D_80175660) # $at, 0x8017
|
||||
/* B76C2C 800FFA8C 30EE00FF */ andi $t6, $a3, 0xff
|
||||
/* B76C30 800FFA90 AC2F5660 */ sw $t7, %lo(D_80175660)($at)
|
||||
/* B76C34 800FFA94 90980004 */ lbu $t8, 4($a0)
|
||||
/* B76C38 800FFA98 01C03825 */ move $a3, $t6
|
||||
/* B76C3C 800FFA9C 00A08825 */ move $s1, $a1
|
||||
/* B76C40 800FFAA0 17000003 */ bnez $t8, .L800FFAB0
|
||||
/* B76C44 800FFAA4 00C0B025 */ move $s6, $a2
|
||||
/* B76C48 800FFAA8 10000007 */ b .L800FFAC8
|
||||
/* B76C4C 800FFAAC 24020002 */ li $v0, 2
|
||||
.L800FFAB0:
|
||||
/* B76C50 800FFAB0 90990005 */ lbu $t9, 5($a0)
|
||||
/* B76C54 800FFAB4 24010001 */ li $at, 1
|
||||
/* B76C58 800FFAB8 24020004 */ li $v0, 4
|
||||
/* B76C5C 800FFABC 17210002 */ bne $t9, $at, .L800FFAC8
|
||||
/* B76C60 800FFAC0 24080080 */ li $t0, 128
|
||||
/* B76C64 800FFAC4 AFA80058 */ sw $t0, 0x58($sp)
|
||||
.L800FFAC8:
|
||||
/* B76C68 800FFAC8 8C940008 */ lw $s4, 8($a0)
|
||||
/* B76C6C 800FFACC 8C95000C */ lw $s5, 0xc($a0)
|
||||
/* B76C70 800FFAD0 8C970010 */ lw $s7, 0x10($a0)
|
||||
/* B76C74 800FFAD4 14E0000E */ bnez $a3, .L800FFB10
|
||||
/* B76C78 800FFAD8 8C9E0014 */ lw $fp, 0x14($a0)
|
||||
/* B76C7C 800FFADC 3C018017 */ lui $at, %hi(D_80175664) # $at, 0x8017
|
||||
/* B76C80 800FFAE0 AC205664 */ sw $zero, %lo(D_80175664)($at)
|
||||
/* B76C84 800FFAE4 3C018017 */ lui $at, %hi(D_80175668) # $at, 0x8017
|
||||
/* B76C88 800FFAE8 24090020 */ li $t1, 32
|
||||
/* B76C8C 800FFAEC A0295668 */ sb $t1, %lo(D_80175668)($at)
|
||||
/* B76C90 800FFAF0 3C018017 */ lui $at, %hi(D_8017566C) # $at, 0x8017
|
||||
/* B76C94 800FFAF4 AC20566C */ sw $zero, %lo(D_8017566C)($at)
|
||||
/* B76C98 800FFAF8 3C018017 */ lui $at, %hi(D_80175669) # $at, 0x8017
|
||||
/* B76C9C 800FFAFC A0205669 */ sb $zero, %lo(D_80175669)($at)
|
||||
/* B76CA0 800FFB00 A7A00064 */ sh $zero, 0x64($sp)
|
||||
/* B76CA4 800FFB04 A7A00062 */ sh $zero, 0x62($sp)
|
||||
/* B76CA8 800FFB08 10000014 */ b .L800FFB5C
|
||||
/* B76CAC 800FFB0C A7A00060 */ sh $zero, 0x60($sp)
|
||||
.L800FFB10:
|
||||
/* B76CB0 800FFB10 8FAA0078 */ lw $t2, 0x78($sp)
|
||||
/* B76CB4 800FFB14 3C018017 */ lui $at, %hi(D_80175664) # $at, 0x8017
|
||||
/* B76CB8 800FFB18 8D4B0000 */ lw $t3, ($t2)
|
||||
/* B76CBC 800FFB1C AC2B5664 */ sw $t3, %lo(D_80175664)($at)
|
||||
/* B76CC0 800FFB20 914C0004 */ lbu $t4, 4($t2)
|
||||
/* B76CC4 800FFB24 3C018017 */ lui $at, %hi(D_80175668) # $at, 0x8017
|
||||
/* B76CC8 800FFB28 A02C5668 */ sb $t4, %lo(D_80175668)($at)
|
||||
/* B76CCC 800FFB2C 8D4D0008 */ lw $t5, 8($t2)
|
||||
/* B76CD0 800FFB30 3C018017 */ lui $at, %hi(D_8017566C) # $at, 0x8017
|
||||
/* B76CD4 800FFB34 AC2D566C */ sw $t5, %lo(D_8017566C)($at)
|
||||
/* B76CD8 800FFB38 914E0005 */ lbu $t6, 5($t2)
|
||||
/* B76CDC 800FFB3C 3C018017 */ lui $at, %hi(D_80175669) # $at, 0x8017
|
||||
/* B76CE0 800FFB40 A02E5669 */ sb $t6, %lo(D_80175669)($at)
|
||||
/* B76CE4 800FFB44 854F000C */ lh $t7, 0xc($t2)
|
||||
/* B76CE8 800FFB48 A7AF0064 */ sh $t7, 0x64($sp)
|
||||
/* B76CEC 800FFB4C 8558000E */ lh $t8, 0xe($t2)
|
||||
/* B76CF0 800FFB50 A7B80062 */ sh $t8, 0x62($sp)
|
||||
/* B76CF4 800FFB54 85590010 */ lh $t9, 0x10($t2)
|
||||
/* B76CF8 800FFB58 A7B90060 */ sh $t9, 0x60($sp)
|
||||
.L800FFB5C:
|
||||
/* B76CFC 800FFB5C 12C00026 */ beqz $s6, .L800FFBF8
|
||||
/* B76D00 800FFB60 00409025 */ move $s2, $v0
|
||||
/* B76D04 800FFB64 27B30064 */ addiu $s3, $sp, 0x64
|
||||
.L800FFB68:
|
||||
/* B76D08 800FFB68 1240000C */ beqz $s2, .L800FFB9C
|
||||
/* B76D0C 800FFB6C 00008025 */ move $s0, $zero
|
||||
.L800FFB70:
|
||||
/* B76D10 800FFB70 02802025 */ move $a0, $s4
|
||||
/* B76D14 800FFB74 02A02825 */ move $a1, $s5
|
||||
/* B76D18 800FFB78 02203025 */ move $a2, $s1
|
||||
/* B76D1C 800FFB7C 0C03FF1E */ jal func_800FFC78
|
||||
/* B76D20 800FFB80 02603825 */ move $a3, $s3
|
||||
/* B76D24 800FFB84 10400003 */ beqz $v0, .L800FFB94
|
||||
/* B76D28 800FFB88 26100001 */ addiu $s0, $s0, 1
|
||||
/* B76D2C 800FFB8C 1000002E */ b .L800FFC48
|
||||
/* B76D30 800FFB90 24020002 */ li $v0, 2
|
||||
.L800FFB94:
|
||||
/* B76D34 800FFB94 1612FFF6 */ bne $s0, $s2, .L800FFB70
|
||||
/* B76D38 800FFB98 26310080 */ addiu $s1, $s1, 0x80
|
||||
.L800FFB9C:
|
||||
/* B76D3C 800FFB9C 02E02025 */ move $a0, $s7
|
||||
/* B76D40 800FFBA0 03C02825 */ move $a1, $fp
|
||||
/* B76D44 800FFBA4 02203025 */ move $a2, $s1
|
||||
/* B76D48 800FFBA8 0C03FF1E */ jal func_800FFC78
|
||||
/* B76D4C 800FFBAC 27A70062 */ addiu $a3, $sp, 0x62
|
||||
/* B76D50 800FFBB0 10400003 */ beqz $v0, .L800FFBC0
|
||||
/* B76D54 800FFBB4 26310080 */ addiu $s1, $s1, 0x80
|
||||
/* B76D58 800FFBB8 10000023 */ b .L800FFC48
|
||||
/* B76D5C 800FFBBC 24020002 */ li $v0, 2
|
||||
.L800FFBC0:
|
||||
/* B76D60 800FFBC0 02E02025 */ move $a0, $s7
|
||||
/* B76D64 800FFBC4 03C02825 */ move $a1, $fp
|
||||
/* B76D68 800FFBC8 02203025 */ move $a2, $s1
|
||||
/* B76D6C 800FFBCC 0C03FF1E */ jal func_800FFC78
|
||||
/* B76D70 800FFBD0 27A70060 */ addiu $a3, $sp, 0x60
|
||||
/* B76D74 800FFBD4 10400003 */ beqz $v0, .L800FFBE4
|
||||
/* B76D78 800FFBD8 8FA80058 */ lw $t0, 0x58($sp)
|
||||
/* B76D7C 800FFBDC 1000001A */ b .L800FFC48
|
||||
/* B76D80 800FFBE0 24020002 */ li $v0, 2
|
||||
.L800FFBE4:
|
||||
/* B76D84 800FFBE4 26D6FFFF */ addiu $s6, $s6, -1
|
||||
/* B76D88 800FFBE8 26310080 */ addiu $s1, $s1, 0x80
|
||||
/* B76D8C 800FFBEC 00084840 */ sll $t1, $t0, 1
|
||||
/* B76D90 800FFBF0 16C0FFDD */ bnez $s6, .L800FFB68
|
||||
/* B76D94 800FFBF4 02298821 */ addu $s1, $s1, $t1
|
||||
.L800FFBF8:
|
||||
/* B76D98 800FFBF8 3C0B8017 */ lui $t3, %hi(D_80175664) # $t3, 0x8017
|
||||
/* B76D9C 800FFBFC 8FA30078 */ lw $v1, 0x78($sp)
|
||||
/* B76DA0 800FFC00 8D6B5664 */ lw $t3, %lo(D_80175664)($t3)
|
||||
/* B76DA4 800FFC04 3C0C8017 */ lui $t4, %hi(D_80175668) # $t4, 0x8017
|
||||
/* B76DA8 800FFC08 3C0D8017 */ lui $t5, %hi(D_8017566C) # $t5, 0x8017
|
||||
/* B76DAC 800FFC0C AC6B0000 */ sw $t3, ($v1)
|
||||
/* B76DB0 800FFC10 918C5668 */ lbu $t4, %lo(D_80175668)($t4)
|
||||
/* B76DB4 800FFC14 3C0E8017 */ lui $t6, %hi(D_80175669) # $t6, 0x8017
|
||||
/* B76DB8 800FFC18 00001025 */ move $v0, $zero
|
||||
/* B76DBC 800FFC1C A06C0004 */ sb $t4, 4($v1)
|
||||
/* B76DC0 800FFC20 8DAD566C */ lw $t5, %lo(D_8017566C)($t5)
|
||||
/* B76DC4 800FFC24 AC6D0008 */ sw $t5, 8($v1)
|
||||
/* B76DC8 800FFC28 91CE5669 */ lbu $t6, %lo(D_80175669)($t6)
|
||||
/* B76DCC 800FFC2C A06E0005 */ sb $t6, 5($v1)
|
||||
/* B76DD0 800FFC30 87AF0064 */ lh $t7, 0x64($sp)
|
||||
/* B76DD4 800FFC34 A46F000C */ sh $t7, 0xc($v1)
|
||||
/* B76DD8 800FFC38 87B80062 */ lh $t8, 0x62($sp)
|
||||
/* B76DDC 800FFC3C A478000E */ sh $t8, 0xe($v1)
|
||||
/* B76DE0 800FFC40 87AA0060 */ lh $t2, 0x60($sp)
|
||||
/* B76DE4 800FFC44 A46A0010 */ sh $t2, 0x10($v1)
|
||||
.L800FFC48:
|
||||
/* B76DE8 800FFC48 8FBF003C */ lw $ra, 0x3c($sp)
|
||||
/* B76DEC 800FFC4C 8FB00018 */ lw $s0, 0x18($sp)
|
||||
/* B76DF0 800FFC50 8FB1001C */ lw $s1, 0x1c($sp)
|
||||
/* B76DF4 800FFC54 8FB20020 */ lw $s2, 0x20($sp)
|
||||
/* B76DF8 800FFC58 8FB30024 */ lw $s3, 0x24($sp)
|
||||
/* B76DFC 800FFC5C 8FB40028 */ lw $s4, 0x28($sp)
|
||||
/* B76E00 800FFC60 8FB5002C */ lw $s5, 0x2c($sp)
|
||||
/* B76E04 800FFC64 8FB60030 */ lw $s6, 0x30($sp)
|
||||
/* B76E08 800FFC68 8FB70034 */ lw $s7, 0x34($sp)
|
||||
/* B76E0C 800FFC6C 8FBE0038 */ lw $fp, 0x38($sp)
|
||||
/* B76E10 800FFC70 03E00008 */ jr $ra
|
||||
/* B76E14 800FFC74 27BD0068 */ addiu $sp, $sp, 0x68
|
||||
|
||||
glabel func_800FFC78
|
||||
/* B76E18 800FFC78 27BDFFC8 */ addiu $sp, $sp, -0x38
|
||||
/* B76E1C 800FFC7C AFB50028 */ sw $s5, 0x28($sp)
|
||||
/* B76E20 800FFC80 AFB40024 */ sw $s4, 0x24($sp)
|
||||
/* B76E24 800FFC84 AFB30020 */ sw $s3, 0x20($sp)
|
||||
/* B76E28 800FFC88 AFB10018 */ sw $s1, 0x18($sp)
|
||||
/* B76E2C 800FFC8C 00C08825 */ move $s1, $a2
|
||||
/* B76E30 800FFC90 00A09825 */ move $s3, $a1
|
||||
/* B76E34 800FFC94 27B40034 */ addiu $s4, $sp, 0x34
|
||||
/* B76E38 800FFC98 27B50036 */ addiu $s5, $sp, 0x36
|
||||
/* B76E3C 800FFC9C AFBF002C */ sw $ra, 0x2c($sp)
|
||||
/* B76E40 800FFCA0 AFB2001C */ sw $s2, 0x1c($sp)
|
||||
/* B76E44 800FFCA4 00E09025 */ move $s2, $a3
|
||||
/* B76E48 800FFCA8 AFB00014 */ sw $s0, 0x14($sp)
|
||||
/* B76E4C 800FFCAC 02A03025 */ move $a2, $s5
|
||||
/* B76E50 800FFCB0 0C03FF85 */ jal func_800FFE14
|
||||
/* B76E54 800FFCB4 02802825 */ move $a1, $s4
|
||||
/* B76E58 800FFCB8 10400003 */ beqz $v0, .L800FFCC8
|
||||
/* B76E5C 800FFCBC 87AF0034 */ lh $t7, 0x34($sp)
|
||||
/* B76E60 800FFCC0 1000004B */ b .L800FFDF0
|
||||
/* B76E64 800FFCC4 24020001 */ li $v0, 1
|
||||
.L800FFCC8:
|
||||
/* B76E68 800FFCC8 864E0000 */ lh $t6, ($s2)
|
||||
/* B76E6C 800FFCCC 24100001 */ li $s0, 1
|
||||
/* B76E70 800FFCD0 2A010040 */ slti $at, $s0, 0x40
|
||||
/* B76E74 800FFCD4 01CFC021 */ addu $t8, $t6, $t7
|
||||
/* B76E78 800FFCD8 A6580000 */ sh $t8, ($s2)
|
||||
/* B76E7C 800FFCDC 86590000 */ lh $t9, ($s2)
|
||||
/* B76E80 800FFCE0 2412000F */ li $s2, 15
|
||||
/* B76E84 800FFCE4 10200041 */ beqz $at, .L800FFDEC
|
||||
/* B76E88 800FFCE8 A6390000 */ sh $t9, ($s1)
|
||||
/* B76E8C 800FFCEC 02602025 */ move $a0, $s3
|
||||
.L800FFCF0:
|
||||
/* B76E90 800FFCF0 02802825 */ move $a1, $s4
|
||||
/* B76E94 800FFCF4 0C03FF85 */ jal func_800FFE14
|
||||
/* B76E98 800FFCF8 02A03025 */ move $a2, $s5
|
||||
/* B76E9C 800FFCFC 10400003 */ beqz $v0, .L800FFD0C
|
||||
/* B76EA0 800FFD00 87A80034 */ lh $t0, 0x34($sp)
|
||||
/* B76EA4 800FFD04 1000003A */ b .L800FFDF0
|
||||
/* B76EA8 800FFD08 24020001 */ li $v0, 1
|
||||
.L800FFD0C:
|
||||
/* B76EAC 800FFD0C 1500001E */ bnez $t0, .L800FFD88
|
||||
/* B76EB0 800FFD10 83A30036 */ lb $v1, 0x36($sp)
|
||||
/* B76EB4 800FFD14 83A30036 */ lb $v1, 0x36($sp)
|
||||
/* B76EB8 800FFD18 1472000F */ bne $v1, $s2, .L800FFD58
|
||||
/* B76EBC 800FFD1C 246AFFFF */ addiu $t2, $v1, -1
|
||||
/* B76EC0 800FFD20 0460002F */ bltz $v1, .L800FFDE0
|
||||
/* B76EC4 800FFD24 A3AA0036 */ sb $t2, 0x36($sp)
|
||||
.L800FFD28:
|
||||
/* B76EC8 800FFD28 00105840 */ sll $t3, $s0, 1
|
||||
/* B76ECC 800FFD2C 022B6021 */ addu $t4, $s1, $t3
|
||||
/* B76ED0 800FFD30 A5800000 */ sh $zero, ($t4)
|
||||
/* B76ED4 800FFD34 83AF0036 */ lb $t7, 0x36($sp)
|
||||
/* B76ED8 800FFD38 26100001 */ addiu $s0, $s0, 1
|
||||
/* B76EDC 800FFD3C 00106E00 */ sll $t5, $s0, 0x18
|
||||
/* B76EE0 800FFD40 25F8FFFF */ addiu $t8, $t7, -1
|
||||
/* B76EE4 800FFD44 A3B80036 */ sb $t8, 0x36($sp)
|
||||
/* B76EE8 800FFD48 05E1FFF7 */ bgez $t7, .L800FFD28
|
||||
/* B76EEC 800FFD4C 000D8603 */ sra $s0, $t5, 0x18
|
||||
/* B76EF0 800FFD50 10000024 */ b .L800FFDE4
|
||||
/* B76EF4 800FFD54 2A010040 */ slti $at, $s0, 0x40
|
||||
.L800FFD58:
|
||||
/* B76EF8 800FFD58 2A010040 */ slti $at, $s0, 0x40
|
||||
/* B76EFC 800FFD5C 10200023 */ beqz $at, .L800FFDEC
|
||||
.L800FFD60:
|
||||
/* B76F00 800FFD60 0010C840 */ sll $t9, $s0, 1
|
||||
/* B76F04 800FFD64 26100001 */ addiu $s0, $s0, 1
|
||||
/* B76F08 800FFD68 00104E00 */ sll $t1, $s0, 0x18
|
||||
/* B76F0C 800FFD6C 00098603 */ sra $s0, $t1, 0x18
|
||||
/* B76F10 800FFD70 2A010040 */ slti $at, $s0, 0x40
|
||||
/* B76F14 800FFD74 02394021 */ addu $t0, $s1, $t9
|
||||
/* B76F18 800FFD78 1420FFF9 */ bnez $at, .L800FFD60
|
||||
/* B76F1C 800FFD7C A5000000 */ sh $zero, ($t0)
|
||||
/* B76F20 800FFD80 1000001B */ b .L800FFDF0
|
||||
/* B76F24 800FFD84 00001025 */ move $v0, $zero
|
||||
.L800FFD88:
|
||||
/* B76F28 800FFD88 0003102A */ slt $v0, $zero, $v1
|
||||
/* B76F2C 800FFD8C 246CFFFF */ addiu $t4, $v1, -1
|
||||
/* B76F30 800FFD90 1040000C */ beqz $v0, .L800FFDC4
|
||||
/* B76F34 800FFD94 A3AC0036 */ sb $t4, 0x36($sp)
|
||||
.L800FFD98:
|
||||
/* B76F38 800FFD98 00106840 */ sll $t5, $s0, 1
|
||||
/* B76F3C 800FFD9C 022D7021 */ addu $t6, $s1, $t5
|
||||
/* B76F40 800FFDA0 A5C00000 */ sh $zero, ($t6)
|
||||
/* B76F44 800FFDA4 83B90036 */ lb $t9, 0x36($sp)
|
||||
/* B76F48 800FFDA8 26100001 */ addiu $s0, $s0, 1
|
||||
/* B76F4C 800FFDAC 00107E00 */ sll $t7, $s0, 0x18
|
||||
/* B76F50 800FFDB0 0019102A */ slt $v0, $zero, $t9
|
||||
/* B76F54 800FFDB4 2728FFFF */ addiu $t0, $t9, -1
|
||||
/* B76F58 800FFDB8 A3A80036 */ sb $t0, 0x36($sp)
|
||||
/* B76F5C 800FFDBC 1440FFF6 */ bnez $v0, .L800FFD98
|
||||
/* B76F60 800FFDC0 000F8603 */ sra $s0, $t7, 0x18
|
||||
.L800FFDC4:
|
||||
/* B76F64 800FFDC4 87A90034 */ lh $t1, 0x34($sp)
|
||||
/* B76F68 800FFDC8 00105040 */ sll $t2, $s0, 1
|
||||
/* B76F6C 800FFDCC 26100001 */ addiu $s0, $s0, 1
|
||||
/* B76F70 800FFDD0 00106600 */ sll $t4, $s0, 0x18
|
||||
/* B76F74 800FFDD4 022A5821 */ addu $t3, $s1, $t2
|
||||
/* B76F78 800FFDD8 000C8603 */ sra $s0, $t4, 0x18
|
||||
/* B76F7C 800FFDDC A5690000 */ sh $t1, ($t3)
|
||||
.L800FFDE0:
|
||||
/* B76F80 800FFDE0 2A010040 */ slti $at, $s0, 0x40
|
||||
.L800FFDE4:
|
||||
/* B76F84 800FFDE4 5420FFC2 */ bnezl $at, .L800FFCF0
|
||||
/* B76F88 800FFDE8 02602025 */ move $a0, $s3
|
||||
.L800FFDEC:
|
||||
/* B76F8C 800FFDEC 00001025 */ move $v0, $zero
|
||||
.L800FFDF0:
|
||||
/* B76F90 800FFDF0 8FBF002C */ lw $ra, 0x2c($sp)
|
||||
/* B76F94 800FFDF4 8FB00014 */ lw $s0, 0x14($sp)
|
||||
/* B76F98 800FFDF8 8FB10018 */ lw $s1, 0x18($sp)
|
||||
/* B76F9C 800FFDFC 8FB2001C */ lw $s2, 0x1c($sp)
|
||||
/* B76FA0 800FFE00 8FB30020 */ lw $s3, 0x20($sp)
|
||||
/* B76FA4 800FFE04 8FB40024 */ lw $s4, 0x24($sp)
|
||||
/* B76FA8 800FFE08 8FB50028 */ lw $s5, 0x28($sp)
|
||||
/* B76FAC 800FFE0C 03E00008 */ jr $ra
|
||||
/* B76FB0 800FFE10 27BD0038 */ addiu $sp, $sp, 0x38
|
||||
|
||||
glabel func_800FFE14
|
||||
/* B76FB4 800FFE14 27BDFFD8 */ addiu $sp, $sp, -0x28
|
||||
/* B76FB8 800FFE18 AFB00018 */ sw $s0, 0x18($sp)
|
||||
/* B76FBC 800FFE1C 00808025 */ move $s0, $a0
|
||||
/* B76FC0 800FFE20 AFBF001C */ sw $ra, 0x1c($sp)
|
||||
/* B76FC4 800FFE24 AFA5002C */ sw $a1, 0x2c($sp)
|
||||
/* B76FC8 800FFE28 AFA60030 */ sw $a2, 0x30($sp)
|
||||
/* B76FCC 800FFE2C 24040010 */ li $a0, 16
|
||||
/* B76FD0 800FFE30 0C03FFD4 */ jal func_800FFF50
|
||||
/* B76FD4 800FFE34 A7A00024 */ sh $zero, 0x24($sp)
|
||||
/* B76FD8 800FFE38 97A90024 */ lhu $t1, 0x24($sp)
|
||||
/* B76FDC 800FFE3C 8FAA002C */ lw $t2, 0x2c($sp)
|
||||
/* B76FE0 800FFE40 00003025 */ move $a2, $zero
|
||||
/* B76FE4 800FFE44 2408000F */ li $t0, 15
|
||||
/* B76FE8 800FFE48 3407FFFF */ li $a3, 65535
|
||||
.L800FFE4C:
|
||||
/* B76FEC 800FFE4C 00067040 */ sll $t6, $a2, 1
|
||||
/* B76FF0 800FFE50 020E7821 */ addu $t7, $s0, $t6
|
||||
/* B76FF4 800FFE54 95E40030 */ lhu $a0, 0x30($t7)
|
||||
/* B76FF8 800FFE58 0106C023 */ subu $t8, $t0, $a2
|
||||
/* B76FFC 800FFE5C 03021807 */ srav $v1, $v0, $t8
|
||||
/* B77000 800FFE60 10E40005 */ beq $a3, $a0, .L800FFE78
|
||||
/* B77004 800FFE64 00C02825 */ move $a1, $a2
|
||||
/* B77008 800FFE68 3079FFFF */ andi $t9, $v1, 0xffff
|
||||
/* B7700C 800FFE6C 0099082A */ slt $at, $a0, $t9
|
||||
/* B77010 800FFE70 10200006 */ beqz $at, .L800FFE8C
|
||||
/* B77014 800FFE74 3069FFFF */ andi $t1, $v1, 0xffff
|
||||
.L800FFE78:
|
||||
/* B77018 800FFE78 24C60001 */ addiu $a2, $a2, 1
|
||||
/* B7701C 800FFE7C 30C500FF */ andi $a1, $a2, 0xff
|
||||
/* B77020 800FFE80 28A10010 */ slti $at, $a1, 0x10
|
||||
/* B77024 800FFE84 1420FFF1 */ bnez $at, .L800FFE4C
|
||||
/* B77028 800FFE88 00A03025 */ move $a2, $a1
|
||||
.L800FFE8C:
|
||||
/* B7702C 800FFE8C 28A10010 */ slti $at, $a1, 0x10
|
||||
/* B77030 800FFE90 14200003 */ bnez $at, .L800FFEA0
|
||||
/* B77034 800FFE94 3C028017 */ lui $v0, %hi(D_80175668) # $v0, 0x8017
|
||||
/* B77038 800FFE98 10000028 */ b .L800FFF3C
|
||||
/* B7703C 800FFE9C 24020001 */ li $v0, 1
|
||||
.L800FFEA0:
|
||||
/* B77040 800FFEA0 02066021 */ addu $t4, $s0, $a2
|
||||
/* B77044 800FFEA4 00067840 */ sll $t7, $a2, 1
|
||||
/* B77048 800FFEA8 918D0000 */ lbu $t5, ($t4)
|
||||
/* B7704C 800FFEAC 020FC021 */ addu $t8, $s0, $t7
|
||||
/* B77050 800FFEB0 97190010 */ lhu $t9, 0x10($t8)
|
||||
/* B77054 800FFEB4 8E0C0050 */ lw $t4, 0x50($s0)
|
||||
/* B77058 800FFEB8 01A97021 */ addu $t6, $t5, $t1
|
||||
/* B7705C 800FFEBC 01D95823 */ subu $t3, $t6, $t9
|
||||
/* B77060 800FFEC0 016C6821 */ addu $t5, $t3, $t4
|
||||
/* B77064 800FFEC4 91A40000 */ lbu $a0, ($t5)
|
||||
/* B77068 800FFEC8 8FB80030 */ lw $t8, 0x30($sp)
|
||||
/* B7706C 800FFECC 24425668 */ addiu $v0, %lo(D_80175668) # addiu $v0, $v0, 0x5668
|
||||
/* B77070 800FFED0 00047903 */ sra $t7, $a0, 4
|
||||
/* B77074 800FFED4 A30F0000 */ sb $t7, ($t8)
|
||||
/* B77078 800FFED8 90590000 */ lbu $t9, ($v0)
|
||||
/* B7707C 800FFEDC 308E000F */ andi $t6, $a0, 0xf
|
||||
/* B77080 800FFEE0 01C02025 */ move $a0, $t6
|
||||
/* B77084 800FFEE4 03255821 */ addu $t3, $t9, $a1
|
||||
/* B77088 800FFEE8 256CFFF1 */ addiu $t4, $t3, -0xf
|
||||
/* B7708C 800FFEEC A04C0000 */ sb $t4, ($v0)
|
||||
/* B77090 800FFEF0 11C00011 */ beqz $t6, .L800FFF38
|
||||
/* B77094 800FFEF4 A5400000 */ sh $zero, ($t2)
|
||||
/* B77098 800FFEF8 0C03FFD4 */ jal func_800FFF50
|
||||
/* B7709C 800FFEFC A3AE0026 */ sb $t6, 0x26($sp)
|
||||
/* B770A0 800FFF00 8FAA002C */ lw $t2, 0x2c($sp)
|
||||
/* B770A4 800FFF04 93A40026 */ lbu $a0, 0x26($sp)
|
||||
/* B770A8 800FFF08 240F0001 */ li $t7, 1
|
||||
/* B770AC 800FFF0C A5420000 */ sh $v0, ($t2)
|
||||
/* B770B0 800FFF10 85450000 */ lh $a1, ($t2)
|
||||
/* B770B4 800FFF14 248D001F */ addiu $t5, $a0, 0x1f
|
||||
/* B770B8 800FFF18 01AFC004 */ sllv $t8, $t7, $t5
|
||||
/* B770BC 800FFF1C 00B8082A */ slt $at, $a1, $t8
|
||||
/* B770C0 800FFF20 10200005 */ beqz $at, .L800FFF38
|
||||
/* B770C4 800FFF24 240EFFFF */ li $t6, -1
|
||||
/* B770C8 800FFF28 008EC804 */ sllv $t9, $t6, $a0
|
||||
/* B770CC 800FFF2C 00B95821 */ addu $t3, $a1, $t9
|
||||
/* B770D0 800FFF30 256C0001 */ addiu $t4, $t3, 1
|
||||
/* B770D4 800FFF34 A54C0000 */ sh $t4, ($t2)
|
||||
.L800FFF38:
|
||||
/* B770D8 800FFF38 00001025 */ move $v0, $zero
|
||||
.L800FFF3C:
|
||||
/* B770DC 800FFF3C 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
/* B770E0 800FFF40 8FB00018 */ lw $s0, 0x18($sp)
|
||||
/* B770E4 800FFF44 27BD0028 */ addiu $sp, $sp, 0x28
|
||||
/* B770E8 800FFF48 03E00008 */ jr $ra
|
||||
/* B770EC 800FFF4C 00000000 */ nop
|
||||
|
||||
glabel func_800FFF50
|
||||
/* B770F0 800FFF50 3C088017 */ lui $t0, %hi(D_80175668) # $t0, 0x8017
|
||||
/* B770F4 800FFF54 25085668 */ addiu $t0, %lo(D_80175668) # addiu $t0, $t0, 0x5668
|
||||
/* B770F8 800FFF58 91050000 */ lbu $a1, ($t0)
|
||||
/* B770FC 800FFF5C AFA40000 */ sw $a0, ($sp)
|
||||
/* B77100 800FFF60 308700FF */ andi $a3, $a0, 0xff
|
||||
/* B77104 800FFF64 000510C3 */ sra $v0, $a1, 3
|
||||
/* B77108 800FFF68 304E00FF */ andi $t6, $v0, 0xff
|
||||
/* B7710C 800FFF6C 19C00029 */ blez $t6, .L80100014
|
||||
/* B77110 800FFF70 01C01025 */ move $v0, $t6
|
||||
/* B77114 800FFF74 3C068017 */ lui $a2, %hi(D_80175660) # $a2, 0x8017
|
||||
/* B77118 800FFF78 3C0D8017 */ lui $t5, %hi(D_8017566C) # $t5, 0x8017
|
||||
/* B7711C 800FFF7C 3C0A8017 */ lui $t2, %hi(D_80175669) # $t2, 0x8017
|
||||
/* B77120 800FFF80 3C098017 */ lui $t1, %hi(D_80175664) # $t1, 0x8017
|
||||
/* B77124 800FFF84 25295664 */ addiu $t1, %lo(D_80175664) # addiu $t1, $t1, 0x5664
|
||||
/* B77128 800FFF88 254A5669 */ addiu $t2, %lo(D_80175669) # addiu $t2, $t2, 0x5669
|
||||
/* B7712C 800FFF8C 25AD566C */ addiu $t5, %lo(D_8017566C) # addiu $t5, $t5, 0x566c
|
||||
/* B77130 800FFF90 8CC65660 */ lw $a2, %lo(D_80175660)($a2)
|
||||
/* B77134 800FFF94 240C0001 */ li $t4, 1
|
||||
/* B77138 800FFF98 240B00FF */ li $t3, 255
|
||||
.L800FFF9C:
|
||||
/* B7713C 800FFF9C 8D240000 */ lw $a0, ($t1)
|
||||
/* B77140 800FFFA0 91590000 */ lbu $t9, ($t2)
|
||||
/* B77144 800FFFA4 91050000 */ lbu $a1, ($t0)
|
||||
/* B77148 800FFFA8 00867821 */ addu $t7, $a0, $a2
|
||||
/* B7714C 800FFFAC 91E30000 */ lbu $v1, ($t7)
|
||||
/* B77150 800FFFB0 24980001 */ addiu $t8, $a0, 1
|
||||
/* B77154 800FFFB4 13200006 */ beqz $t9, .L800FFFD0
|
||||
/* B77158 800FFFB8 AD380000 */ sw $t8, ($t1)
|
||||
/* B7715C 800FFFBC 14600004 */ bnez $v1, .L800FFFD0
|
||||
/* B77160 800FFFC0 03067021 */ addu $t6, $t8, $a2
|
||||
/* B77164 800FFFC4 91C30000 */ lbu $v1, ($t6)
|
||||
/* B77168 800FFFC8 270F0001 */ addiu $t7, $t8, 1
|
||||
/* B7716C 800FFFCC AD2F0000 */ sw $t7, ($t1)
|
||||
.L800FFFD0:
|
||||
/* B77170 800FFFD0 15630003 */ bne $t3, $v1, .L800FFFE0
|
||||
/* B77174 800FFFD4 00602025 */ move $a0, $v1
|
||||
/* B77178 800FFFD8 10000002 */ b .L800FFFE4
|
||||
/* B7717C 800FFFDC A14C0000 */ sb $t4, ($t2)
|
||||
.L800FFFE0:
|
||||
/* B77180 800FFFE0 A1400000 */ sb $zero, ($t2)
|
||||
.L800FFFE4:
|
||||
/* B77184 800FFFE4 8DB80000 */ lw $t8, ($t5)
|
||||
/* B77188 800FFFE8 2442FFFF */ addiu $v0, $v0, -1
|
||||
/* B7718C 800FFFEC 0018CA00 */ sll $t9, $t8, 8
|
||||
/* B77190 800FFFF0 ADB90000 */ sw $t9, ($t5)
|
||||
/* B77194 800FFFF4 03247825 */ or $t7, $t9, $a0
|
||||
/* B77198 800FFFF8 305900FF */ andi $t9, $v0, 0xff
|
||||
/* B7719C 800FFFFC 24B8FFF8 */ addiu $t8, $a1, -8
|
||||
/* B771A0 80100000 03201025 */ move $v0, $t9
|
||||
/* B771A4 80100004 ADAF0000 */ sw $t7, ($t5)
|
||||
/* B771A8 80100008 1F20FFE4 */ bgtz $t9, .L800FFF9C
|
||||
/* B771AC 8010000C A1180000 */ sb $t8, ($t0)
|
||||
/* B771B0 80100010 330500FF */ andi $a1, $t8, 0xff
|
||||
.L80100014:
|
||||
/* B771B4 80100014 3C0D8017 */ lui $t5, %hi(D_8017566C) # $t5, 0x8017
|
||||
/* B771B8 80100018 25AD566C */ addiu $t5, %lo(D_8017566C) # addiu $t5, $t5, 0x566c
|
||||
/* B771BC 8010001C 8DAE0000 */ lw $t6, ($t5)
|
||||
/* B771C0 80100020 00077823 */ negu $t7, $a3
|
||||
/* B771C4 80100024 00A7C021 */ addu $t8, $a1, $a3
|
||||
/* B771C8 80100028 00AE1804 */ sllv $v1, $t6, $a1
|
||||
/* B771CC 8010002C 01E31806 */ srlv $v1, $v1, $t7
|
||||
/* B771D0 80100030 A1180000 */ sb $t8, ($t0)
|
||||
/* B771D4 80100034 03E00008 */ jr $ra
|
||||
/* B771D8 80100038 3062FFFF */ andi $v0, $v1, 0xffff
|
|
@ -0,0 +1,87 @@
|
|||
|
||||
glabel JpegDecoder_ParseNextSymbol
|
||||
/* B76FB4 800FFE14 27BDFFD8 */ addiu $sp, $sp, -0x28
|
||||
/* B76FB8 800FFE18 AFB00018 */ sw $s0, 0x18($sp)
|
||||
/* B76FBC 800FFE1C 00808025 */ move $s0, $a0
|
||||
/* B76FC0 800FFE20 AFBF001C */ sw $ra, 0x1c($sp)
|
||||
/* B76FC4 800FFE24 AFA5002C */ sw $a1, 0x2c($sp)
|
||||
/* B76FC8 800FFE28 AFA60030 */ sw $a2, 0x30($sp)
|
||||
/* B76FCC 800FFE2C 24040010 */ li $a0, 16
|
||||
/* B76FD0 800FFE30 0C03FFD4 */ jal JpegDecoder_ReadBits
|
||||
/* B76FD4 800FFE34 A7A00024 */ sh $zero, 0x24($sp)
|
||||
/* B76FD8 800FFE38 97A90024 */ lhu $t1, 0x24($sp)
|
||||
/* B76FDC 800FFE3C 8FAA002C */ lw $t2, 0x2c($sp)
|
||||
/* B76FE0 800FFE40 00003025 */ move $a2, $zero
|
||||
/* B76FE4 800FFE44 2408000F */ li $t0, 15
|
||||
/* B76FE8 800FFE48 3407FFFF */ li $a3, 65535
|
||||
.L800FFE4C:
|
||||
/* B76FEC 800FFE4C 00067040 */ sll $t6, $a2, 1
|
||||
/* B76FF0 800FFE50 020E7821 */ addu $t7, $s0, $t6
|
||||
/* B76FF4 800FFE54 95E40030 */ lhu $a0, 0x30($t7)
|
||||
/* B76FF8 800FFE58 0106C023 */ subu $t8, $t0, $a2
|
||||
/* B76FFC 800FFE5C 03021807 */ srav $v1, $v0, $t8
|
||||
/* B77000 800FFE60 10E40005 */ beq $a3, $a0, .L800FFE78
|
||||
/* B77004 800FFE64 00C02825 */ move $a1, $a2
|
||||
/* B77008 800FFE68 3079FFFF */ andi $t9, $v1, 0xffff
|
||||
/* B7700C 800FFE6C 0099082A */ slt $at, $a0, $t9
|
||||
/* B77010 800FFE70 10200006 */ beqz $at, .L800FFE8C
|
||||
/* B77014 800FFE74 3069FFFF */ andi $t1, $v1, 0xffff
|
||||
.L800FFE78:
|
||||
/* B77018 800FFE78 24C60001 */ addiu $a2, $a2, 1
|
||||
/* B7701C 800FFE7C 30C500FF */ andi $a1, $a2, 0xff
|
||||
/* B77020 800FFE80 28A10010 */ slti $at, $a1, 0x10
|
||||
/* B77024 800FFE84 1420FFF1 */ bnez $at, .L800FFE4C
|
||||
/* B77028 800FFE88 00A03025 */ move $a2, $a1
|
||||
.L800FFE8C:
|
||||
/* B7702C 800FFE8C 28A10010 */ slti $at, $a1, 0x10
|
||||
/* B77030 800FFE90 14200003 */ bnez $at, .L800FFEA0
|
||||
/* B77034 800FFE94 3C028017 */ lui $v0, %hi(sJpegBitStreamBitIdx) # $v0, 0x8017
|
||||
/* B77038 800FFE98 10000028 */ b .L800FFF3C
|
||||
/* B7703C 800FFE9C 24020001 */ li $v0, 1
|
||||
.L800FFEA0:
|
||||
/* B77040 800FFEA0 02066021 */ addu $t4, $s0, $a2
|
||||
/* B77044 800FFEA4 00067840 */ sll $t7, $a2, 1
|
||||
/* B77048 800FFEA8 918D0000 */ lbu $t5, ($t4)
|
||||
/* B7704C 800FFEAC 020FC021 */ addu $t8, $s0, $t7
|
||||
/* B77050 800FFEB0 97190010 */ lhu $t9, 0x10($t8)
|
||||
/* B77054 800FFEB4 8E0C0050 */ lw $t4, 0x50($s0)
|
||||
/* B77058 800FFEB8 01A97021 */ addu $t6, $t5, $t1
|
||||
/* B7705C 800FFEBC 01D95823 */ subu $t3, $t6, $t9
|
||||
/* B77060 800FFEC0 016C6821 */ addu $t5, $t3, $t4
|
||||
/* B77064 800FFEC4 91A40000 */ lbu $a0, ($t5)
|
||||
/* B77068 800FFEC8 8FB80030 */ lw $t8, 0x30($sp)
|
||||
/* B7706C 800FFECC 24425668 */ addiu $v0, %lo(sJpegBitStreamBitIdx) # addiu $v0, $v0, 0x5668
|
||||
/* B77070 800FFED0 00047903 */ sra $t7, $a0, 4
|
||||
/* B77074 800FFED4 A30F0000 */ sb $t7, ($t8)
|
||||
/* B77078 800FFED8 90590000 */ lbu $t9, ($v0)
|
||||
/* B7707C 800FFEDC 308E000F */ andi $t6, $a0, 0xf
|
||||
/* B77080 800FFEE0 01C02025 */ move $a0, $t6
|
||||
/* B77084 800FFEE4 03255821 */ addu $t3, $t9, $a1
|
||||
/* B77088 800FFEE8 256CFFF1 */ addiu $t4, $t3, -0xf
|
||||
/* B7708C 800FFEEC A04C0000 */ sb $t4, ($v0)
|
||||
/* B77090 800FFEF0 11C00011 */ beqz $t6, .L800FFF38
|
||||
/* B77094 800FFEF4 A5400000 */ sh $zero, ($t2)
|
||||
/* B77098 800FFEF8 0C03FFD4 */ jal JpegDecoder_ReadBits
|
||||
/* B7709C 800FFEFC A3AE0026 */ sb $t6, 0x26($sp)
|
||||
/* B770A0 800FFF00 8FAA002C */ lw $t2, 0x2c($sp)
|
||||
/* B770A4 800FFF04 93A40026 */ lbu $a0, 0x26($sp)
|
||||
/* B770A8 800FFF08 240F0001 */ li $t7, 1
|
||||
/* B770AC 800FFF0C A5420000 */ sh $v0, ($t2)
|
||||
/* B770B0 800FFF10 85450000 */ lh $a1, ($t2)
|
||||
/* B770B4 800FFF14 248D001F */ addiu $t5, $a0, 0x1f
|
||||
/* B770B8 800FFF18 01AFC004 */ sllv $t8, $t7, $t5
|
||||
/* B770BC 800FFF1C 00B8082A */ slt $at, $a1, $t8
|
||||
/* B770C0 800FFF20 10200005 */ beqz $at, .L800FFF38
|
||||
/* B770C4 800FFF24 240EFFFF */ li $t6, -1
|
||||
/* B770C8 800FFF28 008EC804 */ sllv $t9, $t6, $a0
|
||||
/* B770CC 800FFF2C 00B95821 */ addu $t3, $a1, $t9
|
||||
/* B770D0 800FFF30 256C0001 */ addiu $t4, $t3, 1
|
||||
/* B770D4 800FFF34 A54C0000 */ sh $t4, ($t2)
|
||||
.L800FFF38:
|
||||
/* B770D8 800FFF38 00001025 */ move $v0, $zero
|
||||
.L800FFF3C:
|
||||
/* B770DC 800FFF3C 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
/* B770E0 800FFF40 8FB00018 */ lw $s0, 0x18($sp)
|
||||
/* B770E4 800FFF44 27BD0028 */ addiu $sp, $sp, 0x28
|
||||
/* B770E8 800FFF48 03E00008 */ jr $ra
|
||||
/* B770EC 800FFF4C 00000000 */ nop
|
|
@ -387,7 +387,7 @@ glabel Jpeg_Decode
|
|||
/* AE5A80 8006E8E0 AFAC0010 */ sw $t4, 0x10($sp)
|
||||
/* AE5A84 8006E8E4 30E700FF */ andi $a3, $a3, 0xff
|
||||
/* AE5A88 8006E8E8 27A4009C */ addiu $a0, $sp, 0x9c
|
||||
/* AE5A8C 8006E8EC 0C03FE94 */ jal func_800FFA50
|
||||
/* AE5A8C 8006E8EC 0C03FE94 */ jal JpegDecoder_Decode
|
||||
/* AE5A90 8006E8F0 24060004 */ li $a2, 4
|
||||
/* AE5A94 8006E8F4 1040000B */ beqz $v0, .L8006E924
|
||||
/* AE5A98 8006E8F8 3C048014 */ lui $a0, %hi(D_8013C07C) # $a0, 0x8014
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
.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 purpose registers
|
||||
|
||||
.section .data
|
||||
|
||||
.balign 16
|
||||
|
||||
glabel D_8012D200
|
||||
.incbin "baserom.z64", 0xBA43A0, 0x7
|
||||
|
||||
glabel D_8012D207
|
||||
.incbin "baserom.z64", 0xBA43A7, 0x9
|
|
@ -1,25 +0,0 @@
|
|||
.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 purpose registers
|
||||
|
||||
.section .bss
|
||||
|
||||
.balign 16
|
||||
|
||||
glabel D_80175660
|
||||
.space 0x4
|
||||
|
||||
glabel D_80175664
|
||||
.space 0x4
|
||||
|
||||
glabel D_80175668
|
||||
.space 0x1
|
||||
|
||||
glabel D_80175669
|
||||
.space 0x3
|
||||
|
||||
glabel D_8017566C
|
||||
.space 0x4
|
|
@ -1566,7 +1566,7 @@ u32 THA_IsCrash(TwoHeadArena* tha);
|
|||
void THA_Init(TwoHeadArena* tha);
|
||||
void THA_Ct(TwoHeadArena* tha, void* ptr, u32 size);
|
||||
void THA_Dt(TwoHeadArena* tha);
|
||||
// ? func_800C3C20(?);
|
||||
void func_800C3C20(void);
|
||||
void func_800C3C80(AudioMgr* audioMgr);
|
||||
void AudioMgr_HandleRetrace(AudioMgr* audioMgr);
|
||||
void AudioMgr_HandlePRENMI(AudioMgr* audioMgr);
|
||||
|
@ -2306,7 +2306,7 @@ s8 PadUtils_GetRelYImpl(Input* input);
|
|||
s8 PadUtils_GetRelX(Input* input);
|
||||
s8 PadUtils_GetRelY(Input* input);
|
||||
void PadUtils_UpdateRelXY(Input* input);
|
||||
// ? func_800FCD40(?);
|
||||
s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status);
|
||||
f32 Math_tanf(f32 x);
|
||||
f32 Math_nearbyintf(f32 x);
|
||||
f32 Math_atanf_taylor_q(f32 x);
|
||||
|
@ -2391,17 +2391,17 @@ void Sleep_Usec(u32 usec);
|
|||
void Sleep_Msec(u32 ms);
|
||||
void Sleep_Sec(u32 sec);
|
||||
void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 count);
|
||||
s32 JpegUtils_ParseHuffmancodesLengths(u8* ptr, u8* codesLengths);
|
||||
s32 JpegUtils_ParseHuffmanCodesLengths(u8* ptr, u8* codesLengths);
|
||||
s32 JpegUtils_GetHuffmanCodes(u8* codesLengths, u16* codes);
|
||||
s32 JpegUtils_SetHuffmanTable(u8* data, JpegHuffmanTable* ht, u16* codes);
|
||||
u32 JpegUtils_ProcessHuffmanTableImpl(u8* data, JpegHuffmanTable* ht, u8* codesLengths, u16* codes, u8 isAc);
|
||||
u32 JpegUtils_ProcessHuffmanTable(u8* dht, JpegHuffmanTable* ht, u8* codesLengths, u16* codes, u8 count);
|
||||
void JpegUtils_SetHuffmanTableOld(u8* data, JpegHuffmanTableOld* ht, u8* codesLengths, u16* codes, s16 count, u8 isAc);
|
||||
u32 JpegUtils_ProcessHuffmanTableImplOld(u8* dht, JpegHuffmanTableOld* ht, u8* codesLengths, u16* codes);
|
||||
u32 func_800FFA50(JpegDecoder* decoder, u16*, u32, u8, u32*);
|
||||
// ? func_800FFC78(?);
|
||||
// ? func_800FFE14(?);
|
||||
// ? func_800FFF50(?);
|
||||
s32 JpegDecoder_Decode(JpegDecoder* decoder, u16* mcuBuff, s32 count, u8 isFollowing, JpegDecoderState* state);
|
||||
s32 JpegDecoder_ProcessMcu(JpegHuffmanTable* hTable0, JpegHuffmanTable* hTable1, s16* mcu, s16* unk);
|
||||
s32 JpegDecoder_ParseNextSymbol(JpegHuffmanTable* hTable, s16* outCoeff, u8* outZeroCount);
|
||||
u16 JpegDecoder_ReadBits(u8 len);
|
||||
s32 osPfsFreeBlocks(OSPfs* pfs, s32 *bytes_not_used);
|
||||
void guScale(Mtx* m, f32 x, f32 y, f32 z);
|
||||
f32 sinf(f32);
|
||||
|
|
|
@ -3723,11 +3723,6 @@ extern NotePool gNoteFreeLists;
|
|||
//extern ? D_801755D0;
|
||||
extern u32 __osMalloc_FreeBlockTest_Enable;
|
||||
//extern ? D_80175640;
|
||||
//extern ? D_80175660;
|
||||
//extern ? D_80175664;
|
||||
//extern ? D_80175668;
|
||||
//extern ? D_80175669;
|
||||
//extern ? D_8017566C;
|
||||
//extern ? D_80175670;
|
||||
//extern ? D_80175680;
|
||||
//extern ? D_80175688;
|
||||
|
|
|
@ -1841,17 +1841,21 @@ typedef struct {
|
|||
} JpegHuffmanTableOld; // size = 0x300
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 unk_00;
|
||||
/* 0x04 */ u32 unk_04;
|
||||
/* 0x08 */ u32 unk_08;
|
||||
/* 0x0C */ u32 qTablePtrs[3];
|
||||
/* 0x00 */ u32 address;
|
||||
/* 0x04 */ u32 mbCount;
|
||||
/* 0x08 */ u32 mode;
|
||||
/* 0x0C */ u32 qTableYPtr;
|
||||
/* 0x10 */ u32 qTableUPtr;
|
||||
/* 0x14 */ u32 qTableVPtr;
|
||||
/* 0x18 */ char unk_18[0x8];
|
||||
} JpegTaskData; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ JpegTaskData taskData;
|
||||
/* 0x020 */ char yieldData[0x200];
|
||||
/* 0x220 */ JpegQuantizationTable qTables[3];
|
||||
/* 0x220 */ JpegQuantizationTable qTableY;
|
||||
/* 0x2A0 */ JpegQuantizationTable qTableU;
|
||||
/* 0x320 */ JpegQuantizationTable qTableV;
|
||||
/* 0x3A0 */ u8 codesLengths[0x110];
|
||||
/* 0x4B0 */ u16 codes[0x108];
|
||||
/* 0x6C0 */ u16 unk_6C0[4][0x180];
|
||||
|
@ -1859,7 +1863,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* imageData;
|
||||
/* 0x04 */ u8 unk_04;
|
||||
/* 0x04 */ u8 mode;
|
||||
/* 0x05 */ u8 unk_05;
|
||||
/* 0x08 */ JpegHuffmanTable* hTablePtrs[4];
|
||||
/* 0x18 */ u8 unk_18;
|
||||
|
@ -1871,7 +1875,7 @@ typedef struct {
|
|||
/* 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
|
||||
/* 0x28 */ u32 mode; // 0 if Y V0 is 1 and 2 if Y V0 is 2
|
||||
/* 0x2C */ char unk_2C[4];
|
||||
/* 0x30 */ OSScTask scTask;
|
||||
/* 0x88 */ char unk_88[0x10];
|
||||
|
@ -1880,6 +1884,15 @@ typedef struct {
|
|||
/* 0xB4 */ JpegWork* workBuf;
|
||||
} JpegContext; // size = 0xB8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 byteIdx;
|
||||
/* 0x04 */ u8 bitIdx;
|
||||
/* 0x05 */ u8 dontSkip;
|
||||
/* 0x08 */ u32 curWord;
|
||||
/* 0x0C */ s16 unk_0C;
|
||||
/* 0x0E */ s16 unk_0E;
|
||||
/* 0x10 */ s16 unk_10;
|
||||
} JpegDecoderState; // size = 0x14
|
||||
|
||||
// Vis...
|
||||
typedef struct {
|
||||
|
|
8
spec
8
spec
|
@ -384,8 +384,7 @@ beginseg
|
|||
include "build/asm/PreRender.o"
|
||||
include "build/data/PreRender.rodata.o"
|
||||
include "build/src/code/TwoHeadArena.o"
|
||||
include "build/asm/code_800C3C20.o"
|
||||
include "build/data/code_800C3C20.data.o"
|
||||
include "build/src/code/code_800C3C20.o"
|
||||
include "build/src/code/audioMgr.o"
|
||||
include "build/src/code/title_setup.o"
|
||||
include "build/src/code/game.o"
|
||||
|
@ -447,7 +446,7 @@ beginseg
|
|||
include "build/src/code/relocation.o"
|
||||
include "build/src/code/code_800FC620.o"
|
||||
include "build/src/code/padutils.o"
|
||||
include "build/asm/code_800FCD40.o"
|
||||
include "build/src/code/padsetup.o"
|
||||
include "build/src/code/code_800FCE80.o"
|
||||
include "build/asm/fp.o"
|
||||
include "build/src/code/system_malloc.o"
|
||||
|
@ -456,8 +455,7 @@ beginseg
|
|||
include "build/src/code/printutils.o"
|
||||
include "build/src/code/sleep.o"
|
||||
include "build/src/code/jpegutils.o"
|
||||
include "build/asm/jpegdecoder.o"
|
||||
include "build/data/jpegdecoder.bss.o"
|
||||
include "build/src/code/jpegdecoder.o"
|
||||
include "build/asm/code_80100040.o"
|
||||
include "build/asm/guScale.o"
|
||||
include "build/src/libultra_code/sinf.o"
|
||||
|
|
13
src/code/code_800C3C20.c
Normal file
13
src/code/code_800C3C20.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include <global.h>
|
||||
|
||||
u8 D_8012D200[] = {
|
||||
0, 1, 2, 3, 4, 5, 6,
|
||||
};
|
||||
|
||||
void func_800C3C20(void) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_8012D200) & 0xFFFFFFFFu; i++) {
|
||||
func_800F87A0(D_8012D200[i]);
|
||||
}
|
||||
}
|
201
src/code/jpegdecoder.c
Normal file
201
src/code/jpegdecoder.c
Normal file
|
@ -0,0 +1,201 @@
|
|||
#include <global.h>
|
||||
|
||||
u8* sJpegBitStreamPtr;
|
||||
u32 sJpegBitStreamByteIdx;
|
||||
u8 sJpegBitStreamBitIdx;
|
||||
u8 sJpegBitStreamDontSkip;
|
||||
u32 sJpegBitStreamCurWord;
|
||||
|
||||
s32 JpegDecoder_Decode(JpegDecoder* decoder, u16* mcuBuff, s32 count, u8 isFollowing, JpegDecoderState* state) {
|
||||
s16 pad;
|
||||
s16 unk0;
|
||||
s16 unk1;
|
||||
s16 unk2;
|
||||
u32 idx;
|
||||
s32 inc;
|
||||
s16 unkCount;
|
||||
|
||||
JpegHuffmanTable* hTable0;
|
||||
JpegHuffmanTable* hTable1;
|
||||
JpegHuffmanTable* hTable2;
|
||||
JpegHuffmanTable* hTable3;
|
||||
|
||||
inc = 0;
|
||||
sJpegBitStreamPtr = decoder->imageData;
|
||||
if (decoder->mode == 0) {
|
||||
unkCount = 2;
|
||||
} else {
|
||||
unkCount = 4;
|
||||
if (decoder->unk_05 == 1) {
|
||||
inc = 8 * 8 * 2;
|
||||
}
|
||||
}
|
||||
|
||||
hTable0 = decoder->hTablePtrs[0];
|
||||
hTable1 = decoder->hTablePtrs[1];
|
||||
hTable2 = decoder->hTablePtrs[2];
|
||||
hTable3 = decoder->hTablePtrs[3];
|
||||
|
||||
if (!isFollowing) {
|
||||
sJpegBitStreamByteIdx = 0;
|
||||
sJpegBitStreamBitIdx = 32;
|
||||
sJpegBitStreamCurWord = 0;
|
||||
sJpegBitStreamDontSkip = 0;
|
||||
unk0 = 0;
|
||||
unk1 = 0;
|
||||
unk2 = 0;
|
||||
} else {
|
||||
sJpegBitStreamByteIdx = state->byteIdx;
|
||||
sJpegBitStreamBitIdx = state->bitIdx;
|
||||
sJpegBitStreamCurWord = state->curWord;
|
||||
sJpegBitStreamDontSkip = state->dontSkip;
|
||||
unk0 = state->unk_0C;
|
||||
unk1 = state->unk_0E;
|
||||
unk2 = state->unk_10;
|
||||
}
|
||||
|
||||
while (count != 0) {
|
||||
for (idx = 0; idx < unkCount; idx++) {
|
||||
if (JpegDecoder_ProcessMcu(hTable0, hTable1, mcuBuff, &unk0)) {
|
||||
return 2;
|
||||
}
|
||||
mcuBuff += 8 * 8;
|
||||
}
|
||||
|
||||
if (JpegDecoder_ProcessMcu(hTable2, hTable3, mcuBuff, &unk1)) {
|
||||
return 2;
|
||||
}
|
||||
mcuBuff += 8 * 8;
|
||||
|
||||
if (JpegDecoder_ProcessMcu(hTable2, hTable3, mcuBuff, &unk2)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
count--;
|
||||
mcuBuff += 8 * 8;
|
||||
mcuBuff += inc;
|
||||
}
|
||||
|
||||
state->byteIdx = sJpegBitStreamByteIdx;
|
||||
state->bitIdx = sJpegBitStreamBitIdx;
|
||||
state->curWord = sJpegBitStreamCurWord;
|
||||
state->dontSkip = sJpegBitStreamDontSkip;
|
||||
state->unk_0C = unk0;
|
||||
state->unk_0E = unk1;
|
||||
state->unk_10 = unk2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 JpegDecoder_ProcessMcu(JpegHuffmanTable* hTable0, JpegHuffmanTable* hTable1, s16* mcu, s16* unk) {
|
||||
s8 i = 0;
|
||||
s8 zeroCount;
|
||||
s16 coeff;
|
||||
|
||||
if (JpegDecoder_ParseNextSymbol(hTable0, &coeff, &zeroCount)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
*unk += coeff;
|
||||
mcu[i++] = *unk;
|
||||
while (i < 8 * 8) {
|
||||
if (JpegDecoder_ParseNextSymbol(hTable1, &coeff, &zeroCount) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (coeff == 0) {
|
||||
if (zeroCount == 0xF) {
|
||||
while (zeroCount-- >= 0) {
|
||||
mcu[i++] = 0;
|
||||
}
|
||||
} else {
|
||||
while (i < 8 * 8) {
|
||||
mcu[i++] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
while (0 < zeroCount--) {
|
||||
mcu[i++] = 0;
|
||||
}
|
||||
mcu[i++] = coeff;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// stack usage (coeffLength is stored as a u32 instead of a u8)
|
||||
s32 JpegDecoder_ParseNextSymbol(JpegHuffmanTable* hTable, s16* outCoeff, u8* outZeroCount) {
|
||||
u16 buff;
|
||||
u8 codeIdx;
|
||||
u8 sym;
|
||||
u8 coeffLength; // 0x26
|
||||
u16 codeOff; // 0x24
|
||||
|
||||
codeOff = 0;
|
||||
buff = JpegDecoder_ReadBits(16);
|
||||
|
||||
for (codeIdx = 0; codeIdx < 16; codeIdx++) {
|
||||
if (hTable->codesB[codeIdx] == 0xFFFF) {
|
||||
continue;
|
||||
}
|
||||
|
||||
codeOff = buff >> (15 - codeIdx);
|
||||
if (codeOff <= hTable->codesB[codeIdx]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (codeIdx >= 16) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
sym = hTable->symbols[hTable->codeOffs[codeIdx] + codeOff - hTable->codesA[codeIdx]];
|
||||
*outZeroCount = sym >> 4;
|
||||
coeffLength = sym & 0xF; // not using a temp for "sym & 0xF" puts coeffLength on the stack
|
||||
|
||||
sJpegBitStreamBitIdx += codeIdx - 15;
|
||||
*outCoeff = 0;
|
||||
if (coeffLength) { // (cond != 0) instead of (cond) puts coeffLength on the stack
|
||||
*outCoeff = JpegDecoder_ReadBits(coeffLength);
|
||||
if (*outCoeff < (1 << (coeffLength - 1))) {
|
||||
*outCoeff +=
|
||||
(-1 << coeffLength) + 1; // (*outCoeff -= (1 << coeffLength)-1; makes more sense but doesn't match)
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/jpegdecoder/JpegDecoder_ParseNextSymbol.s")
|
||||
#endif
|
||||
|
||||
u16 JpegDecoder_ReadBits(u8 len) {
|
||||
u8 byteCount;
|
||||
u8 data;
|
||||
s32 ret;
|
||||
u32 temp;
|
||||
ret = 0; // this is required for some reason
|
||||
|
||||
for (byteCount = sJpegBitStreamBitIdx >> 3; byteCount > 0; byteCount--) {
|
||||
data = sJpegBitStreamPtr[sJpegBitStreamByteIdx++];
|
||||
if (sJpegBitStreamDontSkip) {
|
||||
if (data == 0) {
|
||||
data = sJpegBitStreamPtr[sJpegBitStreamByteIdx++];
|
||||
}
|
||||
}
|
||||
|
||||
sJpegBitStreamDontSkip = (data == 0xFF) ? 1 : 0;
|
||||
|
||||
sJpegBitStreamCurWord <<= 8;
|
||||
sJpegBitStreamCurWord |= data;
|
||||
sJpegBitStreamBitIdx -= 8;
|
||||
}
|
||||
|
||||
ret = (sJpegBitStreamCurWord << (sJpegBitStreamBitIdx));
|
||||
temp = ret;
|
||||
ret = temp >> -len;
|
||||
sJpegBitStreamBitIdx += len;
|
||||
return ret;
|
||||
}
|
|
@ -12,7 +12,7 @@ void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 c
|
|||
}
|
||||
}
|
||||
|
||||
s32 JpegUtils_ParseHuffmancodesLengths(u8* ptr, u8* codesLengths) {
|
||||
s32 JpegUtils_ParseHuffmanCodesLengths(u8* ptr, u8* codesLengths) {
|
||||
u8 off = 1;
|
||||
s16 count = 0;
|
||||
s16 idx = 1;
|
||||
|
@ -84,7 +84,7 @@ u32 JpegUtils_ProcessHuffmanTableImpl(u8* data, JpegHuffmanTable* ht, u8* codesL
|
|||
s32 count;
|
||||
s32 temp;
|
||||
|
||||
count = JpegUtils_ParseHuffmancodesLengths(data, codesLengths);
|
||||
count = JpegUtils_ParseHuffmanCodesLengths(data, codesLengths);
|
||||
ret = count;
|
||||
if (count == 0 || (isAc && count > 0x100) || (!isAc && count > 0x10)) {
|
||||
return 0;
|
||||
|
@ -139,7 +139,7 @@ u32 JpegUtils_ProcessHuffmanTableImplOld(u8* dht, JpegHuffmanTableOld* ht, u8* c
|
|||
|
||||
isAc = *dht++ >> 4;
|
||||
|
||||
count2 = count = JpegUtils_ParseHuffmancodesLengths(dht, codesLengths);
|
||||
count2 = count = JpegUtils_ParseHuffmanCodesLengths(dht, codesLengths);
|
||||
|
||||
if (count == 0 || (isAc && count > 0x100) || (!isAc && count > 0x10)) {
|
||||
return 1;
|
||||
|
|
|
@ -412,7 +412,7 @@ void PadMgr_Init(PadMgr* padmgr, OSMesgQueue* siIntMsgQ, IrqMgr* irqMgr, OSId id
|
|||
PadMgr_UnlockSerialMesgQueue(padmgr, siIntMsgQ);
|
||||
osCreateMesgQueue(&padmgr->lockMsgQ, padmgr->lockMsgBuf, 1);
|
||||
PadMgr_UnlockPadData(padmgr);
|
||||
func_800FCD40(siIntMsgQ, &padmgr->validCtrlrsMask, padmgr);
|
||||
PadSetup_Init(siIntMsgQ, &padmgr->validCtrlrsMask, padmgr->padStatus);
|
||||
|
||||
padmgr->ncontrollers = 4;
|
||||
osContSetCh(padmgr->ncontrollers);
|
||||
|
|
33
src/code/padsetup.c
Normal file
33
src/code/padsetup.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <global.h>
|
||||
|
||||
s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status) {
|
||||
s32 ret;
|
||||
s32 i;
|
||||
|
||||
*outMask = 0xFF;
|
||||
ret = osContInit(mq, outMask, status);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
if (*outMask == 0xFF) {
|
||||
if (osContStartQuery(mq) != 0) {
|
||||
return 1;
|
||||
}
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
osContGetQuery(status);
|
||||
|
||||
*outMask = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
switch (status[i].errno) {
|
||||
case 0:
|
||||
if (status[i].type == CONT_TYPE_NORMAL) {
|
||||
*outMask |= 1 << i;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -39,12 +39,12 @@ u32 Jpeg_SendTask(JpegContext* ctx) {
|
|||
JpegWork* workBuf = ctx->workBuf;
|
||||
u32 pad[2];
|
||||
|
||||
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]);
|
||||
workBuf->taskData.address = PHYSICAL_TO_VIRTUAL(&workBuf->unk_6C0);
|
||||
workBuf->taskData.mode = ctx->mode;
|
||||
workBuf->taskData.mbCount = 4;
|
||||
workBuf->taskData.qTableYPtr = PHYSICAL_TO_VIRTUAL(&workBuf->qTableY);
|
||||
workBuf->taskData.qTableUPtr = PHYSICAL_TO_VIRTUAL(&workBuf->qTableU);
|
||||
workBuf->taskData.qTableVPtr = PHYSICAL_TO_VIRTUAL(&workBuf->qTableV);
|
||||
|
||||
sJpegTask.flags = 0;
|
||||
sJpegTask.ucode_boot = SysUcode_GetUCodeBoot();
|
||||
|
@ -97,7 +97,7 @@ 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
|
||||
return *(u16*)(ptr - 1) << 8 | (*(u16*)(ptr + 1) >> 8); // lhu crashes with unaligned addresses
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,10 +174,10 @@ void Jpeg_ParseMarkers(u8* ptr, JpegContext* ctx) {
|
|||
|
||||
if (ptr[9] == 0x21) // component Y : V0 == 1
|
||||
{
|
||||
ctx->unk_28 = 0;
|
||||
ctx->mode = 0;
|
||||
} else if (ptr[9] == 0x22) // component Y : V0 == 2
|
||||
{
|
||||
ctx->unk_28 = 2;
|
||||
ctx->mode = 2;
|
||||
}
|
||||
ptr += Jpeg_GetU16(ptr);
|
||||
break;
|
||||
|
@ -215,7 +215,7 @@ s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize) {
|
|||
JpegContext ctx; // 0x208
|
||||
JpegHuffmanTable hTables[4]; // 0xB8
|
||||
JpegDecoder decoder; // 0x9C
|
||||
u32 unk[5]; // 0x88
|
||||
JpegDecoderState state; // 0x88
|
||||
u16(*src)[0x180];
|
||||
OSTime diff; // 0x78
|
||||
OSTime time; // 0x70
|
||||
|
@ -248,19 +248,19 @@ s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize) {
|
|||
|
||||
switch (ctx.dqtCount) {
|
||||
case 1: {
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTables[0], 3);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTableY, 3);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTables[0], 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTables[1], 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTables[2], 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTableY, 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTableU, 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTableV, 1);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTables[0], 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTables[1], 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[2], &workBuff->qTables[2], 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTableY, 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTableU, 1);
|
||||
JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[2], &workBuff->qTableV, 1);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -318,12 +318,12 @@ s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize) {
|
|||
if (1) {}
|
||||
decoder.unk_18 = 0;
|
||||
decoder.imageData = ctx.imageData;
|
||||
decoder.unk_04 = ctx.unk_28;
|
||||
decoder.mode = ctx.mode;
|
||||
|
||||
y = 0;
|
||||
x = 0;
|
||||
for (i = 0; i < 300; i += 4) {
|
||||
if (func_800FFA50(&decoder, &workBuff->unk_6C0, 4, i != 0, unk)) {
|
||||
if (JpegDecoder_Decode(&decoder, &workBuff->unk_6C0, 4, i != 0, &state)) {
|
||||
osSyncPrintf(VT_FGCOL(RED));
|
||||
osSyncPrintf("Error : Can't decode jpeg\n");
|
||||
osSyncPrintf(VT_RST);
|
||||
|
|
Loading…
Reference in a new issue