mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-02 08:11:58 -04:00
Copy JKernel (#126)
* start JSystem * JKRAram and JUTGamePad * started heap and thread * more JKernel * mostly finished JKernel * delete unused asm * JKRFileFinder * delete unused asm and match findNextFile * format * fix mtx_vec
This commit is contained in:
@@ -3,4 +3,10 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
extern "C" {
|
||||
u32 ARInit(u32*, u32);
|
||||
u32 ARAlloc(u32);
|
||||
u32 ARGetSize(void);
|
||||
}
|
||||
|
||||
#endif /* AR_H */
|
||||
|
||||
@@ -3,4 +3,23 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
typedef void (*ARQCallback)(u32 request_address);
|
||||
|
||||
struct ARQRequest {
|
||||
ARQRequest* next;
|
||||
u32 owner;
|
||||
u32 type;
|
||||
u32 priority;
|
||||
u32 source;
|
||||
u32 destination;
|
||||
u32 length;
|
||||
ARQCallback callback;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
void ARQInit(void);
|
||||
void ARQPostRequest(ARQRequest* task, u32 owner, u32 type, u32 priority, u32 source,
|
||||
u32 destination, u32 length, ARQCallback callback);
|
||||
}
|
||||
|
||||
#endif /* ARQ_H */
|
||||
|
||||
@@ -3,4 +3,89 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
typedef enum DVDState {
|
||||
DVD_STATE_END = 0x0,
|
||||
DVD_STATE_BUSY = 0x1,
|
||||
DVD_STATE_WAITING = 0x2,
|
||||
DVD_STATE_COVER_CLOSED = 0x3,
|
||||
DVD_STATE_NO_DISK = 0x4,
|
||||
DVD_STATE_COVER_OPEN = 0x5,
|
||||
DVD_STATE_WRONG_DISK = 0x6,
|
||||
DVD_STATE_MOTOR_STOPPED = 0x7,
|
||||
DVD_STATE_IGNORED = 0x8,
|
||||
DVD_STATE_CANCELED = 0xa, // lmao they skipped 9
|
||||
DVD_STATE_RETRY = 0xb,
|
||||
DVD_STATE_FATAL_ERROR = -1,
|
||||
} DVDState;
|
||||
}
|
||||
|
||||
struct DVDDirectory {
|
||||
u32 entry_number;
|
||||
u32 location;
|
||||
u32 next;
|
||||
};
|
||||
|
||||
struct DVDDirectoryEntry {
|
||||
u32 entry_number;
|
||||
BOOL is_directory;
|
||||
char* name;
|
||||
};
|
||||
|
||||
struct DVDDiskID {
|
||||
char game_name[4];
|
||||
char company[2];
|
||||
u8 disk_number;
|
||||
u8 game_version;
|
||||
u8 is_streaming;
|
||||
u8 streaming_buffer_size;
|
||||
u8 padding[22];
|
||||
};
|
||||
|
||||
struct DVDFileInfo;
|
||||
struct DVDCommandBlock;
|
||||
typedef void (*DVDCBCallback)(s32 result, DVDCommandBlock* block);
|
||||
typedef void (*DVDCallback)(s32 result, DVDFileInfo* info);
|
||||
|
||||
struct DVDCommandBlock {
|
||||
DVDCommandBlock* next;
|
||||
DVDCommandBlock* prev;
|
||||
u32 command;
|
||||
s32 state;
|
||||
u32 offset;
|
||||
u32 length;
|
||||
void* buffer;
|
||||
u32 current_transfer_size;
|
||||
u32 transferred_size;
|
||||
DVDDiskID* disk_id;
|
||||
DVDCBCallback callback;
|
||||
void* user_data;
|
||||
};
|
||||
|
||||
struct DVDFileInfo {
|
||||
DVDCommandBlock block;
|
||||
u32 start_address;
|
||||
u32 length;
|
||||
DVDCallback callback;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
s32 DVDOpen(const char*, DVDFileInfo*);
|
||||
s32 DVDClose(DVDFileInfo*);
|
||||
void DVDReadPrio(DVDFileInfo*, void*, s32, s32, s32);
|
||||
DVDDiskID* DVDGetCurrentDiskID(void);
|
||||
s32 DVDFastOpen(long, DVDFileInfo*);
|
||||
int DVDGetCommandBlockStatus(DVDCommandBlock*);
|
||||
s32 DVDReadAsyncPrio(DVDFileInfo*, void*, long, long, DVDCallback, long);
|
||||
s32 DVDConvertPathToEntrynum(const char*);
|
||||
DVDState DVDGetDriveStatus(void);
|
||||
s32 DVDCheckDisk(void);
|
||||
|
||||
BOOL DVDChangeDir(const char*);
|
||||
BOOL DVDCloseDir(DVDDirectory*);
|
||||
BOOL DVDOpenDir(const char*, DVDDirectory*);
|
||||
BOOL DVDReadDir(DVDDirectory*, DVDDirectoryEntry*);
|
||||
}
|
||||
|
||||
#endif /* DVD_H */
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
#ifndef GX_H_
|
||||
#define GX_H_
|
||||
|
||||
#include "dolphin/gx/GXTexture.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
// TODO: maybe split?
|
||||
|
||||
typedef enum _GXCullMode {
|
||||
GX_CULL_NONE = 0,
|
||||
GX_CULL_FRONT = 1,
|
||||
GX_CULL_BACK = 2,
|
||||
GX_CULL_ALL = 3
|
||||
} GXCullMode;
|
||||
|
||||
typedef enum _GXTexMapID {
|
||||
GX_TEXMAP1 = 1,
|
||||
GX_TEXMAP2 = 2,
|
||||
GX_TEXMAP0 = 0,
|
||||
GX_TEXMAP5 = 5,
|
||||
GX_TEXMAP6 = 6,
|
||||
GX_TEXMAP3 = 3,
|
||||
GX_TEXMAP4 = 4,
|
||||
GX_TEXMAP_NULL = 255,
|
||||
GX_TEX_DISABLE = 256,
|
||||
GX_TEXMAP7 = 7,
|
||||
GX_MAX_TEXMAP = 8
|
||||
} GXTexMapID;
|
||||
|
||||
struct GXRenderModeObj {
|
||||
s32 vi_tv_mode;
|
||||
u16 fb_width;
|
||||
u16 efb_height;
|
||||
u16 xfb_height;
|
||||
u16 vi_x_origin;
|
||||
u16 vi_y_origin;
|
||||
u16 vi_width;
|
||||
u16 vi_height;
|
||||
s32 xfb_mode;
|
||||
u8 field_rendering;
|
||||
u8 antialiasing;
|
||||
u8 sample_pattern[12][2];
|
||||
u8 vfilter[7];
|
||||
};
|
||||
|
||||
typedef enum GXTexFmt8 { /* 8-bit version of GXTexFmt for use in structures */
|
||||
GX_CTF_A8 = 39,
|
||||
GX_CTF_B8 = 42,
|
||||
GX_CTF_G8 = 41,
|
||||
GX_CTF_GB8 = 44,
|
||||
GX_CTF_R4 = 32,
|
||||
GX_CTF_R8 = 40,
|
||||
GX_CTF_RA4 = 34,
|
||||
GX_CTF_RA8 = 35,
|
||||
GX_CTF_RG8 = 43,
|
||||
GX_CTF_YUVA8 = 38,
|
||||
GX_CTF_Z16L = 60,
|
||||
GX_CTF_Z4 = 48,
|
||||
GX_CTF_Z8L = 58,
|
||||
GX_CTF_Z8M = 57,
|
||||
GX_TF_CMPR = 14,
|
||||
GX_TF_I4 = 0,
|
||||
GX_TF_I8 = 1,
|
||||
GX_TF_IA4 = 2,
|
||||
GX_TF_IA8 = 3,
|
||||
GX_TF_RGB565 = 4,
|
||||
GX_TF_RGB5A3 = 5,
|
||||
GX_TF_RGBA8 = 6,
|
||||
GX_TF_Z16 = 19,
|
||||
GX_TF_Z24X8 = 22,
|
||||
GX_TF_Z8 = 17
|
||||
} GXTexFmt8;
|
||||
|
||||
typedef enum GXTexWrapMode8 { /* Same as GXTexWrapMode, but as 1 byte for use inside structures */
|
||||
GX_CLAMP = 0,
|
||||
GX_MIRROR = 2,
|
||||
GX_REPEAT = 1
|
||||
} GXTexWrapMode8;
|
||||
|
||||
typedef enum GXTexFilter8 { /* Same as GXTexFilter, but as 1 byte for use within structures that
|
||||
store the value as a byte */
|
||||
GX_LINEAR = 1,
|
||||
GX_LIN_MIP_LIN = 5,
|
||||
GX_LIN_MIP_NEAR = 3,
|
||||
GX_NEAR = 0,
|
||||
GX_NEAR_MIP_LIN = 4,
|
||||
GX_NEAR_MIP_NEAR = 2
|
||||
} GXTexFilter8;
|
||||
|
||||
extern "C" {
|
||||
f32 GXGetYScaleFactor(u16 efb_height, u16 xfb_height);
|
||||
u16 GXGetNumXfbLines(u32 efb_height, f32 y_scale);
|
||||
|
||||
void GXBegin(u8, u8, u16);
|
||||
void GXLoadTexObj(u32*, s32);
|
||||
void GXInitTexObjLOD(f32, f32, f32, u32*, s32, s32, u32, u8, u32);
|
||||
void GXInitTexObj(u32*, u32, u32, u32, u32, u32, u8);
|
||||
|
||||
void GXSetNumChans(u32);
|
||||
void GXSetNumTevStages(u32);
|
||||
void GXSetNumTexGens(u32);
|
||||
void GXSetTevOrder(u32, u32, u32, u32);
|
||||
void GXSetChanCtrl(u32, u32, u32, u32, u32, u32, s32);
|
||||
void GXSetTevOp(s32, s32);
|
||||
void GXSetTevColor(s32, _GXColor);
|
||||
void GXSetTevColorIn(s32, u32, u32, u32, u32);
|
||||
void GXSetTevAlphaIn(s32, u32, u32, u32, u32);
|
||||
void GXSetTevColorOp(s32, u32, u32, u32, u32, u32);
|
||||
void GXSetTevAlphaOp(s32, u32, u32, u32, u32, u32);
|
||||
void GXSetBlendMode(u32, u32, u32, u32);
|
||||
void GXSetVtxAttrFmt(u32, u32, u32, u32, u32);
|
||||
void GXClearVtxDesc();
|
||||
void GXSetVtxDesc(u32, u32);
|
||||
typedef void (*GXDrawDoneCallback)(void);
|
||||
void GXSetDrawDoneCallback(GXDrawDoneCallback);
|
||||
void GXDrawDone(void);
|
||||
void GXAbortFrame(void);
|
||||
void GXFlush(void);
|
||||
|
||||
struct OSThread;
|
||||
OSThread* GXSetCurrentGXThread(void);
|
||||
OSThread* GXGetCurrentGXThread(void);
|
||||
|
||||
// Below needs proper symbols
|
||||
void GXClearVtxDesc(void);
|
||||
void GXCopyTex(void);
|
||||
void GXGetProjectionv(void);
|
||||
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, s32 is_mip_map, u8 max_lod);
|
||||
void GXGetViewportv(void);
|
||||
void GXInitLightColor(void);
|
||||
void GXInitLightDir(void);
|
||||
void GXInitLightDistAttn(void);
|
||||
void GXInitLightPos(void);
|
||||
void GXInitLightSpot(void);
|
||||
void GXInvalidateTexAll(void);
|
||||
void GXLoadLightObjImm(void);
|
||||
void GXLoadPosMtxImm(void);
|
||||
void GXLoadTexMtxImm(void);
|
||||
void GXPixModeSync(void);
|
||||
void GXProject(void);
|
||||
void GXSetAlphaCompare(void);
|
||||
void GXSetAlphaUpdate(void);
|
||||
void GXSetChanMatColor(void);
|
||||
void GXSetClipMode(void);
|
||||
void GXSetCoPlanar(void);
|
||||
void GXSetCopyFilter(void);
|
||||
void GXSetCullMode(void);
|
||||
void GXSetCurrentMtx(void);
|
||||
void GXSetDither(void);
|
||||
void GXSetFog(void);
|
||||
void GXSetFogRangeAdj(void);
|
||||
void GXSetNumIndStages(void);
|
||||
void GXSetProjection(void);
|
||||
void GXSetScissor(void);
|
||||
void GXSetTevColorS10(void);
|
||||
void GXSetTevKAlphaSel(void);
|
||||
void GXSetTevSwapMode(void);
|
||||
void GXSetTevSwapModeTable(void);
|
||||
void GXSetTexCoordGen2(void);
|
||||
void GXSetTexCopyDst(void);
|
||||
void GXSetTexCopySrc(void);
|
||||
void GXSetViewport(void);
|
||||
void GXSetZCompLoc(void);
|
||||
void GXSetZMode(void);
|
||||
void GXSetZTexture(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,32 @@
|
||||
#ifndef MTX_H
|
||||
#define MTX_H
|
||||
|
||||
#include "dolphin/mtx/quat.h"
|
||||
#include "dolphin/mtx/vec.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
typedef float Mtx[3][4];
|
||||
|
||||
extern "C" {
|
||||
void PSMTXIdentity(Mtx matrix);
|
||||
void PSMTXCopy(const Mtx src, Mtx dst);
|
||||
void PSMTXConcat(const Mtx src_a, const Mtx src_b, Mtx dst);
|
||||
u32 PSMTXInverse(const Mtx src, Mtx dst);
|
||||
void PSMTXRotRad(Mtx matrix, u8 axis, float rad);
|
||||
void PSMTXRotTrig(Mtx matrix, u8 axis, float sin, float cos);
|
||||
double __PSMTXRotAxisRadInternal(double param_1, double param_2, int param_3, int param_4);
|
||||
void PSMTXRotAxisRad(Mtx matrix, const Vec* axis, float rad);
|
||||
void PSMTXTrans(Mtx matrix, float x_trans, float y_trans, float z_trans);
|
||||
void PSMTXTransApply(const Mtx src, Mtx dst, float x, float y, float z);
|
||||
void PSMTXScale(Mtx matrix, float x_scale, float y_scale, float z_scale);
|
||||
void PSMTXScaleApply(const Mtx src, Mtx dst, float x_scale, float y_scale, float z_scale);
|
||||
void PSMTXQuat(Mtx matrix, const Quaternion* quat);
|
||||
|
||||
void C_MTXLookAt(Mtx param_1, const Vec* param_2, const Vec* param_3, const Vec* param_4);
|
||||
void C_MTXLightPerspective(Mtx matrix, float fov_y, float aspect, float scale_s, float scale_t,
|
||||
float trans_s, float trans_t);
|
||||
void C_MTXLightOrtho(Mtx matrix, float top, float bottom, float left, float right, float scale_s,
|
||||
float scale_t, float trans_s, float trans_t);
|
||||
}
|
||||
|
||||
#endif /* MTX_H */
|
||||
|
||||
@@ -3,4 +3,13 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
typedef float Mtx44[4][4];
|
||||
|
||||
extern "C" {
|
||||
|
||||
void C_MTXPerspective(Mtx44 matrix, float fov_y, float aspect, float near, float far);
|
||||
void C_MTXOrtho(Mtx44 matrix, float top, float bottom, float left, float right, float near,
|
||||
float far);
|
||||
}
|
||||
|
||||
#endif /* MTX44_H */
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
#ifndef MTXVEC_H
|
||||
#define MTXVEC_H
|
||||
|
||||
#include "dolphin/mtx/mtx.h"
|
||||
#include "dolphin/mtx/vec.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
extern "C" {
|
||||
void PSMTXMultVec(const Mtx matrix, const Vec* src, Vec* dst);
|
||||
void PSMTXMultVecArray(const Mtx matrix, const Vec* src, Vec* dst, u32 count);
|
||||
void PSMTXMultVecSR(const Mtx matrix, const Vec* src, Vec* dst);
|
||||
void PSMTXMultVecArraySR(const Mtx matrix, const Vec* src, Vec* dst, u32 count);
|
||||
}
|
||||
|
||||
#endif /* MTXVEC_H */
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
#ifndef QUAT_H
|
||||
#define QUAT_H
|
||||
|
||||
#include "dolphin/mtx/vec.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
struct Quaternion {
|
||||
float x, y, z, w;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
void PSQUATMultiply(const Quaternion* src_a, const Quaternion* src_b, Quaternion* dst);
|
||||
void C_QUATRotAxisRad(Quaternion* quat, const Vec* axis, float rad);
|
||||
void C_QUATSlerp(const Quaternion* p, const Quaternion* q, Quaternion* r, float t);
|
||||
}
|
||||
|
||||
#endif /* QUAT_H */
|
||||
|
||||
@@ -13,4 +13,19 @@ struct Vec {
|
||||
float getZDiff(const Vec* other) const { return z - other->z; }
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
void PSVECAdd(const Vec* src_a, const Vec* src_b, Vec* dst);
|
||||
void PSVECSubtract(const Vec* a, const Vec* b, Vec* dst);
|
||||
void PSVECScale(const Vec* src, Vec* dst, float scale);
|
||||
void PSVECNormalize(const Vec* src, Vec* dst);
|
||||
float PSVECSquareMag(const Vec* vec);
|
||||
float PSVECMag(const Vec* data);
|
||||
float PSVECDotProduct(const Vec* a, const Vec* b);
|
||||
void PSVECCrossProduct(const Vec* src_a, const Vec* src_b, Vec* dst);
|
||||
void C_VECHalfAngle(const Vec* incident, const Vec* line_of_sight, Vec* out_half);
|
||||
void C_VECReflect(const Vec* src, const Vec* surface_normal, Vec* dst);
|
||||
float PSVECSquareDistance(const Vec* a, const Vec* b);
|
||||
float PSVECDistance(const Vec* a, const Vec* b);
|
||||
}
|
||||
|
||||
#endif /* VEC_H */
|
||||
|
||||
+297
-3
@@ -1,6 +1,300 @@
|
||||
#ifndef OS_H
|
||||
#define OS_H
|
||||
// at some point: we should split this up into various OS/... headers. but not
|
||||
// yet, since barely any files include this atm.
|
||||
|
||||
#ifndef OS_H_
|
||||
#define OS_H_
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
#endif /* OS_H */
|
||||
/* TODO: more structs, and get rid of the ones that are faked! */
|
||||
|
||||
#define OS_MESSAGE_NON_BLOCKING 0
|
||||
#define OS_MESSAGE_BLOCKING 1
|
||||
|
||||
struct OSThread;
|
||||
struct OSMutex {
|
||||
u8 unk[24];
|
||||
};
|
||||
|
||||
struct OSMutexLink {
|
||||
struct OSMutex* prev;
|
||||
struct OSMutex* next;
|
||||
};
|
||||
|
||||
struct OSMutexQueue {
|
||||
struct OSMutex* prev;
|
||||
struct OSMutex* next;
|
||||
};
|
||||
|
||||
struct OSContext {
|
||||
u32 gpr[32];
|
||||
u32 cr;
|
||||
u32 lr;
|
||||
u32 ctr;
|
||||
u32 xer;
|
||||
double fpr[32];
|
||||
u32 padding_1;
|
||||
u32 fpscr;
|
||||
u32 srr0;
|
||||
u32 srr1;
|
||||
u16 mode;
|
||||
u16 state;
|
||||
u32 gqr[8];
|
||||
u32 padding_2;
|
||||
double ps[32];
|
||||
};
|
||||
|
||||
typedef void (*OSSwitchThreadCallback)(OSThread* from, OSThread* to);
|
||||
|
||||
struct OSThreadLink {
|
||||
struct OSThread* prev;
|
||||
struct OSThread* next;
|
||||
};
|
||||
|
||||
struct OSThreadQueue {
|
||||
struct OSThread* head;
|
||||
struct OSThread* tail;
|
||||
};
|
||||
|
||||
struct OSCond {
|
||||
struct OSThreadQueue queue;
|
||||
};
|
||||
|
||||
typedef void* OSMessage;
|
||||
|
||||
struct OSMessageQueue {
|
||||
struct OSThreadQueue sending_queue;
|
||||
struct OSThreadQueue receiving_queue;
|
||||
void** message_array;
|
||||
s32 num_messages;
|
||||
s32 first_index;
|
||||
s32 num_used;
|
||||
};
|
||||
|
||||
typedef u32 OSTick;
|
||||
|
||||
typedef s64 OSTime;
|
||||
|
||||
struct OSCalendarTime {
|
||||
s32 seconds;
|
||||
s32 minutes;
|
||||
s32 hours;
|
||||
s32 day_of_month;
|
||||
s32 month;
|
||||
s32 year;
|
||||
s32 week_day;
|
||||
s32 year_day;
|
||||
s32 milliseconds;
|
||||
s32 microseconds;
|
||||
};
|
||||
|
||||
typedef s32 OSHeapHandle;
|
||||
|
||||
typedef enum OSSoundMode {
|
||||
SOUND_MODE_MONO = 0,
|
||||
SOUND_MODE_STEREO = 1,
|
||||
} OSSoundMode;
|
||||
|
||||
typedef u16 OSThreadState;
|
||||
#define OS_THREAD_STATE_UNINITIALIZED 0
|
||||
#define OS_THREAD_STATE_READY 1
|
||||
#define OS_THREAD_STATE_RUNNING 2
|
||||
#define OS_THREAD_STATE_WAITING 4
|
||||
#define OS_THREAD_STATE_DEAD 8
|
||||
|
||||
struct OSThread {
|
||||
OSContext context;
|
||||
OSThreadState state;
|
||||
u16 attributes;
|
||||
s32 suspend_count;
|
||||
u32 effective_priority;
|
||||
u32 base_priority;
|
||||
void* exit_value;
|
||||
OSThreadQueue* queue;
|
||||
OSThreadLink link;
|
||||
OSThreadQueue join_queue;
|
||||
OSMutex* mutex;
|
||||
OSMutexQueue owned_mutexes;
|
||||
OSThreadLink active_threads_link;
|
||||
u8* stack_base;
|
||||
u8* stack_end;
|
||||
u8* error_code;
|
||||
void* data[2];
|
||||
};
|
||||
|
||||
struct __va_list_struct {};
|
||||
|
||||
extern "C" {
|
||||
s32 OSEnableScheduler(void);
|
||||
s32 OSDisableScheduler(void);
|
||||
s32 OSCheckActiveThreads(void);
|
||||
OSThread* OSGetCurrentThread(void);
|
||||
|
||||
s32 OSSuspendThread(OSThread* thread);
|
||||
s32 OSSetThreadPriority(OSThread* thread, u32 pri);
|
||||
s32 OSGetThreadPriority(OSThread* thread);
|
||||
s32 OSCreateThread(OSThread* thread, void* func, void* param, void* stack, u32 stackSize,
|
||||
int param_6, int param_7);
|
||||
void OSCancelThread(OSThread* thread);
|
||||
void OSDetachThread(OSThread* thread);
|
||||
s32 OSResumeThread(OSThread* thread);
|
||||
void OSExitThread(void* exit_val);
|
||||
bool OSIsThreadSuspended(OSThread* thread);
|
||||
BOOL OSIsThreadTerminated(OSThread* thread);
|
||||
OSSwitchThreadCallback OSSetSwitchThreadCallback(OSSwitchThreadCallback* callback);
|
||||
|
||||
void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* messages, int message_count);
|
||||
BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* message, int flags);
|
||||
BOOL OSSendMessage(OSMessageQueue* queue, OSMessage message, int flags);
|
||||
BOOL OSJamMessage(OSMessageQueue* queue, OSMessage message, int flags);
|
||||
|
||||
s32 OSGetConsoleType(void);
|
||||
u32 OSGetResetCode(void);
|
||||
|
||||
u32 OSGetSoundMode(void);
|
||||
void OSSetSoundMode(OSSoundMode mode);
|
||||
|
||||
void OSAttention(const char* msg, ...);
|
||||
void OSPanic(const char* file, s32 line, const char* fmt, ...);
|
||||
void OSReport(const char* fmt, ...);
|
||||
void OSReport_Error(const char* fmt, ...);
|
||||
void OSReport_FatalError(const char* fmt, ...);
|
||||
void OSReport_System(const char* fmt, ...);
|
||||
void OSReport_Warning(const char* fmt, ...);
|
||||
void OSReportDisable(void);
|
||||
void OSReportEnable(void);
|
||||
void OSReportForceEnableOff(void);
|
||||
void OSReportForceEnableOn(void);
|
||||
void OSVReport(const char* format, __va_list_struct* list);
|
||||
|
||||
void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime* out_time);
|
||||
OSTime OSGetTime(void);
|
||||
OSTick OSGetTick(void);
|
||||
|
||||
u32 OSGetArenaLo();
|
||||
u32 OSGetArenaHi();
|
||||
u32 OSInitAlloc(u32 low, u32 high, int param_3);
|
||||
void OSSetArenaLo(u32 param_1);
|
||||
void OSSetArenaHi(u32 param_1);
|
||||
void* OSAllocFromArenaLo(u32 size, int alignment);
|
||||
|
||||
// void OSCancelAlarm(OSAlarm *alarm);
|
||||
|
||||
void OSInitMutex(OSMutex* mutex);
|
||||
void OSLockMutex(OSMutex* mutex);
|
||||
void OSTryLockMutex(OSMutex* mutex);
|
||||
void OSUnlockMutex(OSMutex* mutex);
|
||||
|
||||
s32 OSDisableInterrupts();
|
||||
s32 OSEnableInterrupts();
|
||||
s32 OSRestoreInterrupts(s32 level);
|
||||
|
||||
void OSResetSystem(s32 param_1, u32 param_2, s32 param_3);
|
||||
|
||||
void OSSetSaveRegion(void* start, void* end);
|
||||
|
||||
void LCDisable(void);
|
||||
|
||||
void OSReportInit__Fv(void); // needed for inline asm
|
||||
|
||||
u8* OSGetStackPointer(void);
|
||||
}; // extern "C"
|
||||
|
||||
void OSSwitchFiberEx(u32, u32, u32, u32, u32, u32);
|
||||
|
||||
void OSVAttention(const char* fmt, __va_list_struct* va_list);
|
||||
|
||||
void OSReportInit(void);
|
||||
|
||||
#include "dolphin/dvd/dvd.h"
|
||||
|
||||
struct GLOBAL_MEMORY {
|
||||
DVDDiskID disk;
|
||||
u32 nintendo_boot_code; /* Nintendo Standard Boot Code. */
|
||||
u32 field_0x24; /* Version (set by apploader) */
|
||||
u32 memory_size; /* Memory Size (Physical) 24MB */
|
||||
u32 field_0x2c; /* Production Board Model */
|
||||
u32 arena_low; /* Arena Low */
|
||||
u32 arena_high; /* Arena High */
|
||||
u32 field_0x38; /* Start of FST (varies in all games) */
|
||||
u32 field_0x3c; /* Maximum FST Size (varies in all games) */
|
||||
u8 padding_0x40[32];
|
||||
u8 field_0x60[36]; /* Hook is PPC assembler used by Debugger. */
|
||||
u8 padding_0x84[84];
|
||||
OSContext* field_0xd8; /* Current OSContext instance. */
|
||||
OSThread* field_0xdc; /* OSThread pointer, previously created thread. */
|
||||
OSThread* field_0xe0; /* OSThread pointer, most recently created thread. */
|
||||
OSThread* field_0xe4; /* Current thread pointer. */
|
||||
u32 field_0xe8; /* Dev Debugger Monitor Address (If present) */
|
||||
u32 field_0xec; /* Simulated Memory Size */
|
||||
u32 field_0xf0; /* Pointer to data read from partition's bi2.bin, set by apploader */
|
||||
u32 field_0xf4; /* Console Bus Speed */
|
||||
u32 field_0xf8; /* Console CPU Speed */
|
||||
u8 padding_0xfc[5892];
|
||||
u8 field_0x1800[6144]; /* Unused Exception Vector */
|
||||
u8 padding_0x3000[64];
|
||||
u32 field_0x3040[34]; /* __OSInterrupt table. */
|
||||
u32 field_0x30c8; /* Pointer to the first loaded REL file. */
|
||||
u32 field_0x30cc; /* Pointer to the last loaded REL file. */
|
||||
u32 field_0x30d0; /* Pointer to a REL module name table, or 0. */
|
||||
u8 padding_0x30d8[4];
|
||||
u64 field_0x30d8; /* System time */
|
||||
u8 padding_0x30e0[4];
|
||||
u32 field_0x30e4; /* __OSPADButton */
|
||||
u8 padding_0x30ec[8];
|
||||
u32 field_0x30f0; /* DOL Execute Parameters */
|
||||
u8 padding_0x30f4[12];
|
||||
u32 field_0x3100; /* Physical MEM1 size */
|
||||
u32 field_0x3104; /* Simulated MEM1 size */
|
||||
u8 padding_0x3108[8];
|
||||
u32 field_0x3110; /* Heap pointer (end of usable memory by the game) */
|
||||
u8 padding_0x3114[4];
|
||||
u32 field_0x3118; /* Physical MEM2 size */
|
||||
u32 field_0x311c; /* Simulated MEM2 size */
|
||||
u8 padding_0x3120[16];
|
||||
u32 field_0x3130; /* IOS Heap Range (start) */
|
||||
u32 field_0x3134; /* IOS Heap Range (end) */
|
||||
u32 field_0x3138; /* Hollywood Version */
|
||||
u8 padding_0x313c[4];
|
||||
u32 field_0x3140; /* IOS version */
|
||||
u32 field_0x3144; /* IOS Build Date */
|
||||
u8 padding_0x3148[16];
|
||||
u32 field_0x3158; /* GDDR Vendor Code */
|
||||
u32 field_0x315c; /* During the boot process, */
|
||||
u32 field_0x3160; /* Init semaphore (1-2 main() waits for this to clear) */
|
||||
u32 field_0x3164; /* GC (MIOS) mode flag? */
|
||||
u8 padding_0x3168[24];
|
||||
u32 field_0x3180; /* Game ID */
|
||||
u8 field_0x3184; /* Application type. 0x80 for disc games, 0x81 for channels. */
|
||||
u8 padding_0x3185;
|
||||
u8 field_0x3186; /* Application type 2 */
|
||||
u8 padding_0x3187;
|
||||
u32 field_0x3188; /* Minimum IOS version */
|
||||
u32 field_0x318c; /* Title Booted from NAND (Launch Code) */
|
||||
u32 field_0x3190; /* Title Booted from NAND (Return Code) */
|
||||
u32 field_0x3194; /* While reading a disc, the system menu reads the first partition table (0x20
|
||||
bytes from 0x00040020) and stores a pointer to the data partition entry.
|
||||
When launching the disc game, it copies the partition type to 0x3194. The
|
||||
partition type for data partitions is 0, so typically this location always
|
||||
has 0. */
|
||||
u32 field_0x3198; /* While reading a disc, the system menu reads the first partition table (0x20
|
||||
bytes from 0x00040020) and stores a pointer to the data partition entry.
|
||||
When launching the disc game, it copies the partition offset to 0x3198. */
|
||||
u32 field_0x319c; /* Set by the apploader to 0x80 for single-layer discs and 0x81 for dual-layer
|
||||
discs (determined by whether 0x7ed40000 is the value at offset 0x30 in the
|
||||
partition's bi2.bin; it seems that that value is 0 for single-layer discs).
|
||||
Early titles' apploaders do not set it at all, leaving the value as 0. This
|
||||
controls the /dev/di#0x8D_DVDLowUnencryptedRead out-of-bounds Error #001
|
||||
read for titles that do make such a read: they try to read at 0x7ed40000
|
||||
for dual-layer discs and 0x460a0000 for single-layer discs. */
|
||||
u8 field_0x31a0[3424];
|
||||
};
|
||||
|
||||
#define OS_ASSERT(...)
|
||||
|
||||
inline void* OSPhysicalToCached(u32 offset) {
|
||||
OS_ASSERT(offset <= 0x1fffffff);
|
||||
return (void*)(offset + 0x80000000);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -3,4 +3,9 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
extern "C" {
|
||||
void DCInvalidateRange(void*, u32);
|
||||
void DCStoreRange(void*, u32);
|
||||
}
|
||||
|
||||
#endif /* OSCACHE_H */
|
||||
|
||||
@@ -3,4 +3,41 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
typedef enum PADMask {
|
||||
// PAD_CHAN3_BIT = (1 << 0),
|
||||
// PAD_CHAN2_BIT = (1 << 1),
|
||||
// PAD_CHAN1_BIT = (1 << 2),
|
||||
// PAD_CHAN0_BIT = (1 << 3),
|
||||
|
||||
PAD_CHAN3_BIT = (1 << 28),
|
||||
PAD_CHAN2_BIT = (1 << 29),
|
||||
PAD_CHAN1_BIT = (1 << 30),
|
||||
PAD_CHAN0_BIT = (1 << 31),
|
||||
} PADMask;
|
||||
|
||||
typedef struct PADStatus {
|
||||
u16 button;
|
||||
s8 stick_x;
|
||||
s8 stick_y;
|
||||
s8 substick_x;
|
||||
s8 substick_y;
|
||||
u8 trigger_left;
|
||||
u8 trigger_right;
|
||||
u8 analog_a;
|
||||
u8 analog_b;
|
||||
s8 error;
|
||||
} PADStatus;
|
||||
|
||||
extern "C" {
|
||||
u32 PADInit(void);
|
||||
void PADSetAnalogMode(u32 mode);
|
||||
void PADSetSpec(int spec);
|
||||
s32 PADReset(PADMask mask);
|
||||
void PADClampCircle(PADStatus* status);
|
||||
void PADClamp(PADStatus* status);
|
||||
u32 PADRead(PADStatus* status);
|
||||
void PADControlMotor(s32 channel, u32 command);
|
||||
s32 PADRecalibrate(PADMask mask);
|
||||
}
|
||||
|
||||
#endif /* PAD_H */
|
||||
|
||||
@@ -3,4 +3,8 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
typedef void (*VIRetraceCallback)(u32);
|
||||
|
||||
extern "C" void VIWaitForRetrace(void);
|
||||
|
||||
#endif /* VI_H */
|
||||
|
||||
Reference in New Issue
Block a user