NES: make it C++

so we can submit to chan osc buffer
This commit is contained in:
tildearrow 2025-03-07 01:57:52 -05:00
parent 1d60bb03cc
commit 5df3e1f030
7 changed files with 16 additions and 39 deletions

View file

@ -554,9 +554,9 @@ src/engine/platform/sound/segapcm.cpp
src/engine/platform/sound/gb/apu.c src/engine/platform/sound/gb/apu.c
src/engine/platform/sound/gb/timing.c src/engine/platform/sound/gb/timing.c
src/engine/platform/sound/pce_psg.cpp src/engine/platform/sound/pce_psg.cpp
src/engine/platform/sound/nes/apu.c src/engine/platform/sound/nes/apu.cpp
src/engine/platform/sound/nes/fds.c src/engine/platform/sound/nes/fds.cpp
src/engine/platform/sound/nes/mmc5.c src/engine/platform/sound/nes/mmc5.cpp
src/engine/platform/sound/vera_psg.c src/engine/platform/sound/vera_psg.c
src/engine/platform/sound/vera_pcm.c src/engine/platform/sound/vera_pcm.c
src/engine/platform/sound/ymf278b/ymf278.cpp src/engine/platform/sound/ymf278b/ymf278.cpp

View file

@ -376,5 +376,4 @@ void apu_turn_on(struct NESAPU* a, BYTE apu_type) {
a->S2.timer=2048; a->S2.timer=2048;
a->TR.timer=2048; a->TR.timer=2048;
a->NS.timer=0x0FE4; a->NS.timer=0x0FE4;
//a->DMC.=0x01AC;
} }

View file

@ -406,20 +406,14 @@ typedef struct _apuDMC {
BYTE tick_type; BYTE tick_type;
} _apuDMC; } _apuDMC;
#if defined (__cplusplus) struct _nla_table {
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
EXTERNC struct _nla_table {
SWORD pulse[32]; SWORD pulse[32];
SWORD tnd[203]; SWORD tnd[203];
}; };
extern struct _nla_table nla_table; extern struct _nla_table nla_table;
EXTERNC struct NESAPU { struct NESAPU {
_apu apu; _apu apu;
_r4011 r4011; _r4011 r4011;
_r4015 r4015; _r4015 r4015;
@ -538,9 +532,7 @@ static const WORD dmc_rate[3][16] = {
} }
}; };
EXTERNC void apu_tick(struct NESAPU* a, int len); void apu_tick(struct NESAPU* a, int len);
EXTERNC void apu_turn_on(struct NESAPU* a, BYTE apu_type); void apu_turn_on(struct NESAPU* a, BYTE apu_type);
#undef EXTERNC
#endif /* APU_H_ */ #endif /* APU_H_ */

View file

@ -23,13 +23,7 @@
enum fds_operations { FDS_OP_NONE, FDS_OP_READ, FDS_OP_WRITE }; enum fds_operations { FDS_OP_NONE, FDS_OP_READ, FDS_OP_WRITE };
#if defined (__cplusplus) struct _fds {
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
EXTERNC struct _fds {
// snd // snd
BYTE enabled_snd_reg; BYTE enabled_snd_reg;
struct _fds_snd { struct _fds_snd {
@ -86,8 +80,8 @@ EXTERNC struct _fds {
} snd; } snd;
}; };
EXTERNC void extcl_apu_tick_FDS(struct _fds* fds); void extcl_apu_tick_FDS(struct _fds* fds);
EXTERNC void fds_reset(struct _fds* fds); void fds_reset(struct _fds* fds);
#undef EXTERNC #undef EXTERNC

View file

@ -21,13 +21,7 @@
#include "apu.h" #include "apu.h"
#if defined (__cplusplus) struct _mmc5 {
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
EXTERNC struct _mmc5 {
BYTE prg_mode; BYTE prg_mode;
BYTE chr_mode; BYTE chr_mode;
BYTE ext_mode; BYTE ext_mode;
@ -69,12 +63,10 @@ EXTERNC struct _mmc5 {
/* ------------------------------------------------------- */ /* ------------------------------------------------------- */
}; };
EXTERNC void map_init_MMC5(struct _mmc5* mmc5); void map_init_MMC5(struct _mmc5* mmc5);
EXTERNC void extcl_cpu_wr_mem_MMC5(struct _mmc5* mmc5, WORD address, BYTE value); void extcl_cpu_wr_mem_MMC5(struct _mmc5* mmc5, WORD address, BYTE value);
EXTERNC void extcl_length_clock_MMC5(struct _mmc5* mmc5); void extcl_length_clock_MMC5(struct _mmc5* mmc5);
EXTERNC void extcl_envelope_clock_MMC5(struct _mmc5* mmc5); void extcl_envelope_clock_MMC5(struct _mmc5* mmc5);
EXTERNC void extcl_apu_tick_MMC5(struct _mmc5* mmc5); void extcl_apu_tick_MMC5(struct _mmc5* mmc5);
#undef EXTERNC
#endif /* MAPPER_MMC5_H_ */ #endif /* MAPPER_MMC5_H_ */