diff --git a/linker_scripts/us/symbol_addrs_code.txt b/linker_scripts/us/symbol_addrs_code.txt index a6d75cc..0d07c3b 100644 --- a/linker_scripts/us/symbol_addrs_code.txt +++ b/linker_scripts/us/symbol_addrs_code.txt @@ -312,7 +312,7 @@ JpegUtils_SetHuffmanTable = 0x8000BEC8; // type:func JpegUtils_ProcessHuffmanTableImpl = 0x8000BF70; // type:func func_8000C02C = 0x8000C02C; // type:func JpegUtils_SetHuffmanTableOld = 0x8000C104; // type:func -func_8000C1AC = 0x8000C1AC; // type:func +JpegUtils_ProcessHuffmanTableImplOld = 0x8000C1AC; // type:func func_8000C280 = 0x8000C280; // type:func func_8000C4A8 = 0x8000C4A8; // type:func func_8000C644 = 0x8000C644; // type:func diff --git a/src/C970.c b/src/C970.c index 3a729ac..426d0c0 100644 --- a/src/C970.c +++ b/src/C970.c @@ -138,26 +138,22 @@ void JpegUtils_SetHuffmanTableOld(u8* data, JpegHuffmanTableOld* ht, u8* codesLe } } -#ifdef NON_MATCHING -s32 func_8000C1AC(u8* arg0, JpegHuffmanTableOld* arg1, u8* arg2, u16* arg3) { - u8 sp2F; - s16 sp2C; - s16 temp_v0; - u8* temp_s0; +u32 JpegUtils_ProcessHuffmanTableImplOld(u8* dht, JpegHuffmanTableOld* ht, u8* codesLengths, u16* codes) { + u8 isAc = *dht++ >> 4; + s16 count2; + s32 count; - temp_s0 = arg0 + 1; - sp2F = (u8) ((s32) *arg0 >> 4); - temp_v0 = JpegUtils_GetHuffmanCodes(temp_s0, arg2); - if ((temp_v0 == 0) || ((sp2F != 0) && (temp_v0 >= 0x101)) || ((sp2F == 0) && (temp_v0 >= 0x11))) { + count2 = count = JpegUtils_ParseHuffmanCodesLengths(dht, codesLengths); + + if (count == 0 || (isAc && count > 0x100) || (!isAc && count > 0x10)) { return 1; } - sp2C = temp_v0; - if (JpegUtils_GetHuffmanCodes(arg2, arg3) != temp_v0) { + + if (JpegUtils_GetHuffmanCodes(codesLengths, codes) != count2) { return 1; } - JpegUtils_SetHuffmanTableOld((u8*)temp_s0 + 0x10, arg1, arg2, arg3, temp_v0, sp2F); + + JpegUtils_SetHuffmanTableOld(dht + 0x10, ht, codesLengths, codes, count2, isAc); + return 0; -} -#else -#pragma GLOBAL_ASM("asm/us/nonmatchings/C970/func_8000C1AC.s") -#endif +} \ No newline at end of file