1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00

Decompile jpegutils.c (#75)

* Decompile jpegutils.c

jpegutils.c : OK

* Fix a typo

* Fixes in PR #75

- Fix a type in JpegWork
- Remove clang-format off/on in z_quake.c
- Move the jpegutils rule at the end of makefile
This commit is contained in:
Random 2020-04-16 20:08:23 +02:00 committed by GitHub
parent 045a92d7c3
commit 9ac1f8130d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 210 additions and 418 deletions

View file

@ -1,381 +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 purposee registers
.section .text
.align 4
glabel func_800FF540
/* B766E0 800FF540 30C300FF */ andi $v1, $a2, 0xff
/* B766E4 800FF544 00A03825 */ move $a3, $a1
/* B766E8 800FF548 AFA60008 */ sw $a2, 8($sp)
/* B766EC 800FF54C 18600014 */ blez $v1, .L800FF5A0
/* B766F0 800FF550 00001025 */ move $v0, $zero
.L800FF554:
/* B766F4 800FF554 000279C0 */ sll $t7, $v0, 7
/* B766F8 800FF558 24840001 */ addiu $a0, $a0, 1
/* B766FC 800FF55C 00EF3021 */ addu $a2, $a3, $t7
/* B76700 800FF560 00002825 */ move $a1, $zero
.L800FF564:
/* B76704 800FF564 0005C840 */ sll $t9, $a1, 1
/* B76708 800FF568 24A50001 */ addiu $a1, $a1, 1
/* B7670C 800FF56C 90980000 */ lbu $t8, ($a0)
/* B76710 800FF570 30A900FF */ andi $t1, $a1, 0xff
/* B76714 800FF574 29210040 */ slti $at, $t1, 0x40
/* B76718 800FF578 00D94021 */ addu $t0, $a2, $t9
/* B7671C 800FF57C 01202825 */ move $a1, $t1
/* B76720 800FF580 24840001 */ addiu $a0, $a0, 1
/* B76724 800FF584 1420FFF7 */ bnez $at, .L800FF564
/* B76728 800FF588 A5180000 */ sh $t8, ($t0)
/* B7672C 800FF58C 24420001 */ addiu $v0, $v0, 1
/* B76730 800FF590 304A00FF */ andi $t2, $v0, 0xff
/* B76734 800FF594 0143082A */ slt $at, $t2, $v1
/* B76738 800FF598 1420FFEE */ bnez $at, .L800FF554
/* B7673C 800FF59C 01401025 */ move $v0, $t2
.L800FF5A0:
/* B76740 800FF5A0 03E00008 */ jr $ra
/* B76744 800FF5A4 00000000 */ nop
glabel func_800FF5A8
/* B76748 800FF5A8 27BDFFF8 */ addiu $sp, $sp, -8
/* B7674C 800FF5AC AFB00004 */ sw $s0, 4($sp)
/* B76750 800FF5B0 00A08025 */ move $s0, $a1
/* B76754 800FF5B4 24020001 */ li $v0, 1
/* B76758 800FF5B8 00001825 */ move $v1, $zero
/* B7675C 800FF5BC 24060001 */ li $a2, 1
/* B76760 800FF5C0 24070001 */ li $a3, 1
.L800FF5C4:
/* B76764 800FF5C4 00E42821 */ addu $a1, $a3, $a0
/* B76768 800FF5C8 90AEFFFF */ lbu $t6, -1($a1)
/* B7676C 800FF5CC 19C0000C */ blez $t6, .L800FF600
.L800FF5D0:
/* B76770 800FF5D0 02037821 */ addu $t7, $s0, $v1
/* B76774 800FF5D4 A1E20000 */ sb $v0, ($t7)
/* B76778 800FF5D8 90AAFFFF */ lbu $t2, -1($a1)
/* B7677C 800FF5DC 24C60001 */ addiu $a2, $a2, 1
/* B76780 800FF5E0 00064400 */ sll $t0, $a2, 0x10
/* B76784 800FF5E4 24630001 */ addiu $v1, $v1, 1
/* B76788 800FF5E8 00083403 */ sra $a2, $t0, 0x10
/* B7678C 800FF5EC 0003C400 */ sll $t8, $v1, 0x10
/* B76790 800FF5F0 0146082A */ slt $at, $t2, $a2
/* B76794 800FF5F4 1020FFF6 */ beqz $at, .L800FF5D0
/* B76798 800FF5F8 00181C03 */ sra $v1, $t8, 0x10
/* B7679C 800FF5FC 24060001 */ li $a2, 1
.L800FF600:
/* B767A0 800FF600 24420001 */ addiu $v0, $v0, 1
/* B767A4 800FF604 304700FF */ andi $a3, $v0, 0xff
/* B767A8 800FF608 28E10011 */ slti $at, $a3, 0x11
/* B767AC 800FF60C 1420FFED */ bnez $at, .L800FF5C4
/* B767B0 800FF610 00E01025 */ move $v0, $a3
/* B767B4 800FF614 02036021 */ addu $t4, $s0, $v1
/* B767B8 800FF618 A1800000 */ sb $zero, ($t4)
/* B767BC 800FF61C 8FB00004 */ lw $s0, 4($sp)
/* B767C0 800FF620 27BD0008 */ addiu $sp, $sp, 8
/* B767C4 800FF624 03E00008 */ jr $ra
/* B767C8 800FF628 00601025 */ move $v0, $v1
glabel func_800FF62C
/* B767CC 800FF62C 90860000 */ lbu $a2, ($a0)
/* B767D0 800FF630 00001825 */ move $v1, $zero
/* B767D4 800FF634 00001025 */ move $v0, $zero
/* B767D8 800FF638 00C03825 */ move $a3, $a2
.L800FF63C:
/* B767DC 800FF63C 00037040 */ sll $t6, $v1, 1
.L800FF640:
/* B767E0 800FF640 24630001 */ addiu $v1, $v1, 1
/* B767E4 800FF644 0003C400 */ sll $t8, $v1, 0x10
/* B767E8 800FF648 00181C03 */ sra $v1, $t8, 0x10
/* B767EC 800FF64C 00AE7821 */ addu $t7, $a1, $t6
/* B767F0 800FF650 A5E20000 */ sh $v0, ($t7)
/* B767F4 800FF654 00645021 */ addu $t2, $v1, $a0
/* B767F8 800FF658 91480000 */ lbu $t0, ($t2)
/* B767FC 800FF65C 24420001 */ addiu $v0, $v0, 1
/* B76800 800FF660 3049FFFF */ andi $t1, $v0, 0xffff
/* B76804 800FF664 10E8FFF5 */ beq $a3, $t0, .L800FF63C
/* B76808 800FF668 01201025 */ move $v0, $t1
/* B7680C 800FF66C 11000008 */ beqz $t0, .L800FF690
.L800FF670:
/* B76810 800FF670 24C60001 */ addiu $a2, $a2, 1
/* B76814 800FF674 30C700FF */ andi $a3, $a2, 0xff
/* B76818 800FF678 00025840 */ sll $t3, $v0, 1
/* B7681C 800FF67C 3162FFFF */ andi $v0, $t3, 0xffff
/* B76820 800FF680 1507FFFB */ bne $t0, $a3, .L800FF670
/* B76824 800FF684 00E03025 */ move $a2, $a3
/* B76828 800FF688 1000FFED */ b .L800FF640
/* B7682C 800FF68C 00037040 */ sll $t6, $v1, 1
.L800FF690:
/* B76830 800FF690 03E00008 */ jr $ra
/* B76834 800FF694 00601025 */ move $v0, $v1
glabel func_800FF698
/* B76838 800FF698 27BDFFF8 */ addiu $sp, $sp, -8
/* B7683C 800FF69C AFB00004 */ sw $s0, 4($sp)
/* B76840 800FF6A0 00C08025 */ move $s0, $a2
/* B76844 800FF6A4 00A03825 */ move $a3, $a1
/* B76848 800FF6A8 00001825 */ move $v1, $zero
/* B7684C 800FF6AC 00001025 */ move $v0, $zero
/* B76850 800FF6B0 3408FFFF */ li $t0, 65535
.L800FF6B4:
/* B76854 800FF6B4 00442821 */ addu $a1, $v0, $a0
/* B76858 800FF6B8 90AE0000 */ lbu $t6, ($a1)
/* B7685C 800FF6BC 0002C840 */ sll $t9, $v0, 1
/* B76860 800FF6C0 00E27821 */ addu $t7, $a3, $v0
/* B76864 800FF6C4 11C00014 */ beqz $t6, .L800FF718
/* B76868 800FF6C8 00F94821 */ addu $t1, $a3, $t9
/* B7686C 800FF6CC 0003C840 */ sll $t9, $v1, 1
/* B76870 800FF6D0 A1E30000 */ sb $v1, ($t7)
/* B76874 800FF6D4 02194821 */ addu $t1, $s0, $t9
/* B76878 800FF6D8 952A0000 */ lhu $t2, ($t1)
/* B7687C 800FF6DC 0002C040 */ sll $t8, $v0, 1
/* B76880 800FF6E0 00F83021 */ addu $a2, $a3, $t8
/* B76884 800FF6E4 A4CA0010 */ sh $t2, 0x10($a2)
/* B76888 800FF6E8 90AB0000 */ lbu $t3, ($a1)
/* B7688C 800FF6EC 006B1821 */ addu $v1, $v1, $t3
/* B76890 800FF6F0 2463FFFF */ addiu $v1, $v1, -1
/* B76894 800FF6F4 306CFFFF */ andi $t4, $v1, 0xffff
/* B76898 800FF6F8 000C6840 */ sll $t5, $t4, 1
/* B7689C 800FF6FC 020D7021 */ addu $t6, $s0, $t5
/* B768A0 800FF700 95CF0000 */ lhu $t7, ($t6)
/* B768A4 800FF704 25830001 */ addiu $v1, $t4, 1
/* B768A8 800FF708 3078FFFF */ andi $t8, $v1, 0xffff
/* B768AC 800FF70C 03001825 */ move $v1, $t8
/* B768B0 800FF710 10000002 */ b .L800FF71C
/* B768B4 800FF714 A4CF0030 */ sh $t7, 0x30($a2)
.L800FF718:
/* B768B8 800FF718 A5280030 */ sh $t0, 0x30($t1)
.L800FF71C:
/* B768BC 800FF71C 24420001 */ addiu $v0, $v0, 1
/* B768C0 800FF720 304A00FF */ andi $t2, $v0, 0xff
/* B768C4 800FF724 29410010 */ slti $at, $t2, 0x10
/* B768C8 800FF728 1420FFE2 */ bnez $at, .L800FF6B4
/* B768CC 800FF72C 01401025 */ move $v0, $t2
/* B768D0 800FF730 8FB00004 */ lw $s0, 4($sp)
/* B768D4 800FF734 27BD0008 */ addiu $sp, $sp, 8
/* B768D8 800FF738 03E00008 */ jr $ra
/* B768DC 800FF73C 00601025 */ move $v0, $v1
glabel func_800FF740
/* B768E0 800FF740 27BDFFE0 */ addiu $sp, $sp, -0x20
/* B768E4 800FF744 AFBF0014 */ sw $ra, 0x14($sp)
/* B768E8 800FF748 AFA50024 */ sw $a1, 0x24($sp)
/* B768EC 800FF74C AFA40020 */ sw $a0, 0x20($sp)
/* B768F0 800FF750 AFA60028 */ sw $a2, 0x28($sp)
/* B768F4 800FF754 AFA7002C */ sw $a3, 0x2c($sp)
/* B768F8 800FF758 0C03FD6A */ jal func_800FF5A8
/* B768FC 800FF75C 00C02825 */ move $a1, $a2
/* B76900 800FF760 00021C00 */ sll $v1, $v0, 0x10
/* B76904 800FF764 00037403 */ sra $t6, $v1, 0x10
/* B76908 800FF768 1040000B */ beqz $v0, .L800FF798
/* B7690C 800FF76C 01C01825 */ move $v1, $t6
/* B76910 800FF770 93A40033 */ lbu $a0, 0x33($sp)
/* B76914 800FF774 28410101 */ slti $at, $v0, 0x101
/* B76918 800FF778 10800003 */ beqz $a0, .L800FF788
/* B7691C 800FF77C 00000000 */ nop
/* B76920 800FF780 10200005 */ beqz $at, .L800FF798
/* B76924 800FF784 00000000 */ nop
.L800FF788:
/* B76928 800FF788 14800005 */ bnez $a0, .L800FF7A0
/* B7692C 800FF78C 28410011 */ slti $at, $v0, 0x11
/* B76930 800FF790 54200004 */ bnezl $at, .L800FF7A4
/* B76934 800FF794 8FA40028 */ lw $a0, 0x28($sp)
.L800FF798:
/* B76938 800FF798 10000014 */ b .L800FF7EC
/* B7693C 800FF79C 00001025 */ move $v0, $zero
.L800FF7A0:
/* B76940 800FF7A0 8FA40028 */ lw $a0, 0x28($sp)
.L800FF7A4:
/* B76944 800FF7A4 8FA5002C */ lw $a1, 0x2c($sp)
/* B76948 800FF7A8 0C03FD8B */ jal func_800FF62C
/* B7694C 800FF7AC A7A3001E */ sh $v1, 0x1e($sp)
/* B76950 800FF7B0 87A3001E */ lh $v1, 0x1e($sp)
/* B76954 800FF7B4 8FA40020 */ lw $a0, 0x20($sp)
/* B76958 800FF7B8 8FA50024 */ lw $a1, 0x24($sp)
/* B7695C 800FF7BC 10430003 */ beq $v0, $v1, .L800FF7CC
/* B76960 800FF7C0 8FA6002C */ lw $a2, 0x2c($sp)
/* B76964 800FF7C4 10000009 */ b .L800FF7EC
/* B76968 800FF7C8 00001025 */ move $v0, $zero
.L800FF7CC:
/* B7696C 800FF7CC 0C03FDA6 */ jal func_800FF698
/* B76970 800FF7D0 A7A3001E */ sh $v1, 0x1e($sp)
/* B76974 800FF7D4 87A3001E */ lh $v1, 0x1e($sp)
/* B76978 800FF7D8 50620004 */ beql $v1, $v0, .L800FF7EC
/* B7697C 800FF7DC 00601025 */ move $v0, $v1
/* B76980 800FF7E0 10000002 */ b .L800FF7EC
/* B76984 800FF7E4 00001025 */ move $v0, $zero
/* B76988 800FF7E8 00601025 */ move $v0, $v1
.L800FF7EC:
/* B7698C 800FF7EC 8FBF0014 */ lw $ra, 0x14($sp)
/* B76990 800FF7F0 27BD0020 */ addiu $sp, $sp, 0x20
/* B76994 800FF7F4 03E00008 */ jr $ra
/* B76998 800FF7F8 00000000 */ nop
glabel func_800FF7FC
/* B7699C 800FF7FC 27BDFFC0 */ addiu $sp, $sp, -0x40
/* B769A0 800FF800 AFB4002C */ sw $s4, 0x2c($sp)
/* B769A4 800FF804 93B40053 */ lbu $s4, 0x53($sp)
/* B769A8 800FF808 AFB60034 */ sw $s6, 0x34($sp)
/* B769AC 800FF80C AFB50030 */ sw $s5, 0x30($sp)
/* B769B0 800FF810 AFB30028 */ sw $s3, 0x28($sp)
/* B769B4 800FF814 AFB10020 */ sw $s1, 0x20($sp)
/* B769B8 800FF818 AFB0001C */ sw $s0, 0x1c($sp)
/* B769BC 800FF81C 00808025 */ move $s0, $a0
/* B769C0 800FF820 00A09825 */ move $s3, $a1
/* B769C4 800FF824 00C0A825 */ move $s5, $a2
/* B769C8 800FF828 00E0B025 */ move $s6, $a3
/* B769CC 800FF82C AFBF003C */ sw $ra, 0x3c($sp)
/* B769D0 800FF830 AFB70038 */ sw $s7, 0x38($sp)
/* B769D4 800FF834 AFB20024 */ sw $s2, 0x24($sp)
/* B769D8 800FF838 1A80001A */ blez $s4, .L800FF8A4
/* B769DC 800FF83C 00008825 */ move $s1, $zero
/* B769E0 800FF840 24170054 */ li $s7, 84
.L800FF844:
/* B769E4 800FF844 02370019 */ multu $s1, $s7
/* B769E8 800FF848 92020000 */ lbu $v0, ($s0)
/* B769EC 800FF84C 26100001 */ addiu $s0, $s0, 1
/* B769F0 800FF850 02002025 */ move $a0, $s0
/* B769F4 800FF854 00027103 */ sra $t6, $v0, 4
/* B769F8 800FF858 AFAE0010 */ sw $t6, 0x10($sp)
/* B769FC 800FF85C 02A03025 */ move $a2, $s5
/* B76A00 800FF860 02C03825 */ move $a3, $s6
/* B76A04 800FF864 00009012 */ mflo $s2
/* B76A08 800FF868 02532821 */ addu $a1, $s2, $s3
/* B76A0C 800FF86C 0C03FDD0 */ jal func_800FF740
/* B76A10 800FF870 00000000 */ nop
/* B76A14 800FF874 14400003 */ bnez $v0, .L800FF884
/* B76A18 800FF878 26100010 */ addiu $s0, $s0, 0x10
/* B76A1C 800FF87C 1000000A */ b .L800FF8A8
/* B76A20 800FF880 24020001 */ li $v0, 1
.L800FF884:
/* B76A24 800FF884 26310001 */ addiu $s1, $s1, 1
/* B76A28 800FF888 323800FF */ andi $t8, $s1, 0xff
/* B76A2C 800FF88C 02727821 */ addu $t7, $s3, $s2
/* B76A30 800FF890 0314082A */ slt $at, $t8, $s4
/* B76A34 800FF894 ADF00050 */ sw $s0, 0x50($t7)
/* B76A38 800FF898 03008825 */ move $s1, $t8
/* B76A3C 800FF89C 1420FFE9 */ bnez $at, .L800FF844
/* B76A40 800FF8A0 02028021 */ addu $s0, $s0, $v0
.L800FF8A4:
/* B76A44 800FF8A4 00001025 */ move $v0, $zero
.L800FF8A8:
/* B76A48 800FF8A8 8FBF003C */ lw $ra, 0x3c($sp)
/* B76A4C 800FF8AC 8FB0001C */ lw $s0, 0x1c($sp)
/* B76A50 800FF8B0 8FB10020 */ lw $s1, 0x20($sp)
/* B76A54 800FF8B4 8FB20024 */ lw $s2, 0x24($sp)
/* B76A58 800FF8B8 8FB30028 */ lw $s3, 0x28($sp)
/* B76A5C 800FF8BC 8FB4002C */ lw $s4, 0x2c($sp)
/* B76A60 800FF8C0 8FB50030 */ lw $s5, 0x30($sp)
/* B76A64 800FF8C4 8FB60034 */ lw $s6, 0x34($sp)
/* B76A68 800FF8C8 8FB70038 */ lw $s7, 0x38($sp)
/* B76A6C 800FF8CC 03E00008 */ jr $ra
/* B76A70 800FF8D0 27BD0040 */ addiu $sp, $sp, 0x40
glabel func_800FF8D4
/* B76A74 800FF8D4 27BDFFF0 */ addiu $sp, $sp, -0x10
/* B76A78 800FF8D8 AFB00008 */ sw $s0, 8($sp)
/* B76A7C 800FF8DC 87B00022 */ lh $s0, 0x22($sp)
/* B76A80 800FF8E0 AFB1000C */ sw $s1, 0xc($sp)
/* B76A84 800FF8E4 00A08825 */ move $s1, $a1
/* B76A88 800FF8E8 1A000020 */ blez $s0, .L800FF96C
/* B76A8C 800FF8EC 00001025 */ move $v0, $zero
/* B76A90 800FF8F0 93A50027 */ lbu $a1, 0x27($sp)
/* B76A94 800FF8F4 00447021 */ addu $t6, $v0, $a0
.L800FF8F8:
/* B76A98 800FF8F8 10A0000C */ beqz $a1, .L800FF92C
/* B76A9C 800FF8FC 91C30000 */ lbu $v1, ($t6)
/* B76AA0 800FF900 00027840 */ sll $t7, $v0, 1
/* B76AA4 800FF904 00EFC021 */ addu $t8, $a3, $t7
/* B76AA8 800FF908 97190000 */ lhu $t9, ($t8)
/* B76AAC 800FF90C 00034040 */ sll $t0, $v1, 1
/* B76AB0 800FF910 02284821 */ addu $t1, $s1, $t0
/* B76AB4 800FF914 00465021 */ addu $t2, $v0, $a2
/* B76AB8 800FF918 A5390100 */ sh $t9, 0x100($t1)
/* B76ABC 800FF91C 914B0000 */ lbu $t3, ($t2)
/* B76AC0 800FF920 02236021 */ addu $t4, $s1, $v1
/* B76AC4 800FF924 1000000B */ b .L800FF954
/* B76AC8 800FF928 A18B0000 */ sb $t3, ($t4)
.L800FF92C:
/* B76ACC 800FF92C 00026840 */ sll $t5, $v0, 1
/* B76AD0 800FF930 00ED7021 */ addu $t6, $a3, $t5
/* B76AD4 800FF934 95CF0000 */ lhu $t7, ($t6)
/* B76AD8 800FF938 0003C040 */ sll $t8, $v1, 1
/* B76ADC 800FF93C 02384021 */ addu $t0, $s1, $t8
/* B76AE0 800FF940 0046C821 */ addu $t9, $v0, $a2
/* B76AE4 800FF944 A50F0010 */ sh $t7, 0x10($t0)
/* B76AE8 800FF948 93290000 */ lbu $t1, ($t9)
/* B76AEC 800FF94C 02235021 */ addu $t2, $s1, $v1
/* B76AF0 800FF950 A1490000 */ sb $t1, ($t2)
.L800FF954:
/* B76AF4 800FF954 24420001 */ addiu $v0, $v0, 1
/* B76AF8 800FF958 00025C00 */ sll $t3, $v0, 0x10
/* B76AFC 800FF95C 000B1403 */ sra $v0, $t3, 0x10
/* B76B00 800FF960 0050082A */ slt $at, $v0, $s0
/* B76B04 800FF964 5420FFE4 */ bnezl $at, .L800FF8F8
/* B76B08 800FF968 00447021 */ addu $t6, $v0, $a0
.L800FF96C:
/* B76B0C 800FF96C 8FB00008 */ lw $s0, 8($sp)
/* B76B10 800FF970 8FB1000C */ lw $s1, 0xc($sp)
/* B76B14 800FF974 03E00008 */ jr $ra
/* B76B18 800FF978 27BD0010 */ addiu $sp, $sp, 0x10
glabel func_800FF97C
/* B76B1C 800FF97C 27BDFFD0 */ addiu $sp, $sp, -0x30
/* B76B20 800FF980 AFBF0024 */ sw $ra, 0x24($sp)
/* B76B24 800FF984 AFB00020 */ sw $s0, 0x20($sp)
/* B76B28 800FF988 AFA50034 */ sw $a1, 0x34($sp)
/* B76B2C 800FF98C AFA60038 */ sw $a2, 0x38($sp)
/* B76B30 800FF990 AFA7003C */ sw $a3, 0x3c($sp)
/* B76B34 800FF994 90830000 */ lbu $v1, ($a0)
/* B76B38 800FF998 24900001 */ addiu $s0, $a0, 1
/* B76B3C 800FF99C 02002025 */ move $a0, $s0
/* B76B40 800FF9A0 00037903 */ sra $t7, $v1, 4
/* B76B44 800FF9A4 A3AF002F */ sb $t7, 0x2f($sp)
/* B76B48 800FF9A8 0C03FD6A */ jal func_800FF5A8
/* B76B4C 800FF9AC 00C02825 */ move $a1, $a2
/* B76B50 800FF9B0 00024400 */ sll $t0, $v0, 0x10
/* B76B54 800FF9B4 0008C403 */ sra $t8, $t0, 0x10
/* B76B58 800FF9B8 03004025 */ move $t0, $t8
/* B76B5C 800FF9BC 10400009 */ beqz $v0, .L800FF9E4
/* B76B60 800FF9C0 93A3002F */ lbu $v1, 0x2f($sp)
/* B76B64 800FF9C4 10600003 */ beqz $v1, .L800FF9D4
/* B76B68 800FF9C8 28410101 */ slti $at, $v0, 0x101
/* B76B6C 800FF9CC 10200005 */ beqz $at, .L800FF9E4
/* B76B70 800FF9D0 00000000 */ nop
.L800FF9D4:
/* B76B74 800FF9D4 14600005 */ bnez $v1, .L800FF9EC
/* B76B78 800FF9D8 28410011 */ slti $at, $v0, 0x11
/* B76B7C 800FF9DC 54200004 */ bnezl $at, .L800FF9F0
/* B76B80 800FF9E0 8FA40038 */ lw $a0, 0x38($sp)
.L800FF9E4:
/* B76B84 800FF9E4 10000013 */ b .L800FFA34
/* B76B88 800FF9E8 24020001 */ li $v0, 1
.L800FF9EC:
/* B76B8C 800FF9EC 8FA40038 */ lw $a0, 0x38($sp)
.L800FF9F0:
/* B76B90 800FF9F0 8FA5003C */ lw $a1, 0x3c($sp)
/* B76B94 800FF9F4 A3A3002F */ sb $v1, 0x2f($sp)
/* B76B98 800FF9F8 0C03FD8B */ jal func_800FF62C
/* B76B9C 800FF9FC A7A8002C */ sh $t0, 0x2c($sp)
/* B76BA0 800FFA00 87A8002C */ lh $t0, 0x2c($sp)
/* B76BA4 800FFA04 93A3002F */ lbu $v1, 0x2f($sp)
/* B76BA8 800FFA08 26040010 */ addiu $a0, $s0, 0x10
/* B76BAC 800FFA0C 10480003 */ beq $v0, $t0, .L800FFA1C
/* B76BB0 800FFA10 8FA50034 */ lw $a1, 0x34($sp)
/* B76BB4 800FFA14 10000007 */ b .L800FFA34
/* B76BB8 800FFA18 24020001 */ li $v0, 1
.L800FFA1C:
/* B76BBC 800FFA1C 8FA60038 */ lw $a2, 0x38($sp)
/* B76BC0 800FFA20 8FA7003C */ lw $a3, 0x3c($sp)
/* B76BC4 800FFA24 AFA80010 */ sw $t0, 0x10($sp)
/* B76BC8 800FFA28 0C03FE35 */ jal func_800FF8D4
/* B76BCC 800FFA2C AFA30014 */ sw $v1, 0x14($sp)
/* B76BD0 800FFA30 00001025 */ move $v0, $zero
.L800FFA34:
/* B76BD4 800FFA34 8FBF0024 */ lw $ra, 0x24($sp)
/* B76BD8 800FFA38 8FB00020 */ lw $s0, 0x20($sp)
/* B76BDC 800FFA3C 27BD0030 */ addiu $sp, $sp, 0x30
/* B76BE0 800FFA40 03E00008 */ jr $ra
/* B76BE4 800FFA44 00000000 */ nop

View file

@ -182,35 +182,35 @@ glabel Jpeg_Decode
.L8006E5D8: .L8006E5D8:
/* AE5778 8006E5D8 8FA4020C */ lw $a0, 0x20c($sp) /* AE5778 8006E5D8 8FA4020C */ lw $a0, 0x20c($sp)
/* AE577C 8006E5DC 26C50220 */ addiu $a1, $s6, 0x220 /* AE577C 8006E5DC 26C50220 */ addiu $a1, $s6, 0x220
/* AE5780 8006E5E0 0C03FD50 */ jal func_800FF540 /* AE5780 8006E5E0 0C03FD50 */ jal JpegUtils_ProcessQuantizationTable
/* AE5784 8006E5E4 24060003 */ li $a2, 3 /* AE5784 8006E5E4 24060003 */ li $a2, 3
/* AE5788 8006E5E8 1000001D */ b .L8006E660 /* AE5788 8006E5E8 1000001D */ b .L8006E660
/* AE578C 8006E5EC 00000000 */ nop /* AE578C 8006E5EC 00000000 */ nop
.L8006E5F0: .L8006E5F0:
/* AE5790 8006E5F0 26C50220 */ addiu $a1, $s6, 0x220 /* AE5790 8006E5F0 26C50220 */ addiu $a1, $s6, 0x220
/* AE5794 8006E5F4 0C03FD50 */ jal func_800FF540 /* AE5794 8006E5F4 0C03FD50 */ jal JpegUtils_ProcessQuantizationTable
/* AE5798 8006E5F8 24060001 */ li $a2, 1 /* AE5798 8006E5F8 24060001 */ li $a2, 1
/* AE579C 8006E5FC 8FA40210 */ lw $a0, 0x210($sp) /* AE579C 8006E5FC 8FA40210 */ lw $a0, 0x210($sp)
/* AE57A0 8006E600 26C502A0 */ addiu $a1, $s6, 0x2a0 /* AE57A0 8006E600 26C502A0 */ addiu $a1, $s6, 0x2a0
/* AE57A4 8006E604 0C03FD50 */ jal func_800FF540 /* AE57A4 8006E604 0C03FD50 */ jal JpegUtils_ProcessQuantizationTable
/* AE57A8 8006E608 24060001 */ li $a2, 1 /* AE57A8 8006E608 24060001 */ li $a2, 1
/* AE57AC 8006E60C 8FA40210 */ lw $a0, 0x210($sp) /* AE57AC 8006E60C 8FA40210 */ lw $a0, 0x210($sp)
/* AE57B0 8006E610 26C50320 */ addiu $a1, $s6, 0x320 /* AE57B0 8006E610 26C50320 */ addiu $a1, $s6, 0x320
/* AE57B4 8006E614 0C03FD50 */ jal func_800FF540 /* AE57B4 8006E614 0C03FD50 */ jal JpegUtils_ProcessQuantizationTable
/* AE57B8 8006E618 24060001 */ li $a2, 1 /* AE57B8 8006E618 24060001 */ li $a2, 1
/* AE57BC 8006E61C 10000010 */ b .L8006E660 /* AE57BC 8006E61C 10000010 */ b .L8006E660
/* AE57C0 8006E620 00000000 */ nop /* AE57C0 8006E620 00000000 */ nop
.L8006E624: .L8006E624:
/* AE57C4 8006E624 26C50220 */ addiu $a1, $s6, 0x220 /* AE57C4 8006E624 26C50220 */ addiu $a1, $s6, 0x220
/* AE57C8 8006E628 0C03FD50 */ jal func_800FF540 /* AE57C8 8006E628 0C03FD50 */ jal JpegUtils_ProcessQuantizationTable
/* AE57CC 8006E62C 24060001 */ li $a2, 1 /* AE57CC 8006E62C 24060001 */ li $a2, 1
/* AE57D0 8006E630 8FA40210 */ lw $a0, 0x210($sp) /* AE57D0 8006E630 8FA40210 */ lw $a0, 0x210($sp)
/* AE57D4 8006E634 26C502A0 */ addiu $a1, $s6, 0x2a0 /* AE57D4 8006E634 26C502A0 */ addiu $a1, $s6, 0x2a0
/* AE57D8 8006E638 0C03FD50 */ jal func_800FF540 /* AE57D8 8006E638 0C03FD50 */ jal JpegUtils_ProcessQuantizationTable
/* AE57DC 8006E63C 24060001 */ li $a2, 1 /* AE57DC 8006E63C 24060001 */ li $a2, 1
/* AE57E0 8006E640 8FA40214 */ lw $a0, 0x214($sp) /* AE57E0 8006E640 8FA40214 */ lw $a0, 0x214($sp)
/* AE57E4 8006E644 26C50320 */ addiu $a1, $s6, 0x320 /* AE57E4 8006E644 26C50320 */ addiu $a1, $s6, 0x320
/* AE57E8 8006E648 0C03FD50 */ jal func_800FF540 /* AE57E8 8006E648 0C03FD50 */ jal JpegUtils_ProcessQuantizationTable
/* AE57EC 8006E64C 24060001 */ li $a2, 1 /* AE57EC 8006E64C 24060001 */ li $a2, 1
/* AE57F0 8006E650 10000003 */ b .L8006E660 /* AE57F0 8006E650 10000003 */ b .L8006E660
/* AE57F4 8006E654 00000000 */ nop /* AE57F4 8006E654 00000000 */ nop
@ -264,7 +264,7 @@ glabel Jpeg_Decode
/* AE58AC 8006E70C 02802825 */ move $a1, $s4 /* AE58AC 8006E70C 02802825 */ move $a1, $s4
/* AE58B0 8006E710 8FA4021C */ lw $a0, 0x21c($sp) /* AE58B0 8006E710 8FA4021C */ lw $a0, 0x21c($sp)
/* AE58B4 8006E714 26C603A0 */ addiu $a2, $s6, 0x3a0 /* AE58B4 8006E714 26C603A0 */ addiu $a2, $s6, 0x3a0
/* AE58B8 8006E718 0C03FDFF */ jal func_800FF7FC /* AE58B8 8006E718 0C03FDFF */ jal JpegUtils_ProcessHuffmanTable
/* AE58BC 8006E71C 26C704B0 */ addiu $a3, $s6, 0x4b0 /* AE58BC 8006E71C 26C704B0 */ addiu $a3, $s6, 0x4b0
/* AE58C0 8006E720 10400037 */ beqz $v0, .L8006E800 /* AE58C0 8006E720 10400037 */ beqz $v0, .L8006E800
/* AE58C4 8006E724 3C048014 */ lui $a0, %hi(D_8013BF98) # $a0, 0x8014 /* AE58C4 8006E724 3C048014 */ lui $a0, %hi(D_8013BF98) # $a0, 0x8014
@ -280,7 +280,7 @@ glabel Jpeg_Decode
/* AE58E8 8006E748 02203825 */ move $a3, $s1 /* AE58E8 8006E748 02203825 */ move $a3, $s1
/* AE58EC 8006E74C 02003025 */ move $a2, $s0 /* AE58EC 8006E74C 02003025 */ move $a2, $s0
/* AE58F0 8006E750 8FA4021C */ lw $a0, 0x21c($sp) /* AE58F0 8006E750 8FA4021C */ lw $a0, 0x21c($sp)
/* AE58F4 8006E754 0C03FDFF */ jal func_800FF7FC /* AE58F4 8006E754 0C03FDFF */ jal JpegUtils_ProcessHuffmanTable
/* AE58F8 8006E758 02802825 */ move $a1, $s4 /* AE58F8 8006E758 02802825 */ move $a1, $s4
/* AE58FC 8006E75C 10400003 */ beqz $v0, .L8006E76C /* AE58FC 8006E75C 10400003 */ beqz $v0, .L8006E76C
/* AE5900 8006E760 3C048014 */ lui $a0, %hi(D_8013BFBC) # $a0, 0x8014 /* AE5900 8006E760 3C048014 */ lui $a0, %hi(D_8013BFBC) # $a0, 0x8014
@ -292,7 +292,7 @@ glabel Jpeg_Decode
/* AE5914 8006E774 8FA40220 */ lw $a0, 0x220($sp) /* AE5914 8006E774 8FA40220 */ lw $a0, 0x220($sp)
/* AE5918 8006E778 27A5010C */ addiu $a1, $sp, 0x10c /* AE5918 8006E778 27A5010C */ addiu $a1, $sp, 0x10c
/* AE591C 8006E77C 02003025 */ move $a2, $s0 /* AE591C 8006E77C 02003025 */ move $a2, $s0
/* AE5920 8006E780 0C03FDFF */ jal func_800FF7FC /* AE5920 8006E780 0C03FDFF */ jal JpegUtils_ProcessHuffmanTable
/* AE5924 8006E784 02203825 */ move $a3, $s1 /* AE5924 8006E784 02203825 */ move $a3, $s1
/* AE5928 8006E788 10400003 */ beqz $v0, .L8006E798 /* AE5928 8006E788 10400003 */ beqz $v0, .L8006E798
/* AE592C 8006E78C 3C048014 */ lui $a0, %hi(D_8013BFE0) # $a0, 0x8014 /* AE592C 8006E78C 3C048014 */ lui $a0, %hi(D_8013BFE0) # $a0, 0x8014
@ -304,7 +304,7 @@ glabel Jpeg_Decode
/* AE5940 8006E7A0 8FA40224 */ lw $a0, 0x224($sp) /* AE5940 8006E7A0 8FA40224 */ lw $a0, 0x224($sp)
/* AE5944 8006E7A4 27A50160 */ addiu $a1, $sp, 0x160 /* AE5944 8006E7A4 27A50160 */ addiu $a1, $sp, 0x160
/* AE5948 8006E7A8 02003025 */ move $a2, $s0 /* AE5948 8006E7A8 02003025 */ move $a2, $s0
/* AE594C 8006E7AC 0C03FDFF */ jal func_800FF7FC /* AE594C 8006E7AC 0C03FDFF */ jal JpegUtils_ProcessHuffmanTable
/* AE5950 8006E7B0 02203825 */ move $a3, $s1 /* AE5950 8006E7B0 02203825 */ move $a3, $s1
/* AE5954 8006E7B4 10400003 */ beqz $v0, .L8006E7C4 /* AE5954 8006E7B4 10400003 */ beqz $v0, .L8006E7C4
/* AE5958 8006E7B8 3C048014 */ lui $a0, %hi(D_8013C004) # $a0, 0x8014 /* AE5958 8006E7B8 3C048014 */ lui $a0, %hi(D_8013C004) # $a0, 0x8014
@ -316,7 +316,7 @@ glabel Jpeg_Decode
/* AE596C 8006E7CC 8FA40228 */ lw $a0, 0x228($sp) /* AE596C 8006E7CC 8FA40228 */ lw $a0, 0x228($sp)
/* AE5970 8006E7D0 27A501B4 */ addiu $a1, $sp, 0x1b4 /* AE5970 8006E7D0 27A501B4 */ addiu $a1, $sp, 0x1b4
/* AE5974 8006E7D4 02003025 */ move $a2, $s0 /* AE5974 8006E7D4 02003025 */ move $a2, $s0
/* AE5978 8006E7D8 0C03FDFF */ jal func_800FF7FC /* AE5978 8006E7D8 0C03FDFF */ jal JpegUtils_ProcessHuffmanTable
/* AE597C 8006E7DC 02203825 */ move $a3, $s1 /* AE597C 8006E7DC 02203825 */ move $a3, $s1
/* AE5980 8006E7E0 10400007 */ beqz $v0, .L8006E800 /* AE5980 8006E7E0 10400007 */ beqz $v0, .L8006E800
/* AE5984 8006E7E4 3C048014 */ lui $a0, %hi(D_8013C028) # $a0, 0x8014 /* AE5984 8006E7E4 3C048014 */ lui $a0, %hi(D_8013C028) # $a0, 0x8014

View file

@ -2318,13 +2318,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);
void func_800FF540(u8* dqt, JpegQuantizationTable* qtPtr, u8 count); void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 count);
// ? func_800FF5A8(?); s32 JpegUtils_ParseHuffmancodesLengths(u8* ptr, u8* codesLengths);
// ? func_800FF62C(?); s32 JpegUtils_GetHuffmanCodes(u8* codesLengths, u16* codes);
// ? func_800FF698(?); s32 JpegUtils_SetHuffmanTable(u8* data, JpegHuffmanTable* ht, u16* codes);
// ? func_800FF740(?); u32 JpegUtils_ProcessHuffmanTableImpl(u8* data, JpegHuffmanTable* ht, u8* codesLengths, u16* codes, u8 isAc);
u32 func_800FF7FC(u8* data, JpegHuffmanTable* htPtr, void*, void*, u8 count); u32 JpegUtils_ProcessHuffmanTable(u8* dht, JpegHuffmanTable* ht, u8* codesLengths, u16* codes, u8 count);
// ? func_800FF8D4(?); 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*); u32 func_800FFA50(JpegDecoder* decoder, u16*, u32, u8, u32*);
// ? func_800FFC78(?); // ? func_800FFC78(?);
// ? func_800FFE14(?); // ? func_800FFE14(?);

