mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-07-11 14:08:37 -04:00
Remove mp3 support
This commit is contained in:
@@ -72,7 +72,6 @@
|
||||
build/ROMID/lib/naudio/n_csplayer.o (section); \
|
||||
build/ROMID/lib/naudio/n_cspsetbank.o (section); \
|
||||
build/ROMID/lib/ultra/audio/bnkf.o (section); \
|
||||
build/ROMID/lib/mp3.o (section); \
|
||||
build/ROMID/lib/naudio/n_cspgetstate.o (section); \
|
||||
build/ROMID/lib/naudio/n_csq.o (section); \
|
||||
build/ROMID/lib/naudio/n_cspsetseq.o (section); \
|
||||
@@ -104,21 +103,13 @@
|
||||
build/ROMID/lib/naudio/n_synfilter11.o (section); \
|
||||
build/ROMID/lib/ultra/audio/cseq.o (section); \
|
||||
build/ROMID/lib/naudio/n_env.o (section); \
|
||||
build/ROMID/lib/mp3/decoder.o (section); \
|
||||
build/ROMID/lib/mp3/main.o (section); \
|
||||
build/ROMID/lib/naudio/n_cspsendmidi.o (section); \
|
||||
build/ROMID/lib/naudio/n_auxbus.o (section); \
|
||||
build/ROMID/lib/naudio/n_mainbus.o (section); \
|
||||
build/ROMID/lib/naudio/n_synsetpriority.o (section); \
|
||||
build/ROMID/lib/naudio/n_load.o (section); \
|
||||
build/ROMID/lib/naudio/n_resample2.o (section); \
|
||||
build/ROMID/lib/mp3/lib_45ed0.o (section); \
|
||||
build/ROMID/lib/mp3/util.o (section); \
|
||||
build/ROMID/lib/mp3/lib_46650.o (section); \
|
||||
build/ROMID/lib/mp3/lib_47550.o (section); \
|
||||
build/ROMID/lib/naudio/n_resample.o (section); \
|
||||
build/ROMID/lib/mp3/lib_47d20.o (section); \
|
||||
build/ROMID/lib/mp3/lib_47ef0.o (section); \
|
||||
build/ROMID/lib/ultra/io/vitbl.o (section); \
|
||||
build/ROMID/lib/ultra/os/writebackdcacheall.o (section); \
|
||||
build/ROMID/lib/ultra/os/invalicache.o (section); \
|
||||
|
||||
@@ -447,7 +447,6 @@ void lvReset(s32 stagenum)
|
||||
}
|
||||
|
||||
paksReset();
|
||||
sndResetCurMp3();
|
||||
|
||||
if (stagenum == STAGE_BOOTPAKMENU) {
|
||||
bootmenuReset();
|
||||
@@ -2557,9 +2556,7 @@ void lvSetPaused(bool paused)
|
||||
{
|
||||
if (paused) {
|
||||
pakDisableRumbleForAllPlayers();
|
||||
snd0000fe20();
|
||||
} else {
|
||||
snd0000fe50();
|
||||
pakEnableRumbleForAllPlayers();
|
||||
}
|
||||
|
||||
|
||||
+19
-77
@@ -201,9 +201,7 @@ void func0f092a98(s32 channelnum)
|
||||
propDecrementSoundCount(channel->prop);
|
||||
}
|
||||
|
||||
if ((channel->flags & AUDIOCHANNELFLAG_ISMP3)) {
|
||||
snd0000fbc4(channel->soundnum26);
|
||||
} else if (channel->audiohandle && sndGetState(channel->audiohandle) != AL_STOPPED) {
|
||||
if (channel->audiohandle && sndGetState(channel->audiohandle) != AL_STOPPED) {
|
||||
audioStop(channel->audiohandle);
|
||||
}
|
||||
|
||||
@@ -3441,13 +3439,11 @@ void propsndTickChannel(s32 channelnum)
|
||||
&& channel->unk28 != 11
|
||||
&& ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED)
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_0002)
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_1000)
|
||||
|| ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3())))
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_1000)))
|
||||
#else
|
||||
if ((channel->audiohandle != NULL && sndGetState(channel->audiohandle) != AL_STOPPED)
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_0002)
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_1000)
|
||||
|| ((channel->flags & AUDIOCHANNELFLAG_ISMP3) && sndIsPlayingMp3()))
|
||||
|| (channel->flags & AUDIOCHANNELFLAG_1000))
|
||||
#endif
|
||||
{
|
||||
struct coord *pos = NULL; // 50
|
||||
@@ -3633,49 +3629,27 @@ void propsndTickChannel(s32 channelnum)
|
||||
|
||||
if ((channel->flags & AUDIOCHANNELFLAG_2000) == 0) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_1000) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
sndStartMp3(channel->soundnum26, sp48, sp44, (channel->flags2 & AUDIOCHANNELFLAG2_0001) ? 1 : 0);
|
||||
} else {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (channel->flags & AUDIOCHANNELFLAG_0400) {
|
||||
if (sp48) {
|
||||
snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
}
|
||||
} else {
|
||||
if (sp48) {
|
||||
snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
}
|
||||
if (channel->flags & AUDIOCHANNELFLAG_0400) {
|
||||
if (sp48) {
|
||||
snd00010718(&channel->audiohandle, 0, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
}
|
||||
} else {
|
||||
if (sp48) {
|
||||
snd00010718(&channel->audiohandle, 0, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
}
|
||||
#else
|
||||
snd00010718(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
channel->flags &= ~AUDIOCHANNELFLAG_1000;
|
||||
} else {
|
||||
sndAdjust(&channel->audiohandle, channel->flags & AUDIOCHANNELFLAG_ISMP3, sp48, sp44,
|
||||
sndAdjust(&channel->audiohandle, 0, sp48, sp44,
|
||||
channel->soundnum26, sp3c, channel->unk1a, sp40, channel->flags & AUDIOCHANNELFLAG_4000);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (channel->unk28 != 11) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
if (!sndIsPlayingMp3()) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
propDecrementSoundCount(channel->prop);
|
||||
}
|
||||
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) {
|
||||
hudmsgsHideByChannel(channelnum);
|
||||
}
|
||||
}
|
||||
|
||||
channel->flags = AUDIOCHANNELFLAG_IDLE;
|
||||
} else if (channel->audiohandle == NULL) {
|
||||
if (channel->audiohandle == NULL) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
propDecrementSoundCount(channel->prop);
|
||||
}
|
||||
@@ -3683,25 +3657,6 @@ void propsndTickChannel(s32 channelnum)
|
||||
channel->flags = AUDIOCHANNELFLAG_IDLE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (channel->flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
if (!sndIsPlayingMp3()) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
propDecrementSoundCount(channel->prop);
|
||||
}
|
||||
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORHUDMSG) {
|
||||
hudmsgsHideByChannel(channelnum);
|
||||
}
|
||||
}
|
||||
} else if (channel->audiohandle == NULL) {
|
||||
if (channel->flags & AUDIOCHANNELFLAG_FORPROP) {
|
||||
propDecrementSoundCount(channel->prop);
|
||||
}
|
||||
}
|
||||
|
||||
channel->flags = AUDIOCHANNELFLAG_IDLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (var8006ae44 && (channel->flags2 & AUDIOCHANNELFLAG2_0004)) {
|
||||
@@ -4095,23 +4050,10 @@ s16 propsnd0f0939f8(
|
||||
|
||||
channel->flags |= AUDIOCHANNELFLAG_1000;
|
||||
|
||||
if (sndIsMp3(soundnum)) {
|
||||
channel->flags |= AUDIOCHANNELFLAG_ISMP3;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
prevpri = osGetThreadPri(0);
|
||||
osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1);
|
||||
propsndTickChannel(channel->channelnum);
|
||||
osSetThreadPri(0, prevpri);
|
||||
#else
|
||||
propsndTickChannel(channel->channelnum);
|
||||
#endif
|
||||
} else {
|
||||
prevpri = osGetThreadPri(0);
|
||||
osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1);
|
||||
propsndTickChannel(channel->channelnum);
|
||||
osSetThreadPri(0, prevpri);
|
||||
}
|
||||
prevpri = osGetThreadPri(0);
|
||||
osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1);
|
||||
propsndTickChannel(channel->channelnum);
|
||||
osSetThreadPri(0, prevpri);
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (channel->flags & AUDIOCHANNELFLAG_0400) {
|
||||
@@ -4611,7 +4553,7 @@ void func0f09505c(struct sndstate *handle, struct coord *pos, f32 arg2, f32 arg3
|
||||
|
||||
sp4c = propsnd0f0946b0(pos, arg2, arg3, arg4, rooms, soundnum, arg7, arg8);
|
||||
pan = propsnd0f094d78(pos, arg2, arg3, arg4, *arg8, sp50, 0);
|
||||
sndAdjust(&handle, sndIsMp3(soundnum), sp4c, pan, soundnum, 1.0f, 1, -1, 1);
|
||||
sndAdjust(&handle, false, sp4c, pan, soundnum, 1.0f, 1, -1, 1);
|
||||
}
|
||||
|
||||
s32 propsndGetRandomSparkSound(void)
|
||||
|
||||
@@ -12,7 +12,6 @@ void propsndStop(void)
|
||||
|
||||
for (i = 0; i < (IS4MB() ? 30 : 40); i++) {
|
||||
if (g_AudioChannels[i].flags & AUDIOCHANNELFLAG_ISMP3) {
|
||||
snd0000fbc4(g_AudioChannels[i].soundnum26);
|
||||
g_AudioChannels[i].flags &= ~AUDIOCHANNELFLAG_ISMP3;
|
||||
g_AudioChannels[i].flags &= ~AUDIOCHANNELFLAG_0002;
|
||||
} else if (g_AudioChannels[i].audiohandle && sndGetState(g_AudioChannels[i].audiohandle) != AL_STOPPED) {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef _IN_LIB_MP3_H
|
||||
#define _IN_LIB_MP3_H
|
||||
#include <ultra64.h>
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
void mp3Init(ALHeap *heap);
|
||||
void mp3PlayFile(s32 romaddr, s32 filesize);
|
||||
void func00037e1c(void);
|
||||
void func00037e38(void);
|
||||
void func00037e68(void);
|
||||
s32 func00037ea4(void);
|
||||
void func00037f08(s32 arg0, bool arg1);
|
||||
void func00037f5c(s32 arg0, bool arg1);
|
||||
s32 func00037fc0(s32 arg0, Acmd **cmd);
|
||||
void func00038924(struct mp3vars *vars);
|
||||
void func00038b90(void *fn);
|
||||
void mp3Dma(void);
|
||||
|
||||
#endif
|
||||
@@ -5,11 +5,9 @@
|
||||
#include "types.h"
|
||||
|
||||
bool sndIsFiltered(s32 audioid);
|
||||
bool sndIsPlayingMp3(void);
|
||||
u16 snd0000e9dc(void);
|
||||
void sndSetSfxVolume(u16 volume);
|
||||
void snd0000ea80(u16 volume);
|
||||
void sndResetCurMp3(void);
|
||||
void sndLoadSfxCtl(void);
|
||||
void sndIncrementAges(void);
|
||||
ALEnvelope *sndLoadEnvelope(u32 offset, u16 index);
|
||||
@@ -21,26 +19,15 @@ void sndSetSoundMode(s32 mode);
|
||||
ALSound *sndLoadSound(s16 soundnum);
|
||||
void seqInit(struct seqinstance *seq);
|
||||
void sndInit(void);
|
||||
bool sndIsMp3(s16 soundnum);
|
||||
bool snd0000fbc4(s16 arg0);
|
||||
bool seqPlay(struct seqinstance *seq, s32 tracknum);
|
||||
u16 seqGetVolume(struct seqinstance *seq);
|
||||
void seqSetVolume(struct seqinstance *seq, u16 volume);
|
||||
void snd0000fe18(void);
|
||||
void snd0000fe20(void);
|
||||
void snd0000fe50(void);
|
||||
void sndTick(void);
|
||||
bool sndIsDisabled(void);
|
||||
void sndStartMp3ByFilenum(u32 filenum);
|
||||
void sndAdjust(struct sndstate **handle, s32 arg1, s32 arg2, s32 pan, s32 soundnum, f32 arg5, s32 arg6, s32 arg7, s32 arg8);
|
||||
struct sndstate *snd00010718(struct sndstate **handle, s32 arg1, s32 arg2, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7, s32 arg8);
|
||||
struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7);
|
||||
void sndStartMp3(s16 soundnum, s32 arg1, s32 arg2, s32 arg3);
|
||||
void sndPlayNosedive(s32 seconds);
|
||||
void sndStopNosedive(void);
|
||||
void sndTickNosedive(void);
|
||||
void sndPlayUfo(s32 seconds);
|
||||
void sndStopUfo(void);
|
||||
void sndTickUfo(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1973,8 +1973,6 @@ void mainTick(void)
|
||||
|
||||
void mainEndStage(void)
|
||||
{
|
||||
sndStopNosedive();
|
||||
|
||||
if (!g_MainIsEndscreen) {
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
pak0f11c6d0();
|
||||
|
||||
-400
@@ -1,400 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include <n_libaudio.h>
|
||||
#include "naudio/n_abi.h"
|
||||
#include "lib/mp3.h"
|
||||
#include "mp3/mp3.h"
|
||||
#include "types.h"
|
||||
|
||||
/**
|
||||
* These two ABI commands are used in this file, but the format of the data
|
||||
* doesn't match the format used by n_audio's ABI.
|
||||
*/
|
||||
#define acmd07(pkt, a, b) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
_a->words.w0 = _SHIFTL(0x07, 24, 8) | _SHIFTL(a, 0, 16); \
|
||||
_a->words.w1 = b; \
|
||||
}
|
||||
|
||||
#define acmd08(pkt, a) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
_a->words.w0 = _SHIFTL(0x08, 24, 8); \
|
||||
_a->words.w1 = a; \
|
||||
}
|
||||
|
||||
struct mp3vars g_Mp3Vars;
|
||||
struct asistream *g_AsiStream;
|
||||
|
||||
s32 func00038ba8(s32 arg0, u8 *arg1, s32 arg2, s32 arg3);
|
||||
|
||||
extern f32 *var8009c6d8;
|
||||
extern f32 *var8009c6dc;
|
||||
extern struct mp3decfourbytes *var8009c640;
|
||||
extern f32 *var8009c644;
|
||||
|
||||
void mp3Init(ALHeap *heap)
|
||||
{
|
||||
bzero(&g_Mp3Vars, sizeof(struct mp3vars));
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
rmonPrintf("MPEG : RWI -> Allocating %d bytes for ASISTREAM from audio heap\n", sizeof(struct asistream));
|
||||
#endif
|
||||
|
||||
g_AsiStream = alHeapAlloc(heap, sizeof(struct asistream), 1);
|
||||
var8005f6f8 = alHeapAlloc(heap, 1, 0x2200);
|
||||
var8005f6fc = alHeapAlloc(heap, 1, 0x2200);
|
||||
|
||||
var8009c6d8 = alHeapAlloc(heap, 256 * sizeof(f32), 1);
|
||||
var8009c6dc = alHeapAlloc(heap, 256 * sizeof(f32), 1);
|
||||
var8009c640 = alHeapAlloc(heap, 10500 * sizeof(struct mp3decfourbytes), 1);
|
||||
var8009c644 = alHeapAlloc(heap, 8192 * sizeof(f32), 1);
|
||||
|
||||
mp3mainInit();
|
||||
|
||||
g_Mp3Vars.var8009c398 = alHeapAlloc(heap, 1, 0x50);
|
||||
*(u8 **)((u32)&g_Mp3Vars+0x44) = alHeapAlloc(heap, 1, 0x440);
|
||||
|
||||
g_Mp3Vars.var8009c3e0 = 0;
|
||||
g_Mp3Vars.var8009c3e4 = 0x7fff;
|
||||
g_Mp3Vars.var8009c3ec = g_Mp3Vars.var8009c3ee = 0x40;
|
||||
g_Mp3Vars.var8009c39e = 0x7fff;
|
||||
g_Mp3Vars.var8009c39c = 0x40;
|
||||
|
||||
g_Mp3Vars.ivol1 = (n_eqpower[g_Mp3Vars.var8009c39c & 0x7f] * g_Mp3Vars.var8009c39e) >> 15;
|
||||
g_Mp3Vars.ivol2 = (n_eqpower[127 - (g_Mp3Vars.var8009c39c & 0x7f)] * g_Mp3Vars.var8009c39e) >> 15;
|
||||
|
||||
g_Mp3Vars.var8009c3b4 = 1;
|
||||
g_Mp3Vars.var8009c3a4 = 0x7ffc;
|
||||
|
||||
if (g_Mp3Vars.var8009c39c & 0x80) {
|
||||
g_Mp3Vars.var8009c3a6 = 1;
|
||||
} else {
|
||||
g_Mp3Vars.var8009c3a6 = 0;
|
||||
}
|
||||
|
||||
func00038b90(func00038ba8);
|
||||
}
|
||||
|
||||
void mp3PlayFile(s32 romaddr, s32 filesize)
|
||||
{
|
||||
if (g_Mp3Vars.var8009c3dc == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_Mp3Vars.romaddr = romaddr;
|
||||
g_Mp3Vars.filesize = filesize;
|
||||
g_Mp3Vars.var8009c3c4 = 0;
|
||||
g_Mp3Vars.var8009c3e8 = 0;
|
||||
g_Mp3Vars.var8009c3e4 = 0x7fff;
|
||||
g_Mp3Vars.var8009c3f0 = 5;
|
||||
|
||||
mp3Dma();
|
||||
|
||||
g_Mp3Vars.var8009c3e0 = 4;
|
||||
}
|
||||
|
||||
void func00037e1c(void)
|
||||
{
|
||||
g_Mp3Vars.var8009c3e0 = 3;
|
||||
}
|
||||
|
||||
void func00037e38(void)
|
||||
{
|
||||
if (g_Mp3Vars.var8009c3e0 == 1) {
|
||||
g_Mp3Vars.var8009c3e0 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void func00037e68(void)
|
||||
{
|
||||
if (g_Mp3Vars.var8009c3e0 == 2) {
|
||||
g_Mp3Vars.var8009c3f0 = 5;
|
||||
g_Mp3Vars.var8009c3e0 = 5;
|
||||
}
|
||||
}
|
||||
|
||||
s32 func00037ea4(void)
|
||||
{
|
||||
if (g_Mp3Vars.var8009c3e0 == 1
|
||||
|| g_Mp3Vars.var8009c3e0 == 4
|
||||
|| g_Mp3Vars.var8009c3e0 == 5
|
||||
|| g_Mp3Vars.var8009c3e0 == 2) {
|
||||
return g_Mp3Vars.var8009c3e0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void func00037f08(s32 arg0, bool arg1)
|
||||
{
|
||||
if (arg0 < 0) {
|
||||
g_Mp3Vars.var8009c3e4 = 0;
|
||||
} else if (arg0 > 0x7fff) {
|
||||
g_Mp3Vars.var8009c3e4 = 0x7fff;
|
||||
} else {
|
||||
g_Mp3Vars.var8009c3e4 = arg0;
|
||||
}
|
||||
|
||||
g_Mp3Vars.var8009c3e8 = arg1;
|
||||
}
|
||||
|
||||
void func00037f5c(s32 arg0, bool arg1)
|
||||
{
|
||||
if (arg0 > 255) {
|
||||
arg0 = 255;
|
||||
}
|
||||
|
||||
if (arg0 < 0) {
|
||||
arg0 = 0;
|
||||
}
|
||||
|
||||
g_Mp3Vars.var8009c3ee = arg0;
|
||||
|
||||
if (arg1) {
|
||||
g_Mp3Vars.var8009c3ec = g_Mp3Vars.var8009c3ee;
|
||||
}
|
||||
}
|
||||
|
||||
void func00037fa8(s32 arg0, s32 arg1)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
s32 func00037fc0(s32 arg0, Acmd **cmd)
|
||||
{
|
||||
s32 i;
|
||||
s32 sp60;
|
||||
s32 sp5c = 0;
|
||||
struct mp3thing *sp58;
|
||||
struct mp3thing *sp54 = NULL;
|
||||
s32 sp50;
|
||||
s32 sp4c = 0x4e0;
|
||||
s32 sp48 = 0x650;
|
||||
|
||||
if (g_Mp3Vars.var8009c3ec != g_Mp3Vars.var8009c3ee) {
|
||||
sp60 = g_Mp3Vars.var8009c3ee - g_Mp3Vars.var8009c3ec;
|
||||
|
||||
if (sp60 >= -2 && sp60 <= 2) {
|
||||
g_Mp3Vars.var8009c3ec += sp60;
|
||||
} else if (sp60 >= 3) {
|
||||
g_Mp3Vars.var8009c3ec += 2;
|
||||
} else {
|
||||
g_Mp3Vars.var8009c3ec -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Mp3Vars.var8009c3e0 == 4) {
|
||||
mp3Dma();
|
||||
|
||||
if (g_Mp3Vars.var8009c3f0 == 0) {
|
||||
g_Mp3Vars.var8009c394 = mp3main00044460(0, g_Mp3Vars.var8009c3dc, g_Mp3Vars.filesize);
|
||||
|
||||
if (g_Mp3Vars.var8009c394 == NULL) {
|
||||
g_Mp3Vars.var8009c3e0 = 0;
|
||||
return 0;
|
||||
} else {
|
||||
g_Mp3Vars.var8009c3e0 = 1;
|
||||
g_Mp3Vars.var8009c3b4 = 1;
|
||||
g_Mp3Vars.var8009c3c8 = 0;
|
||||
g_Mp3Vars.var8009c3cc = 0;
|
||||
g_Mp3Vars.var8009c3d0 = 0;
|
||||
g_Mp3Vars.var8009c3d8 = 0;
|
||||
|
||||
bzero(*(u32 **)&g_Mp3Vars.var8009c3d4, 0x440);
|
||||
}
|
||||
} else {
|
||||
g_Mp3Vars.var8009c3f0--;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Mp3Vars.var8009c3e0 == 5) {
|
||||
mp3Dma();
|
||||
|
||||
if (g_Mp3Vars.var8009c3f0 == 0) {
|
||||
g_Mp3Vars.var8009c3e0 = 1;
|
||||
} else {
|
||||
g_Mp3Vars.var8009c3f0--;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Mp3Vars.var8009c3e0 == 1) {
|
||||
if (arg0 + g_Mp3Vars.var8009c3d0 > g_Mp3Vars.var8009c3cc) {
|
||||
g_Mp3Vars.var8009c3cc -= g_Mp3Vars.var8009c3d0;
|
||||
|
||||
if (g_Mp3Vars.var8009c3cc != 0 && g_Mp3Vars.var8009c3c8 != 0) {
|
||||
sp54 = (struct mp3thing *)(g_Mp3Vars.var8009c3d0 + g_Mp3Vars.var8009c3c8->unk00);
|
||||
sp50 = g_Mp3Vars.var8009c3cc;
|
||||
}
|
||||
|
||||
g_Mp3Vars.var8009c3d0 = 0;
|
||||
g_Mp3Vars.var8009c3cc = 0;
|
||||
|
||||
if (mp3main0004453c(g_Mp3Vars.var8009c394, &sp58, &sp5c)) {
|
||||
g_Mp3Vars.var8009c3c8 = sp58;
|
||||
|
||||
for (i = 0; i < sp5c; i++) {
|
||||
acmd08((*cmd)++, osVirtualToPhysical(g_Mp3Vars.var8009c3d4_arr[i]));
|
||||
acmd07((*cmd)++, g_Mp3Vars.var8009c3d8, osVirtualToPhysical(sp58));
|
||||
|
||||
sp58++;
|
||||
}
|
||||
|
||||
g_Mp3Vars.var8009c3d8 = (g_Mp3Vars.var8009c3d8 - 0x24) & 0x1e;
|
||||
g_Mp3Vars.var8009c3cc = 0x240;
|
||||
g_Mp3Vars.var8009c3f1 = sp5c == 2;
|
||||
} else {
|
||||
// empty
|
||||
}
|
||||
}
|
||||
|
||||
mp3Dma();
|
||||
|
||||
if (g_Mp3Vars.var8009c3f1 == 0) {
|
||||
sp4c = 0;
|
||||
}
|
||||
|
||||
if (sp54 != NULL) {
|
||||
n_aLoadBuffer((*cmd)++, sp50 + sp50, sp4c, osVirtualToPhysical(sp54));
|
||||
|
||||
if (g_Mp3Vars.var8009c3f1) {
|
||||
sp54++;
|
||||
n_aLoadBuffer((*cmd)++, sp50 + sp50, sp48, osVirtualToPhysical(sp54));
|
||||
}
|
||||
|
||||
sp4c += sp50 + sp50;
|
||||
sp48 += sp50 + sp50;
|
||||
arg0 -= sp50;
|
||||
}
|
||||
|
||||
if (arg0 > 0 && g_Mp3Vars.var8009c3c8) {
|
||||
sp54 = (struct mp3thing *)(g_Mp3Vars.var8009c3d0 * 2 + (u32)g_Mp3Vars.var8009c3c8);
|
||||
|
||||
n_aLoadBuffer((*cmd)++, arg0 + arg0, sp4c, osVirtualToPhysical(sp54));
|
||||
|
||||
if (g_Mp3Vars.var8009c3f1) {
|
||||
sp54++;
|
||||
n_aLoadBuffer((*cmd)++, arg0 + arg0, sp48, osVirtualToPhysical(sp54));
|
||||
}
|
||||
|
||||
g_Mp3Vars.var8009c3d0 += arg0;
|
||||
}
|
||||
|
||||
func00038924(&g_Mp3Vars);
|
||||
|
||||
if (!g_Mp3Vars.var8009c3f1) {
|
||||
aClearBuffer((*cmd)++, 0x4e0, 0x2e0);
|
||||
|
||||
if (g_Mp3Vars.var8009c3b4) {
|
||||
g_Mp3Vars.var8009c3b4 = 0;
|
||||
|
||||
g_Mp3Vars.var8009c3ac = n_eqpower[g_Mp3Vars.var8009c39c & 0x7f] * g_Mp3Vars.var8009c39e >> 0xf;
|
||||
g_Mp3Vars.ratem1 = _getRate(g_Mp3Vars.ivol1, g_Mp3Vars.var8009c3ac, g_Mp3Vars.var8009c3bc, &g_Mp3Vars.ratel1);
|
||||
|
||||
g_Mp3Vars.var8009c3b2 = n_eqpower[0x7f - (g_Mp3Vars.var8009c39c & 0x7f)] * g_Mp3Vars.var8009c39e >> 0xf;
|
||||
g_Mp3Vars.ratem2 = _getRate(g_Mp3Vars.ivol2, g_Mp3Vars.var8009c3b2, g_Mp3Vars.var8009c3bc, &g_Mp3Vars.ratel2);
|
||||
|
||||
n_aSetVolume((*cmd)++, A_VOL | A_LEFT, g_Mp3Vars.ivol1, g_Mp3Vars.var8009c3a4, g_Mp3Vars.var8009c3a6);
|
||||
n_aSetVolume((*cmd)++, A_VOL | A_RIGHT, g_Mp3Vars.var8009c3b2, g_Mp3Vars.ratem2, g_Mp3Vars.ratel2);
|
||||
n_aSetVolume((*cmd)++, A_RATE, g_Mp3Vars.var8009c3ac, g_Mp3Vars.ratem1, g_Mp3Vars.ratel1);
|
||||
n_aEnvMixer((*cmd)++, 1, g_Mp3Vars.ivol2, osVirtualToPhysical(g_Mp3Vars.var8009c398));
|
||||
} else {
|
||||
n_aEnvMixer((*cmd)++, 0, 0, osVirtualToPhysical(g_Mp3Vars.var8009c398));
|
||||
}
|
||||
|
||||
g_Mp3Vars.samples += 184;
|
||||
|
||||
if (g_Mp3Vars.samples > g_Mp3Vars.var8009c3bc) {
|
||||
g_Mp3Vars.samples = g_Mp3Vars.var8009c3bc;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void func00038924(struct mp3vars *vars)
|
||||
{
|
||||
if (vars->var8009c39e != vars->var8009c3e4 || vars->var8009c39c != vars->var8009c3ec) {
|
||||
if (vars->samples >= vars->var8009c3bc) {
|
||||
vars->var8009c3ac = (n_eqpower[vars->var8009c39c & 0x7f] * vars->var8009c39e >> 15);
|
||||
vars->var8009c3b2 = (n_eqpower[127 - (vars->var8009c39c & 0x7f)] * vars->var8009c39e >> 15);
|
||||
vars->samples = vars->var8009c3bc;
|
||||
vars->ivol1 = vars->var8009c3ac;
|
||||
vars->ivol2 = vars->var8009c3b2;
|
||||
} else {
|
||||
vars->ivol1 = _getVol(vars->ivol1, vars->samples, vars->ratem1, vars->ratel1);
|
||||
vars->ivol2 = _getVol(vars->ivol2, vars->samples, vars->ratem2, vars->ratel2);
|
||||
}
|
||||
|
||||
if (vars->ivol1 == 0) {
|
||||
vars->ivol1 = 1;
|
||||
}
|
||||
|
||||
if (vars->ivol2 == 0) {
|
||||
vars->ivol2 = 1;
|
||||
}
|
||||
|
||||
vars->var8009c39e = vars->var8009c3e4;
|
||||
|
||||
if (vars->var8009c39c != vars->var8009c3ec) {
|
||||
if (var8009c340.headphone) {
|
||||
vars->var8009c39c = ((s16)(vars->var8009c3ec & 0x7f) >> 1) + 32;
|
||||
} else {
|
||||
if (var8009c340.mono) {
|
||||
vars->var8009c39c = 64;
|
||||
} else {
|
||||
vars->var8009c39c = vars->var8009c3ec;
|
||||
}
|
||||
}
|
||||
|
||||
vars->var8009c39c &= (vars->var8009c3ec & 0x80) + 0x7f;
|
||||
|
||||
vars->var8009c3a6 = (vars->var8009c39c & 0x80) ? 1 : 0;
|
||||
}
|
||||
|
||||
vars->samples = 0;
|
||||
vars->var8009c3bc = (vars->var8009c3e8 + 183) / 184 * 184;
|
||||
vars->var8009c3b4 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void func00038b90(void *fn)
|
||||
{
|
||||
g_Mp3Vars.var8009c3dc = fn;
|
||||
}
|
||||
|
||||
s32 func00038ba8(s32 arg0, u8 *arg1, s32 arg2, s32 arg3)
|
||||
{
|
||||
u32 sp1c;
|
||||
ALDMAproc proc;
|
||||
|
||||
if (arg3 != -1) {
|
||||
g_Mp3Vars.var8009c3c4 = arg3;
|
||||
}
|
||||
|
||||
if (g_Mp3Vars.var8009c3c4 + arg2 > g_Mp3Vars.filesize) {
|
||||
arg2 = g_Mp3Vars.filesize - g_Mp3Vars.var8009c3c4;
|
||||
}
|
||||
|
||||
proc = n_syn->dma(&sp1c);
|
||||
sp1c = OS_K0_TO_PHYSICAL(proc(g_Mp3Vars.romaddr + g_Mp3Vars.var8009c3c4, arg2, 0));
|
||||
|
||||
bcopy((u8 *)sp1c, arg1, arg2);
|
||||
|
||||
g_Mp3Vars.var8009c3c4 += arg2;
|
||||
|
||||
return arg2;
|
||||
}
|
||||
|
||||
void mp3Dma(void)
|
||||
{
|
||||
u32 state;
|
||||
ALDMAproc proc;
|
||||
|
||||
proc = n_syn->dma(&state);
|
||||
|
||||
proc(g_Mp3Vars.romaddr + g_Mp3Vars.var8009c3c4, 0x400, 0);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
||||
#ifndef _IN_LIB_MP3_INTERNAL_H
|
||||
#define _IN_LIB_MP3_INTERNAL_H
|
||||
#include <ultra64.h>
|
||||
#include "mp3.h"
|
||||
|
||||
bool mp3decInit(void);
|
||||
bool mp3decSetSideInfo(struct asistream *stream);
|
||||
bool mp3decDecodeFrame(struct asistream *stream);
|
||||
|
||||
s32 mp3main00043dd0(struct asistream *stream);
|
||||
|
||||
f32 func00045ed0(f32 arg0, f32 arg1);
|
||||
|
||||
s32 mp3utilGetBits(u8 *buffer, s32 *count, s32 numbits);
|
||||
s32 mp3util000462f8(u8 *arg0, s32 *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s16 **arg6, u8 **arg7);
|
||||
s32 mp3util000464a8(u8 *arg0, s32 *arg1, s32 arg2, s32 arg3, s32 arg4, s16 **arg5, u8 **arg6);
|
||||
|
||||
void func00046650(struct asistream_4f64 *arg0, s32 arg1, struct asistream_4f64 *arg2, struct asistream_4f64 *arg3, void *arg4);
|
||||
|
||||
void func00047550(struct asistream_4f64 *arg0, s32 arg1, struct asistream_4f64 *arg2, struct asistream_4f64 *arg3);
|
||||
|
||||
f32 func00047d20(f32 arg0);
|
||||
|
||||
f32 func00047ef0(f32 arg0);
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include "internal.h"
|
||||
|
||||
f32 func00045ed0(f32 arg0, f32 arg1)
|
||||
{
|
||||
s32 arg1int = arg1;
|
||||
f32 sp30;
|
||||
register bool s0;
|
||||
|
||||
if (arg0 != 0 && arg1 == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (arg0 == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((arg0 == 0 && arg1 == 0) || (arg0 < 0 && arg1int != arg1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (arg1int != arg1) {
|
||||
arg0 = func00047d20(func00047ef0(arg0) * arg1);
|
||||
} else if (arg1 > 0) {
|
||||
arg1--;
|
||||
sp30 = arg0;
|
||||
|
||||
for (s0 = (arg1-- != 0); s0; s0 = (arg1-- != 0)) {
|
||||
arg0 *= sp30;
|
||||
}
|
||||
} else {
|
||||
sp30 = 1;
|
||||
|
||||
for (s0 = (arg1++ != 0); s0; s0 = (arg1++ != 0)) {
|
||||
sp30 /= arg0;
|
||||
}
|
||||
|
||||
arg0 = sp30;
|
||||
}
|
||||
|
||||
return arg0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,348 +0,0 @@
|
||||
#include "asm_helper.h"
|
||||
#include "macros.inc"
|
||||
.set noat
|
||||
.set noreorder
|
||||
|
||||
.text
|
||||
|
||||
glabel func00047550
|
||||
addiu $sp, $sp, -0xd0
|
||||
or $t0, $sp, $zero
|
||||
addiu $t1, $t0, 0xd0
|
||||
.L0004755c:
|
||||
sw $zero, 0x0($t0)
|
||||
sw $zero, 0x4($t0)
|
||||
sw $zero, 0x8($t0)
|
||||
sw $zero, 0xc($t0)
|
||||
addiu $t0, $t0, 0x10
|
||||
bne $t0, $t1, .L0004755c
|
||||
nop
|
||||
or $t2, $a0, $zero
|
||||
or $t3, $sp, $zero
|
||||
addiu $t4, $t3, 0x40
|
||||
or $t6, $t4, $zero
|
||||
addiu $t5, $zero, 0x3
|
||||
.L0004758c:
|
||||
lwc1 $f4, 0x14($t2)
|
||||
lwc1 $f6, 0x10($t2)
|
||||
add.s $f4, $f4, $f6
|
||||
lwc1 $f8, 0x10($t2)
|
||||
lwc1 $f10, 0xc($t2)
|
||||
add.s $f8, $f8, $f10
|
||||
swc1 $f4, 0x14($t2)
|
||||
swc1 $f8, 0x10($t2)
|
||||
lwc1 $f4, 0xc($t2)
|
||||
lwc1 $f6, 0x8($t2)
|
||||
add.s $f4, $f4, $f6
|
||||
lwc1 $f8, 0x8($t2)
|
||||
lwc1 $f10, 0x4($t2)
|
||||
add.s $f8, $f8, $f10
|
||||
swc1 $f4, 0xc($t2)
|
||||
swc1 $f8, 0x8($t2)
|
||||
lwc1 $f4, 0x4($t2)
|
||||
lwc1 $f6, 0x0($t2)
|
||||
add.s $f4, $f4, $f6
|
||||
lwc1 $f8, 0x14($t2)
|
||||
lwc1 $f10, 0xc($t2)
|
||||
add.s $f8, $f8, $f10
|
||||
swc1 $f4, 0x4($t2)
|
||||
swc1 $f8, 0x14($t2)
|
||||
lwc1 $f4, 0xc($t2)
|
||||
lwc1 $f6, 0x4($t2)
|
||||
add.s $f4, $f4, $f6
|
||||
swc1 $f4, 0xc($t2)
|
||||
lwc1 $f4, 0x8($t2)
|
||||
lui $at, %hi(var70059d9c)
|
||||
lwc1 $f6, %lo(var70059d9c)($at)
|
||||
mul.s $f6, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x10($t2)
|
||||
lui $at, 0x3f00
|
||||
mtc1 $at, $f10
|
||||
nop
|
||||
lwc1 $f16, 0x0($t2)
|
||||
mul.s $f10, $f8, $f10
|
||||
nop
|
||||
add.s $f18, $f16, $f10
|
||||
sub.s $f0, $f16, $f8
|
||||
swc1 $f0, 0x4($t3)
|
||||
add.s $f0, $f18, $f6
|
||||
swc1 $f0, 0x0($t3)
|
||||
sub.s $f0, $f18, $f6
|
||||
swc1 $f0, 0x8($t3)
|
||||
lwc1 $f4, 0xc($t2)
|
||||
lui $at, %hi(var70059da0)
|
||||
lwc1 $f6, %lo(var70059da0)($at)
|
||||
mul.s $f6, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x14($t2)
|
||||
lui $at, 0x3f00
|
||||
mtc1 $at, $f10
|
||||
nop
|
||||
lwc1 $f16, 0x4($t2)
|
||||
mul.s $f10, $f8, $f10
|
||||
nop
|
||||
add.s $f18, $f16, $f10
|
||||
sub.s $f0, $f16, $f8
|
||||
swc1 $f0, 0x10($t3)
|
||||
add.s $f0, $f18, $f6
|
||||
swc1 $f0, 0x14($t3)
|
||||
sub.s $f0, $f18, $f6
|
||||
swc1 $f0, 0xc($t3)
|
||||
lwc1 $f4, 0xc($t3)
|
||||
lui $at, %hi(var70059da4)
|
||||
lwc1 $f6, %lo(var70059da4)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x10($t3)
|
||||
lui $at, %hi(var70059da8)
|
||||
lwc1 $f10, %lo(var70059da8)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0xc($t3)
|
||||
swc1 $f8, 0x10($t3)
|
||||
lwc1 $f4, 0x14($t3)
|
||||
lui $at, %hi(var70059dac)
|
||||
lwc1 $f6, %lo(var70059dac)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
swc1 $f4, 0x14($t3)
|
||||
lwc1 $f4, 0x0($t3)
|
||||
lwc1 $f6, 0x14($t3)
|
||||
add.s $f8, $f4, $f6
|
||||
swc1 $f8, 0x0($t3)
|
||||
sub.s $f10, $f4, $f6
|
||||
swc1 $f10, 0x14($t3)
|
||||
lwc1 $f4, 0x4($t3)
|
||||
lwc1 $f6, 0x10($t3)
|
||||
add.s $f8, $f4, $f6
|
||||
swc1 $f8, 0x4($t3)
|
||||
sub.s $f8, $f4, $f6
|
||||
swc1 $f8, 0x10($t3)
|
||||
lwc1 $f4, 0x8($t3)
|
||||
lwc1 $f6, 0xc($t3)
|
||||
add.s $f8, $f4, $f6
|
||||
swc1 $f8, 0x8($t3)
|
||||
sub.s $f8, $f4, $f6
|
||||
swc1 $f8, 0xc($t3)
|
||||
lwc1 $f4, 0x0($t3)
|
||||
lui $at, %hi(var70059db0)
|
||||
lwc1 $f6, %lo(var70059db0)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x4($t3)
|
||||
lui $at, %hi(var70059db4)
|
||||
lwc1 $f10, %lo(var70059db4)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0x0($t3)
|
||||
swc1 $f8, 0x4($t3)
|
||||
lwc1 $f4, 0x8($t3)
|
||||
lui $at, %hi(var70059db8)
|
||||
lwc1 $f6, %lo(var70059db8)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0xc($t3)
|
||||
lui $at, %hi(var70059dbc)
|
||||
lwc1 $f10, %lo(var70059dbc)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0x8($t3)
|
||||
swc1 $f8, 0xc($t3)
|
||||
lwc1 $f4, 0x10($t3)
|
||||
lui $at, %hi(var70059dc0)
|
||||
lwc1 $f6, %lo(var70059dc0)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x14($t3)
|
||||
lui $at, %hi(var70059dc4)
|
||||
lwc1 $f10, %lo(var70059dc4)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0x10($t3)
|
||||
swc1 $f8, 0x14($t3)
|
||||
lwc1 $f4, 0x0($t3)
|
||||
lui $at, %hi(var70059dc8)
|
||||
lwc1 $f6, %lo(var70059dc8)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x0($t3)
|
||||
lui $at, %hi(var70059dcc)
|
||||
lwc1 $f10, %lo(var70059dcc)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0x20($t3)
|
||||
swc1 $f8, 0x24($t3)
|
||||
lwc1 $f4, 0x4($t3)
|
||||
lui $at, %hi(var70059dd0)
|
||||
lwc1 $f6, %lo(var70059dd0)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x4($t3)
|
||||
lui $at, %hi(var70059dd4)
|
||||
lwc1 $f10, %lo(var70059dd4)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0x1c($t3)
|
||||
swc1 $f8, 0x28($t3)
|
||||
lwc1 $f4, 0x8($t3)
|
||||
lui $at, %hi(var70059dd8)
|
||||
lwc1 $f6, %lo(var70059dd8)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x8($t3)
|
||||
lui $at, %hi(var70059ddc)
|
||||
lwc1 $f10, %lo(var70059ddc)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0x18($t3)
|
||||
swc1 $f8, 0x2c($t3)
|
||||
lwc1 $f4, 0xc($t3)
|
||||
lui $at, 0x3f80
|
||||
mtc1 $at, $f6
|
||||
nop
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x10($t3)
|
||||
lui $at, %hi(var70059de0)
|
||||
lwc1 $f10, %lo(var70059de0)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0x0($t3)
|
||||
swc1 $f8, 0x4($t3)
|
||||
lwc1 $f4, 0x14($t3)
|
||||
lui $at, %hi(var70059de4)
|
||||
lwc1 $f6, %lo(var70059de4)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x14($t3)
|
||||
lui $at, %hi(var70059de8)
|
||||
lwc1 $f10, %lo(var70059de8)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0x8($t3)
|
||||
swc1 $f8, 0xc($t3)
|
||||
lwc1 $f4, 0x10($t3)
|
||||
lui $at, %hi(var70059dec)
|
||||
lwc1 $f6, %lo(var70059dec)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
lwc1 $f8, 0x0($t3)
|
||||
lui $at, %hi(var70059df0)
|
||||
lwc1 $f10, %lo(var70059df0)($at)
|
||||
mul.s $f8, $f8, $f10
|
||||
nop
|
||||
swc1 $f4, 0x10($t3)
|
||||
swc1 $f8, 0x14($t3)
|
||||
lwc1 $f4, 0x0($t3)
|
||||
lui $at, %hi(var70059df4)
|
||||
lwc1 $f6, %lo(var70059df4)($at)
|
||||
mul.s $f4, $f4, $f6
|
||||
nop
|
||||
swc1 $f4, 0x0($t3)
|
||||
lwc1 $f4, 0x18($t4)
|
||||
lwc1 $f6, 0x0($t3)
|
||||
add.s $f4, $f4, $f6
|
||||
lwc1 $f8, 0x1c($t4)
|
||||
lwc1 $f10, 0x4($t3)
|
||||
add.s $f8, $f8, $f10
|
||||
swc1 $f4, 0x18($t4)
|
||||
swc1 $f8, 0x1c($t4)
|
||||
lwc1 $f4, 0x20($t4)
|
||||
lwc1 $f6, 0x8($t3)
|
||||
add.s $f4, $f4, $f6
|
||||
lwc1 $f8, 0x24($t4)
|
||||
lwc1 $f10, 0xc($t3)
|
||||
add.s $f8, $f8, $f10
|
||||
swc1 $f4, 0x20($t4)
|
||||
swc1 $f8, 0x24($t4)
|
||||
lwc1 $f4, 0x28($t4)
|
||||
lwc1 $f6, 0x10($t3)
|
||||
add.s $f4, $f4, $f6
|
||||
lwc1 $f8, 0x2c($t4)
|
||||
lwc1 $f10, 0x14($t3)
|
||||
add.s $f8, $f8, $f10
|
||||
swc1 $f4, 0x28($t4)
|
||||
swc1 $f8, 0x2c($t4)
|
||||
lwc1 $f4, 0x30($t4)
|
||||
lwc1 $f6, 0x18($t3)
|
||||
add.s $f4, $f4, $f6
|
||||
lwc1 $f8, 0x34($t4)
|
||||
lwc1 $f10, 0x1c($t3)
|
||||
add.s $f8, $f8, $f10
|
||||
swc1 $f4, 0x30($t4)
|
||||
swc1 $f8, 0x34($t4)
|
||||
lwc1 $f4, 0x38($t4)
|
||||
lwc1 $f6, 0x20($t3)
|
||||
add.s $f4, $f4, $f6
|
||||
lwc1 $f8, 0x3c($t4)
|
||||
lwc1 $f10, 0x24($t3)
|
||||
add.s $f8, $f8, $f10
|
||||
swc1 $f4, 0x38($t4)
|
||||
swc1 $f8, 0x3c($t4)
|
||||
lwc1 $f4, 0x40($t4)
|
||||
lwc1 $f6, 0x28($t3)
|
||||
add.s $f4, $f4, $f6
|
||||
lwc1 $f8, 0x44($t4)
|
||||
lwc1 $f10, 0x2c($t3)
|
||||
add.s $f8, $f8, $f10
|
||||
swc1 $f4, 0x40($t4)
|
||||
swc1 $f8, 0x44($t4)
|
||||
addi $t2, $t2, 0x18
|
||||
addi $t4, $t4, 0x18
|
||||
addi $t5, $t5, -1
|
||||
bnez $t5, .L0004758c
|
||||
nop
|
||||
or $t0, $a2, $zero
|
||||
or $t1, $a3, $zero
|
||||
or $t4, $t6, $zero
|
||||
andi $a1, $a1, 0x1
|
||||
beqz $a1, .L00047a24
|
||||
nop
|
||||
addiu $t5, $zero, 0x9
|
||||
.L000479e0:
|
||||
lwc1 $f4, 0x0($t4)
|
||||
lwc1 $f6, 0x0($t1)
|
||||
add.s $f6, $f4, $f6
|
||||
lwc1 $f8, 0x4($t4)
|
||||
neg.s $f8, $f8
|
||||
lwc1 $f10, 0x4($t1)
|
||||
sub.s $f10, $f8, $f10
|
||||
swc1 $f6, 0x0($t0)
|
||||
swc1 $f10, 0x4($t0)
|
||||
addi $t0, $t0, 0x8
|
||||
addi $t1, $t1, 0x8
|
||||
addi $t4, $t4, 0x8
|
||||
addi $t5, $t5, -1
|
||||
bnez $t5, .L000479e0
|
||||
nop
|
||||
b .L00047a50
|
||||
nop
|
||||
.L00047a24:
|
||||
addiu $t5, $zero, 0x12
|
||||
.L00047a28:
|
||||
lwc1 $f4, 0x0($t4)
|
||||
lwc1 $f6, 0x0($t1)
|
||||
add.s $f4, $f4, $f6
|
||||
swc1 $f4, 0x0($t0)
|
||||
addi $t0, $t0, 0x4
|
||||
addi $t1, $t1, 0x4
|
||||
addi $t4, $t4, 0x4
|
||||
addi $t5, $t5, -1
|
||||
bnez $t5, .L00047a28
|
||||
nop
|
||||
.L00047a50:
|
||||
or $t1, $a3, $zero
|
||||
addi $t4, $t6, 0x48
|
||||
addiu $t5, $zero, 0x12
|
||||
.L00047a5c:
|
||||
lwc1 $f4, 0x0($t4)
|
||||
swc1 $f4, 0x0($t1)
|
||||
addi $t1, $t1, 0x4
|
||||
addi $t4, $t4, 0x4
|
||||
addi $t5, $t5, -1
|
||||
bnez $t5, .L00047a5c
|
||||
nop
|
||||
addiu $sp, $sp, 0xd0
|
||||
jr $ra
|
||||
nop
|
||||
@@ -1,60 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include "internal.h"
|
||||
|
||||
f32 fabsf(f32 value);
|
||||
|
||||
#ifdef __sgi
|
||||
#pragma intrinsic (fabsf)
|
||||
#else
|
||||
#define fabsf(f) __builtin_fabsf((f32)(f))
|
||||
#endif
|
||||
|
||||
f32 func00047d20(f32 arg0)
|
||||
{
|
||||
f32 sp1c;
|
||||
f32 sp18;
|
||||
f32 sp14;
|
||||
f32 sp10;
|
||||
f32 sp0c;
|
||||
s32 sp08;
|
||||
s32 sp04;
|
||||
|
||||
sp0c = fabsf(arg0);
|
||||
|
||||
if (sp0c < 0.00000011920929f) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
sp04 = (s32) (sp0c / 0.6931471824646f);
|
||||
|
||||
if (sp04 > 1024) {
|
||||
if (arg0 >= 0) {
|
||||
return MAXFLOAT;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sp10 = sp0c - sp04 * 0.6931471824646f;
|
||||
sp08 = 1;
|
||||
sp1c = 1;
|
||||
sp18 = 1;
|
||||
|
||||
do {
|
||||
sp14 = sp1c;
|
||||
sp18 *= sp10 / sp08;
|
||||
sp1c += sp18;
|
||||
sp08++;
|
||||
} while (sp1c != sp14);
|
||||
|
||||
while (sp04) {
|
||||
sp1c *= 2;
|
||||
sp04--;
|
||||
}
|
||||
|
||||
if (arg0 >= 0) {
|
||||
return sp1c;
|
||||
} else {
|
||||
return 1 / sp1c;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include "internal.h"
|
||||
|
||||
f32 func00047ef0(f32 arg0)
|
||||
{
|
||||
s32 sp14;
|
||||
f32 sp10;
|
||||
f32 sp0c;
|
||||
f32 sp08;
|
||||
f32 sp04;
|
||||
|
||||
if (arg0 < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (arg0 == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sp08 = 0;
|
||||
|
||||
while (arg0 >= 2) {
|
||||
arg0 /= 2;
|
||||
sp08 += 0.6931471824646f;
|
||||
}
|
||||
|
||||
while (arg0 < 1) {
|
||||
arg0 *= 2;
|
||||
sp08 -= 0.6931471824646f;
|
||||
}
|
||||
|
||||
sp14 = 1;
|
||||
sp10 = (arg0 - 1) / (arg0 + 1);
|
||||
sp0c = 2 * sp10;
|
||||
sp10 *= sp10;
|
||||
|
||||
do {
|
||||
sp04 = sp08;
|
||||
sp08 += sp0c / sp14;
|
||||
sp0c *= sp10;
|
||||
sp14 += 2;
|
||||
} while (sp08 != sp04);
|
||||
|
||||
return sp08;
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include "internal.h"
|
||||
#include "mp3.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;
|
||||
extern struct asistream *g_AsiStream;
|
||||
|
||||
struct mp3decfourbytes var8009c650[34];
|
||||
f32 *var8009c6d8;
|
||||
f32 *var8009c6dc;
|
||||
|
||||
u32 var8005f700 = 0;
|
||||
u32 var8005f704 = 0;
|
||||
|
||||
s32 mp3main00043dd0(struct asistream *stream)
|
||||
{
|
||||
s32 sp1c = 0x1000;
|
||||
s32 sp18;
|
||||
|
||||
if (stream->unk201c + stream->unk3f88 > 0x1ffb) {
|
||||
bcopy(&stream->unk1c[sp1c], &stream->unk1c, sp1c);
|
||||
stream->unk201c -= sp1c;
|
||||
stream->unk2020 -= sp1c * 8;
|
||||
}
|
||||
|
||||
sp18 = stream->unk04(stream->unk00, &stream->unk1c[stream->unk201c], stream->unk3f88, -1);
|
||||
|
||||
if (sp18 < stream->unk3f88) {
|
||||
bzero(&stream->unk1c[sp18], stream->unk3f88 - sp18);
|
||||
}
|
||||
|
||||
stream->unk18 += stream->unk3f88;
|
||||
stream->unk201c += stream->unk3f88;
|
||||
|
||||
return stream->unk201c - stream->unk3f88;
|
||||
}
|
||||
|
||||
bool mp3main00043ef8(struct asistream *stream, s32 arg1)
|
||||
{
|
||||
s32 sp24;
|
||||
s32 sp20;
|
||||
s32 sp1c;
|
||||
u8 mask;
|
||||
|
||||
if (arg1 != -1) {
|
||||
stream->unk18 = arg1;
|
||||
}
|
||||
|
||||
sp24 = arg1;
|
||||
sp20 = 0;
|
||||
mask = 0xff;
|
||||
|
||||
while (true) {
|
||||
sp1c = stream->unk04(stream->unk00, &stream->buffer[sp20], 1, sp24);
|
||||
|
||||
if (sp1c <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sp24 = -1;
|
||||
stream->unk18++;
|
||||
|
||||
if ((stream->buffer[sp20] & mask) != mask) {
|
||||
mask = 0xff;
|
||||
sp20 = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
sp20++;
|
||||
|
||||
if (mask == 0xf0) {
|
||||
break;
|
||||
}
|
||||
|
||||
mask = 0xf0;
|
||||
}
|
||||
|
||||
sp1c = stream->unk04(stream->unk00, &stream->buffer[2], 2, -1);
|
||||
|
||||
if (sp1c <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
stream->unk18 += 2;
|
||||
stream->count = 12;
|
||||
|
||||
stream->version = mp3utilGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->layer = mp3utilGetBits(stream->buffer, &stream->count, 2);
|
||||
stream->crctype = mp3utilGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->bitrateindex = mp3utilGetBits(stream->buffer, &stream->count, 4);
|
||||
stream->samplerateindex = mp3utilGetBits(stream->buffer, &stream->count, 2);
|
||||
stream->haspadding = mp3utilGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->privatebit = mp3utilGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->channelmode = mp3utilGetBits(stream->buffer, &stream->count, 2);
|
||||
|
||||
stream->unk3bc4 = mp3utilGetBits(stream->buffer, &stream->count, 2);
|
||||
stream->unk3bc8 = mp3utilGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->unk3bcc = mp3utilGetBits(stream->buffer, &stream->count, 1);
|
||||
stream->unk3bd0 = mp3utilGetBits(stream->buffer, &stream->count, 2);
|
||||
|
||||
if (stream->bitrateindex == 15 || stream->samplerateindex == 3) {
|
||||
return mp3main00043ef8(stream, -1);
|
||||
}
|
||||
|
||||
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->version != stream->initialversion
|
||||
|| stream->layer != stream->initiallayer
|
||||
|| stream->crctype != stream->initialcrctype
|
||||
|| stream->samplerateindex != stream->initialsamplerateindex
|
||||
|| stream->channelmode != stream->initialchannelmode
|
||||
|| stream->unk3bcc != stream->unk3bf0) {
|
||||
return mp3main00043ef8(stream, -1);
|
||||
}
|
||||
|
||||
stream->unk2068 = 4;
|
||||
|
||||
if (stream->crctype == CRC_PROTECTED) {
|
||||
sp1c = stream->unk04(stream->unk00, &stream->buffer[4], 2, -1);
|
||||
|
||||
if (sp1c <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
stream->unk18 += 2;
|
||||
stream->count += 16;
|
||||
stream->unk2068 = 6;
|
||||
}
|
||||
|
||||
if (stream->layer == LAYER_3) {
|
||||
stream->unk8478 = mp3decDecodeFrame;
|
||||
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 false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 mp3mainInit(void)
|
||||
{
|
||||
if (var8005f704++) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
mp3decInit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct asistream *mp3main00044460(s32 arg0, void *arg1, s32 arg2)
|
||||
{
|
||||
struct asistream *stream = g_AsiStream;
|
||||
|
||||
if (stream == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stream->unk0c = -1;
|
||||
stream->unk10 = -1;
|
||||
stream->unk14 = -1;
|
||||
|
||||
stream->unk00 = arg0;
|
||||
stream->unk04 = arg1;
|
||||
stream->unk08 = arg2;
|
||||
|
||||
stream->unk201c = 0;
|
||||
stream->unk2020 = 0;
|
||||
stream->unk3ba0 = 0;
|
||||
|
||||
mp3main00043ef8(stream, 0);
|
||||
|
||||
stream->unk8474 = 0;
|
||||
|
||||
bzero(&stream->unk6a64, sizeof(stream->unk6a64[0]));
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
s32 mp3main0004453c(struct asistream *streamptr, struct mp3thing **arg1, s32 *arg2)
|
||||
{
|
||||
struct asistream *stream = streamptr;
|
||||
s32 result;
|
||||
|
||||
stream->unk3ba0++;
|
||||
|
||||
if (stream->unk3ba0 > 5) {
|
||||
stream->unk3ba0 = 0;
|
||||
}
|
||||
|
||||
if (!mp3main00043ef8(stream, stream->unk8474)) {
|
||||
g_Mp3Vars.var8009c3e0 = 3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
stream->unk8474 = -1;
|
||||
|
||||
result = stream->unk8478(stream);
|
||||
|
||||
if (!result) {
|
||||
// empty
|
||||
} else {
|
||||
*arg1 = &stream->unk2070[stream->unk3ba0];
|
||||
*arg2 = stream->numchannels;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
#ifndef _IN_LIB_MP3_MP3_H
|
||||
#define _IN_LIB_MP3_MP3_H
|
||||
#include <ultra64.h>
|
||||
#include "types.h"
|
||||
|
||||
struct mp3decfourbytes {
|
||||
u8 bytes[2];
|
||||
s8 unk02;
|
||||
s8 unk03;
|
||||
};
|
||||
|
||||
struct asistream_scalefac {
|
||||
/*0x3d08*/ u32 l[22];
|
||||
/*0x3d60*/ u32 unk3d60;
|
||||
/*0x3d64*/ u32 s[3][13];
|
||||
};
|
||||
|
||||
struct asistream_4f64 {
|
||||
f32 unk00[18];
|
||||
};
|
||||
|
||||
struct asistream {
|
||||
/*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*/ s32 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];
|
||||
struct asistream_scalefac scalefac[2][1];
|
||||
/*0x3ef8*/ u32 unk3ef8;
|
||||
/*0x3efc*/ u32 unk3efc[6];
|
||||
/*0x3f14*/ u32 unk3f14[26];
|
||||
/*0x3f7c*/ s32 unk3f7c;
|
||||
/*0x3f80*/ s32 unk3f80;
|
||||
/*0x3f84*/ s32 unk3f84;
|
||||
/*0x3f88*/ s32 unk3f88;
|
||||
/*0x3f8c*/ s32 numchannels;
|
||||
/*0x3f90*/ s32 numgranules;
|
||||
/*0x3f94*/ s16 unk3f94[1][578];
|
||||
/*0x4418*/ u8 unk4418[1][578];
|
||||
/*0x465c*/ s32 unk465c[1];
|
||||
/*0x4660*/ s32 unk4660[1];
|
||||
/*0x4664*/ struct asistream_4f64 unk4664[1][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);
|
||||
};
|
||||
|
||||
u32 mp3mainInit(void);
|
||||
struct asistream *mp3main00044460(s32 arg0, void *arg1, s32 arg2);
|
||||
s32 mp3main0004453c(struct asistream *stream, struct mp3thing **arg1, s32 *arg2);
|
||||
|
||||
#endif
|
||||
@@ -1,321 +0,0 @@
|
||||
#include "macros.inc"
|
||||
.set noat
|
||||
.set noreorder
|
||||
|
||||
.text
|
||||
|
||||
glabel mp3util000461c0
|
||||
andi $t4, $t0, 0x7
|
||||
addiu $t3, $zero, 0x8
|
||||
lbu $t5, 0x0($a0)
|
||||
lbu $t2, 0x1($a0)
|
||||
sll $t1, $t5, 0x8
|
||||
or $t1, $t1, $t2
|
||||
sub $t3, $t3, $t4
|
||||
srlv $t1, $t1, $t3
|
||||
andi $t1, $t1, 0xff
|
||||
sll $t3, $a2, 0x8
|
||||
add $t3, $t3, $t1
|
||||
lui $t2, %hi(var8005f6fc)
|
||||
addiu $t2, $t2, %lo(var8005f6fc)
|
||||
lw $t2, 0x0($t2)
|
||||
add $t2, $t3, $t2
|
||||
lbu $t2, 0x0($t2)
|
||||
beqz $t2, .L00046238
|
||||
nop
|
||||
add $t0, $t0, $t2
|
||||
add $t4, $t4, $t2
|
||||
srl $t4, $t4, 0x3
|
||||
add $a0, $a0, $t4
|
||||
lui $t2, %hi(var8005f6f8)
|
||||
addiu $t2, $t2, %lo(var8005f6f8)
|
||||
lw $t2, 0x0($t2)
|
||||
add $t2, $t3, $t2
|
||||
lbu $t2, 0x0($t2)
|
||||
srl $t1, $t2, 0x4
|
||||
jr $ra
|
||||
andi $v0, $t2, 0xf
|
||||
.L00046238:
|
||||
add $t7, $zero, $s0
|
||||
andi $t1, $t0, 0x7
|
||||
addiu $t2, $zero, 0x80
|
||||
srlv $t2, $t2, $t1
|
||||
addiu $t6, $zero, -1
|
||||
.L0004624c:
|
||||
and $t4, $t5, $t2
|
||||
beqzl $t4, .L0004625c
|
||||
lbu $t4, 0x0($t7)
|
||||
lbu $t4, 0x1($t7)
|
||||
.L0004625c:
|
||||
srl $t2, $t2, 0x1
|
||||
sll $t4, $t4, 0x2
|
||||
bnez $t2, .L00046278
|
||||
add $t7, $t7, $t4
|
||||
addiu $t2, $zero, 0x80
|
||||
addi $a0, $a0, 0x1
|
||||
lbu $t5, 0x0($a0)
|
||||
.L00046278:
|
||||
lb $t1, 0x2($t7)
|
||||
beq $t1, $t6, .L0004624c
|
||||
addi $t0, $t0, 0x1
|
||||
add $v0, $zero, $t1
|
||||
jr $ra
|
||||
lb $t1, 0x3($t7)
|
||||
|
||||
glabel mp3util00046290
|
||||
lwl $t1, 0x0($a0)
|
||||
lwr $t1, 0x3($a0)
|
||||
andi $t2, $t0, 0x7
|
||||
add $t2, $t2, $s1
|
||||
srl $t2, $t2, 0x3
|
||||
add $a0, $a0, $t2
|
||||
andi $t2, $t0, 0x7
|
||||
sllv $t1, $t1, $t2
|
||||
addiu $t2, $zero, 0x20
|
||||
sub $t2, $t2, $s1
|
||||
srlv $v0, $t1, $t2
|
||||
jr $ra
|
||||
add $t0, $t0, $s1
|
||||
|
||||
glabel mp3utilGetBits
|
||||
lw $t0, 0x0($a1)
|
||||
srl $t1, $t0, 0x3
|
||||
add $a0, $a0, $t1
|
||||
lwl $t1, 0x0($a0)
|
||||
lwr $t1, 0x3($a0)
|
||||
andi $t2, $t0, 0x7
|
||||
sllv $t1, $t1, $t2
|
||||
addiu $t2, $zero, 0x20
|
||||
sub $t2, $t2, $a2
|
||||
srlv $v0, $t1, $t2
|
||||
add $t0, $t0, $a2
|
||||
jr $ra
|
||||
sw $t0, 0x0($a1)
|
||||
|
||||
glabel mp3util000462f8
|
||||
addiu $sp, $sp, -48
|
||||
sw $ra, 0x0($sp)
|
||||
sw $s0, 0x4($sp)
|
||||
sw $s1, 0x8($sp)
|
||||
sw $s2, 0xc($sp)
|
||||
sw $s3, 0x10($sp)
|
||||
sw $s4, 0x14($sp)
|
||||
sw $s5, 0x18($sp)
|
||||
sw $s6, 0x1c($sp)
|
||||
sw $s7, 0x20($sp)
|
||||
sw $s8, 0x24($sp)
|
||||
sw $gp, 0x28($sp)
|
||||
sw $ra, 0x2c($sp)
|
||||
lw $t0, 0x0($a1)
|
||||
sll $s0, $a2, 0x2
|
||||
lui $t1, %hi(var8009c650)
|
||||
addiu $t1, $t1, %lo(var8009c650)
|
||||
add $s0, $s0, $t1
|
||||
lw $s0, 0x0($s0)
|
||||
lw $s1, 0x40($sp)
|
||||
lw $s2, 0x44($sp)
|
||||
lw $s3, 0x48($sp)
|
||||
lw $s4, 0x4c($sp)
|
||||
lw $s3, 0x0($s3)
|
||||
lw $s4, 0x0($s4)
|
||||
srl $t1, $t0, 0x3
|
||||
add $a0, $a0, $t1
|
||||
sub $t1, $s2, $a3
|
||||
blez $t1, .L00046458
|
||||
nop
|
||||
.L00046370:
|
||||
jal mp3util000461c0
|
||||
nop
|
||||
beqz $s1, .L00046398
|
||||
add $s6, $zero, $t1
|
||||
addiu $t2, $zero, 0xf
|
||||
bne $v0, $t2, .L00046398
|
||||
nop
|
||||
jal mp3util00046290
|
||||
nop
|
||||
addi $v0, $v0, 0xf
|
||||
.L00046398:
|
||||
beqzl $v0, .L000463d8
|
||||
sb $zero, 0x0($s4)
|
||||
lb $t1, 0x0($a0)
|
||||
addiu $t3, $zero, 0x7
|
||||
andi $t2, $t0, 0x7
|
||||
addi $t4, $t2, 0x1
|
||||
srl $t4, $t4, 0x3
|
||||
add $a0, $a0, $t4
|
||||
sub $t2, $t3, $t2
|
||||
srlv $t1, $t1, $t2
|
||||
andi $t1, $t1, 0x1
|
||||
addi $t0, $t0, 0x1
|
||||
addiu $t2, $zero, 0x1
|
||||
beqzl $t1, .L000463d8
|
||||
sb $zero, 0x0($s4)
|
||||
sb $t2, 0x0($s4)
|
||||
.L000463d8:
|
||||
beqz $s1, .L000463fc
|
||||
add $s7, $zero, $v0
|
||||
addiu $t2, $zero, 0xf
|
||||
bne $s6, $t2, .L000463fc
|
||||
nop
|
||||
jal mp3util00046290
|
||||
nop
|
||||
addi $s6, $v0, 0xf
|
||||
add $v0, $zero, $s7
|
||||
.L000463fc:
|
||||
sh $v0, 0x0($s3)
|
||||
sh $s6, 0x2($s3)
|
||||
addi $s3, $s3, 0x4
|
||||
beqzl $s6, .L00046448
|
||||
sb $zero, 0x1($s4)
|
||||
lb $t1, 0x0($a0)
|
||||
addiu $t3, $zero, 0x7
|
||||
andi $t2, $t0, 0x7
|
||||
addi $t4, $t2, 0x1
|
||||
srl $t4, $t4, 0x3
|
||||
add $a0, $a0, $t4
|
||||
sub $t2, $t3, $t2
|
||||
srlv $t1, $t1, $t2
|
||||
andi $t1, $t1, 0x1
|
||||
addi $t0, $t0, 0x1
|
||||
addiu $t2, $zero, 0x1
|
||||
beqzl $t1, .L00046448
|
||||
sb $zero, 0x1($s4)
|
||||
sb $t2, 0x1($s4)
|
||||
.L00046448:
|
||||
addi $a3, $a3, 0x2
|
||||
sub $t1, $s2, $a3
|
||||
bgtz $t1, .L00046370
|
||||
addi $s4, $s4, 0x2
|
||||
.L00046458:
|
||||
sw $t0, 0x0($a1)
|
||||
lw $t0, 0x48($sp)
|
||||
lw $t1, 0x4c($sp)
|
||||
sw $s3, 0x0($t0)
|
||||
sw $s4, 0x0($t1)
|
||||
lw $ra, 0x0($sp)
|
||||
lw $s0, 0x4($sp)
|
||||
lw $s1, 0x8($sp)
|
||||
lw $s2, 0xc($sp)
|
||||
lw $s3, 0x10($sp)
|
||||
lw $s4, 0x14($sp)
|
||||
lw $s5, 0x18($sp)
|
||||
lw $s6, 0x1c($sp)
|
||||
lw $s7, 0x20($sp)
|
||||
lw $s8, 0x24($sp)
|
||||
lw $gp, 0x28($sp)
|
||||
lw $ra, 0x2c($sp)
|
||||
addiu $sp, $sp, 0x30
|
||||
jr $ra
|
||||
add $v0, $zero, $a3
|
||||
|
||||
glabel mp3util000464a8
|
||||
addiu $sp, $sp, -48
|
||||
sw $ra, 0x0($sp)
|
||||
sw $s0, 0x4($sp)
|
||||
sw $s1, 0x8($sp)
|
||||
sw $s2, 0xc($sp)
|
||||
sw $s3, 0x10($sp)
|
||||
sw $s4, 0x14($sp)
|
||||
sw $s5, 0x18($sp)
|
||||
sw $s6, 0x1c($sp)
|
||||
sw $s7, 0x20($sp)
|
||||
sw $s8, 0x24($sp)
|
||||
sw $gp, 0x28($sp)
|
||||
sw $ra, 0x2c($sp)
|
||||
lw $t0, 0x0($a1)
|
||||
sll $s0, $a2, 0x2
|
||||
lui $t1, %hi(var8009c650)
|
||||
addiu $t1, $t1, %lo(var8009c650)
|
||||
add $s0, $s0, $t1
|
||||
lw $s0, 0x0($s0)
|
||||
lw $s2, 0x40($sp)
|
||||
lw $s3, 0x44($sp)
|
||||
lw $s4, 0x48($sp)
|
||||
lw $s3, 0x0($s3)
|
||||
lw $s4, 0x0($s4)
|
||||
srl $t1, $t0, 0x3
|
||||
add $a0, $a0, $t1
|
||||
sub $t1, $s2, $t0
|
||||
blez $t1, .L000465f4
|
||||
nop
|
||||
addi $t1, $a3, -576
|
||||
bgez $t1, .L000465f4
|
||||
nop
|
||||
.L00046528:
|
||||
jal mp3util000461c0
|
||||
nop
|
||||
srl $t3, $v0, 0x3
|
||||
andi $t3, $t3, 0x1
|
||||
srl $t4, $v0, 0x2
|
||||
andi $t4, $t4, 0x1
|
||||
srl $t5, $v0, 0x1
|
||||
andi $t5, $t5, 0x1
|
||||
andi $t6, $v0, 0x1
|
||||
sh $t3, 0x0($s3)
|
||||
sh $t4, 0x2($s3)
|
||||
sh $t5, 0x4($s3)
|
||||
sh $t6, 0x6($s3)
|
||||
jal mp3util00046290
|
||||
addiu $s1, $zero, 0x4
|
||||
addiu $s1, $zero, 0x3
|
||||
sb $v0, 0x0($s4)
|
||||
beqz $t3, .L0004657c
|
||||
srlv $t1, $v0, $s1
|
||||
and $t3, $t3, $t1
|
||||
addi $s1, $s1, -1
|
||||
.L0004657c:
|
||||
beqz $t4, .L00046590
|
||||
sb $t3, 0x0($s4)
|
||||
srlv $t1, $v0, $s1
|
||||
and $t4, $t4, $t1
|
||||
addi $s1, $s1, -1
|
||||
.L00046590:
|
||||
beqz $t5, .L000465a4
|
||||
sb $t4, 0x1($s4)
|
||||
srlv $t1, $v0, $s1
|
||||
and $t5, $t5, $t1
|
||||
addi $s1, $s1, -1
|
||||
.L000465a4:
|
||||
beqz $t6, .L000465b8
|
||||
sb $t5, 0x2($s4)
|
||||
srlv $t1, $v0, $s1
|
||||
and $t6, $t6, $t1
|
||||
addi $s1, $s1, -1
|
||||
.L000465b8:
|
||||
sb $t6, 0x3($s4)
|
||||
addi $s1, $s1, 0x1
|
||||
andi $t1, $t0, 0x7
|
||||
sub $t1, $t1, $s1
|
||||
bgez $t1, .L000465d4
|
||||
sub $t0, $t0, $s1
|
||||
addi $a0, $a0, -1
|
||||
.L000465d4:
|
||||
addi $s3, $s3, 0x8
|
||||
addi $s4, $s4, 0x4
|
||||
addi $a3, $a3, 0x4
|
||||
addi $t1, $a3, -576
|
||||
bgez $t1, .L000465f4
|
||||
sub $t1, $s2, $t0
|
||||
bgtz $t1, .L00046528
|
||||
nop
|
||||
.L000465f4:
|
||||
sw $t0, 0x0($a1)
|
||||
lw $t0, 0x44($sp)
|
||||
lw $t1, 0x48($sp)
|
||||
sw $s3, 0x0($t0)
|
||||
sw $s4, 0x0($t1)
|
||||
lw $ra, 0x0($sp)
|
||||
lw $s0, 0x4($sp)
|
||||
lw $s1, 0x8($sp)
|
||||
lw $s2, 0xc($sp)
|
||||
lw $s3, 0x10($sp)
|
||||
lw $s4, 0x14($sp)
|
||||
lw $s5, 0x18($sp)
|
||||
lw $s6, 0x1c($sp)
|
||||
lw $s7, 0x20($sp)
|
||||
lw $s8, 0x24($sp)
|
||||
lw $gp, 0x28($sp)
|
||||
lw $ra, 0x2c($sp)
|
||||
addiu $sp, $sp, 0x30
|
||||
jr $ra
|
||||
add $v0, $zero, $a3
|
||||
@@ -489,7 +489,6 @@ void func00034fb8(N_ALCSPlayer *seqp, u8 channel)
|
||||
}
|
||||
}
|
||||
|
||||
void sndStartMp3ByFilenum(u8 arg0);
|
||||
f32 _depth2Cents(u8 arg0);
|
||||
|
||||
void __n_CSPHandleMIDIMsg(N_ALCSPlayer *seqp, N_ALEvent *event)
|
||||
@@ -969,9 +968,6 @@ void __n_CSPHandleMIDIMsg(N_ALCSPlayer *seqp, N_ALEvent *event)
|
||||
seqp->chanState[chan].unk0b = byte2;
|
||||
}
|
||||
break;
|
||||
case (AL_MIDI_FX_CTRL_6):
|
||||
sndStartMp3ByFilenum(byte2);
|
||||
break;
|
||||
case (0x20):
|
||||
seqp->chanState[chan].unk32 = byte2;
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <ultra64.h>
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
s32 func00037fc0(s32 arg0, Acmd **cmd);
|
||||
void func0003ba64(struct fx *fx, f32 outputrate);
|
||||
|
||||
Acmd *n_alMainBusPull(s32 sampleOffset, Acmd *p)
|
||||
@@ -9,9 +8,9 @@ Acmd *n_alMainBusPull(s32 sampleOffset, Acmd *p)
|
||||
Acmd *ptr = p;
|
||||
s32 i;
|
||||
|
||||
if (!func00037fc0(FIXED_SAMPLE, &ptr)) {
|
||||
//if (!func00037fc0(FIXED_SAMPLE, &ptr)) {
|
||||
aClearBuffer(ptr++, N_AL_MAIN_L_OUT, N_AL_DIVIDED << 1);
|
||||
}
|
||||
//}
|
||||
|
||||
for (i = 0; i < n_syn->maxAuxBusses; i++) {
|
||||
ptr = (n_syn->mainBus->filter.handler)(sampleOffset, ptr, i);
|
||||
|
||||
-459
@@ -15,30 +15,15 @@
|
||||
#include "lib/str.h"
|
||||
#include "lib/lib_2fc60.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
#include "lib/mp3.h"
|
||||
#include "lib/lib_39c80.h"
|
||||
#include "lib/speaker.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
struct curmp3 {
|
||||
union soundnumhack sfxref;
|
||||
u32 playing;
|
||||
u32 unk08;
|
||||
s32 responsetimer240;
|
||||
s32 prevwhisper;
|
||||
s32 prevacknowledge;
|
||||
s32 prevgreeting;
|
||||
u32 romaddr;
|
||||
u32 romsize;
|
||||
s32 responsetype;
|
||||
};
|
||||
|
||||
s32 g_NumSounds;
|
||||
u32 *g_ALSoundRomOffsets;
|
||||
s32 g_SndMaxFxBusses;
|
||||
u32 var80094eac;
|
||||
struct curmp3 g_SndCurMp3;
|
||||
struct seqinstance g_SeqInstances[3];
|
||||
ALHeap g_SndHeap;
|
||||
u32 var80095200;
|
||||
@@ -66,7 +51,6 @@ struct sndstate *g_SndUfoHandle = NULL;
|
||||
|
||||
u16 g_SfxVolume = 32767;
|
||||
s32 g_SoundMode = (VERSION >= VERSION_NTSC_1_0 ? SOUNDMODE_STEREO : SOUNDMODE_SURROUND);
|
||||
bool g_SndMp3Enabled = false;
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
s32 var8005ddd4 = 0;
|
||||
@@ -848,11 +832,6 @@ extern u8 _seqctlSegmentRomEnd;
|
||||
extern u8 _seqtblSegmentRomStart;
|
||||
extern u8 _sequencesSegmentRomStart;
|
||||
|
||||
bool sndIsPlayingMp3(void)
|
||||
{
|
||||
return g_SndCurMp3.playing;
|
||||
}
|
||||
|
||||
u16 snd0000e9dc(void)
|
||||
{
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
@@ -902,20 +881,6 @@ void snd0000ea80(u16 volume)
|
||||
}
|
||||
}
|
||||
|
||||
void sndResetCurMp3(void)
|
||||
{
|
||||
g_SndCurMp3.sfxref.id = 0;
|
||||
g_SndCurMp3.sfxref.mp3priority = 0;
|
||||
g_SndCurMp3.sfxref.unk02 = 0;
|
||||
g_SndCurMp3.sfxref.hasconfig = false;
|
||||
g_SndCurMp3.playing = false;
|
||||
g_SndCurMp3.unk08 = 0;
|
||||
g_SndCurMp3.responsetimer240 = -1;
|
||||
g_SndCurMp3.prevwhisper = -1;
|
||||
g_SndCurMp3.prevacknowledge = -1;
|
||||
g_SndCurMp3.prevgreeting = -1;
|
||||
}
|
||||
|
||||
void sndLoadSfxCtl(void)
|
||||
{
|
||||
s32 i;
|
||||
@@ -1300,10 +1265,6 @@ ALSound *sndLoadSound(s16 soundnum)
|
||||
tmp.packed = soundnum;
|
||||
sfxnum = tmp.id;
|
||||
|
||||
if (sndIsMp3(tmp.packed)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// If this sound doesn't exist in the cache
|
||||
cacheindex = g_SndCache.indexes[sfxnum];
|
||||
|
||||
@@ -1437,15 +1398,8 @@ void sndInit(void)
|
||||
heaplen -= 1024 * 137;
|
||||
heaplen -= 1024 * 12;
|
||||
heaplen -= 1024 * 23;
|
||||
|
||||
g_SndMp3Enabled = false;
|
||||
} else {
|
||||
g_SndMp3Enabled = true;
|
||||
g_SndMaxFxBusses = 2;
|
||||
|
||||
if (argFindByPrefix(1, "-nomp3")) {
|
||||
g_SndMp3Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_SndDisabled) {
|
||||
@@ -1525,16 +1479,6 @@ void sndInit(void)
|
||||
amgrCreate(&synconfig);
|
||||
#endif
|
||||
|
||||
if (g_SndMp3Enabled) {
|
||||
osSyncPrintf("RWI : Initialising the new and improved MP3 player\n");
|
||||
|
||||
mp3Init(&g_SndHeap);
|
||||
func00037f08(0x7fff, 1);
|
||||
func00037f5c(0, true);
|
||||
|
||||
osSyncPrintf("RWI : MP3 player Initialising Done\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
seqInit(&g_SeqInstances[i]);
|
||||
}
|
||||
@@ -1554,27 +1498,8 @@ void sndInit(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool sndIsMp3(s16 soundnum)
|
||||
{
|
||||
union soundnumhack tmp;
|
||||
tmp.packed = soundnum;
|
||||
|
||||
return tmp.mp3priority != 0;
|
||||
}
|
||||
|
||||
bool snd0000fbc4(s16 arg0)
|
||||
{
|
||||
if (!g_SndDisabled && g_SndMp3Enabled) {
|
||||
if (func00037ea4() && g_SndCurMp3.unk08 != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
func00037e1c();
|
||||
|
||||
g_SndCurMp3.playing = false;
|
||||
g_SndCurMp3.responsetimer240 = -1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1794,20 +1719,6 @@ void snd0000fe18(void)
|
||||
// empty
|
||||
}
|
||||
|
||||
void snd0000fe20(void)
|
||||
{
|
||||
if (g_SndMp3Enabled) {
|
||||
func00037e38();
|
||||
}
|
||||
}
|
||||
|
||||
void snd0000fe50(void)
|
||||
{
|
||||
if (g_SndMp3Enabled) {
|
||||
func00037e68();
|
||||
}
|
||||
}
|
||||
|
||||
void snd0000fe80(void)
|
||||
{
|
||||
// empty
|
||||
@@ -1871,105 +1782,6 @@ void sndTick(void)
|
||||
var8005edec = var8005ddd8;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!g_SndDisabled && g_SndMp3Enabled) {
|
||||
if (g_Vars.stagenum == STAGE_AIRFORCEONE) {
|
||||
sndTickNosedive();
|
||||
} else if (g_Vars.stagenum == STAGE_ESCAPE) {
|
||||
sndTickUfo();
|
||||
}
|
||||
|
||||
if (g_Vars.tickmode == TICKMODE_CUTSCENE) {
|
||||
s0 = musicGetVolume() > g_SfxVolume ? musicGetVolume() : g_SfxVolume;
|
||||
|
||||
if (s0 != snd0000e9dc()) {
|
||||
snd0000ea80(s0);
|
||||
}
|
||||
} else {
|
||||
if (g_SfxVolume != snd0000e9dc()) {
|
||||
snd0000ea80(g_SfxVolume);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_SndGuardStringPtr != NULL) {
|
||||
if (strcmp(g_SndGuardStringPtr, g_SndGuardString) != 0) {
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
crashSetMessage("Snd Heap Check FAILED");
|
||||
CRASH();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (func00037ea4() == 0 && g_SndCurMp3.playing) {
|
||||
if (g_SndCurMp3.unk08) {
|
||||
mp3PlayFile(g_SndCurMp3.romaddr, g_SndCurMp3.romsize);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (g_SndCurMp3.responsetype) {
|
||||
case MP3RESPONSETYPE_ACKNOWLEDGE:
|
||||
case MP3RESPONSETYPE_WHISPER:
|
||||
g_SndCurMp3.responsetimer240 = TICKS(60);
|
||||
break;
|
||||
case MP3RESPONSETYPE_GREETING:
|
||||
g_SndCurMp3.responsetimer240 = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
g_SndCurMp3.playing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_SndCurMp3.responsetimer240 > 0) {
|
||||
g_SndCurMp3.responsetimer240 -= g_Vars.lvupdate240;
|
||||
|
||||
if (g_SndCurMp3.responsetimer240 <= 0) {
|
||||
if (g_SndCurMp3.responsetype == MP3RESPONSETYPE_WHISPER) {
|
||||
do {
|
||||
index = random() % 4;
|
||||
} while (index == g_SndCurMp3.prevwhisper);
|
||||
|
||||
g_SndCurMp3.prevwhisper = index;
|
||||
|
||||
switch (index) {
|
||||
case 0: sp50.packed = MP3_JO_WHISPER_RECEIVED; break;
|
||||
case 1: sp50.packed = MP3_JO_WHISPER_UNDERSTOOD; break;
|
||||
case 2: sp50.packed = MP3_JO_WHISPER_AFFIRMATIVE; break;
|
||||
case 3: sp50.packed = MP3_JO_WHISPER_CONFIRMED; break;
|
||||
}
|
||||
} else if (g_SndCurMp3.responsetype == MP3RESPONSETYPE_ACKNOWLEDGE) {
|
||||
do {
|
||||
index = random() % 4;
|
||||
} while (index == g_SndCurMp3.prevacknowledge);
|
||||
|
||||
g_SndCurMp3.prevacknowledge = index;
|
||||
|
||||
switch (index) {
|
||||
case 0: sp50.packed = MP3_JO_ACKNOWLEDGE_CONFIRMED; break;
|
||||
case 1: sp50.packed = MP3_JO_ACKNOWLEDGE_UNDERSTOOD; break;
|
||||
case 2: sp50.packed = MP3_JO_ACKNOWLEDGE_AFFIRMATIVE; break;
|
||||
case 3: sp50.packed = MP3_JO_ACKNOWLEDGE_RECEIVED; break;
|
||||
}
|
||||
} else if (g_SndCurMp3.responsetype == MP3RESPONSETYPE_GREETING) {
|
||||
do {
|
||||
index = random() % 4;
|
||||
} while (index == g_SndCurMp3.prevgreeting);
|
||||
|
||||
g_SndCurMp3.prevgreeting = index;
|
||||
|
||||
switch (index) {
|
||||
case 0: sp50.packed = MP3_JO_GREETING_HELLO; break;
|
||||
case 1: sp50.packed = MP3_JO_GREETING_HI; break;
|
||||
case 2: sp50.packed = MP3_JO_GREETING_HEY; break;
|
||||
case 3: sp50.packed = MP3_JO_GREETING_HIYA; break;
|
||||
}
|
||||
}
|
||||
|
||||
g_SndCurMp3.responsetimer240 = -1;
|
||||
sndStart(0, sp50.packed, 0, -1, -1, -1.0f, -1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s16 snd0001034c(s16 sfxnum)
|
||||
@@ -1989,20 +1801,6 @@ bool sndIsDisabled(void)
|
||||
return g_SndDisabled;
|
||||
}
|
||||
|
||||
void sndStartMp3ByFilenum(u32 filenum)
|
||||
{
|
||||
union soundnumhack sfxref;
|
||||
|
||||
if (!g_SndDisabled && g_SndMp3Enabled) {
|
||||
sfxref.packed = 0;
|
||||
sfxref.unk02 = 0;
|
||||
sfxref.mp3priority = 1; // high priority
|
||||
sfxref.id = filenum;
|
||||
|
||||
sndStart(0, sfxref.packed, NULL, -1, -1, -1, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the player has the language filter enabled
|
||||
* and the given audio ID is one that should be filtered out.
|
||||
@@ -2092,11 +1890,6 @@ void sndAdjust(struct sndstate **handle, s32 arg1, s32 arg2, s32 pan, s32 soundn
|
||||
if (arg1 != 0) {
|
||||
if (arg2 != -1) {
|
||||
arg2 = arg2 * snd0000e9dc() / 32767;
|
||||
func00037f08(arg2, true);
|
||||
}
|
||||
|
||||
if (pan != -1) {
|
||||
func00037f5c(pan, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2212,16 +2005,6 @@ struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 arg
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sndIsMp3(sp40.packed)) {
|
||||
sndStartMp3(sp40.packed, sp3a, sp3d, 0);
|
||||
|
||||
if (handle != NULL) {
|
||||
*handle = NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
if (sp40.id < (u32)g_NumSounds) {
|
||||
return func00033820(arg0, sp40.id, sp3a, sp3d & 0x7f, sp34, sp3f, IS4MB() ? 0 : sp3e, handle);
|
||||
@@ -2232,245 +2015,3 @@ struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 arg
|
||||
return func00033820(arg0, sp40.id, sp3a, sp3d & 0x7f, sp34, sp3f, IS4MB() ? 0 : sp3e, handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char var70053be0[] = "Snd_Play_Universal : Overriding -> Link = %d\n";
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
const char var700552f0nb[] = "Snd_Play_Mpeg : sndId=%d, vol=%d, pan=%d\n";
|
||||
#endif
|
||||
|
||||
const char var70053c10[] = "Snd_Play_Mpeg : SYSTEM IS DISABLED\n";
|
||||
const char var70053c34[] = "Snd_Play_Mpeg : Lib called -> Adr=%x\n";
|
||||
const char var70053c5c[] = "Snd_Play_Mpeg : Chunk size -> Adr=%x\n";
|
||||
|
||||
void sndStartMp3(s16 soundnum, s32 arg1, s32 arg2, s32 arg3)
|
||||
{
|
||||
union soundnumhack sp24;
|
||||
union soundnumhack sp20;
|
||||
|
||||
sp24.packed = soundnum;
|
||||
|
||||
if (!g_SndDisabled) {
|
||||
if (sp24.hasconfig) {
|
||||
sp20.packed = g_AudioRussMappings[sp24.confignum].soundnum;
|
||||
sp20.hasconfig = false;
|
||||
} else {
|
||||
sp20.packed = soundnum;
|
||||
}
|
||||
|
||||
if (!g_SndCurMp3.playing
|
||||
|| ((sp20.mp3priority != 1 || g_SndCurMp3.sfxref.mp3priority != 1)
|
||||
&& sp20.mp3priority <= g_SndCurMp3.sfxref.mp3priority)) {
|
||||
if (sp24.hasconfig) {
|
||||
if (g_AudioConfigs[sp24.confignum].unk10 != -1) {
|
||||
arg1 = g_AudioConfigs[sp24.confignum].unk10 * 32767 / 100;
|
||||
}
|
||||
|
||||
if (g_AudioConfigs[sp24.confignum].unk14 != -1) {
|
||||
arg2 = g_AudioConfigs[sp24.confignum].unk14;
|
||||
}
|
||||
|
||||
// This is the same thing again
|
||||
if (g_AudioConfigs[sp24.confignum].unk14 != -1) {
|
||||
arg2 = g_AudioConfigs[sp24.confignum].unk14;
|
||||
}
|
||||
|
||||
if (g_Vars.langfilteron && (g_AudioConfigs[sp24.confignum].flags & AUDIOCONFIGFLAG_OFFENSIVE)) {
|
||||
arg1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
arg1 = arg1 * snd0000e9dc() / 0x7fff;
|
||||
|
||||
g_SndCurMp3.romaddr = fileGetRomAddress(sp20.id);
|
||||
g_SndCurMp3.romsize = fileGetRomSize(sp20.id);
|
||||
|
||||
func00037f08(arg1, true);
|
||||
func00037f5c(arg2, true);
|
||||
|
||||
mp3PlayFile(g_SndCurMp3.romaddr, g_SndCurMp3.romsize);
|
||||
|
||||
func00037f08(arg1, true);
|
||||
func00037f5c(arg2, true);
|
||||
|
||||
g_SndCurMp3.sfxref.packed = sp20.packed;
|
||||
g_SndCurMp3.playing = true;
|
||||
g_SndCurMp3.responsetimer240 = -1;
|
||||
g_SndCurMp3.responsetype = MP3RESPONSETYPE_NONE;
|
||||
|
||||
if (g_SndCurMp3.sfxref.unk02 == 2) {
|
||||
g_SndCurMp3.responsetype = MP3RESPONSETYPE_ACKNOWLEDGE;
|
||||
} else if (g_SndCurMp3.sfxref.unk02 == 1) {
|
||||
g_SndCurMp3.responsetype = MP3RESPONSETYPE_WHISPER;
|
||||
}
|
||||
|
||||
if ((sp24.hasconfig && (g_AudioConfigs[sp24.confignum].flags & AUDIOCONFIGFLAG_04)) || (arg3 & 1)) {
|
||||
g_SndCurMp3.responsetype = MP3RESPONSETYPE_GREETING;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sndPlayNosedive(s32 seconds)
|
||||
{
|
||||
g_SndNosediveDuration240 = seconds * TICKS(240);
|
||||
g_SndNosediveAge240 = 0;
|
||||
g_SndNosediveVolume = 0;
|
||||
g_SndNosediveHandle = NULL;
|
||||
}
|
||||
|
||||
void sndStopNosedive(void)
|
||||
{
|
||||
if (g_SndNosediveAge240 != -1) {
|
||||
g_SndNosediveAge240 = g_SndNosediveDuration240 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sndTickNosedive(void)
|
||||
{
|
||||
f32 percentage;
|
||||
|
||||
if (g_SndNosediveAge240 != -1) {
|
||||
g_SndNosediveAge240 += g_Vars.lvupdate240;
|
||||
|
||||
percentage = (f32)g_SndNosediveAge240 / (f32)g_SndNosediveDuration240;
|
||||
|
||||
if (percentage < 1.0f) { // less than 100% complete
|
||||
percentage += 0.44f;
|
||||
|
||||
if (lvIsPaused()) {
|
||||
// Fade out volume during pause instead of stopping abruptly
|
||||
if (g_SndNosediveVolume > 0) {
|
||||
g_SndNosediveVolume -= g_Vars.diffframe240 * PALUP(80);
|
||||
|
||||
if (g_SndNosediveVolume < 0) {
|
||||
g_SndNosediveVolume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_SndNosediveVolume) {
|
||||
sndAdjust(&g_SndNosediveHandle, 0, g_SndNosediveVolume, 64, -1, percentage, 0, -1, 1);
|
||||
} else if (g_SndNosediveHandle != NULL) {
|
||||
audioStop(g_SndNosediveHandle);
|
||||
g_SndNosediveHandle = NULL;
|
||||
}
|
||||
} else {
|
||||
// Not paused
|
||||
if (g_SndNosediveHandle == NULL) {
|
||||
sndStart(var80095200, SFX_NOSEDIVE, &g_SndNosediveHandle, -1, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
// Fade in over about 2 seconds
|
||||
if (g_SndNosediveVolume < 20000) {
|
||||
g_SndNosediveVolume += g_Vars.diffframe240 * PALUP(40);
|
||||
|
||||
if (g_SndNosediveVolume > 20000) {
|
||||
g_SndNosediveVolume = 20000;
|
||||
}
|
||||
}
|
||||
|
||||
sndAdjust(&g_SndNosediveHandle, 0, g_SndNosediveVolume, 64, -1, percentage, 0, -1, 1);
|
||||
}
|
||||
} else {
|
||||
// Reached the configured fade out point
|
||||
if (g_SndNosediveVolume > 0) {
|
||||
g_SndNosediveVolume -= g_Vars.diffframe240 * PALUP(80);
|
||||
|
||||
if (g_SndNosediveVolume < 0) {
|
||||
g_SndNosediveVolume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_SndNosediveVolume) {
|
||||
sndAdjust(&g_SndNosediveHandle, 0, g_SndNosediveVolume, 64, -1, -1, 0, -1, 1);
|
||||
} else if (g_SndNosediveHandle != NULL) {
|
||||
audioStop(g_SndNosediveHandle);
|
||||
g_SndNosediveHandle = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sndPlayUfo(s32 seconds)
|
||||
{
|
||||
g_SndUfoDuration240 = seconds * TICKS(240);
|
||||
g_SndUfoAge240 = 0;
|
||||
g_SndUfoVolume = 0;
|
||||
g_SndUfoHandle = NULL;
|
||||
}
|
||||
|
||||
void sndStopUfo(void)
|
||||
{
|
||||
if (g_SndUfoAge240 != -1) {
|
||||
g_SndUfoAge240 = g_SndUfoDuration240 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sndTickUfo(void)
|
||||
{
|
||||
f32 percentage;
|
||||
|
||||
if (g_SndUfoAge240 != -1) {
|
||||
g_SndUfoAge240 += g_Vars.lvupdate240;
|
||||
|
||||
percentage = (f32)g_SndUfoAge240 / (f32)g_SndUfoDuration240;
|
||||
|
||||
if (percentage < 1.0f) { // less than 100% complete
|
||||
if (percentage < 0.65f) {
|
||||
percentage = percentage / 0.65f * 0.3f + 0.7f;
|
||||
} else {
|
||||
percentage = (percentage - 0.65f) / 0.35f * 0.8f + 1.0f;
|
||||
}
|
||||
|
||||
if (lvIsPaused()) {
|
||||
// Fade out volume during pause instead of stopping abruptly
|
||||
if (g_SndUfoVolume > 0) {
|
||||
g_SndUfoVolume -= g_Vars.diffframe240 * PALUP(120);
|
||||
|
||||
if (g_SndUfoVolume < 0) {
|
||||
g_SndUfoVolume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_SndUfoVolume) {
|
||||
sndAdjust(&g_SndUfoHandle, 0, g_SndUfoVolume, 64, -1, percentage, 0, -1, 1);
|
||||
} else if (g_SndUfoHandle != NULL) {
|
||||
audioStop(g_SndUfoHandle);
|
||||
g_SndUfoHandle = NULL;
|
||||
}
|
||||
} else {
|
||||
// Not paused
|
||||
if (g_SndUfoHandle == NULL) {
|
||||
sndStart(var80095200, SFX_UFOHUM, &g_SndUfoHandle, -1, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
// Fade in over about 2.4 seconds
|
||||
if (g_SndUfoVolume < 32767) {
|
||||
g_SndUfoVolume += g_Vars.diffframe240 * PALUP(40);
|
||||
|
||||
if (g_SndUfoVolume > 32767) {
|
||||
g_SndUfoVolume = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
sndAdjust(&g_SndUfoHandle, 0, g_SndUfoVolume, 64, -1, percentage, 0, -1, 1);
|
||||
}
|
||||
} else {
|
||||
// Reached the configured fade out point
|
||||
if (g_SndUfoVolume > 0) {
|
||||
g_SndUfoVolume -= g_Vars.diffframe240 * PALUP(120);
|
||||
|
||||
if (g_SndUfoVolume < 0) {
|
||||
g_SndUfoVolume = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_SndUfoVolume) {
|
||||
sndAdjust(&g_SndUfoHandle, 0, g_SndUfoVolume, 64, -1, -1, 0, -1, 1);
|
||||
} else if (g_SndUfoHandle != NULL) {
|
||||
audioStop(g_SndUfoHandle);
|
||||
g_SndUfoHandle = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user