mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-06-01 09:17:16 -04:00
Implement & link jaudio_NES/neosthread.c
This commit is contained in:
@@ -3,6 +3,7 @@ trim_ctors: true
|
||||
symbol_aligns:
|
||||
0x80018920: 32
|
||||
0x800190e0: 32
|
||||
0x80019380: 32
|
||||
0x80207458: 8 # align RunQueue to 0x001251d8
|
||||
0x800b9140: 32 # align gam_win_moji1_tex to 32 bytes
|
||||
0x801f71c0: 32 # align texture_buffer_data to 32 bytes
|
||||
|
||||
@@ -49,6 +49,12 @@ jaudio_NES/audiothread.c:
|
||||
.bss: [0x8017cfc0, 0x80180020]
|
||||
.sbss: [0x80218440, 0x80218460]
|
||||
.sdata2: [0x80218db8, 0x80218dc0]
|
||||
jaudio_NES/neosthread.c:
|
||||
.text: [0x800190e0, 0x80019380]
|
||||
.rodata: [0x800aa538, 0x800aa558]
|
||||
.bss: [0x80180020, 0x80186440]
|
||||
.sdata: [0x80217be0, 0x80217be8]
|
||||
.sbss: [0x80218460, 0x80218478]
|
||||
# jaudio_NES/game64.c: # TODO: finish
|
||||
# .rodata: [0x800a9938, 0x800a9b98]
|
||||
#jaudio_NES/verysimple.c:
|
||||
|
||||
+2
-1
@@ -628,7 +628,8 @@ JAUDIO_FUNC_ALIGN_32_TUS = [
|
||||
"sample.c",
|
||||
"aictrl.c",
|
||||
"dummyrom.c",
|
||||
"audiothread.c"
|
||||
"audiothread.c",
|
||||
"neosthread.c"
|
||||
]
|
||||
|
||||
class CSource(Source):
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef AUDIOCONST_H
|
||||
#define AUDIOCONST_H
|
||||
|
||||
#include "types.h"
|
||||
#include "jaudio_NES/audiostruct.h"
|
||||
|
||||
typedef struct ALGlobalsConst_ {
|
||||
s8 maxChan;
|
||||
s16 timeBase;
|
||||
s32 acmdBufSize;
|
||||
s32 fixSize;
|
||||
s32 ememSize;
|
||||
} ALGlobalsConst;
|
||||
|
||||
extern ALGlobalsConst AGC;
|
||||
|
||||
#endif
|
||||
@@ -6,5 +6,6 @@
|
||||
|
||||
extern u32 CpubufProcess(DSPBUF_EVENTS event);
|
||||
extern void CpuFrameEnd(void);
|
||||
extern s16* MixCpu(s32 nSamples);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
typedef void (*Jac_DVDCallback)(u32);
|
||||
|
||||
extern s32 DVDT_LoadtoARAM(u32 owner, char* path, u32 dram, u32 aram, u32 len, u32* outLen, Jac_DVDCallback callback);
|
||||
extern s32 DVDT_DRAMtoARAM(u32 owner, u32 dram, u32 aram, u32 len, u32* outLen, Jac_DVDCallback callback);
|
||||
extern s32 DVDT_ARAMtoDRAM(u32 owner, u32 dram, u32 aram, u32 len, u32* outLen, Jac_DVDCallback callback);
|
||||
extern u32 Jac_CheckFile(char* path);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define NEOSTHREAD_H
|
||||
|
||||
#include "types.h"
|
||||
#include "jaudio_NES/audiostruct.h"
|
||||
|
||||
extern void* neosproc(void* param);
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef RSPSIM_H
|
||||
#define RSPSIM_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern void RspStart2(u32* pTaskCmds, s32 allTasks, s32 param_3);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef SUB_SYS_H
|
||||
#define SUB_SYS_H
|
||||
|
||||
#include "types.h"
|
||||
#include "jaudio_NES/audiostruct.h"
|
||||
|
||||
extern s32 CreateAudioTask(Acmd* cmds, s16* pSamples, u32 nSamples, s32 param_4);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SYSTEM_H
|
||||
#define SYSTEM_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern void Nas_InitAudio(u64* acmdBuf, s32 acmdBufSize);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
#include "jaudio_NES/neosthread.h"
|
||||
|
||||
#include "dolphin/os.h"
|
||||
#include "jaudio_NES/dummyrom.h"
|
||||
#include "jaudio_NES/dvdthread.h"
|
||||
#include "jaudio_NES/aictrl.h"
|
||||
#include "jaudio_NES/rate.h"
|
||||
#include "jaudio_NES/audioconst.h"
|
||||
#include "jaudio_NES/system.h"
|
||||
#include "jaudio_NES/audiothread.h"
|
||||
#include "jaudio_NES/cpubuf.h"
|
||||
#include "jaudio_NES/dummyprobe.h"
|
||||
#include "jaudio_NES/sub_sys.h"
|
||||
#include "jaudio_NES/rspsim.h"
|
||||
#include "jaudio_NES/sample.h"
|
||||
|
||||
#define NEOSTHREAD_IMAGE_LOADED_MSG (0x12345678)
|
||||
#define NEOSTHREAD_ACMD_BUF_NUM 1600
|
||||
|
||||
static OSMessageQueue neosproc_mq;
|
||||
static u32 neosproc_mq_init = FALSE;
|
||||
static s16* tmp_buf = nullptr;
|
||||
static BOOL neos_ready = FALSE;
|
||||
|
||||
extern BOOL Neos_Update(s16* dst) {
|
||||
if (neosproc_mq_init) {
|
||||
if (OSSendMessage(&neosproc_mq, (OSMessage)dst, OS_MESSAGE_NOBLOCK) == TRUE) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern void ImageLoaded(u32 param) {
|
||||
OSSendMessage(&neosproc_mq, (OSMessage)NEOSTHREAD_IMAGE_LOADED_MSG, OS_MESSAGE_BLOCK);
|
||||
}
|
||||
|
||||
extern BOOL Neos_CheckBoot(void) {
|
||||
return neos_ready;
|
||||
}
|
||||
|
||||
extern void* neosproc(void* param) {
|
||||
static OSMessage msgbuf[1];
|
||||
static u32 cur = 0;
|
||||
|
||||
neos_ready = FALSE;
|
||||
OSInitMessageQueue(&neosproc_mq, msgbuf, 1);
|
||||
neosproc_mq_init = TRUE;
|
||||
u32 neos_rom_top = GetNeosRomTop();
|
||||
u32 neos_rom_preloaded = GetNeosRom_PreLoaded();
|
||||
u32 neos_file_top = GetNeos_FileTop();
|
||||
|
||||
DVDT_LoadtoARAM(0, "/audiorom.img", neos_rom_top + neos_rom_preloaded, neos_file_top, 0, nullptr, &ImageLoaded);
|
||||
|
||||
OSMessage msg;
|
||||
do {
|
||||
OSReceiveMessage(&neosproc_mq, &msg, 1);
|
||||
} while (msg != (OSMessage)NEOSTHREAD_IMAGE_LOADED_MSG);
|
||||
|
||||
tmp_buf = (s16*)OSAlloc2(DAC_SIZE * 2);
|
||||
|
||||
/* Initialize neos */
|
||||
s32 tmp = AGC.acmdBufSize;
|
||||
u64* acmdBuf = (u64*)OSAlloc2(tmp);
|
||||
Nas_InitAudio(acmdBuf, tmp);
|
||||
NeosSync();
|
||||
neos_ready = TRUE;
|
||||
|
||||
Jac_RegisterMixcallback(&MixCpu, MixMode_Interleave);
|
||||
|
||||
do {
|
||||
static Acmd task_buf[2][NEOSTHREAD_ACMD_BUF_NUM];
|
||||
static u32 tasks[2] = { 0, 0 };
|
||||
|
||||
OSReceiveMessage(&neosproc_mq, &msg, OS_MESSAGE_BLOCK);
|
||||
Probe_Start(8, "NEOS THREAD");
|
||||
s16* samples_dst = (s16*)msg;
|
||||
tasks[cur] = CreateAudioTask(task_buf[cur], tmp_buf, JAC_FRAMESAMPLES, 0);
|
||||
|
||||
tmp = (cur + 1) & 1;
|
||||
if (tasks[tmp]) {
|
||||
RspStart2((u32*)task_buf[tmp], tasks[tmp], 0);
|
||||
tasks[tmp] = 0;
|
||||
Jac_bcopy(tmp_buf, samples_dst, DAC_SIZE * 2);
|
||||
} else {
|
||||
Jac_bzero(samples_dst, DAC_SIZE * 2);
|
||||
}
|
||||
|
||||
Probe_Finish(8);
|
||||
NeosSync();
|
||||
cur = tmp;
|
||||
} while (TRUE);
|
||||
}
|
||||
Reference in New Issue
Block a user