mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Merge branch 'audio_bgm' into voice
This commit is contained in:
@@ -162,6 +162,11 @@ build/src/code/audio/%.o: OPTFLAGS := -O2
|
||||
build/src/boot_O2_g3/fault.o: CFLAGS += -trapuv
|
||||
build/src/boot_O2_g3/fault_drawer.o: CFLAGS += -trapuv
|
||||
|
||||
build/src/code/jpegutils.o: OPTFLAGS := -O2
|
||||
build/src/code/jpegdecoder.o: OPTFLAGS := -O2
|
||||
build/src/code/jpegutils.o: CC := $(CC_OLD)
|
||||
build/src/code/jpegdecoder.o: CC := $(CC_OLD)
|
||||
|
||||
build/src/libultra/libc/ll.o: OPTFLAGS := -O1
|
||||
build/src/libultra/libc/ll.o: MIPS_VERSION := -mips3 -32
|
||||
build/src/libultra/libc/llcvt.o: OPTFLAGS := -O1
|
||||
|
||||
+247
-107
@@ -1,7 +1,8 @@
|
||||
#ifndef _ABI_H_
|
||||
#define _ABI_H_
|
||||
#ifndef ULTRA64_ABI_H
|
||||
#define ULTRA64_ABI_H
|
||||
|
||||
/* Audio commands: */
|
||||
/*
|
||||
#define A_SPNOOP 0
|
||||
#define A_ADPCM 1
|
||||
#define A_CLEARBUFF 2
|
||||
@@ -18,12 +19,37 @@
|
||||
#define A_INTERLEAVE 13
|
||||
#define A_POLEF 14
|
||||
#define A_SETLOOP 15
|
||||
*/
|
||||
|
||||
#define A_SPNOOP 0
|
||||
#define A_ADPCM 1
|
||||
#define A_CLEARBUFF 2
|
||||
#define A_UNK3 3
|
||||
#define A_ADDMIXER 4
|
||||
#define A_RESAMPLE 5
|
||||
#define A_RESAMPLE_ZOH 6
|
||||
#define A_FILTER 7
|
||||
#define A_SETBUFF 8
|
||||
#define A_DUPLICATE 9
|
||||
#define A_DMEMMOVE 10
|
||||
#define A_LOADADPCM 11
|
||||
#define A_MIXER 12
|
||||
#define A_INTERLEAVE 13
|
||||
#define A_HILOGAIN 14
|
||||
#define A_SETLOOP 15
|
||||
#define A_INTERL 17
|
||||
#define A_ENVSETUP1 18
|
||||
#define A_ENVMIXER 19
|
||||
#define A_LOADBUFF 20
|
||||
#define A_SAVEBUFF 21
|
||||
#define A_ENVSETUP2 22
|
||||
#define A_S8DEC 23
|
||||
#define A_UNK19 25
|
||||
#define ACMD_SIZE 32
|
||||
|
||||
/*
|
||||
* Audio flags
|
||||
*/
|
||||
|
||||
#define A_INIT 0x01
|
||||
#define A_CONTINUE 0x00
|
||||
#define A_LOOP 0x02
|
||||
@@ -254,138 +280,252 @@ typedef short ENVMIX_STATE[40];
|
||||
* Macros to assemble the audio command list
|
||||
*/
|
||||
|
||||
#define aADPCMdec(pkt, f, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(f, 16, 8); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
#define aADPCMdec(pkt, f, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(f, 16, 8); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aPoleFilter(pkt, f, g, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(g, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
#define aPoleFilter(pkt, f, g, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(g, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aHiLoGain(pkt, gain, count, dmem, a4) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_HILOGAIN, 24, 8) | \
|
||||
_SHIFTL(gain, 16, 8) | _SHIFTL(count, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(dmem, 16, 16) | _SHIFTL(a4, 0, 16); \
|
||||
}
|
||||
|
||||
#define aUnkCmd3(pkt, a1, a2, a3) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_UNK3, 24, 8) | _SHIFTL(a3, 0, 16); \
|
||||
_a->words.w1 = _SHIFTL(a1, 16, 16) | _SHIFTL(a2, 0, 16); \
|
||||
}
|
||||
|
||||
#define aUnkCmd19(pkt, a1, a2, a3, a4) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_UNK19, 24, 8) | _SHIFTL(a1, 16, 8) | \
|
||||
_SHIFTL(a2, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(a3, 16, 16) | _SHIFTL(a4, 0, 16); \
|
||||
}
|
||||
|
||||
#define aS8Dec(pkt, a1, a2) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_S8DEC, 24, 8) | _SHIFTL(a1, 16, 8); \
|
||||
_a->words.w1 = (unsigned int)(a2); \
|
||||
}
|
||||
|
||||
#define aClearBuffer(pkt, d, c) \
|
||||
{ \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_CLEARBUFF, 24, 8) | _SHIFTL(d, 0, 24); \
|
||||
_a->words.w1 = (unsigned int)(c); \
|
||||
}
|
||||
}
|
||||
|
||||
#define aEnvMixer(pkt, f, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
#define aEnvMixer(pkt, dmemi, count, swapLR, x0, x1, x2, x3, m, bits) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (bits | _SHIFTL(dmemi >> 4, 16, 8) | \
|
||||
_SHIFTL(count, 8, 8) | _SHIFTL(swapLR, 4, 1) | \
|
||||
_SHIFTL(x0, 3, 1) | _SHIFTL(x1, 2, 1) | \
|
||||
_SHIFTL(x2, 1, 1) | _SHIFTL(x3, 0, 1)); \
|
||||
_a->words.w1 = (unsigned int)(m); \
|
||||
}
|
||||
|
||||
#define aInterleave(pkt, l, r) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
|
||||
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
|
||||
}
|
||||
#define aInterleave(pkt, o, l, r, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_INTERLEAVE, 24, 8) | \
|
||||
_SHIFTL(c >> 4, 16, 8) | _SHIFTL(o, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
|
||||
}
|
||||
|
||||
#define aLoadBuffer(pkt, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
#define aInterl(pkt, dmemi, dmemo, count) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd*)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_INTERL, 24, 8) | \
|
||||
_SHIFTL(count, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(dmemi, 16, 16) | _SHIFTL(dmemo, 0, 16); \
|
||||
}
|
||||
|
||||
#define aMix(pkt, f, g, i, o) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(g, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
|
||||
}
|
||||
#define aLoadBuffer(pkt, s, d, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8) | \
|
||||
_SHIFTL((c) >> 4, 16, 8) | _SHIFTL(d, 0, 16); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aPan(pkt, f, d, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(d, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
#define aMix(pkt, f, g, i, o) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(g, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
|
||||
}
|
||||
|
||||
#define aResample(pkt, f, p, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(p, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
#define aPan(pkt, f, d, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(d, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aSaveBuffer(pkt, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
#define aResample(pkt, f, p, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | \
|
||||
_SHIFTL(f, 16, 8) | _SHIFTL(p, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define aSegment(pkt, s, b) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \
|
||||
_a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
|
||||
}
|
||||
#define aSaveBuffer(pkt, s, d, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8) | \
|
||||
_SHIFTL((c) >> 4, 16, 8) | _SHIFTL(s, 0, 16); \
|
||||
_a->words.w1 = (unsigned int)(d); \
|
||||
}
|
||||
|
||||
#define aSegment(pkt, s, b) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \
|
||||
_a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
|
||||
}
|
||||
|
||||
#define aSetBuffer(pkt, f, i, o, c) \
|
||||
{ \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(i, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(c, 0, 16) | _SHIFTL(o, 16, 16); \
|
||||
}
|
||||
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
|
||||
}
|
||||
|
||||
#define aSetVolume(pkt, f, v, t, r) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
|
||||
_SHIFTL(v, 0, 16)); \
|
||||
/* had to change this otherwise it doesn't want to match */ \
|
||||
_a->words.w1 = (unsigned int)(r); /*_SHIFTL(r, 0, 16)|_SHIFTL(t, 16, 16) ;*/ \
|
||||
}
|
||||
#define aSetVolume(pkt, f, v, t, r) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
|
||||
_SHIFTL(v, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(r, 0, 16) | _SHIFTL(t, 16, 16); \
|
||||
}
|
||||
|
||||
#define aSetLoop(pkt, a) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
_a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \
|
||||
_a->words.w1 = (unsigned int)(a); \
|
||||
}
|
||||
#define aSetVolume32(pkt, f, v, tr) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
|
||||
_SHIFTL(v, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(tr); \
|
||||
}
|
||||
|
||||
#define aDMEMMove(pkt, i, o, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \
|
||||
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
|
||||
}
|
||||
#define aSetLoop(pkt, a) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \
|
||||
_a->words.w1 = (unsigned int)(a); \
|
||||
}
|
||||
|
||||
#define aDMEMMove(pkt, i, o, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \
|
||||
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
|
||||
}
|
||||
|
||||
#define aLoadADPCM(pkt, c, d) \
|
||||
{ \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
|
||||
_a->words.w1 = (unsigned int)d; \
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !_ABI_H_ */
|
||||
|
||||
|
||||
#define aEnvSetup1(pkt, a, b, c, d) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_ENVSETUP1, 24, 8) | \
|
||||
_SHIFTL(a, 16, 8) | _SHIFTL(b, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(c, 16, 16) | _SHIFTL(d, 0, 16); \
|
||||
}
|
||||
|
||||
#define aEnvSetup2(pkt, volLeft, volRight) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_ENVSETUP2, 24, 8); \
|
||||
_a->words.w1 = _SHIFTL(volLeft, 16, 16) | \
|
||||
_SHIFTL(volRight, 0, 16); \
|
||||
}
|
||||
|
||||
#define aFilter(pkt, f, countOrBuf, addr) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_FILTER, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(countOrBuf, 0, 16); \
|
||||
_a->words.w1 = (unsigned int)(addr); \
|
||||
}
|
||||
|
||||
#define aDuplicate(pkt, count, dmemi, dmemo, a4) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_DUPLICATE, 24, 8) | \
|
||||
_SHIFTL(count, 16, 8) | _SHIFTL(dmemi, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(dmemo, 16, 16) | _SHIFTL(a4, 0, 16); \
|
||||
}
|
||||
|
||||
#define aAddMixer(pkt, count, dmemi, dmemo, a4) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_ADDMIXER, 24, 8) | \
|
||||
_SHIFTL(count >> 4, 16, 8) | _SHIFTL(a4, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(dmemi, 16, 16) | _SHIFTL(dmemo, 0, 16); \
|
||||
}
|
||||
|
||||
#define aResampleZoh(pkt, pitch, pitchAccu) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_RESAMPLE_ZOH, 24, 8) | \
|
||||
_SHIFTL(pitch, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(pitchAccu, 0, 16); \
|
||||
}
|
||||
|
||||
#endif /* ULTRA64_ABI_H */
|
||||
|
||||
+130
@@ -3,4 +3,134 @@
|
||||
|
||||
#define NA_BGM_STOP 0x100000FF
|
||||
|
||||
#define NA_BGM_GENERAL_SFX 0x00 // General Sound Effects
|
||||
#define NA_BGM_NATURE_AMBIENCE 0x01 // Ambient background noises
|
||||
#define NA_BGM_TERMINA_FIELD 0x02 // Termina Field
|
||||
#define NA_BGM_CHASE 0x03 // Forest Chase
|
||||
#define NA_BGM_MAJORAS_THEME 0x04 // Majora's Theme "STALKID"
|
||||
#define NA_BGM_CLOCK_TOWER 0x05 // The Clock Tower
|
||||
#define NA_BGM_STONE_TOWER_TEMPLE 0x06 // Stone Tower Temple
|
||||
#define NA_BGM_INV_STONE_TOWER_TEMPLE 0x07 // Stone Tower Temple Inverted
|
||||
#define NA_BGM_FAILURE_0 0x08 // Missed Event 1
|
||||
#define NA_BGM_FAILURE_1 0x09 // Title
|
||||
#define NA_BGM_HAPPY_MASK_SALESMAN 0x0A // Mask Salesman "OMENYA"
|
||||
#define NA_BGM_SONG_OF_HEALING 0x0B // Song of Healing "DEMO_CURE"
|
||||
#define NA_BGM_SWAMP_REGION 0x0C // Southern Swamp and Woodfall "DAMP_AREA"
|
||||
#define NA_BGM_ALIEN_INVASION 0x0D // Ghost Attack "UFO"
|
||||
#define NA_BGM_SWAMP_CRUISE 0x0E // Mini Game "JUNGLE_CREWS"
|
||||
#define NA_BGM_SHARPS_CURSE 0x0F // Sharp's Curse
|
||||
#define NA_BGM_GREAT_BAY_REGION 0x10 // Great Bay Coast "SEA_AREA"
|
||||
#define NA_BGM_IKANA_REGION 0x11 // Ikana Valley
|
||||
#define NA_BGM_DEKU_KING 0x12 // Court of the Deku King
|
||||
#define NA_BGM_MOUNTAIN_REGION 0x13 // Mountain Village "SNOW_AREA"
|
||||
#define NA_BGM_PIRATES_FORTRESS 0x14 // Pirates' Fortress "PIRATE_AREA"
|
||||
#define NA_BGM_CLOCK_TOWN_DAY_1 0x15 // Clock Town Day 1 This song's filename is dummied out in MM3D "DUMMY_21"
|
||||
#define NA_BGM_CLOCK_TOWN_DAY_2 0x16 // Clock Town Day 2 his song's filename is dummied out in MM3D "DUMMY_22"
|
||||
#define NA_BGM_CLOCK_TOWN_DAY_3 0x17 // Clock Town Day 3 This song's filename is dummied out in MM3D "DUMMY_23"
|
||||
#define NA_BGM_FILE_SELECT 0x18 // This song has no track name, as it's a duplicate of the Fairy's Fountain
|
||||
#define NA_BGM_CLEAR_EVENT 0x19 // Event Clear
|
||||
#define NA_BGM_ENEMY 0x1A // Battle
|
||||
#define NA_BGM_BOSS 0x1B // Boss Battle
|
||||
#define NA_BGM_WOODFALL_TEMPLE 0x1C // Woodfall Temple "JUNGLE_DUNGEON"
|
||||
#define NA_BGM_MARKET 0x1D // Clock Town Day 1 Duplicate of #15. Interesting filename in MM3D. ✘
|
||||
#define NA_BGM_OPENING 0x1E // Forest Ambush
|
||||
#define NA_BGM_INSIDE_A_HOUSE 0x1F // House "LINK_HOUSE"
|
||||
#define NA_BGM_GAME_OVER 0x20 // Game Over
|
||||
#define NA_BGM_CLEAR_BOSS 0x21 // Boss Clear
|
||||
#define NA_BGM_GET_ITEM 0x22 // Item Catch
|
||||
#define NA_BGM_GATE_OPEN 0x23 // Clock Town Day 2 Duplicate of #16. In MM3D, it shares its filename with the Door of Time song from OoT
|
||||
#define NA_BGM_GET_HEART 0x24 // Complete a Heart Piece
|
||||
#define NA_BGM_MINI_GAME_2 0x25 // Playing Minigame
|
||||
#define NA_BGM_GORON_RACE 0x26 // Goron Race
|
||||
#define NA_BGM_MUSIC_BOX_HOUSE 0x27 // Music Box House "ORGEL_HOUSE"
|
||||
#define NA_BGM_FAIRY_FOUNTAIN 0x28 // Fairy's Fountain In MM3D, it shares its filename with the Door of Time song from OoT "GODESS"
|
||||
#define NA_BGM_ZELDAS_LULLABY 0x29 // Zelda's Lullaby "HIME"
|
||||
#define NA_BGM_ROSA_SISTERS 0x2A // Rosa Sisters' Dance "SISTER_DANCER"
|
||||
#define NA_BGM_OPEN_CHEST 0x2B // Open Chest "OPEN_TRE_BOX"
|
||||
#define NA_BGM_MARINE_RESEARCH_LAB 0x2C // Marine Research Laboratory "DRUGSTORE"
|
||||
#define NA_BGM_GIANTS_THEME 0x2D // The Four Giants "KYOJIN_ROOM"
|
||||
#define NA_BGM_SONG_OF_STORMS 0x2E // Guru-Guru's Song "FUSHA"
|
||||
#define NA_BGM_ROMANI_RANCH 0x2F // Romani Ranch "RONRON"
|
||||
#define NA_BGM_GORON_VILLAGE 0x30 // Goron Village
|
||||
#define NA_BGM_MAYORS_OFFICE 0x31 // Mayor Dotour "MEETING"
|
||||
#define NA_BGM_OCA_EPONA 0x32 // Ocarina Epona's Song
|
||||
#define NA_BGM_OCA_SUNS 0x33 // Ocarina Sun's Song
|
||||
#define NA_BGM_OCA_TIME 0x34 // Ocarina Song of Time "TIME_NORMAL"
|
||||
#define NA_BGM_OCA_STORM 0x35 // Ocarina Song of Storms
|
||||
#define NA_BGM_ZORA_HALL 0x36 // Zora Hall
|
||||
#define NA_BGM_GET_NEW_MASK 0x37 // A New Mask
|
||||
#define NA_BGM_MINI_BOSS 0x38 // Mini Boss "MIDDLE_BOSS"
|
||||
#define NA_BGM_GET_SMALL_ITEM 0x39 // Small Item Catch "S_ITEM_GET"
|
||||
#define NA_BGM_ASTRAL_OBSERVATORY 0x3A // Astral Observatory "TENMONDAI"
|
||||
#define NA_BGM_CAVERN 0x3B // Clock Town Cavern "NORMAL_DUNGEON"
|
||||
#define NA_BGM_MILK_BAR 0x3C // Milk Bar Latte
|
||||
#define NA_BGM_ZELDA_APPEAR 0x3D // Meet Zelda (OoT)
|
||||
#define NA_BGM_SARIAS_SONG 0x3E // Saria's Theme Song from OoT "MAYOIMORI"
|
||||
#define NA_BGM_GORON_GOAL 0x3F // Goron Race Goal
|
||||
#define NA_BGM_HORSE 0x40 // Gorman Race
|
||||
#define NA_BGM_HORSE_GOAL 0x41 // Race Finish
|
||||
#define NA_BGM_INGO 0x42 // Gorman Bros. "INGO"
|
||||
#define NA_BGM_KOTAKE_POTION_SHOP 0x43 // Kotake's Potion Shop "KOTAKE_KOUME"
|
||||
#define NA_BGM_SHOP 0x44 // Store
|
||||
#define NA_BGM_OWL 0x45 // Gaebora's Theme
|
||||
#define NA_BGM_MINI_GAME 0x46 // Target Practice
|
||||
#define NA_BGM_OCA_SOARING 0x47 // Ocarina Song of Soaring "OCA_BIGWING"
|
||||
#define NA_BGM_OCA_HEALING 0x48 // Ocarina Song of Healing "OCA_CURE"
|
||||
#define NA_BGM_INVERTED_SONG_OF_TIME 0x49 // Inverted Song of Time "_SPEED"
|
||||
#define NA_BGM_SONG_OF_DOUBLE_TIME 0x4A // Song of Double Time "TIME_JUMP"
|
||||
#define NA_BGM_SONATA_OF_AWAKENING 0x4B // Sonata of Awakening "DEMO_AWAKING"
|
||||
#define NA_BGM_GORON_LULLABY 0x4C // Goron Lullaby "DEMO_LULLABY"
|
||||
#define NA_BGM_NEW_WAVE_BOSSA_NOVA 0x4D // New Wave Bossa Nova "DEMO_TIDE"
|
||||
#define NA_BGM_ELEGY_OF_EMPTINESS 0x4E // Elegy of Emptiness "DEMO_SHELL"
|
||||
#define NA_BGM_OATH_TO_ORDER 0x4F // Oath to Order "DEMO_PLEDGE"
|
||||
#define NA_BGM_SWORD_TRAINING_HALL 0x50 // Sword Training "EXERCISE_HALL"
|
||||
#define NA_BGM_GORON_LULLABY_INTRO 0x51 // Ocarina Goron Lullaby Intro "DEMO_LULLABY_HALF"
|
||||
#define NA_BGM_OCA_FAIRY 0x52 // New Song "OCA_YOUSEI"
|
||||
#define NA_BGM_BREMEN_MARCH 0x53 // Bremen March "FACEMASK"
|
||||
#define NA_BGM_BALLAD_OF_THE_WIND_FISH 0x54 // Quartet performed in on the milk bar stage "QUARTET"
|
||||
#define NA_BGM_SONG_OF_SOARING 0x55 // Song of Soaring "WING_WARP"
|
||||
#define NA_BGM_MILK_BAR_DUPLICATE 0x56 // Milk Bar Latte Duplicate. "MILK_BAR_DUMMY"
|
||||
#define NA_BGM_FINAL_HOURS 0x57 // Final Hours "TIME_LIMIT"
|
||||
#define NA_BGM_MIKAU_RIFF 0x58 // Mikau's Tale "MIKAU_LIFF"
|
||||
#define NA_BGM_MIKAU_FINALE 0x59 // A single guitar chord. "MIKAU_FIN"
|
||||
#define NA_BGM_FROG_SONG 0x5A // Don Gero's Song
|
||||
#define NA_BGM_OCA_SONATA 0x5B // Ocarina Sonata of Awakening "OCA_AWAKING"
|
||||
#define NA_BGM_OCA_LULLABY 0x5C // Ocarina Goron Lullaby "OCA_LULLABY"
|
||||
#define NA_BGM_OCA_NEW_WAVE 0x5D // Ocarina New Wave Bossa Nova "OCA_TIDE"
|
||||
#define NA_BGM_OCA_ELEGY 0x5E // Ocarina Elegy of Emptiness "OCA_SHELL"
|
||||
#define NA_BGM_OCA_OATH 0x5F // Ocarina Oath to Order "OCA_PLEDGE"
|
||||
#define NA_BGM_MAJORAS_LAIR 0x60 // "LAST_DUNGEON"
|
||||
#define NA_BGM_OCA_LULLABY_INTRO 0x61 // "OCA_LULLABY_HALF"
|
||||
#define NA_BGM_OCA_GUITAR_BASS_SESSION 0x62 // Bass and Guitar Session "OCA_SESSION"
|
||||
#define NA_BGM_PIANO_SESSION 0x63 // Piano Solo "DEMO_SESSION"
|
||||
#define NA_BGM_INDIGO_GO_SESSION 0x64 // The Indigo-Go's Rehearsal "ALLPART_SESSION"
|
||||
#define NA_BGM_SNOWHEAD_TEMPLE 0x65 // Snowhead Temple "SILVER_DUNGEON"
|
||||
#define NA_BGM_GREAT_BAY_TEMPLE 0x66 // Great Bay Temple "DEEPBLUE_DUNGEON"
|
||||
#define NA_BGM_NEW_WAVE_SAXOPHONE 0x67 // "DEMO_TIDE_SAX"
|
||||
#define NA_BGM_NEW_WAVE_VOCAL 0x68 // "DEMO_TIDE_VOCAL"
|
||||
#define NA_BGM_MAJORAS_WRATH 0x69 // Majora's Wrath "MUJURA_1"
|
||||
#define NA_BGM_MAJORAS_INCARNATION 0x6A // Majora's Incarnation "MUJURA_2"
|
||||
#define NA_BGM_MAJORAS_MASK 0x6B // Majora's Mask Battle "MUJURA_3"
|
||||
#define NA_BGM_BASS_PLAY 0x6C // Bass Practice "BASS_PLAY"
|
||||
#define NA_BGM_DRUMS_PLAY 0x6D // Drums Practice "DRUMS_PLAY"
|
||||
#define NA_BGM_PIANO_PLAY 0x6E // Piano Practice "PIANO_PLAY"
|
||||
#define NA_BGM_IKANA_CASTLE 0x6F // Ikana Castle
|
||||
#define NA_BGM_GATHERING_GIANTS 0x70 // Calling the Four Giants
|
||||
#define NA_BGM_KAMARO_DANCE 0x71 // Kamaro's Dance "CAMARO_DANCE"
|
||||
#define NA_BGM_CREMIA_CARRIAGE 0x72 // Cremia's Carriage "DONKEY_CART"
|
||||
#define NA_BGM_KEATON_QUIZ 0x73 // Keaton "QUIZ"
|
||||
#define NA_BGM_END_CREDITS_1 0x74 // The End/Credits I "END_DEMO"
|
||||
#define NA_BGM_OPENING_LOOP 0x75 // Forest Ambush (?) Duplicate.
|
||||
#define NA_BGM_TITLE_THEME 0x76 // Title Screen
|
||||
#define NA_BGM_DUNGEON_APPEAR 0x77 // Surfacing of Woodfall
|
||||
#define NA_BGM_WOODFALL_CLEAR 0x78 // Woodfall Clear "PURIFICATION_0"
|
||||
#define NA_BGM_SNOWHEAD_CLEAR 0x79 // Snowhead Clear "PURIFICATION_1"
|
||||
#define NA_BGM_INTO_THE_MOON 0x7B // To the Moon
|
||||
#define NA_BGM_GOODBYE_GIANT 0x7C //
|
||||
#define NA_BGM_TATL_AND_TAEL 0x7D // Tatl and Tael "CHAT"
|
||||
#define NA_BGM_MOONS_DESTRUCTION 0x7E // Moon's Destruction "MOON_VANISH"
|
||||
#define NA_BGM_NO_MUSIC 0x7F //
|
||||
#define NA_BGM_END_CREDITS_2 0x82 // The End/Credits II "STAFFROLL2"
|
||||
#define NA_BGM_DISABLED 0xFFFF
|
||||
|
||||
#endif
|
||||
|
||||
+14
-27
@@ -1696,11 +1696,7 @@ void FireObj_Update(GlobalContext* globalCtx, FireObj* fire, Actor* actor);
|
||||
void func_800F40A0(GlobalContext* globalCtx, s32 param_2);
|
||||
// void func_800F415C(void);
|
||||
UNK_TYPE func_800F41E4(GlobalContext* globalCtx, ActorContext* actorCtx);
|
||||
// void func_800F42A0(void);
|
||||
// void func_800F43BC(void);
|
||||
// void func_800F44F4(void);
|
||||
// void func_800F4540(void);
|
||||
// s32 func_800F470C(UNK_TYPE4 param_1, UNK_TYPE4 param_2, s32 param_3, u32 param_4);
|
||||
|
||||
void func_800F4A10(GlobalContext* globalCtx);
|
||||
void func_800F4C0C(GlobalContext* globalCtx);
|
||||
void func_800F4E20(GlobalContext* globalCtx);
|
||||
@@ -1761,7 +1757,7 @@ void func_800FD654(GlobalContext* globalCtx, Color_RGB8* pzParm2, f32 fParm3);
|
||||
// u32 get_days_elapsed(void);
|
||||
// void reset_days_elapsed(void);
|
||||
// u32 get_current_day(void);
|
||||
void func_800FD750(UNK_TYPE arg0);
|
||||
void func_800FD750(u16 seqId);
|
||||
// void func_800FD768(void);
|
||||
void func_800FD78C(GlobalContext* globalCtx);
|
||||
void func_800FD858(GlobalContext* globalCtx);
|
||||
@@ -2067,7 +2063,7 @@ s32 func_8010BF58(Actor* actor, GlobalContext* globalCtx, s32* param_3, UNK_PTR
|
||||
void Nmi_Init(void);
|
||||
void Nmi_SetPrenmiStart(void);
|
||||
// s32 Nmi_GetPrenmiHasStarted(void);
|
||||
// void func_8010C1B0(void);
|
||||
void MsgEvent_SendNullTask(void);
|
||||
f32 OLib_Vec3fDist(Vec3f* a, Vec3f* b);
|
||||
f32 OLib_Vec3fDistOutDiff(Vec3f* a, Vec3f* b, Vec3f* dest);
|
||||
f32 OLib_Vec3fDistXZ(Vec3f* a, Vec3f* b);
|
||||
@@ -3413,10 +3409,12 @@ void func_8018219C(MtxF* pfParm1, Vec3s* psParm2, s32 iParm3);
|
||||
// void func_801822C4(void);
|
||||
void Matrix_InsertRotationAroundUnitVector_f(f32 rotation, Vec3f* vector, s32 appendToState);
|
||||
void Matrix_InsertRotationAroundUnitVector_s(s16 rotation, Vec3f* vector, s32 appendToState);
|
||||
|
||||
u64* SysUcode_GetUCodeBoot(void);
|
||||
u32 SysUcode_GetUCodeBootSize(void);
|
||||
u64* SysUcode_GetUCode(void);
|
||||
u64* SysUcode_GetUCodeData(void);
|
||||
|
||||
// void func_80182CE0(void);
|
||||
// void func_80183020(void);
|
||||
// void func_80183058(void);
|
||||
@@ -3874,7 +3872,7 @@ void func_8019FDC8(UNK_PTR arg0, u16 sfxId, UNK_TYPE arg2);
|
||||
void func_801A0124(Vec3f* pos, u8 arg1);
|
||||
// void func_801A0184(void);
|
||||
// void func_801A01C4(void);
|
||||
void func_801A0204(UNK_TYPE);
|
||||
void func_801A0204(s8 seqId);
|
||||
// void func_801A0238(void);
|
||||
// void func_801A026C(void);
|
||||
// void func_801A0318(void);
|
||||
@@ -3895,10 +3893,10 @@ void func_801A0204(UNK_TYPE);
|
||||
// void func_801A1904(void);
|
||||
// void func_801A1A10(void);
|
||||
// void func_801A1A8C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
void func_801A1D44(Vec3f* vec, UNK_TYPE arg1, f32 arg2);
|
||||
void func_801A1DB8(Vec3f* vec, UNK_TYPE arg1, f32 arg2);
|
||||
void func_801A1D44(Vec3f* vec, u8 seqId, f32 arg2);
|
||||
void func_801A1DB8(Vec3f* vec, u8 seqId, f32 arg2);
|
||||
// void func_801A1E0C(void);
|
||||
void func_801A1F00(s32 arg0, s32 arg1);
|
||||
void func_801A1F00(u8 arg0, u16 seqId);
|
||||
void func_801A1F88(void);
|
||||
// void func_801A1FB4(void);
|
||||
// void func_801A2090(void);
|
||||
@@ -3911,20 +3909,20 @@ void func_801A246C(u8 param_1, u8 param_2);
|
||||
// void func_801A27E8(void);
|
||||
// void func_801A281C(void);
|
||||
void func_801A29D4(UNK_TYPE arg0, f32 arg1, UNK_TYPE arg2);
|
||||
void func_801A2BB8(s32 arg0);
|
||||
void func_801A2BB8(s32 seqId);
|
||||
void func_801A2C20(void);
|
||||
// void func_801A2C44(void);
|
||||
// void func_801A2C88(void);
|
||||
// void func_801A2D54(void);
|
||||
s32 func_801A2DE0(UNK_TYPE4 arg1);
|
||||
s32 Audio_IsSequencePlaying(u8 seqId);
|
||||
void func_801A2E54(s32 param_1);
|
||||
void func_801A2ED8(void);
|
||||
// void func_801A2F88(void);
|
||||
// void func_801A3000(void);
|
||||
// void func_801A3038(void);
|
||||
void func_801A3098(u16 arg0);
|
||||
void func_801A3098(u16 seqId);
|
||||
// void func_801A312C(void);
|
||||
void func_801A31EC(UNK_TYPE1 arg1, UNK_TYPE4 arg2, u8 arg3);
|
||||
void func_801A31EC(u16 seqId, s8 arg1, u8 arg2);
|
||||
// void func_801A3238(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5);
|
||||
// void func_801A32CC(void);
|
||||
// void func_801A3590(void);
|
||||
@@ -4025,18 +4023,7 @@ s32 func_801A8A50(s32 param1);
|
||||
// void func_801A982C(void);
|
||||
// void func_801A99B8(void);
|
||||
// void func_801A9A74(void);
|
||||
// void func_801A9B10(void);
|
||||
// void func_801A9B78(void);
|
||||
// void func_801A9BFC(void);
|
||||
// void func_801A9C68(void);
|
||||
// void func_801A9D10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5);
|
||||
// void func_801A9DCC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5);
|
||||
// void func_801A9EA4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE1 param_6);
|
||||
// void func_801A9F4C(void);
|
||||
// void func_801AA020(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
||||
// void func_801AA248(void);
|
||||
// void func_801AA3E4(void);
|
||||
// void func_801AA520(void);
|
||||
|
||||
void GameOver_Init(GlobalContext* globalCtx);
|
||||
void GameOver_FadeLights(GlobalContext* globalCtx);
|
||||
void GameOver_Update(GlobalContext* globalCtx);
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ extern GraphicsContext* __gfxCtx;
|
||||
#define SQ(x) ((x) * (x))
|
||||
#define ABS(x) ((x) >= 0 ? (x) : -(x))
|
||||
#define ABS_ALT(x) ((x) < 0 ? -(x) : (x))
|
||||
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
|
||||
#define DECR(x) ((x) == 0 ? 0 : --(x))
|
||||
|
||||
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
|
||||
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
|
||||
|
||||
+4
-9
@@ -360,7 +360,7 @@ extern u16 viRetrace;
|
||||
extern DmaEntry dmadata[1568];
|
||||
// extern UNK_TYPE1 D_80186028;
|
||||
// extern UNK_TYPE1 D_801AAAB0;
|
||||
// extern UNK_TYPE1 D_801AD370;
|
||||
extern u64 gJpegUCode[];
|
||||
extern ActorInit En_A_Obj_InitVars;
|
||||
extern ColliderCylinderInit enAObjCylinderInit;
|
||||
extern InitChainEntry enAObjInitVar;
|
||||
@@ -1867,7 +1867,7 @@ extern s8 D_801DB4B8;
|
||||
// extern UNK_TYPE1 D_801DB8B8;
|
||||
// extern UNK_TYPE1 D_801DB900;
|
||||
extern UNK_PTR D_801DB930;
|
||||
extern s8018CFAC D_801DB958[21];
|
||||
extern AudioSpec D_801DB958[21];
|
||||
|
||||
// rodata
|
||||
extern f32 D_801DBDF0;
|
||||
@@ -3107,7 +3107,7 @@ extern UNK_PTR D_801E10B0;
|
||||
// extern UNK_TYPE1 D_801E1E80;
|
||||
// extern UNK_TYPE1 D_801E2160;
|
||||
// extern UNK_TYPE1 D_801E3790;
|
||||
// extern UNK_TYPE1 D_801E3F40;
|
||||
extern u64 gJpegUCodeData[];
|
||||
// extern UNK_TYPE1 D_801E3FA0;
|
||||
|
||||
// bss
|
||||
@@ -3635,7 +3635,7 @@ extern u8 sVoiceMaskPattern[];
|
||||
// extern UNK_TYPE1 D_801FE4C0;
|
||||
// extern UNK_TYPE1 D_801FE640;
|
||||
// extern UNK_TYPE1 D_801FE6D0;
|
||||
extern s801FE7C0 D_801FE7C0[1];
|
||||
extern SoundRequest D_801FE7C0[1];
|
||||
// extern UNK_TYPE1 D_801FFBC0;
|
||||
// extern UNK_TYPE1 D_801FFBC8;
|
||||
// extern UNK_TYPE1 D_801FFBD0;
|
||||
@@ -3789,11 +3789,6 @@ extern OSMesg D_80203290[1];
|
||||
// extern UNK_TYPE4 D_80208E6C;
|
||||
// extern UNK_TYPE4 D_80208E70;
|
||||
// extern UNK_TYPE4 D_80208E74;
|
||||
// extern UNK_TYPE1 D_80208E90;
|
||||
// extern UNK_TYPE1 D_80208E94;
|
||||
// extern UNK_TYPE1 D_80208E98;
|
||||
// extern UNK_TYPE1 D_80208E99;
|
||||
// extern UNK_TYPE1 D_80208E9C;
|
||||
|
||||
// post-code buffers
|
||||
extern u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
|
||||
+1
-39
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "z64actor.h"
|
||||
#include "z64animation.h"
|
||||
#include "z64audio.h"
|
||||
#include "z64bgcheck.h"
|
||||
#include "z64collision_check.h"
|
||||
#include "z64cutscene.h"
|
||||
@@ -440,29 +441,6 @@ typedef struct {
|
||||
/* 0x14 */ OSMesgQueue unk14;
|
||||
} s80185D40; // size = 0x2C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 unk0;
|
||||
/* 0x04 */ u8 unk4;
|
||||
/* 0x05 */ u8 unk5;
|
||||
/* 0x06 */ u8 unk6;
|
||||
/* 0x07 */ UNK_TYPE1 pad7[0x2];
|
||||
/* 0x09 */ u8 unk9;
|
||||
/* 0x0A */ UNK_TYPE1 padA[0x2];
|
||||
/* 0x0C */ u32 unkC;
|
||||
/* 0x10 */ u16 unk10;
|
||||
/* 0x12 */ u16 unk12;
|
||||
/* 0x14 */ u16 unk14;
|
||||
/* 0x16 */ UNK_TYPE1 pad16[0x2];
|
||||
/* 0x18 */ u32 unk18;
|
||||
/* 0x1C */ u32 unk1C;
|
||||
/* 0x20 */ u32 unk20;
|
||||
/* 0x24 */ u32 unk24;
|
||||
/* 0x28 */ u32 unk28;
|
||||
/* 0x2C */ u32 unk2C;
|
||||
/* 0x30 */ u32 unk30;
|
||||
/* 0x34 */ u32 unk34;
|
||||
} s8018CFAC; // size = 0x38
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u8 unk0;
|
||||
/* 0x1 */ u8 unk1;
|
||||
@@ -474,10 +452,6 @@ typedef struct {
|
||||
/* 0x7 */ u8 unk7;
|
||||
} s801AEC84; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ UNK_TYPE1 pad0[0x14];
|
||||
} s801FE7C0; // size = 0x14
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3f unk0;
|
||||
/* 0x0C */ Vec3f unkC;
|
||||
@@ -608,12 +582,6 @@ typedef struct {
|
||||
|
||||
typedef void(*fault_update_input_func)(Input* input);
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 noteIdx;
|
||||
/* 0x01 */ u8 state;
|
||||
/* 0x02 */ u8 pos;
|
||||
} OcarinaStaff; // size = 0x3;
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ View view;
|
||||
/* 0x168 */ u8* iconItemSegment;
|
||||
@@ -1297,12 +1265,6 @@ typedef struct ActorListEntry {
|
||||
#define OS_SC_NMI_MSG 3 // name is made up, 3 is OS_SC_RDP_DONE_MSG in the original sched.c
|
||||
#define OS_SC_PRE_NMI_MSG 4
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ OSTask task;
|
||||
/* 0x0040 */ OSMesgQueue* taskQueue;
|
||||
/* 0x0044 */ char unk_44[0xC];
|
||||
} AudioTask; // size = 0x50
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ IrqMgr* irqMgr;
|
||||
/* 0x004 */ SchedContext* sched;
|
||||
|
||||
+1186
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,99 @@
|
||||
#ifndef Z64_JPEG_H
|
||||
#define Z64_JPEG_H
|
||||
|
||||
#include "PR/ultratypes.h"
|
||||
#include "ultra64/message.h"
|
||||
#include "PR/sched.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 table[8*8];
|
||||
} JpegQuantizationTable; // size = 0x80
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 codeOffs[16];
|
||||
/* 0x10 */ u16 codesA[16];
|
||||
/* 0x30 */ u16 codesB[16];
|
||||
/* 0x50 */ u8* symbols;
|
||||
} JpegHuffmanTable; // size = 0x54
|
||||
|
||||
// this struct might be inaccurate but it's not used outside jpegutils.c
|
||||
typedef struct {
|
||||
/* 0x000 */ u8 codeOffs[16];
|
||||
/* 0x010 */ u16 dcCodes[120];
|
||||
/* 0x100 */ u16 acCodes[256];
|
||||
} JpegHuffmanTableOld; // size = 0x300
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* address;
|
||||
/* 0x04 */ u32 mbCount;
|
||||
/* 0x08 */ u32 mode;
|
||||
/* 0x0C */ void* qTableYPtr;
|
||||
/* 0x10 */ void* qTableUPtr;
|
||||
/* 0x14 */ void* qTableVPtr;
|
||||
/* 0x18 */ char unk_18[0x8];
|
||||
} JpegTaskData; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ JpegTaskData taskData;
|
||||
/* 0x020 */ char yieldData[0x200];
|
||||
/* 0x220 */ JpegQuantizationTable qTableY;
|
||||
/* 0x2A0 */ JpegQuantizationTable qTableU;
|
||||
/* 0x320 */ JpegQuantizationTable qTableV;
|
||||
/* 0x3A0 */ u8 codesLengths[0x110];
|
||||
/* 0x4B0 */ u16 codes[0x108];
|
||||
/* 0x6C0 */ u16 data[4][0x180];
|
||||
} JpegWork; // size = 0x12C0
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* imageData;
|
||||
/* 0x04 */ u8 mode;
|
||||
/* 0x05 */ u8 unk_05;
|
||||
/* 0x08 */ JpegHuffmanTable* hTablePtrs[4];
|
||||
/* 0x18 */ u8 unk_18;
|
||||
} JpegDecoder; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 dqtCount;
|
||||
/* 0x04 */ u8* dqtPtr[3];
|
||||
/* 0x10 */ u8 dhtCount;
|
||||
/* 0x14 */ u8* dhtPtr[4];
|
||||
/* 0x24 */ void* imageData;
|
||||
/* 0x28 */ u8 mode; // 0 if Y V0 is 1 and 2 if Y V0 is 2
|
||||
/* 0x30 */ OSScTask scTask;
|
||||
/* 0x98 */ OSMesgQueue mq;
|
||||
/* 0xB0 */ OSMesg msg;
|
||||
/* 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
|
||||
|
||||
|
||||
void Jpeg_ScheduleDecoderTask(JpegContext* jpegCtx);
|
||||
void Jpeg_CopyToZbuffer(u16* src, u16* zbuffer, s32 x, s32 y);
|
||||
u16 Jpeg_GetUnalignedU16(u8* ptr);
|
||||
void Jpeg_ParseMarkers(u8* ptr, JpegContext* jpegCtx);
|
||||
s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize);
|
||||
|
||||
void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 count);
|
||||
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);
|
||||
|
||||
s32 JpegDecoder_Decode(JpegDecoder* decoder, u16* mcuBuff, s32 count, u8 isFollowing, JpegDecoderState* state);
|
||||
s32 JpegDecoder_ProcessMcu(JpegHuffmanTable* hTable0, JpegHuffmanTable* hTable1, u16* mcu, s16* unk);
|
||||
s32 JpegDecoder_ParseNextSymbol(JpegHuffmanTable* hTable, s16* outCoeff, s8* outZeroCount);
|
||||
u16 JpegDecoder_ReadBits(u8 len);
|
||||
|
||||
#endif
|
||||
@@ -428,7 +428,7 @@ beginseg
|
||||
compress
|
||||
after "dmadata"
|
||||
include "build/src/code/z_en_a_keep.o"
|
||||
include "build/data/code/z_en_a_keep.data.o"
|
||||
include "build/data/code/rsp.data.o"
|
||||
include "build/data/code/code_801ADE60.data.o"
|
||||
include "build/data/code/code_801E3FA0.bss.o"
|
||||
include "build/src/code/z_en_item00.o"
|
||||
@@ -492,8 +492,8 @@ beginseg
|
||||
include "build/src/code/z_horse.o"
|
||||
include "build/data/code/z_horse.data.o"
|
||||
include "build/src/code/z_jpeg.o"
|
||||
include "build/data/code/z_jpeg.data.o"
|
||||
include "build/src/code/z_kaleido_setup.o"
|
||||
include "build/data/code/z_kaleido_setup.data.o"
|
||||
include "build/src/code/z_kanfont.o"
|
||||
include "build/src/code/z_kankyo.o"
|
||||
include "build/data/code/z_kankyo.data.o"
|
||||
@@ -676,11 +676,11 @@ beginseg
|
||||
include "build/data/code/code_801A7B10.bss.o"
|
||||
include "build/data/code/audio_init_params.rodata.o"
|
||||
include "build/src/code/jpegutils.o"
|
||||
include "build/src/code/code_801AA020.o"
|
||||
include "build/data/code/code_801AA020.bss.o"
|
||||
include "build/src/code/jpegdecoder.o"
|
||||
include_readonly "build/src/code/z_game_over.o"
|
||||
include "build/src/code/z_construct.o"
|
||||
include "build/data/code/code_801E1180.rodata.o"
|
||||
include "build/data/code/audio_sound_params.data.o"
|
||||
include "build/data/code/rsp.rodata.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2D54.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2DE0.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_IsSequencePlaying.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2E54.s")
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
|
||||
// Blocks the current thread until all currently queued scheduler tasks have been completed
|
||||
void func_8010C1B0(void) {
|
||||
void MsgEvent_SendNullTask(void) {
|
||||
OSScTask task;
|
||||
OSMesgQueue queue;
|
||||
OSMesg msg;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801AA020/func_801AA020.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801AA020/func_801AA248.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801AA020/func_801AA3E4.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801AA020/func_801AA520.s")
|
||||
@@ -0,0 +1,193 @@
|
||||
#include "z64jpeg.h"
|
||||
#include "libc/stdbool.h"
|
||||
#include "macros.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;
|
||||
u16 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, u16* mcu, s16* unk) {
|
||||
s8 i = 0;
|
||||
s8 zeroCount;
|
||||
s16 coeff;
|
||||
|
||||
if (JpegDecoder_ParseNextSymbol(hTable0, &coeff, &zeroCount)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
*unk += coeff;
|
||||
mcu[i++] = *unk;
|
||||
while (i < 8 * 8) {
|
||||
if (JpegDecoder_ParseNextSymbol(hTable1, &coeff, &zeroCount)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
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 false;
|
||||
}
|
||||
|
||||
s32 JpegDecoder_ParseNextSymbol(JpegHuffmanTable* hTable, s16* outCoeff, s8* outZeroCount) {
|
||||
u8 codeIdx;
|
||||
u8 sym;
|
||||
u16 codeOff = 0;
|
||||
u16 buff = JpegDecoder_ReadBits(16);
|
||||
|
||||
for (codeIdx = 0; codeIdx < ARRAY_COUNT(hTable->codesB); codeIdx++) {
|
||||
if (hTable->codesB[codeIdx] == 0xFFFF) {
|
||||
continue;
|
||||
}
|
||||
|
||||
codeOff = buff >> (15 - codeIdx);
|
||||
if (codeOff <= hTable->codesB[codeIdx]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (codeIdx >= ARRAY_COUNT(hTable->codesB)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
sym = hTable->symbols[hTable->codeOffs[codeIdx] + codeOff - hTable->codesA[codeIdx]];
|
||||
*outZeroCount = sym >> 4;
|
||||
sym &= 0xF;
|
||||
|
||||
sJpegBitStreamBitIdx += codeIdx - 15;
|
||||
*outCoeff = 0;
|
||||
if (sym) {
|
||||
*outCoeff = JpegDecoder_ReadBits(sym);
|
||||
if (*outCoeff < (1 << (sym - 1))) {
|
||||
*outCoeff += (-1 << sym) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
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) ? true : false;
|
||||
|
||||
sJpegBitStreamCurWord <<= 8;
|
||||
sJpegBitStreamCurWord |= data;
|
||||
sJpegBitStreamBitIdx -= 8;
|
||||
}
|
||||
|
||||
ret = (sJpegBitStreamCurWord << (sJpegBitStreamBitIdx));
|
||||
temp = ret;
|
||||
ret = temp >> -len;
|
||||
sJpegBitStreamBitIdx += len;
|
||||
return ret;
|
||||
}
|
||||
+147
-9
@@ -1,17 +1,155 @@
|
||||
#include "global.h"
|
||||
#include "z64jpeg.h"
|
||||
#include "libc/stdbool.h"
|
||||
#include "macros.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/jpegutils/func_801A9B10.s")
|
||||
void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 count) {
|
||||
u8 i;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/jpegutils/func_801A9B78.s")
|
||||
for (i = 0; i < count; i++) {
|
||||
u8 j;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/jpegutils/func_801A9BFC.s")
|
||||
dqt++;
|
||||
for (j = 0; j < ARRAY_COUNT(qt[i].table); j++) {
|
||||
qt[i].table[j] = *dqt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/jpegutils/func_801A9C68.s")
|
||||
s32 JpegUtils_ParseHuffmanCodesLengths(u8* ptr, u8* codesLengths) {
|
||||
u8 off = 1;
|
||||
s16 count = 0;
|
||||
s16 idx = 1;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/jpegutils/func_801A9D10.s")
|
||||
while (off <= 16) {
|
||||
while (idx <= ptr[off - 1]) {
|
||||
codesLengths[count++] = off;
|
||||
idx++;
|
||||
}
|
||||
idx = 1;
|
||||
off++;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/jpegutils/func_801A9DCC.s")
|
||||
codesLengths[count] = 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/jpegutils/func_801A9EA4.s")
|
||||
s32 JpegUtils_GetHuffmanCodes(u8* codesLengths, u16* codes) {
|
||||
s16 idx = 0;
|
||||
u16 code = 0;
|
||||
u8 lastLen = codesLengths[0];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/jpegutils/func_801A9F4C.s")
|
||||
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 = 0;
|
||||
|
||||
for (idx = 0; idx < 16; 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 = JpegUtils_ParseHuffmanCodesLengths(data, codesLengths);
|
||||
s32 temp;
|
||||
|
||||
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 true;
|
||||
}
|
||||
|
||||
dht += 16;
|
||||
ht[idx].symbols = dht;
|
||||
dht += codeCount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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 = *dht++ >> 4;
|
||||
s16 count2;
|
||||
s32 count;
|
||||
|
||||
count2 = count = JpegUtils_ParseHuffmanCodesLengths(dht, codesLengths);
|
||||
|
||||
if (count == 0 || (isAc && count > 0x100) || (!isAc && count > 0x10)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (JpegUtils_GetHuffmanCodes(codesLengths, codes) != count2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
JpegUtils_SetHuffmanTableOld(dht + 0x10, ht, codesLengths, codes, count2, isAc);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ SaveContext gSaveContext;
|
||||
void SaveContext_Init(void) {
|
||||
bzero(&gSaveContext, sizeof(gSaveContext));
|
||||
gSaveContext.playerForm = 0;
|
||||
gSaveContext.seqIndex = 0xFF;
|
||||
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.nightSeqIndex = 0xFF;
|
||||
gSaveContext.unk_3F46 = 0;
|
||||
gSaveContext.unk_3F46 = NA_BGM_GENERAL_SFX;
|
||||
gSaveContext.nextCutsceneIndex = 0xFFEF;
|
||||
gSaveContext.cutsceneTrigger = 0;
|
||||
gSaveContext.unk_3F4D = 0;
|
||||
|
||||
@@ -45,7 +45,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
|
||||
|
||||
gSaveContext.unk_3DC0 = 2000;
|
||||
gSaveContext.naviTimer = 0;
|
||||
gSaveContext.seqIndex = 0xFF;
|
||||
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.nightSeqIndex = 0xFF;
|
||||
gSaveContext.eventInf[0] = 0;
|
||||
gSaveContext.eventInf[1] = 0;
|
||||
@@ -66,7 +66,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
|
||||
gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
|
||||
break;
|
||||
case GAMEOVER_DEATH_FADE_OUT:
|
||||
if (func_801A8A50(1) != 32) {
|
||||
if (func_801A8A50(1) != NA_BGM_GAME_OVER) {
|
||||
func_80169F78(globalCtx);
|
||||
if (gSaveContext.respawnFlag != -7) {
|
||||
gSaveContext.respawnFlag = -6;
|
||||
|
||||
+299
-6
@@ -1,11 +1,304 @@
|
||||
#include "global.h"
|
||||
#include "z64jpeg.h"
|
||||
#include "libc/stdbool.h"
|
||||
#include "variables.h"
|
||||
#include "functions.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_800F42A0.s")
|
||||
#define MARKER_ESCAPE 0x00
|
||||
#define MARKER_SOI 0xD8
|
||||
#define MARKER_SOF 0xC0
|
||||
#define MARKER_DHT 0xC4
|
||||
#define MARKER_DQT 0xDB
|
||||
#define MARKER_DRI 0xDD
|
||||
#define MARKER_SOS 0xDA
|
||||
#define MARKER_APP0 0xE0
|
||||
#define MARKER_APP1 0xE1
|
||||
#define MARKER_APP2 0xE2
|
||||
#define MARKER_COM 0xFE
|
||||
#define MARKER_EOI 0xD9
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_800F43BC.s")
|
||||
/**
|
||||
* Configures and schedules a JPEG decoder task and waits for it to finish.
|
||||
*/
|
||||
void Jpeg_ScheduleDecoderTask(JpegContext* jpegCtx) {
|
||||
static OSTask_t sJpegTask = {
|
||||
M_NJPEGTASK, // type
|
||||
0, // flags
|
||||
NULL, // ucode_boot
|
||||
0, // ucode_boot_size
|
||||
gJpegUCode, // ucode
|
||||
0x1000, // ucode_size
|
||||
gJpegUCodeData, // ucode_data
|
||||
0x800, // ucode_data_size
|
||||
NULL, // dram_stack
|
||||
0, // dram_stack_size
|
||||
NULL, // output_buff
|
||||
NULL, // output_buff_size
|
||||
NULL, // data_ptr
|
||||
sizeof(JpegTaskData), // data_size
|
||||
NULL, // yield_data_ptr
|
||||
0x200, // yield_data_size
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_800F44F4.s")
|
||||
JpegWork* workBuf = jpegCtx->workBuf;
|
||||
s32 pad[2];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_800F4540.s")
|
||||
workBuf->taskData.address = &workBuf->data;
|
||||
workBuf->taskData.mode = jpegCtx->mode;
|
||||
workBuf->taskData.mbCount = 4;
|
||||
workBuf->taskData.qTableYPtr = &workBuf->qTableY;
|
||||
workBuf->taskData.qTableUPtr = &workBuf->qTableU;
|
||||
workBuf->taskData.qTableVPtr = &workBuf->qTableV;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_800F470C.s")
|
||||
sJpegTask.flags = 0;
|
||||
sJpegTask.ucodeBoot = SysUcode_GetUCodeBoot();
|
||||
sJpegTask.ucodeBootSize = SysUcode_GetUCodeBootSize();
|
||||
sJpegTask.yieldDataPtr = (u64*)&workBuf->yieldData;
|
||||
sJpegTask.dataPtr = (u64*)&workBuf->taskData;
|
||||
|
||||
jpegCtx->scTask.next = NULL;
|
||||
jpegCtx->scTask.flags = OS_SC_NEEDS_RSP;
|
||||
jpegCtx->scTask.msgQ = &jpegCtx->mq;
|
||||
jpegCtx->scTask.msg = NULL;
|
||||
jpegCtx->scTask.framebuffer = NULL;
|
||||
jpegCtx->scTask.list.t = sJpegTask;
|
||||
|
||||
osSendMesg(&gSchedContext.cmdQ, (OSMesg)&jpegCtx->scTask, OS_MESG_BLOCK);
|
||||
Sched_SendEntryMsg(&gSchedContext); // osScKickEntryMsg
|
||||
osRecvMesg(&jpegCtx->mq, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a 16x16 block of decoded image data to the Z-buffer.
|
||||
*/
|
||||
void Jpeg_CopyToZbuffer(u16* src, u16* zbuffer, s32 x, s32 y) {
|
||||
u16* dst = zbuffer + (((y * SCREEN_WIDTH) + x) * 16);
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
dst[3] = src[3];
|
||||
dst[4] = src[4];
|
||||
dst[5] = src[5];
|
||||
dst[6] = src[6];
|
||||
dst[7] = src[7];
|
||||
dst[8] = src[8];
|
||||
dst[9] = src[9];
|
||||
dst[10] = src[10];
|
||||
dst[11] = src[11];
|
||||
dst[12] = src[12];
|
||||
dst[13] = src[13];
|
||||
dst[14] = src[14];
|
||||
dst[15] = src[15];
|
||||
|
||||
src += 16;
|
||||
dst += SCREEN_WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an u16 from a possibly unaligned address in memory.
|
||||
*
|
||||
* Replaces unaligned 16-bit reads with a pair of aligned reads, allowing for reading the possibly
|
||||
* unaligned values in JPEG header files.
|
||||
*/
|
||||
u16 Jpeg_GetUnalignedU16(u8* ptr) {
|
||||
if (((u32)ptr & 1) == 0) {
|
||||
// Read the value normally if it's aligned to a 16-bit address.
|
||||
return *(u16*)ptr;
|
||||
} else {
|
||||
// Read unaligned values using two separate aligned memory accesses when it's not.
|
||||
return *(u16*)(ptr - 1) << 8 | (*(u16*)(ptr + 1) >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the markers in the JPEG file, storing information such as the pointer to the image data
|
||||
* in `jpegCtx` for later processing.
|
||||
*/
|
||||
void Jpeg_ParseMarkers(u8* ptr, JpegContext* jpegCtx) {
|
||||
u32 exit = false;
|
||||
|
||||
jpegCtx->dqtCount = 0;
|
||||
jpegCtx->dhtCount = 0;
|
||||
|
||||
while (true) {
|
||||
if (exit) {
|
||||
break;
|
||||
}
|
||||
|
||||
// 0xFF indicates the start of a JPEG marker, so look for the next.
|
||||
if (*ptr++ == 0xFF) {
|
||||
switch (*ptr++) {
|
||||
case MARKER_ESCAPE: {
|
||||
// Compressed value 0xFF is stored as 0xFF00 to escape it, so ignore it.
|
||||
break;
|
||||
}
|
||||
case MARKER_SOI: {
|
||||
// Start of Image
|
||||
break;
|
||||
}
|
||||
case MARKER_APP0: {
|
||||
// Application marker for JFIF
|
||||
ptr += Jpeg_GetUnalignedU16(ptr);
|
||||
break;
|
||||
}
|
||||
case MARKER_APP1: {
|
||||
// Application marker for EXIF
|
||||
ptr += Jpeg_GetUnalignedU16(ptr);
|
||||
break;
|
||||
}
|
||||
case MARKER_APP2: {
|
||||
ptr += Jpeg_GetUnalignedU16(ptr);
|
||||
break;
|
||||
}
|
||||
case MARKER_DQT: {
|
||||
// Define Quantization Table, stored for later processing
|
||||
jpegCtx->dqtPtr[jpegCtx->dqtCount++] = ptr + 2;
|
||||
ptr += Jpeg_GetUnalignedU16(ptr);
|
||||
break;
|
||||
}
|
||||
case MARKER_DHT: {
|
||||
// Define Huffman Table, stored for later processing
|
||||
jpegCtx->dhtPtr[jpegCtx->dhtCount++] = ptr + 2;
|
||||
ptr += Jpeg_GetUnalignedU16(ptr);
|
||||
break;
|
||||
}
|
||||
case MARKER_DRI: {
|
||||
// Define Restart Interval
|
||||
ptr += Jpeg_GetUnalignedU16(ptr);
|
||||
break;
|
||||
}
|
||||
case MARKER_SOF: {
|
||||
// Start of Frame, stores important metadata of the image.
|
||||
// Only used for extracting the sampling factors (jpegCtx->mode).
|
||||
|
||||
if (ptr[9] == 0x21) {
|
||||
// component Y : V0 == 1
|
||||
jpegCtx->mode = 0;
|
||||
} else if (ptr[9] == 0x22) {
|
||||
// component Y : V0 == 2
|
||||
jpegCtx->mode = 2;
|
||||
}
|
||||
ptr += Jpeg_GetUnalignedU16(ptr);
|
||||
break;
|
||||
}
|
||||
case MARKER_SOS: {
|
||||
// Start of Scan marker, indicates the start of the image data.
|
||||
ptr += Jpeg_GetUnalignedU16(ptr);
|
||||
jpegCtx->imageData = ptr;
|
||||
break;
|
||||
}
|
||||
case MARKER_EOI: {
|
||||
// End of Image
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ptr += Jpeg_GetUnalignedU16(ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize) {
|
||||
s32 y;
|
||||
s32 x;
|
||||
s32 j;
|
||||
s32 i;
|
||||
JpegContext jpegCtx;
|
||||
JpegHuffmanTable hTables[4];
|
||||
JpegDecoder decoder;
|
||||
JpegDecoderState state;
|
||||
JpegWork* workBuff = work;
|
||||
|
||||
if (workSize < sizeof(JpegWork)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
osCreateMesgQueue(&jpegCtx.mq, &jpegCtx.msg, 1);
|
||||
MsgEvent_SendNullTask();
|
||||
|
||||
jpegCtx.workBuf = workBuff;
|
||||
|
||||
Jpeg_ParseMarkers(data, &jpegCtx);
|
||||
|
||||
switch (jpegCtx.dqtCount) {
|
||||
case 1:
|
||||
JpegUtils_ProcessQuantizationTable(jpegCtx.dqtPtr[0], &workBuff->qTableY, 3);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
JpegUtils_ProcessQuantizationTable(jpegCtx.dqtPtr[0], &workBuff->qTableY, 1);
|
||||
JpegUtils_ProcessQuantizationTable(jpegCtx.dqtPtr[1], &workBuff->qTableU, 1);
|
||||
JpegUtils_ProcessQuantizationTable(jpegCtx.dqtPtr[1], &workBuff->qTableV, 1);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
JpegUtils_ProcessQuantizationTable(jpegCtx.dqtPtr[0], &workBuff->qTableY, 1);
|
||||
JpegUtils_ProcessQuantizationTable(jpegCtx.dqtPtr[1], &workBuff->qTableU, 1);
|
||||
JpegUtils_ProcessQuantizationTable(jpegCtx.dqtPtr[2], &workBuff->qTableV, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (jpegCtx.dhtCount) {
|
||||
case 1:
|
||||
if (JpegUtils_ProcessHuffmanTable(jpegCtx.dhtPtr[0], &hTables[0], workBuff->codesLengths, workBuff->codes,
|
||||
4)) {
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// This chained if-else has printfs inside it on debug
|
||||
if (JpegUtils_ProcessHuffmanTable(jpegCtx.dhtPtr[0], &hTables[0], workBuff->codesLengths, workBuff->codes,
|
||||
1)) {
|
||||
} else if (JpegUtils_ProcessHuffmanTable(jpegCtx.dhtPtr[1], &hTables[1], workBuff->codesLengths,
|
||||
workBuff->codes, 1)) {
|
||||
} else if (JpegUtils_ProcessHuffmanTable(jpegCtx.dhtPtr[2], &hTables[2], workBuff->codesLengths,
|
||||
workBuff->codes, 1)) {
|
||||
} else if (!JpegUtils_ProcessHuffmanTable(jpegCtx.dhtPtr[3], &hTables[3], workBuff->codesLengths,
|
||||
workBuff->codes, 1)) {
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
decoder.imageData = jpegCtx.imageData;
|
||||
decoder.mode = jpegCtx.mode;
|
||||
decoder.unk_05 = 2;
|
||||
|
||||
decoder.hTablePtrs[0] = &hTables[0];
|
||||
decoder.hTablePtrs[1] = &hTables[1];
|
||||
decoder.hTablePtrs[2] = &hTables[2];
|
||||
decoder.hTablePtrs[3] = &hTables[3];
|
||||
decoder.unk_18 = 0;
|
||||
|
||||
x = y = 0;
|
||||
for (i = 0; i < 300; i += 4) {
|
||||
if (!JpegDecoder_Decode(&decoder, (u16*)workBuff->data, 4, (i != 0), &state)) {
|
||||
Jpeg_ScheduleDecoderTask(&jpegCtx);
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
Jpeg_CopyToZbuffer(workBuff->data[j], zbuffer, x, y);
|
||||
x++;
|
||||
|
||||
if (x >= 20) {
|
||||
x = 0;
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -449,7 +449,7 @@ void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
globalCtx->soundCtx.seqIndex = cmd->soundSettings.musicSeq;
|
||||
globalCtx->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX;
|
||||
|
||||
if (gSaveContext.seqIndex == 0xFF || func_801A8A50(0) == 0x57) {
|
||||
if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED || func_801A8A50(0) == NA_BGM_FINAL_HOURS) {
|
||||
audio_setBGM(cmd->soundSettings.bgmId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1005,7 +1005,7 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (spB0->unk_0144 >= 10) {
|
||||
Audio_QueueSeqCmd(0x8021);
|
||||
Audio_QueueSeqCmd(NA_BGM_CLEAR_BOSS | 0x8000);
|
||||
}
|
||||
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_INBOSS_DEAD_OLD);
|
||||
@@ -1342,7 +1342,7 @@ void func_809DC78C(Actor* thisx, GlobalContext* globalCtx) {
|
||||
if (D_809E0430 != 0) {
|
||||
D_809E0430--;
|
||||
if (D_809E0430 == 0) {
|
||||
Audio_QueueSeqCmd(0x801B);
|
||||
Audio_QueueSeqCmd(NA_BGM_BOSS | 0x8000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user