This commit is contained in:
Donkey Kong 2024-10-04 17:43:43 -05:00
parent 0b1e6d704a
commit e912f3df80
17 changed files with 266 additions and 94 deletions

View File

@ -331,12 +331,12 @@ segments:
- [0x21371D0, c, audio/code_1371D0]
- [0x2137630, c, audio/code_137630]
- [0x2137C10, c, audio/csplayer]
- [0x213A6A0, c, audio/code_13A6A0]
- [0x213A750, c, audio/code_13A750]
- [0x213A750, c, audio/cspsetbank]
- [0x213A7A0, c, audio/code_13A7A0]
- [0x213C920, c, audio/code_13C920]
- [0x213CB30, c, audio/code_13CB30]
- [0x213CB50, c, audio/code_13CB50]
- [0x213CB30, c, audio/seqpgetstate]
- [0x213CB50, c, audio/cspplay]
- [0x213CB90, c, audio/code_13CB90]
- [0x213CE70, c, audio/code_13CE70]
- [0x213CFA0, c, audio/code_13CFA0]
- [0x213D020, c, audio/code_13D020]

View File

@ -3849,8 +3849,8 @@ f32 func_global_asm_80732DAC(f32 arg0);
// TODO: func_global_asm_807359A0 has no documented signature but has been matched
// TODO: func_global_asm_80735A34 has no documented signature but has been matched
// global_asm/audio/code_13A750.c
void func_global_asm_80735A50(ALSeqPlayer *arg0, s32 arg1);
// global_asm/audio/cspsetbank.c
void func_global_asm_80735A50(ALSeqPlayer *arg0, ALBank *arg1);
// global_asm/audio/code_13A7A0.c
// TODO: func_global_asm_80735AA0 has no documented signature
@ -3878,11 +3878,11 @@ void func_global_asm_80737B58(u8 arg0, u16 arg1);
void func_global_asm_80737C20(s32 arg0);
void func_global_asm_80737CF4(s32 arg0, s32 arg1);
// global_asm/audio/code_13CB30.c
// global_asm/audio/seqpgetstate.c
s32 func_global_asm_80737E30(ALSeqPlayer *seqp);
// global_asm/audio/code_13CB50.c
void func_global_asm_80737E50(ALSeqPlayer *seqp);
// global_asm/audio/cspplay.c
void func_global_asm_80737E50(ALCSPlayer *seqp);
// TODO: func_global_asm_80737E90 has no documented signature but has been matched
// TODO: func_global_asm_80737EA4 has no documented signature but has been matched
// TODO: func_global_asm_80737F0C has no documented signature but has been matched

View File

