summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/g3dhax.h26
-rwxr-xr-xinclude/game.h130
-rwxr-xr-xinclude/rvl/GXVert.h38
-rw-r--r--kamek_pal.x41
-rw-r--r--src/fileload.cpp8
5 files changed, 209 insertions, 34 deletions
diff --git a/include/g3dhax.h b/include/g3dhax.h
index b016e55..d358436 100644
--- a/include/g3dhax.h
+++ b/include/g3dhax.h
@@ -161,6 +161,8 @@ class mAllocator_c : public EGG::Allocator {
mAllocator_c();
~mAllocator_c();
+ bool setup(/*EGG::Heap*/void *heap, s32 align);
+
void *alloc(u32 size);
void free(void *block);
};
@@ -182,19 +184,15 @@ namespace m3d {
void DisableIndirectTexturing();
void InitTexObjWithResTex(GXTexObj *obj, /* ResTex */ void *resTex, GXTexWrapMode wrapS, GXTexWrapMode wrapT, GXTexFilter minFilt, GXTexFilter magFilt);
- // I need to do scnLeaf_c some time...
- class proc_c {
+ class scnLeaf_c {
public:
- proc_c();
- virtual ~proc_c();
+ scnLeaf_c();
+ virtual ~scnLeaf_c();
- void setup(void *allocator = 0, u32 *size = 0);
virtual int returnUnknown();
virtual void free();
virtual bool scheduleForDrawing();
- virtual void drawOpa();
- virtual void drawXlu();
void setScnObjOption(ulong, ulong);
bool getScnObjOption(ulong, ulong*);
@@ -214,8 +212,20 @@ namespace m3d {
void *scnObj;
};
- class banm_c;
+ class proc_c : public scnLeaf_c {
+ public:
+ bool setup(void *allocator = 0, u32 *size = 0);
+
+ int returnUnknown() { return 2; }
+ virtual void drawOpa() = 0;
+ virtual void drawXlu() = 0;
+ };
+
+
+
+ // TODO: bmdl_c/smdl_c
+ class banm_c;
class mdl_c {
public:
mdl_c();
diff --git a/include/game.h b/include/game.h
index 8e7d86a..0871eb1 100755
--- a/include/game.h
+++ b/include/game.h
@@ -11,8 +11,17 @@
#define offsetof(type, member) ((u32) &(((type *) 0)->member))
+template <typename T>
+inline T min(T one, T two) { return (one < two) ? one : two; }
+template <typename T>
+inline T max(T one, T two) { return (one > two) ? one : two; }
+template <typename T>
+inline T clamp(T value, T one, T two) { return (value < one) ? one : ((value > two) ? two : value); }
+
+
extern "C" {
int strlen(const char *str);
+char *strcpy(char *dest, const char *src);
float atan(float x);
float atan2(float y, float x);
@@ -761,8 +770,15 @@ namespace G3DState {
}
+VEC2 GetSomeSizeRelatedBULLSHIT();
+Vec CalculateSomethingAboutRatio(float, float, float, float);
+float CalculateSomethingElseAboutRatio();
+
nw4r::g3d::CameraData *GetCameraByID(int id);
+namespace EGG { class Screen; };
+void DoSomethingCameraRelatedWithEGGScreen(int id, EGG::Screen *screen);
+
int GetCurrentCameraID(); // 80164C80
void SetCurrentCameraID(int id); // 80164C90
@@ -777,6 +793,7 @@ void DrawOpa(); // 80164F70
void DrawXlu(); // 80164F80
bool ChangeAlphaUpdate(bool enable); // 802D3270
+bool ChangeColorUpdate(bool enable); // 802D3210
void DoSpecialDrawing1(); // 8006CAE0
void DoSpecialDrawing2(); // 8006CB40
@@ -784,6 +801,7 @@ void DoSpecialDrawing2(); // 8006CB40
void SetupLYTDrawing(); // 80163360
void ClearLayoutDrawList(); // 801632B0
+void RenderAllLayouts(); // 800067A0
void DrawAllLayoutsBeforeX(int x); // 80163440
void DrawAllLayoutsAfterX(int x); // 801634D0
void DrawAllLayoutsAfterXandBeforeY(int x, int y); // 80163560
@@ -837,7 +855,7 @@ namespace m2d {
namespace EGG {
class Frustum {
public:
- GXProjectionType projType;
+ int projType; // 0 = ortho, 1 = perspective.. who needs GXEnum.h anyway
int isCentered;
float width;
float height;
@@ -847,8 +865,8 @@ namespace EGG {
float far;
float center_x_maybe;
float center_y_maybe;
- float x_direction;
- float unk2;
+ float horizontalMultiplier;
+ float verticalMultiplier;
float unk3;
short some_flag_bit;
@@ -876,8 +894,8 @@ namespace EGG {
void copyAllFields(Frustum &f); // 802C6EE0
- void saveSomething(float f1, float f2, float f3, float f4); // 802C70C0
- void loadSomething(float *f1, float *f2, float *f3, float *f4); // 802C70E0
+ static void saveSomething(float f1, float f2, float f3, float f4); // 802C70C0
+ static void restoreSomething(float *f1, float *f2, float *f3, float *f4); // 802C70E0
void loadPerspective(); // 802C7110
void loadOrtho(); // 802C7140
@@ -891,6 +909,97 @@ namespace EGG {
void getOrthoVars(float *top, float *bottom, float *left, float *right); // 802C7480
};
+
+
+ class Screen : public Frustum {
+ public:
+ struct Info {
+ float viewportX, viewportY, viewportWidth, viewportHeight;
+ float viewportNearZ, viewportFarZ;
+
+ int scissorX, scissorY, scissorWidth, scissorHeight;
+ int scissorOffsetX, scissorOffsetY;
+ };
+
+ Screen(); // 802D0FB0; creates perspective screen with basic settings
+ Screen(Screen *pParent, bool isCentered, float m40, float m44, float width, float height); // 802D1080
+ Screen(Screen &s); // 802D1140
+
+ ~Screen(); // not called by the retail game.. dunno how to make CodeWarrior do this, who gives a fuck
+
+ void loadDirectly();
+ void loadIntoCamera(nw4r::g3d::Camera cam);
+
+ void setSomeVars(bool isCentered, float m40, float m44, float width, float height); // 802D1500
+
+ Info *getStructContainingInfo(); // 802D1AB0
+
+ void doSomethingWithAPassedMatrix(Mtx m, float f1, float f2, float f3, float f4); // 802D1B40
+
+ //protected:
+ void copyAllFields(Screen &s); // 802D1430
+ void setParent(Screen *pParent = 0); // 802D1540
+
+ void useScreenWidth640(); // 802D15A0
+ void calculateCrap(); // 802D15D0
+
+ bool checkIfFlag1IsSet(); // 802D1B10
+
+
+ Screen *parent; // I think it's the parent screen, anyway ...
+ float _40, _44, _48, _4C, _50, _54;
+ Info info;
+ };
+
+
+ class LookAtCamera /* : public BaseCamera */ {
+ public:
+ virtual Mtx *getMatrix();
+ virtual Mtx *getMatrixAgain();
+ virtual void callCalculateMatrix();
+ virtual void calculateMatrix();
+ virtual void loadMatricesIntoGX();
+ virtual void _vf1C(); // null
+ virtual Vec getCamPos();
+ virtual void doStuffInvolvingVfsAndOtherObject(void *unkType);
+ virtual void _vf28(); // null
+ virtual Mtx *getPreviousMatrix();
+
+ void assignToNW4RCamera(nw4r::g3d::Camera &cam); // 802BEB70
+ Vec getStuffFromMatrix(); // 802BEBC0
+ Vec getMoreStuffFromMatrix(); // 802BEC20
+ Vec getEvenMoreStuffFromMatrix(); // 802BEC80
+
+ private:
+ Mtx matrix;
+ Mtx previousMatrix;
+
+ public:
+ Vec camPos, target, camUp;
+ };
+
+ class ProjectOrtho /* : public something? */ {
+ public:
+ virtual GXProjectionType getProjectionType();
+ virtual void setGXProjection();
+ virtual void _vf10(); // null
+ virtual VEC2 _vf14(VEC2 *something);
+ virtual Vec _vf18(float something, /*BaseCamera?*/ LookAtCamera *camera);
+ virtual Vec _vf1C(float something, /*BaseCamera?*/ LookAtCamera *camera);
+ virtual Vec _vf20(VEC2 *something);
+ virtual void _vf24();
+ virtual void setOrthoOntoCamera(nw4r::g3d::Camera &cam);
+ virtual void _vf2C(); // null
+ virtual void setGXProjectionUnscaled(); // does not take aspect ratio into account
+
+ ProjectOrtho(); // 802BF6C0
+ void setVolume(float top, float bottom, float left, float right); // 802BF710
+ void setDefaults(); // I think? 802BF830
+
+ Mtx44 matrix; // unused? dunno
+ void *_44; // dunno type
+ float near, far, top, bottom, left, right;
+ };
}
@@ -2337,5 +2446,16 @@ inline u8 *getResource(const char *arcName, const char *fileName) {
inline void scaleDown(Vec* scale, float amt) { scale->x -= amt; scale->y -= amt; scale->z -= amt; }
inline void scaleUp(Vec* scale, float amt) { scale->x -= amt; scale->y -= amt; scale->z -= amt; }
+
+
+
+
+struct SSM { short width, height; float xScale, yScale; };
+extern SSM ScreenSizesAndMultipliers[3];
+extern int currentScreenSizeID;
+
+extern float GlobalScreenWidth, GlobalScreenHeight;
+
+
#endif
diff --git a/include/rvl/GXVert.h b/include/rvl/GXVert.h
index 8564563..41587c5 100755
--- a/include/rvl/GXVert.h
+++ b/include/rvl/GXVert.h
@@ -24,10 +24,24 @@ extern "C" {
#else // MINNOW
#define GXFIFO_ADDR 0x1C008000
#endif// MINNOW
+typedef union uPPCWGPipe
+{
+ u8 u8;
+ u16 u16;
+ u32 u32;
+ u64 u64;
+ s8 s8;
+ s16 s16;
+ s32 s32;
+ s64 s64;
+ f32 f32;
+ f64 f64;
+} PPCWGPipe;
+
// SN-Phil: removed 'extern', added AT_ADDRESS
-//volatile PPCWGPipe GXWGFifo AT_ADDRESS(GXFIFO_ADDR) ;
-extern volatile PPCWGPipe GXWGFifo;
+volatile PPCWGPipe GXWGFifo : (GXFIFO_ADDR) ;
+//extern volatile PPCWGPipe GXWGFifo;
#endif // !EMU
/*---------------------------------------------------------------------------*/
@@ -76,7 +90,7 @@ extern volatile PPCWGPipe GXWGFifo;
#define __GXCDEF1(func,ts,td) \
static inline void func(const ts x) \
{ \
- GXWGFifo._##td = (td) x; \
+ GXWGFifo.td = (td) x; \
return; \
}
@@ -84,8 +98,8 @@ extern volatile PPCWGPipe GXWGFifo;
#define __GXCDEF2(func,ts,td) \
static inline void func(const ts x, const ts y) \
{ \
- GXWGFifo._##td = (td) x; \
- GXWGFifo._##td = (td) y; \
+ GXWGFifo.td = (td) x; \
+ GXWGFifo.td = (td) y; \
return; \
}
@@ -93,9 +107,9 @@ extern volatile PPCWGPipe GXWGFifo;
#define __GXCDEF3(func,ts,td) \
static inline void func(const ts x, const ts y, const ts z) \
{ \
- GXWGFifo._##td = (td) x; \
- GXWGFifo._##td = (td) y; \
- GXWGFifo._##td = (td) z; \
+ GXWGFifo.td = (td) x; \
+ GXWGFifo.td = (td) y; \
+ GXWGFifo.td = (td) z; \
return; \
}
@@ -103,10 +117,10 @@ extern volatile PPCWGPipe GXWGFifo;
#define __GXCDEF4(func,ts,td) \
static inline void func(const ts x, const ts y, const ts z, const ts w) \
{ \
- GXWGFifo._##td = (td) x; \
- GXWGFifo._##td = (td) y; \
- GXWGFifo._##td = (td) z; \
- GXWGFifo._##td = (td) w; \
+ GXWGFifo.td = (td) x; \
+ GXWGFifo.td = (td) y; \
+ GXWGFifo.td = (td) z; \
+ GXWGFifo.td = (td) w; \
return; \
}
diff --git a/kamek_pal.x b/kamek_pal.x
index c46bb81..4f5e7e6 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -506,6 +506,28 @@ SECTIONS {
OSReport__FPCce = 0x8015F870;
_Z7OSFatal7GXColorS_PKc = 0x801AF710;
+ GetSomeSizeRelatedBULLSHIT__Fv = 0x800E2670;
+ CalculateSomethingAboutRatio__Fffff = 0x800E27E0;
+ CalculateSomethingElseAboutRatio__Fv = 0x800E28B0;
+ DoSomethingCameraRelatedWithEGGScreen__FiPQ23EGG6Screen = 0x80169360;
+
+ GlobalScreenWidth = 0x8042A3CC;
+ GlobalScreenHeight = 0x8042A3D0;
+
+ currentScreenSizeID = 0x8042B1E8;
+ ScreenSizesAndMultipliers = 0x80350820;
+
+ setOrtho__Q23EGG7FrustumFffffff = 0x802C6DD0;
+
+ __ct__Q23EGG6ScreenFv = 0x802D0FB0;
+ __dt__Q23EGG6ScreenFv = 0x802D0D90;
+
+ __vt__Q23EGG12LookAtCamera = 0x803503B8;
+ assignToNW4RCamera__Q23EGG12LookAtCameraFRQ34nw4r3g3d6Camera = 0x802BEB70;
+
+ __ct__Q23EGG12ProjectOrthoFv = 0x802BF6C0;
+ setVolume__Q23EGG12ProjectOrthoFffff = 0x802BF710;
+
GetCameraByID__Fi = 0x80164C60;
GetCurrentCameraID__Fv = 0x80164C80;
SetCurrentCameraID__Fi = 0x80164C90;
@@ -521,6 +543,7 @@ SECTIONS {
DrawXlu__Fv = 0x80164F80;
ChangeAlphaUpdate__Fb = 0x802D3270;
+ ChangeColorUpdate__Fb = 0x802D3210;
DoSpecialDrawing1__Fv = 0x8006CAE0;
DoSpecialDrawing2__Fv = 0x8006CB40;
@@ -528,6 +551,7 @@ SECTIONS {
SetupLYTDrawing__Fv = 0x80163360;
ClearLayoutDrawList__Fv = 0x801632B0;
+ RenderAllLayouts__Fv = 0x800067A0;
DrawAllLayoutsBeforeX__Fi = 0x80163440;
DrawAllLayoutsAfterX__Fi = 0x801634D0;
DrawAllLayoutsAfterXandBeforeY__Fii = 0x80163560;
@@ -581,12 +605,13 @@ SECTIONS {
/* This is preliminary and kinda strange, most of these just point to ScnLeaf for now */
setup__Q23m3d6proc_cFPvPUi = 0x80165110;
- __ct__Q23m3d6proc_cFv = 0x8016A150;
- __dt__Q23m3d6proc_cFv = 0x8016A170;
- free__Q23m3d6proc_cFv = 0x8016A1D0;
- scheduleForDrawing__Q23m3d6proc_cFv = 0x8016A220;
- getViewMatrix__Q23m3d6proc_cFPA3_A4_f = 0x8016A2D0;
returnUnknown__Q23m3d6proc_cFv = 0x8000F720;
+
+ __ct__Q23m3d9scnLeaf_cFv = 0x8016A150;
+ __dt__Q23m3d9scnLeaf_cFv = 0x8016A170;
+ free__Q23m3d9scnLeaf_cFv = 0x8016A1D0;
+ scheduleForDrawing__Q23m3d9scnLeaf_cFv = 0x8016A220;
+ getViewMatrix__Q23m3d9scnLeaf_cFPA3_A4_f = 0x8016A2D0;
/* End preliminary section */
__vt__Q23m3d5mdl_c = 0x80329984;
@@ -858,6 +883,7 @@ SECTIONS {
_Z6strlenPKc = 0x802DC98C;
strlen__FPCc = 0x802DC98C;
strlen = 0x802DC98C;
+ strcpy = 0x802E1C28;
atan = 0x802E7F04;
atan2 = 0x802E8900;
@@ -994,6 +1020,7 @@ SECTIONS {
GXInitTexObjWrapMode = 0x801C7240;
GXLoadTexObj = 0x801C7600;
GXInvalidateTexAll = 0x801C7800;
+ GXSetNumIndStages = 0x801C8250;
GXSetTevDirect = 0x801C8270;
GXSetTevOp = 0x801C8390;
GXSetTevColorIn = 0x801C8430;
@@ -1013,9 +1040,12 @@ SECTIONS {
GXSetFog = 0x801C8A60;
GXSetFogRangeAdj = 0x801C8DF0;
GXSetBlendMode = 0x801C8F00;
+ GXSetColorUpdate = 0x801C8F50;
+ GXSetAlphaUpdate = 0x801C8F80;
GXSetZMode = 0x801C8FB0;
GXSetZCompLoc = 0x801C8FF0;
GXSetDither = 0x801C90D0;
+ GXSetDstAlpha = 0x801C9100;
GXCallDisplayList = 0x801C9720;
GXSetProjection = 0x801C9980;
GXLoadPosMtxImm = 0x801C9A80;
@@ -1050,6 +1080,7 @@ SECTIONS {
__ct__12mAllocator_cFv = 0x8016a720;
__vt__12mAllocator_c = 0x80329a04;
__dt__12mAllocator_cFv = 0x8016a770;
+ setup__12mAllocator_cFPvi = 0x8016A7D0;
__vt__Q23m3d6banm_c = 0x80329920;
__dt__Q23m3d6banm_cFv = 0x80168000;
diff --git a/src/fileload.cpp b/src/fileload.cpp
index fac7576..e672863 100644
--- a/src/fileload.cpp
+++ b/src/fileload.cpp
@@ -26,7 +26,7 @@ void *LoadFile(FileHandle *handle, const char *name) {
return handle->filePtr;
}
-void *LoadCompressedFile(FileHandle *handle, const char *name) {
+/*void *LoadCompressedFile(FileHandle *handle, const char *name) {
OSReport("[LoadCompressedFile %s]\n", name);
int entryNum = DVDConvertPathToEntrynum(name);
@@ -57,7 +57,7 @@ void *LoadCompressedFile(FileHandle *handle, const char *name) {
OSReport("[Success %p]\n", handle->filePtr);
return handle->filePtr;
-}
+}*/
bool FreeFile(FileHandle *handle) {
if (!handle) return false;
@@ -95,7 +95,7 @@ bool File::open(const char *filename) {
return (ret != 0);
}
-bool File::openCompressed(const char *filename) {
+/*bool File::openCompressed(const char *filename) {
if (m_loaded)
close();
@@ -104,7 +104,7 @@ bool File::openCompressed(const char *filename) {
m_loaded = true;
return (ret != 0);
-}
+}*/
void File::close() {
if (!m_loaded)