Difference between revisions of "FF7/PSX/Sound/Code Map"

From Final Fantasy Inside
< FF7
Jump to navigation Jump to search
m
(Add a number of PsyQ library functions)
Line 64: Line 64:
  
 
== Psy-Q Library Functions ==
 
== Psy-Q Library Functions ==
 +
 +
=== LIBSPU ===
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 72: Line 74:
 
|0x80036298
 
|0x80036298
 
|void SpuInit(void)
 
|void SpuInit(void)
|Initialize SPU
+
|
 +
|-
 +
|0x80036FFC
 +
|long SpuInitMalloc(long num, char *top)
 +
|
 +
|-
 +
|0x800373AC
 +
|long SpuMallocWithStartAddr(unsigned long addr, long size)
 +
|
 +
|-
 +
|0x80037964
 +
|unsigned long SpuSetNoiseVoice(long on_off, unsigned long voice_bit)
 +
|
 +
|-
 +
|0x80037B90
 +
|long SpuSetNoiseClock(long n_clock)
 +
|
 +
|-
 +
|0x80037BE0
 +
|unsigned long SpuRead(unsigned char *addr, unsigned long size)
 +
|
 +
|-
 +
|0x80037C40
 +
|long SpuSetReverb(long on_off)
 +
|
 +
|-
 +
|0x80037D90
 +
|long SpuGetReverb(void)
 +
|
 +
|-
 +
|0x80037E1C
 +
|long SpuSetReverbModeParam(SpuReverbAttr *attr)
 +
|
 +
|-
 +
|0x800387FC
 +
|void SpuGetReverbModeParam (SpuReverbAttr *attr)
 +
|
 +
|-
 +
|0x8003884C
 +
|long SpuSetReverbDepth(SpuReverbAttr *attr)
 +
|
 +
|-
 +
|0x800388C4
 +
|unsigned long SpuSetReverbVoice(long on_off, unsigned long voice_bit)
 +
|
 +
|-
 +
|0x800388E8
 +
|long SpuClearReverbWorkArea(long mode)
 +
|
 +
|-
 +
|0x80038A84
 +
|long SpuSetIRQ(long on_off)
 +
|
 +
|-
 +
|0x80038BC4
 +
|unsigned long SpuSetIRQAddr(unsigned long addr)
 +
|
 +
|-
 +
|0x80038C04
 +
|SpuIRQCallbackProc SpuSetIRQCallback(SpuIRQCallbackProc func)
 +
|
 +
|-
 +
|0x80038C6C
 +
|void SpuSetKey(long on_off, unsigned long voice_bit)
 +
|
 +
|-
 +
|0x80038F04
 +
|unsigned long SpuWrite(unsigned char *addr, unsigned long size)
 +
|
 +
|-
 +
|0x80038F64
 +
|unsigned long SpuSetTransferStartAddr(unsigned long addr)
 +
|
 +
|-
 +
|0x80038FB8
 +
|long SpuSetTransferMode(long mode)
 +
|
 +
|-
 +
|0x80038FEC
 +
|SpuTransferCallbackProc SpuSetTransferCallback(SpuTransferCallbackProc func)
 +
|
 +
|-
 +
|0x80039010
 +
|unsigned long SpuSetPitchLFOVoice(long on_off, unsigned long voice_bit)
 +
|
 +
|-
 +
|0x80039034
 +
|void SpuSetCommonAttr(SpuCommonAttr *attr)
 +
|
 +
|-
 +
|0x800393C8
 +
|void SpuSetVoiceVolume(int voiceNum, short volL, short volR)
 +
|
 +
|-
 +
|0x80039450
 +
|void SpuSetVoiceVolumeAttr(int voiceNum, short volL, short volR, short volModeL, short volModeR)
 +
|
 +
|-
 +
|0x800395C8
 +
|void SpuSetVoicePitch(int voiceNum, unsigned short pitch)
 +
|
 +
|-
 +
|0x80039644
 +
|void SpuSetVoiceStartAddr(int voiceNum, unsigned long startAddr)
 +
|
 +
|-
 +
|0x800396C0
 +
|void SpuSetVoiceLoopStartAddr(int voiceNum, unsigned long lsa)
 +
|
 +
|-
 +
|0x8003973C
 +
