Skip to content

Commit

Permalink
Link most of dvd, mtx
Browse files Browse the repository at this point in the history
  • Loading branch information
HeartPiece44 committed Sep 27, 2024
1 parent 1b63285 commit 9fdd81e
Show file tree
Hide file tree
Showing 15 changed files with 2,286 additions and 5,527 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"*.cp": "cpp",
"__mem.h": "c",
"db.h": "c",
"math.h": "c"
"math.h": "c",
"dvd.h": "c"
}
}
31 changes: 20 additions & 11 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@
"-inline auto",
]

# Dolphin mtx library flags
cflags_mtx = [
*cflags_base,
"-fp_contract off",
]

config.linker_version = "GC/1.2.5"


Expand Down Expand Up @@ -811,23 +817,26 @@ def DolphinLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
Object(Matching, "db/db.c"),
]
),
DolphinLib(
"mtx",
[
{
"lib": "mtx",
"mw_version": "GC/1.2.5n",
"cflags": cflags_mtx,
"progress_category": "sdk",
"objects": [
Object(NonMatching, "mtx/mtx.c"),
Object(NonMatching, "mtx/mtx44.c"),
Object(NonMatching, "mtx/vec.c"),
Object(Matching, "mtx/mtx44.c"),
Object(Matching, "mtx/vec.c"),
]
),
},
DolphinLib(
"dvd",
[
Object(NonMatching, "dvd/dvdlow.c"),
Object(NonMatching, "dvd/dvdfs.c"),
Object(NonMatching, "dvd/dvd.c"),
Object(NonMatching, "dvd/dvdqueue.c"),
Object(Matching, "dvd/dvdlow.c"),
Object(Matching, "dvd/dvdfs.c"),
Object(Matching, "dvd/dvd.c"),
Object(Matching, "dvd/dvdqueue.c"),
Object(NonMatching, "dvd/dvderror.c"),
Object(NonMatching, "dvd/fstload.c"),
Object(Matching, "dvd/fstload.c"),
]
),
DolphinLib(
Expand Down
1 change: 1 addition & 0 deletions include/Dolphin/dvd.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ BOOL DVDChangeDir(char* dirName);
s32 DVDConvertPathToEntrynum(char* path);

// Other disk functions.
void __DVDLowSetWAType(u32 type, u32 location);
s32 DVDGetTransferredSize(DVDFileInfo* fileInfo);
DVDDiskID* DVDGetCurrentDiskID();
BOOL DVDCompareDiskID(DVDDiskID* id1, DVDDiskID* id2);
Expand Down
33 changes: 5 additions & 28 deletions include/Dolphin/mtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,43 +28,20 @@ typedef struct Quaternion {

////// PAIRED SINGLE MATRIX FUNCTIONS //////
void PSMTXIdentity(Mtx mtx);
void PSMTXCopy(const Mtx src, Mtx dest);
void PSMTXConcat(const Mtx A, const Mtx B, Mtx concat);

void PSMTXTranspose(const Mtx src, Mtx xPose);
u32 PSMTXInverse(const Mtx src, Mtx inv);

void __PSMTXRotAxisRadInternal(Mtx mtx, const Vec* axis, f32 sinA, f32 cosA);
void PSMTXRotRad(Mtx mtx, char axis, f32 angle);
void PSMTXRotTrig(Mtx mtx, char axis, f32 sinA, f32 cosA);
void PSMTXRotAxisRad(Mtx mtx, const Vec* axis, f32 angle);

void PSMTXTrans(Mtx mtx, f32 xT, f32 yT, f32 zT);
void PSMTXTransApply(const Mtx src, Mtx dest, f32 xT, f32 yT, f32 zT);

void PSMTXScale(Mtx mtx, f32 xS, f32 yS, f32 zS);
void PSMTXScaleApply(const Mtx src, Mtx dest, f32 xS, f32 yS, f32 zS);
void PSMTXQuat(Mtx mtx, const PSQuaternion* quat);

////////////////////////////////////////////

//// PAIRED SINGLE MATRIX VEC FUNCTIONS ////
void PSMTXMultVec(const Mtx, const Vec*, Vec*);
void PSMTXMultVecSR(const Mtx, const Vec*, Vec*);
void PSMTXMultVecArraySR(const Mtx, f32*, f32*, f32*);

////////////////////////////////////////////

/////////// MATRIX44 FUNCTIONS ////////////
void PSMTX44Copy(Mtx44 src, Mtx44 dest);
void C_MTXPerspective(Mtx44 mtx, f32 fovY, f32 aspect, f32 n, f32 f);
void C_MTXOrtho(Mtx44 mtx, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f);
void MTXPerspective(Mtx44 mtx, f32 fovY, f32 aspect, f32 n, f32 f);
void MTXOrtho(Mtx44 mtx, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f);
////////////////////////////////////////////

///////// CODED C MATRIX FUNCTIONS /////////
void C_MTXLookAt(Mtx, const Vec*, const Vec*, const Vec*);
void C_MTXLightPerspective(Mtx mtx, f32 fovY, f32 aspect, f32 scaleS, f32 scaleT, f32 transS, f32 transT);
void C_MTXLightOrtho(Mtx mtx, f32 t, f32 b, f32 l, f32 r, f32 scaleS, f32 scaleT, f32 transS, f32 transT);
void MTXTrans(Mtx m, f32 xT, f32 yT, f32 zT);
void MTXScale(Mtx m, f32 xS, f32 yS, f32 zS);
void MTXLightPerspective(Mtx m, f32 fovY, f32 aspect, f32 scaleS, f32 scaleT, f32 transS, f32 transT);
////////////////////////////////////////////

////////////// MATRIX INLINES //////////////
Expand Down
6 changes: 1 addition & 5 deletions include/Dolphin/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,8 @@ void OSInit();
void OSReport(const char* message, ...);
void OSPanic(const char* file, int line, const char* message, ...);

#define OSError(...) OSPanic(__FILE__, __LINE__, __VA_ARGS__)
#ifndef MATCHING
#define OSErrorLine(line, ...) OSError(__VA_ARGS__)
#else
#define OSError(...) OSPanic(__FILE__, __LINE__, __VA_ARGS__)
#define OSErrorLine(line, ...) OSPanic(__FILE__, line, __VA_ARGS__)
#endif

// Other OS functions.
void OSRegisterVersion(const char*);
Expand Down
17 changes: 2 additions & 15 deletions include/Dolphin/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,11 @@ typedef struct SVec {
s16 z;
} SVec;

void PSVECAdd(const Vec*, const Vec*, Vec*);
void PSVECSubtract(const Vec*, const Vec*, Vec*);
void PSVECNormalize(const Vec*, Vec*);
f32 PSVECMag(const Vec*);
void PSVECCrossProduct(const Vec*, const Vec*, Vec*);
f32 PSVECSquareMag(Vec*);
f32 VECMag(Vec*);

#ifdef __cplusplus
}
#endif

// lfs f1,0(r3)
// lfs f0,4(r3)
// fmuls f1,f1,f1
// lfs f2,8(r3)
// fmuls f0,f0,f0
// fmuls f2,f2,f2
// fadds f0,f1,f0
// fadds f1,f2,f0
// blr

#endif
Loading

0 comments on commit 9fdd81e

Please sign in to comment.