View file

@ -1480,6 +1480,13 @@ typedef struct {
/* 0x50 */ u8* symbols; /* 0x50 */ u8* symbols;
} JpegHuffmanTable; // size = 0x54 } JpegHuffmanTable; // size = 0x54
// this struct might be unaccurate but it's not used outside jpegutils.c anyways
typedef struct {
/* 0x000 */ u8 codeOffs[16];
/* 0x010 */ u16 dcCodes[120];
/* 0x100 */ u16 acCodes[256];
} JpegHuffmanTableOld; // size = 0x300
typedef struct { typedef struct {
/* 0x00 */ u32 unk_00; /* 0x00 */ u32 unk_00;
/* 0x04 */ u32 unk_04; /* 0x04 */ u32 unk_04;
@ -1492,7 +1499,7 @@ typedef struct {
/* 0x000 */ JpegTaskData taskData; /* 0x000 */ JpegTaskData taskData;
/* 0x020 */ char yieldData[0x200]; /* 0x020 */ char yieldData[0x200];
/* 0x220 */ JpegQuantizationTable qTables[3]; /* 0x220 */ JpegQuantizationTable qTables[3];
/* 0x3A0 */ u8 codesLenghts[0x110]; /* 0x3A0 */ u8 codesLengths[0x110];
/* 0x4B0 */ u16 codes[0x108]; /* 0x4B0 */ u16 codes[0x108];
/* 0x6C0 */ u16 unk_6C0[4][0x180]; /* 0x6C0 */ u16 unk_6C0[4][0x180];
} JpegWork; // size = 0x12C0 } JpegWork; // size = 0x12C0

View file

@ -107,6 +107,7 @@ build/src/code/fault.o: OPTIMIZATION := -O2 -g3
build/src/code/fault_drawer.o: CFLAGS += -trapuv build/src/code/fault_drawer.o: CFLAGS += -trapuv
build/src/code/fault_drawer.o: OPTIMIZATION := -O2 -g3 build/src/code/fault_drawer.o: OPTIMIZATION := -O2 -g3
#### Main Targets ### #### Main Targets ###
compare: $(ROM) compare: $(ROM)
@ -192,6 +193,8 @@ build/src/overlays/actors/%.o: CC := python3 tools/asm_processor/build.py $(CC)
build/src/overlays/effects/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) -- build/src/overlays/effects/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
build/src/overlays/gamestates/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) -- build/src/overlays/gamestates/%.o: CC := python3 tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
build/src/code/jpegutils.o: CC := python3 tools/asm_processor/build.py $(CC_OLD) -- $(AS) $(ASFLAGS) --
#build/assets/textures/%.o: assets/textures/%.zdata #build/assets/textures/%.o: assets/textures/%.zdata
# $(OBJCOPY) -I binary -O elf32-big $< $@ # $(OBJCOPY) -I binary -O elf32-big $< $@

