mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-08-05 01:09:33 -04:00
Decompile mp3decSetSideInfo
This commit is contained in:
@@ -45,7 +45,7 @@ void func00041600(struct asistream *stream, u32 gr, u32 ch);
|
||||
bool func00042238(struct asistream *stream, u32 gr, u32 ch);
|
||||
bool func000427d8(struct asistream *stream, u32 gr);
|
||||
bool mp3decReduceAliases(struct asistream *stream, u32 gr, u32 ch);
|
||||
bool func00042e38(struct asistream *stream);
|
||||
bool mp3decSetSideInfo(struct asistream *stream);
|
||||
bool mp3decDecodeFrame(struct asistream *stream);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
u32 func000461c0(void);
|
||||
u32 func00046290(void);
|
||||
s32 func000462c4(u8 *arg0, s32 *arg1, s32 arg2);
|
||||
s32 mp3decGetBits(u8 *buffer, s32 *count, s32 numbits);
|
||||
s32 func000462f8(u8 *arg0, s32 *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, u8 **arg6, u8 **arg7);
|
||||
s32 func000464a8(u8 *arg0, s32 *arg1, s32 arg2, s32 arg3, s32 arg4, u8 **arg5, u8 **arg6);
|
||||
|
||||
|
||||
+76
-75
@@ -7352,81 +7352,82 @@ struct asistream_4f64 {
|
||||
#define MAX_CH 2
|
||||
|
||||
struct asistream {
|
||||
s32 unk00;
|
||||
s32 (*unk04)(s32 arg0, void *arg1, s32 arg2, s32 arg3);
|
||||
s32 unk08;
|
||||
s32 unk0c;
|
||||
s32 unk10;
|
||||
s32 unk14;
|
||||
s32 unk18;
|
||||
u8 unk1c[0x2000];
|
||||
s32 unk201c;
|
||||
s32 unk2020;
|
||||
u8 unk2024[0x40];
|
||||
s32 unk2064;
|
||||
u32 unk2068;
|
||||
u32 unk206c;
|
||||
struct mp3thing unk2070[6];
|
||||
s32 unk3ba0;
|
||||
u32 unk3ba4;
|
||||
u32 unk3ba8;
|
||||
u32 unk3bac;
|
||||
u32 unk3bb0;
|
||||
u32 unk3bb4;
|
||||
u32 unk3bb8;
|
||||
u32 unk3bbc;
|
||||
u32 unk3bc0;
|
||||
u32 unk3bc4;
|
||||
u32 unk3bc8;
|
||||
u32 unk3bcc;
|
||||
u32 unk3bd0;
|
||||
u32 unk3bd4;
|
||||
u32 unk3bd8;
|
||||
u32 unk3bdc;
|
||||
u32 unk3be0;
|
||||
u32 unk3be4;
|
||||
u32 unk3be8;
|
||||
u32 unk3bec;
|
||||
u32 unk3bf0;
|
||||
u32 unk3bf4;
|
||||
u32 unk3bf8[1][0x20];
|
||||
u32 unk3c78[2][1];
|
||||
u32 unk3c80[4][1];
|
||||
u32 unk3c90[2][1];
|
||||
u32 unk3c98[1][1];
|
||||
u32 unk3c9c;
|
||||
u32 block_type[2][1];
|
||||
u32 unk3ca8[1][1];
|
||||
u32 unk3cac;
|
||||
u32 unk3cb0[4][1][3];
|
||||
u32 unk3ce0[1][1];
|
||||
u32 unk3ce4;
|
||||
u32 unk3ce8[1][1];
|
||||
u32 unk3cec;
|
||||
u8 unk3cf0[0x10];
|
||||
u32 unk3d00[1][1];
|
||||
u32 unk3d04;
|
||||
u8 scalefac_l[0x58];
|
||||
u8 unk3d60[4];
|
||||
u8 scalefac_s[4];
|
||||
u8 unk3d68[0x2c];
|
||||
u8 unk3d94[0x6c];
|
||||
u8 unk3e00[0x188];
|
||||
s32 unk3f88;
|
||||
s32 numchannels;
|
||||
u32 unk3f90;
|
||||
u8 unk3f94[1][0x484];
|
||||
u8 unk4418[1][0x242];
|
||||
s32 unk465c[1];
|
||||
s32 unk4660[1];
|
||||
struct asistream_4f64 unk4664[32];
|
||||
struct asistream_4f64 unk4f64[2][32];
|
||||
u8 unk6164[0x900];
|
||||
struct asistream_4f64 unk6a64[2][32];
|
||||
u8 unk7c64[0x810];
|
||||
s32 unk8474;
|
||||
bool (*unk8478)(struct asistream *stream);
|
||||
bool (*unk847c)(struct asistream *stream);
|
||||
/*0x0000*/ s32 unk00;
|
||||
/*0x0004*/ s32 (*unk04)(s32 arg0, void *arg1, s32 arg2, s32 arg3);
|
||||
/*0x0008*/ s32 unk08;
|
||||
/*0x000c*/ s32 unk0c;
|
||||
/*0x0010*/ s32 unk10;
|
||||
/*0x0014*/ s32 unk14;
|
||||
/*0x0018*/ s32 unk18;
|
||||
/*0x2000*/ u8 unk1c[0x2000];
|
||||
/*0x201c*/ s32 unk201c;
|
||||
/*0x2020*/ s32 unk2020;
|
||||
/*0x2024*/ u8 buffer[0x40];
|
||||
/*0x2064*/ s32 count;
|
||||
/*0x2068*/ u32 unk2068;
|
||||
/*0x206c*/ u32 unk206c;
|
||||
/*0x2070*/ struct mp3thing unk2070[6];
|
||||
/*0x3ba0*/ s32 unk3ba0;
|
||||
/*0x3ba4*/ u32 version;
|
||||
/*0x3ba8*/ u32 layer;
|
||||
/*0x3bac*/ u32 crctype;
|
||||
/*0x3bb0*/ u32 bitrateindex;
|
||||
/*0x3bb4*/ u32 samplerateindex;
|
||||
/*0x3bb8*/ u32 haspadding;
|
||||
/*0x3bbc*/ u32 privatebit;
|
||||
/*0x3bc0*/ u32 channelmode;
|
||||
/*0x3bc4*/ u32 unk3bc4;
|
||||
/*0x3bc8*/ u32 unk3bc8;
|
||||
/*0x3bcc*/ u32 unk3bcc;
|
||||
/*0x3bd0*/ u32 unk3bd0;
|
||||
/*0x3bd4*/ bool doneinitial;
|
||||
/*0x3bd8*/ u32 initialversion;
|
||||
/*0x3bdc*/ u32 initiallayer;
|
||||
/*0x3be0*/ u32 initialcrctype;
|
||||
/*0x3be4*/ u32 initialsamplerateindex;
|
||||
/*0x3be8*/ u32 initialchannelmode;
|
||||
/*0x3bec*/ u32 unk3bec;
|
||||
/*0x3bf0*/ u32 unk3bf0;
|
||||
/*0x3bf4*/ u32 main_data_begin;
|
||||
/*0x3bf8*/ u32 scfsi[1][32];
|
||||
/*0x3c78*/ u32 part2_3_length[2][1];
|
||||
/*0x3c80*/ u32 big_value[2][1];
|
||||
/*0x3c88*/ u32 global_gain[2][1];
|
||||
/*0x3c90*/ u32 scalefac_compress[2][1];
|
||||
/*0x3c98*/ u32 window_switching[2][1];
|
||||
/*0x3ca0*/ u32 block_type[2][1];
|
||||
/*0x3ca8*/ u32 mixed_block_flag[2][1];
|
||||
/*0x3cb0*/ u32 table_select[2][1][3];
|
||||
/*0x3cc8*/ u32 subblock_gain[2][1][3];
|
||||
/*0x3ce0*/ u32 region0_count[2][1];
|
||||
/*0x3ce8*/ u32 region1_count[2][1];
|
||||
/*0x3cf0*/ u32 preflag[2][1];
|
||||
/*0x3cf8*/ u32 scalefac_scale[2][1];
|
||||
/*0x3d00*/ u32 count1table_select[2][1];
|
||||
/*0x3d08*/ u8 scalefac_l[0x58];
|
||||
/*0x3d60*/ u8 unk3d60[4];
|
||||
/*0x3d64*/ u8 scalefac_s[4];
|
||||
/*0x3d68*/ u8 unk3d68[0x2c];
|
||||
/*0x3d94*/ u8 unk3d94[0x6c];
|
||||
/*0x3e00*/ u8 unk3e00[0x17c];
|
||||
/*0x3f7c*/ s32 unk3f7c;
|
||||
/*0x3f80*/ s32 unk3f80;
|
||||
/*0x3f84*/ s32 unk3f84;
|
||||
/*0x3f88*/ s32 unk3f88;
|
||||
/*0x3f8c*/ s32 numchannels;
|
||||
/*0x3f90*/ s32 numgranules;
|
||||
/*0x3f94*/ u8 unk3f94[1][0x484];
|
||||
/*0x4418*/ u8 unk4418[1][0x242];
|
||||
/*0x465c*/ s32 unk465c[1];
|
||||
/*0x4660*/ s32 unk4660[1];
|
||||
/*0x4664*/ struct asistream_4f64 unk4664[32];
|
||||
/*0x4f64*/ struct asistream_4f64 unk4f64[2][32];
|
||||
/*0x6164*/ u8 unk6164[0x900];
|
||||
/*0x6a64*/ struct asistream_4f64 unk6a64[2][32];
|
||||
/*0x7c64*/ u8 unk7c64[0x810];
|
||||
/*0x8474*/ s32 unk8474;
|
||||
/*0x8478*/ bool (*unk8478)(struct asistream *stream);
|
||||
/*0x847c*/ bool (*unk847c)(struct asistream *stream);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+172
-692
File diff suppressed because it is too large
Load Diff
+54
-45
@@ -7,6 +7,13 @@
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
#define LAYER_3 1
|
||||
#define LAYER_2 2
|
||||
#define LAYER_1 3
|
||||
|
||||
#define CRC_PROTECTED 0
|
||||
#define CRC_UNPROTECTED 1
|
||||
|
||||
extern struct mp3vars g_Mp3Vars;
|
||||
|
||||
u32 var8009c650[34];
|
||||
@@ -55,16 +62,16 @@ bool func00043ef8(struct asistream *stream, s32 arg1)
|
||||
mask = 0xff;
|
||||
|
||||
while (true) {
|
||||
sp1c = stream->unk04(stream->unk00, &stream->unk2024[sp20], 1, sp24);
|
||||
sp1c = stream->unk04(stream->unk00, &stream->buffer[sp20], 1, sp24);
|
||||
|
||||
if (sp1c < 1) {
|
||||
return 0;
|
||||
if (sp1c <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sp24 = -1;
|
||||
stream->unk18++;
|
||||
|
||||
if ((stream->unk2024[sp20] & mask) != mask) {
|
||||
if ((stream->buffer[sp20] & mask) != mask) {
|
||||
mask = 0xff;
|
||||
sp20 = 0;
|
||||
continue;
|
||||
@@ -79,78 +86,80 @@ bool func00043ef8(struct asistream *stream, s32 arg1)
|
||||
mask = 0xf0;
|
||||
}
|
||||
|
||||
sp1c = stream->unk04(stream->unk00, &stream->unk2024[2], 2, -1);
|
||||
sp1c = stream->unk04(stream->unk00, &stream->buffer[2], 2, -1);
|
||||
|
||||
if (sp1c <= 0) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
stream->unk18 += 2;
|
||||
stream->unk2064 = 12;
|
||||
stream->count = 12;
|
||||
|
||||
stream->unk3ba4 = func000462c4(stream->unk2024, &stream->unk2064, 1);
|
||||
stream->unk3ba8 = func000462c4(stream->unk2024, &stream->unk2064, 2);
|
||||
stream->unk3bac = func000462c4(stream->unk2024, &stream->unk2064, 1);
|
||||
stream->unk3bb0 = func000462c4(stream->unk2024, &stream->unk2064, 4);
|
||||
stream->unk3bb4 = func000462c4(stream->unk2024, &stream->unk2064, 2);
|
||||
stream->unk3bb8 = func000462c4(stream->unk2024, &stream->unk2064, 1);
|
||||
stream->unk3bbc = func000462c4(stream->unk2024, &stream->unk2064, 1);
|
||||
stream->unk3bc0 = func000462c4(stream->unk2024, &stream->unk2064, 2);
|
||||
stream->unk3bc4 = func000462c4(stream->unk2024, &stream->unk2064, 2);
|
||||
stream->unk3bc8 = func000462c4(stream->unk2024, &stream->unk2064, 1);
|
||||
stream->unk3bcc = func000462c4(stream->unk2024, &stream->unk2064, 1);
|
||||
stream->unk3bd0 = func000462c4(stream->unk2024, &stream->unk2064, 2);
|
||||
stream->version = mp3decGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->layer = mp3decGetBits(stream->buffer, &stream->count, 2);
|
||||
stream->crctype = mp3decGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->bitrateindex = mp3decGetBits(stream->buffer, &stream->count, 4);
|
||||
stream->samplerateindex = mp3decGetBits(stream->buffer, &stream->count, 2);
|
||||
stream->haspadding = mp3decGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->privatebit = mp3decGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->channelmode = mp3decGetBits(stream->buffer, &stream->count, 2);
|
||||
|
||||
if (stream->unk3bb0 == 15 || stream->unk3bb4 == 3) {
|
||||
stream->unk3bc4 = mp3decGetBits(stream->buffer, &stream->count, 2);
|
||||
stream->unk3bc8 = mp3decGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->unk3bcc = mp3decGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->unk3bd0 = mp3decGetBits(stream->buffer, &stream->count, 2);
|
||||
|
||||
if (stream->bitrateindex == 15 || stream->samplerateindex == 3) {
|
||||
return func00043ef8(stream, -1);
|
||||
}
|
||||
|
||||
if (stream->unk3bd4 == 0) {
|
||||
stream->unk3bd4 = 1;
|
||||
stream->unk3bd8 = stream->unk3ba4;
|
||||
stream->unk3bdc = stream->unk3ba8;
|
||||
stream->unk3be0 = stream->unk3bac;
|
||||
stream->unk3be4 = stream->unk3bb4;
|
||||
stream->unk3be8 = stream->unk3bc0;
|
||||
if (!stream->doneinitial) {
|
||||
stream->doneinitial = true;
|
||||
|
||||
stream->initialversion = stream->version;
|
||||
stream->initiallayer = stream->layer;
|
||||
stream->initialcrctype = stream->crctype;
|
||||
stream->initialsamplerateindex = stream->samplerateindex;
|
||||
stream->initialchannelmode = stream->channelmode;
|
||||
stream->unk3bec = stream->unk3bc8;
|
||||
stream->unk3bf0 = stream->unk3bcc;
|
||||
} else if (stream->unk3ba4 != stream->unk3bd8
|
||||
|| stream->unk3ba8 != stream->unk3bdc
|
||||
|| stream->unk3bac != stream->unk3be0
|
||||
|| stream->unk3bb4 != stream->unk3be4
|
||||
|| stream->unk3bc0 != stream->unk3be8
|
||||
} else if (stream->version != stream->initialversion
|
||||
|| stream->layer != stream->initiallayer
|
||||
|| stream->crctype != stream->initialcrctype
|
||||
|| stream->samplerateindex != stream->initialsamplerateindex
|
||||
|| stream->channelmode != stream->initialchannelmode
|
||||
|| stream->unk3bcc != stream->unk3bf0) {
|
||||
return func00043ef8(stream, -1);
|
||||
}
|
||||
|
||||
stream->unk2068 = 4;
|
||||
|
||||
if (stream->unk3bac == 0) {
|
||||
sp1c = stream->unk04(stream->unk00, &stream->unk2024[4], 2, -1);
|
||||
if (stream->crctype == CRC_PROTECTED) {
|
||||
sp1c = stream->unk04(stream->unk00, &stream->buffer[4], 2, -1);
|
||||
|
||||
if (sp1c < 1) {
|
||||
return 0;
|
||||
if (sp1c <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
stream->unk18 += 2;
|
||||
stream->unk2064 += 16;
|
||||
stream->count += 16;
|
||||
stream->unk2068 = 6;
|
||||
}
|
||||
|
||||
if (stream->unk3ba8 == 1) {
|
||||
if (stream->layer == LAYER_3) {
|
||||
stream->unk8478 = mp3decDecodeFrame;
|
||||
stream->unk847c = func00042e38;
|
||||
} else if (stream->unk3ba8 == 2) {
|
||||
return 0;
|
||||
} else if (stream->unk3ba8 == 3) {
|
||||
return 0;
|
||||
stream->unk847c = mp3decSetSideInfo;
|
||||
} else if (stream->layer == LAYER_2) {
|
||||
return false;
|
||||
} else if (stream->layer == LAYER_1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stream->unk847c(stream) == 0) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 func00044404(void)
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ glabel func00046290
|
||||
jr $ra
|
||||
add $t0, $t0, $s1
|
||||
|
||||
glabel func000462c4
|
||||
glabel mp3decGetBits
|
||||
lw $t0, 0x0($a1)
|
||||
srl $t1, $t0, 0x3
|
||||
add $a0, $a0, $t1
|
||||
|
||||
Reference in New Issue
Block a user