mirror of https://github.com/blawar/ooot.git
audio partially working
This commit is contained in:
parent
d15bd043ad
commit
b4f0eba3d9
|
@ -1,3 +1,6 @@
|
|||
[submodule "GLideN64"]
|
||||
path = GLideN64
|
||||
url = https://github.com/blawar/GLideN64.git
|
||||
[submodule "AziAudio"]
|
||||
path = AziAudio
|
||||
url = https://github.com/blawar/AziAudio.git
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit b32a71208e79e10c8de9216ffebcb15733c959de
|
|
@ -1,8 +1,9 @@
|
|||
#pragma once
|
||||
#include "z64audio.h"
|
||||
#include "sched.h"
|
||||
#include "z64math.h"
|
||||
|
||||
struct AudioTask;
|
||||
|
||||
struct SoundSource {
|
||||
/* 0x00 */ u16 countdown;
|
||||
/* 0x04 */ Vec3f originPos;
|
||||
|
@ -29,4 +30,4 @@ struct AudioMgr {
|
|||
|
||||
extern Vec3f D_801333D4;
|
||||
extern f32 D_801333E0;
|
||||
extern s8 D_801333E8;
|
||||
extern s8 D_801333E8;
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#pragma once
|
||||
#define osAiGetLength(a) 0
|
||||
u32 osAiGetLength();
|
|
@ -13,7 +13,7 @@ extern s8 D_801333E8;
|
|||
extern u8 D_801333F0;
|
||||
extern u8 D_8016E348[4];
|
||||
extern unk_D_8016E750 D_8016E750[4];
|
||||
extern ActiveSound gActiveSounds[7][MAX_CHANNELS_PER_BANK];
|
||||
extern ActiveSound gActiveSounds[7][3]; // MAX_CHANNELS_PER_BANK = 3
|
||||
extern AudioContext gAudioContext;
|
||||
extern u8 gAudioSfxSwapMode[10];
|
||||
extern u8 gAudioSfxSwapOff;
|
||||
|
|
|
@ -16,3 +16,63 @@ s32 func_800E5EDC(void);
|
|||
s32 func_800E5F88(s32 arg0);
|
||||
s32 func_800E6680(void);
|
||||
u32 osGetCount(void);
|
||||
AudioTask* getAudioTask();
|
||||
|
||||
enum ChannelUpdateType
|
||||
{
|
||||
CHAN_UPD_UNK_0, // 0
|
||||
CHAN_UPD_VOL_SCALE, // 1
|
||||
CHAN_UPD_VOL, // 2
|
||||
CHAN_UPD_PAN_SIGNED, // 3
|
||||
CHAN_UPD_FREQ_SCALE, // 4
|
||||
CHAN_UPD_REVERB, // 5
|
||||
CHAN_UPD_SCRIPT_IO, // 6
|
||||
CHAN_UPD_PAN_UNSIGNED, // 7
|
||||
CHAN_UPD_STOP_SOMETHING2, // 8
|
||||
CHAN_UPD_MUTE_BEHAVE, // 9
|
||||
CHAN_UPD_VIBE_X8, // 10
|
||||
CHAN_UPD_VIBE_X32, // 11
|
||||
CHAN_UPD_UNK_0F, // 12
|
||||
CHAN_UPD_UNK_20, // 13
|
||||
CHAN_UPD_STEREO // 14
|
||||
};
|
||||
|
||||
enum LoadChannelType
|
||||
{
|
||||
CHAN_LOAD_SET_SOUND_MODE = 0xF0,
|
||||
CHAN_LOAD_UKN_F1 = 0xF1,
|
||||
CHAN_LOAD_UKN_F2 = 0xF2,
|
||||
CHAN_LOAD_INSTRUMENT_ASYNC = 0xF3,
|
||||
CHAN_LOAD_BANK_ASYNC = 0xF4,
|
||||
CHAN_LOAD_FONT_ASYNC = 0xF5,
|
||||
CHAN_LOAD_DISCARD_SEQ_FONTS = 0xF6,
|
||||
CHAN_LOAD_UKN_FC = 0xFC,
|
||||
CHAN_LOAD_UKN_81 = 0x81,
|
||||
CHAN_LOAD_UKN_82 = 0x82,
|
||||
CHAN_LOAD_DISABLE_SEQUENCE = 0x83,
|
||||
CHAN_LOAD_UKN_85 = 0x85,
|
||||
CHAN_LOAD_UKN_90 = 0x90,
|
||||
CHAN_LOAD_SET_FONT_INSTRUMENT0 = 0xE0,
|
||||
CHAN_LOAD_SET_FONT_INSTRUMENT1 = 0xE1,
|
||||
CHAN_LOAD_SET_FONT_INSTRUMENT = 0xE2,
|
||||
CHAN_LOAD_POP_CACHE = 0xE3,
|
||||
CHAN_LOAD_RESET_LOAD_SPECID = 0xF9,
|
||||
CHAN_LOAD_UKN_FB_CALLBACK = 0xFB,
|
||||
CHAN_LOAD_UKN_FE = 0xFE
|
||||
};
|
||||
|
||||
enum SequenceCommandType
|
||||
{
|
||||
SEQ_CMD_UKN_41 = 0x41,
|
||||
SEQ_CMD_UKN_46 = 0x46,
|
||||
SEQ_CMD_SET_TEMPO = 0x47,
|
||||
SEQ_CMD_UKN_48 = 0x48,
|
||||
SEQ_CMD_UKN_49 = 0x49,
|
||||
SEQ_CMD_UKN_4A = 0x4A,
|
||||
SEQ_CMD_UKN_4B = 0x4B,
|
||||
SEQ_CMD_UKN_4C = 0x4C,
|
||||
SEQ_CMD_UKN_4D = 0x4D,
|
||||
SEQ_CMD_UKN_4E = 0x4E
|
||||
};
|
||||
|
||||
const u8 QUEUE_FINISHED = 0xF8;
|
|
@ -1,2 +1 @@
|
|||
#pragma once
|
||||
#define osCreateMesgQueue(a, b, c) 0
|
||||
|
|
|
@ -115,7 +115,7 @@ s32 Player_IsFacingActor(Actor* actor, s16 angle, GlobalContext* globalCtx);
|
|||
f32 Rand_CenteredFloat(f32 f);
|
||||
f32 Rand_ZeroFloat(f32 f);
|
||||
void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s16 x, s16 y, u8 width, u8 height);
|
||||
void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, s32 width, s32 height, s32 delay);
|
||||
void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void*& texture, s32 x, s32 y, s32 width, s32 height, s32 delay);
|
||||
void func_8002BE04(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, f32* arg3);
|
||||
void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx);
|
||||
s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx);
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#pragma once
|
||||
#include "ultra64/message.h"
|
||||
|
||||
struct OSPiHandle;
|
||||
struct OSIoMesg;
|
||||
struct DmaRequest;
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
void osSyncPrintf(const char* fmt, ...);
|
||||
#define osRecvMesg(a, b, c) 0
|
||||
#define osSendMesg(a, b, c) 0
|
||||
|
||||
#if defined(_MSC_VER) && 0
|
||||
#define bcopy(b1, b2, len) (memmove((b2), (b1), (len)), (void)0)
|
||||
|
|
|
@ -1,75 +1,4 @@
|
|||
#undef osCreateMesgQueue
|
||||
|
||||
static void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 count)
|
||||
{
|
||||
mq->mtqueue = NULL;
|
||||
mq->fullqueue = NULL;
|
||||
mq->validCount = 0;
|
||||
mq->first = 0;
|
||||
mq->msgCount = count;
|
||||
mq->msg = msg;
|
||||
}
|
||||
|
||||
#undef osSendMesg
|
||||
|
||||
static s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag)
|
||||
{
|
||||
register u32 index;
|
||||
|
||||
while(mq->validCount >= mq->msgCount)
|
||||
{
|
||||
if(flag == OS_MESG_BLOCK)
|
||||
{
|
||||
int zyz = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
index = (mq->first + mq->validCount) % mq->msgCount;
|
||||
mq->msg[index] = mesg;
|
||||
mq->validCount++;
|
||||
|
||||
if(mq->mtqueue->next != NULL)
|
||||
{
|
||||
//osStartThread(__osPopThread(&mq->mtqueue));
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef osRecvMesg
|
||||
|
||||
static s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag)
|
||||
{
|
||||
while(mq->validCount == 0)
|
||||
{
|
||||
if(flag == OS_MESG_NOBLOCK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1; // TODO FIX HACK
|
||||
}
|
||||
}
|
||||
|
||||
if(msg != NULL)
|
||||
{
|
||||
*msg = mq->msg[mq->first];
|
||||
}
|
||||
|
||||
mq->first = (mq->first + 1) % mq->msgCount;
|
||||
mq->validCount--;
|
||||
|
||||
if(mq->fullqueue->next != NULL)
|
||||
{
|
||||
//osStartThread(__osPopThread(&mq->fullqueue));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
|
|
|
@ -131,4 +131,24 @@ enum SequenceMode {
|
|||
/* 3 */ SEQ_MODE_IGNORE
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AUDIO_CMD_SEQUENCE_PLAY = 0,
|
||||
AUDIO_CMD_DISABLE_PLAYER = 1,
|
||||
AUDIO_CMD_SEQUENCE_QUEUE = 2,
|
||||
AUDIO_CMD_SEQUENCE_STOP = 3,
|
||||
AUDIO_CMD_SEQUENCE_TRANS_VOLUME = 4,
|
||||
AUDIO_CMD_SEQUENCE_TRANS_FREQ_SCALE_ALL = 5,
|
||||
AUDIO_CMD_SEQUENCE_TRANS_FREQ_SCALE = 0x0D,
|
||||
AUDIO_CMD_SEQUENCE_TRANS_VOL_SCALE = 0x06,
|
||||
AUDIO_CMD_SET_IO_PORT_GLOBAL = 0x07,
|
||||
AUDIO_CMD_SET_IO_PORT_MASKED = 0x08,
|
||||
AUDIO_CMD_SET_IO_PORT_MASK = 0x09,
|
||||
AUDIO_CMD_SET_CHANNEL_STOP_MASK = 0x0A,
|
||||
AUDIO_CMD_UPDATE_TEMPO = 0x0B,
|
||||
AUDIO_CMD_SEQUENCE_START_WITH_SETUP = 0x0C,
|
||||
AUDIO_CMD_0E = 0x0E,
|
||||
AUDIO_CMD_CHANGE_SPEC = 0x0F
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
uintptr_t check_pointer(uintptr_t p, u32 sz);
|
||||
|
||||
/* Audio commands: */
|
||||
#define A_SPNOOP 0
|
||||
#define A_ADPCM 1
|
||||
|
@ -51,135 +53,318 @@
|
|||
* Data Structures.
|
||||
*/
|
||||
|
||||
struct Aadpcm {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 gain : 16;
|
||||
u32 addr;
|
||||
struct Aadpcm
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 gain : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 gain : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Apolef {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 gain : 16;
|
||||
u32 addr;
|
||||
struct Apolef
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 gain : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 gain : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Aenvelope {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 pad1 : 16;
|
||||
u32 addr;
|
||||
struct Aenvelope
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 pad1 : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 pad1 : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Aclearbuff {
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 dmem : 16;
|
||||
u32 pad2 : 16;
|
||||
u32 count : 16;
|
||||
struct Aclearbuff
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 dmem : 16;
|
||||
u32 pad1 : 8;
|
||||
u32 cmd : 8;
|
||||
u32 count : 16;
|
||||
u32 pad2 : 16;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 dmem : 16;
|
||||
u32 pad2 : 16;
|
||||
u32 count : 16;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Ainterleave {
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 pad2 : 16;
|
||||
u32 inL : 16;
|
||||
u32 inR : 16;
|
||||
struct Ainterleave
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 pad2 : 16;
|
||||
u32 pad1 : 8;
|
||||
u32 cmd : 8;
|
||||
u32 inR : 16;
|
||||
u32 inL : 16;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 pad2 : 16;
|
||||
u32 inL : 16;
|
||||
u32 inR : 16;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Aloadbuff {
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 24;
|
||||
u32 addr;
|
||||
struct Aloadbuff
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 pad1 : 24;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 24;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Aenvmixer {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 pad1 : 16;
|
||||
u32 addr;
|
||||
struct Aenvmixer
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 pad1 : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 pad1 : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Amixer {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 gain : 16;
|
||||
u32 dmemi : 16;
|
||||
u32 dmemo : 16;
|
||||
struct Amixer
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 gain : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 dmemo : 16;
|
||||
u32 dmemi : 16;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 gain : 16;
|
||||
u32 dmemi : 16;
|
||||
u32 dmemo : 16;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Apan {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 dmem2 : 16;
|
||||
u32 addr;
|
||||
struct Apan
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 dmem2 : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 dmem2 : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Aresample {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 pitch : 16;
|
||||
u32 addr;
|
||||
struct Aresample
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 pitch : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 pitch : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Areverb {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 pad1 : 16;
|
||||
u32 addr;
|
||||
struct Areverb
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 pad1 : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 pad1 : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Asavebuff {
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 24;
|
||||
u32 addr;
|
||||
struct Afilter
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 count : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 count : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Asegment {
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 24;
|
||||
u32 pad2 : 2;
|
||||
struct Asavebuff
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 pad1 : 24;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 24;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Asegment
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 pad1 : 24;
|
||||
u32 cmd : 8;
|
||||
u32 pad3 : 2;
|
||||
u32 base : 24;
|
||||
u32 number : 4;
|
||||
u32 base : 24;
|
||||
u32 pad2 : 2;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 24;
|
||||
u32 pad2 : 2;
|
||||
u32 number : 4;
|
||||
u32 base : 24;
|
||||
u32 pad3 : 2;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Asetbuff {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 dmemin : 16;
|
||||
u32 dmemout : 16;
|
||||
u32 count : 16;
|
||||
struct Asetbuff
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 dmemin : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 count : 16;
|
||||
u32 dmemout : 16;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 dmemin : 16;
|
||||
u32 dmemout : 16;
|
||||
u32 count : 16;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Asetvol {
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 vol : 16;
|
||||
u32 voltgt : 16;
|
||||
u32 volrate : 16;
|
||||
struct Aduplicate
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 dmemin : 16;
|
||||
u32 repeats : 8;
|
||||
u32 cmd : 8;
|
||||
u32 size : 16;
|
||||
u32 dmemout : 16;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 repeats : 8;
|
||||
u32 dmemin : 16;
|
||||
u32 dmemout : 16;
|
||||
u32 size : 16;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Admemmove {
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 dmemin : 16;
|
||||
u32 dmemout : 16;
|
||||
u32 count : 16;
|
||||
struct Asetvol
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 vol : 16;
|
||||
u32 flags : 8;
|
||||
u32 cmd : 8;
|
||||
u32 volrate : 16;
|
||||
u32 voltgt : 16;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 flags : 8;
|
||||
u32 vol : 16;
|
||||
u32 voltgt : 16;
|
||||
u32 volrate : 16;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Aloadadpcm {
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 count : 16;
|
||||
u32 addr;
|
||||
struct Admemmove
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 dmemin : 16;
|
||||
u32 pad1 : 8;
|
||||
u32 cmd : 8;
|
||||
u32 count : 16;
|
||||
u32 dmemout : 16;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 dmemin : 16;
|
||||
u32 dmemout : 16;
|
||||
u32 count : 16;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Asetloop {
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 pad2 : 16;
|
||||
u32 addr;
|
||||
struct Aloadadpcm
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 count : 16;
|
||||
u32 pad1 : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 count : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Asetloop
|
||||
{
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u32 pad2 : 16;
|
||||
u32 pad1 : 8;
|
||||
u32 cmd : 8;
|
||||
u32 addr;
|
||||
#else
|
||||
u32 cmd : 8;
|
||||
u32 pad1 : 8;
|
||||
u32 pad2 : 16;
|
||||
u32 addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -211,6 +396,8 @@ union Acmd
|
|||
Aloadadpcm loadadpcm;
|
||||
Amixer mixer;
|
||||
Asetloop setloop;
|
||||
Afilter filter;
|
||||
Aduplicate duplicate;
|
||||
long long int force_union_align; /* dummy, force alignment */
|
||||
};
|
||||
|
||||
|
@ -339,7 +526,7 @@ typedef short ENVMIX_STATE[40];
|
|||
\
|
||||
_a->words.w0 = (_SHIFTL(A_LOADBUFF, 24, 8) | \
|
||||
_SHIFTL((c) >> 4, 16, 8) | _SHIFTL(d, 0, 16)); \
|
||||
_a->words.w1 = (uintptr_t)(s); \
|
||||
_a->words.w1 = check_pointer((uintptr_t)(s), c); \
|
||||
}
|
||||
|
||||
#define aMix(pkt, f, g, i, o) \
|
||||
|
@ -434,7 +621,7 @@ typedef short ENVMIX_STATE[40];
|
|||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
|
||||
_a->words.w1 = (uintptr_t)d; \
|
||||
_a->words.w1 = check_pointer((uintptr_t)d, c); \
|
||||
}
|
||||
|
||||
#define aEnvSetup1(pkt, a, b, c, d) \
|
||||
|
|
|
@ -36,4 +36,8 @@ struct OSMesgQueue {
|
|||
/* 0x14 */ OSMesg* msg;
|
||||
}; // size = 0x18
|
||||
|
||||
void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 count);
|
||||
s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag);
|
||||
s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,67 +1,104 @@
|
|||
#ifndef ULTRA64_RCP_H
|
||||
#define ULTRA64_RCP_H
|
||||
|
||||
#define HW_REG(reg, type) *(volatile type*)((reg) | 0xA0000000)
|
||||
uintptr_t& hw_reg(u32 reg);
|
||||
//#define HW_REG(reg, type) *(type*)((reg) | 0xA0000000)
|
||||
#define HW_REG(reg, type) hw_reg(reg)
|
||||
|
||||
#define AI_DRAM_ADDR_REG 0x04500000
|
||||
#define AI_LEN_REG 0x04500004
|
||||
#define AI_CONTROL_REG 0x04500008
|
||||
#define AI_STATUS_REG 0x0450000C
|
||||
#define AI_DACRATE_REG 0x04500010
|
||||
#define AI_BITRATE_REG 0x04500014
|
||||
const u32 AI_DRAM_ADDR_REG = 0x04500000;
|
||||
const u32 AI_LEN_REG = 0x04500004;
|
||||
const u32 AI_CONTROL_REG = 0x04500008;
|
||||
const u32 AI_STATUS_REG = 0x0450000C;
|
||||
const u32 AI_DACRATE_REG = 0x04500010;
|
||||
const u32 AI_BITRATE_REG = 0x04500014;
|
||||
|
||||
#define AI_STATUS_AI_FULL (1 << 31)
|
||||
#define AI_STATUS_AI_BUSY (1 << 30)
|
||||
|
||||
#define VI_STATUS_REG 0x04400000
|
||||
const u32 VI_STATUS_REG = 0x04400000;
|
||||
|
||||
#define VI_CONTROL_REG VI_STATUS_REG
|
||||
#define VI_ORIGIN_REG 0x04400004
|
||||
const u32 VI_ORIGIN_REG = 0x04400004;
|
||||
|
||||
#define VI_DRAM_ADDR_REG VI_ORIGIN_REG
|
||||
#define VI_WIDTH_REG 0x04400008
|
||||
const u32 VI_WIDTH_REG = 0x04400008;
|
||||
|
||||
#define VI_H_WIDTH_REG VI_WIDTH_REG
|
||||
#define VI_INTR_REG 0x0440000C
|
||||
const u32 VI_INTR_REG = 0x0440000C;
|
||||
|
||||
#define VI_V_INTER_REG VI_H_WIDTH_REG
|
||||
#define VI_CURRENT_REG 0x04400010
|
||||
const u32 VI_CURRENT_REG = 0x04400010;
|
||||
|
||||
#define VI_V_CURRENT_LINE_REG VI_CURRENT_REG
|
||||
#define VI_BURST_REG 0x04400014
|
||||
const u32 VI_BURST_REG = 0x04400014;
|
||||
|
||||
#define VI_TIMING_REG VI_BURST_REG
|
||||
#define VI_V_SYNC_REG 0x04400018 //VI vertical sync
|
||||
#define VI_H_SYNC_REG 0x0440001C //VI horizontal sync
|
||||
#define VI_LEAP_REG 0x04400020 //VI horizontal sync leap
|
||||
const u32 VI_V_SYNC_REG = 0x04400018; //VI vertical sync
|
||||
|
||||
const u32 VI_H_SYNC_REG = 0x0440001C; //VI horizontal sync
|
||||
|
||||
const u32 VI_LEAP_REG = 0x04400020; //VI horizontal sync leap
|
||||
|
||||
#define VI_H_SYNC_LEAP_REG VI_LEAP_REG
|
||||
#define VI_H_START_REG 0x04400024 //VI horizontal video
|
||||
const u32 VI_H_START_REG = 0x04400024; //VI horizontal video
|
||||
|
||||
#define VI_H_VIDEO_REG VI_H_START_REG
|
||||
#define VI_V_START_REG 0x04400028 //VI vertical video
|
||||
const u32 VI_V_START_REG = 0x04400028; //VI vertical video
|
||||
|
||||
#define VI_V_VIDEO_REG VI_V_START_REG
|
||||
#define VI_V_BURST_REG 0x0440002C //VI vertical burst
|
||||
#define VI_X_SCALE_REG 0x04400030 //VI x-scale
|
||||
#define VI_Y_SCALE_REG 0x04400034 //VI y-scale
|
||||
const u32 VI_V_BURST_REG = 0x0440002C; //VI vertical burst
|
||||
|
||||
const u32 VI_X_SCALE_REG = 0x04400030; //VI x-scale
|
||||
|
||||
const u32 VI_Y_SCALE_REG = 0x04400034; //VI y-scale
|
||||
|
||||
|
||||
#define SP_IMEM_START 0x04001000
|
||||
#define SP_DMEM_START 0x04000000
|
||||
|
||||
#define SP_MEM_ADDR_REG 0x04040000
|
||||
#define SP_DRAM_ADDR_REG 0x04040004
|
||||
#define SP_RD_LEN_REG 0x04040008
|
||||
#define SP_WR_LEN_REG 0x0404000C
|
||||
#define SP_STATUS_REG 0x04040010
|
||||
#define SP_PC_REG 0x04080000
|
||||
const u32 SP_MEM_ADDR_REG = 0x04040000;
|
||||
|
||||
const u32 SP_DRAM_ADDR_REG = 0x04040004;
|
||||
|
||||
const u32 SP_RD_LEN_REG = 0x04040008;
|
||||
|
||||
const u32 SP_WR_LEN_REG = 0x0404000C;
|
||||
|
||||
const u32 SP_STATUS_REG = 0x04040010;
|
||||
|
||||
const u32 SP_PC_REG = 0x04080000;
|
||||
|
||||
|
||||
const u32 PI_DRAM_ADDR_REG = 0x04600000; //PI DRAM address
|
||||
|
||||
const u32 PI_CART_ADDR_REG = 0x04600004; //PI pbus (cartridge) address
|
||||
|
||||
const u32 PI_RD_LEN_REG = 0x04600008; //PI read length
|
||||
|
||||
const u32 PI_WR_LEN_REG = 0x0460000C; //PI write length
|
||||
|
||||
const u32 PI_STATUS_REG = 0x04600010; //PI status
|
||||
|
||||
const u32 PI_BSD_DOM1_LAT_REG = 0x04600014; //PI dom1 latency
|
||||
|
||||
const u32 PI_DOMAIN1_REG = 0x04600014;
|
||||
|
||||
const u32 PI_BSD_DOM1_PWD_REG = 0x04600018; //PI dom1 pulse width
|
||||
|
||||
const u32 PI_BSD_DOM1_PGS_REG = 0x0460001C; //PI dom1 page size
|
||||
|
||||
const u32 PI_BSD_DOM1_RLS_REG = 0x04600020; //PI dom1 release
|
||||
|
||||
const u32 PI_BSD_DOM2_LAT_REG = 0x04600024; //PI dom2 latency
|
||||
|
||||
const u32 PI_DOMAIN2_REG = 0x04600024;
|
||||
|
||||
const u32 PI_BSD_DOM2_PWD_REG = 0x04600028; //PI dom2 pulse width
|
||||
|
||||
const u32 PI_BSD_DOM2_PGS_REG = 0x0460002C; //PI dom2 page size
|
||||
|
||||
const u32 PI_BSD_DOM2_RLS_REG = 0x04600030; //PI dom2 release
|
||||
|
||||
#define PI_DRAM_ADDR_REG 0x04600000 //PI DRAM address
|
||||
#define PI_CART_ADDR_REG 0x04600004 //PI pbus (cartridge) address
|
||||
#define PI_RD_LEN_REG 0x04600008 //PI read length
|
||||
#define PI_WR_LEN_REG 0x0460000C //PI write length
|
||||
#define PI_STATUS_REG 0x04600010 //PI status
|
||||
#define PI_BSD_DOM1_LAT_REG 0x04600014 //PI dom1 latency
|
||||
#define PI_DOMAIN1_REG 0x04600014
|
||||
#define PI_BSD_DOM1_PWD_REG 0x04600018 //PI dom1 pulse width
|
||||
#define PI_BSD_DOM1_PGS_REG 0x0460001C //PI dom1 page size
|
||||
#define PI_BSD_DOM1_RLS_REG 0x04600020 //PI dom1 release
|
||||
#define PI_BSD_DOM2_LAT_REG 0x04600024 //PI dom2 latency
|
||||
#define PI_DOMAIN2_REG 0x04600024
|
||||
#define PI_BSD_DOM2_PWD_REG 0x04600028 //PI dom2 pulse width
|
||||
#define PI_BSD_DOM2_PGS_REG 0x0460002C //PI dom2 page size
|
||||
#define PI_BSD_DOM2_RLS_REG 0x04600030 //PI dom2 release
|
||||
|
||||
#define PI_STATUS_BUSY 0x1
|
||||
#define PI_STATUS_IOBUSY 0x2
|
||||
|
@ -70,10 +107,14 @@
|
|||
#define PI_STATUS_RESET_CONTROLLER 0x1
|
||||
#define PI_STATUS_CLEAR_INTR 0x2
|
||||
|
||||
#define SI_DRAM_ADDR_REG 0x04800000
|
||||
#define SI_PIF_ADDR_RD64B_REG 0x04800004
|
||||
#define SI_PIF_ADDR_WR64B_REG 0x04800010
|
||||
#define SI_STATUS_REG 0x04800018
|
||||
const u32 SI_DRAM_ADDR_REG = 0x04800000;
|
||||
|
||||
const u32 SI_PIF_ADDR_RD64B_REG = 0x04800004;
|
||||
|
||||
const u32 SI_PIF_ADDR_WR64B_REG = 0x04800010;
|
||||
|
||||
const u32 SI_STATUS_REG = 0x04800018;
|
||||
|
||||
|
||||
#define SI_STATUS_DMA_BUSY 0x1
|
||||
#define SI_STATUS_IO_READ_BUSY 0x2
|
||||
|
@ -82,11 +123,15 @@
|
|||
|
||||
#define PIF_RAM_START 0x1FC007C0
|
||||
|
||||
#define MI_INIT_MODE_REG 0x04300000
|
||||
const u32 MI_INIT_MODE_REG = 0x04300000;
|
||||
|
||||
#define MI_MODE_REG MI_INIT_MODE_REG
|
||||
#define MI_VERSION_REG 0x04300004
|
||||
#define MI_INTR_REG 0x04300008
|
||||
#define MI_INTR_MASK_REG 0x0430000C
|
||||
const u32 MI_VERSION_REG = 0x04300004;
|
||||
|
||||
const u32 MI_INTR_REG = 0x04300008;
|
||||
|
||||
const u32 MI_INTR_MASK_REG = 0x0430000C;
|
||||
|
||||
|
||||
#define VI_NTSC_CLOCK 48681812 /* Hz = 48.681812 MHz */
|
||||
#define VI_PAL_CLOCK 49656530 /* Hz = 49.656530 MHz */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "ultra64/pi.h"
|
||||
#include "ultra64/sptask.h"
|
||||
#include "z64math.h"
|
||||
#include "porting_defs.h"
|
||||
|
||||
#define MK_CMD(b0,b1,b2,b3) ((((b0) & 0xFF) << 0x18) | (((b1) & 0xFF) << 0x10) | (((b2) & 0xFF) << 0x8) | (((b3) & 0xFF) << 0))
|
||||
|
||||
|
@ -106,6 +107,14 @@ struct Portamento {
|
|||
}; // size = 0xC
|
||||
|
||||
struct AdsrEnvelope {
|
||||
AdsrEnvelope() : delay(0), arg(0)
|
||||
{
|
||||
}
|
||||
|
||||
AdsrEnvelope(s16 _delay, s16 _arg) : delay(_delay), arg(_arg)
|
||||
{
|
||||
}
|
||||
|
||||
/* 0x0 */ s16 delay;
|
||||
/* 0x2 */ s16 arg;
|
||||
}; // size = 0x4
|
||||
|
@ -143,6 +152,8 @@ struct SoundFontSample {
|
|||
/* 0x0C */ AdpcmBook* book;
|
||||
}; // size = 0x10
|
||||
|
||||
static_assert(sizeof(SoundFontSample) == 0x10, "SoundFontSample incorrect size");
|
||||
|
||||
struct SoundFontSound {
|
||||
/* 0x00 */ SoundFontSample* sample;
|
||||
/* 0x04 */ f32 tuning; // frequency scale factor
|
||||
|
@ -249,7 +260,7 @@ struct SeqScriptState {
|
|||
|
||||
// Also known as a Group, according to debug strings.
|
||||
struct SequencePlayer {
|
||||
#ifdef LITTLE_ENDIAN
|
||||
#ifdef LITTLE_ENDIAN2
|
||||
u8 unk_0b1 : 1;
|
||||
u8 stopScript : 1;
|
||||
u8 recalculateVolume : 1;
|
||||
|
@ -375,7 +386,7 @@ struct NoteAttributes {
|
|||
|
||||
// Also known as a SubTrack, according to sm64 debug strings.
|
||||
typedef struct SequenceChannel {
|
||||
#ifdef LITTLE_ENDIAN
|
||||
#ifdef LITTLE_ENDIAN2
|
||||
u8 unused : 1;
|
||||
u8 largeNotes : 1; // notes specify duration and velocity
|
||||
u8 stereoHeadsetEffects : 1;
|
||||
|
@ -397,6 +408,11 @@ typedef struct SequenceChannel {
|
|||
union {
|
||||
struct {
|
||||
#ifdef LITTLE_ENDIAN
|
||||
u8 padding1 : 1;
|
||||
u8 padding2 : 1;
|
||||
u8 padding3 : 1;
|
||||
u8 padding4 : 1;
|
||||
u8 padding5 : 1;
|
||||
u8 pan : 1;
|
||||
u8 volume : 1;
|
||||
u8 freqScale : 1;
|
||||
|
@ -404,6 +420,11 @@ typedef struct SequenceChannel {
|
|||
u8 freqScale : 1;
|
||||
u8 volume : 1;
|
||||
u8 pan : 1;
|
||||
u8 padding1 : 1;
|
||||
u8 padding2 : 1;
|
||||
u8 padding3 : 1;
|
||||
u8 padding4 : 1;
|
||||
u8 padding5 : 1;
|
||||
#endif
|
||||
} s;
|
||||
/* 0x01 */ u8 asByte;
|
||||
|
@ -456,7 +477,7 @@ typedef struct SequenceChannel {
|
|||
|
||||
// Might also be known as a Track, according to sm64 debug strings (?).
|
||||
struct SequenceLayer {
|
||||
#ifdef LITTLE_ENDIAN
|
||||
#ifdef LITTLE_ENDIAN2
|
||||
u8 notePropertiesNeedInit : 1;
|
||||
u8 bit1 : 1; // "has initialized continuous notes"?
|
||||
u8 ignoreDrumPan : 1;
|
||||
|
@ -566,9 +587,9 @@ struct NotePlaybackState {
|
|||
// may contain portamento, vibratoState, if those are not part of Note itself
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct NoteSubEu {
|
||||
struct {
|
||||
#ifdef LITTLE_ENDIAN
|
||||
#ifdef LITTLE_ENDIAN2
|
||||
u8 usesHeadsetPanEffects : 1; // ?
|
||||
u8 stereoHeadsetEffects : 1;
|
||||
u8 stereoStrongLeft : 1;
|
||||
|
@ -589,7 +610,7 @@ typedef struct {
|
|||
#endif
|
||||
} bitField0;
|
||||
struct {
|
||||
#ifdef LITTLE_ENDIAN
|
||||
#ifdef LITTLE_ENDIAN2
|
||||
u8 usesHeadsetPanEffects2 : 1;
|
||||
u8 hasTwoParts : 1;
|
||||
u8 isSyntheticWave : 1;
|
||||
|
@ -619,7 +640,9 @@ typedef struct {
|
|||
} sound;
|
||||
/* 0x14 */ s16* filter;
|
||||
/* 0x18 */ char pad_18[0x8];
|
||||
} NoteSubEu; // size = 0x20
|
||||
}; // size = 0x20
|
||||
|
||||
static_assert(sizeof(NoteSubEu) == 0x20, "incorrect NoteSubEu size!");
|
||||
|
||||
struct Note {
|
||||
/* 0x00 */ AudioListItem listItem;
|
||||
|
@ -821,7 +844,6 @@ struct AudioSlowLoad {
|
|||
/* 0x18 */ s32 bytesRemaining;
|
||||
/* 0x1C */ s8* isDone;
|
||||
/* 0x20 */ SoundFontSample sample;
|
||||
/* 0x30 */ OSMesgQueue msgqueue;
|
||||
/* 0x48 */ OSMesg msg;
|
||||
/* 0x4C */ OSIoMesg ioMesg;
|
||||
}; // size = 0x64
|
||||
|
@ -884,23 +906,12 @@ struct AudioContext {
|
|||
/* 0x1768 */ s32 numUsedSamples;
|
||||
/* 0x176C */ s32 preloadSampleStackTop;
|
||||
/* 0x1770 */ AudioAsyncLoad asyncLoads[0x10];
|
||||
/* 0x1CF0 */ OSMesgQueue asyncLoadUnkMediumQueue;
|
||||
/* 0x1D08 */ char unk_1D08[0x40];
|
||||
/* 0x1D48 */ AudioAsyncLoad* curUnkMediumLoad;
|
||||
/* 0x1D4C */ u32 slowLoadPos;
|
||||
/* 0x1D50 */ AudioSlowLoad slowLoads[2];
|
||||
/* 0x1E18 */ OSPiHandle* cartHandle;
|
||||
/* 0x1E1C */ OSPiHandle* driveHandle;
|
||||
/* 0x1E20 */ OSMesgQueue externalLoadQueue;
|
||||
/* 0x1E38 */ OSMesg externalLoadMesgBuf[0x10];
|
||||
/* 0x1E78 */ OSMesgQueue preloadSampleQueue;
|
||||
/* 0x1E90 */ OSMesg preloadSampleMesgBuf[0x10];
|
||||
/* 0x1ED0 */ OSMesgQueue currAudioFrameDmaQueue;
|
||||
/* 0x1EE8 */ OSMesg currAudioFrameDmaMesgBuf[0x40];
|
||||
/* 0x1FE8 */ OSIoMesg currAudioFrameDmaIoMesgBuf[0x40];
|
||||
/* 0x25E8 */ OSMesgQueue syncDmaQueue;
|
||||
/* 0x2600 */ OSMesg syncDmaMesg;
|
||||
/* 0x2604 */ OSIoMesg syncDmaIoMesg;
|
||||
/* 0x261C */ SampleDma* sampleDmas;
|
||||
/* 0x2620 */ u32 sampleDmaCount;
|
||||
/* 0x2624 */ u32 sampleDmaListSize1;
|
||||
|
@ -1035,7 +1046,7 @@ struct unk_D_8016E750 {
|
|||
/* 0x013 */ u8 fadeVolUpdate;
|
||||
/* 0x014 */ u32 unk_14;
|
||||
/* 0x018 */ u16 unk_18;
|
||||
/* 0x01C */ f32 unk_1C;
|
||||
/* 0x01C */ f32 tempo;
|
||||
/* 0x020 */ f32 unk_20;
|
||||
/* 0x024 */ f32 unk_24;
|
||||
/* 0x028 */ u16 unk_28;
|
||||
|
@ -1154,6 +1165,13 @@ enum OcarinaNoteIdx {
|
|||
/* -1 */ OCARINA_NOTE_INVALID = 0xFF
|
||||
};
|
||||
|
||||
template <u32 SZ> struct VAdpcmBook
|
||||
{
|
||||
s32 order;
|
||||
s32 npredictors;
|
||||
s16 book[SZ];
|
||||
};
|
||||
|
||||
#define gTatumsPerBeat (D_8014A6C0[1])
|
||||
|
||||
extern void(*D_801755D0)(void);
|
||||
|
|
|
@ -91,7 +91,6 @@ struct EnvironmentContext {
|
|||
/* 0x36 */ LightInfo dirLight2; // used for moonlight outdoors
|
||||
/* 0x44 */ s8 skyboxDmaState;
|
||||
/* 0x48 */ DmaRequest dmaRequest;
|
||||
/* 0x68 */ OSMesgQueue loadQueue;
|
||||
/* 0x80 */ OSMesg loadMsg;
|
||||
/* 0x84 */ f32 unk_84;
|
||||
/* 0x88 */ f32 unk_88;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#pragma once
|
||||
#include "ultra64/types.h"
|
||||
#include "view.h"
|
||||
#include "z64audio.h"
|
||||
//#include "z64audio.h"
|
||||
|
||||
struct OcarinaStaff;
|
||||
|
||||
typedef enum { TEXTBOX_ICON_TRIANGLE, TEXTBOX_ICON_SQUARE, TEXTBOX_ICON_ARROW } TextBoxIcon;
|
||||
|
||||
|
|
|
@ -630,7 +630,6 @@ struct RoomContext {
|
|||
/* 0x31 */ s8 status;
|
||||
/* 0x34 */ void* unk_34;
|
||||
/* 0x38 */ DmaRequest dmaRequest;
|
||||
/* 0x58 */ OSMesgQueue loadQueue;
|
||||
/* 0x70 */ OSMesg loadMsg;
|
||||
/* 0x74 */ s16 unk_74[2]; // context-specific data used by the current scene draw config
|
||||
}; // size = 0x78
|
||||
|
|
|
@ -23,22 +23,22 @@
|
|||
#define Audio_DisableSeq(playerIdx, fadeOut) Audio_QueueCmdS32(0x83000000 | ((u8)playerIdx << 16), fadeOut)
|
||||
#define Audio_StartSeq(playerIdx, fadeTimer, seqId) \
|
||||
Audio_QueueSeqCmd(0x00000000 | ((u8)playerIdx << 24) | ((u8)(fadeTimer) << 0x10) | (u16)seqId)
|
||||
#define Audio_SeqCmd7(playerIdx, a, b) \
|
||||
#define Audio_SeqSetIoPortGlobal(playerIdx, a, b) \
|
||||
Audio_QueueSeqCmd(0x70000000 | ((u8)playerIdx << 0x18) | ((u8)a << 0x10) | (u8)(b))
|
||||
#define Audio_SeqCmdC(playerIdx, a, b, c) \
|
||||
#define Audio_SeqStartWithSetup(playerIdx, a, b, c) \
|
||||
Audio_QueueSeqCmd(0xC0000000 | ((u8)playerIdx << 24) | ((u8)a << 16) | ((u8)b << 8) | ((u8)(c)))
|
||||
#define Audio_SeqCmdA(playerIdx, a) Audio_QueueSeqCmd(0xA0000000 | ((u8)playerIdx << 24) | ((u16)(a)))
|
||||
#define Audio_SeqCmd1(playerIdx, a) Audio_QueueSeqCmd(0x100000FF | ((u8)playerIdx << 24) | ((u8)(a) << 16))
|
||||
#define Audio_SeqCmdB(playerIdx, a, b, c) \
|
||||
#define Audio_SeqSetChannelStopMask(playerIdx, a) Audio_QueueSeqCmd(0xA0000000 | ((u8)playerIdx << 24) | ((u16)(a)))
|
||||
#define Audio_SeqDisablePlayer(playerIdx, a) Audio_QueueSeqCmd(0x100000FF | ((u8)playerIdx << 24) | ((u8)(a) << 16))
|
||||
#define Audio_SeqUpdateTempo(playerIdx, a, b, c) \
|
||||
Audio_QueueSeqCmd(0xB0000000 | ((u8)playerIdx << 24) | ((u8)a << 16) | ((u8)b << 8) | ((u8)c))
|
||||
#define Audio_SeqCmdB40(playerIdx, a, b) Audio_QueueSeqCmd(0xB0004000 | ((u8)playerIdx << 24) | ((u8)a << 16) | ((u8)b))
|
||||
#define Audio_SeqCmd6(playerIdx, a, b, c) \
|
||||
#define Audio_SeqUpdateTempo2(playerIdx, a, b) Audio_QueueSeqCmd(0xB0004000 | ((u8)playerIdx << 24) | ((u8)a << 16) | ((u8)b))
|
||||
#define Audio_SeqSetTransVolScale(playerIdx, a, b, c) \
|
||||
Audio_QueueSeqCmd(0x60000000 | ((u8)playerIdx << 24) | ((u8)(a) << 16) | ((u8)b << 8) | ((u8)c))
|
||||
#define Audio_SeqCmdE0(playerIdx, a) Audio_QueueSeqCmd(0xE0000000 | ((u8)playerIdx << 24) | ((u8)a))
|
||||
#define Audio_SeqCmdE01(playerIdx, a) Audio_QueueSeqCmd(0xE0000100 | ((u8)playerIdx << 24) | ((u16)a))
|
||||
#define Audio_SeqCmd8(playerIdx, a, b, c) \
|
||||
#define Audio_SeqSetIoPortMasked(playerIdx, a, b, c) \
|
||||
Audio_QueueSeqCmd(0x80000000 | ((u8)playerIdx << 24) | ((u8)a << 16) | ((u8)b << 8) | ((u8)c))
|
||||
#define Audio_SeqCmdF(playerIdx, a) Audio_QueueSeqCmd(0xF0000000 | ((u8)playerIdx << 24) | ((u8)a))
|
||||
#define Audio_SeqChangeSpec(playerIdx, a) Audio_QueueSeqCmd(0xF0000000 | ((u8)playerIdx << 24) | ((u8)a))
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ f32 vol;
|
||||
|
@ -1084,15 +1084,15 @@ void func_800ED458(s32 arg0) {
|
|||
D_80130F24 = Audio_OcaAdjStick(D_80130F2C);
|
||||
|
||||
D_80130F34 = (sCurOcaStick.x < 0 ? -sCurOcaStick.x : sCurOcaStick.x) >> 2;
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD06, D_80130F34);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | 0xD06, D_80130F34);
|
||||
} else {
|
||||
D_80130F2C = 0;
|
||||
D_80130F24 = 1.0f;
|
||||
}
|
||||
|
||||
if ((sCurOcarinaBtnVal != 0xFF) && (sPrevOcarinaNoteVal != sCurOcarinaBtnVal)) {
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, D_80130F10 - 1);
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sCurOcarinaBtnVal);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, D_80130F10 - 1);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sCurOcarinaBtnVal);
|
||||
Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &D_801333D4, 4, &D_80130F24, &D_80130F28, &D_801333E8);
|
||||
} else if ((sPrevOcarinaNoteVal != 0xFF) && (sCurOcarinaBtnVal == 0xFF)) {
|
||||
Audio_StopSfxById(NA_SE_OC_OCARINA);
|
||||
|
@ -1109,7 +1109,7 @@ void Audio_OcaSetInstrument(u8 arg0) {
|
|||
return;
|
||||
}
|
||||
|
||||
Audio_SeqCmd8(SEQ_PLAYER_SFX, 1, SFX_PLAYER_CHANNEL_OCARINA, arg0);
|
||||
Audio_SeqSetIoPortMasked(SEQ_PLAYER_SFX, 1, SFX_PLAYER_CHANNEL_OCARINA, arg0);
|
||||
D_80130F10 = arg0;
|
||||
if (arg0 == 0) {
|
||||
sCurOcarinaBtnPress = 0;
|
||||
|
@ -1202,7 +1202,7 @@ void Audio_OcaPlayback(void) {
|
|||
|
||||
if (sNotePlaybackVibrato != sPlaybackSong[sPlaybackNotePos].vibrato) {
|
||||
sNotePlaybackVibrato = sPlaybackSong[sPlaybackNotePos].vibrato;
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD06, sNotePlaybackVibrato);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | 0xD06, sNotePlaybackVibrato);
|
||||
}
|
||||
|
||||
if (sNotePlaybackTone != sPlaybackSong[sPlaybackNotePos].tone) {
|
||||
|
@ -1227,8 +1227,8 @@ void Audio_OcaPlayback(void) {
|
|||
|
||||
if (sDisplayedNoteValue != 0xFF) {
|
||||
sStaffPlaybackPos++;
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, D_80130F10 - 1);
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sDisplayedNoteValue & 0x3F);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, D_80130F10 - 1);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sDisplayedNoteValue & 0x3F);
|
||||
Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &D_801333D4, 4, &sNormalizedNotePlaybackTone,
|
||||
&sNormalizedNotePlaybackVolume, &D_801333E8);
|
||||
} else {
|
||||
|
@ -1767,7 +1767,7 @@ void AudioDebug_ProcessInput_SndCont(void) {
|
|||
Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, sAudioSndContWork[sAudioSndContSel]);
|
||||
break;
|
||||
case 6:
|
||||
Audio_SeqCmdF(SEQ_PLAYER_BGM_MAIN, sAudioSndContWork[sAudioSndContSel]);
|
||||
Audio_SeqChangeSpec(SEQ_PLAYER_BGM_MAIN, sAudioSndContWork[sAudioSndContSel]);
|
||||
sAudioSubTrackInfoSpec = sAudioSndContWork[6];
|
||||
if (sAudioSubTrackInfoPlayerSel > gAudioSpecs[sAudioSubTrackInfoSpec].numSequencePlayers - 1) {
|
||||
sAudioSubTrackInfoPlayerSel = gAudioSpecs[sAudioSubTrackInfoSpec].numSequencePlayers - 1;
|
||||
|
@ -1789,10 +1789,10 @@ void AudioDebug_ProcessInput_SndCont(void) {
|
|||
switch (sAudioSndContSel) {
|
||||
case 0:
|
||||
case 1:
|
||||
Audio_SeqCmd1(sAudioSndContSel, 0);
|
||||
Audio_SeqDisablePlayer(sAudioSndContSel, 0);
|
||||
break;
|
||||
case 7:
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_MAIN, 0);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
|
@ -2081,7 +2081,7 @@ void AudioDebug_ProcessInput_BlkChgBgm(void) {
|
|||
}
|
||||
|
||||
if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) {
|
||||
Audio_QueueCmdS8(MK_CMD(0x46, SEQ_PLAYER_BGM_MAIN, 0x00, 0x00), sAudioBlkChgBgmWork[1]);
|
||||
Audio_QueueCmdS8(MK_CMD(SEQ_CMD_UKN_46, SEQ_PLAYER_BGM_MAIN, 0x00, 0x00), sAudioBlkChgBgmWork[1]);
|
||||
Audio_QueueSeqCmd(sAudioBlkChgBgmWork[0] | 0x10000);
|
||||
}
|
||||
|
||||
|
@ -2239,10 +2239,10 @@ void AudioDebug_ProcessInput(void) {
|
|||
sAudioSndContWork[5] ^= 1;
|
||||
Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, sAudioSndContWork[5]);
|
||||
if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_NATURE_AMBIENCE) {
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_MAIN, 0);
|
||||
}
|
||||
Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0);
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_SUB, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_FANFARE, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_SUB, 0);
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) {
|
||||
|
@ -2322,7 +2322,7 @@ void func_800F3140(UNK_TYPE arg0, UNK_TYPE arg1) {
|
|||
}
|
||||
|
||||
void func_800F314C(s8 arg0) {
|
||||
Audio_QueueCmdS32(0x82 << 24 | SEQ_PLAYER_BGM_MAIN << 16 | (((u8)arg0 & 0xFF) << 8), 1);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_UKN_82 << 24 | SEQ_PLAYER_BGM_MAIN << 16 | (((u8)arg0 & 0xFF) << 8), 1);
|
||||
}
|
||||
|
||||
f32 Audio_ComputeSoundVolume(u8 bankId, u8 entryIdx) {
|
||||
|
@ -2630,33 +2630,33 @@ void Audio_SetSoundProperties(u8 bankId, u8 entryIdx, u8 channelIdx) {
|
|||
}
|
||||
|
||||
// CHAN_UPD_SCRIPT_IO (slot 2, sets volume)
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8) | 2, volS8);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8) | 2, volS8);
|
||||
if (reverb != sSfxChannelState[channelIdx].reverb) {
|
||||
Audio_QueueCmdS8(0x5 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), reverb);
|
||||
Audio_QueueCmdS8(CHAN_UPD_REVERB << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), reverb);
|
||||
sSfxChannelState[channelIdx].reverb = reverb;
|
||||
}
|
||||
if (freqScale != sSfxChannelState[channelIdx].freqScale) {
|
||||
Audio_QueueCmdF32(0x4 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), freqScale);
|
||||
Audio_QueueCmdF32(CHAN_UPD_FREQ_SCALE << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), freqScale);
|
||||
sSfxChannelState[channelIdx].freqScale = freqScale;
|
||||
}
|
||||
if (stereoBits != sSfxChannelState[channelIdx].stereoBits) {
|
||||
Audio_QueueCmdS8(0xE << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), stereoBits | 0x10);
|
||||
Audio_QueueCmdS8(CHAN_UPD_STEREO << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), stereoBits | 0x10);
|
||||
sSfxChannelState[channelIdx].stereoBits = stereoBits;
|
||||
}
|
||||
if (filter != sSfxChannelState[channelIdx].filter) {
|
||||
// CHAN_UPD_SCRIPT_IO (slot 3, sets filter)
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8) | 3, filter);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8) | 3, filter);
|
||||
sSfxChannelState[channelIdx].filter = filter;
|
||||
}
|
||||
if (sp38 != sSfxChannelState[channelIdx].unk_0C) {
|
||||
// CHAN_UPD_UNK_0F
|
||||
Audio_QueueCmdS8(0xC << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), 0x10);
|
||||
Audio_QueueCmdS8(CHAN_UPD_UNK_0F << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), 0x10);
|
||||
// CHAN_UPD_UNK_20
|
||||
Audio_QueueCmdU16(0xD << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), ((u16)(sp38) << 8) + 0xFF);
|
||||
Audio_QueueCmdU16(CHAN_UPD_UNK_20 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), ((u16)(sp38) << 8) + 0xFF);
|
||||
sSfxChannelState[channelIdx].unk_0C = sp38;
|
||||
}
|
||||
if (panSigned != sSfxChannelState[channelIdx].panSigned) {
|
||||
Audio_QueueCmdS8(0x3 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), panSigned);
|
||||
Audio_QueueCmdS8(CHAN_UPD_PAN_SIGNED << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), panSigned);
|
||||
sSfxChannelState[channelIdx].panSigned = panSigned;
|
||||
}
|
||||
}
|
||||
|
@ -2684,7 +2684,7 @@ void Audio_ResetSfxChannelState(void) {
|
|||
void func_800F3F3C(u8 arg0) {
|
||||
if (gSoundBankMuted[0] != 1) {
|
||||
Audio_StartSeq(SEQ_PLAYER_BGM_SUB, 0, NA_BGM_VARIOUS_SFX);
|
||||
Audio_SeqCmd8(SEQ_PLAYER_BGM_SUB, 0, 0, arg0);
|
||||
Audio_SeqSetIoPortMasked(SEQ_PLAYER_BGM_SUB, 0, 0, arg0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2872,8 +2872,7 @@ void func_800F4870(u8 arg0) {
|
|||
|
||||
for (i = 0; i < 16; i++) {
|
||||
// CHAN_UPD_PAN_UNSIGNED
|
||||
Audio_QueueCmdS8(
|
||||
_SHIFTL(0x7, 24, 8) | _SHIFTL(SEQ_PLAYER_BGM_MAIN, 16, 8) | _SHIFTL(i, 8, 8) | _SHIFTL(0, 0, 8), pan);
|
||||
Audio_QueueCmdS8(_SHIFTL(CHAN_UPD_PAN_UNSIGNED, 24, 8) | _SHIFTL(SEQ_PLAYER_BGM_MAIN, 16, 8) | _SHIFTL(i, 8, 8) | _SHIFTL(0, 0, 8), pan);
|
||||
}
|
||||
|
||||
if (arg0 == 7) {
|
||||
|
@ -2897,7 +2896,7 @@ s32 Audio_SetGanonDistVol(u8 targetVol) {
|
|||
phi_v0 = (((targetVol - 0x40) >> 2) + 1) << 4;
|
||||
}
|
||||
|
||||
Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, 4, 15, phi_v0);
|
||||
Audio_SeqSetIoPortMasked(SEQ_PLAYER_BGM_MAIN, 4, 15, phi_v0);
|
||||
for (i = 0; i < 0x10; i++) {
|
||||
if (gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[i] != &gAudioContext.sequenceChannelNone) {
|
||||
if ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[i]->soundScriptIO[5] != 0xFF) {
|
||||
|
@ -2909,7 +2908,7 @@ s32 Audio_SetGanonDistVol(u8 targetVol) {
|
|||
phi_v0_2 = 0x7F;
|
||||
}
|
||||
// CHAN_UPD_REVERB
|
||||
Audio_QueueCmdS8(_SHIFTL(0x5, 24, 8) | _SHIFTL(SEQ_PLAYER_BGM_MAIN, 16, 8) | _SHIFTL(i, 8, 8) |
|
||||
Audio_QueueCmdS8(_SHIFTL(CHAN_UPD_REVERB, 24, 8) | _SHIFTL(SEQ_PLAYER_BGM_MAIN, 16, 8) | _SHIFTL(i, 8, 8) |
|
||||
_SHIFTL(0, 0, 8),
|
||||
(u8)phi_v0_2);
|
||||
}
|
||||
|
@ -2977,8 +2976,7 @@ void func_800F4C58(Vec3f* pos, u16 sfxId, u8 arg2) {
|
|||
for (i = 0; i < gChannelsPerBank[gSfxChannelLayout][bankId]; i++) {
|
||||
if ((gActiveSounds[bankId][i].entryIndex != 0xFF) &&
|
||||
(sfxId == gSoundBanks[bankId][gActiveSounds[bankId][i].entryIndex].sfxId)) {
|
||||
Audio_QueueCmdS8(
|
||||
_SHIFTL(0x6, 24, 8) | _SHIFTL(SEQ_PLAYER_SFX, 16, 8) | _SHIFTL(phi_s1, 8, 8) | _SHIFTL(6, 0, 8), arg2);
|
||||
Audio_QueueCmdS8(_SHIFTL(CHAN_UPD_SCRIPT_IO, 24, 8) | _SHIFTL(SEQ_PLAYER_SFX, 16, 8) | _SHIFTL(phi_s1, 8, 8) | _SHIFTL(6, 0, 8), arg2);
|
||||
}
|
||||
phi_s1++;
|
||||
}
|
||||
|
@ -3020,8 +3018,8 @@ void func_800F4E30(Vec3f* pos, f32 arg1) {
|
|||
|
||||
for (i = 0; i < 0x10; i++) {
|
||||
if (i != 9) {
|
||||
Audio_SeqCmd6(SEQ_PLAYER_BGM_MAIN, 2, i, (127.0f * phi_f22));
|
||||
Audio_QueueCmdS8(0x3 << 24 | SEQ_PLAYER_BGM_MAIN << 16 | ((u8)((u32)i) << 8), phi_s4);
|
||||
Audio_SeqSetTransVolScale(SEQ_PLAYER_BGM_MAIN, 2, i, (127.0f * phi_f22));
|
||||
Audio_QueueCmdS8(CHAN_UPD_PAN_SIGNED << 24 | SEQ_PLAYER_BGM_MAIN << 16 | ((u8)((u32)i) << 8), phi_s4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3079,7 +3077,7 @@ void Audio_SplitBgmChannels(s8 volSplit) {
|
|||
}
|
||||
}
|
||||
|
||||
Audio_SeqCmdA(bgmPlayers[i], channelBits);
|
||||
Audio_SeqSetChannelStopMask(bgmPlayers[i], channelBits);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3146,7 +3144,7 @@ void func_800F5550(u16 seqId) {
|
|||
if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_WINDMILL) {
|
||||
if (func_800FA0B4(SEQ_PLAYER_BGM_SUB) == NA_BGM_LONLON) {
|
||||
func_800F9474(SEQ_PLAYER_BGM_SUB, 0);
|
||||
Audio_QueueCmdS32(0xF8000000, 0);
|
||||
Audio_QueueCmdS32(QUEUE_FINISHED << 24, 0);
|
||||
}
|
||||
|
||||
if ((sSeqFlags[D_80130630] & 0x20) && sSeqFlags[(seqId & 0xFF) & 0xFF] & 0x10) {
|
||||
|
@ -3192,16 +3190,16 @@ void func_800F5718(void) {
|
|||
|
||||
void func_800F574C(f32 arg0, u8 arg2) {
|
||||
if (arg0 == 1.0f) {
|
||||
Audio_SeqCmdB40(SEQ_PLAYER_BGM_MAIN, arg2, 0);
|
||||
Audio_SeqUpdateTempo2(SEQ_PLAYER_BGM_MAIN, arg2, 0);
|
||||
} else {
|
||||
Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x30, arg2, arg0 * 100.0f);
|
||||
Audio_SeqStartWithSetup(SEQ_PLAYER_FANFARE, 0x30, arg2, arg0 * 100.0f);
|
||||
}
|
||||
Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0xA0, arg2, arg0 * 100.0f);
|
||||
Audio_SeqStartWithSetup(SEQ_PLAYER_FANFARE, 0xA0, arg2, arg0 * 100.0f);
|
||||
}
|
||||
|
||||
void func_800F5918(void) {
|
||||
if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_MINI_GAME_2 && func_800FA11C(0, 0xF0000000)) {
|
||||
Audio_SeqCmdB(SEQ_PLAYER_BGM_MAIN, 5, 0, 0xD2);
|
||||
Audio_SeqUpdateTempo(SEQ_PLAYER_BGM_MAIN, 5, 0, 0xD2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3215,7 +3213,7 @@ void func_800F595C(u16 arg0) {
|
|||
|
||||
} else {
|
||||
func_800F5E18(SEQ_PLAYER_BGM_MAIN, arg0, 0, 7, -1);
|
||||
Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_FANFARE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3223,11 +3221,11 @@ void func_800F59E8(u16 arg0) {
|
|||
u8 arg0b = arg0 & 0xFF;
|
||||
|
||||
if (sSeqFlags[arg0b] & 2) {
|
||||
Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_FANFARE, 0);
|
||||
} else if (sSeqFlags[arg0b] & 4) {
|
||||
Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_FANFARE, 0);
|
||||
} else {
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_MAIN, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3266,7 +3264,7 @@ void func_800F5B58(void) {
|
|||
if ((func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && (D_80130628 != NA_BGM_DISABLED) &&
|
||||
(sSeqFlags[func_800FA0B4(SEQ_PLAYER_BGM_MAIN) & 0xFF] & 8)) {
|
||||
if (D_80130628 == NA_BGM_DISABLED) {
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_MAIN, 0);
|
||||
} else {
|
||||
Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, D_80130628);
|
||||
}
|
||||
|
@ -3304,7 +3302,7 @@ void Audio_PlayFanfare(u16 seqId) {
|
|||
D_8016B9F4 = 1;
|
||||
} else {
|
||||
D_8016B9F4 = 5;
|
||||
Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_FANFARE, 0);
|
||||
}
|
||||
D_8016B9F6 = seqId;
|
||||
}
|
||||
|
@ -3317,32 +3315,32 @@ void func_800F5CF8(void) {
|
|||
if (D_8016B9F4 != 0) {
|
||||
D_8016B9F4--;
|
||||
if (D_8016B9F4 == 0) {
|
||||
Audio_QueueCmdS32(0xE3000000, SEQUENCE_TABLE);
|
||||
Audio_QueueCmdS32(0xE3000000, FONT_TABLE);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_POP_CACHE << 24, SEQUENCE_TABLE);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_POP_CACHE << 24, FONT_TABLE);
|
||||
func_800FA0B4(SEQ_PLAYER_BGM_MAIN);
|
||||
sp26 = func_800FA0B4(SEQ_PLAYER_FANFARE);
|
||||
sp22 = func_800FA0B4(SEQ_PLAYER_BGM_SUB);
|
||||
if (sp26 == NA_BGM_DISABLED) {
|
||||
Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 1, 0, 5);
|
||||
Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 1, 0, 5);
|
||||
Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x80, 1, 0xA);
|
||||
Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x83, 1, 0xA);
|
||||
Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x90, 0, 0);
|
||||
Audio_SeqStartWithSetup(SEQ_PLAYER_FANFARE, 0x80, 1, 0xA);
|
||||
Audio_SeqStartWithSetup(SEQ_PLAYER_FANFARE, 0x83, 1, 0xA);
|
||||
Audio_SeqStartWithSetup(SEQ_PLAYER_FANFARE, 0x90, 0, 0);
|
||||
if (sp22 != NA_BGM_LONLON) {
|
||||
Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x93, 0, 0);
|
||||
Audio_SeqStartWithSetup(SEQ_PLAYER_FANFARE, 0x93, 0, 0);
|
||||
}
|
||||
}
|
||||
Audio_StartSeq(SEQ_PLAYER_FANFARE, 1, D_8016B9F6);
|
||||
Audio_SeqCmdA(0, 0xFFFF);
|
||||
Audio_SeqSetChannelStopMask(0, 0xFFFF);
|
||||
if (sp22 != NA_BGM_LONLON) {
|
||||
Audio_SeqCmdA(SEQ_PLAYER_BGM_SUB, 0xFFFF);
|
||||
Audio_SeqSetChannelStopMask(SEQ_PLAYER_BGM_SUB, 0xFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_800F5E18(u8 playerIdx, u16 seqId, u8 fadeTimer, s8 arg3, s8 arg4) {
|
||||
Audio_SeqCmd7(playerIdx, arg3, arg4);
|
||||
Audio_SeqSetIoPortGlobal(playerIdx, arg3, arg4);
|
||||
Audio_StartSeq(playerIdx, fadeTimer, seqId);
|
||||
}
|
||||
|
||||
|
@ -3383,7 +3381,7 @@ void Audio_SetSequenceMode(u8 seqMode) {
|
|||
}
|
||||
} else if ((sPrevSeqMode & 0x7F) == SEQ_MODE_ENEMY) {
|
||||
// Stop playing enemy bgm
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_SUB, 10);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_SUB, 10);
|
||||
if (seqMode == SEQ_MODE_IGNORE) {
|
||||
volumeFadeOutTimer = 0;
|
||||
} else {
|
||||
|
@ -3414,7 +3412,7 @@ void Audio_SetSequenceMode(u8 seqMode) {
|
|||
}
|
||||
|
||||
sPrevSeqMode = seqMode;
|
||||
Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 2, seqMode);
|
||||
Audio_SeqSetIoPortGlobal(SEQ_PLAYER_BGM_MAIN, 2, seqMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3465,9 +3463,9 @@ void func_800F6268(f32 dist, u16 arg1) {
|
|||
phi_v1 = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f);
|
||||
}
|
||||
// Transition volume of channels 0, 1 and 13 on seq player 0 over 3 frames
|
||||
Audio_SeqCmd6(SEQ_PLAYER_BGM_MAIN, 3, 0, 127 - phi_v1);
|
||||
Audio_SeqCmd6(SEQ_PLAYER_BGM_MAIN, 3, 1, 127 - phi_v1);
|
||||
Audio_SeqCmd6(SEQ_PLAYER_BGM_MAIN, 3, 13, phi_v1);
|
||||
Audio_SeqSetTransVolScale(SEQ_PLAYER_BGM_MAIN, 3, 0, 127 - phi_v1);
|
||||
Audio_SeqSetTransVolScale(SEQ_PLAYER_BGM_MAIN, 3, 1, 127 - phi_v1);
|
||||
Audio_SeqSetTransVolScale(SEQ_PLAYER_BGM_MAIN, 3, 13, phi_v1);
|
||||
if (D_8016B9D8 == 0) {
|
||||
D_8016B9D8++;
|
||||
}
|
||||
|
@ -3476,7 +3474,7 @@ void func_800F6268(f32 dist, u16 arg1) {
|
|||
temp_a0 = (s8)(func_800FA0B4(SEQ_PLAYER_BGM_SUB) & 0xFF);
|
||||
if ((temp_a0 != (arg1 & 0xFF)) && (D_8016B9D8 < 10)) {
|
||||
func_800F5E18(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0);
|
||||
Audio_SeqCmdA(SEQ_PLAYER_BGM_SUB, 0xFFFC);
|
||||
Audio_SeqSetChannelStopMask(SEQ_PLAYER_BGM_SUB, 0xFFFC);
|
||||
D_8016B9D8 = 10;
|
||||
}
|
||||
|
||||
|
@ -3488,8 +3486,8 @@ void func_800F6268(f32 dist, u16 arg1) {
|
|||
phi_v1 = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f);
|
||||
}
|
||||
// Transition volume of channels 0 and 1 on seq player 0 over 3 frames
|
||||
Audio_SeqCmd6(SEQ_PLAYER_BGM_SUB, 3, 0, 127 - phi_v1);
|
||||
Audio_SeqCmd6(SEQ_PLAYER_BGM_SUB, 3, 1, 127 - phi_v1);
|
||||
Audio_SeqSetTransVolScale(SEQ_PLAYER_BGM_SUB, 3, 0, 127 - phi_v1);
|
||||
Audio_SeqSetTransVolScale(SEQ_PLAYER_BGM_SUB, 3, 1, 127 - phi_v1);
|
||||
}
|
||||
|
||||
if (D_8016B9D8 < 10) {
|
||||
|
@ -3502,10 +3500,10 @@ void func_800F64E0(u8 arg0) {
|
|||
D_80130608 = arg0;
|
||||
if (arg0 != 0) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_WIN_OPEN, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
Audio_QueueCmdS32(0xF1000000, 0);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_UKN_F1 << 24, 0);
|
||||
} else {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_WIN_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
Audio_QueueCmdS32(0xF2000000, 0);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_UKN_F2 << 24, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3525,19 +3523,19 @@ void func_800F6584(u8 arg0) {
|
|||
}
|
||||
|
||||
if (arg0 != 0) {
|
||||
Audio_SeqCmd6(playerIdx, 1, 0, 0);
|
||||
Audio_SeqCmd6(playerIdx, 1, 1, 0);
|
||||
Audio_SeqSetTransVolScale(playerIdx, 1, 0, 0);
|
||||
Audio_SeqSetTransVolScale(playerIdx, 1, 1, 0);
|
||||
if (playerIdx == SEQ_PLAYER_BGM_SUB) {
|
||||
Audio_SeqCmdA(playerIdx, sp34 | 3);
|
||||
Audio_SeqSetChannelStopMask(playerIdx, sp34 | 3);
|
||||
}
|
||||
} else {
|
||||
if (playerIdx == SEQ_PLAYER_BGM_SUB) {
|
||||
func_800F5E18(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0);
|
||||
}
|
||||
Audio_SeqCmd6(playerIdx, 1, 0, 0x7F);
|
||||
Audio_SeqCmd6(playerIdx, 1, 1, 0x7F);
|
||||
Audio_SeqSetTransVolScale(playerIdx, 1, 0, 0x7F);
|
||||
Audio_SeqSetTransVolScale(playerIdx, 1, 1, 0x7F);
|
||||
if (playerIdx == SEQ_PLAYER_BGM_SUB) {
|
||||
Audio_SeqCmdA(playerIdx, sp34);
|
||||
Audio_SeqSetChannelStopMask(playerIdx, sp34);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3599,7 +3597,7 @@ void Audio_SetExtraFilter(u8 filter) {
|
|||
for (i = 0; i < 16; i++) {
|
||||
t = i;
|
||||
// CHAN_UPD_SCRIPT_IO (seq player 0, all channels, slot 6)
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_BGM_MAIN << 16 | ((t & 0xFF) << 8) | 6, filter);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_BGM_MAIN << 16 | ((t & 0xFF) << 8) | 6, filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3622,8 +3620,8 @@ void func_800F6964(u16 arg0) {
|
|||
s32 skip;
|
||||
u8 i;
|
||||
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, (arg0 * 3) / 2);
|
||||
Audio_SeqCmd1(SEQ_PLAYER_FANFARE, (arg0 * 3) / 2);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_MAIN, (arg0 * 3) / 2);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_FANFARE, (arg0 * 3) / 2);
|
||||
for (i = 0; i < 0x10; i++) {
|
||||
skip = false;
|
||||
switch (i) {
|
||||
|
@ -3639,17 +3637,17 @@ void func_800F6964(u16 arg0) {
|
|||
}
|
||||
|
||||
if (!skip) {
|
||||
Audio_SeqCmd6(SEQ_PLAYER_SFX, arg0 >> 1, i, 0);
|
||||
Audio_SeqSetTransVolScale(SEQ_PLAYER_SFX, arg0 >> 1, i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_SUB, (arg0 * 3) / 2);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_SUB, (arg0 * 3) / 2);
|
||||
}
|
||||
|
||||
void func_800F6AB0(u16 arg0) {
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, arg0);
|
||||
Audio_SeqCmd1(SEQ_PLAYER_FANFARE, arg0);
|
||||
Audio_SeqCmd1(SEQ_PLAYER_BGM_SUB, arg0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_MAIN, arg0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_FANFARE, arg0);
|
||||
Audio_SeqDisablePlayer(SEQ_PLAYER_BGM_SUB, arg0);
|
||||
Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 0);
|
||||
Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 1, 0x7F, 0);
|
||||
}
|
||||
|
@ -3707,7 +3705,7 @@ void func_800F6C34(void) {
|
|||
sSpecReverb = sSpecReverbs[gAudioSpecId];
|
||||
D_80130608 = 0;
|
||||
D_80130628 = NA_BGM_DISABLED;
|
||||
Audio_QueueCmdS8(0x46 << 24 | SEQ_PLAYER_BGM_MAIN << 16, -1);
|
||||
Audio_QueueCmdS8(SEQ_CMD_UKN_46 << 24 | SEQ_PLAYER_BGM_MAIN << 16, -1);
|
||||
sSariaBgmPtr = NULL;
|
||||
D_8016B9F4 = 0;
|
||||
D_8016B9F3 = 1;
|
||||
|
@ -3737,7 +3735,7 @@ void func_800F6D58(u8 arg0, u8 arg1, u8 arg2) {
|
|||
}
|
||||
|
||||
for (i = t; i <= temp_a0; i++) {
|
||||
Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, arg1, i, arg2);
|
||||
Audio_SeqSetIoPortMasked(SEQ_PLAYER_BGM_MAIN, arg1, i, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3749,9 +3747,9 @@ void func_800F6E7C(u16 arg0, u16 arg1) {
|
|||
func_800F3F3C(0xF);
|
||||
return;
|
||||
}
|
||||
Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 0, 1);
|
||||
Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 4, arg0 >> 8);
|
||||
Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 5, arg0 & 0xFF);
|
||||
Audio_SeqSetIoPortGlobal(SEQ_PLAYER_BGM_MAIN, 0, 1);
|
||||
Audio_SeqSetIoPortGlobal(SEQ_PLAYER_BGM_MAIN, 4, arg0 >> 8);
|
||||
Audio_SeqSetIoPortGlobal(SEQ_PLAYER_BGM_MAIN, 5, arg0 & 0xFF);
|
||||
Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 1);
|
||||
|
||||
i = 0;
|
||||
|
@ -3768,7 +3766,7 @@ void func_800F6E7C(u16 arg0, u16 arg1) {
|
|||
|
||||
for (i = 0; i < 0x10; i++) {
|
||||
if (!(arg1 & (1 << i)) && (arg0 & (1 << i))) {
|
||||
Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, 1, i, 1);
|
||||
Audio_SeqSetIoPortMasked(SEQ_PLAYER_BGM_MAIN, 1, i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3783,14 +3781,14 @@ void func_800F6FB4(u8 arg0) {
|
|||
!(sSeqFlags[((u8)D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254) & 0xFF] & 0x80)) {
|
||||
func_800F6E7C(D_801306DC[arg0].unk_00, D_801306DC[arg0].unk_02);
|
||||
while ((D_801306DC[arg0].unk_04[i] != 0xFF) && (i < 100)) {
|
||||
// Probably a fake match, using Audio_SeqCmd8 doesn't work.
|
||||
// Probably a fake match, using Audio_SeqSetIoPortMasked doesn't work.
|
||||
b0 = D_801306DC[arg0].unk_04[i++];
|
||||
b1 = D_801306DC[arg0].unk_04[i++];
|
||||
b2 = D_801306DC[arg0].unk_04[i++];
|
||||
Audio_QueueSeqCmd(0x80000000 | (SEQ_PLAYER_BGM_MAIN << 24) | (b1 << 0x10) | (b0 << 8) | b2);
|
||||
}
|
||||
|
||||
Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, 0x07, 13, D_80130604);
|
||||
Audio_SeqSetIoPortMasked(SEQ_PLAYER_BGM_MAIN, 0x07, 13, D_80130604);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3809,9 +3807,9 @@ void Audio_InitSound(void) {
|
|||
|
||||
void func_800F7170(void) {
|
||||
func_800F9280(SEQ_PLAYER_SFX, 0, 0x70, 1);
|
||||
Audio_QueueCmdS32(0xF2000000, 1);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_UKN_F2 << 24, 1);
|
||||
Audio_ScheduleProcessCmds();
|
||||
Audio_QueueCmdS32(0xF8000000, 0);
|
||||
Audio_QueueCmdS32(QUEUE_FINISHED << 24, 0);
|
||||
}
|
||||
|
||||
void func_800F71BC(s32 arg0) {
|
||||
|
@ -3825,7 +3823,7 @@ void func_800F71BC(s32 arg0) {
|
|||
|
||||
void func_800F7208(void) {
|
||||
func_800FADF8();
|
||||
Audio_QueueCmdS32(0xF2000000, 1);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_UKN_F2 << 24, 1);
|
||||
func_800F6C34();
|
||||
Audio_ResetSfxChannelState();
|
||||
func_800F9280(SEQ_PLAYER_SFX, 0, 0x70, 1);
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
#include "def/audio.h"
|
||||
#include "def/audio_rsp.h"
|
||||
#include "def/audio_playback.h"
|
||||
#include "../../AziAudio/AziAudio/AudioSpec.h"
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
#include "ultra64/rcp.h"
|
||||
#include "redef_msgqueue.h"
|
||||
|
||||
static AudioMgr* g_audioMgr = NULL;
|
||||
|
||||
|
@ -49,9 +54,125 @@ void AudioMgr_ThreadEntry(void* arg0) {
|
|||
void AudioMgr_Unlock(AudioMgr* audioMgr) {
|
||||
}
|
||||
|
||||
void audio_int()
|
||||
{
|
||||
/*
|
||||
*AudioInfo.AI_STATUS_REG = AI_STATUS_DMA_BUSY;
|
||||
*AudioInfo.AI_STATUS_REG &= ~AI_STATUS_FIFO_FULL;
|
||||
*AudioInfo.MI_INTR_REG |= MI_INTR_AI;
|
||||
*/
|
||||
/*
|
||||
uint32_t mi_intr_reg = HW_REG(MI_INTR_REG, u32), status_register;
|
||||
|
||||
mi_intr_reg &= ~MI_INTR_AI;
|
||||
mi_intr_reg |= (m_AudioIntrReg & MI_INTR_AI);
|
||||
|
||||
mi_intr_reg |= (m_RspIntrReg & MI_INTR_SP);
|
||||
mi_intr_reg |= (m_GfxIntrReg & MI_INTR_DP);
|
||||
if((MI_INTR_MASK_REG & mi_intr_reg) != 0)
|
||||
{
|
||||
FAKE_CAUSE_REGISTER |= CAUSE_IP2;
|
||||
}
|
||||
else
|
||||
{
|
||||
FAKE_CAUSE_REGISTER &= ~CAUSE_IP2;
|
||||
}
|
||||
HW_REG(MI_INTR_REG, u32) = mi_intr_reg;
|
||||
status_register = HW_REG(AI_STATUS_REG, u32);
|
||||
|
||||
if((status_register & STATUS_IE) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if((status_register & STATUS_EXL) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if((status_register & STATUS_ERL) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if((status_register & FAKE_CAUSE_REGISTER & 0xFF00) != 0)
|
||||
{
|
||||
if(m_FirstInterupt)
|
||||
{
|
||||
m_FirstInterupt = false;
|
||||
}
|
||||
}*/
|
||||
return;
|
||||
}
|
||||
|
||||
static AudioTask* g_currentAudioTask = nullptr;
|
||||
|
||||
void bah()
|
||||
{
|
||||
}
|
||||
|
||||
void audio_thread()
|
||||
{
|
||||
SREG(20);
|
||||
s16* msg = NULL;
|
||||
auto audioMgr = g_audioMgr;
|
||||
|
||||
const auto interval = std::chrono::microseconds(1000 * 1000 / 60);
|
||||
auto targetTime = std::chrono::high_resolution_clock::now() + interval;
|
||||
while(true)
|
||||
{
|
||||
if(std::chrono::high_resolution_clock::now() > targetTime)
|
||||
{
|
||||
auto task = getAudioTask();
|
||||
|
||||
if(task)
|
||||
{
|
||||
HLEStart((AZI_OSTask*)&task->task.t);
|
||||
AiUpdate(false);
|
||||
}
|
||||
|
||||
targetTime += interval;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<std::thread> t1;
|
||||
|
||||
static bool g_aziInit = false;
|
||||
|
||||
void azi_init()
|
||||
{
|
||||
if(g_aziInit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_aziInit = true;
|
||||
AUDIO_INFO Audio_Info;
|
||||
memset(&Audio_Info, 0, sizeof(Audio_Info));
|
||||
|
||||
HW_REG(AI_CONTROL_REG, u32) = 1;
|
||||
HW_REG(AI_DACRATE_REG, u32) = 0x3FFF;
|
||||
HW_REG(AI_BITRATE_REG, u32) = 0xF;
|
||||
|
||||
Audio_Info.hwnd = GetActiveWindow();
|
||||
Audio_Info.AI_DRAM_ADDR_REG = &HW_REG(AI_DRAM_ADDR_REG, u32);
|
||||
Audio_Info.AI_LEN_REG = &HW_REG(AI_LEN_REG, u32);
|
||||
Audio_Info.AI_CONTROL_REG = &HW_REG(AI_CONTROL_REG, u32);
|
||||
Audio_Info.AI_STATUS_REG = &HW_REG(AI_STATUS_REG, u32);
|
||||
Audio_Info.AI_DACRATE_REG = &HW_REG(AI_DACRATE_REG, u32);
|
||||
Audio_Info.AI_BITRATE_REG = &HW_REG(AI_BITRATE_REG, u32);
|
||||
Audio_Info.MI_INTR_REG = &HW_REG(MI_INTR_REG, u32);
|
||||
Audio_Info.CheckInterrupts = audio_int;
|
||||
|
||||
InitiateAudio(Audio_Info);
|
||||
}
|
||||
|
||||
void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedContext* sched, IrqMgr* irqMgr) {
|
||||
bzero(audioMgr, sizeof(AudioMgr));
|
||||
g_audioMgr = audioMgr;
|
||||
azi_init();
|
||||
|
||||
IrqMgrClient irqClient;
|
||||
s16* msg = NULL;
|
||||
|
@ -59,4 +180,6 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon
|
|||
Audio_Init();
|
||||
//AudioLoad_SetDmaHandler(DmaMgr_DmaHandler);
|
||||
Audio_InitSound();
|
||||
|
||||
t1 = std::make_unique<std::thread>(audio_thread);
|
||||
}
|
||||
|
|
|
@ -552,11 +552,11 @@ void Audio_PlayActiveSounds(u8 bankId) {
|
|||
}
|
||||
}
|
||||
Audio_SetSoundProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx);
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8), 1);
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 4,
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8), 1);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 4,
|
||||
entry->sfxId & 0xFF);
|
||||
if (gIsLargeSoundBank[bankId]) {
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 5,
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 5,
|
||||
(entry->sfxId & 0x100) >> 8);
|
||||
}
|
||||
if (entry->sfxId & 0xC00) {
|
||||
|
@ -588,7 +588,7 @@ void Audio_StopSfxByBank(u8 bankId) {
|
|||
while (entryIndex != 0xFF) {
|
||||
entry = &gSoundBanks[bankId][entryIndex];
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(bankId, entryIndex);
|
||||
|
@ -608,7 +608,7 @@ void func_800F8884(u8 bankId, Vec3f* pos) {
|
|||
entry = &gSoundBanks[bankId][entryIndex];
|
||||
if (entry->posX == &pos->x) {
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(bankId, entryIndex);
|
||||
|
@ -650,7 +650,7 @@ void Audio_StopSfxByPosAndId(Vec3f* pos, u16 sfxId) {
|
|||
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
|
||||
if (entry->posX == &pos->x && entry->sfxId == sfxId) {
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex);
|
||||
|
@ -678,7 +678,7 @@ void Audio_StopSfxByTokenAndId(u8 token, u16 sfxId) {
|
|||
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
|
||||
if (entry->token == token && entry->sfxId == sfxId) {
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex);
|
||||
|
@ -705,7 +705,7 @@ void Audio_StopSfxById(u32 sfxId) {
|
|||
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
|
||||
if (entry->sfxId == sfxId) {
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex);
|
||||
|
|
|
@ -20,12 +20,12 @@ u8 D_80133418 = 0;
|
|||
// TODO: clean up these macros. They are similar to ones in audio.c but without casts.
|
||||
#define Audio_StartSeq(playerIdx, fadeTimer, seqId) \
|
||||
Audio_QueueSeqCmd(0x00000000 | ((playerIdx) << 24) | ((fadeTimer) << 16) | (seqId))
|
||||
#define Audio_SeqCmdA(playerIdx, a) Audio_QueueSeqCmd(0xA0000000 | ((playerIdx) << 24) | (a))
|
||||
#define Audio_SeqSetChannelStopMask(playerIdx, a) Audio_QueueSeqCmd(0xA0000000 | ((playerIdx) << 24) | (a))
|
||||
#define Audio_SeqCmdB30(playerIdx, a, b) Audio_QueueSeqCmd(0xB0003000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmdB40(playerIdx, a, b) Audio_QueueSeqCmd(0xB0004000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqUpdateTempo2(playerIdx, a, b) Audio_QueueSeqCmd(0xB0004000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmd3(playerIdx, a) Audio_QueueSeqCmd(0x30000000 | ((playerIdx) << 24) | (a))
|
||||
#define Audio_SeqCmd5(playerIdx, a, b) Audio_QueueSeqCmd(0x50000000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmd4(playerIdx, a, b) Audio_QueueSeqCmd(0x40000000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmd_Trans_Volume(playerIdx, a, b) Audio_QueueSeqCmd(0x40000000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SetVolScaleNow(playerIdx, volFadeTimer, volScale) \
|
||||
Audio_ProcessSeqCmd(0x40000000 | ((u8)playerIdx << 24) | ((u8)volFadeTimer << 16) | ((u8)(volScale * 127.0f)));
|
||||
|
||||
|
@ -38,9 +38,9 @@ void func_800F9280(u8 playerIdx, u8 seqId, u8 arg2, u16 fadeTimer) {
|
|||
arg2 &= 0x7F;
|
||||
if (arg2 == 0x7F) {
|
||||
dur = (fadeTimer >> 3) * 60 * gAudioContext.audioBufferParameters.updatesPerFrame;
|
||||
Audio_QueueCmdS32(0x85000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(seqId, 8, 8), dur);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_UKN_85 << 24 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(seqId, 8, 8), dur);
|
||||
} else {
|
||||
Audio_QueueCmdS32(0x82000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(seqId, 8, 8),
|
||||
Audio_QueueCmdS32(CHAN_LOAD_UKN_82 << 24 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(seqId, 8, 8),
|
||||
(fadeTimer * (u16)gAudioContext.audioBufferParameters.updatesPerFrame) / 4);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ void func_800F9280(u8 playerIdx, u8 seqId, u8 arg2, u16 fadeTimer) {
|
|||
D_8016E750[playerIdx].unk_256 = seqId | (arg2 << 8);
|
||||
|
||||
if (D_8016E750[playerIdx].volCur != 1.0f) {
|
||||
Audio_QueueCmdF32(0x41000000 | _SHIFTL(playerIdx, 16, 8), D_8016E750[playerIdx].volCur);
|
||||
Audio_QueueCmdF32(SEQ_CMD_UKN_41 << 24 | _SHIFTL(playerIdx, 16, 8), D_8016E750[playerIdx].volCur);
|
||||
}
|
||||
|
||||
D_8016E750[playerIdx].unk_28 = 0;
|
||||
|
@ -68,7 +68,7 @@ void func_800F9280(u8 playerIdx, u8 seqId, u8 arg2, u16 fadeTimer) {
|
|||
}
|
||||
|
||||
void func_800F9474(u8 playerIdx, u16 arg1) {
|
||||
Audio_QueueCmdS32(0x83000000 | ((u8)playerIdx << 16),
|
||||
Audio_QueueCmdS32(CHAN_LOAD_DISABLE_SEQUENCE << 24 | ((u8)playerIdx << 16),
|
||||
(arg1 * (u16)gAudioContext.audioBufferParameters.updatesPerFrame) / 4);
|
||||
D_8016E750[playerIdx].unk_254 = NA_BGM_DISABLED;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
playerIdx = (cmd & 0xF000000) >> 24;
|
||||
|
||||
switch (op) {
|
||||
case 0x0:
|
||||
case AUDIO_CMD_SEQUENCE_PLAY:
|
||||
// play sequence immediately
|
||||
seqId = cmd & 0xFF;
|
||||
seqArgs = (cmd & 0xFF00) >> 8;
|
||||
|
@ -139,13 +139,13 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 0x1:
|
||||
case AUDIO_CMD_DISABLE_PLAYER:
|
||||
// disable seq player
|
||||
fadeTimer = (cmd & 0xFF0000) >> 13;
|
||||
func_800F9474(playerIdx, fadeTimer);
|
||||
break;
|
||||
|
||||
case 0x2:
|
||||
case AUDIO_CMD_SEQUENCE_QUEUE:
|
||||
// queue sequence
|
||||
seqId = cmd & 0xFF;
|
||||
seqArgs = (cmd & 0xFF00) >> 8;
|
||||
|
@ -183,7 +183,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 0x3:
|
||||
case AUDIO_CMD_SEQUENCE_STOP:
|
||||
// unqueue/stop sequence
|
||||
seqId = cmd & 0xFF;
|
||||
fadeTimer = (cmd & 0xFF0000) >> 13;
|
||||
|
@ -212,7 +212,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 0x4:
|
||||
case AUDIO_CMD_SEQUENCE_TRANS_VOLUME:
|
||||
// transition seq volume
|
||||
duration = (cmd & 0xFF0000) >> 15;
|
||||
val = cmd & 0xFF;
|
||||
|
@ -227,7 +227,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 0x5:
|
||||
case AUDIO_CMD_SEQUENCE_TRANS_FREQ_SCALE_ALL:
|
||||
// transition freq scale for all channels
|
||||
duration = (cmd & 0xFF0000) >> 15;
|
||||
val = cmd & 0xFFFF;
|
||||
|
@ -244,7 +244,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
D_8016E750[playerIdx].unk_250 = 0xFFFF;
|
||||
break;
|
||||
|
||||
case 0xD:
|
||||
case AUDIO_CMD_SEQUENCE_TRANS_FREQ_SCALE:
|
||||
// transition freq scale
|
||||
duration = (cmd & 0xFF0000) >> 15;
|
||||
chanIdx = (cmd & 0xF000) >> 12;
|
||||
|
@ -260,7 +260,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
D_8016E750[playerIdx].unk_250 |= 1 << chanIdx;
|
||||
break;
|
||||
|
||||
case 0x6:
|
||||
case AUDIO_CMD_SEQUENCE_TRANS_VOL_SCALE:
|
||||
// transition vol scale
|
||||
duration = (cmd & 0xFF0000) >> 15;
|
||||
chanIdx = (cmd & 0xF00) >> 8;
|
||||
|
@ -278,52 +278,52 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 0x7:
|
||||
case AUDIO_CMD_SET_IO_PORT_GLOBAL:
|
||||
// set global io port
|
||||
port = (cmd & 0xFF0000) >> 16;
|
||||
val = cmd & 0xFF;
|
||||
Audio_QueueCmdS8(0x46000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(port, 0, 8), val);
|
||||
Audio_QueueCmdS8(SEQ_CMD_UKN_46 << 24 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(port, 0, 8), val);
|
||||
break;
|
||||
|
||||
case 0x8:
|
||||
case AUDIO_CMD_SET_IO_PORT_MASKED:
|
||||
// set io port if channel masked
|
||||
chanIdx = (cmd & 0xF00) >> 8;
|
||||
port = (cmd & 0xFF0000) >> 16;
|
||||
val = cmd & 0xFF;
|
||||
if ((D_8016E750[playerIdx].unk_258 & (1 << chanIdx)) == 0) {
|
||||
Audio_QueueCmdS8(0x06000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(chanIdx, 8, 8) | _SHIFTL(port, 0, 8),
|
||||
Audio_QueueCmdS8(CHAN_UPD_SCRIPT_IO << 24 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(chanIdx, 8, 8) | _SHIFTL(port, 0, 8),
|
||||
val);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x9:
|
||||
case AUDIO_CMD_SET_IO_PORT_MASK:
|
||||
// set channel mask for command 0x8
|
||||
D_8016E750[playerIdx].unk_258 = cmd & 0xFFFF;
|
||||
break;
|
||||
|
||||
case 0xA:
|
||||
case AUDIO_CMD_SET_CHANNEL_STOP_MASK:
|
||||
// set channel stop mask
|
||||
channelMask = cmd & 0xFFFF;
|
||||
if (channelMask != 0) {
|
||||
// with channel mask channelMask...
|
||||
Audio_QueueCmdU16(0x90000000 | _SHIFTL(playerIdx, 16, 8), channelMask);
|
||||
Audio_QueueCmdU16(0x90 << 24 | _SHIFTL(playerIdx, 16, 8), channelMask);
|
||||
// stop channels
|
||||
Audio_QueueCmdS8(0x08000000 | _SHIFTL(playerIdx, 16, 8) | 0xFF00, 1);
|
||||
Audio_QueueCmdS8(CHAN_UPD_STOP_SOMETHING2 << 24 | _SHIFTL(playerIdx, 16, 8) | 0xFF00, 1);
|
||||
}
|
||||
if ((channelMask ^ 0xFFFF) != 0) {
|
||||
// with channel mask ~channelMask...
|
||||
Audio_QueueCmdU16(0x90000000 | _SHIFTL(playerIdx, 16, 8), (channelMask ^ 0xFFFF));
|
||||
Audio_QueueCmdU16(0x90 << 24 | _SHIFTL(playerIdx, 16, 8), (channelMask ^ 0xFFFF));
|
||||
// unstop channels
|
||||
Audio_QueueCmdS8(0x08000000 | _SHIFTL(playerIdx, 16, 8) | 0xFF00, 0);
|
||||
Audio_QueueCmdS8(CHAN_UPD_STOP_SOMETHING2 << 24 | _SHIFTL(playerIdx, 16, 8) | 0xFF00, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xB:
|
||||
case AUDIO_CMD_UPDATE_TEMPO:
|
||||
// update tempo
|
||||
D_8016E750[playerIdx].unk_14 = cmd;
|
||||
break;
|
||||
|
||||
case 0xC:
|
||||
case AUDIO_CMD_SEQUENCE_START_WITH_SETUP:
|
||||
// start sequence with setup commands
|
||||
subOp = (cmd & 0xF00000) >> 20;
|
||||
if (subOp != 0xF) {
|
||||
|
@ -339,13 +339,13 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 0xE:
|
||||
case AUDIO_CMD_0E:
|
||||
subOp = (cmd & 0xF00) >> 8;
|
||||
val = cmd & 0xFF;
|
||||
switch (subOp) {
|
||||
case 0:
|
||||
// set sound mode
|
||||
Audio_QueueCmdS32(0xF0000000, D_80133410[val]);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_SET_SOUND_MODE << 24, D_80133410[val]);
|
||||
break;
|
||||
case 1:
|
||||
// set sequence starting disabled?
|
||||
|
@ -354,7 +354,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 0xF:
|
||||
case AUDIO_CMD_CHANGE_SPEC:
|
||||
// change spec
|
||||
spec = cmd & 0xFF;
|
||||
gSfxChannelLayout = (cmd & 0xFF00) >> 8;
|
||||
|
@ -362,7 +362,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
gAudioSpecId = spec;
|
||||
func_800E5F88(spec);
|
||||
func_800F71BC(oldSpec);
|
||||
Audio_QueueCmdS32(0xF8000000, 0);
|
||||
Audio_QueueCmdS32(QUEUE_FINISHED << 24, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ void func_800FA3DC(void) {
|
|||
for (j = 0; j < 4; j++) {
|
||||
phi_f0 *= (D_8016E750[playerIdx].volScales[j] / 127.0f);
|
||||
}
|
||||
Audio_SeqCmd4(playerIdx, D_8016E750[playerIdx].volFadeTimer, (u8)(phi_f0 * 127.0f));
|
||||
Audio_SeqCmd_Trans_Volume(playerIdx, D_8016E750[playerIdx].volFadeTimer, (u8)(phi_f0 * 127.0f));
|
||||
D_8016E750[playerIdx].fadeVolUpdate = 0;
|
||||
}
|
||||
|
||||
|
@ -479,7 +479,7 @@ void func_800FA3DC(void) {
|
|||
D_8016E750[playerIdx].volCur = D_8016E750[playerIdx].volTarget;
|
||||
}
|
||||
|
||||
Audio_QueueCmdF32(0x41000000 | _SHIFTL(playerIdx, 16, 8), D_8016E750[playerIdx].volCur);
|
||||
Audio_QueueCmdF32(SEQ_CMD_UKN_41 << 24 | _SHIFTL(playerIdx, 16, 8), D_8016E750[playerIdx].volCur);
|
||||
}
|
||||
|
||||
if (D_8016E750[playerIdx].unk_14 != 0) {
|
||||
|
@ -523,8 +523,8 @@ void func_800FA3DC(void) {
|
|||
}
|
||||
|
||||
D_8016E750[playerIdx].unk_20 = phi_a2;
|
||||
D_8016E750[playerIdx].unk_1C = gAudioContext.seqPlayers[playerIdx].tempo / 0x30;
|
||||
D_8016E750[playerIdx].unk_24 = (D_8016E750[playerIdx].unk_1C - D_8016E750[playerIdx].unk_20) / phi_t0;
|
||||
D_8016E750[playerIdx].tempo = gAudioContext.seqPlayers[playerIdx].tempo / 0x30;
|
||||
D_8016E750[playerIdx].unk_24 = (D_8016E750[playerIdx].tempo - D_8016E750[playerIdx].unk_20) / phi_t0;
|
||||
D_8016E750[playerIdx].unk_28 = phi_t0;
|
||||
D_8016E750[playerIdx].unk_14 = 0;
|
||||
}
|
||||
|
@ -533,12 +533,12 @@ void func_800FA3DC(void) {
|
|||
if (D_8016E750[playerIdx].unk_28 != 0) {
|
||||
D_8016E750[playerIdx].unk_28--;
|
||||
if (D_8016E750[playerIdx].unk_28 != 0) {
|
||||
D_8016E750[playerIdx].unk_1C = D_8016E750[playerIdx].unk_1C - D_8016E750[playerIdx].unk_24;
|
||||
D_8016E750[playerIdx].tempo = D_8016E750[playerIdx].tempo - D_8016E750[playerIdx].unk_24;
|
||||
} else {
|
||||
D_8016E750[playerIdx].unk_1C = D_8016E750[playerIdx].unk_20;
|
||||
D_8016E750[playerIdx].tempo = D_8016E750[playerIdx].unk_20;
|
||||
}
|
||||
// set tempo
|
||||
Audio_QueueCmdS32(0x47000000 | _SHIFTL(playerIdx, 16, 8), D_8016E750[playerIdx].unk_1C);
|
||||
Audio_QueueCmdS32(SEQ_CMD_SET_TEMPO << 24 | _SHIFTL(playerIdx, 16, 8), D_8016E750[playerIdx].tempo);
|
||||
}
|
||||
|
||||
if (D_8016E750[playerIdx].unk_252 != 0) {
|
||||
|
@ -552,7 +552,7 @@ void func_800FA3DC(void) {
|
|||
D_8016E750[playerIdx].unk_252 ^= (1 << k);
|
||||
}
|
||||
// CHAN_UPD_VOL_SCALE (playerIdx = seq, k = chan)
|
||||
Audio_QueueCmdF32(0x01000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(k, 8, 8),
|
||||
Audio_QueueCmdF32(CHAN_UPD_VOL_SCALE << 24 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(k, 8, 8),
|
||||
D_8016E750[playerIdx].unk_50[k].unk_00);
|
||||
}
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ void func_800FA3DC(void) {
|
|||
D_8016E750[playerIdx].unk_250 ^= (1 << k);
|
||||
}
|
||||
// CHAN_UPD_FREQ_SCALE
|
||||
Audio_QueueCmdF32(0x04000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(k, 8, 8),
|
||||
Audio_QueueCmdF32(CHAN_UPD_FREQ_SCALE << 24 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(k, 8, 8),
|
||||
D_8016E750[playerIdx].unk_50[k].unk_10);
|
||||
}
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ void func_800FA3DC(void) {
|
|||
Audio_SeqCmdB30(temp_s1, temp_s0_3, temp_a3_3);
|
||||
break;
|
||||
case 4:
|
||||
Audio_SeqCmdB40(temp_s1, temp_a3_3, 0);
|
||||
Audio_SeqUpdateTempo2(temp_s1, temp_a3_3, 0);
|
||||
break;
|
||||
case 5:
|
||||
temp_v1 = D_8016E750[playerIdx].unk_2C[j] & 0xFFFF;
|
||||
|
@ -633,18 +633,18 @@ void func_800FA3DC(void) {
|
|||
break;
|
||||
case 14:
|
||||
if (temp_a3_3 & 1) {
|
||||
Audio_QueueCmdS32(0xE3000000, SEQUENCE_TABLE);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_POP_CACHE << 24, SEQUENCE_TABLE);
|
||||
}
|
||||
if (temp_a3_3 & 2) {
|
||||
Audio_QueueCmdS32(0xE3000000, FONT_TABLE);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_POP_CACHE << 24, FONT_TABLE);
|
||||
}
|
||||
if (temp_a3_3 & 4) {
|
||||
Audio_QueueCmdS32(0xE3000000, SAMPLE_TABLE);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_POP_CACHE << 24, SAMPLE_TABLE);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
temp_v1 = D_8016E750[playerIdx].unk_2C[j] & 0xFFFF;
|
||||
Audio_SeqCmdA(temp_s1, temp_v1);
|
||||
Audio_SeqSetChannelStopMask(temp_s1, temp_v1);
|
||||
break;
|
||||
case 10:
|
||||
Audio_SeqCmd5(temp_s1, temp_s0_3, (temp_a3_3 * 10) & 0xFFFF);
|
||||
|
@ -662,13 +662,13 @@ u8 func_800FAD34(void) {
|
|||
if (D_80133418 == 1) {
|
||||
if (func_800E5EDC() == 1) {
|
||||
D_80133418 = 0;
|
||||
Audio_QueueCmdS8(0x46020000, gSfxChannelLayout);
|
||||
Audio_QueueCmdS8(SEQ_CMD_UKN_46 << 24 | 0x00020000, gSfxChannelLayout);
|
||||
func_800F7170();
|
||||
}
|
||||
} else if (D_80133418 == 2) {
|
||||
while (func_800E5EDC() != 1) {}
|
||||
D_80133418 = 0;
|
||||
Audio_QueueCmdS8(0x46020000, gSfxChannelLayout);
|
||||
Audio_QueueCmdS8(SEQ_CMD_UKN_46 << 24 | 0x00020000, gSfxChannelLayout);
|
||||
func_800F7170();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define INTERNAL_SRC_CODE_AUDIO_HEAP_C
|
||||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
#include <string.h>
|
||||
#include "z64audio.h"
|
||||
#include "def/aisetfreq.h"
|
||||
#include "def/audio_data.h"
|
||||
|
@ -166,7 +167,9 @@ void* AudioHeap_AllocDmaMemoryZeroed(AudioAllocPool* pool, u32 size) {
|
|||
}
|
||||
|
||||
void* AudioHeap_AllocZeroed(AudioAllocPool* pool, u32 size) {
|
||||
#if 0
|
||||
u8* ret = (u8*)AudioHeap_Alloc(pool, size);
|
||||
|
||||
u8* ptr;
|
||||
|
||||
if (ret != NULL) {
|
||||
|
@ -176,9 +179,19 @@ void* AudioHeap_AllocZeroed(AudioAllocPool* pool, u32 size) {
|
|||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
void* ret = AudioHeap_Alloc(pool, size);
|
||||
if(ret)
|
||||
{
|
||||
memset(ret, 0, size);
|
||||
}
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
void* AudioHeap_Alloc(AudioAllocPool* pool, u32 size) {
|
||||
return _aligned_malloc(ALIGN16(size), 0x10);
|
||||
return malloc(size);
|
||||
u32 aligned = ALIGN16(size);
|
||||
u8* ret = pool->cur;
|
||||
|
||||
|
@ -936,9 +949,9 @@ void AudioHeap_Init(void) {
|
|||
reverb->unk_08 = settings->unk_12;
|
||||
reverb->useReverb = 8;
|
||||
reverb->leftRingBuf =
|
||||
(s16*)AudioHeap_AllocZeroedAttemptExternal(&gAudioContext.notesAndBuffersPool, reverb->windowSize * sizeof(s16));
|
||||
(s16*)AudioHeap_AllocZeroedAttemptExternal(&gAudioContext.notesAndBuffersPool, reverb->windowSize * sizeof(s16) * 2); // TODO FIX HACK
|
||||
reverb->rightRingBuf =
|
||||
(s16*)AudioHeap_AllocZeroedAttemptExternal(&gAudioContext.notesAndBuffersPool, reverb->windowSize * sizeof(s16));
|
||||
(s16*)AudioHeap_AllocZeroedAttemptExternal(&gAudioContext.notesAndBuffersPool, reverb->windowSize * sizeof(s16) * 2); // TODO FIX HACK
|
||||
reverb->nextRingBufPos = 0;
|
||||
reverb->unk_20 = 0;
|
||||
reverb->curFrame = 0;
|
||||
|
|
|
@ -137,6 +137,7 @@ void* AudioLoad_DmaSampleData(Pointer devAddr, size_t size, s32 arg2, u8* dmaInd
|
|||
u32 transfer;
|
||||
s32 bufferPos;
|
||||
u32 i;
|
||||
return devAddr.buffer();
|
||||
|
||||
if (arg2 != 0 || *dmaIndexRef >= gAudioContext.sampleDmaListSize1) {
|
||||
for (i = gAudioContext.sampleDmaListSize1; i < gAudioContext.sampleDmaCount; i++) {
|
||||
|
@ -218,8 +219,8 @@ void* AudioLoad_DmaSampleData(Pointer devAddr, size_t size, s32 arg2, u8* dmaInd
|
|||
dma->ttl = 3;
|
||||
dma->devAddr = dmaDevAddr;
|
||||
dma->sizeUnused = transfer;
|
||||
AudioLoad_Dma(&gAudioContext.currAudioFrameDmaIoMesgBuf[gAudioContext.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr.get(), dma->ramAddr, transfer, &gAudioContext.currAudioFrameDmaQueue, medium,
|
||||
AudioLoad_Dma(nullptr, OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr.get(), dma->ramAddr, transfer, nullptr, medium,
|
||||
"SUPERDMA");
|
||||
*dmaIndexRef = dmaIndex;
|
||||
return (devAddr - dmaDevAddr).get() + dma->ramAddr;
|
||||
|
@ -364,22 +365,9 @@ void AudioLoad_SetSampleFontLoadStatus(s32 sampleBankId, s32 status) {
|
|||
}
|
||||
}
|
||||
|
||||
static AudioTable* LoadTable(AudioTable* table)
|
||||
{
|
||||
for(s16 i = 0; i < table->numEntries; i++)
|
||||
{
|
||||
AudioTableEntry* entry = &table->entries[i];
|
||||
continue;
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
void AudioLoad_InitTable(AudioTable* table, void* romAddr, u16 unkMediumParam) {
|
||||
s32 i;
|
||||
|
||||
LoadTable(table);
|
||||
|
||||
table->unkMediumParam = unkMediumParam;
|
||||
table->romAddr = (uintptr_t)romAddr;
|
||||
|
||||
|
@ -404,10 +392,18 @@ SoundFontData* AudioLoad_SyncLoadSeqFonts(s32 seqId, u32* outDefaultFontId) {
|
|||
|
||||
fontId = 0xFF;
|
||||
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
||||
#ifdef LITTLE_ENDIAN
|
||||
numFonts = gAudioContext.sequenceFontTable[++index];
|
||||
#else
|
||||
numFonts = gAudioContext.sequenceFontTable[index++];
|
||||
#endif
|
||||
|
||||
while (numFonts > 0) {
|
||||
#ifdef LITTLE_ENDIAN
|
||||
fontId = gAudioContext.sequenceFontTable[++index];
|
||||
#else
|
||||
fontId = gAudioContext.sequenceFontTable[index++];
|
||||
#endif
|
||||
font = AudioLoad_SyncLoadFont(fontId);
|
||||
numFonts--;
|
||||
}
|
||||
|
@ -525,11 +521,19 @@ void AudioLoad_DiscardSeqFonts(s32 seqId) {
|
|||
s32 numFonts;
|
||||
|
||||
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
||||
#ifdef LITTLE_ENDIAN
|
||||
numFonts = gAudioContext.sequenceFontTable[++index];
|
||||
#else
|
||||
numFonts = gAudioContext.sequenceFontTable[index++];
|
||||
#endif
|
||||
|
||||
while (numFonts > 0) {
|
||||
numFonts--;
|
||||
#ifdef LITTLE_ENDIAN
|
||||
fontId = AudioLoad_GetRealTableIndex(FONT_TABLE, gAudioContext.sequenceFontTable[++index]);
|
||||
#else
|
||||
fontId = AudioLoad_GetRealTableIndex(FONT_TABLE, gAudioContext.sequenceFontTable[index++]);
|
||||
#endif
|
||||
if (AudioHeap_SearchPermanentCache(FONT_TABLE, fontId) == NULL) {
|
||||
AudioLoad_DiscardFont(fontId);
|
||||
AudioLoad_SetFontLoadStatus(fontId, 0);
|
||||
|
@ -596,10 +600,18 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||
|
||||
fontId = 0xFF;
|
||||
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
||||
#ifdef LITTLE_ENDIAN
|
||||
numFonts = gAudioContext.sequenceFontTable[++index];
|
||||
#else
|
||||
numFonts = gAudioContext.sequenceFontTable[index++];
|
||||
#endif
|
||||
|
||||
while (numFonts > 0) {
|
||||
fontId = gAudioContext.sequenceFontTable[index++];
|
||||
#ifdef LITTLE_ENDIAN
|
||||
fontId = gAudioContext.sequenceFontTable[++index];
|
||||
#else
|
||||
fontId = gAudioContext.sequenceFontTable[index++];
|
||||
#endif
|
||||
AudioLoad_SyncLoadFont(fontId);
|
||||
numFonts--;
|
||||
}
|
||||
|
@ -850,23 +862,20 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||
s32 numSfx = gAudioContext.soundFonts[fontId].numSfx;
|
||||
void** ptrs = (void**)mem;
|
||||
|
||||
#define BASE_OFFSET(x) (void*)((BEE32((uintptr_t)x)) + (u32)(mem))
|
||||
//#define BASE_OFFSET(x) (void*)(((uintptr_t)x) + (u32)(mem))
|
||||
reloc2 = (uintptr_t)ptrs[0];
|
||||
|
||||
if ((reloc2 != 0) && (numDrums != 0)) {
|
||||
ptrs[0] = BASE_OFFSET(reloc2);
|
||||
//ptrs[0] = BASE_OFFSET(reloc2);
|
||||
for (i = 0; i < numDrums; i++) {
|
||||
reloc = (uintptr_t)((Drum**)ptrs[0])[i];
|
||||
//reloc = (Drum*)ptrs[0] + i;
|
||||
if (reloc != 0) {
|
||||
reloc = (uintptr_t)BASE_OFFSET(reloc);
|
||||
drum = (Drum*)reloc;
|
||||
//reloc = (uintptr_t)BASE_OFFSET(reloc);
|
||||
//drum = (Drum*)reloc;
|
||||
((Drum**)ptrs[0])[i] = drum = (Drum*)reloc;
|
||||
if (!drum->loaded) {
|
||||
AudioLoad_RelocateSample(&drum->sound, mem, relocInfo);
|
||||
reloc = (uintptr_t)drum->envelope;
|
||||
drum->envelope = (AdsrEnvelope*)BASE_OFFSET(reloc);
|
||||
drum->loaded = 1;
|
||||
}
|
||||
}
|
||||
|
@ -876,7 +885,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||
reloc2 = (uintptr_t)ptrs[1];
|
||||
|
||||
if ((reloc2 != 0) && (numSfx != 0)) {
|
||||
ptrs[1] = BASE_OFFSET(reloc2);
|
||||
//ptrs[1] = BASE_OFFSET(reloc2);
|
||||
for (i = 0; i < numSfx; i++) {
|
||||
reloc = (uintptr_t)((SoundFontSound*)ptrs[1] + i);
|
||||
if (reloc != 0) {
|
||||
|
@ -894,7 +903,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||
|
||||
for (i = 2; i <= 2 + numInstruments - 1; i++) {
|
||||
if (ptrs[i] != NULL) {
|
||||
ptrs[i] = BASE_OFFSET(ptrs[i]);
|
||||
//ptrs[i] = BASE_OFFSET(ptrs[i]);
|
||||
inst = (Instrument*)ptrs[i];
|
||||
if (!inst->loaded) {
|
||||
if (inst->normalRangeLo != 0) {
|
||||
|
@ -905,14 +914,14 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||
AudioLoad_RelocateSample(&inst->highNotesSound, mem, relocInfo);
|
||||
}
|
||||
|
||||
reloc = (uintptr_t)inst->envelope;
|
||||
inst->envelope = (AdsrEnvelope*)BASE_OFFSET(reloc);
|
||||
//reloc = (uintptr_t)inst->envelope;
|
||||
//inst->envelope = (AdsrEnvelope*)BASE_OFFSET(reloc);
|
||||
inst->loaded = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef BASE_OFFSET
|
||||
//#undef BASE_OFFSET
|
||||
|
||||
gAudioContext.soundFonts[fontId].drums = (Drum**)ptrs[0];
|
||||
gAudioContext.soundFonts[fontId].soundEffects = (SoundFontSound*)ptrs[1];
|
||||
|
@ -920,8 +929,6 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||
}
|
||||
|
||||
static void AudioLoad_SyncDma(Pointer devAddr, Pointer addr, size_t size, s32 medium) {
|
||||
OSMesgQueue* msgQueue = &gAudioContext.syncDmaQueue;
|
||||
OSIoMesg* ioMesg = &gAudioContext.syncDmaIoMesg;
|
||||
size = ALIGN16(size);
|
||||
|
||||
Audio_InvalDCache(addr.buffer(), size);
|
||||
|
@ -930,20 +937,19 @@ static void AudioLoad_SyncDma(Pointer devAddr, Pointer addr, size_t size, s32 me
|
|||
if (size < 0x400) {
|
||||
break;
|
||||
}
|
||||
AudioLoad_Dma(ioMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, addr, 0x400, msgQueue, medium, "FastCopy");
|
||||
osRecvMesg(msgQueue, NULL, OS_MESG_BLOCK);
|
||||
AudioLoad_Dma(nullptr, OS_MESG_PRI_HIGH, OS_READ, devAddr, addr, 0x400, nullptr, medium, "FastCopy");
|
||||
size -= 0x400;
|
||||
devAddr = devAddr + 0x400;
|
||||
addr = addr + 0x400;
|
||||
}
|
||||
|
||||
if (size != 0) {
|
||||
AudioLoad_Dma(ioMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, addr, size, msgQueue, medium, "FastCopy");
|
||||
osRecvMesg(msgQueue, NULL, OS_MESG_BLOCK);
|
||||
AudioLoad_Dma(nullptr, OS_MESG_PRI_HIGH, OS_READ, devAddr, addr, size, nullptr, medium, "FastCopy");
|
||||
}
|
||||
}
|
||||
|
||||
static void AudioLoad_SyncDmaUnkMedium(Pointer devAddr, Pointer addr, size_t size, s32 unkMediumParam) {
|
||||
memcpy(addr.buffer(), devAddr.buffer(), size);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -972,14 +978,7 @@ static s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, Pointer de
|
|||
size = ALIGN16(size);
|
||||
}
|
||||
|
||||
mesg->hdr.pri = priority;
|
||||
mesg->hdr.retQueue = reqQueue;
|
||||
mesg->dramAddr = (void*)ramAddr.get();
|
||||
mesg->devAddr = (void*)devAddr.get();
|
||||
mesg->size = size;
|
||||
memcpy((void*)ramAddr.get(), (void*)devAddr.get(), size);
|
||||
//handle->transferInfo.cmdType = 2;
|
||||
//sDmaHandler(handle, mesg, direction);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1163,12 +1162,6 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||
gAudioContext.currTask = NULL;
|
||||
gAudioContext.rspTask[0].task.t.data_size = 0;
|
||||
gAudioContext.rspTask[1].task.t.data_size = 0;
|
||||
osCreateMesgQueue(&gAudioContext.syncDmaQueue, &gAudioContext.syncDmaMesg, 1);
|
||||
osCreateMesgQueue(&gAudioContext.currAudioFrameDmaQueue, gAudioContext.currAudioFrameDmaMesgBuf, 0x40);
|
||||
osCreateMesgQueue(&gAudioContext.externalLoadQueue, gAudioContext.externalLoadMesgBuf,
|
||||
ARRAY_COUNT(gAudioContext.externalLoadMesgBuf));
|
||||
osCreateMesgQueue(&gAudioContext.preloadSampleQueue, gAudioContext.preloadSampleMesgBuf,
|
||||
ARRAY_COUNT(gAudioContext.externalLoadMesgBuf));
|
||||
gAudioContext.curAudioFrameDmaCount = 0;
|
||||
gAudioContext.sampleDmaCount = 0;
|
||||
//gAudioContext.cartHandle = osCartRomInit();
|
||||
|
@ -1203,7 +1196,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||
|
||||
AudioHeap_ResetStep();
|
||||
AudioLoad_InitTable(gAudioContext.sequenceTable, (void*)Audioseq, 0);
|
||||
AudioLoad_InitTable(gAudioContext.soundFontTable, (void*)Audiobank_le, 0);
|
||||
//AudioLoad_InitTable(gAudioContext.soundFontTable, (void*)Audiobank_le, 0);
|
||||
AudioLoad_InitTable(gAudioContext.sampleBankTable, (void*)Audiotable, 0);
|
||||
numFonts = gAudioContext.soundFontTable->numEntries;
|
||||
gAudioContext.soundFonts = (SoundFont*)AudioHeap_Alloc(&gAudioContext.audioInitPool, numFonts * sizeof(SoundFont));
|
||||
|
@ -1330,7 +1323,6 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) {
|
|||
switch (gAudioContext.slowLoads[i].status) {
|
||||
case LOAD_STATUS_LOADING:
|
||||
if (slowLoad->medium != MEDIUM_UNK) {
|
||||
osRecvMesg(&slowLoad->msgqueue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
if (resetStatus != 0) {
|
||||
|
@ -1370,9 +1362,8 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) {
|
|||
|
||||
void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, s32 size) {
|
||||
Audio_InvalDCache(slowLoad->curRamAddr, size);
|
||||
osCreateMesgQueue(&slowLoad->msgqueue, &slowLoad->msg, 1);
|
||||
AudioLoad_Dma(&slowLoad->ioMesg, OS_MESG_PRI_NORMAL, 0, slowLoad->curDevAddr, slowLoad->curRamAddr, size,
|
||||
&slowLoad->msgqueue, slowLoad->medium, "SLOWCOPY");
|
||||
nullptr, slowLoad->medium, "SLOWCOPY");
|
||||
}
|
||||
|
||||
static void AudioLoad_DmaSlowCopyUnkMedium(Pointer devAddr, Pointer ramAddr, size_t size, s32 arg3) {
|
||||
|
@ -1433,7 +1424,6 @@ AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, u32 devAdd
|
|||
return NULL;
|
||||
}
|
||||
|
||||
osSendMesg(&gAudioContext.asyncLoadUnkMediumQueue, asyncLoad, OS_MESG_NOBLOCK);
|
||||
asyncLoad->unkMediumParam = unkMediumParam;
|
||||
return asyncLoad;
|
||||
}
|
||||
|
@ -1489,13 +1479,7 @@ void AudioLoad_ProcessAsyncLoads(s32 resetStatus) {
|
|||
}
|
||||
|
||||
if (gAudioContext.curUnkMediumLoad == NULL) {
|
||||
if (resetStatus != 0) {
|
||||
// Clear and ignore queue if resetting.
|
||||
do {
|
||||
} while (osRecvMesg(&gAudioContext.asyncLoadUnkMediumQueue, (OSMesg*)&asyncLoad, OS_MESG_NOBLOCK) != -1);
|
||||
} else if (osRecvMesg(&gAudioContext.asyncLoadUnkMediumQueue, (OSMesg*)&asyncLoad, OS_MESG_NOBLOCK) == -1) {
|
||||
gAudioContext.curUnkMediumLoad = NULL;
|
||||
} else {
|
||||
if (resetStatus == 0) {
|
||||
gAudioContext.curUnkMediumLoad = asyncLoad;
|
||||
}
|
||||
}
|
||||
|
@ -1566,13 +1550,8 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) {
|
|||
if (asyncLoad->delay == 1) {
|
||||
asyncLoad->delay = 0;
|
||||
} else if (resetStatus != 0) {
|
||||
// Await the previous DMA response synchronously, then return.
|
||||
osRecvMesg(&asyncLoad->msgQueue, NULL, OS_MESG_BLOCK);
|
||||
asyncLoad->status = LOAD_STATUS_WAITING;
|
||||
return;
|
||||
} else if (osRecvMesg(&asyncLoad->msgQueue, NULL, OS_MESG_NOBLOCK) == -1) {
|
||||
// If the previous DMA step isn't done, return.
|
||||
return;
|
||||
}
|
||||
|
||||
if (asyncLoad->bytesRemaining == 0) {
|
||||
|
@ -1622,15 +1601,16 @@ void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, RelocIn
|
|||
SoundFontSample* sample;
|
||||
void* reloc;
|
||||
|
||||
if (BEE32((u32)sound->sample) <= 0x80000000) {
|
||||
sample = sound->sample = (SoundFontSample*)RELOC(sound->sample, mem);
|
||||
//if (BEE32((u32)sound->sample) <= 0x80000000)
|
||||
{
|
||||
sample = sound->sample; // = (SoundFontSample*)RELOC(sound->sample, mem);
|
||||
if (sample->size != 0 && sample->unk_bit25 != 1) {
|
||||
sample->loop = (AdpcmLoop*)RELOC(sample->loop, mem);
|
||||
sample->book = (AdpcmBook*)RELOC(sample->book, mem);
|
||||
//sample->loop = (AdpcmLoop*)RELOC(sample->loop, mem);
|
||||
//sample->book = (AdpcmBook*)RELOC(sample->book, mem);
|
||||
|
||||
// Resolve the sample medium 2-bit bitfield into a real value based on relocInfo.
|
||||
switch (BEE32(sample->medium)) {
|
||||
case 0:
|
||||
case 0: // read from baserom/Audiotable
|
||||
sample->sampleAddr = (u8*)RELOC(sample->sampleAddr, relocInfo->baseAddr1);
|
||||
sample->medium = relocInfo->medium1;
|
||||
break;
|
||||
|
@ -1642,12 +1622,16 @@ void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, RelocIn
|
|||
case 3:
|
||||
// Invalid? This leaves sample->medium as MEDIUM_CART and MEDIUM_DISK_DRIVE
|
||||
// respectively, and the sampleAddr unrelocated.
|
||||
sample->sampleAddr = sample->sampleAddr;
|
||||
break;
|
||||
}
|
||||
|
||||
sample->unk_bit25 = 1;
|
||||
if (sample->unk_bit26 && (sample->medium != MEDIUM_RAM)) {
|
||||
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
|
||||
if(gAudioContext.numUsedSamples < ARRAY_COUNT(gAudioContext.usedSamples))
|
||||
{
|
||||
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1681,7 +1665,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Rel
|
|||
}
|
||||
|
||||
for (i = 0; i < gAudioContext.numUsedSamples; i++) {
|
||||
if (gAudioContext.preloadSampleStackTop == 120) {
|
||||
if (gAudioContext.preloadSampleStackTop == ARRAY_COUNT(gAudioContext.usedSamples) - 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1751,7 +1735,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Rel
|
|||
sample = topPreload->sample;
|
||||
nChunks = (sample->size >> 12) + 1;
|
||||
AudioLoad_StartAsyncLoad((u32)sample->sampleAddr, topPreload->ramAddr, sample->size, sample->medium, nChunks,
|
||||
&gAudioContext.preloadSampleQueue, topPreload->encodedInfo);
|
||||
nullptr, topPreload->encodedInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1765,15 +1749,9 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
|
|||
|
||||
if (gAudioContext.preloadSampleStackTop > 0) {
|
||||
if (resetStatus != 0) {
|
||||
// Clear result queue and preload stack and return.
|
||||
osRecvMesg(&gAudioContext.preloadSampleQueue, (OSMesg*)&preloadIndex, OS_MESG_NOBLOCK);
|
||||
gAudioContext.preloadSampleStackTop = 0;
|
||||
return 0;
|
||||
}
|
||||
if (osRecvMesg(&gAudioContext.preloadSampleQueue, (OSMesg*)&preloadIndex, OS_MESG_NOBLOCK) == -1) {
|
||||
// Previous preload is not done yet.
|
||||
return 0;
|
||||
}
|
||||
|
||||
preloadIndex >>= 24;
|
||||
preload = &gAudioContext.preloadSampleStack[preloadIndex];
|
||||
|
@ -1809,7 +1787,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
|
|||
gAudioContext.preloadSampleStackTop--;
|
||||
} else {
|
||||
AudioLoad_StartAsyncLoad((u32)sample->sampleAddr, preload->ramAddr, sample->size, sample->medium,
|
||||
nChunks, &gAudioContext.preloadSampleQueue, preload->encodedInfo);
|
||||
nChunks, nullptr, preload->encodedInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1872,7 +1850,10 @@ void AudioLoad_AddUsedSample(SoundFontSound* sound) {
|
|||
SoundFontSample* sample = sound->sample;
|
||||
|
||||
if ((sample->size != 0) && (sample->unk_bit26) && (sample->medium != MEDIUM_RAM)) {
|
||||
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
|
||||
if(gAudioContext.numUsedSamples < ARRAY_COUNT(gAudioContext.usedSamples))
|
||||
{
|
||||
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1941,7 +1922,7 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo
|
|||
if (size) {}
|
||||
|
||||
for (i = 0; i < gAudioContext.numUsedSamples; i++) {
|
||||
if (gAudioContext.preloadSampleStackTop == 120) {
|
||||
if (gAudioContext.preloadSampleStackTop == ARRAY_COUNT(gAudioContext.usedSamples) - 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2007,7 +1988,7 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo
|
|||
sample = topPreload->sample;
|
||||
nChunks = (sample->size >> 12) + 1;
|
||||
AudioLoad_StartAsyncLoad((u32)sample->sampleAddr, topPreload->ramAddr, sample->size, sample->medium, nChunks,
|
||||
&gAudioContext.preloadSampleQueue, topPreload->encodedInfo);
|
||||
nullptr, topPreload->encodedInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2062,16 +2043,16 @@ void AudioLoad_ScriptLoad(s32 tableType, s32 id, s8* isDone) {
|
|||
|
||||
void AudioLoad_ProcessScriptLoads(void) {
|
||||
u32 temp = 0;
|
||||
u32 sp20 = 0; // TODO FIX
|
||||
u32 sp20;
|
||||
s8* isDone;
|
||||
|
||||
//if (osRecvMesg(&sScriptLoadQueue, (OSMesg*)&sp20, OS_MESG_NOBLOCK) != -1) { TODO FIX HACK
|
||||
if (osRecvMesg(&sScriptLoadQueue, (OSMesg*)&sp20, OS_MESG_NOBLOCK) != -1) {
|
||||
temp = sp20 >> 24;
|
||||
isDone = sScriptLoadDonePointers[temp];
|
||||
if (isDone != NULL) {
|
||||
*isDone = 0;
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
void AudioLoad_InitScriptLoads(void) {
|
||||
|
|
|
@ -178,10 +178,6 @@ void Audio_ProcessNotes(void) {
|
|||
noteSubEu2 = &gAudioContext.noteSubsEu[gAudioContext.noteSubEuOffset + i];
|
||||
playbackState = ¬e->playbackState;
|
||||
if (playbackState->parentLayer != NO_LAYER) {
|
||||
if ((uintptr_t)playbackState->parentLayer < 0x7FFFFFFF) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note != playbackState->parentLayer->note && playbackState->unk_04 == 0) {
|
||||
playbackState->adsr.action.s.release = true;
|
||||
playbackState->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
|
@ -214,7 +210,7 @@ void Audio_ProcessNotes(void) {
|
|||
|
||||
out:
|
||||
if (playbackState->priority != 0) {
|
||||
if (1) {}
|
||||
|
||||
noteSubEu = ¬e->noteSubEu;
|
||||
if (playbackState->unk_04 >= 1 || noteSubEu->bitField0.finished) {
|
||||
if (playbackState->adsr.action.s.state == ADSR_STATE_DISABLED || noteSubEu->bitField0.finished) {
|
||||
|
@ -358,9 +354,7 @@ Drum* Audio_GetDrum(s32 fontId, s32 drumId) {
|
|||
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
|
||||
return NULL;
|
||||
}
|
||||
if ((uintptr_t)gAudioContext.soundFonts[fontId].drums < 0x80000000) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
drum = gAudioContext.soundFonts[fontId].drums[drumId];
|
||||
|
||||
if (drum == NULL) {
|
||||
|
@ -387,10 +381,6 @@ SoundFontSound* Audio_GetSfx(s32 fontId, s32 sfxId) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if ((uintptr_t)gAudioContext.soundFonts[fontId].soundEffects < 0x80000000) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sfx = &gAudioContext.soundFonts[fontId].soundEffects[sfxId];
|
||||
|
||||
if (sfx == NULL) {
|
||||
|
|
|
@ -17,350 +17,32 @@
|
|||
#include "def/audio_bank.h"
|
||||
#include "def/createmesgqueue.h"
|
||||
#include "def/recvmesg.h"
|
||||
#include "AziAudio/AziAudio/AudioSpec.h"
|
||||
|
||||
#include "redef_msgqueue.h"
|
||||
|
||||
static const int16_t RESAMPLE_LUT[64 * 4] = {
|
||||
(int16_t)0x0c39, (int16_t)0x66ad, (int16_t)0x0d46, (int16_t)0xffdf, (int16_t)0x0b39, (int16_t)0x6696, (int16_t)0x0e5f, (int16_t)0xffd8, (int16_t)0x0a44, (int16_t)0x6669, (int16_t)0x0f83, (int16_t)0xffd0, (int16_t)0x095a, (int16_t)0x6626,
|
||||
(int16_t)0x10b4, (int16_t)0xffc8, (int16_t)0x087d, (int16_t)0x65cd, (int16_t)0x11f0, (int16_t)0xffbf, (int16_t)0x07ab, (int16_t)0x655e, (int16_t)0x1338, (int16_t)0xffb6, (int16_t)0x06e4, (int16_t)0x64d9, (int16_t)0x148c, (int16_t)0xffac,
|
||||
(int16_t)0x0628, (int16_t)0x643f, (int16_t)0x15eb, (int16_t)0xffa1, (int16_t)0x0577, (int16_t)0x638f, (int16_t)0x1756, (int16_t)0xff96, (int16_t)0x04d1, (int16_t)0x62cb, (int16_t)0x18cb, (int16_t)0xff8a, (int16_t)0x0435, (int16_t)0x61f3,
|
||||
(int16_t)0x1a4c, (int16_t)0xff7e, (int16_t)0x03a4, (int16_t)0x6106, (int16_t)0x1bd7, (int16_t)0xff71, (int16_t)0x031c, (int16_t)0x6007, (int16_t)0x1d6c, (int16_t)0xff64, (int16_t)0x029f, (int16_t)0x5ef5, (int16_t)0x1f0b, (int16_t)0xff56,
|
||||
(int16_t)0x022a, (int16_t)0x5dd0, (int16_t)0x20b3, (int16_t)0xff48, (int16_t)0x01be, (int16_t)0x5c9a, (int16_t)0x2264, (int16_t)0xff3a, (int16_t)0x015b, (int16_t)0x5b53, (int16_t)0x241e, (int16_t)0xff2c, (int16_t)0x0101, (int16_t)0x59fc,
|
||||
(int16_t)0x25e0, (int16_t)0xff1e, (int16_t)0x00ae, (int16_t)0x5896, (int16_t)0x27a9, (int16_t)0xff10, (int16_t)0x0063, (int16_t)0x5720, (int16_t)0x297a, (int16_t)0xff02, (int16_t)0x001f, (int16_t)0x559d, (int16_t)0x2b50, (int16_t)0xfef4,
|
||||
(int16_t)0xffe2, (int16_t)0x540d, (int16_t)0x2d2c, (int16_t)0xfee8, (int16_t)0xffac, (int16_t)0x5270, (int16_t)0x2f0d, (int16_t)0xfedb, (int16_t)0xff7c, (int16_t)0x50c7, (int16_t)0x30f3, (int16_t)0xfed0, (int16_t)0xff53, (int16_t)0x4f14,
|
||||
(int16_t)0x32dc, (int16_t)0xfec6, (int16_t)0xff2e, (int16_t)0x4d57, (int16_t)0x34c8, (int16_t)0xfebd, (int16_t)0xff0f, (int16_t)0x4b91, (int16_t)0x36b6, (int16_t)0xfeb6, (int16_t)0xfef5, (int16_t)0x49c2, (int16_t)0x38a5, (int16_t)0xfeb0,
|
||||
(int16_t)0xfedf, (int16_t)0x47ed, (int16_t)0x3a95, (int16_t)0xfeac, (int16_t)0xfece, (int16_t)0x4611, (int16_t)0x3c85, (int16_t)0xfeab, (int16_t)0xfec0, (int16_t)0x4430, (int16_t)0x3e74, (int16_t)0xfeac, (int16_t)0xfeb6, (int16_t)0x424a,
|
||||
(int16_t)0x4060, (int16_t)0xfeaf, (int16_t)0xfeaf, (int16_t)0x4060, (int16_t)0x424a, (int16_t)0xfeb6, (int16_t)0xfeac, (int16_t)0x3e74, (int16_t)0x4430, (int16_t)0xfec0, (int16_t)0xfeab, (int16_t)0x3c85, (int16_t)0x4611, (int16_t)0xfece,
|
||||
(int16_t)0xfeac, (int16_t)0x3a95, (int16_t)0x47ed, (int16_t)0xfedf, (int16_t)0xfeb0, (int16_t)0x38a5, (int16_t)0x49c2, (int16_t)0xfef5, (int16_t)0xfeb6, (int16_t)0x36b6, (int16_t)0x4b91, (int16_t)0xff0f, (int16_t)0xfebd, (int16_t)0x34c8,
|
||||
(int16_t)0x4d57, (int16_t)0xff2e, (int16_t)0xfec6, (int16_t)0x32dc, (int16_t)0x4f14, (int16_t)0xff53, (int16_t)0xfed0, (int16_t)0x30f3, (int16_t)0x50c7, (int16_t)0xff7c, (int16_t)0xfedb, (int16_t)0x2f0d, (int16_t)0x5270, (int16_t)0xffac,
|
||||
(int16_t)0xfee8, (int16_t)0x2d2c, (int16_t)0x540d, (int16_t)0xffe2, (int16_t)0xfef4, (int16_t)0x2b50, (int16_t)0x559d, (int16_t)0x001f, (int16_t)0xff02, (int16_t)0x297a, (int16_t)0x5720, (int16_t)0x0063, (int16_t)0xff10, (int16_t)0x27a9,
|
||||
(int16_t)0x5896, (int16_t)0x00ae, (int16_t)0xff1e, (int16_t)0x25e0, (int16_t)0x59fc, (int16_t)0x0101, (int16_t)0xff2c, (int16_t)0x241e, (int16_t)0x5b53, (int16_t)0x015b, (int16_t)0xff3a, (int16_t)0x2264, (int16_t)0x5c9a, (int16_t)0x01be,
|
||||
(int16_t)0xff48, (int16_t)0x20b3, (int16_t)0x5dd0, (int16_t)0x022a, (int16_t)0xff56, (int16_t)0x1f0b, (int16_t)0x5ef5, (int16_t)0x029f, (int16_t)0xff64, (int16_t)0x1d6c, (int16_t)0x6007, (int16_t)0x031c, (int16_t)0xff71, (int16_t)0x1bd7,
|
||||
(int16_t)0x6106, (int16_t)0x03a4, (int16_t)0xff7e, (int16_t)0x1a4c, (int16_t)0x61f3, (int16_t)0x0435, (int16_t)0xff8a, (int16_t)0x18cb, (int16_t)0x62cb, (int16_t)0x04d1, (int16_t)0xff96, (int16_t)0x1756, (int16_t)0x638f, (int16_t)0x0577,
|
||||
(int16_t)0xffa1, (int16_t)0x15eb, (int16_t)0x643f, (int16_t)0x0628, (int16_t)0xffac, (int16_t)0x148c, (int16_t)0x64d9, (int16_t)0x06e4, (int16_t)0xffb6, (int16_t)0x1338, (int16_t)0x655e, (int16_t)0x07ab, (int16_t)0xffbf, (int16_t)0x11f0,
|
||||
(int16_t)0x65cd, (int16_t)0x087d, (int16_t)0xffc8, (int16_t)0x10b4, (int16_t)0x6626, (int16_t)0x095a, (int16_t)0xffd0, (int16_t)0x0f83, (int16_t)0x6669, (int16_t)0x0a44, (int16_t)0xffd8, (int16_t)0x0e5f, (int16_t)0x6696, (int16_t)0x0b39,
|
||||
(int16_t)0xffdf, (int16_t)0x0d46, (int16_t)0x66ad, (int16_t)0x0c39};
|
||||
|
||||
u32 osGetCount(void);
|
||||
|
||||
#define SAMPLES_TO_OVERPRODUCE 0x10
|
||||
#define EXTRA_BUFFERED_AI_SAMPLES_TARGET 0x80
|
||||
|
||||
typedef enum {
|
||||
CHAN_UPD_UNK_0, // 0
|
||||
CHAN_UPD_VOL_SCALE, // 1
|
||||
CHAN_UPD_VOL, // 2
|
||||
CHAN_UPD_PAN_SIGNED, // 3
|
||||
CHAN_UPD_FREQ_SCALE, // 4
|
||||
CHAN_UPD_REVERB, // 5
|
||||
CHAN_UPD_SCRIPT_IO, // 6
|
||||
CHAN_UPD_PAN_UNSIGNED, // 7
|
||||
CHAN_UPD_STOP_SOMETHING2, // 8
|
||||
CHAN_UPD_MUTE_BEHAVE, // 9
|
||||
CHAN_UPD_VIBE_X8, // 10
|
||||
CHAN_UPD_VIBE_X32, // 11
|
||||
CHAN_UPD_UNK_0F, // 12
|
||||
CHAN_UPD_UNK_20, // 13
|
||||
CHAN_UPD_STEREO // 14
|
||||
} ChannelUpdateType;
|
||||
|
||||
void func_800E6300(SequenceChannel* channel, AudioCmd* arg1);
|
||||
void func_800E59AC(s32 playerIdx, s32 fadeTimer);
|
||||
void Audio_ProcessChannelCmd(SequenceChannel* channel, AudioCmd* arg1);
|
||||
void Audio_LoadSetFadeInTimer(s32 playerIdx, s32 fadeTimer);
|
||||
void Audio_InitMesgQueues(void);
|
||||
AudioTask* func_800E5000(void);
|
||||
AudioTask* getAudioTask(void);
|
||||
void Audio_ProcessCmds(u32);
|
||||
void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* arg1);
|
||||
void func_800E5958(s32 playerIdx, s32 fadeTimer);
|
||||
void Audio_ProcessSequenceCmd(SequencePlayer* seqPlayer, AudioCmd* arg1);
|
||||
void Audio_LoadSetFadeOutTimer(s32 playerIdx, s32 fadeTimer);
|
||||
s32 func_800E66C0(s32 arg0);
|
||||
|
||||
// AudioMgr_Retrace
|
||||
AudioTask* func_800E4FE0(void) {
|
||||
return func_800E5000();
|
||||
return getAudioTask();
|
||||
}
|
||||
|
||||
extern u64 rspAspMainDataStart[0x5C];
|
||||
extern u32 rspAspMainDataStart[0x5C * 2];
|
||||
|
||||
static inline int16_t clamp_s16(int32_t v)
|
||||
{
|
||||
return v < -32768 ? -32768 : v > 32767 ? 32767 : v;
|
||||
}
|
||||
|
||||
static inline int16_t sample_mix(int16_t dst, int16_t src, int16_t gain)
|
||||
{
|
||||
int32_t src_modified = (src * gain) >> 15;
|
||||
return clamp_s16(dst + src_modified);
|
||||
}
|
||||
|
||||
static const u32 MAX_MEMORY_SIZE = 0xFFFF;
|
||||
static u8 m_memory[MAX_MEMORY_SIZE];
|
||||
|
||||
class AudioRsp
|
||||
{
|
||||
typedef void (AudioRsp::*AbiHandler)(const Acmd& cmds);
|
||||
public:
|
||||
|
||||
constexpr AudioRsp()
|
||||
{
|
||||
}
|
||||
|
||||
void execute(Acmd* cmds, size_t len)
|
||||
{
|
||||
for(size_t i = 0; i < len; i++)
|
||||
{
|
||||
const auto& cmd = cmds[i];
|
||||
u8 op = _SHIFTR(cmd.words.w0, 24, 8);
|
||||
|
||||
if(op >= sizeof(m_abiHandlers))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
(*this.*m_abiHandlers[op])(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void cmd_SPNOOP(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_ADPCM(const Acmd& cmd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_CLEARBUFF(const Acmd& cmd)
|
||||
{
|
||||
DMem addr = _SHIFTR(cmd.words.w0, 0, 16);
|
||||
u16 count = _SHIFTR(cmd.words.w1, 0, 16);
|
||||
|
||||
memset(addr, 0, count);
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_UNK3(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_ADDMIXER(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_RESAMPLE(const Acmd& cmd)
|
||||
{
|
||||
u8 flags = _SHIFTR(cmd.words.w0, 16, 8);
|
||||
uintptr_t s = cmd.words.w1;
|
||||
u16 p = _SHIFTR(cmd.words.w0, 0, 16);
|
||||
/*_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) | _SHIFTL(p, 0, 16));
|
||||
_a->words.w1 = (uintptr_t)(s);
|
||||
|
||||
int16_t* dst = (int16_t*)(alist_buffer + alist_audio.out);
|
||||
int16_t* src = (int16_t*)(alist_buffer + alist_audio.in);
|
||||
size_t count = alist_audio.count >> 1;
|
||||
uint32_t pitch_accumulator = 0;
|
||||
|
||||
count = align(count, 8);
|
||||
|
||||
src -= 4;
|
||||
|
||||
if(flags & A_INIT)
|
||||
{
|
||||
memset(src, 0, 4 * sizeof(int16_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(src, state_addr, 4 * sizeof(int16_t));
|
||||
pitch_accumulator = state_addr[4];
|
||||
}
|
||||
|
||||
while(count != 0)
|
||||
{
|
||||
const int16_t* lut = RESAMPLE_LUT + ((pitch_accumulator & 0xfc00) >> 8);
|
||||
|
||||
*dst++ = clamp_s16((src[0] * lut[0] + src[1] * lut[1] + src[2] * lut[2] + src[3] * lut[3]) >> 15);
|
||||
pitch_accumulator += (pitch << 1);
|
||||
src += pitch_accumulator >> 16;
|
||||
pitch_accumulator &= 0xffff;
|
||||
--count;
|
||||
}
|
||||
|
||||
memcpy(state_addr, src, 4 * sizeof(int16_t));
|
||||
state_addr[4] = pitch_accumulator;*/
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_RESAMPLE_ZOH(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_FILTER(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_SETBUFF(const Acmd& cmd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_DUPLICATE(const Acmd& cmd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_DMEMMOVE(const Acmd& cmd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_LOADADPCM(const Acmd& cmd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_MIXER(const Acmd& cmd)
|
||||
{
|
||||
u16 count = _SHIFTR(cmd.words.w0, 16, 8);
|
||||
s16 gain = _SHIFTR(cmd.words.w0, 0, 16);
|
||||
DMem _src = _SHIFTR(cmd.words.w1, 16, 16);
|
||||
DMem _dest = _SHIFTR(cmd.words.w1, 0, 16);
|
||||
|
||||
|
||||
int16_t* dst = (int16_t*)_dest.buffer();
|
||||
const int16_t* src = (const int16_t*)_src.buffer();
|
||||
|
||||
while(count != 0)
|
||||
{
|
||||
*dst = sample_mix(*dst, *src, gain);
|
||||
++dst;
|
||||
++src;
|
||||
--count;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_INTERLEAVE(const Acmd& cmd)
|
||||
{
|
||||
u16 count = _SHIFTR(cmd.words.w0, 16, 8) << 4;
|
||||
DMem dest = _SHIFTR(cmd.words.w0, 0, 16);
|
||||
DMem L = _SHIFTR(cmd.words.w1, 16, 16);
|
||||
DMem R = _SHIFTR(cmd.words.w1, 0, 16);
|
||||
|
||||
int16_t* dst = (int16_t*)dest.buffer();
|
||||
int16_t* srcL = (int16_t*)L.buffer();
|
||||
int16_t* srcR = (int16_t*)R.buffer();
|
||||
|
||||
// Unroll a bit
|
||||
while(count != 0)
|
||||
{
|
||||
int16_t l1 = *srcL++;
|
||||
int16_t l2 = *srcL++;
|
||||
int16_t r1 = *srcR++;
|
||||
int16_t r2 = *srcR++;
|
||||
|
||||
*dst++ = l1;
|
||||
*dst++ = r1;
|
||||
*dst++ = l2;
|
||||
*dst++ = r2;
|
||||
|
||||
--count;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_HILOGAIN(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_SETLOOP(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_UNK16(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_INTERL(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_ENVSETUP1(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_ENVMIXER(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_LOADBUFF(const Acmd& cmd)
|
||||
{
|
||||
auto addr = (void*)cmd.words.w1;
|
||||
size_t len = _SHIFTR(cmd.words.w0, 16, 8) << 4;
|
||||
DMem arg2 = _SHIFTR(cmd.words.w0, 0, 16);
|
||||
memcpy(addr, arg2, len);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_SAVEBUFF(const Acmd& cmd)
|
||||
{
|
||||
size_t len = _SHIFTR(cmd.words.w0, 16, 8) << 4;
|
||||
auto addr = (void*)cmd.words.w1;
|
||||
DMem arg2 = _SHIFTR(cmd.words.w0, 0, 16);
|
||||
memcpy(arg2, addr, len);
|
||||
return;
|
||||
}
|
||||
|
||||
void cmd_ENVSETUP2(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void cmd_UNK17(const Acmd& cmd)
|
||||
{
|
||||
}
|
||||
|
||||
AbiHandler m_abiHandlers[24] = {&AudioRsp::cmd_SPNOOP, &AudioRsp::cmd_ADPCM, &AudioRsp::cmd_CLEARBUFF, &AudioRsp::cmd_UNK3, &AudioRsp::cmd_ADDMIXER, &AudioRsp::cmd_RESAMPLE,
|
||||
&AudioRsp::cmd_RESAMPLE_ZOH, &AudioRsp::cmd_FILTER, &AudioRsp::cmd_SETBUFF, &AudioRsp::cmd_DUPLICATE, &AudioRsp::cmd_DMEMMOVE, &AudioRsp::cmd_LOADADPCM, &AudioRsp::cmd_MIXER,
|
||||
&AudioRsp::cmd_INTERLEAVE, &AudioRsp::cmd_HILOGAIN, &AudioRsp::cmd_SETLOOP, &AudioRsp::cmd_UNK16, &AudioRsp::cmd_INTERL, &AudioRsp::cmd_ENVSETUP1, &AudioRsp::cmd_ENVMIXER,
|
||||
&AudioRsp::cmd_LOADBUFF, &AudioRsp::cmd_SAVEBUFF, &AudioRsp::cmd_ENVSETUP2, &AudioRsp::cmd_UNK17};
|
||||
|
||||
|
||||
class DMem
|
||||
{
|
||||
public:
|
||||
DMem(u16 addr)
|
||||
{
|
||||
m_address = (uintptr_t)m_memory + addr;
|
||||
}
|
||||
|
||||
void* buffer()
|
||||
{
|
||||
return (void*)m_address;
|
||||
}
|
||||
|
||||
operator uintptr_t()
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
|
||||
operator u8*()
|
||||
{
|
||||
return (u8*)m_address;
|
||||
}
|
||||
|
||||
/*operator int16_t*()
|
||||
{
|
||||
return (int16_t*)m_address;
|
||||
}*/
|
||||
|
||||
protected:
|
||||
uintptr_t m_address;
|
||||
};
|
||||
};
|
||||
|
||||
static AudioRsp rsp;
|
||||
|
||||
AudioTask* func_800E5000(void) {
|
||||
AudioTask* getAudioTask() {
|
||||
static s32 sMaxAbiCmdCnt = 0x80;
|
||||
static AudioTask* sWaitingAudioTask = NULL;
|
||||
u32 samplesRemainingInAi;
|
||||
|
@ -399,8 +81,6 @@ AudioTask* func_800E5000(void) {
|
|||
if (gAudioContext.resetTimer < 16) {
|
||||
if (gAudioContext.aiBufLengths[index] != 0) {
|
||||
osAiSetNextBuffer(gAudioContext.aiBuffers[index], gAudioContext.aiBufLengths[index] * 4);
|
||||
if (gAudioContext.aiBuffers[index]) {}
|
||||
if (gAudioContext.aiBufLengths[index]) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -408,26 +88,6 @@ AudioTask* func_800E5000(void) {
|
|||
D_801755D0();
|
||||
}
|
||||
|
||||
sp5C = gAudioContext.curAudioFrameDmaCount;
|
||||
for (i = 0; i < gAudioContext.curAudioFrameDmaCount; i++) {
|
||||
if (osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
sp5C--;
|
||||
}
|
||||
}
|
||||
|
||||
if (sp5C != 0) {
|
||||
for (i = 0; i < sp5C; i++) {
|
||||
osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
sp48 = gAudioContext.currAudioFrameDmaQueue.validCount;
|
||||
if (sp48 != 0) {
|
||||
for (i = 0; i < sp48; i++) {
|
||||
osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
gAudioContext.curAudioFrameDmaCount = 0;
|
||||
AudioLoad_DecreaseSampleDmaTtls();
|
||||
AudioLoad_ProcessLoads(gAudioContext.resetStatus);
|
||||
|
@ -500,7 +160,7 @@ AudioTask* func_800E5000(void) {
|
|||
task->ucode_boot_size = 0x1000;
|
||||
task->ucode_data_size = (sizeof(rspAspMainDataStart) * sizeof(u64)) - 1;
|
||||
task->ucode = D_801120C0;
|
||||
task->ucode_data = rspAspMainDataStart;
|
||||
task->ucode_data = (u64*)rspAspMainDataStart;
|
||||
task->ucode_size = 0x1000;
|
||||
task->dram_stack = NULL;
|
||||
task->dram_stack_size = 0;
|
||||
|
@ -512,7 +172,7 @@ AudioTask* func_800E5000(void) {
|
|||
task->yield_data_ptr = NULL;
|
||||
task->yield_data_size = 0;
|
||||
|
||||
rsp.execute(gAudioContext.abiCmdBufs[index], abiCmdCnt);
|
||||
//HLEStart((AZI_OSTask*)task);
|
||||
|
||||
if (sMaxAbiCmdCnt < abiCmdCnt) {
|
||||
sMaxAbiCmdCnt = abiCmdCnt;
|
||||
|
@ -529,7 +189,7 @@ AudioTask* func_800E5000(void) {
|
|||
#define ACMD_SND_MDE ((u32)0xF0000000)
|
||||
#define ACMD_MUTE ((u32)0xF1000000)
|
||||
|
||||
void func_800E5584(AudioCmd* cmd) {
|
||||
void Audio_ProcessLoadCmd(AudioCmd* cmd) {
|
||||
s32 i;
|
||||
s32 pad;
|
||||
s32 pad2;
|
||||
|
@ -537,36 +197,36 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
u32 temp_t7;
|
||||
|
||||
switch (cmd->op) {
|
||||
case 0x81:
|
||||
case CHAN_LOAD_UKN_81:
|
||||
AudioLoad_SyncLoadSeqParts(cmd->arg1, cmd->arg2);
|
||||
return;
|
||||
case 0x82:
|
||||
case CHAN_LOAD_UKN_82:
|
||||
AudioLoad_SyncInitSeqPlayer(cmd->arg0, cmd->arg1, cmd->arg2);
|
||||
func_800E59AC(cmd->arg0, (s32)cmd->data);
|
||||
Audio_LoadSetFadeInTimer(cmd->arg0, (s32)cmd->data);
|
||||
return;
|
||||
case 0x85:
|
||||
case CHAN_LOAD_UKN_85:
|
||||
AudioLoad_SyncInitSeqPlayerSkipTicks(cmd->arg0, cmd->arg1, (s32)cmd->data);
|
||||
return;
|
||||
case 0x83:
|
||||
case CHAN_LOAD_DISABLE_SEQUENCE:
|
||||
if (gAudioContext.seqPlayers[cmd->arg0].enabled) {
|
||||
if (cmd->asInt == 0) {
|
||||
AudioSeq_SequencePlayerDisableAsFinished(&gAudioContext.seqPlayers[cmd->arg0]);
|
||||
} else {
|
||||
func_800E5958(cmd->arg0, cmd->asInt);
|
||||
Audio_LoadSetFadeOutTimer(cmd->arg0, cmd->asInt);
|
||||
}
|
||||
}
|
||||
return;
|
||||
case 0xF0:
|
||||
case CHAN_LOAD_SET_SOUND_MODE:
|
||||
gAudioContext.soundMode = cmd->asUInt;
|
||||
return;
|
||||
case 0xF1:
|
||||
case CHAN_LOAD_UKN_F1:
|
||||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i];
|
||||
seqPlayer->muted = 1;
|
||||
seqPlayer->recalculateVolume = 1;
|
||||
}
|
||||
return;
|
||||
case 0xF2:
|
||||
case CHAN_LOAD_UKN_F2:
|
||||
if (cmd->asUInt == 1) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
Note* note = &gAudioContext.notes[i];
|
||||
|
@ -586,37 +246,37 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
}
|
||||
|
||||
return;
|
||||
case 0xF3:
|
||||
case CHAN_LOAD_INSTRUMENT_ASYNC:
|
||||
AudioLoad_SyncLoadInstrument(cmd->arg0, cmd->arg1, cmd->arg2);
|
||||
return;
|
||||
case 0xF4:
|
||||
AudioLoad_AsyncLoadSampleBank(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
|
||||
case CHAN_LOAD_BANK_ASYNC:
|
||||
AudioLoad_AsyncLoadSampleBank(cmd->arg0, cmd->arg1, cmd->arg2, nullptr);
|
||||
return;
|
||||
case 0xF5:
|
||||
AudioLoad_AsyncLoadFont(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
|
||||
case CHAN_LOAD_FONT_ASYNC:
|
||||
AudioLoad_AsyncLoadFont(cmd->arg0, cmd->arg1, cmd->arg2, nullptr);
|
||||
return;
|
||||
case 0xFC:
|
||||
AudioLoad_AsyncLoadSeq(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
|
||||
case CHAN_LOAD_UKN_FC:
|
||||
AudioLoad_AsyncLoadSeq(cmd->arg0, cmd->arg1, cmd->arg2, nullptr);
|
||||
return;
|
||||
case 0xF6:
|
||||
case CHAN_LOAD_DISCARD_SEQ_FONTS:
|
||||
AudioLoad_DiscardSeqFonts(cmd->arg1);
|
||||
return;
|
||||
case 0x90:
|
||||
case CHAN_LOAD_UKN_90:
|
||||
gAudioContext.unk_5BDC[cmd->arg0] = cmd->asUShort;
|
||||
return;
|
||||
case 0xF9:
|
||||
case CHAN_LOAD_RESET_LOAD_SPECID:
|
||||
gAudioContext.resetStatus = 5;
|
||||
gAudioContext.audioResetSpecIdToLoad = cmd->asUInt;
|
||||
return;
|
||||
case 0xFB:
|
||||
case CHAN_LOAD_UKN_FB_CALLBACK:
|
||||
D_801755D0 = (void (*)(void))cmd->asUInt;
|
||||
return;
|
||||
case 0xE0:
|
||||
case 0xE1:
|
||||
case 0xE2:
|
||||
case CHAN_LOAD_SET_FONT_INSTRUMENT0:
|
||||
case CHAN_LOAD_SET_FONT_INSTRUMENT1:
|
||||
case CHAN_LOAD_SET_FONT_INSTRUMENT:
|
||||
Audio_SetFontInstrument(cmd->op - 0xE0, cmd->arg0, cmd->arg1, cmd->data);
|
||||
return;
|
||||
case 0xFE:
|
||||
case CHAN_LOAD_UKN_FE:
|
||||
temp_t7 = cmd->asUInt;
|
||||
if (temp_t7 == 1) {
|
||||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
|
@ -628,7 +288,7 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
}
|
||||
func_800E66C0(temp_t7);
|
||||
return;
|
||||
case 0xE3:
|
||||
case CHAN_LOAD_POP_CACHE:
|
||||
AudioHeap_PopCache(cmd->asInt);
|
||||
return;
|
||||
default:
|
||||
|
@ -637,7 +297,7 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
}
|
||||
|
||||
// SetFadeOutTimer
|
||||
void func_800E5958(s32 playerIdx, s32 fadeTimer) {
|
||||
void Audio_LoadSetFadeOutTimer(s32 playerIdx, s32 fadeTimer) {
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx];
|
||||
|
||||
if (fadeTimer == 0) {
|
||||
|
@ -650,7 +310,7 @@ void func_800E5958(s32 playerIdx, s32 fadeTimer) {
|
|||
}
|
||||
|
||||
// SetFadeInTimer
|
||||
void func_800E59AC(s32 playerIdx, s32 fadeTimer) {
|
||||
void Audio_LoadSetFadeInTimer(s32 playerIdx, s32 fadeTimer) {
|
||||
SequencePlayer* seqPlayer;
|
||||
if (fadeTimer != 0) {
|
||||
seqPlayer = &gAudioContext.seqPlayers[playerIdx];
|
||||
|
@ -741,30 +401,30 @@ void Audio_ProcessCmd(AudioCmd* cmd) {
|
|||
s32 i;
|
||||
|
||||
if ((cmd->op & 0xF0) == 0xF0) {
|
||||
func_800E5584(cmd);
|
||||
Audio_ProcessLoadCmd(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd->arg0 < gAudioContext.audioBufferParameters.numSequencePlayers) {
|
||||
seqPlayer = &gAudioContext.seqPlayers[cmd->arg0];
|
||||
if (cmd->op & 0x80) {
|
||||
func_800E5584(cmd);
|
||||
Audio_ProcessLoadCmd(cmd);
|
||||
return;
|
||||
}
|
||||
if (cmd->op & 0x40) {
|
||||
func_800E6128(seqPlayer, cmd);
|
||||
Audio_ProcessSequenceCmd(seqPlayer, cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd->arg1 < 0x10) {
|
||||
func_800E6300(seqPlayer->channels[cmd->arg1], cmd);
|
||||
Audio_ProcessChannelCmd(seqPlayer->channels[cmd->arg1], cmd);
|
||||
return;
|
||||
}
|
||||
if (cmd->arg1 == 0xFF) {
|
||||
phi_v0 = gAudioContext.unk_5BDC[cmd->arg0];
|
||||
for (i = 0; i < 0x10; i++) {
|
||||
if (phi_v0 & 1) {
|
||||
func_800E6300(seqPlayer->channels[i], cmd);
|
||||
Audio_ProcessChannelCmd(seqPlayer->channels[i], cmd);
|
||||
}
|
||||
phi_v0 = phi_v0 >> 1;
|
||||
}
|
||||
|
@ -789,7 +449,7 @@ void Audio_ProcessCmds(u32 msg) {
|
|||
}
|
||||
|
||||
cmd = &gAudioContext.cmdBuf[curCmdRdPos++ & 0xFF];
|
||||
if (cmd->op == 0xF8) {
|
||||
if (cmd->op == QUEUE_FINISHED) {
|
||||
gAudioContext.cmdQueueFinished = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -802,10 +462,6 @@ void Audio_ProcessCmds(u32 msg) {
|
|||
u32 func_800E5E20(u32* out) {
|
||||
u32 sp1C = 0;
|
||||
|
||||
if (osRecvMesg(&gAudioContext.externalLoadQueue, (OSMesg*)&sp1C, OS_MESG_NOBLOCK) == -1) {
|
||||
*out = 0;
|
||||
return 0;
|
||||
}
|
||||
*out = sp1C & 0xFFFFFF;
|
||||
return sp1C >> 0x18;
|
||||
}
|
||||
|
@ -833,7 +489,7 @@ s32 func_800E5EDC(void) {
|
|||
}
|
||||
|
||||
void func_800E5F34(void) {
|
||||
return; // TODO FIX HACK IGNORE
|
||||
//return; // TODO FIX HACK IGNORE
|
||||
// macro?
|
||||
// clang-format off
|
||||
s32 chk = -1; s32 sp28; do {} while (osRecvMesg(gAudioContext.audioResetQueueP, (OSMesg*)&sp28, OS_MESG_NOBLOCK) != chk);
|
||||
|
@ -860,7 +516,7 @@ s32 func_800E5F88(s32 resetPreloadID) {
|
|||
}
|
||||
|
||||
func_800E5F34();
|
||||
Audio_QueueCmdS32(0xF9000000, resetPreloadID);
|
||||
Audio_QueueCmdS32(CHAN_LOAD_RESET_LOAD_SPECID << 24, resetPreloadID);
|
||||
|
||||
return Audio_ScheduleProcessCmds();
|
||||
}
|
||||
|
@ -873,7 +529,7 @@ void Audio_PreNMIInternal(void) {
|
|||
}
|
||||
}
|
||||
|
||||
s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) {
|
||||
s8 Audio_GetScriptIO_Value(s32 playerIdx, s32 channelIdx, s32 scriptIdx) {
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx];
|
||||
SequenceChannel* channel;
|
||||
if (seqPlayer->enabled) {
|
||||
|
@ -896,34 +552,34 @@ void Audio_DestroyExternalPool(void) {
|
|||
gAudioContext.externalPool.start = NULL;
|
||||
}
|
||||
|
||||
void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) {
|
||||
void Audio_ProcessSequenceCmd(SequencePlayer* seqPlayer, AudioCmd* cmd) {
|
||||
f32 fadeVolume;
|
||||
switch (cmd->op) {
|
||||
case 0x41:
|
||||
case SEQ_CMD_UKN_41:
|
||||
if (seqPlayer->fadeVolumeScale != cmd->asFloat) {
|
||||
seqPlayer->fadeVolumeScale = cmd->asFloat;
|
||||
seqPlayer->recalculateVolume = 1;
|
||||
}
|
||||
return;
|
||||
case 0x47:
|
||||
case SEQ_CMD_SET_TEMPO:
|
||||
seqPlayer->tempo = cmd->asInt * 0x30;
|
||||
return;
|
||||
case 0x49:
|
||||
case SEQ_CMD_UKN_49:
|
||||
seqPlayer->unk_0C = cmd->asInt * 0x30;
|
||||
return;
|
||||
case 0x4E:
|
||||
case SEQ_CMD_UKN_4E:
|
||||
seqPlayer->unk_0C = cmd->asInt;
|
||||
return;
|
||||
case 0x48:
|
||||
case SEQ_CMD_UKN_48:
|
||||
seqPlayer->transposition = cmd->asSbyte;
|
||||
return;
|
||||
case 0x46:
|
||||
case SEQ_CMD_UKN_46:
|
||||
seqPlayer->soundScriptIO[cmd->arg2] = cmd->asSbyte;
|
||||
return;
|
||||
case 0x4A:
|
||||
case SEQ_CMD_UKN_4A:
|
||||
fadeVolume = (s32)cmd->arg1 / 127.0f;
|
||||
goto block_11;
|
||||
case 0x4B:
|
||||
case SEQ_CMD_UKN_4B:
|
||||
fadeVolume = ((s32)cmd->arg1 / 100.0f) * seqPlayer->fadeVolume;
|
||||
block_11:
|
||||
if (seqPlayer->state != 2) {
|
||||
|
@ -938,7 +594,7 @@ void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) {
|
|||
}
|
||||
}
|
||||
return;
|
||||
case 0x4C:
|
||||
case SEQ_CMD_UKN_4C:
|
||||
if (seqPlayer->state != 2) {
|
||||
if (cmd->asInt == 0) {
|
||||
seqPlayer->fadeVolume = seqPlayer->volume;
|
||||
|
@ -950,7 +606,7 @@ void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) {
|
|||
}
|
||||
}
|
||||
return;
|
||||
case 0x4D:
|
||||
case SEQ_CMD_UKN_4D:
|
||||
seqPlayer->unk_34 = cmd->asFloat;
|
||||
if (seqPlayer->unk_34 == 1.0f) {
|
||||
seqPlayer->unk_0b1 = 0;
|
||||
|
@ -960,7 +616,7 @@ void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
void func_800E6300(SequenceChannel* channel, AudioCmd* cmd) {
|
||||
void Audio_ProcessChannelCmd(SequenceChannel* channel, AudioCmd* cmd) {
|
||||
switch (cmd->op) {
|
||||
case CHAN_UPD_VOL_SCALE:
|
||||
if (channel->volumeScale != cmd->asFloat) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
#include "z64audio.h"
|
||||
#include <unordered_map>
|
||||
#include "def/audio_data.h"
|
||||
#include "def/audio_effects.h"
|
||||
#include "def/audio_heap.h"
|
||||
|
@ -11,6 +12,39 @@
|
|||
#include "def/audio_rsp.h"
|
||||
#include "def/audio_bank.h"
|
||||
|
||||
static std::unordered_map<AdsrEnvelope*, AdsrEnvelope*> g_envelopeMape;
|
||||
|
||||
static u32 AdsrEnvelopeBE_Length(const AdsrEnvelope* env)
|
||||
{
|
||||
u32 len = 1;
|
||||
|
||||
while(BE16(env->delay) != (u16)-1)
|
||||
{
|
||||
env++;
|
||||
len++;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static AdsrEnvelope* AdsrEnvelopeBE(AdsrEnvelope* pointer)
|
||||
{
|
||||
auto& ptr = g_envelopeMape[pointer];
|
||||
|
||||
if(!ptr)
|
||||
{
|
||||
u32 len = AdsrEnvelopeBE_Length(pointer);
|
||||
ptr = new AdsrEnvelope[len];
|
||||
|
||||
for(u32 i=0; i < len; i++)
|
||||
{
|
||||
ptr[i].delay = BE16(pointer[i].delay);
|
||||
ptr[i].arg = BE16(pointer[i].arg);
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80)
|
||||
#define PORTAMENTO_MODE(x) ((x).mode & ~0x80)
|
||||
#define PORTAMENTO_MODE_1 1
|
||||
|
@ -19,6 +53,14 @@
|
|||
#define PORTAMENTO_MODE_4 4
|
||||
#define PORTAMENTO_MODE_5 5
|
||||
|
||||
#if 0
|
||||
#define BES16(x) ((s16)BE16((u16)x))
|
||||
#define BEU16(x) (BE16(x))
|
||||
#else
|
||||
#define BES16(x) (x)
|
||||
#define BEU16(x) (x)
|
||||
#endif
|
||||
|
||||
u8 AudioSeq_ScriptReadU8(SeqScriptState* state);
|
||||
s16 AudioSeq_ScriptReadS16(SeqScriptState* state);
|
||||
u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state);
|
||||
|
@ -369,18 +411,18 @@ u8 AudioSeq_ScriptReadU8(SeqScriptState* state) {
|
|||
}
|
||||
|
||||
s16 AudioSeq_ScriptReadS16(SeqScriptState* state) {
|
||||
s16 ret = *(state->pc++) << 8;
|
||||
s16 ret = BES16(*(state->pc++)) << 8;
|
||||
|
||||
ret = *(state->pc++) | ret;
|
||||
ret = BES16(*(state->pc++)) | ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state) {
|
||||
u16 ret = *(state->pc++);
|
||||
u16 ret = BEU16(*(state->pc++));
|
||||
|
||||
if (ret & 0x80) {
|
||||
ret = (ret << 8) & 0x7F00;
|
||||
ret = *(state->pc++) | ret;
|
||||
ret = BEU16(*(state->pc++)) | ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -594,7 +636,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
|
|||
|
||||
case 0xCB:
|
||||
sp3A = AudioSeq_ScriptReadS16(state);
|
||||
layer->adsr.envelope = (AdsrEnvelope*)(seqPlayer->seqData + sp3A);
|
||||
layer->adsr.envelope = AdsrEnvelopeBE((AdsrEnvelope*)(seqPlayer->seqData + sp3A));
|
||||
// fallthrough
|
||||
|
||||
case 0xCF:
|
||||
|
@ -1061,8 +1103,13 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
|
||||
if (seqPlayer->defaultFont != 0xFF) {
|
||||
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||
#ifdef LITTLE_ENDIAN
|
||||
lowBits = gAudioContext.sequenceFontTable[offset + 1];
|
||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result + 1];
|
||||
#else
|
||||
lowBits = gAudioContext.sequenceFontTable[offset];
|
||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, command)) {
|
||||
|
@ -1124,7 +1171,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
break;
|
||||
case 0xDA:
|
||||
offset = (u16)parameters[0];
|
||||
channel->adsr.envelope = (AdsrEnvelope*)&seqPlayer->seqData[offset];
|
||||
channel->adsr.envelope = AdsrEnvelopeBE((AdsrEnvelope*)&seqPlayer->seqData[offset]);
|
||||
break;
|
||||
case 0xD9:
|
||||
command = (u8)parameters[0];
|
||||
|
@ -1172,8 +1219,13 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
|
||||
if (seqPlayer->defaultFont != 0xFF) {
|
||||
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||
#ifdef LITTLE_ENDIAN
|
||||
lowBits = gAudioContext.sequenceFontTable[offset + 1];
|
||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result + 1];
|
||||
#else
|
||||
lowBits = gAudioContext.sequenceFontTable[offset];
|
||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, command)) {
|
||||
|
|
|
@ -699,9 +699,9 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
s32 phi_s4;
|
||||
s32 nFirstFrameSamplesToIgnore;
|
||||
s32 pad2[7];
|
||||
s32 frameSize = 0; // TODO HACK not sure why this isnt being set
|
||||
s32 frameSize; // TODO HACK not sure why this isnt being set
|
||||
s32 nFramesToDecode;
|
||||
s32 skipInitialSamples = 16; // TODO HACK not sure why this isnt being set
|
||||
s32 skipInitialSamples; // TODO HACK not sure why this isnt being set
|
||||
Pointer sampleDataStart;
|
||||
u8* sampleData;
|
||||
s32 nParts;
|
||||
|
@ -751,13 +751,6 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
nSamplesToLoad = samplesLenFixedPoint >> 16;
|
||||
synthState->samplePosFrac = samplesLenFixedPoint & 0xFFFF;
|
||||
|
||||
// Partially-optimized out no-op ifs required for matching. SM64 decomp
|
||||
// makes it clear that this is how it should look.
|
||||
if (synthState->numParts == 1 && nParts == 2) {
|
||||
} else if (synthState->numParts == 2 && nParts == 1) {
|
||||
} else {
|
||||
}
|
||||
|
||||
synthState->numParts = nParts;
|
||||
|
||||
if (noteSubEu->bitField1.isSyntheticWave) {
|
||||
|
@ -880,9 +873,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
} else if (audioFontSample->medium == MEDIUM_UNK) {
|
||||
return cmd;
|
||||
} else {
|
||||
sampleData = (u8*)AudioLoad_DmaSampleData(sampleDataStart + sampleDataOffset + sampleAddr,
|
||||
ALIGN16((nFramesToDecode * frameSize) + 0x10), flags,
|
||||
&synthState->sampleDmaIndex, audioFontSample->medium);
|
||||
sampleData = (u8*)(sampleDataStart + sampleDataOffset + sampleAddr).get();
|
||||
}
|
||||
|
||||
if (sampleData == NULL) {
|
||||
|
@ -913,6 +904,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
}
|
||||
switch (audioFontSample->codec) {
|
||||
case CODEC_ADPCM:
|
||||
aligned = ALIGN16((nFramesToDecode * frameSize) + 0x10);
|
||||
aligned = ALIGN16((nFramesToDecode * frameSize) + 0x10);
|
||||
addr = DMEM_COMPRESSED_ADPCM_DATA - aligned;
|
||||
aSetBuffer(cmd++, 0, addr + sampleDataStartPad, DMEM_UNCOMPRESSED_NOTE + phi_s4,
|
||||
|
@ -920,6 +912,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
aADPCMdec(cmd++, flags, synthState->synthesisBuffers->adpcmdecState);
|
||||
break;
|
||||
case CODEC_SMALL_ADPCM:
|
||||
aligned = ALIGN16((nFramesToDecode * frameSize) + 0x10);
|
||||
aligned = ALIGN16((nFramesToDecode * frameSize) + 0x10);
|
||||
addr = DMEM_COMPRESSED_ADPCM_DATA - aligned;
|
||||
aSetBuffer(cmd++, 0, addr + sampleDataStartPad, DMEM_UNCOMPRESSED_NOTE + phi_s4,
|
||||
|
|
|
@ -476,7 +476,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
|||
}
|
||||
SpeedMeter_Init(&D_801664D0);
|
||||
Rumble_Reset();
|
||||
osSendMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||
//osSendMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||
|
||||
endTime = osGetTime();
|
||||
// "Other initialization processing time %d us"
|
||||
|
@ -491,7 +491,7 @@ void GameState_Destroy(GameState* gameState) {
|
|||
osSyncPrintf("game destructor start\n"); // "game destructor start"
|
||||
Audio_StopAllBanks();
|
||||
func_800F3054();
|
||||
osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||
//osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||
LogUtils_CheckNullPointer("this->cleanup", gameState->destroy, "../game.c", 1139);
|
||||
if (gameState->destroy != NULL) {
|
||||
gameState->destroy(gameState);
|
||||
|
|
|
@ -203,7 +203,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
|||
|
||||
gfxCtx->schedMsgQ = &gSchedContext.cmdQ;
|
||||
|
||||
osSendMesg(&gSchedContext.cmdQ, scTask, OS_MESG_BLOCK);
|
||||
//osSendMesg(&gSchedContext.cmdQ, scTask, OS_MESG_BLOCK);
|
||||
Sched_SendEntryMsg(&gSchedContext);
|
||||
|
||||
if (!oot::config().game().isGraphicsDisabled())
|
||||
|
|
|
@ -3,15 +3,10 @@
|
|||
#include "padmgr.h"
|
||||
#include "n64fault.h"
|
||||
#include "vt.h"
|
||||
#include "port/player/players.h"
|
||||
#include "def/padmgr.h"
|
||||
#include "def/padutils.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void hid_init();
|
||||
void hid_update();
|
||||
}
|
||||
|
||||
u32 gIsCtrlr2Valid = false;
|
||||
s32 D_8012D280 = 1;
|
||||
|
||||
|
@ -53,7 +48,7 @@ void PadMgr_HandlePreNMI(PadMgr* padMgr) {
|
|||
}
|
||||
|
||||
void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 mode) {
|
||||
hid_update();
|
||||
oot::hid::Players::Update();
|
||||
s32 i;
|
||||
Input* ogInput;
|
||||
Input* newInput;
|
||||
|
|
|
@ -21,7 +21,7 @@ s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status) {
|
|||
return 1;
|
||||
}*/
|
||||
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
//osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
//osContGetQuery(status);
|
||||
|
||||
*outMask = 0;
|
||||
|
|
|
@ -722,14 +722,11 @@ void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx
|
|||
titleCtx->delayTimer = 0;
|
||||
}
|
||||
|
||||
void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s32 x, s32 y,
|
||||
void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void*& texture, s32 x, s32 y,
|
||||
s32 width, s32 height, s32 delay) {
|
||||
SceneTableEntry* loadedScene = globalCtx->loadedScene;
|
||||
size_t size = (loadedScene->titleFile.vromEnd - loadedScene->titleFile.vromStart).size();
|
||||
|
||||
if ((size != 0) && (size <= 0x3000)) {
|
||||
DmaMgr_SendRequest1(texture, loadedScene->titleFile.vromStart, size, "../z_actor.c", 2765);
|
||||
}
|
||||
texture = loadedScene->titleFile.vromStart.buffer();
|
||||
|
||||
titleCtx->texture = texture;
|
||||
titleCtx->x = x;
|
||||
|
@ -2890,7 +2887,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC
|
|||
actorCtx->targetCtx.bgmEnemy = NULL;
|
||||
}
|
||||
|
||||
/* Audio_StopSfxByPos(&actor->projectedPos); */
|
||||
Audio_StopSfxByPos(&actor->projectedPos);
|
||||
Actor_Destroy(actor, globalCtx);
|
||||
|
||||
newHead = Actor_RemoveFromCategory(globalCtx, actorCtx, actor);
|
||||
|
|
|
@ -88,7 +88,7 @@ CameraModeValue D_8011A3C8[] = {
|
|||
{ 50, 8 }, // unk_14
|
||||
{ 0x200A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 20, 12 } // unk_1C
|
||||
{ 20, 12 } // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011A3F4[] = {
|
||||
|
@ -100,7 +100,7 @@ CameraModeValue D_8011A3F4[] = {
|
|||
{ 45, 14 }, // unk_10
|
||||
{ -5, 15 }, // unk_14
|
||||
{ 15, 16 }, // unk_18
|
||||
{ 15, 17 }, // unk_1C
|
||||
{ 15, 17 }, // tempo
|
||||
{ 45, 7 }, // unk_20
|
||||
{ 50, 8 }, // unk_24
|
||||
{ 0x2001, 9 }, // flags
|
||||
|
@ -326,7 +326,7 @@ CameraModeValue D_8011A660[] = {
|
|||
{ 30, 8 }, // unk_14
|
||||
{ 0x206A, 9 }, // flags
|
||||
{ -20, 11 }, // unk_18
|
||||
{ 30, 12 }, // unk_1C
|
||||
{ 30, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011A68C[] = {
|
||||
|
@ -338,7 +338,7 @@ CameraModeValue D_8011A68C[] = {
|
|||
{ 85, 14 }, // unk_10
|
||||
{ 10, 15 }, // unk_14
|
||||
{ 5, 16 }, // unk_18
|
||||
{ 25, 17 }, // unk_1C
|
||||
{ 25, 17 }, // tempo
|
||||
{ 45, 7 }, // unk_20
|
||||
{ 50, 8 }, // unk_24
|
||||
{ 0x2001, 9 }, // flags
|
||||
|
@ -372,7 +372,7 @@ CameraModeValue sSetNorm1ModeParaVals[] = {
|
|||
{ 50, 8 }, // unk_14
|
||||
{ 0x2002, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 20, 12 }, // unk_1C
|
||||
{ 20, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011A714[] = {
|
||||
|
@ -384,7 +384,7 @@ CameraModeValue D_8011A714[] = {
|
|||
{ 45, 14 }, // unk_10
|
||||
{ -5, 15 }, // unk_14
|
||||
{ 15, 16 }, // unk_18
|
||||
{ 15, 17 }, // unk_1C
|
||||
{ 15, 17 }, // tempo
|
||||
{ 45, 7 }, // unk_20
|
||||
{ 50, 8 }, // unk_24
|
||||
{ 0x2001, 9 }, // flags
|
||||
|
@ -543,7 +543,7 @@ CameraModeValue D_8011A8C4[] = {
|
|||
{ 50, 8 }, // unk_14
|
||||
{ 0x200A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 20, 12 }, // unk_1C
|
||||
{ 20, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011A8F0[] = {
|
||||
|
@ -555,7 +555,7 @@ CameraModeValue D_8011A8F0[] = {
|
|||
{ 45, 14 }, // unk_10
|
||||
{ -5, 15 }, // unk_14
|
||||
{ 15, 16 }, // unk_18
|
||||
{ 15, 17 }, // unk_1C
|
||||
{ 15, 17 }, // tempo
|
||||
{ 45, 7 }, // unk_20
|
||||
{ 50, 8 }, // unk_24
|
||||
{ 0x2001, 9 }, // flags
|
||||
|
@ -815,7 +815,7 @@ CameraModeValue D_8011ABB4[] = {
|
|||
{ 50, 8 }, // unk_14
|
||||
{ 0x206A, 9 }, // flags
|
||||
{ -20, 11 }, // unk_18
|
||||
{ 30, 12 }, // unk_1C
|
||||
{ 30, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue sSetNorm3ModeNormVals[] = {
|
||||
|
@ -828,7 +828,7 @@ CameraModeValue sSetNorm3ModeNormVals[] = {
|
|||
{ 5, 5 }, // unk_10
|
||||
{ 40, 6 }, // unk_14
|
||||
{ 60, 7 }, // fovTarget
|
||||
{ 100, 8 }, // unk_1C
|
||||
{ 100, 8 }, // tempo
|
||||
{ 0x0004, 9 }, // flags
|
||||
};
|
||||
|
||||
|
@ -844,7 +844,7 @@ CameraModeValue D_8011AC08[] = {
|
|||
{ 100, 8 }, // unk_14
|
||||
{ 0x200A, 9 }, // flags
|
||||
{ -50, 11 }, // unk_18
|
||||
{ 20, 12 }, // unk_1C
|
||||
{ 20, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011AC34[] = {
|
||||
|
@ -876,7 +876,7 @@ CameraModeValue sSetNorm3ModeBoomVals[] = {
|
|||
{ 5, 5 }, // unk_10
|
||||
{ 60, 6 }, // unk_14
|
||||
{ 60, 7 }, // fovTarget
|
||||
{ 40, 8 }, // unk_1C
|
||||
{ 40, 8 }, // tempo
|
||||
{ 0x0005, 9 }, // flags
|
||||
};
|
||||
|
||||
|
@ -928,7 +928,7 @@ CameraModeValue D_8011ACF8[] = {
|
|||
{ 45, 14 }, // unk_10
|
||||
{ -5, 15 }, // unk_14
|
||||
{ 15, 16 }, // unk_18
|
||||
{ 15, 17 }, // unk_1C
|
||||
{ 15, 17 }, // tempo
|
||||
{ 45, 7 }, // unk_20
|
||||
{ 50, 8 }, // unk_24
|
||||
{ 0x2601, 9 }, // flags
|
||||
|
@ -1280,7 +1280,7 @@ CameraModeValue D_8011B108[] = {
|
|||
{ 0, 0 }, // unk_00
|
||||
{ 120, 1 }, // unk_04
|
||||
{ 280, 2 }, // unk_08
|
||||
{ 60, 23 }, // unk_1C
|
||||
{ 60, 23 }, // tempo
|
||||
{ 8, 4 }, // unk_0C
|
||||
{ 40, 6 }, // unk_10
|
||||
{ 60, 7 }, // unk_14
|
||||
|
@ -1293,7 +1293,7 @@ CameraModeValue D_8011B12C[] = {
|
|||
{ 0, 0 }, // unk_00
|
||||
{ 120, 1 }, // unk_04
|
||||
{ 280, 2 }, // unk_08
|
||||
{ 60, 23 }, // unk_1C
|
||||
{ 60, 23 }, // tempo
|
||||
{ 8, 4 }, // unk_0C
|
||||
{ 40, 6 }, // unk_10
|
||||
{ 60, 7 }, // unk_14
|
||||
|
@ -1306,7 +1306,7 @@ CameraModeValue D_8011B150[] = {
|
|||
{ 0, 0 }, // unk_00
|
||||
{ 270, 1 }, // unk_04
|
||||
{ 300, 2 }, // unk_08
|
||||
{ 120, 23 }, // unk_1C
|
||||
{ 120, 23 }, // tempo
|
||||
{ 8, 4 }, // unk_0C
|
||||
{ 60, 6 }, // unk_10
|
||||
{ 60, 7 }, // unk_14
|
||||
|
@ -1319,7 +1319,7 @@ CameraModeValue D_8011B174[] = {
|
|||
{ 0, 0 }, // unk_00
|
||||
{ 270, 1 }, // unk_04
|
||||
{ 300, 2 }, // unk_08
|
||||
{ 120, 23 }, // unk_1C
|
||||
{ 120, 23 }, // tempo
|
||||
{ 6, 4 }, // unk_0C
|
||||
{ 60, 6 }, // unk_10
|
||||
{ 60, 7 }, // unk_14
|
||||
|
@ -1509,7 +1509,7 @@ CameraModeValue sSetMori1ModeNormVals[] = {
|
|||
{ 30, 8 }, // unk_14
|
||||
{ 0x000C, 9 }, // flags
|
||||
{ -50, 11 }, // unk_18
|
||||
{ 20, 12 }, // unk_1C
|
||||
{ 20, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B2E0[] = {
|
||||
|
@ -1556,7 +1556,7 @@ CameraModeValue D_8011B31C[] = {
|
|||
{ 50, 8 }, // unk_14
|
||||
{ 0x200A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 20, 12 }, // unk_1C
|
||||
{ 20, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B348[] = {
|
||||
|
@ -1633,7 +1633,7 @@ CameraModeValue D_8011B3F0[] = {
|
|||
{ 50, 8 }, // unk_14
|
||||
{ 0x200A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 20, 12 }, // unk_1C
|
||||
{ 20, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B41C[] = {
|
||||
|
@ -1769,7 +1769,7 @@ CameraModeValue D_8011B560[] = {
|
|||
{ 80, 8 }, // unk_14
|
||||
{ 0x201A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 40, 12 }, // unk_1C
|
||||
{ 40, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B58C[] = {
|
||||
|
@ -1784,7 +1784,7 @@ CameraModeValue D_8011B58C[] = {
|
|||
{ 80, 8 }, // unk_14
|
||||
{ 0x201A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 40, 12 }, // unk_1C
|
||||
{ 40, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B5B8[] = {
|
||||
|
@ -1827,7 +1827,7 @@ CameraModeValue D_8011B608[] = {
|
|||
{ 80, 8 }, // unk_14
|
||||
{ 0x201A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 40, 12 }, // unk_1C
|
||||
{ 40, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B634[] = {
|
||||
|
@ -1842,7 +1842,7 @@ CameraModeValue D_8011B634[] = {
|
|||
{ 80, 8 }, // unk_14
|
||||
{ 0x200A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 40, 12 }, // unk_1C
|
||||
{ 40, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B660[] = {
|
||||
|
@ -1885,7 +1885,7 @@ CameraModeValue D_8011B6B0[] = {
|
|||
{ 80, 8 }, // unk_14
|
||||
{ 0x200A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 40, 12 }, // unk_1C
|
||||
{ 40, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B6DC[] = {
|
||||
|
@ -1900,7 +1900,7 @@ CameraModeValue D_8011B6DC[] = {
|
|||
{ 80, 8 }, // unk_14
|
||||
{ 0x200A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 40, 12 }, // unk_1C
|
||||
{ 40, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B708[] = {
|
||||
|
@ -1976,7 +1976,7 @@ CameraModeValue D_8011B7AC[] = {
|
|||
{ 50, 8 }, // unk_14
|
||||
{ 0x2F0A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 20, 12 }, // unk_1C
|
||||
{ 20, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011B7D8[] = {
|
||||
|
@ -2131,7 +2131,7 @@ CameraModeValue D_8011B958[] = {
|
|||
{ 50, 8 }, // unk_14
|
||||
{ 0x200A, 9 }, // flags
|
||||
{ -40, 11 }, // unk_18
|
||||
{ 20, 12 }, // unk_1C
|
||||
{ 20, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue sSetDung2ModeBattVals[] = {
|
||||
|
@ -2248,7 +2248,7 @@ CameraModeValue D_8011BA9C[] = {
|
|||
{ 30, 8 }, // unk_14
|
||||
{ 0x206A, 9 }, // flags
|
||||
{ -20, 11 }, // unk_18
|
||||
{ 30, 12 }, // unk_1C
|
||||
{ 30, 12 }, // tempo
|
||||
};
|
||||
|
||||
CameraModeValue D_8011BAC8[] = {
|
||||
|
@ -2274,7 +2274,7 @@ CameraModeValue D_8011BAF0[] = {
|
|||
{ 45, 14 }, // unk_10
|
||||
{ 0, 15 }, // unk_14
|
||||
{ -5, 16 }, // unk_18
|
||||
{ 20, 17 }, // unk_1C
|
||||
{ 20, 17 }, // tempo
|
||||
{ 50, 7 }, // unk_20
|
||||
{ 50, 8 }, // unk_24
|
||||
{ 0x2001, 9 }, // flags
|
||||
|
|
|
@ -71,9 +71,9 @@ void Jpeg_ScheduleDecoderTask(JpegContext* ctx) {
|
|||
ctx->scTask.framebuffer = NULL;
|
||||
ctx->scTask.list.t = sJpegTask;
|
||||
|
||||
osSendMesg(&gSchedContext.cmdQ, (OSMesg)&ctx->scTask, OS_MESG_BLOCK);
|
||||
//osSendMesg(&gSchedContext.cmdQ, (OSMesg)&ctx->scTask, OS_MESG_BLOCK);
|
||||
Sched_SendEntryMsg(&gSchedContext); // osScKickEntryMsg
|
||||
osRecvMesg(&ctx->mq, NULL, OS_MESG_BLOCK);
|
||||
//osRecvMesg(&ctx->mq, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -734,9 +734,8 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
|||
envCtx->skyboxDmaState = SKYBOX_DMA_FILE1_START;
|
||||
size = POINTER_SUB2(gSkyboxFiles[newSkybox1Index].file.vromEnd, gSkyboxFiles[newSkybox1Index].file.vromStart);
|
||||
|
||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, skyboxCtx->staticSegments[0],
|
||||
gSkyboxFiles[newSkybox1Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
||||
gSkyboxFiles[newSkybox1Index].file.vromStart, size, 0, nullptr, NULL,
|
||||
"../z_kankyo.c", 1264);
|
||||
//skyboxCtx->staticSegments[0] = gSkyboxFiles[newSkybox1Index].file.vromStart;
|
||||
envCtx->skybox1Index = newSkybox1Index;
|
||||
|
@ -746,9 +745,8 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
|||
envCtx->skyboxDmaState = SKYBOX_DMA_FILE2_START;
|
||||
size = POINTER_SUB2(gSkyboxFiles[newSkybox2Index].file.vromEnd, gSkyboxFiles[newSkybox2Index].file.vromStart);
|
||||
|
||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, skyboxCtx->staticSegments[1],
|
||||
gSkyboxFiles[newSkybox2Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
||||
gSkyboxFiles[newSkybox2Index].file.vromStart, size, 0, nullptr, NULL,
|
||||
"../z_kankyo.c", 1281);
|
||||
//skyboxCtx->staticSegments[1] = gSkyboxFiles[newSkybox2Index].file.vromStart;
|
||||
envCtx->skybox2Index = newSkybox2Index;
|
||||
|
@ -760,15 +758,13 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
|||
if ((newSkybox1Index & 1) ^ ((newSkybox1Index & 4) >> 2)) {
|
||||
size = POINTER_SUB2(gSkyboxFiles[newSkybox1Index].palette.vromEnd, gSkyboxFiles[newSkybox1Index].palette.vromStart);
|
||||
|
||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, skyboxCtx->palettes,
|
||||
gSkyboxFiles[newSkybox1Index].palette.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
||||
gSkyboxFiles[newSkybox1Index].palette.vromStart, size, 0, nullptr, NULL,
|
||||
"../z_kankyo.c", 1307);
|
||||
} else {
|
||||
size = POINTER_SUB2(gSkyboxFiles[newSkybox1Index].palette.vromEnd, gSkyboxFiles[newSkybox1Index].palette.vromStart);
|
||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, POINTER_ADD(skyboxCtx->palettes, size),
|
||||
gSkyboxFiles[newSkybox1Index].palette.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
||||
gSkyboxFiles[newSkybox1Index].palette.vromStart, size, 0, nullptr, NULL,
|
||||
"../z_kankyo.c", 1320);
|
||||
}
|
||||
}
|
||||
|
@ -779,27 +775,22 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
|||
if ((newSkybox2Index & 1) ^ ((newSkybox2Index & 4) >> 2)) {
|
||||
size = POINTER_SUB2(gSkyboxFiles[newSkybox2Index].palette.vromEnd, gSkyboxFiles[newSkybox2Index].palette.vromStart);
|
||||
|
||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, skyboxCtx->palettes,
|
||||
gSkyboxFiles[newSkybox2Index].palette.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
||||
gSkyboxFiles[newSkybox2Index].palette.vromStart, size, 0, nullptr, NULL,
|
||||
"../z_kankyo.c", 1342);
|
||||
} else {
|
||||
size = POINTER_SUB2(gSkyboxFiles[newSkybox2Index].palette.vromEnd, gSkyboxFiles[newSkybox2Index].palette.vromStart);
|
||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||
|
||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, POINTER_ADD(skyboxCtx->palettes, size),
|
||||
gSkyboxFiles[newSkybox2Index].palette.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
||||
gSkyboxFiles[newSkybox2Index].palette.vromStart, size, 0, nullptr, NULL,
|
||||
"../z_kankyo.c", 1355);
|
||||
}
|
||||
}
|
||||
|
||||
if ((envCtx->skyboxDmaState == SKYBOX_DMA_FILE1_START) || (envCtx->skyboxDmaState == SKYBOX_DMA_FILE2_START)) {
|
||||
if (osRecvMesg(&envCtx->loadQueue, 0, OS_MESG_NOBLOCK) == 0) {
|
||||
envCtx->skyboxDmaState++;
|
||||
}
|
||||
envCtx->skyboxDmaState++;
|
||||
} else if (envCtx->skyboxDmaState >= SKYBOX_DMA_FILE1_DONE) {
|
||||
if (osRecvMesg(&envCtx->loadQueue, 0, OS_MESG_NOBLOCK) == 0) {
|
||||
envCtx->skyboxDmaState = SKYBOX_DMA_INACTIVE;
|
||||
}
|
||||
envCtx->skyboxDmaState = SKYBOX_DMA_INACTIVE;
|
||||
}
|
||||
|
||||
envCtx->skyboxBlend = skyboxBlend;
|
||||
|
|
|
@ -20,7 +20,7 @@ void MsgEvent_SendNullTask(void) {
|
|||
task.framebuffer = NULL;
|
||||
task.list.t.type = M_NULTASK;
|
||||
osCreateMesgQueue(task.msgQ, &msg, 1);
|
||||
osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK);
|
||||
//osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK);
|
||||
Sched_SendEntryMsg(&gSchedContext);
|
||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||
//osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
|
|
@ -1139,10 +1139,7 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* pthis, Vec3f* refP
|
|||
}
|
||||
|
||||
void Player_DrawGetItem(GlobalContext* globalCtx, Player* pthis) {
|
||||
if (!pthis->giObjectLoading || !osRecvMesg(&pthis->giObjectLoadQueue, NULL, OS_MESG_NOBLOCK)) {
|
||||
pthis->giObjectLoading = false;
|
||||
Player_DrawGetItemImpl(globalCtx, pthis, &sGetItemRefPos, ABS(pthis->unk_862));
|
||||
}
|
||||
Player_DrawGetItemImpl(globalCtx, pthis, &sGetItemRefPos, ABS(pthis->unk_862));
|
||||
}
|
||||
|
||||
void func_80090A28(Player* pthis, Vec3f* vecs) {
|
||||
|
|
|
@ -592,19 +592,15 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) {
|
|||
|
||||
s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) {
|
||||
if (roomCtx->status == 1) {
|
||||
if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) {
|
||||
roomCtx->status = 0;
|
||||
roomCtx->curRoom.segment = roomCtx->unk_34;
|
||||
gSegments[3] = (uintptr_t)VIRTUAL_TO_PHYSICAL(roomCtx->unk_34);
|
||||
roomCtx->status = 0;
|
||||
roomCtx->curRoom.segment = roomCtx->unk_34;
|
||||
gSegments[3] = (uintptr_t)VIRTUAL_TO_PHYSICAL(roomCtx->unk_34);
|
||||
|
||||
Scene_ExecuteCommands(globalCtx, (SceneCmd*)roomCtx->curRoom.segment);
|
||||
Player_SetBootData(globalCtx, GET_PLAYER(globalCtx));
|
||||
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
|
||||
Scene_ExecuteCommands(globalCtx, (SceneCmd*)roomCtx->curRoom.segment);
|
||||
Player_SetBootData(globalCtx, GET_PLAYER(globalCtx));
|
||||
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -346,7 +346,7 @@ bool cmd_sound_settings(GlobalContext* globalCtx, const SceneCmd* cmd) {
|
|||
globalCtx->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId;
|
||||
|
||||
if (gSaveContext.seqId == (u8)NA_BGM_DISABLED) {
|
||||
Audio_QueueSeqCmd(cmd->soundSettings.specId | 0xF0000000);
|
||||
Audio_QueueSeqCmd(cmd->soundSettings.specId | 0xF0000000); // AUDIO_CMD_CHANGE_SPEC
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -951,8 +951,6 @@ void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelA
|
|||
*/
|
||||
void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* data) {
|
||||
AnimEntryLoadFrame* entry = &data->load;
|
||||
|
||||
osRecvMesg(&entry->msgQueue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
|
||||
#include "vt.h"
|
||||
#include "objects/object_fr/object_fr.h"
|
||||
#include "z64audio.h"
|
||||
#include "def/audio.h"
|
||||
#include "def/sys_matrix.h"
|
||||
#include "def/z_actor.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
#include "z_en_kakasi.h"
|
||||
#include "z64audio.h"
|
||||
#include "vt.h"
|
||||
#include "objects/object_ka/object_ka.h"
|
||||
#include "def/z_actor.h"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "z_en_kakasi3.h"
|
||||
#include "vt.h"
|
||||
#include "z64audio.h"
|
||||
#include "objects/object_ka/object_ka.h"
|
||||
#include "def/z_actor.h"
|
||||
#include "def/z_camera.h"
|
||||
|
|
|
@ -4613,19 +4613,9 @@ s32 func_8083ADD4(GlobalContext* globalCtx, Player* pthis) {
|
|||
|
||||
void func_8083AE40(Player* pthis, s16 objectId) {
|
||||
s32 pad;
|
||||
u32 size;
|
||||
|
||||
if (objectId != 0) {
|
||||
pthis->giObjectLoading = true;
|
||||
//osCreateMesgQueue(&pthis->giObjectLoadQueue, &pthis->giObjectLoadMsg, 1);
|
||||
|
||||
size = POINTER_SUB2(gObjectTable[objectId].vromEnd, gObjectTable[objectId].vromStart);
|
||||
|
||||
LOG_HEX("size", size, "../z_player.c", 9090);
|
||||
ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091);
|
||||
|
||||
DmaMgr_SendRequest2(&pthis->giObjectDmaRequest, pthis->giObjectSegment, gObjectTable[objectId].vromStart,
|
||||
size, 0, &pthis->giObjectLoadQueue, NULL, "../z_player.c", 9099);
|
||||
pthis->giObjectSegment = gObjectTable[objectId].vromStart.buffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9044,7 +9034,7 @@ void Player_Init(Actor* pthisx, GlobalContext* globalCtx2) {
|
|||
Player_SetEquipmentData(globalCtx, pthis);
|
||||
pthis->prevBoots = pthis->currentBoots;
|
||||
Player_InitCommon(pthis, globalCtx, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]);
|
||||
pthis->giObjectSegment = (void*)(((uintptr_t)ZeldaArena_MallocDebug(0x3008, "../z_player.c", 17175) + 8) & ~0xF);
|
||||
pthis->giObjectSegment = nullptr;
|
||||
|
||||
sp50 = gSaveContext.respawnFlag;
|
||||
|
||||
|
|
|
@ -139,9 +139,7 @@ struct Player {
|
|||
/* 0x0164 */ Gfx** leftHandDLists;
|
||||
/* 0x0168 */ Gfx** sheathDLists;
|
||||
/* 0x016C */ Gfx** waistDLists;
|
||||
/* 0x0170 */ u8 giObjectLoading;
|
||||
/* 0x0174 */ DmaRequest giObjectDmaRequest;
|
||||
/* 0x0194 */ OSMesgQueue giObjectLoadQueue;
|
||||
/* 0x01AC */ OSMesg giObjectLoadMsg;
|
||||
/* 0x01B0 */ void* giObjectSegment; // also used for title card textures
|
||||
/* 0x01B4 */ SkelAnime skelAnime;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define INTERNAL_SRC_OVERLAYS_MISC_OVL_KALEIDO_SCOPE_Z_KALEIDO_COLLECT_C
|
||||
#include "actor_common.h"
|
||||
#include "z_kaleido_scope.h"
|
||||
#include "z64audio.h"
|
||||
#include "textures/parameter_static/parameter_static.h"
|
||||
#include "textures/icon_item_static/icon_item_static.h"
|
||||
#include "hack.h"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "actor_common.h"
|
||||
#include "z_kaleido_scope.h"
|
||||
#include "Framerate.h"
|
||||
#include "z64audio.h"
|
||||
#include "segment_symbols.h"
|
||||
#include "textures/icon_item_static/icon_item_static.h"
|
||||
#include "textures/icon_item_24_static/icon_item_24_static.h"
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef AUDIO_API_H
|
||||
#define AUDIO_API_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct AudioAPI
|
||||
{
|
||||
bool (*init)(void);
|
||||
int (*buffered)(void);
|
||||
int (*get_desired_buffered)(void);
|
||||
void (*play)(const uint8_t* buf, size_t len);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef AUDIO_NULL_H
|
||||
#define AUDIO_NULL_H
|
||||
|
||||
#include "audio_api.h"
|
||||
|
||||
extern struct AudioAPI audio_null;
|
||||
|
||||
#endif
|
|
@ -1,67 +0,0 @@
|
|||
#define ENABLE_SDL_AUDIO
|
||||
#if defined(ENABLE_SDL_AUDIO)
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include "SDL.h"
|
||||
#else
|
||||
#include "SDL2/SDL.h"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef OSX_BUILD
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "audio_api.h"
|
||||
|
||||
static SDL_AudioDeviceID dev;
|
||||
|
||||
static bool audio_sdl_init(void)
|
||||
{
|
||||
if(SDL_Init(SDL_INIT_AUDIO) != 0)
|
||||
{
|
||||
fprintf(stderr, "SDL init error: %s\n", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
SDL_AudioSpec want, have;
|
||||
SDL_zero(want);
|
||||
want.freq = 32000;
|
||||
want.format = AUDIO_S16;
|
||||
want.channels = 2;
|
||||
want.samples = 512;
|
||||
want.callback = NULL;
|
||||
dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
|
||||
if(dev == 0)
|
||||
{
|
||||
fprintf(stderr, "SDL_OpenAudio error: %s\n", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
SDL_PauseAudioDevice(dev, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int audio_sdl_buffered(void)
|
||||
{
|
||||
return SDL_GetQueuedAudioSize(dev) / 4;
|
||||
}
|
||||
|
||||
static int audio_sdl_get_desired_buffered(void)
|
||||
{
|
||||
return 1100;
|
||||
}
|
||||
|
||||
static void audio_sdl_play(const uint8_t* buf, size_t len)
|
||||
{
|
||||
if(audio_sdl_buffered() < 6000)
|
||||
{
|
||||
// Don't fill the audio buffer too much in case this happens
|
||||
SDL_QueueAudio(dev, buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
struct AudioAPI audio_sdl = {audio_sdl_init, audio_sdl_buffered, audio_sdl_get_desired_buffered, audio_sdl_play};
|
||||
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef AUDIO_SDL_H
|
||||
#define AUDIO_SDL_H
|
||||
#if(defined(TARGET_WEB) || (defined(WIN32) || defined(WIN64)) || defined(__SWITCH__)) && !defined(DISABLE_SDL_AUDIO) && !defined(DISABLE_SDL_AUDIO)
|
||||
#define ENABLE_SDL_AUDIO
|
||||
extern struct AudioAPI audio_sdl;
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,19 +0,0 @@
|
|||
Copyright (c) 2020 Emill, MaikelChan
|
||||
|
||||
Redistribution and use in source forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form are not allowed.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,33 +0,0 @@
|
|||
# Nintendo 64 Fast3D renderer
|
||||
|
||||
Implementation of a Fast3D renderer for games built originally for the Nintendo 64 platform.
|
||||
|
||||
For rendering OpenGL, Direct3D 11 and Direct3D 12 are supported.
|
||||
|
||||
Supported windowing systems are GLX (used on Linux), DXGI (used on Windows) and SDL (generic).
|
||||
|
||||
# Usage
|
||||
|
||||
See `gfx_pc.h`. You will also need a copy of `PR/gbi.h`, found in libultra.
|
||||
|
||||
First call `gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, const char *game_name, bool start_in_fullscreen)` and supply the desired backends at program start.
|
||||
|
||||
Some callbacks can be set on `wapi`. See `gfx_window_manager_api.h` for more info.
|
||||
|
||||
Each game main loop iteration should look like this:
|
||||
|
||||
```C
|
||||
gfx_start_frame(); // Handles input events such as keyboard and window events
|
||||
// perform game logic here
|
||||
gfx_run(cmds); // submit display list and render a frame
|
||||
// do more expensive work here, such as play audio
|
||||
gfx_end_frame(); // this just waits until the frame is shown on the screen (vsync), to provide correct game timing
|
||||
```
|
||||
|
||||
When you are ready to start the main loop, call `wapi->main_loop(one_iteration_func)`.
|
||||
|
||||
For the best experience, please change the Vtx and Mtx structures to use floats instead of fixed point arithmetic (`GBI_FLOATS`).
|
||||
|
||||
# License
|
||||
|
||||
See LICENSE.txt. Redistributions are allowed only in source form, not in binary form.
|
|
@ -1,791 +0,0 @@
|
|||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
//#define GL_DEBUG
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
#define FOR_WINDOWS 1
|
||||
#else
|
||||
#define FOR_WINDOWS 0
|
||||
#endif
|
||||
|
||||
#if FOR_WINDOWS
|
||||
#include <GL/glew.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#include <SDL2/SDL_opengl.h>
|
||||
#else
|
||||
#include <SDL2/SDL.h>
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#include <SDL2/SDL_opengles2.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "gfx_cc.h"
|
||||
#include "renderer.h"
|
||||
|
||||
#ifndef __SWITCH__
|
||||
#define ENABLE_NOISE_FILTER
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOISE_FILTER
|
||||
#define SHADER_VERSION "#version 110"
|
||||
#else
|
||||
#define SHADER_VERSION "#version 100\nprecision mediump float;"
|
||||
#endif
|
||||
|
||||
#include "shaders.h"
|
||||
|
||||
#ifdef GL_DEBUG
|
||||
static void GLAPIENTRY MessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
|
||||
const GLchar* message, const void* userParam) {
|
||||
osSyncPrintf("GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
|
||||
(type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : ""), type, severity, message);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace sm64::gfx
|
||||
{
|
||||
struct Fog
|
||||
{
|
||||
float color[4];
|
||||
float scaler;
|
||||
float offset;
|
||||
} fog;
|
||||
|
||||
struct ShaderProgram
|
||||
{
|
||||
u32 shader_id;
|
||||
GLuint opengl_program_id;
|
||||
u8 num_inputs;
|
||||
bool used_textures[2];
|
||||
u8 num_floats;
|
||||
GLint attrib_locations[7];
|
||||
u8 attrib_sizes[7];
|
||||
u8 num_attribs;
|
||||
bool used_noise;
|
||||
bool used_fog;
|
||||
GLint frame_count_location;
|
||||
GLint window_height_location;
|
||||
GLint fog_scaler_location;
|
||||
GLint fog_offset_location;
|
||||
GLint fog_color_location;
|
||||
};
|
||||
} // namespace sm64::gfx
|
||||
|
||||
namespace sm64::gfx::opengl
|
||||
{
|
||||
class Opengl : public Renderer
|
||||
{
|
||||
public:
|
||||
ShaderProgram shader_program_pool[64];
|
||||
u8 shader_program_pool_size = 0;
|
||||
|
||||
u32 frame_count = 0;
|
||||
u32 current_height = 0;
|
||||
|
||||
Opengl()
|
||||
{
|
||||
#if FOR_WINDOWS
|
||||
glewInit();
|
||||
#endif
|
||||
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
#ifdef GL_DEBUG
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glDebugMessageCallback(MessageCallback, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool z_is_from_0_to_1()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void vertex_array_set_attribs(struct ShaderProgram* prg)
|
||||
{
|
||||
size_t num_floats = prg->num_floats;
|
||||
size_t pos = 0;
|
||||
|
||||
for(int i = 0; i < prg->num_attribs; i++)
|
||||
{
|
||||
glEnableVertexAttribArray(prg->attrib_locations[i]);
|
||||
glVertexAttribPointer(prg->attrib_locations[i], prg->attrib_sizes[i], GL_FLOAT, GL_FALSE, num_floats * sizeof(float), (void*)(pos * sizeof(float)));
|
||||
pos += prg->attrib_sizes[i];
|
||||
}
|
||||
}
|
||||
|
||||
void set_uniforms(struct ShaderProgram* prg)
|
||||
{
|
||||
if(prg->used_noise)
|
||||
{
|
||||
glUniform1i(prg->frame_count_location, frame_count);
|
||||
glUniform1i(prg->window_height_location, current_height);
|
||||
}
|
||||
|
||||
if(prg->used_fog)
|
||||
{
|
||||
glUniform4f(prg->fog_color_location, fog.color[0], fog.color[1], fog.color[2], fog.color[3]);
|
||||
glUniform1f(prg->fog_scaler_location, fog.scaler);
|
||||
glUniform1f(prg->fog_offset_location, fog.offset);
|
||||
|
||||
/*glUniform4f(prg->fog_color_location, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glUniform1f(prg->fog_scaler_location, 1280.0f);
|
||||
glUniform1f(prg->fog_offset_location, 64512.0f);*/
|
||||
}
|
||||
}
|
||||
|
||||
void unload_shader(struct ShaderProgram* old_prg)
|
||||
{
|
||||
if(old_prg != NULL)
|
||||
{
|
||||
for(int i = 0; i < old_prg->num_attribs; i++)
|
||||
{
|
||||
glDisableVertexAttribArray(old_prg->attrib_locations[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShaderProgram* current_program = 0;
|
||||
|
||||
void reload_shader()
|
||||
{
|
||||
glUseProgram(current_program->opengl_program_id);
|
||||
vertex_array_set_attribs(current_program);
|
||||
set_uniforms(current_program);
|
||||
}
|
||||
|
||||
void load_shader(ShaderProgram* new_prg)
|
||||
{
|
||||
glUseProgram(new_prg->opengl_program_id);
|
||||
vertex_array_set_attribs(new_prg);
|
||||
set_uniforms(new_prg);
|
||||
current_program = new_prg;
|
||||
// set_transformation();
|
||||
}
|
||||
|
||||
void append_str(char* buf, size_t* len, const char* str)
|
||||
{
|
||||
while(*str != '\0')
|
||||
buf[(*len)++] = *str++;
|
||||
}
|
||||
|
||||
void append_line(char* buf, size_t* len, const char* str)
|
||||
{
|
||||
while(*str != '\0')
|
||||
buf[(*len)++] = *str++;
|
||||
buf[(*len)++] = '\n';
|
||||
}
|
||||
|
||||
const char* shader_item_to_str(u32 item, bool with_alpha, bool only_alpha, bool inputs_have_alpha, bool hint_single_element)
|
||||
{
|
||||
if(!only_alpha)
|
||||
{
|
||||
switch(item)
|
||||
{
|
||||
case SHADER_0:
|
||||
return with_alpha ? "vec4(0.0, 0.0, 0.0, 0.0)" : "vec3(0.0, 0.0, 0.0)";
|
||||
case SHADER_INPUT_1:
|
||||
return with_alpha || !inputs_have_alpha ? "vInput1" : "vInput1.rgb";
|
||||
case SHADER_INPUT_2:
|
||||
return with_alpha || !inputs_have_alpha ? "vInput2" : "vInput2.rgb";
|
||||
case SHADER_INPUT_3:
|
||||
return with_alpha || !inputs_have_alpha ? "vInput3" : "vInput3.rgb";
|
||||
case SHADER_INPUT_4:
|
||||
return with_alpha || !inputs_have_alpha ? "vInput4" : "vInput4.rgb";
|
||||
case SHADER_TEXEL0:
|
||||
return with_alpha ? "texVal0" : "texVal0.rgb";
|
||||
case SHADER_TEXEL0A:
|
||||
return hint_single_element ? "texVal0.a" : (with_alpha ? "vec4(texVal0.a, texVal0.a, texVal0.a, texVal0.a)" : "vec3(texVal0.a, texVal0.a, texVal0.a)");
|
||||
case SHADER_TEXEL1:
|
||||
return with_alpha ? "texVal1" : "texVal1.rgb";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(item)
|
||||
{
|
||||
case SHADER_0:
|
||||
return "0.0";
|
||||
case SHADER_INPUT_1:
|
||||
return "vInput1.a";
|
||||
case SHADER_INPUT_2:
|
||||
return "vInput2.a";
|
||||
case SHADER_INPUT_3:
|
||||
return "vInput3.a";
|
||||
case SHADER_INPUT_4:
|
||||
return "vInput4.a";
|
||||
case SHADER_TEXEL0:
|
||||
return "texVal0.a";
|
||||
case SHADER_TEXEL0A:
|
||||
return "texVal0.a";
|
||||
case SHADER_TEXEL1:
|
||||
return "texVal1.a";
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void append_formula(char* buf, size_t* len, u8 c[2][4], bool do_single, bool do_multiply, bool do_mix, bool with_alpha, bool only_alpha, bool opt_alpha)
|
||||
{
|
||||
if(do_single)
|
||||
{
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][3], with_alpha, only_alpha, opt_alpha, false));
|
||||
}
|
||||
else if(do_multiply)
|
||||
{
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][0], with_alpha, only_alpha, opt_alpha, false));
|
||||
append_str(buf, len, " * ");
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][2], with_alpha, only_alpha, opt_alpha, true));
|
||||
}
|
||||
else if(do_mix)
|
||||
{
|
||||
append_str(buf, len, "mix(");
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][1], with_alpha, only_alpha, opt_alpha, false));
|
||||
append_str(buf, len, ", ");
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][0], with_alpha, only_alpha, opt_alpha, false));
|
||||
append_str(buf, len, ", ");
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][2], with_alpha, only_alpha, opt_alpha, true));
|
||||
append_str(buf, len, ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
append_str(buf, len, "(");
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][0], with_alpha, only_alpha, opt_alpha, false));
|
||||
append_str(buf, len, " - ");
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][1], with_alpha, only_alpha, opt_alpha, false));
|
||||
append_str(buf, len, ") * ");
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][2], with_alpha, only_alpha, opt_alpha, true));
|
||||
append_str(buf, len, " + ");
|
||||
append_str(buf, len, shader_item_to_str(c[only_alpha][3], with_alpha, only_alpha, opt_alpha, false));
|
||||
}
|
||||
}
|
||||
|
||||
struct ShaderProgram* create_and_load_new_shader(u32 shader_id)
|
||||
{
|
||||
struct CCFeatures cc_features;
|
||||
gfx_cc_get_features(shader_id, &cc_features);
|
||||
|
||||
char vs_buf[1024];
|
||||
char fs_buf[1024];
|
||||
size_t vs_len = 0;
|
||||
size_t fs_len = 0;
|
||||
size_t num_floats = 4;
|
||||
|
||||
// Vertex shader
|
||||
append_line(vs_buf, &vs_len, SHADER_VERSION);
|
||||
append_line(vs_buf, &vs_len, "attribute vec4 aVtxPos;");
|
||||
append_line(vs_buf, &vs_len, "uniform mat4 MVP;");
|
||||
|
||||
if(cc_features.used_textures[0] || cc_features.used_textures[1])
|
||||
{
|
||||
append_line(vs_buf, &vs_len, "attribute vec2 aTexCoord;");
|
||||
append_line(vs_buf, &vs_len, "varying vec2 vTexCoord;");
|
||||
num_floats += 2;
|
||||
}
|
||||
|
||||
if(cc_features.opt_fog)
|
||||
{
|
||||
append_line(vs_buf, &vs_len, "uniform vec4 aFog;");
|
||||
append_line(vs_buf, &vs_len, "uniform float fogScaler;");
|
||||
append_line(vs_buf, &vs_len, "uniform float fogOffset;");
|
||||
append_line(vs_buf, &vs_len, "varying vec4 vFog;");
|
||||
}
|
||||
|
||||
for(int i = 0; i < cc_features.num_inputs; i++)
|
||||
{
|
||||
vs_len += sprintf(vs_buf + vs_len, "attribute vec%d aInput%d;\n", cc_features.opt_alpha ? 4 : 3, i + 1);
|
||||
vs_len += sprintf(vs_buf + vs_len, "varying vec%d vInput%d;\n", cc_features.opt_alpha ? 4 : 3, i + 1);
|
||||
num_floats += cc_features.opt_alpha ? 4 : 3;
|
||||
}
|
||||
|
||||
append_line(vs_buf, &vs_len, "void main() {");
|
||||
if(cc_features.used_textures[0] || cc_features.used_textures[1])
|
||||
{
|
||||
append_line(vs_buf, &vs_len, "vTexCoord = aTexCoord;");
|
||||
}
|
||||
|
||||
/*if (cc_features.opt_fog)
|
||||
{
|
||||
append_line(vs_buf, &vs_len, "vFog = aFog;");
|
||||
}*/
|
||||
|
||||
for(int i = 0; i < cc_features.num_inputs; i++)
|
||||
{
|
||||
vs_len += sprintf(vs_buf + vs_len, "vInput%d = aInput%d;\n", i + 1, i + 1);
|
||||
}
|
||||
|
||||
append_line(vs_buf, &vs_len, "gl_Position = MVP * aVtxPos;");
|
||||
|
||||
if(cc_features.opt_fog)
|
||||
{
|
||||
append_line(vs_buf, &vs_len, "vFog = aFog;");
|
||||
append_line(vs_buf, &vs_len, "float w = gl_Position.w != 0.0 ? gl_Position.w : 0.001;");
|
||||
append_line(vs_buf, &vs_len, "vFog[3] = clamp(((gl_Position.z / (w < 0.0 ? 32767.0 : w)) * fogScaler + fogOffset) / 255.0, 0.0, 1.0);");
|
||||
}
|
||||
append_line(vs_buf, &vs_len, "}");
|
||||
|
||||
// Fragment shader
|
||||
append_line(fs_buf, &fs_len, SHADER_VERSION);
|
||||
// append_line(fs_buf, &fs_len, "precision mediump float;");
|
||||
if(cc_features.used_textures[0] || cc_features.used_textures[1])
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "varying vec2 vTexCoord;");
|
||||
}
|
||||
if(cc_features.opt_fog)
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "varying vec4 vFog;");
|
||||
}
|
||||
for(int i = 0; i < cc_features.num_inputs; i++)
|
||||
{
|
||||
fs_len += sprintf(fs_buf + fs_len, "varying vec%d vInput%d;\n", cc_features.opt_alpha ? 4 : 3, i + 1);
|
||||
}
|
||||
if(cc_features.used_textures[0])
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "uniform sampler2D uTex0;");
|
||||
}
|
||||
if(cc_features.used_textures[1])
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "uniform sampler2D uTex1;");
|
||||
}
|
||||
|
||||
if(cc_features.opt_alpha && cc_features.opt_noise)
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "uniform int frame_count;");
|
||||
append_line(fs_buf, &fs_len, "uniform int window_height;");
|
||||
|
||||
append_line(fs_buf, &fs_len, "float random(in vec3 value) {");
|
||||
append_line(fs_buf, &fs_len, " float random = dot(sin(value), vec3(12.9898, 78.233, 37.719));");
|
||||
append_line(fs_buf, &fs_len, " return fract(sin(random) * 143758.5453);");
|
||||
append_line(fs_buf, &fs_len, "}");
|
||||
}
|
||||
|
||||
append_line(fs_buf, &fs_len, "void main() {");
|
||||
|
||||
if(cc_features.used_textures[0])
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "vec4 texVal0 = texture2D(uTex0, vTexCoord);");
|
||||
}
|
||||
if(cc_features.used_textures[1])
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "vec4 texVal1 = texture2D(uTex1, vTexCoord);");
|
||||
}
|
||||
|
||||
append_str(fs_buf, &fs_len, cc_features.opt_alpha ? "vec4 texel = " : "vec3 texel = ");
|
||||
if(!cc_features.color_alpha_same && cc_features.opt_alpha)
|
||||
{
|
||||
append_str(fs_buf, &fs_len, "vec4(");
|
||||
append_formula(fs_buf, &fs_len, cc_features.c, cc_features.do_single[0], cc_features.do_multiply[0], cc_features.do_mix[0], false, false, true);
|
||||
append_str(fs_buf, &fs_len, ", ");
|
||||
append_formula(fs_buf, &fs_len, cc_features.c, cc_features.do_single[1], cc_features.do_multiply[1], cc_features.do_mix[1], true, true, true);
|
||||
append_str(fs_buf, &fs_len, ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
append_formula(fs_buf, &fs_len, cc_features.c, cc_features.do_single[0], cc_features.do_multiply[0], cc_features.do_mix[0], cc_features.opt_alpha, false, cc_features.opt_alpha);
|
||||
}
|
||||
append_line(fs_buf, &fs_len, ";");
|
||||
|
||||
if(cc_features.opt_texture_edge && cc_features.opt_alpha)
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "if (texel.a > 0.3) texel.a = 1.0; else discard;");
|
||||
}
|
||||
// TODO discard if alpha is 0?
|
||||
if(cc_features.opt_fog)
|
||||
{
|
||||
if(cc_features.opt_alpha)
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "texel = vec4(mix(texel.rgb, vFog.rgb, vFog.a), texel.a);");
|
||||
}
|
||||
else
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "texel = mix(texel, vFog.rgb, vFog.a);");
|
||||
}
|
||||
}
|
||||
|
||||
if(cc_features.opt_alpha && cc_features.opt_noise)
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "texel.a *= floor(random(vec3(floor(gl_FragCoord.xy), float(frame_count))) + 0.5);");
|
||||
}
|
||||
|
||||
if(cc_features.opt_alpha)
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "gl_FragColor = texel;");
|
||||
}
|
||||
else
|
||||
{
|
||||
append_line(fs_buf, &fs_len, "gl_FragColor = vec4(texel, 1.0);");
|
||||
}
|
||||
append_line(fs_buf, &fs_len, "}");
|
||||
|
||||
vs_buf[vs_len] = '\0';
|
||||
fs_buf[fs_len] = '\0';
|
||||
|
||||
const GLchar* sources[2] = {vs_buf, fs_buf};
|
||||
const GLint lengths[2] = {vs_len, fs_len};
|
||||
GLint success;
|
||||
|
||||
GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
||||
glShaderSource(vertex_shader, 1, &sources[0], &lengths[0]);
|
||||
glCompileShader(vertex_shader);
|
||||
glGetShaderiv(vertex_shader, GL_COMPILE_STATUS, &success);
|
||||
if(!success)
|
||||
{
|
||||
GLint max_length = 0;
|
||||
glGetShaderiv(vertex_shader, GL_INFO_LOG_LENGTH, &max_length);
|
||||
char error_log[1024];
|
||||
fprintf(stderr, "Vertex shader compilation failed\n");
|
||||
glGetShaderInfoLog(vertex_shader, max_length, &max_length, &error_log[0]);
|
||||
fprintf(stderr, "%s\n", &error_log[0]);
|
||||
abort();
|
||||
}
|
||||
|
||||
GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(fragment_shader, 1, &sources[1], &lengths[1]);
|
||||
glCompileShader(fragment_shader);
|
||||
glGetShaderiv(fragment_shader, GL_COMPILE_STATUS, &success);
|
||||
if(!success)
|
||||
{
|
||||
GLint max_length = 0;
|
||||
glGetShaderiv(fragment_shader, GL_INFO_LOG_LENGTH, &max_length);
|
||||
char error_log[1024];
|
||||
fprintf(stderr, "Fragment shader compilation failed\n");
|
||||
glGetShaderInfoLog(fragment_shader, max_length, &max_length, &error_log[0]);
|
||||
fprintf(stderr, "%s\n", &error_log[0]);
|
||||
abort();
|
||||
}
|
||||
|
||||
GLuint shader_program = glCreateProgram();
|
||||
glAttachShader(shader_program, vertex_shader);
|
||||
glAttachShader(shader_program, fragment_shader);
|
||||
glLinkProgram(shader_program);
|
||||
|
||||
size_t cnt = 0;
|
||||
|
||||
struct ShaderProgram* prg = &shader_program_pool[shader_program_pool_size++];
|
||||
prg->attrib_locations[cnt] = glGetAttribLocation(shader_program, "aVtxPos");
|
||||
prg->attrib_sizes[cnt] = 4;
|
||||
++cnt;
|
||||
|
||||
if(cc_features.used_textures[0] || cc_features.used_textures[1])
|
||||
{
|
||||
prg->attrib_locations[cnt] = glGetAttribLocation(shader_program, "aTexCoord");
|
||||
prg->attrib_sizes[cnt] = 2;
|
||||
++cnt;
|
||||
}
|
||||
|
||||
if(cc_features.opt_fog)
|
||||
{
|
||||
prg->fog_scaler_location = glGetUniformLocation(shader_program, "fogScaler");
|
||||
prg->fog_offset_location = glGetUniformLocation(shader_program, "fogOffset");
|
||||
prg->fog_color_location = glGetUniformLocation(shader_program, "aFog");
|
||||
prg->used_fog = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
prg->used_fog = false;
|
||||
}
|
||||
|
||||
for(int i = 0; i < cc_features.num_inputs; i++)
|
||||
{
|
||||
char name[16];
|
||||
sprintf(name, "aInput%d", i + 1);
|
||||
prg->attrib_locations[cnt] = glGetAttribLocation(shader_program, name);
|
||||
prg->attrib_sizes[cnt] = cc_features.opt_alpha ? 4 : 3;
|
||||
++cnt;
|
||||
}
|
||||
|
||||
prg->shader_id = shader_id;
|
||||
prg->opengl_program_id = shader_program;
|
||||
prg->num_inputs = cc_features.num_inputs;
|
||||
prg->used_textures[0] = cc_features.used_textures[0];
|
||||
prg->used_textures[1] = cc_features.used_textures[1];
|
||||
prg->num_floats = num_floats;
|
||||
prg->num_attribs = cnt;
|
||||
|
||||
load_shader(prg);
|
||||
|
||||
if(cc_features.used_textures[0])
|
||||
{
|
||||
GLint sampler_location = glGetUniformLocation(shader_program, "uTex0");
|
||||
glUniform1i(sampler_location, 0);
|
||||
}
|
||||
if(cc_features.used_textures[1])
|
||||
{
|
||||
GLint sampler_location = glGetUniformLocation(shader_program, "uTex1");
|
||||
glUniform1i(sampler_location, 1);
|
||||
}
|
||||
|
||||
if(cc_features.opt_alpha && cc_features.opt_noise)
|
||||
{
|
||||
prg->frame_count_location = glGetUniformLocation(shader_program, "frame_count");
|
||||
prg->window_height_location = glGetUniformLocation(shader_program, "window_height");
|
||||
prg->used_noise = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
prg->used_noise = false;
|
||||
}
|
||||
|
||||
set_uniforms(prg);
|
||||
|
||||
return prg;
|
||||
}
|
||||
|
||||
ShaderProgram* lookup_shader(u32 shader_id)
|
||||
{
|
||||
for(size_t i = 0; i < shader_program_pool_size; i++)
|
||||
{
|
||||
if(shader_program_pool[i].shader_id == shader_id)
|
||||
{
|
||||
return &shader_program_pool[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void shader_get_info(struct ShaderProgram* prg, u8* num_inputs, bool used_textures[2])
|
||||
{
|
||||
*num_inputs = prg->num_inputs;
|
||||
used_textures[0] = prg->used_textures[0];
|
||||
used_textures[1] = prg->used_textures[1];
|
||||
}
|
||||
|
||||
GLuint new_texture()
|
||||
{
|
||||
GLuint ret;
|
||||
glGenTextures(1, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void select_texture(int tile, TextureNode& node)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + tile);
|
||||
glBindTexture(GL_TEXTURE_2D, node.texture_id);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
//#define ENABLE_MIPMAP
|
||||
#endif
|
||||
|
||||
void upload_texture(const u8* rgba32_buf, int width, int height, TextureNode& node)
|
||||
{
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba32_buf);
|
||||
#ifdef ENABLE_MIPMAP
|
||||
node.mipmap = width * height > 64 * 32;
|
||||
if(node.mipmap)
|
||||
{
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static u32 gfx_cm_to_opengl(u32 val)
|
||||
{
|
||||
if(val & G_TX_CLAMP)
|
||||
{
|
||||
return GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
return (val & G_TX_MIRROR) ? GL_MIRRORED_REPEAT : GL_REPEAT;
|
||||
}
|
||||
|
||||
void set_sampler_parameters(int tile, TextureNode& node)
|
||||
{
|
||||
#ifdef ENABLE_MIPMAP
|
||||
if(node.mipmap)
|
||||
{
|
||||
const int configMipMapMaxLevel = 1000;
|
||||
|
||||
// const GLenum filter = linear_filter ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST;
|
||||
const GLenum filter = node.linear_filter ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST;
|
||||
glActiveTexture(GL_TEXTURE0 + tile);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, configMipMapMaxLevel);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gfx_cm_to_opengl(node.cms));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gfx_cm_to_opengl(node.cmt));
|
||||
}
|
||||
else
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + tile);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, node.linear_filter ? GL_LINEAR : GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, node.linear_filter ? GL_LINEAR : GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gfx_cm_to_opengl(node.cms));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gfx_cm_to_opengl(node.cmt));
|
||||
}
|
||||
#else
|
||||
glActiveTexture(GL_TEXTURE0 + tile);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, node.linear_filter ? GL_LINEAR : GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, node.linear_filter ? GL_LINEAR : GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gfx_cm_to_opengl(node.cms));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gfx_cm_to_opengl(node.cmt));
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_depth_test(bool depth_test)
|
||||
{
|
||||
if(depth_test)
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
void set_depth_mask(bool z_upd)
|
||||
{
|
||||
glDepthMask(z_upd ? GL_TRUE : GL_FALSE);
|
||||
}
|
||||
|
||||
void set_zmode_decal(bool zmode_decal)
|
||||
{
|
||||
if(zmode_decal)
|
||||
{
|
||||
glPolygonOffset(-2, -2);
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
}
|
||||
else
|
||||
{
|
||||
glPolygonOffset(0, 0);
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
}
|
||||
}
|
||||
|
||||
void set_viewport(int x, int y, int width, int height)
|
||||
{
|
||||
glViewport(x, y, width, height);
|
||||
current_height = height;
|
||||
}
|
||||
|
||||
void set_scissor(int x, int y, int width, int height)
|
||||
{
|
||||
glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
void set_use_alpha(bool use_alpha)
|
||||
{
|
||||
if(use_alpha)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
u64 create_vbo()
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenBuffers(1, &handle);
|
||||
|
||||
return (u64)handle;
|
||||
}
|
||||
|
||||
u64 create_vbo(float buf_vbo[], size_t buf_vbo_len)
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenBuffers(1, &handle);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, handle);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * buf_vbo_len, buf_vbo, GL_STATIC_DRAW);
|
||||
|
||||
return (u64)handle;
|
||||
}
|
||||
|
||||
void update_vbo(u64 handle, float buf_vbo[], size_t buf_vbo_len)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, handle);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * buf_vbo_len, buf_vbo, GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
u64 delete_vbo(u64 handle)
|
||||
{
|
||||
GLuint _handle = (GLuint)handle;
|
||||
glDeleteBuffers(1, &_handle);
|
||||
return INVALID_VBO;
|
||||
}
|
||||
|
||||
void setFogColor(float r, float g, float b, float a)
|
||||
{
|
||||
fog.color[0] = r;
|
||||
fog.color[1] = g;
|
||||
fog.color[2] = b;
|
||||
fog.color[3] = a;
|
||||
}
|
||||
|
||||
void setFogMetrics(float scaler, float offset)
|
||||
{
|
||||
fog.scaler = scaler;
|
||||
fog.offset = offset;
|
||||
}
|
||||
|
||||
void set_transformation(float* mvp)
|
||||
{
|
||||
GLint shader_id = glGetUniformLocation(current_program->opengl_program_id, "MVP");
|
||||
static const GLfloat identity[4][4] = {{1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}};
|
||||
|
||||
if(mvp)
|
||||
{
|
||||
glUniformMatrix4fv(shader_id, 1, GL_FALSE, mvp);
|
||||
}
|
||||
else
|
||||
{
|
||||
glUniformMatrix4fv(shader_id, 1, GL_FALSE, &identity[0][0]);
|
||||
}
|
||||
}
|
||||
|
||||
void draw_triangles(u64 handle, size_t buf_vbo_num_tris, float* mvp)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, (GLuint)handle);
|
||||
reload_shader();
|
||||
|
||||
set_transformation(mvp);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3 * buf_vbo_num_tris);
|
||||
// reload_shader();
|
||||
}
|
||||
|
||||
void draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t buf_vbo_num_tris, float* mvp)
|
||||
{
|
||||
// printf("flushing %d tris\n", buf_vbo_num_tris);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * buf_vbo_len, buf_vbo, GL_STREAM_DRAW);
|
||||
reload_shader();
|
||||
set_transformation(mvp);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3 * buf_vbo_num_tris);
|
||||
}
|
||||
|
||||
void on_resize()
|
||||
{
|
||||
}
|
||||
|
||||
void start_frame()
|
||||
{
|
||||
frame_count++;
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDepthMask(GL_TRUE); // Must be set to clear Z-buffer
|
||||
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
void end_frame()
|
||||
{
|
||||
// glFinish();
|
||||
}
|
||||
|
||||
static void finish_render()
|
||||
{
|
||||
}
|
||||
};
|
||||
} // namespace sm64::gfx::opengl
|
File diff suppressed because it is too large
Load Diff
|
@ -1,39 +0,0 @@
|
|||
#pragma once
|
||||
//#include "types.h"
|
||||
#include <mutex>
|
||||
|
||||
struct GfxDimensions
|
||||
{
|
||||
u32 width;
|
||||
u32 height;
|
||||
float aspect_ratio;
|
||||
float adjust_ratio;
|
||||
};
|
||||
|
||||
extern GfxDimensions gfx_current_dimensions;
|
||||
|
||||
namespace sm64::gfx
|
||||
{
|
||||
class Fast64
|
||||
{
|
||||
public:
|
||||
void start_frame();
|
||||
void end_frame();
|
||||
void run_loop();
|
||||
void run_paced_loop();
|
||||
void run_locked_loop();
|
||||
void physics_loop();
|
||||
void run(Gfx* commands);
|
||||
|
||||
static Fast64* createContext();
|
||||
|
||||
protected:
|
||||
std::mutex m_mutex;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> m_nextFrameTime;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> m_currentFrameStartTime;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> m_lastFrameTime;
|
||||
std::chrono::duration<u64, std::micro> m_lastFrameDuration;
|
||||
std::chrono::duration<u64, std::micro> m_lastSwapDuration;
|
||||
std::chrono::microseconds m_refreshRate;
|
||||
};
|
||||
} // namespace sm64::gfx
|
|
@ -1,49 +0,0 @@
|
|||
#include "gfx_cc.h"
|
||||
|
||||
void gfx_cc_get_features(uint32_t shader_id, struct CCFeatures* cc_features)
|
||||
{
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
cc_features->c[0][i] = (shader_id >> (i * 3)) & 7;
|
||||
cc_features->c[1][i] = (shader_id >> (12 + i * 3)) & 7;
|
||||
}
|
||||
|
||||
cc_features->opt_alpha = (shader_id & SHADER_OPT_ALPHA) != 0;
|
||||
cc_features->opt_fog = (shader_id & SHADER_OPT_FOG) != 0;
|
||||
cc_features->opt_texture_edge = (shader_id & SHADER_OPT_TEXTURE_EDGE) != 0;
|
||||
cc_features->opt_noise = (shader_id & SHADER_OPT_NOISE) != 0;
|
||||
|
||||
cc_features->used_textures[0] = false;
|
||||
cc_features->used_textures[1] = false;
|
||||
cc_features->num_inputs = 0;
|
||||
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
for(int j = 0; j < 4; j++)
|
||||
{
|
||||
if(cc_features->c[i][j] >= SHADER_INPUT_1 && cc_features->c[i][j] <= SHADER_INPUT_4)
|
||||
{
|
||||
if(cc_features->c[i][j] > cc_features->num_inputs)
|
||||
{
|
||||
cc_features->num_inputs = cc_features->c[i][j];
|
||||
}
|
||||
}
|
||||
if(cc_features->c[i][j] == SHADER_TEXEL0 || cc_features->c[i][j] == SHADER_TEXEL0A)
|
||||
{
|
||||
cc_features->used_textures[0] = true;
|
||||
}
|
||||
if(cc_features->c[i][j] == SHADER_TEXEL1)
|
||||
{
|
||||
cc_features->used_textures[1] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cc_features->do_single[0] = cc_features->c[0][2] == 0;
|
||||
cc_features->do_single[1] = cc_features->c[1][2] == 0;
|
||||
cc_features->do_multiply[0] = cc_features->c[0][1] == 0 && cc_features->c[0][3] == 0;
|
||||
cc_features->do_multiply[1] = cc_features->c[1][1] == 0 && cc_features->c[1][3] == 0;
|
||||
cc_features->do_mix[0] = cc_features->c[0][1] == cc_features->c[0][3];
|
||||
cc_features->do_mix[1] = cc_features->c[1][1] == cc_features->c[1][3];
|
||||
cc_features->color_alpha_same = (shader_id & 0xfff) == ((shader_id >> 12) & 0xfff);
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
#ifndef GFX_CC_H
|
||||
#define GFX_CC_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum
|
||||
{
|
||||
CC_0,
|
||||
CC_TEXEL0,
|
||||
CC_TEXEL1,
|
||||
CC_PRIM,
|
||||
CC_SHADE,
|
||||
CC_ENV,
|
||||
CC_TEXEL0A,
|
||||
CC_LOD
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SHADER_0,
|
||||
SHADER_INPUT_1,
|
||||
SHADER_INPUT_2,
|
||||
SHADER_INPUT_3,
|
||||
SHADER_INPUT_4,
|
||||
SHADER_TEXEL0,
|
||||
SHADER_TEXEL0A,
|
||||
SHADER_TEXEL1
|
||||
};
|
||||
|
||||
#define SHADER_OPT_ALPHA (1 << 24)
|
||||
#define SHADER_OPT_FOG (1 << 25)
|
||||
#define SHADER_OPT_TEXTURE_EDGE (1 << 26)
|
||||
#define SHADER_OPT_NOISE (1 << 27)
|
||||
|
||||
struct CCFeatures
|
||||
{
|
||||
uint8_t c[2][4];
|
||||
bool opt_alpha;
|
||||
bool opt_fog;
|
||||
bool opt_texture_edge;
|
||||
bool opt_noise;
|
||||
bool used_textures[2];
|
||||
int num_inputs;
|
||||
bool do_single[2];
|
||||
bool do_multiply[2];
|
||||
bool do_mix[2];
|
||||
bool color_alpha_same;
|
||||
};
|
||||
|
||||
void gfx_cc_get_features(uint32_t shader_id, struct CCFeatures* cc_features);
|
||||
|
||||
#endif
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef GFX_SCREEN_CONFIG_H
|
||||
#define GFX_SCREEN_CONFIG_H
|
||||
|
||||
#define DESIRED_SCREEN_WIDTH 1280
|
||||
#define DESIRED_SCREEN_HEIGHT 720
|
||||
|
||||
#endif
|
|
@ -1,22 +0,0 @@
|
|||
#ifdef _MSC_VER
|
||||
#include <windows.h>
|
||||
#include <chrono>
|
||||
#include "global.h"
|
||||
#include "types.h"
|
||||
|
||||
unsigned long get_time(void) // returns microseconds
|
||||
{
|
||||
return (unsigned long)std::chrono::high_resolution_clock::now().time_since_epoch().count() / 1000;
|
||||
}
|
||||
|
||||
u64 getTickCount()
|
||||
{
|
||||
return GetTickCount();
|
||||
}
|
||||
|
||||
void sleep(u64 ms)
|
||||
{
|
||||
return Sleep(ms);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,61 +0,0 @@
|
|||
#pragma once
|
||||
#include "types.h"
|
||||
#include <chrono>
|
||||
|
||||
extern void create_next_audio_buffer(s16* samples, u32 num_samples);
|
||||
//void send_display_list(SPTask* spTask);
|
||||
void game_loop_one_iteration();
|
||||
void process_physics();
|
||||
//void dispatch_audio_sptask(SPTask* spTask);
|
||||
|
||||
void game_init(void* arg);
|
||||
void create_next_audio_buffer(s16* samples, u32 num_samples);
|
||||
|
||||
namespace sm64::gfx::platform
|
||||
{
|
||||
class Base
|
||||
{
|
||||
public:
|
||||
virtual void set_fullscreen_changed_callback(void (*on_fullscreen_changed)(bool is_now_fullscreen)) = 0;
|
||||
virtual void set_fullscreen(bool enable, bool call_callback) = 0;
|
||||
virtual void get_dimensions(uint32_t* width, uint32_t* height) = 0;
|
||||
virtual void handle_events() = 0;
|
||||
virtual bool begin_frame() = 0;
|
||||
virtual bool end_frame() = 0;
|
||||
virtual void swap_buffers_begin() = 0;
|
||||
virtual void swap_buffers_end() = 0;
|
||||
|
||||
void produce_one_frame()
|
||||
{
|
||||
begin_frame();
|
||||
game_loop_one_iteration();
|
||||
|
||||
/*int samples_left = audio_api->buffered();
|
||||
u32 num_audio_samples = samples_left < audio_api->get_desired_buffered() ? 544 : 528;
|
||||
|
||||
#ifdef ENABLE_60FPS
|
||||
s16 audio_buffer[544 * 2];
|
||||
create_next_audio_buffer(audio_buffer, num_audio_samples);
|
||||
audio_api->play((const u8*)audio_buffer, num_audio_samples * 4);
|
||||
#else
|
||||
s16 audio_buffer[544 * 2 * 2];
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
create_next_audio_buffer(audio_buffer + i * (num_audio_samples * 2), num_audio_samples);
|
||||
}
|
||||
audio_api->play((const u8*)audio_buffer, 2 * num_audio_samples * 4);
|
||||
#endif
|
||||
*/
|
||||
|
||||
end_frame();
|
||||
}
|
||||
|
||||
const std::chrono::microseconds& refreshInterval() const
|
||||
{
|
||||
return m_refreshInterval;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::chrono::microseconds m_refreshInterval;
|
||||
};
|
||||
} // namespace sm64::gfx::platform
|
|
@ -1,336 +0,0 @@
|
|||
#ifdef _WIN32
|
||||
#include <GL/glew.h>
|
||||
#include "SDL2/SDL.h"
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#include "SDL2/SDL_opengl.h"
|
||||
#else
|
||||
#include <SDL2/SDL.h>
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#include <SDL2/SDL_opengles2.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include "driver_opengl.h"
|
||||
#include "platform.h"
|
||||
|
||||
#include "gfx_screen_config.h"
|
||||
|
||||
#define GFX_API_NAME "SDL2 - OpenGL"
|
||||
|
||||
namespace sm64::gfx::platform
|
||||
{
|
||||
static const SDL_Scancode windows_scancode_table[] = {
|
||||
/* 0 1 2 3 4 5 6 7
|
||||
*/
|
||||
/* 8 9 A B C D E F
|
||||
*/
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_ESCAPE,
|
||||
SDL_SCANCODE_1,
|
||||
SDL_SCANCODE_2,
|
||||
SDL_SCANCODE_3,
|
||||
SDL_SCANCODE_4,
|
||||
SDL_SCANCODE_5,
|
||||
SDL_SCANCODE_6, /* 0 */
|
||||
SDL_SCANCODE_7,
|
||||
SDL_SCANCODE_8,
|
||||
SDL_SCANCODE_9,
|
||||
SDL_SCANCODE_0,
|
||||
SDL_SCANCODE_MINUS,
|
||||
SDL_SCANCODE_EQUALS,
|
||||
SDL_SCANCODE_BACKSPACE,
|
||||
SDL_SCANCODE_TAB, /* 0 */
|
||||
|
||||
SDL_SCANCODE_Q,
|
||||
SDL_SCANCODE_W,
|
||||
SDL_SCANCODE_E,
|
||||
SDL_SCANCODE_R,
|
||||
SDL_SCANCODE_T,
|
||||
SDL_SCANCODE_Y,
|
||||
SDL_SCANCODE_U,
|
||||
SDL_SCANCODE_I, /* 1 */
|
||||
SDL_SCANCODE_O,
|
||||
SDL_SCANCODE_P,
|
||||
SDL_SCANCODE_LEFTBRACKET,
|
||||
SDL_SCANCODE_RIGHTBRACKET,
|
||||
SDL_SCANCODE_RETURN,
|
||||
SDL_SCANCODE_LCTRL,
|
||||
SDL_SCANCODE_A,
|
||||
SDL_SCANCODE_S, /* 1 */
|
||||
|
||||
SDL_SCANCODE_D,
|
||||
SDL_SCANCODE_F,
|
||||
SDL_SCANCODE_G,
|
||||
SDL_SCANCODE_H,
|
||||
SDL_SCANCODE_J,
|
||||
SDL_SCANCODE_K,
|
||||
SDL_SCANCODE_L,
|
||||
SDL_SCANCODE_SEMICOLON, /* 2 */
|
||||
SDL_SCANCODE_APOSTROPHE,
|
||||
SDL_SCANCODE_GRAVE,
|
||||
SDL_SCANCODE_LSHIFT,
|
||||
SDL_SCANCODE_BACKSLASH,
|
||||
SDL_SCANCODE_Z,
|
||||
SDL_SCANCODE_X,
|
||||
SDL_SCANCODE_C,
|
||||
SDL_SCANCODE_V, /* 2 */
|
||||
|
||||
SDL_SCANCODE_B,
|
||||
SDL_SCANCODE_N,
|
||||
SDL_SCANCODE_M,
|
||||
SDL_SCANCODE_COMMA,
|
||||
SDL_SCANCODE_PERIOD,
|
||||
SDL_SCANCODE_SLASH,
|
||||
SDL_SCANCODE_RSHIFT,
|
||||
SDL_SCANCODE_PRINTSCREEN, /* 3 */
|
||||
SDL_SCANCODE_LALT,
|
||||
SDL_SCANCODE_SPACE,
|
||||
SDL_SCANCODE_CAPSLOCK,
|
||||
SDL_SCANCODE_F1,
|
||||
SDL_SCANCODE_F2,
|
||||
SDL_SCANCODE_F3,
|
||||
SDL_SCANCODE_F4,
|
||||
SDL_SCANCODE_F5, /* 3 */
|
||||
|
||||
SDL_SCANCODE_F6,
|
||||
SDL_SCANCODE_F7,
|
||||
SDL_SCANCODE_F8,
|
||||
SDL_SCANCODE_F9,
|
||||
SDL_SCANCODE_F10,
|
||||
SDL_SCANCODE_NUMLOCKCLEAR,
|
||||
SDL_SCANCODE_SCROLLLOCK,
|
||||
SDL_SCANCODE_HOME, /* 4 */
|
||||
SDL_SCANCODE_UP,
|
||||
SDL_SCANCODE_PAGEUP,
|
||||
SDL_SCANCODE_KP_MINUS,
|
||||
SDL_SCANCODE_LEFT,
|
||||
SDL_SCANCODE_KP_5,
|
||||
SDL_SCANCODE_RIGHT,
|
||||
SDL_SCANCODE_KP_PLUS,
|
||||
SDL_SCANCODE_END, /* 4 */
|
||||
|
||||
SDL_SCANCODE_DOWN,
|
||||
SDL_SCANCODE_PAGEDOWN,
|
||||
SDL_SCANCODE_INSERT,
|
||||
SDL_SCANCODE_DELETE,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_NONUSBACKSLASH,
|
||||
SDL_SCANCODE_F11, /* 5 */
|
||||
SDL_SCANCODE_F12,
|
||||
SDL_SCANCODE_PAUSE,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_LGUI,
|
||||
SDL_SCANCODE_RGUI,
|
||||
SDL_SCANCODE_APPLICATION,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN, /* 5 */
|
||||
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_F13,
|
||||
SDL_SCANCODE_F14,
|
||||
SDL_SCANCODE_F15,
|
||||
SDL_SCANCODE_F16, /* 6 */
|
||||
SDL_SCANCODE_F17,
|
||||
SDL_SCANCODE_F18,
|
||||
SDL_SCANCODE_F19,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN, /* 6 */
|
||||
|
||||
SDL_SCANCODE_INTERNATIONAL2,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_INTERNATIONAL1,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN, /* 7 */
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_INTERNATIONAL4,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_INTERNATIONAL5,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_INTERNATIONAL3,
|
||||
SDL_SCANCODE_UNKNOWN,
|
||||
SDL_SCANCODE_UNKNOWN /* 7 */
|
||||
};
|
||||
|
||||
static const SDL_Scancode scancode_rmapping_nonextended[][2] = {
|
||||
{SDL_SCANCODE_KP_7, SDL_SCANCODE_HOME},
|
||||
{SDL_SCANCODE_KP_8, SDL_SCANCODE_UP},
|
||||
{SDL_SCANCODE_KP_9, SDL_SCANCODE_PAGEUP},
|
||||
{SDL_SCANCODE_KP_4, SDL_SCANCODE_LEFT},
|
||||
{SDL_SCANCODE_KP_6, SDL_SCANCODE_RIGHT},
|
||||
{SDL_SCANCODE_KP_1, SDL_SCANCODE_END},
|
||||
{SDL_SCANCODE_KP_2, SDL_SCANCODE_DOWN},
|
||||
{SDL_SCANCODE_KP_3, SDL_SCANCODE_PAGEDOWN},
|
||||
{SDL_SCANCODE_KP_0, SDL_SCANCODE_INSERT},
|
||||
{SDL_SCANCODE_KP_PERIOD, SDL_SCANCODE_DELETE},
|
||||
{SDL_SCANCODE_KP_MULTIPLY, SDL_SCANCODE_PRINTSCREEN}};
|
||||
|
||||
static const SDL_Scancode scancode_rmapping_extended[][2] = {
|
||||
{SDL_SCANCODE_KP_ENTER, SDL_SCANCODE_RETURN}, {SDL_SCANCODE_RALT, SDL_SCANCODE_LALT}, {SDL_SCANCODE_RCTRL, SDL_SCANCODE_LCTRL}, {SDL_SCANCODE_KP_DIVIDE, SDL_SCANCODE_SLASH},
|
||||
//{SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_CAPSLOCK}
|
||||
};
|
||||
|
||||
static int inverted_scancode_table[512];
|
||||
|
||||
class Sdl : public Base
|
||||
{
|
||||
public:
|
||||
SDL_Window* wnd;
|
||||
|
||||
unsigned int window_width = DESIRED_SCREEN_WIDTH;
|
||||
unsigned int window_height = DESIRED_SCREEN_HEIGHT;
|
||||
bool fullscreen_state;
|
||||
void (*on_fullscreen_changed_callback)(bool is_now_fullscreen) = NULL;
|
||||
|
||||
Sdl(const char* game_name, bool start_in_fullscreen)
|
||||
{
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||
// SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
|
||||
// SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||
// SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||
|
||||
char title[512];
|
||||
int len = sprintf(title, "%s (%s)", game_name, GFX_API_NAME);
|
||||
|
||||
#ifdef __SWITCH__
|
||||
wnd = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
|
||||
#else
|
||||
wnd = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
|
||||
if(start_in_fullscreen)
|
||||
{
|
||||
set_fullscreen(true, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_GL_CreateContext(wnd);
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
set_vsync();
|
||||
}
|
||||
|
||||
void set_fullscreen(bool on, bool call_callback)
|
||||
{
|
||||
#ifndef __SWITCH__
|
||||
if(fullscreen_state == on)
|
||||
{
|
||||
return;
|
||||
}
|
||||
fullscreen_state = on;
|
||||
|
||||
SDL_DisplayMode mode;
|
||||
SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(wnd), &mode);
|
||||
|
||||
m_refreshInterval = std::chrono::microseconds(1000 * 1000 / mode.refresh_rate);
|
||||
|
||||
if(on)
|
||||
{
|
||||
window_width = mode.w;
|
||||
window_height = mode.h;
|
||||
}
|
||||
else
|
||||
{
|
||||
window_width = DESIRED_SCREEN_WIDTH;
|
||||
window_height = DESIRED_SCREEN_HEIGHT;
|
||||
}
|
||||
SDL_SetWindowSize(wnd, window_width, window_height);
|
||||
SDL_SetWindowFullscreen(wnd, on ? SDL_WINDOW_FULLSCREEN : 0);
|
||||
|
||||
if(on_fullscreen_changed_callback != NULL && call_callback)
|
||||
{
|
||||
on_fullscreen_changed_callback(on);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_vsync()
|
||||
{
|
||||
if(SDL_GetNumVideoDisplays() > 0)
|
||||
{
|
||||
SDL_DisplayMode mode;
|
||||
|
||||
if(SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(wnd), &mode) == 0) // assume highest resolution display is the one in use
|
||||
{
|
||||
m_refreshInterval = std::chrono::microseconds(1000 * 1000 / mode.refresh_rate);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_refreshInterval = std::chrono::microseconds(1000 * 1000 / 60); // assume 60 fps
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void set_fullscreen_changed_callback(void (*on_fullscreen_changed)(bool is_now_fullscreen))
|
||||
{
|
||||
on_fullscreen_changed_callback = on_fullscreen_changed;
|
||||
}
|
||||
|
||||
void get_dimensions(u32* width, u32* height)
|
||||
{
|
||||
*width = window_width;
|
||||
*height = window_height;
|
||||
}
|
||||
|
||||
int translate_scancode(int scancode)
|
||||
{
|
||||
if(scancode < 512)
|
||||
{
|
||||
return inverted_scancode_table[scancode];
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void handle_events()
|
||||
{
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case SDL_WINDOWEVENT:
|
||||
if(event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
|
||||
{
|
||||
window_width = event.window.data1;
|
||||
window_height = event.window.data2;
|
||||
}
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool begin_frame()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool end_frame()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void swap_buffers_begin()
|
||||
{
|
||||
SDL_GL_SwapWindow(wnd);
|
||||
}
|
||||
|
||||
void swap_buffers_end()
|
||||
{
|
||||
}
|
||||
};
|
||||
} // namespace sm64::gfx::platform
|
|
@ -1,145 +0,0 @@
|
|||
#pragma once
|
||||
#include "types.h"
|
||||
|
||||
namespace sm64::gfx
|
||||
{
|
||||
struct ShaderProgram;
|
||||
|
||||
const u64 INVALID_VBO = 0xFFFFFFFFFFFFFFFF;
|
||||
|
||||
struct TextureNode
|
||||
{
|
||||
TextureNode() : texture_addr(nullptr), fmt(0), siz(0), texture_id(0), cms(0), cmt(0), linear_filter(0), mipmap(0)
|
||||
{
|
||||
}
|
||||
|
||||
TextureNode(const u8* texture_addr, u8 fmt, u8 siz, bool linear_filter, u8 cms = 0, u8 cmy = 0) : texture_addr(texture_addr), fmt(fmt), siz(siz), texture_id(0), cms(cms), cmt(cmt), linear_filter(linear_filter), mipmap(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool isValid() const
|
||||
{
|
||||
return texture_addr != nullptr;
|
||||
}
|
||||
|
||||
const u8* texture_addr;
|
||||
u8 fmt;
|
||||
u8 siz;
|
||||
|
||||
u32 texture_id;
|
||||
u8 cms;
|
||||
u8 cmt;
|
||||
bool linear_filter;
|
||||
bool mipmap;
|
||||
};
|
||||
|
||||
class Renderer
|
||||
{
|
||||
bool z_is_from_0_to_1()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void unload_shader(ShaderProgram* old_prg)
|
||||
{
|
||||
}
|
||||
|
||||
void load_shader(ShaderProgram* new_prg)
|
||||
{
|
||||
}
|
||||
|
||||
ShaderProgram* create_and_load_new_shader(u32 shader_id)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShaderProgram* lookup_shader(u32 shader_id)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void shader_get_info(ShaderProgram* prg, u8& num_inputs, bool used_textures[2])
|
||||
{
|
||||
num_inputs = 0;
|
||||
}
|
||||
|
||||
u32 new_texture()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void select_texture(int tile, TextureNode& node)
|
||||
{
|
||||
}
|
||||
|
||||
void upload_texture(const u8* rgba32_buf, int width, int height, TextureNode& node)
|
||||
{
|
||||
}
|
||||
|
||||
void set_sampler_parameters(int sampler, TextureNode& node)
|
||||
{
|
||||
}
|
||||
|
||||
void set_depth_test(bool depth_test)
|
||||
{
|
||||
}
|
||||
|
||||
void set_depth_mask(bool z_upd)
|
||||
{
|
||||
}
|
||||
|
||||
void set_zmode_decal(bool zmode_decal)
|
||||
{
|
||||
}
|
||||
|
||||
void set_viewport(int x, int y, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
void set_scissor(int x, int y, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
void set_use_alpha(bool use_alpha)
|
||||
{
|
||||
}
|
||||
|
||||
u64 create_vbo(float buf_vbo[], size_t buf_vbo_len, size_t buf_vbo_num_tris)
|
||||
{
|
||||
return INVALID_VBO;
|
||||
}
|
||||
|
||||
u64 delete_vbo(u64 handle)
|
||||
{
|
||||
return INVALID_VBO;
|
||||
}
|
||||
|
||||
void draw_triangles(u64 handle, size_t buf_vbo_num_tris)
|
||||
{
|
||||
}
|
||||
|
||||
void draw_triangles(float buf_vbo[], size_t buf_vbo_len, size_t buf_vbo_num_tris)
|
||||
{
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
}
|
||||
|
||||
void on_resize()
|
||||
{
|
||||
}
|
||||
|
||||
void start_frame()
|
||||
{
|
||||
}
|
||||
|
||||
void end_frame()
|
||||
{
|
||||
}
|
||||
|
||||
void finish_render()
|
||||
{
|
||||
}
|
||||
};
|
||||
} // namespace sm64::gfx
|
|
@ -1,12 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#define MULTILINE(...) #__VA_ARGS__
|
||||
|
||||
namespace shaders
|
||||
{
|
||||
const char* fogFunc = MULTILINE(vec3 applyFog(in vec3 rgb, in float distance) {
|
||||
float fogAmount = 1.0 - exp(-distance * 1.0);
|
||||
vec3 fogColor = vec3(0.5, 0.6, 0.7);
|
||||
return mix(rgb, fogColor, fogAmount);
|
||||
});
|
||||
}
|
|
@ -1,10 +1,16 @@
|
|||
#define WIN32_LEAN_AND_MEAN
|
||||
#define ENABLE_OPENGL
|
||||
#define USE_GLIDEN64
|
||||
#define DISABLE_AUDIO
|
||||
#include "window.h"
|
||||
#include "options.h"
|
||||
#include "player/players.h"
|
||||
#include "controller/tas.h"
|
||||
#include "../../AziAudio/AziAudio/AudioSpec.h"
|
||||
#include "ultra64/rcp.h"
|
||||
#include "z64audio.h"
|
||||
#include "controller/controllers.h"
|
||||
#include "def/audio_rsp.h"
|
||||
|
||||
static std::unique_ptr<platform::window::Base> gWindow;
|
||||
|
||||
|
@ -31,61 +37,8 @@ extern OSViMode osViModeNtscLan1;
|
|||
#include <filesystem>
|
||||
|
||||
#include "nx.h"
|
||||
#include "audio/audio_api.h"
|
||||
//#include "ultra64/sptask.h"
|
||||
#include "xxhash64.h"
|
||||
#ifdef USE_F3D
|
||||
extern "C" {
|
||||
#include "n64-fast3d-engine/gfx_pc.h"
|
||||
#include "n64-fast3d-engine/gfx_opengl.h"
|
||||
#include "n64-fast3d-engine/gfx_sdl.h"
|
||||
}
|
||||
#elif defined(USE_GLIDEN64)
|
||||
#include "gfxapi.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_CF3D)
|
||||
#include "gfx/fast64.h"
|
||||
#elif defined(USE_RDPP)
|
||||
extern "C" {
|
||||
|
||||
#include "core/n64video.h"
|
||||
#include "output/screen.h"
|
||||
#include "output/vdac.h"
|
||||
|
||||
#define MSG_BUFFER_LEN 256
|
||||
|
||||
void msg_error(const char* err, ...) {
|
||||
va_list arg;
|
||||
va_start(arg, err);
|
||||
char buf[MSG_BUFFER_LEN];
|
||||
vsprintf(buf, err, arg);
|
||||
|
||||
va_end(arg);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void msg_warning(const char* err, ...) {
|
||||
va_list arg;
|
||||
va_start(arg, err);
|
||||
char buf[MSG_BUFFER_LEN];
|
||||
vsprintf(buf, err, arg);
|
||||
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
void msg_debug(const char* err, ...) {
|
||||
va_list arg;
|
||||
va_start(arg, err);
|
||||
char buf[MSG_BUFFER_LEN];
|
||||
vsprintf(buf, err, arg);
|
||||
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
//GfxDimensions gfx_current_dimensions;
|
||||
|
||||
OSMesg D_80339BEC;
|
||||
OSMesgQueue gSIEventMesgQueue;
|
||||
|
@ -93,55 +46,8 @@ OSMesgQueue gSIEventMesgQueue;
|
|||
s8 gResetTimer;
|
||||
s8 D_8032C648;
|
||||
|
||||
#ifndef DISABLE_AUDIO
|
||||
extern AudioAPI audio_sdl;
|
||||
AudioAPI* audio_api = nullptr;
|
||||
|
||||
/*
|
||||
#ifdef ENABLE_SDL_AUDIO
|
||||
#else
|
||||
AudioAPI audio_sdl;
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef USE_CF3D
|
||||
sm64::gfx::Fast64* g_fast64 = nullptr;
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
void send_display_list(Gfx* gfx);
|
||||
}
|
||||
void game_loop_one_iteration(void);
|
||||
void dispatch_audio_sptask(struct SPTask* spTask);
|
||||
|
||||
extern void game_init(void* arg);
|
||||
|
||||
void dispatch_audio_sptask(struct SPTask* spTask)
|
||||
{
|
||||
}
|
||||
|
||||
static uint8_t inited = 0;
|
||||
|
||||
void send_display_list(Gfx* gfx) {
|
||||
if(!inited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#ifdef USE_F3D
|
||||
gfx_start_frame();
|
||||
gfx_run(gfx);
|
||||
gfx_end_frame();
|
||||
#endif
|
||||
//g_fast64->run(gfx);
|
||||
}
|
||||
|
||||
#define printf
|
||||
|
||||
static void save_config(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool verifyIntegrity()
|
||||
{
|
||||
return true; // TODO FIX
|
||||
|
@ -204,38 +110,7 @@ bool verifyIntegrity()
|
|||
}
|
||||
|
||||
void main_func();
|
||||
|
||||
extern "C" {
|
||||
|
||||
void hid_init();
|
||||
void hid_update();
|
||||
}
|
||||
|
||||
extern void* gAudioBuffer;
|
||||
extern u32 gAudioBufferSize;
|
||||
|
||||
void AudioMgr_HandleRetraceNULL();
|
||||
|
||||
|
||||
void audio_thread()
|
||||
{
|
||||
int samples_left = audio_api->buffered();
|
||||
u32 num_audio_samples = samples_left < audio_api->get_desired_buffered() ? 544 : 528;
|
||||
|
||||
s16 audio_buffer[544 * 2 * 2];
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
create_next_audio_buffer(audio_buffer + i * (num_audio_samples * 2), num_audio_samples);
|
||||
}
|
||||
|
||||
AudioMgr_HandleRetraceNULL();
|
||||
|
||||
if(audio_api /* && !config().game().disableSound()*/)
|
||||
{
|
||||
//audio_api->play((const u8*)audio_buffer, 2 * num_audio_samples * 4);
|
||||
audio_api->play((const u8*)gAudioBuffer, gAudioBufferSize);
|
||||
}
|
||||
}
|
||||
void azi_init();
|
||||
|
||||
void main_func(void)
|
||||
{
|
||||
|
@ -248,6 +123,8 @@ void main_func(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
azi_init();
|
||||
|
||||
#ifdef _DEBUG//Record TAS to capture bugs and crashes
|
||||
//oot::hid::tas::playTas(true);//Uncomment to play back TAS/crash report from end-users
|
||||
|
||||
|
@ -255,49 +132,19 @@ void main_func(void)
|
|||
oot::config().game().recordTas(true);
|
||||
#endif
|
||||
|
||||
//static u64 pool[0x165000 / 8 / 4 * sizeof(void*)];
|
||||
//main_pool_init(pool, pool + sizeof(pool) / sizeof(pool[0]));
|
||||
//gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
|
||||
|
||||
#ifdef USE_CF3D
|
||||
g_fast64 = sm64::gfx::Fast64::createContext();
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_AUDIO
|
||||
audio_api = &audio_sdl;
|
||||
if(!audio_api->init())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
//audio_init();
|
||||
//interface_init();
|
||||
|
||||
if (!oot::config().game().isGraphicsDisabled())
|
||||
gWindow = platform::window::create("The Legend of Zelda - Ocarina of Time", false);
|
||||
|
||||
#ifdef USE_F3D
|
||||
gfx_init(&gfx_sdl, &gfx_opengl_api, "Zelda OOT PC-Port", 0);
|
||||
#elif defined(USE_RDPP)
|
||||
n64video_config config;
|
||||
n64video_config_init(&config);
|
||||
n64video_init(&config);
|
||||
|
||||
screen_init(&config);
|
||||
#elif defined(USE_GLIDEN64)
|
||||
if (!oot::config().game().isGraphicsDisabled())
|
||||
{
|
||||
gfx_init("THE LEGEND OF ZELDA", &osViModeNtscLan1);
|
||||
//gfx_fbe_enable(0);//Uncomment to disable frame buffer emulation
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!oot::config().game().isGraphicsDisabled())
|
||||
gWindow->resize(-1, -1);
|
||||
|
||||
hid_init();
|
||||
|
||||
game_init(NULL);
|
||||
oot::hid::InputDeviceManager::get().scan();
|
||||
|
||||
inited = 1;
|
||||
|
||||
|
@ -306,16 +153,6 @@ void main_func(void)
|
|||
gfx_shutdown();
|
||||
}
|
||||
|
||||
void game_loop_one_iteration() {
|
||||
Graph_ThreadEntry(0);
|
||||
}
|
||||
|
||||
void process_physics() {
|
||||
}
|
||||
|
||||
void game_init(void* arg) {
|
||||
}
|
||||
|
||||
#if(defined(_WIN32) || defined(_WIN64)) && defined(_MSC_VER)
|
||||
#include <windows.h>
|
||||
//#include "engine/script.h"
|
||||
|
@ -368,9 +205,6 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
void create_next_audio_buffer(s16* samples, u32 num_samples) {
|
||||
}
|
||||
|
||||
static bool g_isRunning = true;
|
||||
|
||||
extern "C" {
|
||||
|
@ -390,7 +224,17 @@ extern "C" {
|
|||
gWindow->setTargetFrameRate(FRAMERATE_MAX / frameRateDivisor());
|
||||
gWindow->end_frame();
|
||||
}
|
||||
audio_thread();
|
||||
/*for(int i=0; i < 3; i++)
|
||||
{
|
||||
auto task = getAudioTask();
|
||||
|
||||
if(task)
|
||||
{
|
||||
HLEStart((AZI_OSTask*)&task->task.t);
|
||||
AiUpdate(false);
|
||||
}
|
||||
}*/
|
||||
//audio_thread();
|
||||
}
|
||||
|
||||
float gfx_ar_ratio()
|
||||
|
|
|
@ -13,25 +13,11 @@ using namespace oot::hid;
|
|||
Players g_players;
|
||||
|
||||
|
||||
extern "C" {
|
||||
void hid_init() {
|
||||
InputDeviceManager::get().scan();
|
||||
}
|
||||
|
||||
void hid_update() {
|
||||
Players::Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Players& Players::get()
|
||||
{
|
||||
return g_players;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Players::Update()
|
||||
{
|
||||
g_players.update();
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
//#include "ultra64/pi.h"
|
||||
#include "ultra64/vi.h"
|
||||
#include "ultra64/rcp.h"
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include "../../AziAudio/AziAudio/AudioSpec.h"
|
||||
|
||||
extern u32 osTvType;
|
||||
|
||||
|
@ -427,20 +430,17 @@ s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize)
|
|||
|
||||
#include "ultra64/rcp.h"
|
||||
|
||||
void* gAudioBuffer = nullptr;
|
||||
u32 gAudioBufferSize = 0;
|
||||
|
||||
s32 osAiSetNextBuffer(void* buf, u32 size)
|
||||
{
|
||||
static u8 D_80130500 = false;
|
||||
uintptr_t bufAdjusted = (uintptr_t)buf;
|
||||
static u8 D_80130500 = false;
|
||||
u32 bufAdjusted = (u32)buf;
|
||||
s32 status;
|
||||
|
||||
if(D_80130500)
|
||||
{
|
||||
bufAdjusted = (uintptr_t)buf - 0x2000;
|
||||
bufAdjusted = (u32)buf - 0x2000;
|
||||
}
|
||||
if((((uintptr_t)buf + size) & 0x1FFF) == 0)
|
||||
if((((u32)buf + size) & 0x1FFF) == 0)
|
||||
{
|
||||
D_80130500 = true;
|
||||
}
|
||||
|
@ -450,23 +450,28 @@ s32 osAiSetNextBuffer(void* buf, u32 size)
|
|||
}
|
||||
|
||||
// Originally a call to __osAiDeviceBusy
|
||||
/*status = HW_REG(AI_STATUS_REG, s32);
|
||||
status = HW_REG(AI_STATUS_REG, s32);
|
||||
if(status & AI_STATUS_AI_FULL)
|
||||
{
|
||||
return -1;
|
||||
}*/
|
||||
}
|
||||
|
||||
// OS_K0_TO_PHYSICAL replaces osVirtualToPhysical, this replacement
|
||||
// assumes that only KSEG0 addresses are given
|
||||
// HW_REG(AI_DRAM_ADDR_REG, uintptr_t) = bufAdjusted;
|
||||
// HW_REG(AI_LEN_REG, u32) = size;
|
||||
gAudioBuffer = (void*)bufAdjusted;
|
||||
gAudioBufferSize = size;
|
||||
HW_REG(AI_DRAM_ADDR_REG, u32) = bufAdjusted;
|
||||
HW_REG(AI_LEN_REG, u32) = size;
|
||||
AiLenChanged();
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern s32 osViClock;
|
||||
|
||||
u32 osAiGetLength()
|
||||
{
|
||||
AiReadLength();
|
||||
return HW_REG(AI_LEN_REG, u32);
|
||||
}
|
||||
|
||||
s32 osAiSetFrequency(u32 frequency)
|
||||
{
|
||||
u8 bitrate;
|
||||
|
@ -485,7 +490,105 @@ s32 osAiSetFrequency(u32 frequency)
|
|||
bitrate = 16;
|
||||
}
|
||||
|
||||
// HW_REG(AI_DACRATE_REG, u32) = dacRate - 1;
|
||||
// HW_REG(AI_BITRATE_REG, u32) = bitrate - 1;
|
||||
HW_REG(AI_DACRATE_REG, u32) = dacRate - 1;
|
||||
HW_REG(AI_BITRATE_REG, u32) = bitrate - 1;
|
||||
AiDacrateChanged(SYSTEM_NTSC);
|
||||
return osViClock / (s32)dacRate;
|
||||
}
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
static std::unordered_map<u32, uintptr_t> gRegisterMap;
|
||||
|
||||
uintptr_t& hw_reg(u32 reg)
|
||||
{
|
||||
if(reg == AI_DACRATE_REG || reg == AI_BITRATE_REG || reg == AI_LEN_REG)
|
||||
{
|
||||
int x = 0;
|
||||
}
|
||||
if(gRegisterMap.size() == 0)
|
||||
{
|
||||
gRegisterMap.reserve(64);
|
||||
}
|
||||
|
||||
return gRegisterMap[reg];
|
||||
}
|
||||
|
||||
void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 count)
|
||||
{
|
||||
mq->mtqueue = NULL;
|
||||
mq->fullqueue = NULL;
|
||||
mq->validCount = 0;
|
||||
mq->first = 0;
|
||||
mq->msgCount = count;
|
||||
mq->msg = msg;
|
||||
}
|
||||
|
||||
s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag)
|
||||
{
|
||||
register u32 index;
|
||||
|
||||
while(mq->validCount >= mq->msgCount)
|
||||
{
|
||||
if(flag == OS_MESG_BLOCK)
|
||||
{
|
||||
int zyz = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
index = (mq->first + mq->validCount) % mq->msgCount;
|
||||
mq->msg[index] = mesg;
|
||||
mq->validCount++;
|
||||
|
||||
if(mq->mtqueue->next != NULL)
|
||||
{
|
||||
// osStartThread(__osPopThread(&mq->mtqueue));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag)
|
||||
{
|
||||
while(mq->validCount == 0)
|
||||
{
|
||||
if(flag == OS_MESG_NOBLOCK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
/*else
|
||||
{
|
||||
return -1; // TODO FIX HACK
|
||||
}*/
|
||||
}
|
||||
|
||||
if(msg != NULL)
|
||||
{
|
||||
*msg = mq->msg[mq->first];
|
||||
}
|
||||
|
||||
mq->first = (mq->first + 1) % mq->msgCount;
|
||||
mq->validCount--;
|
||||
|
||||
if(mq->fullqueue->next != NULL)
|
||||
{
|
||||
// osStartThread(__osPopThread(&mq->fullqueue));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uintptr_t check_pointer(uintptr_t p, u32 sz)
|
||||
{
|
||||
if(IsBadReadPtr((const void*)p, sz))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
|
@ -3,15 +3,6 @@
|
|||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
extern void create_next_audio_buffer(s16* samples, u32 num_samples);
|
||||
//void send_display_list(SPTask* spTask);
|
||||
void game_loop_one_iteration();
|
||||
void process_physics();
|
||||
//void dispatch_audio_sptask(SPTask* spTask);
|
||||
|
||||
void game_init(void* arg);
|
||||
void create_next_audio_buffer(s16* samples, u32 num_samples);
|
||||
|
||||
namespace platform::window
|
||||
{
|
||||
class Base
|
||||
|
@ -30,38 +21,12 @@ namespace platform::window
|
|||
|
||||
void calc_sizes();
|
||||
|
||||
void produce_one_frame()
|
||||
{
|
||||
begin_frame();
|
||||
game_loop_one_iteration();
|
||||
|
||||
/*int samples_left = audio_api->buffered();
|
||||
u32 num_audio_samples = samples_left < audio_api->get_desired_buffered() ? 544 : 528;
|
||||
|
||||
#ifdef ENABLE_60FPS
|
||||
s16 audio_buffer[544 * 2];
|
||||
create_next_audio_buffer(audio_buffer, num_audio_samples);
|
||||
audio_api->play((const u8*)audio_buffer, num_audio_samples * 4);
|
||||
#else
|
||||
s16 audio_buffer[544 * 2 * 2];
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
create_next_audio_buffer(audio_buffer + i * (num_audio_samples * 2), num_audio_samples);
|
||||
}
|
||||
audio_api->play((const u8*)audio_buffer, 2 * num_audio_samples * 4);
|
||||
#endif
|
||||
*/
|
||||
|
||||
end_frame();
|
||||
}
|
||||
|
||||
const std::chrono::microseconds& refreshInterval() const
|
||||
{
|
||||
return m_refreshInterval;
|
||||
}
|
||||
|
||||
bool run_paced_loop();
|
||||
void run();
|
||||
bool wait_frame_ready();
|
||||
|
||||
void setTargetFrameRate(size_t rate) { m_targetFrameRate = rate; };
|
||||
float ar() { return m_ar; }
|
||||
|
|
|
@ -17,6 +17,19 @@
|
|||
|
||||
void quit();
|
||||
|
||||
/*
|
||||
#ifdef _WIN32
|
||||
#include "SDL_syswm.h"
|
||||
HWND getHwnd()
|
||||
{
|
||||
SDL_SysWMinfo wmInfo;
|
||||
SDL_VERSION(&wmInfo.version);
|
||||
SDL_GetWindowWMInfo(window, &wmInfo);
|
||||
HWND hwnd = wmInfo.info.win.window;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
namespace platform::window
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace platform::window
|
|||
m_ar_ratio = m_ar / ((float)SCREEN_WIDTH / (float)SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
bool Base::run_paced_loop()
|
||||
bool Base::wait_frame_ready()
|
||||
{
|
||||
m_refreshInterval = std::chrono::microseconds(1000 * 1000 / 1);
|
||||
// const auto frameAlignment = (m_refreshRate - (m_lastFrameDuration % m_refreshRate)) / 2;
|
||||
|
@ -61,30 +61,6 @@ namespace platform::window
|
|||
|
||||
|
||||
m_currentFrameStartTime = std::chrono::high_resolution_clock::now();
|
||||
|
||||
/*
|
||||
int samples_left = audio_api->buffered();
|
||||
u32 num_audio_samples = samples_left < audio_api->get_desired_buffered() ? 544 : 528;
|
||||
|
||||
#ifdef ENABLE_60FPS
|
||||
s16 audio_buffer[544 * 2];
|
||||
create_next_audio_buffer(audio_buffer, num_audio_samples);
|
||||
if(!config().game().disableSound())
|
||||
{
|
||||
audio_api->play((const u8*)audio_buffer, num_audio_samples * 4);
|
||||
}
|
||||
#else
|
||||
s16 audio_buffer[544 * 2 * 2];
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
create_next_audio_buffer(audio_buffer + i * (num_audio_samples * 2), num_audio_samples);
|
||||
}
|
||||
if(!config().game().disableSound())
|
||||
{
|
||||
audio_api->play((const u8*)audio_buffer, 2 * num_audio_samples * 4);
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -96,22 +72,12 @@ namespace platform::window
|
|||
return false;
|
||||
}
|
||||
|
||||
void Base::run()
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
begin_frame();
|
||||
game_loop_one_iteration();
|
||||
end_frame();
|
||||
}
|
||||
}
|
||||
|
||||
bool Base::begin_frame()
|
||||
{
|
||||
handle_events();
|
||||
if (oot::config().game().isFramePacing())
|
||||
{
|
||||
while (!run_paced_loop())
|
||||
while(!wait_frame_ready())
|
||||
{}
|
||||
}
|
||||
return !dropped_frame;
|
||||
|
|
|
@ -4,6 +4,41 @@ from oot import *
|
|||
|
||||
conf = config()
|
||||
|
||||
symbols = {}
|
||||
|
||||
class Root:
|
||||
def __init__(self):
|
||||
self.address = 0
|
||||
self.offset = 0
|
||||
root = Root()
|
||||
|
||||
class Symbol:
|
||||
def __init__(self, name, definition, offset, static):
|
||||
self.name = name
|
||||
self.definition = definition
|
||||
self.offset = offset
|
||||
self.static = static
|
||||
|
||||
def __str__(self):
|
||||
if self.static:
|
||||
return 'static ' + self.definition
|
||||
return self.definition
|
||||
|
||||
def registerSymbol(name, definition, offset, static = True):
|
||||
global symbols
|
||||
|
||||
symbols[offset] = Symbol(name, definition, offset, static = static)
|
||||
|
||||
def getSymbolNameByOffset(offset, ptr = False, base = -1):
|
||||
if offset > 0:
|
||||
for name, s in symbols.items():
|
||||
if s.offset == offset + base:
|
||||
if ptr:
|
||||
return '&' + s.name
|
||||
return s.name
|
||||
return '0x%8.8X' % offset
|
||||
return '0x%8.8X' % offset
|
||||
|
||||
def reverse(s):
|
||||
return s[::-1]
|
||||
return int.from_bytes(s, byteorder='big').to_bytes(len(s), 'little')
|
||||
|
@ -156,8 +191,11 @@ class Reloc:
|
|||
self.dataFile = dataFile
|
||||
self.f = f
|
||||
|
||||
def getDef(self):
|
||||
return '';
|
||||
def getSymbol(self):
|
||||
return '0x%8.8X' % (self.address)
|
||||
|
||||
def render(self, f):
|
||||
pass
|
||||
|
||||
def OFFSET(o):
|
||||
if o > 0x2BDC0:
|
||||
|
@ -166,32 +204,75 @@ def OFFSET(o):
|
|||
|
||||
class AdpcmLoop:
|
||||
def __init__(self, f, parent):
|
||||
self.pos = f.tell()
|
||||
self.parent = parent
|
||||
self.start = readU32(f)
|
||||
self.end = readU32(f)
|
||||
self.count = readU32(f)
|
||||
self.unk_0C = f.read(4, swap = False)
|
||||
|
||||
self.states = []
|
||||
sunks = []
|
||||
for i in range(4):
|
||||
sunks.append("{0:#0{1}x}".format(self.unk_0C[i],4))
|
||||
|
||||
self.states = []
|
||||
sstates = []
|
||||
if self.count > 0:
|
||||
for i in range(16):
|
||||
self.states.append(readS16(f))
|
||||
s = readS16(f, swap = False)
|
||||
self.states.append(s)
|
||||
sstates.append("{0:#0{1}x}".format(s,6))
|
||||
registerSymbol(self.getSymbol(), 'AdpcmLoop %s = {.start = %d, .end = %d, .count = %d, .unk_0C = {%s}, .state = {%s}};' % (self.getSymbol(), self.start, self.end, self.count, ', '.join(sunks), ', '.join(sstates)), self.pos)
|
||||
|
||||
def render(self):
|
||||
return ''
|
||||
|
||||
def getSymbol(self):
|
||||
return 'loop_%8.8X' % self.pos
|
||||
|
||||
class AdpcmBook:
|
||||
def __init__(self, f, parent):
|
||||
self.pos = f.tell()
|
||||
self.order = readS32(f)
|
||||
self.npredictors = readS32(f)
|
||||
print('order = %d, npred = %d, offset = %8.8X' % (self.order, self.npredictors, f.tell()))
|
||||
print('.order = %d, .npred = %d, .offset = %8.8X' % (self.order, self.npredictors, f.tell()))
|
||||
|
||||
sbooks = []
|
||||
self.books = [] # TODO LOOP THROUGH: size 8 * order * npredictors. 8-byte aligned
|
||||
for i in range(self.order * self.npredictors * 8):
|
||||
self.books.append(readS16(f))
|
||||
b = readS16(f, swap = False)
|
||||
self.books.append(b)
|
||||
#sbooks.append('0x%4.4X' % b)
|
||||
sbooks.append("{0:#0{1}x}".format(b,6))
|
||||
|
||||
registerSymbol(self.getSymbol(), 'VAdpcmBook<%d> %s = {.order = %d, .npredictors = %d, .book = {%s}};' % (self.order * self.npredictors * 8, self.getSymbol(), self.order, self.npredictors, ','.join(sbooks)), self.pos)
|
||||
|
||||
def render(self):
|
||||
return ''
|
||||
|
||||
def getSymbol(self):
|
||||
return 'book_%8.8X' % self.pos
|
||||
|
||||
def RSHIFT(n, offset, length):
|
||||
return (n >> offset) & ((0x01 << length) - 1)
|
||||
|
||||
class BufferU8:
|
||||
def __init__(self, parent, offset, size, dataFile = 'baserom/Audiotable'):
|
||||
self.pos = offset
|
||||
data = []
|
||||
with open(assetPath(dataFile), 'rb') as f:
|
||||
f.seek(offset)
|
||||
for b in f.read(size):
|
||||
data.append(hex(b))
|
||||
registerSymbol(self.getSymbol(), 'u8 %s[] = {%s};' % (self.getSymbol(), ', '.join(data)), self.pos + 0x10000000)
|
||||
|
||||
def getSymbol(self):
|
||||
return 'buffer_%8.8X' % self.pos
|
||||
|
||||
|
||||
class SoundFontSample:
|
||||
def __init__(self, f, parent):
|
||||
self.pos = f.tell()
|
||||
self.flags = readU32(f)
|
||||
self.sampleOffset = readU32(f)
|
||||
self.loopOffset = readU32(f)
|
||||
|
@ -200,12 +281,18 @@ class SoundFontSample:
|
|||
pos = f.tell()
|
||||
|
||||
|
||||
|
||||
self.codec = RSHIFT(self.flags, 0, 4)
|
||||
self.medium = RSHIFT(self.flags, 4, 2)
|
||||
self.unk_bit26 = RSHIFT(self.flags, 6, 1)
|
||||
self.unk_bit25 = RSHIFT(self.flags, 7, 1)
|
||||
self.size = RSHIFT(self.flags, 8, 24)
|
||||
#self.codec = RSHIFT(self.flags, 0, 4)
|
||||
#self.medium = RSHIFT(self.flags, 4, 2)
|
||||
#self.unk_bit26 = RSHIFT(self.flags, 6, 1)
|
||||
#self.unk_bit25 = RSHIFT(self.flags, 7, 1)
|
||||
#self.size = RSHIFT(self.flags, 8, 24)
|
||||
|
||||
self.size = RSHIFT(self.flags, 0, 24)
|
||||
self.unk_bit25 = RSHIFT(self.flags, 25, 1)
|
||||
self.unk_bit26 = RSHIFT(self.flags, 26, 1)
|
||||
self.medium = RSHIFT(self.flags, 27, 2)
|
||||
self.codec = RSHIFT(self.flags, 29, 4)
|
||||
|
||||
print('sample flags: %8.8X, size = %d, codec = %d, medium = %d, unk_bit26 = %d, unk_bit25 = %d, sampleOffset = %8.8X' % (self.flags, self.size, self.codec, self.medium, self.unk_bit26, self.unk_bit25, self.sampleOffset))
|
||||
|
||||
#print('sample flags: %8.8X, size = %d' % (self.flags, RSHIFT(self.flags, 8, 24)))
|
||||
|
@ -224,12 +311,40 @@ class SoundFontSample:
|
|||
if OFFSET(self.bookOffset) > 0:
|
||||
f.seek(self.bookOffset + parent.address)
|
||||
self.book = AdpcmBook(f, parent)
|
||||
|
||||
|
||||
sampleSymbol = '0x%8.8X' % self.sampleOffset
|
||||
|
||||
if self.size > 0 and self.unk_bit25 != 1:
|
||||
if self.medium == 2:
|
||||
self.medium = 0
|
||||
'''
|
||||
if self.medium == 2:
|
||||
self.sampleBuffer = BufferU8(parent, offset = self.sampleOffset, size = self.size, dataFile = 'baserom/Audiotable')
|
||||
#self.medium = 2
|
||||
self.unk_bit25 = 1
|
||||
sampleSymbol = self.sampleBuffer.getSymbol()
|
||||
|
||||
if self.medium == 0:
|
||||
self.sampleBuffer = BufferU8(parent, offset = self.sampleOffset, size = self.size, dataFile = 'baserom/Audiotable')
|
||||
#self.medium = 2
|
||||
self.unk_bit25 = 1
|
||||
sampleSymbol = self.sampleBuffer.getSymbol()
|
||||
'''
|
||||
|
||||
f.seek(pos)
|
||||
|
||||
class SoundFontSound:
|
||||
def __init__(self, f, parent):
|
||||
registerSymbol(self.getSymbol(), 'SoundFontSample %s = {.size = %d, .unk_bit25 = %d, .unk_bit26 = %d, .medium = %d, .codec = %d, .sampleAddr = (u8*)%s, .loop = %s, .book = (AdpcmBook*)%s};' % (self.getSymbol(), self.size, self.unk_bit25, self.unk_bit26, self.medium, self.codec, sampleSymbol, getSymbolNameByOffset(self.loopOffset, base = parent.address, ptr = True), getSymbolNameByOffset(self.bookOffset, base = parent.address, ptr = True)), self.pos)
|
||||
|
||||
def render(self):
|
||||
return ''
|
||||
|
||||
def getSymbol(self):
|
||||
return 'sf_sample_%8.8X' % self.pos
|
||||
|
||||
class SoundFontSound:
|
||||
def __init__(self, f, parent, register = True):
|
||||
self.parent = parent
|
||||
self.pos = f.tell()
|
||||
self.sampleOffset = readU32(f)
|
||||
self.tuning = readFloat(f)
|
||||
|
||||
|
@ -242,9 +357,19 @@ class SoundFontSound:
|
|||
f.seek(pos)
|
||||
|
||||
print('SoundFontSound: %8.8X, tuning: %f' % (self.sampleOffset, self.tuning))
|
||||
|
||||
if register:
|
||||
registerSymbol(self.getSymbol(), 'SoundFontSound %s = %s;' % (self.getSymbol(), self.render()), self.pos)
|
||||
|
||||
def render(self):
|
||||
return '{.sample = %s, .tuning = %f}' % (getSymbolNameByOffset(self.sampleOffset, base = self.parent.address, ptr = True), self.tuning)
|
||||
|
||||
def getSymbol(self):
|
||||
return 'sf_sound_%8.8X' % self.pos
|
||||
|
||||
class Drum:
|
||||
def __init__(self, f, parent):
|
||||
self.pos = f.tell()
|
||||
self.releaseRate = readU8(f)
|
||||
self.pan = readU8(f)
|
||||
self.loaded = readU8(f)
|
||||
|
@ -257,30 +382,61 @@ class Drum:
|
|||
|
||||
pos = f.tell()
|
||||
|
||||
envelopeSymbol = '0x00000000'
|
||||
if OFFSET(self.envelopeOffset) > 0:
|
||||
f.seek(self.envelopeOffset + parent.address)
|
||||
self.adsrEnvelope = AdsrEnvelope(f)
|
||||
envelopeSymbol = self.adsrEnvelope.getSymbol()
|
||||
|
||||
f.seek(pos)
|
||||
|
||||
print('Drum: releaseRate: %d, pan: %d, envelopeOffset: %8.8X' % (self.releaseRate, self.pan, self.envelopeOffset))
|
||||
registerSymbol(self.getSymbol(), 'Drum %s = {.releaseRate = %d, .pan = %d, .loaded = %d, .sound = %s, .envelope = %s};' % (self.getSymbol(), self.releaseRate, self.pan, self.loaded, self.soundFontSound.render(), envelopeSymbol), self.pos)
|
||||
|
||||
def render(self):
|
||||
return ''
|
||||
|
||||
def getSymbol(self):
|
||||
return 'drum_%8.8X' % self.pos
|
||||
|
||||
class AdsrEnvelope:
|
||||
def __init__(self, f):
|
||||
self.delay = readS16(f)
|
||||
self.arg = readS16(f)
|
||||
self.pos = f.tell()
|
||||
|
||||
self.delays = []
|
||||
self.args = []
|
||||
lst = []
|
||||
|
||||
delay = 0
|
||||
|
||||
for i in range(32):
|
||||
if delay < 0:
|
||||
break
|
||||
delay = readS16(f)
|
||||
arg = readS16(f)
|
||||
lst.append('AdsrEnvelope(%d, %d)' % (delay, arg))
|
||||
|
||||
|
||||
registerSymbol(self.getSymbol(), 'AdsrEnvelope %s[] = {%s};' % (self.getSymbol(), ', '.join(lst)), self.pos)
|
||||
|
||||
def render(self):
|
||||
return ''
|
||||
|
||||
def getSymbol(self):
|
||||
return 'adsrEnvelope_%8.8X' % self.pos
|
||||
|
||||
class Instrument:
|
||||
def __init__(self, f, parent):
|
||||
self.pos = f.tell()
|
||||
self.loaded = readU8(f)
|
||||
self.normalRangeLo = readU8(f)
|
||||
self.normalRangeHi = readU8(f)
|
||||
self.releaseRate = readU8(f)
|
||||
|
||||
self.envelopeOffset = readU32(f)
|
||||
self.lowNotesSound = SoundFontSound(f, parent)
|
||||
self.normalNotesSound = SoundFontSound(f, parent)
|
||||
self.highNotesSound = SoundFontSound(f, parent)
|
||||
self.lowNotesSound = SoundFontSound(f, parent, register = False)
|
||||
self.normalNotesSound = SoundFontSound(f, parent, register = False)
|
||||
self.highNotesSound = SoundFontSound(f, parent, register = False)
|
||||
|
||||
pos = f.tell()
|
||||
|
||||
|
@ -290,14 +446,53 @@ class Instrument:
|
|||
|
||||
f.seek(pos)
|
||||
|
||||
print('Instrument: normalRangeLo: %d, normalRangeHi: %d, releaseRate: %d, envelopeOffset = %8.8X (%8.8X)' % (self.normalRangeLo, self.normalRangeHi, self.releaseRate, self.envelopeOffset, parent.address))
|
||||
#print('Instrument: normalRangeLo: %d, normalRangeHi: %d, releaseRate: %d, envelopeOffset = %8.8X (%8.8X), lowNotesSound = %s, normalNotesSound = %s, highNotesSound = %s' % (self.normalRangeLo, self.normalRangeHi, self.releaseRate, self.envelopeOffset, parent.address))
|
||||
registerSymbol(self.getSymbol(), 'Instrument %s = {.loaded = %d, .normalRangeLo = %d, .normalRangeHi = %d, .releaseRate = %d, .envelope = %s, .lowNotesSound = %s, .normalNotesSound = %s, .highNotesSound = %s};' % (self.getSymbol(), self.loaded, self.normalRangeLo, self.normalRangeHi, self.releaseRate, getSymbolNameByOffset(self.envelopeOffset, base = parent.address, ptr = False), self.lowNotesSound.render(), self.normalNotesSound.render(), self.highNotesSound.render()), self.pos)
|
||||
|
||||
def render(self):
|
||||
return ''
|
||||
|
||||
def getSymbol(self):
|
||||
return 'instrument_%8.8X' % self.pos
|
||||
|
||||
class JumpTable:
|
||||
def __init__(self, address, lst, parent, f, prefix = 'jmp_', datatype = 'void*'):
|
||||
self.address = address
|
||||
self.prefix = prefix
|
||||
self.parent = parent
|
||||
|
||||
rlst = []
|
||||
|
||||
for i in lst:
|
||||
if i is None or i == 0:
|
||||
rlst.append('0x00000000')
|
||||
else:
|
||||
rlst.append('&' + getSymbolNameByOffset(i, base = parent.address))
|
||||
|
||||
registerSymbol(self.getSymbol(), '%s %s[] = {%s};' % (datatype, self.getSymbol(), ', '.join(rlst)), offset = address)
|
||||
|
||||
def getSymbol(self):
|
||||
return '%s%8.8X' % (self.prefix, self.address + self.parent.address)
|
||||
|
||||
class Array:
|
||||
def __init__(self, address, lst, parent, f, prefix = 'array_', datatype = 'u8'):
|
||||
self.address = address
|
||||
self.prefix = prefix
|
||||
|
||||
rlst = []
|
||||
|
||||
for i in lst:
|
||||
rlst.append(i.render())
|
||||
|
||||
registerSymbol(self.getSymbol(), 'struct %s %s[%d] = {%s};' % (datatype, self.getSymbol(), len(lst), ', '.join(rlst)), offset = address)
|
||||
|
||||
def getSymbol(self):
|
||||
return '%s%8.8X' % (self.prefix, self.address)
|
||||
|
||||
|
||||
class FontReloc(Reloc):
|
||||
def __init__(self, address, size, medium, cachePolicy, shortData1, shortData2, shortData3, dataFile, f):
|
||||
super(FontReloc, self).__init__(address, size, medium, cachePolicy, shortData1, shortData2, shortData3, dataFile, f)
|
||||
|
||||
self.pos = address
|
||||
self.sampleBankId1 = (shortData1 >> 8) & 0xFF
|
||||
self.sampleBankId2 = (shortData1) & 0xFF
|
||||
self.numInstruments = (shortData2 >> 8) & 0xFF
|
||||
|
@ -314,44 +509,66 @@ class FontReloc(Reloc):
|
|||
|
||||
print('bankId1 = %d, bankId2 = %d, numInstruments = %d, numDrums = %d, , numSfx = %d' % (self.sampleBankId1, self.sampleBankId2, self.numInstruments, self.numDrums, self.numSfx))
|
||||
|
||||
def getName(self):
|
||||
return 'font_%X' % self.address
|
||||
|
||||
def getDef(self):
|
||||
buf = 'FontReloc %s = {' % self.getName()
|
||||
r = []
|
||||
for offset in self.offsets:
|
||||
r.append('0x%8.8X' % offset)
|
||||
|
||||
buf += ', '.join(r) + ' }; // data starts at 0x%8.8X\n' % (len(self.offsets) * 4)
|
||||
|
||||
drums = []
|
||||
sfxs = []
|
||||
instruments = []
|
||||
|
||||
f = self.f
|
||||
|
||||
symbols = []
|
||||
|
||||
if self.offsets[0] > 0:
|
||||
lst = []
|
||||
|
||||
for i in range(self.numDrums):
|
||||
f.seek(self.offsets[0] + self.address + (i * 4))
|
||||
p = readS32(f)
|
||||
|
||||
if p > 0:
|
||||
f.seek(p + self.address)
|
||||
drums.append(Drum(f, self))
|
||||
lst.append(p + self.address)
|
||||
d = Drum(f, self)
|
||||
drums.append(d)
|
||||
else:
|
||||
lst.append(None)
|
||||
if 0x00000740 == self.offsets[0]:
|
||||
x = 1
|
||||
tbl = JumpTable(address = self.offsets[0] + self.address, lst = lst, parent = root, f = f, prefix = 'drum_jmp_', datatype = 'Drum*')
|
||||
|
||||
if self.offsets[1] > 0:
|
||||
lst = []
|
||||
f.seek(self.offsets[1] + self.address)
|
||||
for i in range(self.numSfx):
|
||||
sfxs.append(SoundFontSound(f, self))
|
||||
sf = SoundFontSound(f, self, register = False)
|
||||
sfxs.append(sf)
|
||||
|
||||
tbl = Array(address = self.offsets[1] + self.address, lst = sfxs, parent = self, f = f, prefix = 'sfxs_', datatype = 'SoundFontSound')
|
||||
|
||||
for i in range(2, self.numInstruments + 2):
|
||||
if self.offsets[i] > 0:
|
||||
f.seek(self.offsets[i] + self.address)
|
||||
instruments.append(Instrument(f, self))
|
||||
inst = Instrument(f, self)
|
||||
instruments.append(inst)
|
||||
|
||||
symlist = []
|
||||
for offset in self.offsets:
|
||||
symlist.append(getSymbolNameByOffset(offset, base = self.address))
|
||||
#registerSymbol(self.getSymbol(), 'void* %s[] = {%s};' % (self.getSymbol(), ', '.join(symlist)), self.pos)
|
||||
self.tbl = JumpTable(address = address, lst = self.offsets, parent = self, f = f)
|
||||
|
||||
def getSymbol(self):
|
||||
return self.tbl.getSymbol()
|
||||
|
||||
return buf
|
||||
|
||||
def render(self, f):
|
||||
if self.offsets[0] > 0:
|
||||
instList = '0x%8.8X' % self.offsets[0]
|
||||
else:
|
||||
instList = 'nullptr'
|
||||
#f.write('SoundFont %s = { .numInstruments = %d, .numDrums = %d, .sampleBankId1 = %d, .sampleBankId2 = %d, .numSfx = %d, .instruments = %s};\n' % (self.getSymbol(), self.numInstruments, self.numDrums, self.sampleBankId1, self.sampleBankId2, self.numSfx, instList, drumList))
|
||||
|
||||
def getName(self):
|
||||
return 'font_%X' % self.address
|
||||
|
||||
|
||||
class Table(Section):
|
||||
|
@ -362,6 +579,7 @@ class Table(Section):
|
|||
|
||||
|
||||
def serialize(self, f, z64):
|
||||
global symbols
|
||||
z64.seek(self.offset)
|
||||
|
||||
numEntries = readS16(z64, swap = False)
|
||||
|
@ -385,15 +603,23 @@ class Table(Section):
|
|||
shortData3 = readS16(z64, swap = False)
|
||||
|
||||
reloc = self.getReloc(address, size, medium, cachePolicy, shortData1, shortData2, shortData3, f = x)
|
||||
reloc.getDef() # reverses endian
|
||||
relocs.append(reloc)
|
||||
lst.append('{ .romAddr = 0x%8.8X, .size = 0x%8.8X, .medium = 0x%2.2X, .cachePolicy = %d, .shortData1 = 0x%4.4X, .shortData2 = 0x%4.4X, .shortData3 = 0x%4.4X }' % (address, size, medium, cachePolicy, shortData1, shortData2, shortData3))
|
||||
lst.append('{ .romAddr = (uintptr_t)%s, .size = 0x%8.8X, .medium = 0x%2.2X, .cachePolicy = %d, .shortData1 = 0x%4.4X, .shortData2 = 0x%4.4X, .shortData3 = 0x%4.4X }' % (reloc.getSymbol(), size, medium, cachePolicy, shortData1, shortData2, shortData3))
|
||||
|
||||
#reloc.render(f)
|
||||
|
||||
f.write('AudioTableDef %s = {\n.numEntries = 0x%4.4X, .unkMediumParam = 0x%4.4X, .romAddr = 0x%8.8X, .pad = {0}, .entries = {\n' % (self.name, numEntries, unkMediumParam, address))
|
||||
definition = ('AudioTableDef %s = {\n.numEntries = 0x%4.4X, .unkMediumParam = 0x%4.4X, .romAddr = 0x%8.8X, .pad = {0}, .entries = {\n' % (self.name, numEntries, unkMediumParam, address))
|
||||
|
||||
f.write(',\n'.join(lst))
|
||||
definition += (',\n'.join(lst))
|
||||
|
||||
f.write('\n}};\n\n')
|
||||
definition += ('\n}};')
|
||||
|
||||
registerSymbol(self.name, definition, self.offset, static = False)
|
||||
|
||||
for offset, definition in symbols.items():
|
||||
f.write('%s\n\n' % (definition))
|
||||
|
||||
symbols = {}
|
||||
|
||||
def getReloc(self, address, size, medium, cachePolicy, shortData1, shortData2, shortData3, f):
|
||||
return Reloc(address, size, medium, cachePolicy, shortData1, shortData2, shortData3, self.dataFile, f = f)
|
||||
|
@ -414,7 +640,7 @@ sections = {'misc/rsp.h': [
|
|||
Section('gSequenceFontTable', conf.sections.gSequenceFontTable.offset, conf.sections.gSequenceFontTable.size, 2),
|
||||
Table('gSequenceTable', conf.sections.gSequenceTable.offset, conf.sections.gSequenceTable.size, 'baserom/Audioseq'),
|
||||
Table('gSampleBankTable', conf.sections.gSampleBankTable.offset, conf.sections.gSampleBankTable.size, 'baserom/Audiotable'),
|
||||
Section('rspAspMainDataStart', conf.sections.rspAspMainData.offset, conf.sections.rspAspMainData.size),
|
||||
Section('rspAspMainDataStart', conf.sections.rspAspMainData.offset, conf.sections.rspAspMainData.size, 4),
|
||||
Section('D_80155F50', conf.sections.rspF3DZEXText.offset, conf.sections.rspF3DZEXText.size, 1),
|
||||
Section('D_80157580', conf.sections.rspF3DZEXData.offset, conf.sections.rspF3DZEXData.size, 1),
|
||||
Section('D_801579A0', conf.sections.rspS2DEXData.offset, conf.sections.rspS2DEXData.size, 1),
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{835979AC-BC6A-45B7-A513-8EEE79B443DE}</ProjectGuid>
|
||||
<RootNamespace>AziAudio</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(SolutionDir)..\AziAudio\PropertySheets\$(Platform).props" />
|
||||
<Import Project="$(SolutionDir)..\AziAudio\PropertySheets\$(Configuration).props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<IntDir>$(SolutionDir)Build\$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)..\external\$(Platform)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\AziAudi\3rd Party\directx\include</AdditionalIncludeDirectories>
|
||||
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32'">$(SolutionDir)..\AziAudi\3rd Party\directx\lib\x86</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories Condition="'$(Platform)'=='x64'">$(SolutionDir)..\AziAudi\3rd Party\directx\lib\x64</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<LinkTimeCodeGeneration Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\audiohle.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\AudioSpec.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\common.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Configuration.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\DirectSoundDriver.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\DirectSoundDriverLegacy.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\arithmetics.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\audio.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\common.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\hle.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\hle_external.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\hle_internal.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\memory.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\ucodes.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\my_types.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\NoSoundDriver.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\resource.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Settings.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\SoundDriver.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\SoundDriverFactory.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\SoundDriverInterface.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\SoundDriverLegacy.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\WASAPISoundDriver.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\WaveOut.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\WaveOutSoundDriver.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\XAudio2SoundDriver.h" />
|
||||
<ClInclude Include="..\AziAudio\AziAudio\XAudio2SoundDriverLegacy.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI1.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI2.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI3.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI3mp3.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Adpcm.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Buffers.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Envmixer.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Filters.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_MixerInterleave.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Resample.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\Configuration.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\DirectSoundDriver.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\DirectSoundDriverLegacy.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\HLEMain.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\main.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\NoSoundDriver.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\SoundDriver.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\SoundDriverFactory.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\SoundDriverInterface.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\SoundDriverLegacy.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\WASAPISoundDriver.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\WaveOut.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\WaveOutSoundDriver.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\XAudio2SoundDriver.cpp" />
|
||||
<ClCompile Include="..\AziAudio\AziAudio\XAudio2SoundDriverLegacy.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\AziAudio\AziAudio\readme.txt" />
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="resource.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<ItemGroup>
|
||||
<FilesToDeploy Include="$(OutDir)AziAudio.dll" />
|
||||
</ItemGroup>
|
||||
<!--Set Pj64Install as an environment variable or as an MSBuild command-line property.-->
|
||||
<Target Name="Publish">
|
||||
<Message Text="Deploying to [$(Pj64Install)]" />
|
||||
<Message Text="Files to move: [@(FilesToDeploy)]" />
|
||||
<Copy SourceFiles="@(FilesToDeploy)" DestinationFolder="$(Pj64Install)\Plugin\$(PluginType)" Condition="'$(Platform)'=='Win32'" />
|
||||
<Copy SourceFiles="@(FilesToDeploy)" DestinationFolder="$(Pj64Install)\Plugin64\$(PluginType)" Condition="'$(Platform)'=='x64'" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,194 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Sound Driver">
|
||||
<UniqueIdentifier>{43b2e3b5-e716-4d8f-ba1a-b40e20c69319}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\HLE">
|
||||
<UniqueIdentifier>{8c30a8de-e2ce-48be-af01-21ba3969d5f2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mupen64Plus HLE">
|
||||
<UniqueIdentifier>{95916df6-fc86-47c2-9217-016b83ad7d67}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Mupen64Plus HLE\Mupen64Plus Headers">
|
||||
<UniqueIdentifier>{25c811b5-8ad0-4d49-b449-e6b2a225ab89}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\DirectSoundDriver.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\SoundDriver.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\XAudio2SoundDriver.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\arithmetics.h">
|
||||
<Filter>Mupen64Plus HLE\Mupen64Plus Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\audio.h">
|
||||
<Filter>Mupen64Plus HLE\Mupen64Plus Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\common.h">
|
||||
<Filter>Mupen64Plus HLE\Mupen64Plus Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\hle.h">
|
||||
<Filter>Mupen64Plus HLE\Mupen64Plus Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\hle_external.h">
|
||||
<Filter>Mupen64Plus HLE\Mupen64Plus Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\hle_internal.h">
|
||||
<Filter>Mupen64Plus HLE\Mupen64Plus Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\memory.h">
|
||||
<Filter>Mupen64Plus HLE\Mupen64Plus Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Mupen64plusHLE\ucodes.h">
|
||||
<Filter>Mupen64Plus HLE\Mupen64Plus Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\audiohle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\AudioSpec.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\common.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\WaveOut.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\my_types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\NoSoundDriver.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\SoundDriverFactory.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\SoundDriverInterface.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Configuration.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\SoundDriverLegacy.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\DirectSoundDriverLegacy.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\XAudio2SoundDriverLegacy.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\WASAPISoundDriver.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\WaveOutSoundDriver.h">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AziAudio\AziAudio\Settings.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\DirectSoundDriver.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\XAudio2SoundDriver.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\WaveOut.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI1.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI2.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI3.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI3mp3.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\HLEMain.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Resample.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Envmixer.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Adpcm.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Buffers.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_Filters.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\ABI_MixerInterleave.cpp">
|
||||
<Filter>Source Files\HLE</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\SoundDriver.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\NoSoundDriver.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\SoundDriverFactory.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\SoundDriverInterface.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\Configuration.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\SoundDriverLegacy.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\DirectSoundDriverLegacy.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\XAudio2SoundDriverLegacy.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\WASAPISoundDriver.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\AziAudio\AziAudio\WaveOutSoundDriver.cpp">
|
||||
<Filter>Source Files\Sound Driver</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\AziAudio\AziAudio\readme.txt">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Text>
|
||||
</ItemGroup>
|
||||
</Project>
|
18
vs/OOT.sln
18
vs/OOT.sln
|
@ -16,6 +16,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGLideNHQ", "libGLideNHQ.
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osal", "osal.vcxproj", "{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AziAudio", "AziAudio.vcxproj", "{835979AC-BC6A-45B7-A513-8EEE79B443DE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug_mupenplus|Win32 = Debug_mupenplus|Win32
|
||||
|
@ -92,6 +94,22 @@ Global
|
|||
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release|Win32.Build.0 = Release|Win32
|
||||
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release|x64.ActiveCfg = Release|x64
|
||||
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}.Release|x64.Build.0 = Release|x64
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Debug_mupenplus|Win32.ActiveCfg = Debug|Win32
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Debug_mupenplus|Win32.Build.0 = Debug|Win32
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Debug_mupenplus|x64.ActiveCfg = Debug|x64
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Debug_mupenplus|x64.Build.0 = Debug|x64
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Debug|x64.Build.0 = Debug|x64
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Release_mupenplus|Win32.ActiveCfg = Release|Win32
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Release_mupenplus|Win32.Build.0 = Release|Win32
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Release_mupenplus|x64.ActiveCfg = Release|x64
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Release_mupenplus|x64.Build.0 = Release|x64
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Release|Win32.Build.0 = Release|Win32
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Release|x64.ActiveCfg = Release|x64
|
||||
{835979AC-BC6A-45B7-A513-8EEE79B443DE}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -1703,7 +1703,6 @@
|
|||
<ClCompile Include="..\src\overlays\misc\ovl_kaleido_scope\z_lmap_mark.cpp" />
|
||||
<ClCompile Include="..\roms\$(buildrom)\src\overlays\misc\ovl_kaleido_scope\z_lmap_mark_data.cpp" />
|
||||
<ClCompile Include="..\roms\$(buildrom)\src\overlays\misc\ovl_map_mark_data\z_map_mark_data.cpp" />
|
||||
<ClCompile Include="..\src\port\audio\audio_sdl.cpp" />
|
||||
<ClCompile Include="..\src\port\configfile.cpp" />
|
||||
<ClCompile Include="..\src\port\controller\controller.cpp" />
|
||||
<ClCompile Include="..\src\port\controller\controllers.cpp" />
|
||||
|
|
|
@ -61,18 +61,9 @@
|
|||
<Filter Include="Source Files\port">
|
||||
<UniqueIdentifier>{057ee800-4200-4c7a-a71e-208d474c6e8c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\port\gfx">
|
||||
<UniqueIdentifier>{076249ff-2c0a-43d4-b2a1-f6ccd1ebb59c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\port\audio">
|
||||
<UniqueIdentifier>{b812585d-3a65-4698-b9b6-72c21967ea4b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\include">
|
||||
<UniqueIdentifier>{cdd864ce-73d5-467a-8fa2-93129f1e0479}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\port\fast3d">
|
||||
<UniqueIdentifier>{30e9f867-99b2-403c-8285-bb8a7b77ecc5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\port\controller">
|
||||
<UniqueIdentifier>{3b39d445-502a-4ef8-9dc4-bc4de8f3982e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -2190,9 +2181,6 @@
|
|||
<ClCompile Include="..\src\port\options.cpp">
|
||||
<Filter>Source Files\port</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\port\audio\audio_sdl.cpp">
|
||||
<Filter>Source Files\port\audio</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\port\controller\controller.cpp">
|
||||
<Filter>Source Files\port\controller</Filter>
|
||||
</ClCompile>
|
||||
|
@ -5082,6 +5070,72 @@
|
|||
<ClCompile Include="..\roms\$(buildrom)\text\staff_message_data_static.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\indoors\hairal_niwa2\hairal_niwa2_room_0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\indoors\hairal_niwa2\hairal_niwa2_scene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\besitu\besitu_room_0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\besitu\besitu_scene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\depth_test\depth_test_room_0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\depth_test\depth_test_scene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\sasatest\sasatest_room_0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\sasatest\sasatest_scene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\sutaru\sutaru_room_0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\sutaru\sutaru_scene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\syotes2\syotes2_room_0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\syotes2\syotes2_scene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\syotes\syotes_room_0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\syotes\syotes_scene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\test01\test01_room_0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\test01\test01_scene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\testroom\testroom_room_0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\testroom\testroom_room_1.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\testroom\testroom_room_2.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\testroom\testroom_room_3.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\testroom\testroom_room_4.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\assets\$(buildrom)\scenes\test_levels\testroom\testroom_scene.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\segment_symbols.h">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>GLideN64d.lib;opengl32.lib;libGLideNHQd.lib;osald.lib;freetype253MT.lib;SDL2-static.lib;winmm.lib;setupapi.lib;version.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>GLideN64d.lib;AziAudio.lib;dsound.lib;opengl32.lib;libGLideNHQd.lib;osald.lib;freetype253MT.lib;SDL2-static.lib;winmm.lib;setupapi.lib;version.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
|
@ -18,7 +18,7 @@
|
|||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>GLideN64.lib;opengl32.lib;libGLideNHQ.lib;osald.lib;freetype253MT.lib;SDL2-static.lib;winmm.lib;setupapi.lib;version.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>GLideN64.lib;AziAudio.lib;dsound.lib;opengl32.lib;libGLideNHQ.lib;osald.lib;freetype253MT.lib;SDL2-static.lib;winmm.lib;setupapi.lib;version.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue