1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-10 19:20:13 +00:00

Merge branch 'master' into ovl_Bg_Haka_Megane

This commit is contained in:
Ethan Roseman 2020-03-23 14:43:28 -04:00
commit c79cbf7d9c
2 changed files with 13 additions and 117 deletions

View file

@ -1,99 +0,0 @@
glabel Yaz0_DecompressImpl
/* 0028B0 80001CB0 27BDFFC0 */ addiu $sp, $sp, -0x40
/* 0028B4 80001CB4 AFBF002C */ sw $ra, 0x2c($sp)
/* 0028B8 80001CB8 AFB40028 */ sw $s4, 0x28($sp)
/* 0028BC 80001CBC AFB30024 */ sw $s3, 0x24($sp)
/* 0028C0 80001CC0 AFB20020 */ sw $s2, 0x20($sp)
/* 0028C4 80001CC4 AFB1001C */ sw $s1, 0x1c($sp)
/* 0028C8 80001CC8 AFB00018 */ sw $s0, 0x18($sp)
/* 0028CC 80001CCC 8C8E0004 */ lw $t6, 4($a0)
/* 0028D0 80001CD0 3C128001 */ lui $s2, %hi(sYaz0MaxPtr) # $s2, 0x8001
/* 0028D4 80001CD4 3C138001 */ lui $s3, %hi(sYaz0CurSize) # $s3, 0x8001
/* 0028D8 80001CD8 00A08025 */ move $s0, $a1
/* 0028DC 80001CDC 00003025 */ move $a2, $zero
/* 0028E0 80001CE0 24910010 */ addiu $s1, $a0, 0x10
/* 0028E4 80001CE4 267344E8 */ addiu $s3, %lo(sYaz0CurSize) # addiu $s3, $s3, 0x44e8
/* 0028E8 80001CE8 265244EC */ addiu $s2, %lo(sYaz0MaxPtr) # addiu $s2, $s2, 0x44ec
/* 0028EC 80001CEC 8FA70030 */ lw $a3, 0x30($sp)
/* 0028F0 80001CF0 01C5A021 */ addu $s4, $t6, $a1
.L80001CF4:
/* 0028F4 80001CF4 54C0000F */ bnezl $a2, .L80001D34
/* 0028F8 80001CF8 30F90080 */ andi $t9, $a3, 0x80
/* 0028FC 80001CFC 8E4F0000 */ lw $t7, ($s2)
/* 002900 80001D00 01F1082B */ sltu $at, $t7, $s1
/* 002904 80001D04 50200008 */ beql $at, $zero, .L80001D28
/* 002908 80001D08 92270000 */ lbu $a3, ($s1)
/* 00290C 80001D0C 8E780000 */ lw $t8, ($s3)
/* 002910 80001D10 53000005 */ beql $t8, $zero, .L80001D28
/* 002914 80001D14 92270000 */ lbu $a3, ($s1)
/* 002918 80001D18 0C0006F2 */ jal Yaz0_NextDMA
/* 00291C 80001D1C 02202025 */ move $a0, $s1
/* 002920 80001D20 00408825 */ move $s1, $v0
/* 002924 80001D24 92270000 */ lbu $a3, ($s1)
.L80001D28:
/* 002928 80001D28 26310001 */ addiu $s1, $s1, 1
/* 00292C 80001D2C 24060008 */ li $a2, 8
/* 002930 80001D30 30F90080 */ andi $t9, $a3, 0x80
.L80001D34:
/* 002934 80001D34 13200006 */ beqz $t9, .L80001D50
/* 002938 80001D38 00073840 */ sll $a3, $a3, 1
/* 00293C 80001D3C 92280000 */ lbu $t0, ($s1)
/* 002940 80001D40 26100001 */ addiu $s0, $s0, 1
/* 002944 80001D44 26310001 */ addiu $s1, $s1, 1
/* 002948 80001D48 10000027 */ b .L80001DE8
/* 00294C 80001D4C A208FFFF */ sb $t0, -1($s0)
.L80001D50:
/* 002950 80001D50 92230000 */ lbu $v1, ($s1)
/* 002954 80001D54 92290001 */ lbu $t1, 1($s1)
/* 002958 80001D58 26310002 */ addiu $s1, $s1, 2
/* 00295C 80001D5C 306A000F */ andi $t2, $v1, 0xf
/* 002960 80001D60 000A5A00 */ sll $t3, $t2, 8
/* 002964 80001D64 00032903 */ sra $a1, $v1, 4
/* 002968 80001D68 012B2025 */ or $a0, $t1, $t3
/* 00296C 80001D6C 14A00005 */ bnez $a1, .L80001D84
/* 002970 80001D70 02041023 */ subu $v0, $s0, $a0
/* 002974 80001D74 92230000 */ lbu $v1, ($s1)
/* 002978 80001D78 26310001 */ addiu $s1, $s1, 1
/* 00297C 80001D7C 10000002 */ b .L80001D88
/* 002980 80001D80 24630012 */ addiu $v1, $v1, 0x12
.L80001D84:
/* 002984 80001D84 24A30002 */ addiu $v1, $a1, 2
.L80001D88:
/* 002988 80001D88 30650003 */ andi $a1, $v1, 3
/* 00298C 80001D8C 00052823 */ negu $a1, $a1
/* 002990 80001D90 10A00009 */ beqz $a1, .L80001DB8
/* 002994 80001D94 00A32021 */ addu $a0, $a1, $v1
.L80001D98:
/* 002998 80001D98 904CFFFF */ lbu $t4, -1($v0)
/* 00299C 80001D9C 2463FFFF */ addiu $v1, $v1, -1
/* 0029A0 80001DA0 26100001 */ addiu $s0, $s0, 1
/* 0029A4 80001DA4 24420001 */ addiu $v0, $v0, 1
/* 0029A8 80001DA8 1483FFFB */ bne $a0, $v1, .L80001D98
/* 0029AC 80001DAC A20CFFFF */ sb $t4, -1($s0)
/* 0029B0 80001DB0 1060000D */ beqz $v1, .L80001DE8
/* 0029B4 80001DB4 00000000 */ nop
.L80001DB8:
/* 0029B8 80001DB8 904DFFFF */ lbu $t5, -1($v0)
/* 0029BC 80001DBC 2463FFFC */ addiu $v1, $v1, -4
/* 0029C0 80001DC0 26100004 */ addiu $s0, $s0, 4
/* 0029C4 80001DC4 A20DFFFC */ sb $t5, -4($s0)
/* 0029C8 80001DC8 904E0000 */ lbu $t6, ($v0)
/* 0029CC 80001DCC 24420004 */ addiu $v0, $v0, 4
/* 0029D0 80001DD0 A20EFFFD */ sb $t6, -3($s0)
/* 0029D4 80001DD4 904FFFFD */ lbu $t7, -3($v0)
/* 0029D8 80001DD8 A20FFFFE */ sb $t7, -2($s0)
/* 0029DC 80001DDC 9058FFFE */ lbu $t8, -2($v0)
/* 0029E0 80001DE0 1460FFF5 */ bnez $v1, .L80001DB8
/* 0029E4 80001DE4 A218FFFF */ sb $t8, -1($s0)
.L80001DE8:
/* 0029E8 80001DE8 1614FFC2 */ bne $s0, $s4, .L80001CF4
/* 0029EC 80001DEC 24C6FFFF */ addiu $a2, $a2, -1
/* 0029F0 80001DF0 8FBF002C */ lw $ra, 0x2c($sp)
/* 0029F4 80001DF4 AFA70030 */ sw $a3, 0x30($sp)
/* 0029F8 80001DF8 8FB00018 */ lw $s0, 0x18($sp)
/* 0029FC 80001DFC 8FB1001C */ lw $s1, 0x1c($sp)
/* 002A00 80001E00 8FB20020 */ lw $s2, 0x20($sp)
/* 002A04 80001E04 8FB30024 */ lw $s3, 0x24($sp)
/* 002A08 80001E08 8FB40028 */ lw $s4, 0x28($sp)
/* 002A0C 80001E0C 03E00008 */ jr $ra
/* 002A10 80001E10 27BD0040 */ addiu $sp, $sp, 0x40