2
spec
View file

@ -505,7 +505,7 @@ beginseg
include "build/src/code/__osMalloc.o" include "build/src/code/__osMalloc.o"
include "build/src/code/printutils.o" include "build/src/code/printutils.o"
include "build/src/code/sleep.o" include "build/src/code/sleep.o"
include "build/asm/code_800FF540.o" include "build/src/code/jpegutils.o"
include "build/asm/code_800FFA50.o" include "build/asm/code_800FFA50.o"
include "build/data/code_800FFA50.bss.o" include "build/data/code_800FFA50.bss.o"
include "build/asm/code_80100040.o" include "build/asm/code_80100040.o"

155
src/code/jpegutils.c Normal file
View file

@ -0,0 +1,155 @@
#include <global.h>
void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 count) {
u8 i;
for (i = 0; i < count; i++) {
u8 j;
dqt++;
for (j = 0; j < 64; j++) {
qt[i].table[j] = *dqt++;
}
}
}
s32 JpegUtils_ParseHuffmancodesLengths(u8* ptr, u8* codesLengths) {
u8 off = 1;
s16 count = 0;
s16 idx = 1;
while (off < 0x11) {
while (idx <= ptr[off - 1]) {
codesLengths[count++] = off;
idx++;
}
idx = 1;
off++;
}
codesLengths[count] = 0;
return count;
}
s32 JpegUtils_GetHuffmanCodes(u8* codesLengths, u16* codes) {
s16 idx = 0;
u16 code = 0;
u8 lastLen = codesLengths[0];
while (true) {
while (true) {
codes[idx++] = code++;
if (codesLengths[idx] != lastLen) {
break;
}
}
if (codesLengths[idx] == 0) {
break;
}
while (true) {
if (code <<= 1, codesLengths[idx] == ++lastLen) {
break;
}
}
}
return idx;
}
s32 JpegUtils_SetHuffmanTable(u8* data, JpegHuffmanTable* ht, u16* codes) {
u8 idx;
u16 codeOff;
codeOff = 0;
for (idx = 0; idx < 0x10; idx++) {
if (data[idx]) {
ht->codeOffs[idx] = codeOff;
ht->codesA[idx] = codes[codeOff];
codeOff += data[idx] - 1;
ht->codesB[idx] = codes[codeOff];
codeOff++;
} else {
ht->codesB[idx] = 0xFFFF;
}
}
return codeOff;
}
u32 JpegUtils_ProcessHuffmanTableImpl(u8* data, JpegHuffmanTable* ht, u8* codesLengths, u16* codes, u8 isAc) {
s16 ret;
s32 count;
s32 temp;
count = JpegUtils_ParseHuffmancodesLengths(data, codesLengths);
ret = count;
if (count == 0 || (isAc && count > 0x100) || (!isAc && count > 0x10)) {
return 0;
}
if (ret != JpegUtils_GetHuffmanCodes(codesLengths, codes)) {
return 0;
}
if (temp = JpegUtils_SetHuffmanTable(data, ht, codes), temp != ret) {
return 0;
}
return ret;
}
u32 JpegUtils_ProcessHuffmanTable(u8* dht, JpegHuffmanTable* ht, u8* codesLengths, u16* codes, u8 count) {
u8 idx;
u32 codeCount;
for (idx = 0; idx < count; idx++) {
u32 ac = (*dht++ >> 4);
codeCount = JpegUtils_ProcessHuffmanTableImpl(dht, &ht[idx], codesLengths, codes, ac);
if (codeCount == 0) {
return 1;
}
dht += 0x10;
ht[idx].symbols = dht;
dht += codeCount;
}
return 0;
}
void JpegUtils_SetHuffmanTableOld(u8* data, JpegHuffmanTableOld* ht, u8* codesLengths, u16* codes, s16 count, u8 isAc) {
s16 idx;
u8 a;
for (idx = 0; idx < count; idx++) {
a = data[idx];
if (isAc) {
ht->acCodes[a] = codes[idx];
ht->codeOffs[a] = codesLengths[idx];
} else {
ht->dcCodes[a] = codes[idx];
ht->codeOffs[a] = codesLengths[idx];
}
}
}
u32 JpegUtils_ProcessHuffmanTableImplOld(u8* dht, JpegHuffmanTableOld* ht, u8* codesLengths, u16* codes) {
u8 isAc;
s16 count2;
s32 count;
isAc = *dht++ >> 4;
count2 = count = JpegUtils_ParseHuffmancodesLengths(dht, codesLengths);
if (count == 0 || (isAc && count > 0x100) || (!isAc && count > 0x10)) {
return 1;
}
if (JpegUtils_GetHuffmanCodes(codesLengths, codes) != count2) {
return 1;
}
JpegUtils_SetHuffmanTableOld(dht + 0x10, ht, codesLengths, codes, count2, isAc);
return 0;
}

