Decompile __CSPRepostEvent

This commit is contained in:
Ryan Dwyer committed 2021-03-27 16:54:12 +10:00
1 parent 4488a219de
commit 9148abb178
7 files changed
+368 -75

No files matched your search

+1
View File
@@ -83,6 +83,7 @@ $(B_DIR)/lib/ultra/libc/llcvt.o: MIPSISET := -mips3 -32
# it introduces a race condition when using make -j because they create a
# temporary include-stdin.u file during compilation.
# For these files, see their explicit targets towards the end of this file.
$(B_DIR)/lib/ultra/audio/csplayer.o: OPT_LVL := -g
$(B_DIR)/lib/ultra/audio/heap.o: OPT_LVL := -g
$(B_DIR)/lib/ultra/gu/align.o: OPT_LVL := -O3
$(B_DIR)/lib/ultra/gu/frustum.o: OPT_LVL := -O3
+1 -1
View File
@@ -66,7 +66,7 @@
build/ROMID/lib/lib_30ce0.o (section); \
build/ROMID/lib/lib_317f0.o (section); \
build/ROMID/lib/lib_34030.o (section); \
build/ROMID/lib/lib_34240.o (section); \
build/ROMID/lib/ultra/audio/csplayer.o (section); \
build/ROMID/lib/lib_37650.o (section); \
build/ROMID/lib/lib_37b00.o (section); \
build/ROMID/lib/lib_38d10.o (section); \
+1 -1
View File
@@ -64,7 +64,7 @@
build/ROMID/lib/lib_30ce0.o (section); \
build/ROMID/lib/lib_317f0.o (section); \
build/ROMID/lib/lib_34030.o (section); \
build/ROMID/lib/lib_34240.o (section); \
build/ROMID/lib/ultra/audio/csplayer.o (section); \
build/ROMID/lib/lib_37650.o (section); \
build/ROMID/lib/lib_37b00.o (section); \
build/ROMID/lib/lib_38d10.o (section); \
+1 -1
View File
@@ -64,7 +64,7 @@
build/ROMID/lib/lib_30ce0.o (section); \
build/ROMID/lib/lib_317f0.o (section); \
build/ROMID/lib/lib_34030.o (section); \
build/ROMID/lib/lib_34240.o (section); \
build/ROMID/lib/ultra/audio/csplayer.o (section); \
build/ROMID/lib/lib_37650.o (section); \
build/ROMID/lib/lib_37b00.o (section); \
build/ROMID/lib/lib_38d10.o (section); \
+336
View File
@@ -0,0 +1,336 @@
/*====================================================================
* audioInternals.h
*
* Synopsis:
*
* Copyright 1993, 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 __audioInternals__
#define __audioInternals__
#include <PR/libaudio.h>
/*
* filter message ids
*/
enum {
AL_FILTER_FREE_VOICE,
AL_FILTER_SET_SOURCE,
AL_FILTER_ADD_SOURCE,
AL_FILTER_ADD_UPDATE,
AL_FILTER_RESET,
AL_FILTER_SET_WAVETABLE,
/* AL_FILTER_SET_DMA_PROC,*/
/* AL_FILTER_SKIP_LOOP,*/
AL_FILTER_SET_DRAM,
AL_FILTER_SET_PITCH,
AL_FILTER_SET_UNITY_PITCH,
AL_FILTER_START,
/* AL_FILTER_SET_DECAY,*/
/* AL_FILTER_SET_FC,*/
AL_FILTER_SET_STATE,
AL_FILTER_SET_VOLUME,
AL_FILTER_SET_PAN,
AL_FILTER_START_VOICE_ALT,
AL_FILTER_START_VOICE,
AL_FILTER_STOP_VOICE,
AL_FILTER_SET_FXAMT
};
#define AL_MAX_RSP_SAMPLES 160
/*
* buffer locations based on AL_MAX_RSP_SAMPLES
*/
#define AL_DECODER_IN 0
#define AL_RESAMPLER_OUT 0
#define AL_TEMP_0 0
#define AL_DECODER_OUT 320
#define AL_TEMP_1 320
#define AL_TEMP_2 640
#define AL_MAIN_L_OUT 1088
#define AL_MAIN_R_OUT 1408
#define AL_AUX_L_OUT 1728
#define AL_AUX_R_OUT 2048
/*
* filter types
*/
enum {
AL_ADPCM,
AL_RESAMPLE,
AL_BUFFER,
AL_SAVE,
AL_ENVMIX,
AL_FX,
AL_AUXBUS,
AL_MAINBUS
};
typedef struct ALParam_s {
struct ALParam_s *next;
s32 delta;
s16 type;
union {
f32 f;
s32 i;
} data;
union {
f32 f;
s32 i;
} moredata;
union {
f32 f;
s32 i;
} stillmoredata;
union {
f32 f;
s32 i;
} yetstillmoredata;
} ALParam;
typedef struct {
struct ALParam_s *next;
s32 delta;
s16 type;
s16 unity; /* disable resampler */
f32 pitch;
s16 volume;
ALPan pan;
u8 fxMix;
s32 samples;
struct ALWaveTable_s *wave;
} ALStartParamAlt;
typedef struct {
struct ALParam_s *next;
s32 delta;
s16 type;
s16 unity; /* disable resampler */
struct ALWaveTable_s *wave;
} ALStartParam;
typedef struct {
struct ALParam_s *next;
s32 delta;
s16 type;
struct PVoice_s *pvoice;
} ALFreeParam;
typedef Acmd *(*ALCmdHandler)(void *, s16 *, s32, s32, Acmd *);
typedef s32 (*ALSetParam)(void *, s32, void *);
typedef struct ALFilter_s {
struct ALFilter_s *source;
ALCmdHandler handler;
ALSetParam setParam;
s16 inp;
s16 outp;
s32 type;
} ALFilter;
void alFilterNew(ALFilter *f, ALCmdHandler h, ALSetParam s, s32 type);
#define AL_MAX_ADPCM_STATES 3 /* Depends on number of subframes
* per frame and loop length
*/
typedef struct {
ALFilter filter;
ADPCM_STATE *state;
ADPCM_STATE *lstate;
ALRawLoop loop;
struct ALWaveTable_s *table;
s32 bookSize;
ALDMAproc dma;
void *dmaState;
s32 sample;
s32 lastsam;
s32 first;
s32 memin;
} ALLoadFilter;
void alLoadNew(ALLoadFilter *f, ALDMANew dma, ALHeap *hp);
Acmd *alAdpcmPull(void *f, s16 *outp, s32 byteCount, s32 sampleOffset, Acmd *p);
Acmd *alRaw16Pull(void *f, s16 *outp, s32 byteCount, s32 sampleOffset, Acmd *p);
s32 alLoadParam(void *filter, s32 paramID, void *param);
typedef struct ALResampler_s {
ALFilter filter;
RESAMPLE_STATE *state;
f32 ratio;
s32 upitch;
f32 delta;
s32 first;
ALParam *ctrlList;
ALParam *ctrlTail;
s32 motion;
} ALResampler;
typedef struct {
s16 fc;
s16 fgain;
union {
s16 fccoef[16];
s64 force_aligned;
} fcvec;
POLEF_STATE *fstate;
s32 first;
} ALLowPass;
typedef struct {
u32 input;
u32 output;
s16 ffcoef;
s16 fbcoef;
s16 gain;
f32 rsinc;
f32 rsval;
s32 rsdelta;
f32 rsgain;
ALLowPass *lp;
ALResampler *rs;
} ALDelay;
typedef s32 (*ALSetFXParam)(void *, s32, void *);
typedef struct {
struct ALFilter_s filter;
s16 *base;
s16 *input;
u32 length;
ALDelay *delay;
u8 section_count;
ALSetFXParam paramHdl;
} ALFx;
void alFxNew(ALFx *r, ALSynConfig *c, ALHeap *hp);
Acmd *alFxPull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
s32 alFxParam(void *filter, s32 paramID, void *param);
s32 alFxParamHdl(void *filter, s32 paramID, void *param);
#define AL_MAX_MAIN_BUS_SOURCES 1
typedef struct ALMainBus_s {
ALFilter filter;
s32 sourceCount;
s32 maxSources;
ALFilter **sources;
} ALMainBus;
void alMainBusNew(ALMainBus *m, void *ptr, s32 len);
Acmd *alMainBusPull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
s32 alMainBusParam(void *filter, s32 paramID, void *param);
#define AL_MAX_AUX_BUS_SOURCES 8
#define AL_MAX_AUX_BUS_FX 1
typedef struct ALAuxBus_s {
ALFilter filter;
s32 sourceCount;
s32 maxSources;
ALFilter **sources;
ALFx fx[AL_MAX_AUX_BUS_FX];
} ALAuxBus;
void alAuxBusNew(ALAuxBus *m, void *ptr, s32 len);
Acmd *alAuxBusPull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
s32 alAuxBusParam(void *filter, s32 paramID, void *param);
void alResampleNew(ALResampler *r, ALHeap *hp);
Acmd *alResamplePull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
s32 alResampleParam(void *f, s32 paramID, void *param);
typedef struct ALSave_s {
ALFilter filter;
s32 dramout;
s32 first;
} ALSave;
void alSaveNew(ALSave *r);
Acmd *alSavePull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
s32 alSaveParam(void *f, s32 paramID, void *param);
typedef struct ALEnvMixer_s {
ALFilter filter;
ENVMIX_STATE *state;
s16 pan;
s16 volume;
s16 cvolL;
s16 cvolR;
s16 dryamt;
s16 wetamt;
u16 lratl;
s16 lratm;
s16 ltgt;
u16 rratl;
s16 rratm;
s16 rtgt;
s32 delta;
s32 segEnd;
s32 first;
ALParam *ctrlList;
ALParam *ctrlTail;
ALFilter **sources;
s32 motion;
} ALEnvMixer;
void alEnvmixerNew(ALEnvMixer *e, ALHeap *hp);
Acmd *alEnvmixerPull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
s32 alEnvmixerParam(void *filter, s32 paramID, void *param);
/*
* heap stuff
*/
typedef struct {
s32 magic; /* check structure integrety */
s32 size; /* size of this allocated block */
u8 *file; /* file that this alloc was called from */
s32 line; /* line that it was called from */
s32 count; /* heap call number */
s32 pad0;
s32 pad1;
s32 pad2; /* Make it 32 bytes */
} HeapInfo;
#define AL_CACHE_ALIGN 15
/*
* synth stuff
*/
typedef struct PVoice_s {
ALLink node;
struct ALVoice_s *vvoice;
ALFilter *channelKnob;
ALLoadFilter decoder;
ALResampler resampler;
ALEnvMixer envmixer;
s32 offset;
} PVoice;
/*
* prototypes for private driver functions
*/
ALParam *__allocParam(void);
void __freeParam(ALParam *param);
void _freePVoice(ALSynth *drvr, PVoice *pvoice);
void _collectPVoices(ALSynth *drvr);
s32 _timeToSamples(ALSynth *ALSynth, s32 micros);
ALMicroTime _samplesToTime(ALSynth *synth, s32 samples);
#endif
-1
View File
@@ -10,7 +10,6 @@ u32 func00034f0c(void);
u32 func00034fb8(void);
u32 func00035110(void);
u32 func00037220(void);
u32 func00037460(void);
u32 func00037554(void);
u32 func0003759c(void);
@@ -6660,7 +6660,7 @@ glabel func00037220
/* 37420: 00000000 */ nop
/* 37424: 8fa40040 */ lw $a0,0x40($sp)
/* 37428: 8fa50024 */ lw $a1,0x24($sp)
/* 3742c: 0c00dd18 */ jal func00037460
/* 3742c: 0c00dd18 */ jal __CSPRepostEvent
/* 37430: 24840048 */ addiu $a0,$a0,0x48
/* 37434: 8fae0020 */ lw $t6,0x20($sp)
/* 37438: afae0024 */ sw $t6,0x24($sp)
@@ -6677,76 +6677,33 @@ glabel func00037220
/* 3745c: 00000000 */ nop
);
GLOBAL_ASM(
glabel func00037460
/* 37460: 27bdffd8 */ addiu $sp,$sp,-40
/* 37464: afbf0014 */ sw $ra,0x14($sp)
/* 37468: afa40028 */ sw $a0,0x28($sp)
/* 3746c: afa5002c */ sw $a1,0x2c($sp)
/* 37470: 0c012194 */ jal osSetIntMask
/* 37474: 24040001 */ addiu $a0,$zero,0x1
/* 37478: afa20024 */ sw $v0,0x24($sp)
/* 3747c: 8fae0028 */ lw $t6,0x28($sp)
/* 37480: 25cf0008 */ addiu $t7,$t6,0x8
/* 37484: 11e0002b */ beqz $t7,.L00037534
/* 37488: afaf0020 */ sw $t7,0x20($sp)
.L0003748c:
/* 3748c: 8fb80020 */ lw $t8,0x20($sp)
/* 37490: 8f190000 */ lw $t9,0x0($t8)
/* 37494: 17200008 */ bnez $t9,.L000374b8
/* 37498: 00000000 */ nop
/* 3749c: 8fa4002c */ lw $a0,0x2c($sp)
/* 374a0: 0c00c5dc */ jal alLink
/* 374a4: 8fa50020 */ lw $a1,0x20($sp)
/* 374a8: 10000022 */ b .L00037534
/* 374ac: 00000000 */ nop
/* 374b0: 1000001c */ b .L00037524
/* 374b4: 00000000 */ nop
.L000374b8:
/* 374b8: 8fa80020 */ lw $t0,0x20($sp)
/* 374bc: 8d090000 */ lw $t1,0x0($t0)
/* 374c0: afa9001c */ sw $t1,0x1c($sp)
/* 374c4: 8faa002c */ lw $t2,0x2c($sp)
/* 374c8: 8fac001c */ lw $t4,0x1c($sp)
/* 374cc: 8d4b0008 */ lw $t3,0x8($t2)
/* 374d0: 8d8d0008 */ lw $t5,0x8($t4)
/* 374d4: 016d082a */ slt $at,$t3,$t5
/* 374d8: 1020000c */ beqz $at,.L0003750c
/* 374dc: 00000000 */ nop
/* 374e0: 8fae001c */ lw $t6,0x1c($sp)
/* 374e4: 8fb8002c */ lw $t8,0x2c($sp)
/* 374e8: 8dcf0008 */ lw $t7,0x8($t6)
/* 374ec: 8f190008 */ lw $t9,0x8($t8)
/* 374f0: 01f94023 */ subu $t0,$t7,$t9
/* 374f4: adc80008 */ sw $t0,0x8($t6)
/* 374f8: 8fa4002c */ lw $a0,0x2c($sp)
/* 374fc: 0c00c5dc */ jal alLink
/* 37500: 8fa50020 */ lw $a1,0x20($sp)
/* 37504: 1000000b */ b .L00037534
/* 37508: 00000000 */ nop
.L0003750c:
/* 3750c: 8fa9002c */ lw $t1,0x2c($sp)
/* 37510: 8fac001c */ lw $t4,0x1c($sp)
/* 37514: 8d2a0008 */ lw $t2,0x8($t1)
/* 37518: 8d8b0008 */ lw $t3,0x8($t4)
/* 3751c: 014b6823 */ subu $t5,$t2,$t3
/* 37520: ad2d0008 */ sw $t5,0x8($t1)
.L00037524:
/* 37524: 8fb80020 */ lw $t8,0x20($sp)
/* 37528: 8f0f0000 */ lw $t7,0x0($t8)
/* 3752c: 15e0ffd7 */ bnez $t7,.L0003748c
/* 37530: afaf0020 */ sw $t7,0x20($sp)
.L00037534:
/* 37534: 0c012194 */ jal osSetIntMask
/* 37538: 8fa40024 */ lw $a0,0x24($sp)
/* 3753c: 10000001 */ b .L00037544
/* 37540: 00000000 */ nop
.L00037544:
/* 37544: 8fbf0014 */ lw $ra,0x14($sp)
/* 37548: 27bd0028 */ addiu $sp,$sp,0x28
/* 3754c: 03e00008 */ jr $ra
/* 37550: 00000000 */ nop
);
void __CSPRepostEvent(ALEventQueue *evtq, ALEventListItem *item)
{
OSIntMask mask;
ALLink *node;
ALEventListItem *nextItem;
mask = osSetIntMask(OS_IM_NONE);
for (node = &evtq->allocList; node != 0; node = node->next) {
if (!node->next) {
alLink((ALLink *)item, node);
break;
} else {
nextItem = (ALEventListItem *)node->next;
if (item->delta < nextItem->delta) {
nextItem->delta -= item->delta;
alLink((ALLink *)item, node);
break;
}
item->delta -= nextItem->delta;
}
}
osSetIntMask(mask);
}
GLOBAL_ASM(
glabel func00037554