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
11 changes: 9 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
"GAMECUBE"
],
"includePath": [
"${workspaceFolder}/include/**",
"${workspaceFolder}/src/**"
"${workspaceFolder}/include",
"${workspaceFolder}/include/bink",
"${workspaceFolder}/include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include",
"${workspaceFolder}/include/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include",
"${workspaceFolder}/include/inline",
"${workspaceFolder}/include/rwsdk",
"${workspaceFolder}/src/SB/Core/gc",
"${workspaceFolder}/src/SB/Core/x",
"${workspaceFolder}/src/SB/Game"
],
"cStandard": "c99",
"cppStandard": "c++98",
Expand Down
1 change: 0 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@
"-i include/bink",
"-i include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include",
"-i include/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include",
"-i include/dolphin",
"-i include/inline",
"-i include/rwsdk",
"-i src/SB/Core/gc",
Expand Down
24 changes: 24 additions & 0 deletions include/dolphin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef _DOLPHIN_H_
#define _DOLPHIN_H_

#include <dolphin/types.h>
#include <dolphin/os.h>
#include <dolphin/dsp.h>
#include <dolphin/dvd.h>
#include <dolphin/gx.h>
#include <dolphin/hio.h>
#include <dolphin/mtx.h>
#include <dolphin/vi.h>
#include <dolphin/card.h>
#include <dolphin/perf.h>
#include <dolphin/ar.h>
#include <dolphin/base/PPCArch.h>
#include <dolphin/db.h>
#include <dolphin/pad.h>
#include <dolphin/dtk.h>
#include <dolphin/ai.h>
#include <dolphin/demo.h>
#include <dolphin/exi.h>
#include <dolphin/si.h>

#endif
88 changes: 88 additions & 0 deletions include/dolphin/G2D.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#ifndef _DOLPHIN_G2D_H_
#define _DOLPHIN_G2D_H_

#include <dolphin/gx.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum G2DMatCtg {
G2D_CTG_TEXTURE,
G2D_CTG_RGB_DIRECT,
G2D_CTG_RGBA_INDEX8,
G2D_CTG_EMPTY,
} G2DMatCtg;

typedef struct G2DSprite {
u16 nTlcS; // "Top Left Corner"
u16 nTlcT;
u16 nWidth;
u16 nHeight;
GXTexObj* to;
f32 rS0;
f32 rT0;
f32 rS1;
f32 rT1;
} G2DSprite;

typedef struct G2DPosOri {
f32 rPosX;
f32 rPosY;
f32 rOriX;
f32 rOriY;
} G2DPosOri;

typedef struct G2DGlob {
u16 nViewportTlcX;
u16 nViewportTlcY;
u16 nViewportWidth;
u16 nViewportHeight;
G2DPosOri poCam;
f32 rWorldX;
f32 rWorldY;
f32 rHalfX;
f32 rHalfY;
} G2DGlob;

typedef struct G2DMatDesc {
s32 nReserved;
G2DMatCtg nCategory;
GXColor* color;
GXTexObj* to;
u8* clut; // Color Look-Up Table
} G2DMatDesc;

typedef struct G2DTileDesc {
u8 nMaterial;
u8 nS;
u8 nT;
u8 nCI; // Color Index
u8 aUser[4];
} G2DTileDesc;

typedef struct G2DLayer {
void* map;
s8 nHS;
s8 nVS;
s8 nBPI;
s16 nTileWidth;
s16 nTileHeight;
s8 bWrap;
u8 nNumMaterials;
G2DTileDesc* tileDesc;
G2DMatDesc* matDesc;
} G2DLayer;

void G2DInitSprite(G2DSprite* sprite);
void G2DDrawSprite(G2DSprite* sprite, G2DPosOri* po);
void G2DDrawLayer(G2DLayer* layer, s8* aSortBuffer);
void G2DSetCamera(G2DPosOri* po);
void G2DInitWorld(u32 nWorldX, u32 nWorldY);
void G2DSetViewport(u16 nLeft, u16 nTop, u16 nWidth, u16 nHeight);

#ifdef __cplusplus
}
#endif

#endif // _DOLPHIN_G2D_H_
50 changes: 50 additions & 0 deletions include/dolphin/ai.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef _DOLPHIN_AI_H_
#define _DOLPHIN_AI_H_

#include <dolphin/types.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef void (*AISCallback)(u32 count);
typedef void (*AIDCallback)();

#define AI_STREAM_START 1
#define AI_STREAM_STOP 0

#define AI_SAMPLERATE_32KHZ 0
#define AI_SAMPLERATE_48KHZ 1