@ -2134,13 +2134,16 @@ typedef struct N_ALMAinBus_s {
CommandHandler handler;
} N_ALMAinBus;
typedef struct SoundState {
typedef struct SoundState SoundState;
struct SoundState {
ALLink node;
ALSound *sound;
ALVoice voice;
f32 unk28;
f32 unk2C;
u8 pad30[0x38-0x30];
f32 pitch;
SoundState **unk30;
s32 unk34;
s16 volume;
u8 pad3A[0x40 - 0x3A];
u8 priority;
@ -2149,7 +2152,7 @@ typedef struct SoundState {
u8 status;
u8 playState;
u8 pad45[0x48-0x45];
} SoundState;
};
typedef struct CustomResampler {
s32 unk0;

View File

@ -393,7 +393,7 @@ us,asm,func_global_asm_80624CA4,1576,no
us,asm,func_global_asm_8065E0CC,88,yes
us,asm,func_global_asm_806A018C,356,yes
us,asm,func_global_asm_806188F4,56,yes
us,asm,func_global_asm_80737198,212,no
us,asm,func_global_asm_80737198,212,yes
us,asm,func_global_asm_806D281C,200,yes
us,asm,func_global_asm_806BFBF4,5292,no
us,asm,func_global_asm_8061537C,144,yes
@ -1899,7 +1899,7 @@ us,asm,func_global_asm_8069E018,40,yes
us,asm,func_global_asm_806156A0,60,yes
us,asm,func_global_asm_806D2A14,140,yes
us,asm,func_global_asm_807023E8,124,yes
us,asm,func_global_asm_8073749C,324,no
us,asm,func_global_asm_8073749C,324,yes
us,asm,func_global_asm_806159EC,80,yes
us,asm,func_global_asm_80687EE0,156,yes
us,asm,func_global_asm_8066104C,8,yes
@ -3066,7 +3066,7 @@ us,asm,func_global_asm_8064B370,136,yes
us,asm,func_global_asm_806E84C0,56,yes
us,asm,func_global_asm_80652F9C,64,yes
us,asm,func_global_asm_806B3D18,140,yes
us,asm,func_global_asm_807370A4,244,no
us,asm,func_global_asm_807370A4,244,yes
us,asm,func_global_asm_8066C2D0,832,no
us,asm,func_global_asm_80711F90,804,no
us,asm,func_global_asm_8061C6A8,348,no

1 version section function length matching
393 us asm func_global_asm_8065E0CC 88 yes
394 us asm func_global_asm_806A018C 356 yes
395 us asm func_global_asm_806188F4 56 yes
396 us asm func_global_asm_80737198 212 no yes
397 us asm func_global_asm_806D281C 200 yes
398 us asm func_global_asm_806BFBF4 5292 no
399 us asm func_global_asm_8061537C 144 yes
1899 us asm func_global_asm_806156A0 60 yes
1900 us asm func_global_asm_806D2A14 140 yes
1901 us asm func_global_asm_807023E8 124 yes
1902 us asm func_global_asm_8073749C 324 no yes
1903 us asm func_global_asm_806159EC 80 yes
1904 us asm func_global_asm_80687EE0 156 yes
1905 us asm func_global_asm_8066104C 8 yes
3066 us asm func_global_asm_806E84C0 56 yes
3067 us asm func_global_asm_80652F9C 64 yes
3068 us asm func_global_asm_806B3D18 140 yes
3069 us asm func_global_asm_807370A4 244 no yes
3070 us asm func_global_asm_8066C2D0 832 no
3071 us asm func_global_asm_80711F90 804 no
3072 us asm func_global_asm_8061C6A8 348 no

View File

@ -393,7 +393,7 @@ us,asm,func_global_asm_80624CA4,1576,no
us,asm,func_global_asm_8065E0CC,88,yes
us,asm,func_global_asm_806A018C,356,yes
us,asm,func_global_asm_806188F4,56,yes
us,asm,func_global_asm_80737198,212,no
us,asm,func_global_asm_80737198,212,yes
us,asm,func_global_asm_806D281C,200,yes
us,asm,func_global_asm_806BFBF4,5292,no
us,asm,func_global_asm_8061537C,144,yes
@ -1899,7 +1899,7 @@ us,asm,func_global_asm_8069E018,40,yes
us,asm,func_global_asm_806156A0,60,yes
us,asm,func_global_asm_806D2A14,140,yes
us,asm,func_global_asm_807023E8,124,yes
us,asm,func_global_asm_8073749C,324,no
us,asm,func_global_asm_8073749C,324,yes
us,asm,func_global_asm_806159EC,80,yes
us,asm,func_global_asm_80687EE0,156,yes
us,asm,func_global_asm_8066104C,8,yes
@ -3066,7 +3066,7 @@ us,asm,func_global_asm_8064B370,136,yes
us,asm,func_global_asm_806E84C0,56,yes
us,asm,func_global_asm_80652F9C,64,yes
us,asm,func_global_asm_806B3D18,140,yes
us,asm,func_global_asm_807370A4,244,no
us,asm,func_global_asm_807370A4,244,yes
us,asm,func_global_asm_8066C2D0,832,no
us,asm,func_global_asm_80711F90,804,no
us,asm,func_global_asm_8061C6A8,348,no

1 version section function length matching
393 us asm func_global_asm_8065E0CC 88 yes
394 us asm func_global_asm_806A018C 356 yes
395 us asm func_global_asm_806188F4 56 yes
396 us asm func_global_asm_80737198 212 no yes
397 us asm func_global_asm_806D281C 200 yes
398 us asm func_global_asm_806BFBF4 5292 no
399 us asm func_global_asm_8061537C 144 yes
1899 us asm func_global_asm_806156A0 60 yes
1900 us asm func_global_asm_806D2A14 140 yes
1901 us asm func_global_asm_807023E8 124 yes
1902 us asm func_global_asm_8073749C 324 no yes
1903 us asm func_global_asm_806159EC 80 yes
1904 us asm func_global_asm_80687EE0 156 yes
1905 us asm func_global_asm_8066104C 8 yes
3066 us asm func_global_asm_806E84C0 56 yes
3067 us asm func_global_asm_80652F9C 64 yes
3068 us asm func_global_asm_806B3D18 140 yes
3069 us asm func_global_asm_807370A4 244 no yes
3070 us asm func_global_asm_8066C2D0 832 no
3071 us asm func_global_asm_80711F90 804 no
3072 us asm func_global_asm_8061C6A8 348 no

View File

@ -17,7 +17,7 @@
<text x="38.5" y="14">global_asm</text>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="111.5" y="15" fill="#010101" fill-opacity=".3">38.9452%</text>
<text x="110.5" y="14">38.9452%</text>
<text x="111.5" y="15" fill="#010101" fill-opacity=".3">39.0086%</text>
<text x="110.5" y="14">39.0086%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -17,7 +17,7 @@
<text x="66.0" y="14">Donkey Kong 64 (US)</text>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="166.5" y="15" fill="#010101" fill-opacity=".3">41.3706%</text>
<text x="165.5" y="14">41.3706%</text>
<text x="166.5" y="15" fill="#010101" fill-opacity=".3">41.4180%</text>
<text x="165.5" y="14">41.4180%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,40 +0,0 @@
#include <ultra64.h>
#include "functions.h"
typedef struct {
u8 unk0[0x18 - 0x0];
s32 unk18;
u8 unk1C[0x24 - 0x1C];
s32 unk24;
s32 unk28;
s32 unk2C;
u8 unk30[0x48 - 0x30];
s32 unk48;
} Struct807359A0;
void func_global_asm_807359A0(Struct807359A0 *arg0) {
s32 pad[3];
s16 pad2;
s16 sp20;
s32 sp1C;
if (!(arg0->unk2C == 1) || !arg0->unk18) {
return;
}
if (!func_global_asm_8073D060(arg0->unk18, &sp1C)) {
return;
}
sp20 = 0;
alEvtqPostEvent(&arg0->unk48, &sp20, arg0->unk24 * sp1C);
}
typedef struct {
u8 unk0[0x88 - 0x0];
u8 unk88;
} Struct80735A34;
void func_global_asm_80735A34(Struct80735A34 *arg0, u8 arg1) {
arg0->unk88 = arg1;
}

View File

@ -1,13 +0,0 @@
#include <ultra64.h>
#include "functions.h"
void func_global_asm_80735A50(ALSeqPlayer *arg0, s32 arg1) {
s32 pad[2];
s32 sp1C;
s16 sp1A;
s16 sp18; // TODO: ALEvent
sp18 = 0xE;
sp1C = arg1;
alEvtqPostEvent(&arg0->evtq, &sp18, 0);
}

View File

@ -1,5 +1,6 @@
#include <ultra64.h>
#include "functions.h"
#include "sndp.h"
typedef struct {
u8 unk0[0x14];
@ -76,8 +77,8 @@ extern SoundState *D_global_asm_807563C0;
extern u16 *D_global_asm_807FF0E4;
void func_global_asm_80735DBC(ALEvent *);
void func_global_asm_807370A4(s32, void *, s32);
void func_global_asm_8073749C(void *);
void func_global_asm_807370A4(ALEventQueue *, ALSoundState *, u16);
void func_global_asm_8073749C(SoundState *);
void func_global_asm_8073B6B0(void *);
void func_global_asm_8073B750(void *);
@ -129,13 +130,90 @@ void func_global_asm_80737028(struct_80737028_0 *arg0) {
alEvtqPostEvent(&D_global_asm_807563CC->evtq, &sp20, 0x8235);
}
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13A7A0/func_global_asm_807370A4.s")
void func_global_asm_807370A4(ALEventQueue *evtq, ALSoundState *state, u16 arg2) {
// __removeEVents
ALLink *thisNode;
ALLink *nextNode;
ALEventListItem *thisItem;
ALEventListItem *nextItem;
ALSndpEvent *sp1C;
OSIntMask mask;
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13A7A0/func_global_asm_80737198.s")
mask = osSetIntMask(1U);
thisNode = evtq->allocList.next;
while (thisNode) {
nextNode = thisNode->next;
thisItem = thisNode;
nextItem = nextNode;
sp1C = (ALSndpEvent *)&thisItem->evt;
if ((sp1C->common.state == state) && (*(u16*)(&sp1C->common.type) & arg2)) {
if (nextItem != NULL) {
nextItem->delta += thisItem->delta;
}
alUnlink(thisNode);
alLink(thisNode, evtq);
}
thisNode = nextNode;
}
osSetIntMask(mask);
}
extern SoundState *D_global_asm_807563C0;
extern SoundState *D_global_asm_807563C4;
extern SoundState *D_global_asm_807563C8;
u16 func_global_asm_80737198(u16 *arg0, u16 *arg1) {
u16 sp16;
u16 sp14;
u16 sp12;
SoundState *spC;
SoundState *sp8;
SoundState *sp4;
spC = D_global_asm_807563C0;
sp8 = D_global_asm_807563C8;
sp4 = D_global_asm_807563C4;
for (sp16 = 0; spC; sp16++, spC = spC->node.next) {}
for (sp14 = 0; sp8; sp14++, sp8 = sp8->node.next) {}
for (sp12 = 0; sp4; sp12++, sp4 = sp4->node.prev) {}
*arg0 = sp14;
*arg1 = sp16;
return sp12;
}
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13A7A0/func_global_asm_8073726C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13A7A0/func_global_asm_8073749C.s")
extern s16 D_global_asm_807563D0;
void func_global_asm_8073749C(SoundState *arg0) {
if (D_global_asm_807563C0 == arg0) {
D_global_asm_807563C0 = arg0->node.next;
}
if (D_global_asm_807563C4 == arg0) {
D_global_asm_807563C4 = arg0->node.prev;
}
alUnlink(arg0);
if (D_global_asm_807563C8 != NULL) {
arg0->node.next = D_global_asm_807563C8;
arg0->node.prev = NULL;
D_global_asm_807563C8->node.prev = arg0;
D_global_asm_807563C8 = arg0;
} else {
arg0->node.prev = NULL;
arg0->node.next = arg0->node.prev;
D_global_asm_807563C8 = arg0;
}
if (arg0->status & 4) {
D_global_asm_807563D0--;
}
arg0->playState = 0;
if (arg0->unk30 != NULL) {
if (*arg0->unk30 == arg0) {
*arg0->unk30 = 0;
}
arg0->unk30 = NULL;
}
}
void func_global_asm_807375E0(Struct_807375E0 *arg0, u8 arg1) {
if (arg0 != 0) {

View File

@ -51,13 +51,6 @@ typedef struct {
Struct80737F0C_unk60 *unk60;
} Struct80737F0C;
void func_global_asm_80737E50(ALSeqPlayer* arg0) {
ALEvent sp18;
sp18.type = AL_SEQP_PLAY_EVT;
alEvtqPostEvent(&arg0->evtq, &sp18, 0);
}
void func_global_asm_80737E90(Struct80737E90 *arg0, s32 arg1) {
arg0->unk84 = arg1;
}
@ -87,7 +80,7 @@ void func_global_asm_80737F40(Struct80737F0C *arg0) {
}
}
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB50/func_global_asm_80737FD8.s")
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB90/func_global_asm_80737FD8.s")
/*
void func_global_asm_80737FD8(ALSeqPlayer *arg0, s32 arg1) {
@ -95,7 +88,7 @@ void func_global_asm_80737FD8(ALSeqPlayer *arg0, s32 arg1) {
}
*/
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB50/func_global_asm_8073801C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB90/func_global_asm_8073801C.s")
/*
void func_global_asm_8073801C(ALSeqPlayer *arg0, s32 arg1) {
@ -104,7 +97,7 @@ void func_global_asm_8073801C(ALSeqPlayer *arg0, s32 arg1) {
}
*/
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB50/func_global_asm_80738080.s")
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB90/func_global_asm_80738080.s")
/*
void func_global_asm_80738080(ALSeqPlayer *arg0, s32 arg1, u8 arg2) {
@ -112,7 +105,7 @@ void func_global_asm_80738080(ALSeqPlayer *arg0, s32 arg1, u8 arg2) {
}
*/
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB50/func_global_asm_807380CC.s")
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB90/func_global_asm_807380CC.s")
/*
void func_global_asm_807380CC(ALSeqPlayer *arg0, s32 arg1, u8 arg2) {
@ -120,7 +113,7 @@ void func_global_asm_807380CC(ALSeqPlayer *arg0, s32 arg1, u8 arg2) {
}
*/
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB50/func_global_asm_80738118.s")
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/audio/code_13CB90/func_global_asm_80738118.s")
/*
void func_global_asm_80738118(ALSeqPlayer *arg0, s32 arg1, u8 arg2) {

View File

@ -227,4 +227,32 @@ void func_global_asm_80735958(ALCSPlayer *seqp, f32 tempo) {
} else {
seqp->uspt = 0x1E8;
}
}
extern s32 func_global_asm_8073D060(ALCSeq *, u32 *);
void func_global_asm_807359A0(ALCSPlayer *seqp) {
// __CSPPostNextSeqEvent
ALEvent sp20;
u32 sp1C;
if (!(seqp->state == AL_PLAYING) || (!seqp->target)) {
return;
}
if (!func_global_asm_8073D060(seqp->target, &sp1C)) {
return;
}
sp20.type = AL_SEQ_REF_EVT;
alEvtqPostEvent(&seqp->evtq, &sp20, seqp->uspt * sp1C);
}
typedef struct {
u8 unk0[0x88 - 0x0];
u8 unk88;
} Struct80735A34;
void func_global_asm_80735A34(Struct80735A34 *arg0, u8 arg1) {
arg0->unk88 = arg1;
}

View File

@ -0,0 +1,10 @@
#include <ultra64.h>
#include "functions.h"
void func_global_asm_80737E50(ALCSPlayer * seqp) {
// alCSPPlay
ALEvent evt;
evt.type = AL_SEQP_PLAY_EVT;
alEvtqPostEvent(&seqp->evtq, &evt, 0);
}

View File

@ -0,0 +1,10 @@
#include <ultra64.h>
#include "functions.h"
void func_global_asm_80735A50(ALSeqPlayer *seqp, ALBank *b) {
ALEvent evt;
evt.type = AL_SEQP_BANK_EVT;
evt.msg.spbank.bank = b;
alEvtqPostEvent(&seqp->evtq, &evt, 0);
}

View File

@ -2,5 +2,6 @@
#include "functions.h"
s32 func_global_asm_80737E30(ALSeqPlayer *arg0) {
// alSeqpGetState
return arg0->state;
}

102
src/global_asm/audio/sndp.h Normal file
View File

@ -0,0 +1,102 @@
/*====================================================================
* sndp.h
*
* Synopsis:
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
#ifndef __SNDP__
#define __SNDP__
#include <libaudio.h>
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#define MIN_RATIO 0.0001
typedef enum {
AL_SNDP_PLAY_EVT,
AL_SNDP_STOP_EVT,
AL_SNDP_PAN_EVT,
AL_SNDP_VOL_EVT,
AL_SNDP_PITCH_EVT,
AL_SNDP_API_EVT,
AL_SNDP_DECAY_EVT,
AL_SNDP_END_EVT,
AL_SNDP_FX_EVT
} ALSndpMsgType;
typedef struct {
ALVoice voice;
ALSound *sound; /* sound referenced here */
s16 priority;
f32 pitch; /* current playback pitch */
s32 state; /* play state for this sound */
s16 vol; /* volume - combined with volume from bank */
ALPan pan; /* pan - 0 = left, 127 = right */
u8 fxMix; /* wet/dry mix - 0 = dry, 127 = wet */
} ALSoundState;
typedef union {
ALEvent msg;
struct {
s16 type;
ALSoundState *state;
} common;
struct {
s16 type;
ALSoundState *state;
s16 vol;
} vol;
struct {
s16 type;
ALSoundState *state;
f32 pitch;
} pitch;
struct {
s16 type;
ALSoundState *state;
ALPan pan;
} pan;
struct {
s16 type;
ALSoundState *state;
u8 mix;
} fx;
} ALSndpEvent;
static ALMicroTime _sndpVoiceHandler(void *node);
static void _handleEvent(ALSndPlayer *sndp, ALSndpEvent *event);
static void _removeEvents(ALEventQueue *evtq, ALSoundState *state);
static s32 _DivS32ByF32 (s32 i, f32 f);
#endif

View File

@ -20,7 +20,7 @@ extern struct_8076BF48 D_global_asm_8076BF48[];
extern struct_8076C328 D_global_asm_8076C328[];
void func_global_asm_8060B140(s32, s32*, s32*, s32, s32, s32, s32);
void func_global_asm_80737E50(ALSeqPlayer*);
void func_global_asm_80737E50(ALCSPlayer *);
void func_global_asm_80737F0C(ALSeqPlayer*, s32, u8);
void func_global_asm_80738080(ALSeqPlayer*, u8, u8);
void func_global_asm_807380CC(ALSeqPlayer*, s32, u8);