|void SpuSetVoiceDR(int voiceNum, unsigned short DR)
 +
|
 +
|-
 +
|0x800397C8
 +
|void SpuSetVoiceSL(int voiceNum, unsigned short SL)
 +
|
 +
|-
 +
|0x80039850
 +
|void SpuSetVoiceARAttr(int voiceNum, unsigned short AR, long ARmode)
 +
|
 +
|-
 +
|0x800398EC
 +
|void SpuSetVoiceSRAttr(int voiceNum, unsigned short SR, long SRmode)
 +
|
 +
|-
 +
|0x800399D0
 +
|void SpuSetVoiceRRAttr(int voiceNum, unsigned short RR, long RRmode)
 +
|
 +
|}
 +
 
 +
=== LIBETC ===
 +
 
 +
{| class="wikitable"
 +
! PSX Address
 +
! Declaration
 +
! Description
 
|-
 
|-
 
|0x8003D0C0
 
|0x8003D0C0
 
|int ResetCallback(void)
 
|int ResetCallback(void)
|Initialize all system callbacks
+
|
 +
|-
 +
|0x8003D150
 +
|int VSyncCallback(void (*func)(void))
 +
|
 +
|-
 +
|0x8003D1B4
 +
|int StopCallback(void)
 +
|
 +
|-
 +
|0x8003D214
 +
|int CheckCallback(void)
 +
|
 +
|}
 +
 
 +
=== LIBAPI ===
 +
 
 +
{| class="wikitable"
 +
! PSX Address
 +
! Declaration
 +
! Description
 +
|-
 +
|0x800429F0
 +
|void DeliverEvent(unsigned long ev1, unsigned long ev2)
 +
|
 +
|-
 +
|0x80042A00
 +
|long OpenEvent(unsigned long desc, long spec, long mode, long (*func)())
 +
|
 +
|-
 +
|0x80042A10
 +
|long CloseEvent(long event)
 +
|
 +
|-
 +
|0x80042A20
 +
|long WaitEvent(long event)
 +
|
 +
|-
 +
|0x80042A40
 +
|long EnableEvent(long event)
 +
|
 +
|-
 +
|0x80042A50
 +
|long DisableEvent(long event)
 +
|
 +
|-
 +
|0x80042BC0
 +
|long SetRCnt(unsigned long spec, unsigned short target, long mode)
 +
|
 +
|-
 +
|0x80042C60
 +
|long GetRCnt(unsigned long spec)
 +
|
 +
|-
 +
|0x80042C98
 +
|long StartRCnt(unsigned long spec)
 +
|
 +
|-
 +
|0x80042CCC
 +
|long StopRCnt(unsigned long spec)
 +
|
 
|}
 
|}
  

Revision as of 17:21, 31 May 2020

Code Map

Introduces functions, variables and data related to sound, contained in SCUS_941.63 (game program of US version). Note that all symbol names below are for convenience only.

PSX Address Declaration Description
0x80029818 void AkaoLoadInstrSet(const void *sampleSet, const void *instrSet) Load additional instrument set

sampleSet: corresponding to SOUND/INSTR2.ALL

instrSet: corresponding to SOUND/INSTR2.DAT

0x8002988C void AkaoInit(const void *sampleSet, const void *instrSet) Initialize sound driver and load initial instruments

sampleSet: corresponding to SOUND/INSTR.ALL

instrSet: corresponding to SOUND/INSTR.DAT

0x8002DA7C int AkaoLoadSeq(void) Load and start playing new AKAO sequence

Parameters are given from a global structure

Returns: 0 for success, 1 for already loaded, and -1 for invalid signature

0x80030234 int _AkaoCallback(void) Callback event for sound, registered by OpenEvent BIOS function
0x80030E7C void _AkaoDispatchVoice(struct MusicPlayerTrack *track, void *a1, int a2) Dispatch voice opcodes until the next note or end of track
0x80049948 const unsigned char VOICE_OPCODE_LENGTHS[0x60] Length table for voice opcodes 0xa0-0xff

0 for end of track and branches