AIDCallback AIRegisterDMACallback(AIDCallback callback);
void AIInitDMA(u32 start_addr, u32 length);
BOOL AIGetDMAEnableFlag(void);
void AIStartDMA(void);
void AIStopDMA(void);
u32 AIGetDMABytesLeft(void);
u32 AIGetDMAStartAddr(void);
u32 AIGetDMALength(void);
BOOL AICheckInit(void);
AISCallback AIRegisterStreamCallback(AISCallback callback);
u32 AIGetStreamSampleCount(void);
void AIResetStreamSampleCount(void);
void AISetStreamTrigger(u32 trigger);
u32 AIGetStreamTrigger(void);
void AISetStreamPlayState(u32 state);
u32 AIGetStreamPlayState(void);
void AISetDSPSampleRate(u32 rate);
u32 AIGetDSPSampleRate(void);
void AISetStreamSampleRate(u32 rate);
u32 AIGetStreamSampleRate(void);
void AISetStreamVolLeft(u8 vol);
u8 AIGetStreamVolLeft(void);
void AISetStreamVolRight(u8 vol);
u8 AIGetStreamVolRight(void);
void AIInit(u8* stack);
void AIReset(void);

#ifdef __cplusplus
}
#endif

#endif
26 changes: 26 additions & 0 deletions include/dolphin/am.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef _DOLPHIN_AM_H_
#define _DOLPHIN_AM_H_

#include <dolphin/types.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef void (*AMCallback)(char* path);

void* AMLoadFile(char* path, u32* length);
u32 AMPush(char* path);
u32 AMPushData(void* buffer, u32 length);
void AMPop(void);
u32 AMGetZeroBuffer(void);
u32 AMGetReadStatus(void);
u32 AMGetFreeSize(void);
u32 AMGetStackPointer(void);
void AMInit(u32 aramBase, u32 aramBytes);

#ifdef __cplusplus
}
#endif

#endif
123 changes: 123 additions & 0 deletions include/dolphin/amc/AmcExi2Comm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#ifndef _DOLPHIN_AMC_AMCEXI2COMM_H_
#define _DOLPHIN_AMC_AMCEXI2COMM_H_

#include <dolphin/os.h>
#include <dolphin/amc/AmcTypes.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum
{
AMC_EXI_NO_ERROR = 0,
AMC_EXI_UNSELECTED,
} AmcExiError;

// ---------------------------------------------------------------------------
//
// void EXI2_Init( volatile unsigned char **inputPendingPtrRef,
// EXICallback monitorCallback );
//
// Description: Initialize the EXI2 driver (without interrupts). The
// parameter 'inputPendingPtrref' is a flag showing whether input
// is waiting in the EXI2 buffer and 'monitorCallback' is a
// pointer to a callback function that is invoked at the end of
// the EXI2 ISR.
//
// ---------------------------------------------------------------------------
void EXI2_Init(volatile unsigned char **inputPendingPtrRef, EXICallback monitorCallback);

// ---------------------------------------------------------------------------
//
// void EXI2_EnableInterrupts( void );
//
// Description: Enable EXI2 interrupts. This function must be called to use
// interrupts on the EXI2 interface. Call this function only
// after EXI2_Init() has been invoked.
//
// ---------------------------------------------------------------------------
void EXI2_EnableInterrupts( void );



// ---------------------------------------------------------------------------
//
// int EXI2_Poll( void );
//
// Description: Returns the number of bytes waiting to be read in the EXI2
// buffer.
//
// ---------------------------------------------------------------------------
int EXI2_Poll( void );



// ---------------------------------------------------------------------------
//
// AmcExiError EXI2_ReadN( void *bytes, unsigned long length );
//
// Description: Read length bytes and return in bytes[] array.
//
// Returns: One of AMC_EXI_*.
//
// ---------------------------------------------------------------------------
AmcExiError EXI2_ReadN( void *bytes, unsigned long length);



// ---------------------------------------------------------------------------
//
// AmcExiError EXI2_WriteN( const void *bytes, unsigned long length );
//
// Description: Write length bytes stored in bytes[] array.
//
// Returns: One of AMC_EXI_*.
//
// ---------------------------------------------------------------------------
AmcExiError EXI2_WriteN( const void *bytes, unsigned long length);



// ---------------------------------------------------------------------------
//
// void EXI2_Reserve( void );
//
// Description: Disable non-monitor communications over the EXI2 port.
// This function must be called before the monitor takes
// control of the processor.
//
// ---------------------------------------------------------------------------
void EXI2_Reserve( void );



// ---------------------------------------------------------------------------
//
// void EXI2_Unreserve( void );
//
// Description: Re-enable non-monitor communications over the EXI2 port.
// This function must be called just before the monitor
// gives control of the processor back to the application.
//
// ---------------------------------------------------------------------------
void EXI2_Unreserve( void );



// ---------------------------------------------------------------------------
//
// AmcExiError EXI2_GetStatusReg( u16* pu16StatusReg );
//
// Description: Read and store the value of the status register into
// *pu16StatusReg.
//
// Returns: One of AMC_EXI_*.
// ---------------------------------------------------------------------------
AmcExiError EXI2_GetStatusReg( u16* pu16StatusReg );

#ifdef __cplusplus
}
#endif

#endif
9 changes: 9 additions & 0 deletions include/dolphin/amc/AmcTypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef _INCLUDE_DOLPHIN_AMCTYPES_H_
#define _INCLUDE_DOLPHIN_AMCTYPES_H_

#include <dolphin/os.h>

// EXI callback function pointer type
typedef void (*EXICallback)(s32 chan, OSContext* context);

#endif
Loading
Loading