Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,22 +339,22 @@ def MatchingFor(*versions):
Object(Matching, "jaudio/aictrl.c"),
Object(Matching, "jaudio/sample.c"),
Object(Matching, "jaudio/dummyrom.c"),
Object(not MatchingFor("GPIP01_00"), "jaudio/audiothread.c"),
Object(Matching, "jaudio/audiothread.c"),
Object(Matching, "jaudio/streamctrl.c"),
Object(Matching, "jaudio/dspbuf.c"),
Object(Matching, "jaudio/cpubuf.c"),
Object(Matching, "jaudio/playercall.c"),
Object(Matching, "jaudio/dvdthread.c"),
Object(Matching, "jaudio/rate.c"),
Object(not MatchingFor("G98P01_PIKIDEMO", "DPIJ01_PIKIDEMO"), "jaudio/audiomesg.c"),
Object(Matching, "jaudio/audiomesg.c"),
Object(Matching, "jaudio/stackchecker.c"),
Object(Matching, "jaudio/dspboot.c"),
Object(Matching, "jaudio/dspproc.c"),
Object(Matching, "jaudio/dsptask.c"),
Object(Matching, "jaudio/osdsp.c"),
Object(not MatchingFor("GPIP01_00"), "jaudio/osdsp_task.c"),
Object(Equivalent, "jaudio/osdsp_task.c"),
Object(Matching, "jaudio/ipldec.c"),
Object(not MatchingFor("G98E01_PIKIDEMO", "G98P01_PIKIDEMO"), "jaudio/dsp_cardunlock.c"),
Object(Matching, "jaudio/dsp_cardunlock.c"),
Object(Matching, "jaudio/driverinterface.c"),
Object(Matching, "jaudio/dspdriver.c"),
Object(Matching, "jaudio/dspinterface.c"),
Expand All @@ -367,11 +367,11 @@ def MatchingFor(*versions):
Object(Matching, "jaudio/random.c"),
Object(Matching, "jaudio/aramcall.c"),
Object(Matching, "jaudio/ja_calc.c"),
Object(not MatchingFor("GPIJ01_01", "G98P01_PIKIDEMO", "DPIJ01_PIKIDEMO"), "jaudio/fat.c"),
Object(Matching, "jaudio/fat.c"),
Object(Matching, "jaudio/cmdstack.c"),
Object(Matching, "jaudio/virload.c"),
Object(Matching, "jaudio/heapctrl.c"),
Object(not MatchingFor("GPIJ01_01", "G98P01_PIKIDEMO", "DPIJ01_PIKIDEMO"), "jaudio/jammain_2.c"),
Object(Matching, "jaudio/jammain_2.c"),
Object(Matching, "jaudio/midplay.c"),
Object(Matching, "jaudio/noteon.c"),
Object(Matching, "jaudio/seqsetup.c"),
Expand All @@ -385,15 +385,15 @@ def MatchingFor(*versions):
Object(Matching, "jaudio/piki_player.c"),
Object(Matching, "jaudio/piki_bgm.c"),
Object(Matching, "jaudio/piki_scene.c"),
Object(not MatchingFor("GPIP01_00"), "jaudio/pikidemo.c"),
Object(Matching, "jaudio/pikidemo.c"),
Object(Matching, "jaudio/file_seq.c"),
Object(Matching, "jaudio/cmdqueue.c"),
Object(Matching, "jaudio/filter3d.c"),
Object(not MatchingFor("GPIP01_00"), "jaudio/syncstream.c"),
Object(Matching, "jaudio/bankloader.c"),
Object(Matching, "jaudio/interleave.c"),
Object(Matching, "jaudio/pikiseq.c"),
Object(not MatchingFor("GPIP01_00"), "jaudio/hvqm_play.c"),
Object(Matching, "jaudio/hvqm_play.c"),
],
},
{
Expand Down Expand Up @@ -522,7 +522,7 @@ def MatchingFor(*versions):
Object(Matching, "plugPikiKando/fastGrid.cpp"),
Object(Matching, "plugPikiKando/ropeCreature.cpp"),
Object(Matching, "plugPikiKando/objectTypes.cpp"),
Object(not MatchingFor("DPIJ01_PIKIDEMO"), "plugPikiKando/pelletMgr.cpp"),
Object(Matching, "plugPikiKando/pelletMgr.cpp"),
Object(Matching, "plugPikiKando/animPellet.cpp"),
Object(Matching, "plugPikiKando/genPellet.cpp"),
Object(Matching, "plugPikiKando/pelletState.cpp"),
Expand Down Expand Up @@ -870,7 +870,7 @@ def MatchingFor(*versions):
Object(Matching, "os/OSInterrupt.c"),
Object(Matching, "os/OSLink.c"),
Object(Matching, "os/OSMessage.c"),
Object(not MatchingFor("DPIJ01_PIKIDEMO"), "os/OSMemory.c"),
Object(Matching, "os/OSMemory.c"),
Object(Matching, "os/OSMutex.c"),
Object(Matching, "os/OSReboot.c"),
Object(Matching, "os/OSReset.c"),
Expand Down
1 change: 1 addition & 0 deletions include/Dolphin/OS/OSSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ u32 SIGetStatus(void); // WHAT?
u32 SIGetStatus(s32 chan);
#endif
void SISetCommand(s32 chan, u32 command);
u32 SIGetCommand(s32 chan);
void SITransferCommands(void);
u32 SISetXY(u32 x, u32 y);
u32 SIEnablePolling(u32 poll);
Expand Down
15 changes: 11 additions & 4 deletions include/Dolphin/card.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,10 @@ struct CARDControl {
CARDCallback eraseCallback; // _D8
CARDCallback unlockCallback; // _DC
OSAlarm alarm; // _E0, for timeout.
#if OS_BUILD_VERSION >= 20011112L
#if OS_BUILD_VERSION >= 20011112L && !defined(JAUDIO_BROKEN_CARDUNLOCK)
u32 cid; // _108
const DVDDiskID* diskID; // _10C
#endif
// while these members DO clearly exist in demo, dsp_cardunlock.c in jaudio seems to disagree
};

// CARD identification struct (size 0x200).
Expand Down Expand Up @@ -202,10 +201,18 @@ struct CARDDecodeParameters {
};

// Enum for 'permission' in CARDDir.
typedef enum { FilePermPublic = 0x2, FilePermNoCopy = 0x4, FilePermNoMove = 0x8 } CARDFilePermissions;
typedef enum {
FilePermPublic = 0x2,
FilePermNoCopy = 0x4,
FilePermNoMove = 0x8,
} CARDFilePermissions;

// Enum for banner format in CARDDir.
typedef enum { BannerColorCI8 = 0x1, BannerPresent = 0x2, IconAnimationPingPong = 0x4 } CARDBannerFlag;
typedef enum {
BannerColorCI8 = 0x1,
BannerPresent = 0x2,
IconAnimationPingPong = 0x4,
} CARDBannerFlag;

// Managers for both memory card slots (A and B).
extern CARDControl __CARDBlock[2];
Expand Down
12 changes: 0 additions & 12 deletions include/jaudio/dsp_cardunlock.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/jaudio/jammain_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void Jam_CheckExportApp(void);
void Jam_CheckImportApp(void);
void Jam_WritePortIndirect(void);
void Jam_ReadPortIndirect(void);
BOOL Jam_CheckPortIndirect(seqp_*, u8, int);
BOOL Jam_CheckPortIndirect(seqp_*, u32, u16);
BOOL Jam_WritePortAppDirect(seqp_*, u32, u16);
BOOL Jam_ReadPortAppDirect(seqp_*, u32, u16*);
BOOL Jam_CheckPortAppDirect(seqp_*, u32, u16);
Expand Down
13 changes: 7 additions & 6 deletions include/jaudio/syncstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef int (*StreamCallback)(u32, s32);

void Init_StreamAudio(void);
void Get_StreamAudio_Handle(int);
BOOL StreamAudio_Start(u32, int, immut char*, int, int, StreamHeader_*);
BOOL StreamAudio_Start(u32, int, immut char*, BOOL, BOOL, StreamHeader_*);
void RegisterStreamCallback(StreamCallback);
void Jac_Decode_ADPCM(u8*, s16*, s16*, u32, u8, s16*);
BOOL StreamSyncCheckReady(u32);
Expand All @@ -34,6 +34,7 @@ u8 StreamCheckAudioFormat(u32);
void StreamCheckBufferEmpty(void);
void StreamCheckBufferRemainSize(void);

// size 0x10
struct BufControl_ {
u8 state; // _00
u8 maxBufCount; // _01
Expand Down Expand Up @@ -86,10 +87,10 @@ struct StreamCtrl_ {
u32 samplesDecoded; // _21980
u32 playbackState; // _21984
StreamHeader_ header; // _21988
s32 autoStart; // _219A8
s32 stopRequested; // _219AC
BOOL autoStart; // _219A8
BOOL stopRequested; // _219AC
BOOL isPaused; // _219B0
s32 isAtEnd; // _219B4
BOOL isAtEnd; // _219B4
DVDFileInfo fileinfo; // _219B8
dspch_* dspch[2]; // _219F4
u32 totalSamples; // _219FC
Expand All @@ -108,8 +109,8 @@ struct StreamCtrl_ {
u32 updateFlags; // _21A38
u32 _21A3C; // _21A3C
u32 samplesLoaded; // _21A40
s32 isBufferingComplete; // _21A44
s32 isLoadInProgress; // _21A48
BOOL isBufferingComplete; // _21A44
BOOL isLoadInProgress; // _21A48
s32 bufferMargin; // _21A4C
};

Expand Down
4 changes: 2 additions & 2 deletions include/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ enum {
/**
* @brief FABRICATED - No other class we currently know of has a virtual table like this.
*/
struct System_Class_250 {
struct SystemClass250 {
virtual void method(Graphics& gfx) = 0; // _00

// _00 = VTBL
Expand Down Expand Up @@ -420,7 +420,7 @@ struct System : public StdSystem {
u32 mHeapStart; // _244
u32 mHeapEnd; // _248
Graphics* mDGXGfx; // _24C, cast to DGXGraphics in DOL
System_Class_250* _250; // _250, a vestigial pointer related to `System::halt`
SystemClass250* _250; // _250, a vestigial pointer related to `System::halt`
Delegate1<System, Graphics&>* mDvdErrorCallback; // _254
int mDvdErrorCode; // _258
u32 mDvdBufferSize; // _25C
Expand Down
1 change: 1 addition & 0 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ typedef u32 HWND;
#define IS_NOT_ALIGNED(X, N) (((X) & ((N) - 1)) != 0) // True if X is not aligned to N bytes, else false
#define ATTRIBUTE_ALIGN(num) __attribute__((aligned(num))) // Align object to num bytes (num should be power of two)

// Makes the compiler averse to using that register for the entire function.
#define BUMP_REGISTER(reg) TERNARY_BUILD_MATCHING(MACRO_ARG({ asm { mr reg, reg } }), (void)0)

// clang-format off
Expand Down
4 changes: 2 additions & 2 deletions src/ai/ai.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ static void __AISHandler(s16 interrupt, OSContext* context)
static void __AIDHandler(s16 interrupt, OSContext* context)
{
OSContext tempContext;
u32 temp = __DSPRegs[5];
__DSPRegs[5] = (temp & ~0xA0) | 8;
u32 temp = __DSPRegs[DSP_CONTROL_STATUS];
__DSPRegs[DSP_CONTROL_STATUS] = (temp & ~0xA0) | 8;
OSClearContext(&tempContext);
OSSetCurrentContext(&tempContext);
if (__AID_Callback) {
Expand Down
2 changes: 1 addition & 1 deletion src/card/CARDMount.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static s32 DoMount(s32 channel)

sram = __OSLockSramEx();
vendorID = *(u16*)sram->flashID[channel];
__OSUnlockSramEx(0);
__OSUnlockSramEx(FALSE);

if (__CARDVendorID == 0xFFFF || vendorID != __CARDVendorID) {
result = CARD_RESULT_WRONGDEVICE;
Expand Down
16 changes: 9 additions & 7 deletions src/dsp/dsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,17 @@ void DSPInit(void)
__OSSetInterruptHandler(7, __DSPHandler);
__OSUnmaskInterrupts(OS_INTERRUPTMASK_DSP_DSP);

tmp = __DSPRegs[5];
tmp = (tmp & ~0xA8) | 0x800;
__DSPRegs[5] = tmp;
tmp = __DSPRegs[DSP_CONTROL_STATUS];
__DSPRegs[DSP_CONTROL_STATUS] = (tmp & ~0xA8) | 0x800;

tmp = __DSPRegs[5];
__DSPRegs[5] = tmp = tmp & ~0xAC;
tmp = __DSPRegs[DSP_CONTROL_STATUS];
__DSPRegs[DSP_CONTROL_STATUS] = tmp & ~0xAC;

__DSP_first_task = __DSP_last_task = __DSP_curr_task = __DSP_tmp_task = NULL;
__DSP_init_flag = 1;
__DSP_tmp_task = NULL;
__DSP_curr_task = NULL;
__DSP_last_task = NULL;
__DSP_first_task = NULL;
__DSP_init_flag = 1;

OSRestoreInterrupts(old);
}
Expand Down
6 changes: 2 additions & 4 deletions src/jaudio/audiomesg.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ void Jac_InitMessageQueue(Jac_MessageQueue* queue, OSMessage* msgArray, s32 coun
*/
BOOL Jac_SendMessageBlock(Jac_MessageQueue* queue, OSMessage mesg)
{
if (Jac_SendMessage(queue, mesg) == TRUE) {
return TRUE;
}
// UNUSED FUNCTION
while (Jac_SendMessage(queue, mesg) != TRUE) { }
return TRUE;
}

/**
Expand Down
14 changes: 9 additions & 5 deletions src/jaudio/audiothread.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,25 @@ static void DspSync()
*/
static void DspSync2(void*)
{
volatile u32 check;
u32 check;
u32 mesg;
u32 stack;

u32* REF_check = &check;
STACK_PAD_VAR(1);

do {
check = DSPCheckMailFromDSP();
} while (check == 0);

mesg = DSPReadMailFromDSP();
if (mesg >> 0x10 == 0xf355) {
stack = 0x10000;
if (u16(mesg & 0xff00) == stack - 0x100) {
switch (mesg & 0xff00) {
case 0xff00:
DspSync();
} else {
break;
default:
DspFinishWork(mesg);
break;
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/jaudio/cmdqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ static s32 Jal_FrameWork(void* a)

for (curr = queue_list; curr; curr = curr->next) {
#if defined(VERSION_GPIJ01_01) || defined(VERSION_G98P01_PIKIDEMO) || defined(VERSION_DPIJ01_PIKIDEMO)
if (Jam_CheckPortIndirect(curr->track, curr->_64, 1) == 1) {
if (Jam_CheckPortIndirect(curr->track, curr->_64, 1) == 1)
#else
if (Jam_CheckPortAppDirect(curr->track, curr->_64, 1) == 1) {
if (Jam_CheckPortAppDirect(curr->track, curr->_64, 1) == 1)
#endif
{
if (Jac_ReceiveMessage_Fast(&curr->msgQueue, &message) == 1) {
Jam_WritePortAppDirect(curr->track, curr->_64, (u16)message);
}
Expand Down
10 changes: 8 additions & 2 deletions src/jaudio/dsp_cardunlock.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#include "jaudio/dsp_cardunlock.h"

// This file uses `OSAssert` even in release builds.
#define DEBUG

// This modifies the struct `CARDControl` in "Dolphin/card.h" to be broken on purpose. Maybe a duplicate definition
// of `CARDControl` was in a JAudio library header and they forgot to update it after it was changed in the SDK?
// This probably implies JAudio didn't use the SDK header, but I'd rather not duplicate any more than we already have.
#if defined(VERSION_G98E01_PIKIDEMO) || defined(VERSION_G98P01_PIKIDEMO)
#define JAUDIO_BROKEN_CARDUNLOCK
#endif

#include "Dolphin/card.h"
#include "Dolphin/exi.h"
#include "Dolphin/os.h"
Expand Down
4 changes: 2 additions & 2 deletions src/jaudio/dspdriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ dspch_* AllocDSPchannel(u32 param_1, u32 param_2)

s32 i;
STACK_PAD_VAR(1);
u32* p2 = &param_2;
s32* ip = &i;
u32* REF_param_2 = &param_2;
s32* REF_i = &i;
if (param_1 == 0) {

for (i = 0; i < DSPCH_LENGTH; ++i) {
Expand Down
10 changes: 7 additions & 3 deletions src/jaudio/fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ static struct FAT_info2 {
} FH_TO_FAT[FAT_SIZE];

static FATEntry FAT[FAT_SIZE];

// havent figured this out yet
static struct FATEntry fattmp[FAT_SIZE];
#if defined(VERSION_GPIJ01_01) || defined(VERSION_DPIJ01_PIKIDEMO) || defined(VERSION_G98P01_PIKIDEMO)
#else
static FATEntry fattmp[FAT_SIZE];
#endif

/**
* @TODO: Documentation
Expand Down Expand Up @@ -126,6 +127,9 @@ int FAT_FreeMemory(u16 size)
u16 size2;
u32 count;
u16 tail;
#if defined(VERSION_GPIJ01_01) || defined(VERSION_DPIJ01_PIKIDEMO) || defined(VERSION_G98P01_PIKIDEMO)
FATEntry fattmp[FAT_SIZE];
#endif

count = FH_TO_FAT[size].blockCount;
start = FH_TO_FAT[size].startBlock;
Expand Down
Loading
Loading