mirror of https://github.com/PrimeDecomp/prime.git
Fix local functions in snd3d.s, add missing functions in snd_init.c, nearly match dataInsertKeymap
This commit is contained in:
parent
b221c7ed89
commit
919e53661f
|
@ -1734,7 +1734,7 @@ lbl_803AFE48:
|
||||||
/* 803AFE54 003ACDB4 38 21 00 10 */ addi r1, r1, 0x10
|
/* 803AFE54 003ACDB4 38 21 00 10 */ addi r1, r1, 0x10
|
||||||
/* 803AFE58 003ACDB8 4E 80 00 20 */ blr
|
/* 803AFE58 003ACDB8 4E 80 00 20 */ blr
|
||||||
|
|
||||||
AddStartingEmitter:
|
.fn AddStartingEmitter, local
|
||||||
/* 803AFE5C 003ACDBC 88 CD AF 62 */ lbz r6, startGroupNum@sda21(r13)
|
/* 803AFE5C 003ACDBC 88 CD AF 62 */ lbz r6, startGroupNum@sda21(r13)
|
||||||
/* 803AFE60 003ACDC0 3C 80 80 56 */ lis r4, startGroup@ha
|
/* 803AFE60 003ACDC0 3C 80 80 56 */ lis r4, startGroup@ha
|
||||||
/* 803AFE64 003ACDC4 38 A4 F9 90 */ addi r5, r4, startGroup@l
|
/* 803AFE64 003ACDC4 38 A4 F9 90 */ addi r5, r4, startGroup@l
|
||||||
|
@ -1828,8 +1828,9 @@ lbl_803AFF6C:
|
||||||
/* 803AFF9C 003ACEFC D0 84 00 10 */ stfs f4, 0x10(r4)
|
/* 803AFF9C 003ACEFC D0 84 00 10 */ stfs f4, 0x10(r4)
|
||||||
/* 803AFFA0 003ACF00 D0 24 00 04 */ stfs f1, 4(r4)
|
/* 803AFFA0 003ACF00 D0 24 00 04 */ stfs f1, 4(r4)
|
||||||
/* 803AFFA4 003ACF04 4E 80 00 20 */ blr
|
/* 803AFFA4 003ACF04 4E 80 00 20 */ blr
|
||||||
|
.endfn AddStartingEmitter
|
||||||
|
|
||||||
StartContinousEmitters:
|
.fn StartContinousEmitters, local
|
||||||
/* 803AFFA8 003ACF08 94 21 FF 80 */ stwu r1, -0x80(r1)
|
/* 803AFFA8 003ACF08 94 21 FF 80 */ stwu r1, -0x80(r1)
|
||||||
/* 803AFFAC 003ACF0C 7C 08 02 A6 */ mflr r0
|
/* 803AFFAC 003ACF0C 7C 08 02 A6 */ mflr r0
|
||||||
/* 803AFFB0 003ACF10 90 01 00 84 */ stw r0, 0x84(r1)
|
/* 803AFFB0 003ACF10 90 01 00 84 */ stw r0, 0x84(r1)
|
||||||
|
@ -2094,6 +2095,7 @@ lbl_803B031C:
|
||||||
/* 803B034C 003AD2AC 7C 08 03 A6 */ mtlr r0
|
/* 803B034C 003AD2AC 7C 08 03 A6 */ mtlr r0
|
||||||
/* 803B0350 003AD2B0 38 21 00 80 */ addi r1, r1, 0x80
|
/* 803B0350 003AD2B0 38 21 00 80 */ addi r1, r1, 0x80
|
||||||
/* 803B0354 003AD2B4 4E 80 00 20 */ blr
|
/* 803B0354 003AD2B4 4E 80 00 20 */ blr
|
||||||
|
.endfn StartContinousEmitters
|
||||||
|
|
||||||
.global s3dHandle
|
.global s3dHandle
|
||||||
s3dHandle:
|
s3dHandle:
|
||||||
|
|
|
@ -1,25 +1,77 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#include "musyx/musyx_priv.h"
|
#include "musyx/musyx_priv.h"
|
||||||
// #define _DEBUG
|
// #define _DEBUG
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
static s32 DoInit(u32 rate, u32 aramSize, u32 voices, u32 flags) {
|
||||||
|
bool ret;
|
||||||
|
|
||||||
|
MUSY_DEBUG("\nMusyX software initialization...\nBuild Date: %s %s\n\n", __DATE__, __TIME__);
|
||||||
|
ret = FALSE;
|
||||||
|
|
||||||
s32 DoInit(u32 rate, u32 aramSize, u8 voices, u32 flags) {
|
|
||||||
dataInitStack();
|
dataInitStack();
|
||||||
|
|
||||||
dataInit(0, aramSize);
|
dataInit(0, aramSize);
|
||||||
|
|
||||||
seqInit();
|
seqInit();
|
||||||
|
|
||||||
synthIdleWaitActive = 0;
|
synthIdleWaitActive = 0;
|
||||||
|
|
||||||
synthInit(rate, voices);
|
synthInit(rate, voices);
|
||||||
|
|
||||||
streamInit();
|
streamInit();
|
||||||
|
|
||||||
vsInit();
|
vsInit();
|
||||||
|
|
||||||
s3dInit(flags);
|
s3dInit(flags);
|
||||||
|
|
||||||
sndActive = 1;
|
sndActive = 1;
|
||||||
|
|
||||||
return FALSE;
|
MUSY_DEBUG("MusyX logic is initialized.\n\n");
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 sndInit(u8 voices, u8 music, u8 sfx, u8 studios, u32 flags, u32 aramSize) {
|
/*
|
||||||
u32 rate;
|
|
||||||
s32 ret;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
s32 sndInit(u8 voices, u8 music, u8 sfx, u8 studios, u32 flags, u32 aramSize) {
|
||||||
|
s32 ret; // r31
|
||||||
|
u32 frq; // r1+0x14
|
||||||
|
|
||||||
|
MUSY_DEBUG("Entering sndInit()\n\n");
|
||||||
sndActive = 0;
|
sndActive = 0;
|
||||||
if (voices <= 64) {
|
if (voices <= 64) {
|
||||||
synthInfo.voiceNum = voices;
|
synthInfo.voiceNum = voices;
|
||||||
|
@ -31,27 +83,65 @@ s32 sndInit(u8 voices, u8 music, u8 sfx, u8 studios, u32 flags, u32 aramSize) {
|
||||||
} else {
|
} else {
|
||||||
synthInfo.studioNum = 8;
|
synthInfo.studioNum = 8;
|
||||||
}
|
}
|
||||||
rate = 32000;
|
|
||||||
synthInfo.maxMusic = music;
|
synthInfo.maxMusic = music;
|
||||||
synthInfo.maxSFX = sfx;
|
synthInfo.maxSFX = sfx;
|
||||||
ret = hwInit(&rate, synthInfo.voiceNum, synthInfo.studioNum, flags);
|
frq = 32000;
|
||||||
if (ret == 0) {
|
if ((ret = hwInit(&frq, synthInfo.voiceNum, synthInfo.studioNum, flags)) == 0) {
|
||||||
ret = DoInit(32000, aramSize, synthInfo.voiceNum, flags);
|
ret = DoInit(32000, aramSize, synthInfo.voiceNum, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MUSY_DEBUG("Leaving sndInit().\n\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
void sndQuit() {
|
void sndQuit() {
|
||||||
|
MUSY_ASSERT_MSG(sndActive, "Sound system is not initialized.");
|
||||||
|
|
||||||
hwExit();
|
hwExit();
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
dataExit();
|
dataExit();
|
||||||
|
/*
|
||||||
|
*/
|
||||||
s3dExit();
|
s3dExit();
|
||||||
|
/* */
|
||||||
synthExit();
|
synthExit();
|
||||||
|
/* */
|
||||||
sndActive = 0;
|
sndActive = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
void sndSetMaxVoices(u8 music, u8 sfx) {
|
void sndSetMaxVoices(u8 music, u8 sfx) {
|
||||||
MUSY_ASSERT_MSG(music > synthInfo.voiceNum, "Music voices are above maximum voice number.");
|
MUSY_ASSERT_MSG(music <= synthInfo.voiceNum, "Music voices are above maximum voice number.");
|
||||||
MUSY_ASSERT_MSG(sfx > synthInfo.voiceNum, "Sfx voices are above maximum voice number.");
|
MUSY_ASSERT_MSG(sfx <= synthInfo.voiceNum, "Sfx voices are above maximum voice number.");
|
||||||
|
|
||||||
synthInfo.maxMusic = music;
|
synthInfo.maxMusic = music;
|
||||||
synthInfo.maxSFX = sfx;
|
synthInfo.maxSFX = sfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
bool sndIsInstalled() { return sndActive; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
SND_PLAYBACKINFO* sndGetPlayBackInfo() {
|
||||||
|
if (sndActive) {
|
||||||
|
return &synthInfo.pbInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -15,32 +15,33 @@ static MAC_SUBTAB dataMacSubTabmem[2048];
|
||||||
static u16 dataFXGroupNum = 0;
|
static u16 dataFXGroupNum = 0;
|
||||||
static FX_GROUP dataFXGroups[128];
|
static FX_GROUP dataFXGroups[128];
|
||||||
|
|
||||||
|
// #line 94
|
||||||
u32 dataInsertKeymap(u16 cid, void* keymapdata) {
|
u32 dataInsertKeymap(u16 cid, void* keymapdata) {
|
||||||
long i; // r31
|
long i; // r31
|
||||||
long j; // r29
|
long j; // r29
|
||||||
|
|
||||||
hwDisableIrq();
|
hwDisableIrq();
|
||||||
for (i = 0; i < dataKeymapNum && dataKeymapTab[i].id < cid; ++i);
|
|
||||||
|
for (i = 0; i < dataKeymapNum && dataKeymapTab[i].id < cid; ++i)
|
||||||
|
;
|
||||||
|
|
||||||
if (i < dataKeymapNum) {
|
if (i < dataKeymapNum) {
|
||||||
if (cid == dataKeymapTab[i].id) {
|
if (cid != dataKeymapTab[i].id) {
|
||||||
|
if (dataKeymapNum < 256) {
|
||||||
|
for (j = dataKeymapNum - 1; j >= i; --j) {
|
||||||
|
dataKeymapTab[j + 1] = dataKeymapTab[j];
|
||||||
|
}
|
||||||
|
++dataKeymapNum;
|
||||||
|
} else {
|
||||||
|
hwEnableIrq();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
dataKeymapTab[i].refCount++;
|
dataKeymapTab[i].refCount++;
|
||||||
hwEnableIrq();
|
hwEnableIrq();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
} else if (dataKeymapNum < 256) {
|
||||||
if (256 < dataKeymapNum) {
|
|
||||||
hwEnableIrq();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
j = dataKeymapNum;
|
|
||||||
for (j = dataKeymapNum; i <= j; --j) {
|
|
||||||
dataKeymapTab[j].id = dataKeymapTab[j - 1].id;
|
|
||||||
dataKeymapTab[j].refCount = dataKeymapTab[j - 1].refCount;
|
|
||||||
dataKeymapTab[j].data = dataKeymapTab[j - 1].data;
|
|
||||||
}
|
|
||||||
} else if (256 < dataKeymapNum) {
|
|
||||||
hwEnableIrq();
|
hwEnableIrq();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue