diff --git a/configure.py b/configure.py index 7da386d5..02885142 100644 --- a/configure.py +++ b/configure.py @@ -772,7 +772,7 @@ config.libs = [ "objects": [ Object(Matching, "jaudio_NES/internal/aictrl.c"), Object(Matching, "jaudio_NES/internal/astest.c"), - Object(Matching, "jaudio_NES/internal/audiothread.c"), + Object(Matching, "jaudio_NES/internal/audiothread.c", extra_cflags=["-sym off"]), # The entire lib probably has sym off Object(Matching, "jaudio_NES/internal/cpubuf.c"), Object(Matching, "jaudio_NES/internal/dspboot.c"), Object(Matching, "jaudio_NES/internal/dspbuf.c"), diff --git a/include/jaudio_NES/audiostruct.h b/include/jaudio_NES/audiostruct.h index ed5a0494..d6ac82bf 100644 --- a/include/jaudio_NES/audiostruct.h +++ b/include/jaudio_NES/audiostruct.h @@ -104,7 +104,7 @@ typedef struct adpcmloop_ { typedef struct adpcmbook_ { /* 0x00 */ s32 order; /* 0x04 */ s32 n_predictors; - /* 0x08 */ s16 codebook[0]; /* variable length */ + /* 0x08 */ s16 codebook[0]; /* variable length, length = order * n_predictors * 8 (VADPCM) */ } adpcmbook; typedef struct smzwavetable_ { diff --git a/include/libjsys/jsyswrapper.h b/include/libjsys/jsyswrapper.h index b77c5f12..f876c3a8 100644 --- a/include/libjsys/jsyswrapper.h +++ b/include/libjsys/jsyswrapper.h @@ -88,7 +88,7 @@ extern void JC_JFWDisplay_beginRender(void* manager); extern void JC_JFWDisplay_endRender(void* manager); extern void JC_JFWDisplay_setClearColor(void* manager, GXColor color); extern int JC_JFWDisplay_startFadeOut(void* manager, int fadeout); -extern void JC_JFWDisplay_clearEfb(void* manager, GXColor* color); +extern void JC_JFWDisplay_clearEfb(void* manager, GXColor color); extern const GXRenderModeObj* JC_JFWDisplay_getRenderMode(void* manager); extern void* JC_JFWDisplay_changeToSingleXfb(void* manager, int index); extern void* JC_JFWDisplay_changeToDoubleXfb(void* manager); diff --git a/src/famicom_emu.c b/src/famicom_emu.c index 21cd7207..7cd5207c 100644 --- a/src/famicom_emu.c +++ b/src/famicom_emu.c @@ -6,6 +6,7 @@ #include "dolphin/gx.h" #include "jsyswrap.h" #include "libc64/sprintf.h" +#include "libjsys/jsyswrapper.h" #include "m_common_data.h" #include "m_debug.h" #include "m_malloc.h" @@ -67,26 +68,22 @@ Famicom_MallocInfo my_malloc_func = { }; extern void famicom_emu_main(GAME* famicom) { - static GXColor black_color = { 0, 0, 0, 0 }; - GXColor t; - int i; int padid; pad_t* current_pad; u32 combo; - void* manager; - if (famicom_done == 0) { + if (!famicom_done) { if (famicom_rom_load_check() < 0) { Common_Set(my_room_message_control_flags, Common_Get(my_room_message_control_flags) | 1); - famicom_done = 1; + famicom_done = TRUE; famicom_done_countdown = 0; } else { - for (padid = 0, i = 4; i != 0; i--, padid++) { + for (padid = 0; padid < 4; padid++) { current_pad = &gamePT->pads[padid]; combo = current_pad->now.button | current_pad->on.button; if (combo == (BUTTON_L | BUTTON_R | BUTTON_Z) || combo == (BUTTON_L | BUTTON_R | BUTTON_X | BUTTON_Y)) { - famicom_done = 1; + famicom_done = TRUE; famicom_done_countdown = 60; JC_JFWDisplay_startFadeOut(JC_JFWDisplay_getManager(), famicom_done_countdown); break; @@ -94,23 +91,25 @@ extern void famicom_emu_main(GAME* famicom) { } } } - if (famicom_done != 0) { + + if (famicom_done) { if (famicom_done_countdown == 0) { return_emu_game(famicom); } else { - famicom_done_countdown -= 1; + famicom_done_countdown--; } } JW_BeginFrame(); famicom->disable_display = 1; - if (famicom_done == 0) { + if (!famicom_done) { famicom_1frame(); } else { - manager = JC_JFWDisplay_getManager(); - t = black_color; - JC_JFWDisplay_clearEfb(manager, &t); + static GXColor black_color = { 0, 0, 0, 0 }; + void* manager = JC_JFWDisplay_getManager(); + + JC_JFWDisplay_clearEfb(manager, black_color); } JW_EndFrame(); } @@ -122,7 +121,7 @@ extern void famicom_emu_init(GAME* game) { void* manager; const GXRenderModeObj* render; - famicom_done = 0; + famicom_done = FALSE; famicom_done_countdown = 0; game_resize_hyral(game, 0); Common_Set(famicom_287F9, 0); diff --git a/src/static/jaudio_NES/game/verysimple.c b/src/static/jaudio_NES/game/verysimple.c index aade8e30..67925962 100644 --- a/src/static/jaudio_NES/game/verysimple.c +++ b/src/static/jaudio_NES/game/verysimple.c @@ -7,7 +7,7 @@ #include "jaudio_NES/jammain_2.h" extern void Jac_Start(void* heap, u32 heap_size, u32 aram_size) { - StartAudioThread(heap, heap_size, aram_size, 7); + StartAudioThread(heap, heap_size, aram_size, AUDIO_THREAD_FLAG_DVD | AUDIO_THREAD_FLAG_AUDIO | AUDIO_THREAD_FLAG_NEOS); Jac_WaveDirectorySet("/"); Jac_PlayInit(); Jac_Portcmd_Init(); diff --git a/src/static/jaudio_NES/internal/audiothread.c b/src/static/jaudio_NES/internal/audiothread.c index 846eb92c..2461d12d 100644 --- a/src/static/jaudio_NES/internal/audiothread.c +++ b/src/static/jaudio_NES/internal/audiothread.c @@ -1,6 +1,7 @@ #include "jaudio_NES/audiothread.h" #include "dolphin/os.h" +#include "dolphin/os/OSFastCast.h" #include "dolphin/hw_regs.h" #include "dolphin/ai.h" #include "jaudio_NES/dspproc.h" @@ -37,8 +38,6 @@ static OSMessage msgbuf[AUDIOPROC_MQ_BUF_COUNT]; static u32 audioproc_mq_init = FALSE; volatile int intcount = 0; -extern void OSInitFastCast(void); - extern void DspSyncCountClear(int count) { intcount = count; } @@ -146,25 +145,6 @@ static void* audioproc(void* param) { } } -extern void OSInitFastCast(void) { -#ifdef __MWERKS__ // clang-format off - asm { - li r3, 4 - oris r3, r3, 4 - mtspr 0x392, r3 - li r3, 5 - oris r3, r3, 5 - mtspr 0x393, r3 - li r3, 6 - oris r3, r3, 6 - mtspr 0x394, r3 - li r3, 7 - oris r3, r3, 7 - mtspr 0x395, r3 - } -#endif // clang-format on -} - static BOOL priority_set = FALSE; static OSPriority pri = 0; static OSPriority pri2 = 0; diff --git a/src/static/libforest/emu64/emu64.c b/src/static/libforest/emu64/emu64.c index 4bed6218..3c1d106d 100644 --- a/src/static/libforest/emu64/emu64.c +++ b/src/static/libforest/emu64/emu64.c @@ -30,8 +30,6 @@ static void guMtxXFM1F_dol6w(MtxP mtx, GXProjectionType type, float x, float y, void guMtxXFM1F_dol6w1(MtxP mtx, GXProjectionType type, float x, float y, float z, float w, float* ox, float* oy, float* oz); -extern void OSInitFastCast(void); - static aflags_c aflags; u8 emu64::nChans = 0; static u8 texture_buffer_data[TEX_BUFFER_DATA_SIZE] ATTRIBUTE_ALIGN(32); diff --git a/src/static/libjsys/jsyswrapper_main.cpp b/src/static/libjsys/jsyswrapper_main.cpp index 997b7b60..4c73df16 100644 --- a/src/static/libjsys/jsyswrapper_main.cpp +++ b/src/static/libjsys/jsyswrapper_main.cpp @@ -289,8 +289,8 @@ extern void* JC_JFWDisplay_changeToDoubleXfb(void* manager) { return reinterpret_cast(manager)->changeToDoubleXfb(); } -extern void JC_JFWDisplay_clearEfb(void* manager, GXColor* color) { - reinterpret_cast(manager)->clearEfb(*color); +extern void JC_JFWDisplay_clearEfb(void* manager, GXColor color) { + reinterpret_cast(manager)->clearEfb(color); } extern const GXRenderModeObj* JC_JFWDisplay_getRenderMode(void* manager) {