0x80049AA8 void (* const VOICE_OPCODES[0x60])(struct MusicPlayerTrack *, void *, int) Address table for voice opcodes 0xa0-0xff
0x80049C44 const unsigned short VOLUME_TABLE_L[256] See Opcode 0xAA for volume balance calculation
0x80049E44 const unsigned short VOLUME_TABLE_R[256] See Opcode 0xAA for volume balance calculation
0x80083580 unsigned char g_AkaoSeqData[] RAM area to load AKAO sequence data

Psy-Q Library Functions

LIBSPU

PSX Address Declaration Description
0x80036298 void SpuInit(void)
0x80036FFC long SpuInitMalloc(long num, char *top)
0x800373AC long SpuMallocWithStartAddr(unsigned long addr, long size)
0x80037964 unsigned long SpuSetNoiseVoice(long on_off, unsigned long voice_bit)
0x80037B90 long SpuSetNoiseClock(long n_clock)
0x80037BE0 unsigned long SpuRead(unsigned char *addr, unsigned long size)
0x80037C40 long SpuSetReverb(long on_off)
0x80037D90 long SpuGetReverb(void)
0x80037E1C long SpuSetReverbModeParam(SpuReverbAttr *attr)
0x800387FC void SpuGetReverbModeParam (SpuReverbAttr *attr)
0x8003884C long SpuSetReverbDepth(SpuReverbAttr *attr)
0x800388C4 unsigned long SpuSetReverbVoice(long on_off, unsigned long voice_bit)
0x800388E8 long SpuClearReverbWorkArea(long mode)
0x80038A84 long SpuSetIRQ(long on_off)
0x80038BC4 unsigned long SpuSetIRQAddr(unsigned long addr)
0x80038C04 SpuIRQCallbackProc SpuSetIRQCallback(SpuIRQCallbackProc func)
0x80038C6C void SpuSetKey(long on_off, unsigned long voice_bit)
0x80038F04 unsigned long SpuWrite(unsigned char *addr, unsigned long size)
0x80038F64 unsigned long SpuSetTransferStartAddr(unsigned long addr)
0x80038FB8 long SpuSetTransferMode(long mode)
0x80038FEC SpuTransferCallbackProc SpuSetTransferCallback(SpuTransferCallbackProc func)
0x80039010 unsigned long SpuSetPitchLFOVoice(long on_off, unsigned long voice_bit)
0x80039034 void SpuSetCommonAttr(SpuCommonAttr *attr)
0x800393C8 void SpuSetVoiceVolume(int voiceNum, short volL, short volR)
0x80039450 void SpuSetVoiceVolumeAttr(int voiceNum, short volL, short volR, short volModeL, short volModeR)
0x800395C8 void SpuSetVoicePitch(int voiceNum, unsigned short pitch)
0x80039644 void SpuSetVoiceStartAddr(int voiceNum, unsigned long startAddr)
0x800396C0 void SpuSetVoiceLoopStartAddr(int voiceNum, unsigned long lsa)
0x8003973C void SpuSetVoiceDR(int voiceNum, unsigned short DR)
0x800397C8 void SpuSetVoiceSL(int voiceNum, unsigned short SL)
0x80039850 void SpuSetVoiceARAttr(int voiceNum, unsigned short AR, long ARmode)
0x800398EC void SpuSetVoiceSRAttr(int voiceNum, unsigned short SR, long SRmode)
0x800399D0 void SpuSetVoiceRRAttr(int voiceNum, unsigned short RR, long RRmode)

LIBETC

PSX Address Declaration Description
0x8003D0C0 int ResetCallback(void)
0x8003D150 int VSyncCallback(void (*func)(void))
0x8003D1B4 int StopCallback(void)
0x8003D214 int CheckCallback(void)

LIBAPI

PSX Address Declaration Description
0x800429F0 void DeliverEvent(unsigned long ev1, unsigned long ev2)
0x80042A00 long OpenEvent(unsigned long desc, long spec, long mode, long (*func)())
0x80042A10 long CloseEvent(long event)
0x80042A20 long WaitEvent(long event)
0x80042A40 long EnableEvent(long event)
0x80042A50 long DisableEvent(long event)
0x80042BC0 long SetRCnt(unsigned long spec, unsigned short target, long mode)
0x80042C60 long GetRCnt(unsigned long spec)
0x80042C98 long StartRCnt(unsigned long spec)
0x80042CCC long StopRCnt(unsigned long spec)

Structures

struct MusicPlayerTrack {
};