View file

@ -97,8 +97,7 @@ void Jpeg_CopyToZbuffer(u16* src, u16* zbuffer, s32 x, s32 y) {
u16 Jpeg_GetU16(u8* ptr) { u16 Jpeg_GetU16(u8* ptr) {
if (((u32)ptr & 1) == 0) { // if the address is aligned to 2 if (((u32)ptr & 1) == 0) { // if the address is aligned to 2
return *(u16*)ptr; return *(u16*)ptr;
} } else {
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); // ?? it's exactly like *(16*)ptr
} }
} }
@ -250,19 +249,19 @@ s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize) {
switch (ctx.dqtCount) { switch (ctx.dqtCount) {
case 1: { case 1: {
func_800FF540(ctx.dqtPtr[0], &workBuff->qTables[0], 3); JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTables[0], 3);
break; break;
} }
case 2: { case 2: {
func_800FF540(ctx.dqtPtr[0], &workBuff->qTables[0], 1); JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTables[0], 1);
func_800FF540(ctx.dqtPtr[1], &workBuff->qTables[1], 1); JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTables[1], 1);
func_800FF540(ctx.dqtPtr[1], &workBuff->qTables[2], 1); JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTables[2], 1);
break; break;
} }
case 3: { case 3: {
func_800FF540(ctx.dqtPtr[0], &workBuff->qTables[0], 1); JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[0], &workBuff->qTables[0], 1);
func_800FF540(ctx.dqtPtr[1], &workBuff->qTables[1], 1); JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[1], &workBuff->qTables[1], 1);
func_800FF540(ctx.dqtPtr[2], &workBuff->qTables[2], 1); JpegUtils_ProcessQuantizationTable(ctx.dqtPtr[2], &workBuff->qTables[2], 1);
break; break;
} }
default: default:
@ -277,22 +276,27 @@ s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize) {
switch (ctx.dhtCount) { switch (ctx.dhtCount) {
case 1: { case 1: {
if (func_800FF7FC(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLenghts, &workBuff->codes, 4)) { if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLengths, &workBuff->codes,
4)) {
osSyncPrintf("Error : Cant' make huffman table.\n"); osSyncPrintf("Error : Cant' make huffman table.\n");
} }
break; break;
} }
case 4: { case 4: {
if (func_800FF7FC(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLenghts, &workBuff->codes, 1)) { if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[0], &hTables[0], &workBuff->codesLengths, &workBuff->codes,
1)) {
osSyncPrintf("Error : Cant' make huffman table.\n"); osSyncPrintf("Error : Cant' make huffman table.\n");
} }
if (func_800FF7FC(ctx.dhtPtr[1], &hTables[1], &workBuff->codesLenghts, &workBuff->codes, 1)) { if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[1], &hTables[1], &workBuff->codesLengths, &workBuff->codes,
1)) {
osSyncPrintf("Error : Cant' make huffman table.\n"); osSyncPrintf("Error : Cant' make huffman table.\n");
} }
if (func_800FF7FC(ctx.dhtPtr[2], &hTables[2], &workBuff->codesLenghts, &workBuff->codes, 1)) { if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[2], &hTables[2], &workBuff->codesLengths, &workBuff->codes,
1)) {
osSyncPrintf("Error : Cant' make huffman table.\n"); osSyncPrintf("Error : Cant' make huffman table.\n");
} }
if (func_800FF7FC(ctx.dhtPtr[3], &hTables[3], &workBuff->codesLenghts, &workBuff->codes, 1)) { if (JpegUtils_ProcessHuffmanTable(ctx.dhtPtr[3], &hTables[3], &workBuff->codesLengths, &workBuff->codes,
1)) {
osSyncPrintf("Error : Cant' make huffman table.\n"); osSyncPrintf("Error : Cant' make huffman table.\n");
} }
break; break;

