link playercall

This commit is contained in:
Prakxo
2024-06-08 19:50:33 +02:00
parent dd463a6e6f
commit d9cf62aa29
5 changed files with 104 additions and 1 deletions
+1
View File
@@ -6,6 +6,7 @@ symbol_aligns:
0x80018920: 32
0x800190e0: 32
0x80019380: 32
0x8001a0c0: 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
+3
View File
@@ -84,6 +84,9 @@ jaudio_NES/internal/neosthread.c:
.bss: [0x80180020, 0x80186440]
.sdata: [0x80217be0, 0x80217be8]
.sbss: [0x80218460, 0x80218478]
jaudio_NES/internal/playercall.c:
.text: [0x80019dc0, 0x8001a0c0]
.bss: [0x801864d0,0x80186590]
jaudio_NES/internal/os.c:
.text: [0x80026120, 0x80026300]
Famicom/famicom.cpp:
+9
View File
@@ -894,6 +894,15 @@ typedef union SOUNDID_ {
u32 uint32;
} SOUNDID;
typedef s32 (*PlayerCallBack)(void*);
typedef struct PLAYER_CALL_ {
PlayerCallBack callback;
void* arg;
u32 DSP_mode;
} PLAYER_CALL;
#ifdef __cplusplus
}
#endif
+8 -1
View File
@@ -2,15 +2,22 @@
#define PLAYERCALL_H
#include "types.h"
#include "jaudio_NES/audiostruct.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void ResetPlayerCallback(void);
extern void ResetPlayerCallback();
extern s32 Jac_RegisterDspPlayerCallback(PlayerCallBack callback, void* arg);
extern s32 Jac_RegisterPlayerCallback(PlayerCallBack callback, void* arg);
#ifdef __cplusplus
}
#endif
extern void PlayerCallback();
extern void DspPlayerCallback();
#endif
@@ -0,0 +1,83 @@
#include "jaudio_NES/playercall.h"
#include "jaudio_NES/audiostruct.h"
static PLAYER_CALL PLAYER_CALLLIST[16];
extern void ResetPlayerCallback(){
int i;
for(i = 0; i < 16; i++){
PLAYER_CALLLIST[i].callback = nullptr;
}
}
static s32 Jac_CheckPlayerCallback(PlayerCallBack callback, void* arg){
int i;
for(i = 0; i < 16; i++){
if(PLAYER_CALLLIST[i].callback == callback && PLAYER_CALLLIST[i].arg == arg){
return i;
}
}
return -1;
}
extern s32 Jac_RegisterDspPlayerCallback(PlayerCallBack callback, void* arg){
s32 idx = Jac_RegisterPlayerCallback(callback,arg);
if(idx == -1){
return -1;
}
PLAYER_CALLLIST[idx].DSP_mode = true;
return idx;
}
extern s32 Jac_RegisterPlayerCallback(PlayerCallBack callback, void* arg){
u32 i;
for(i = 0; i < 16; i++){
if(PLAYER_CALLLIST[i].callback == nullptr){
break;
}
}
if(i == 16){
return -1;
}
if(Jac_CheckPlayerCallback(callback,arg) != -1){
return -1;
}
else{
PLAYER_CALLLIST[i].callback = callback;
PLAYER_CALLLIST[i].arg = arg;
PLAYER_CALLLIST[i].DSP_mode = false;
return i;
}
return -1;
}
extern void PlayerCallback(){
u32 i;
for(i = 0; i < 16; i++){
PlayerCallBack callback = PLAYER_CALLLIST[i].callback;
if(callback != nullptr && PLAYER_CALLLIST[i].DSP_mode == false && callback(PLAYER_CALLLIST[i].arg) == -1){
PLAYER_CALLLIST[i].callback = nullptr;
}
}
}
extern void DspPlayerCallback(){
u32 i;
for(i = 0; i < 16; i++){
PlayerCallBack callback = PLAYER_CALLLIST[i].callback;
if(callback != nullptr && PLAYER_CALLLIST[i].DSP_mode == true && callback(PLAYER_CALLLIST[i].arg) == -1){
PLAYER_CALLLIST[i].callback = nullptr;
}
}
}