View file

@ -51,10 +51,6 @@ void* Yaz0_NextDMA(void* curSrcPos) {
return dst;
}
#ifdef NON_MATCHING
// has an extra check at the start of the small compressed loop
// along with an extra move instruction
// maybe some regalloc differences besides these issues
void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) {
u32 bitIdx;
u8* src;
@ -63,46 +59,45 @@ void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) {
u32 nibble;
u8* backPtr;
s32 chunkSize;
u32 curDecBit;
u32 off;
bitIdx = 0;
src = hdr->data;
src = (u8*)hdr->data;
dstEnd = dst + hdr->decSize;
do {
if (bitIdx == 0) {
if ((sYaz0MaxPtr < (u32)src) && (sYaz0CurSize != 0))
if ((sYaz0MaxPtr < (u32)src) && (sYaz0CurSize != 0)) {
src = Yaz0_NextDMA(src);
}
chunkHeader = *src++;
bitIdx = 8;
}
curDecBit = chunkHeader & (1 << 7);
chunkHeader <<= 1;
if (curDecBit) { // uncompressed
*dst++ = *src++;
if (chunkHeader & (1 << 7)) { // uncompressed
*dst = *src;
dst++;
src++;
} else { // compressed
off = ((*src & 0xF) << 8 | *(src + 1));
nibble = *src >> 4;
backPtr = dst - (*(src + 1) | (*src & 0xF) << 8);
backPtr = dst - off;
src += 2;
chunkSize = (nibble == 0) // N = chunkSize; B = back offset
? *src++ + 0x12 // 3 bytes 0B BB NN
: nibble + 2; // 2 bytes NB BB
for (off = chunkSize; off > 0; off--)
do {
*dst++ = *(backPtr++ - 1);
chunkSize--;
} while (chunkSize != 0);
}
chunkHeader <<= 1;
bitIdx--;
} while (dst != dstEnd);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/boot/yaz0/Yaz0_DecompressImpl.s")
#endif
void Yaz0_Decompress(u32 romStart, void* dst, u32 size) {
sYaz0CurRomStart = romStart;