View file

@ -4,6 +4,7 @@
QuakeRequest sQuakeRequest[4]; QuakeRequest sQuakeRequest[4];
s16 D_80126250 = 1; s16 D_80126250 = 1;
s16 sQuakeRequestCount = 0; s16 sQuakeRequestCount = 0;
s16 (*sQuakeCallbacks[])(QuakeRequest*, ShakeInfo*) = { s16 (*sQuakeCallbacks[])(QuakeRequest*, ShakeInfo*) = {
NULL, Quake_Callback1, Quake_Callback2, Quake_Callback3, Quake_Callback4, Quake_Callback5, Quake_Callback6, NULL, Quake_Callback1, Quake_Callback2, Quake_Callback3, Quake_Callback4, Quake_Callback5, Quake_Callback6,
}; };

View file

@ -40,8 +40,9 @@ s32 osReadMempak(OSMesgQueue* ctrlrqueue, s32 ctrlridx, u16 addr, PIF_mempak_dat
if (!ret) { if (!ret) {
if (bufptr[0x26] != osMempakDataCRC(bufptr + 6)) { if (bufptr[0x26] != osMempakDataCRC(bufptr + 6)) {
ret = func_80101910(ctrlrqueue, ctrlridx); ret = func_80101910(ctrlrqueue, ctrlridx);
if (ret) if (ret) {
break; break;
}
ret = 4; // Retry ret = 4; // Retry
} else { } else {
bcopy(bufptr + 6, data, 0x20); bcopy(bufptr + 6, data, 0x20);
@ -49,8 +50,9 @@ s32 osReadMempak(OSMesgQueue* ctrlrqueue, s32 ctrlridx, u16 addr, PIF_mempak_dat
} else { } else {
ret = 1; // Error ret = 1; // Error
} }
if (ret != 4) if (ret != 4) {
break; break;
}
} while (0 <= read_try_count--); } while (0 <= read_try_count--);
__osSiRelAccess(); __osSiRelAccess();
return ret; return ret;