decompile testApp

This commit is contained in:
SwareJonge 2023-01-01 03:34:48 +01:00
parent 378ecc518b
commit 6c535af8aa
19 changed files with 783 additions and 25 deletions

View File

@ -17,7 +17,8 @@ Dolphin/__ppc_eabi_init.s:
#JSystem/JMath/JMATrigonometric.cpp:
#.text: [0x800693d0, 0x800697f8]
#.bss: [0x803f2540, 0x803fa5c0]
#.ctors: [0x803160c4, 0x803160c8]
#.bss: [0x803f2540, 0x803fa5c0] # alligned by 32
#.sdata2: [0x80417798, 0x804177e0]
Bando/EngineSound.cpp:
@ -56,6 +57,12 @@ Kaneshige/RaceInfo.cpp:
Kaneshige/RaceTime.cpp:
.text: [0x801d9e4c, 0x801d9ea0]
Osako/testApp.cpp:
.text: [0x801f6fc0, 0x801f7154]
.data: [0x8039c400, 0x8039c418]
.sbss: [0x804168d8, 0x804168e0]
.sdata2: [0x8041aee0, 0x8041aef0]
Osako/GameApp.cpp:
.text: [0x801f74dc, 0x801f75f4]
.data: [0x8039c460, 0x8039c478]
@ -71,7 +78,7 @@ Osako/systemData.cpp:
.sbss: [0x80416a00, 0x80416a10]
.sdata2: [0x8041b758, 0x8041b778]
#Osako/SaveFile.cpp:
#Osako/SaveFile.cpp: due to bss shit this doesn't compile properly
#.text: [0x8020c230, 0x8020c3ac]
#.rodata: [0x8037e060, 0x8037e090]
#.bss: [0x80407334, 0x80407740]

View File

@ -30,9 +30,19 @@ global:
0x804156e8: msVideoMode__10KartLocale
0x804156ec: msVideoFrameMode__10KartLocale
# J2DOrthoGraph.cpp
0x80043d68: setPort__13J2DOrthoGraphFv
0x80389d00: __vt__13J2DOrthoGraph
# J2DPrint
0x8004b024: initiate__8J2DPrintFv
0x8004b43c: print__8J2DPrintFffPCce
0x80389fe0: __vt__8J2DPrint
# random.cpp
0x800693c8: __ct__Q25JMath13TRandom_fast_FUl
0x800693d0: atan2___Q25JMath18TAtanTable<1024,f>CFff
0x80069628: __sinit_JMATrigonometric_cpp
0x800697e8: __ct__Q23std9pair<f,f>Fv
@ -120,6 +130,15 @@ global:
# runtime.c
0x80105f24: __cvt_fp2unsigned
# math.h
0x80112040: atan
0x801123c4: cos
0x80112498: floor
0x8011292c: sin
0x80112a04: tan
0x80112a7c: asin
0x80112a9c: atan2
# EngineSound.cpp
0x80118cac: getEngineType__11EngineSoundF7EKartID
@ -132,6 +151,8 @@ global:
0x801497d4: getKartInfo__8RaceInfoFi
0x80149bd4: getRaceMode__7RaceMgrCFv
0x80149be8: getJ2DOrtho__6SystemFv
# SequenceInfo.cpp
0x801528e8: rndDemo__12SequenceInfoFUl
@ -410,6 +431,9 @@ global:
# RaceMgr.cpp
0x801aff04: getRaceMode__8RaceInfoCFv
0x801b059c: testButton__10JUTGamePadCFUl
0x801b0bd8: testTrigger__10JUTGamePadCFUl
# CrsArea.cpp
0x801b35f8: __ct__7CrsAreaFv
0x801b366c: search__7CrsAreaFUcRCQ29JGeometry8TVec3<f>
@ -489,20 +513,30 @@ global:
# RaceTime.cpp
0x801d9e4c: get__8RaceTimeCFPiPiPi
# system.cpp
0x80416968: mspDisplay__6System
0x8041696c: mspAppHeap__6System
0x80416970: msDvdState__6System
0x80416974: msRenderMode__6System
0x80416978: mspSendTask__6System
0x8041697c: mspRecvTask__6System
0x80416980: mspAramTask__6System
0x80416984: mspLoTask__6System
0x80416988: mspJ2DPrint__6System
0x8041698c: mspJ2DOrtho__6System
0x80416990: mspAudioHeap__6System
0x801d7a80: getAppHeap__6SystemF
0x801d7a88: getHeap__7GameAppFv
# systemData.cpp
# AppMgr.cpp
0x80200a28: draw__6AppMgrFv
0x80200a80: calc__6AppMgrFv
0x80200c90: setNextApp__6AppMgrFQ26AppMgr11KartAppEnum
0x80200cd4: insertErrorViewApp__6AppMgrFv
0x80200d08: createApp__6AppMgrFQ26AppMgr11KartAppEnum
0x80200db4: restartApp__6AppMgrFv
0x80200fb0: isRestartable__6AppMgrFv
0x80201028: __sinit_AppMgr_cpp
0x80416998: msGameApp__6AppMgr
0x8041699c: msNextGameApp__6AppMgr
0x804169a0: msNextNextGameApp__6AppMgr
0x804169a4: msPrevGameApp__6AppMgr
0x804169a8: mspGameApp__6AppMgr
0x804169ac: msRequest__6AppMgr
0x804169b0: msDrawStallFrame__6AppMgr
0x804169b1: msCalcStallFrame__6AppMgr
0x804169b2: msChangeStallFrame__6AppMgr
# systemData.cpp
0x80205c2c: __sinit_systemData_cpp
0x8037d938: sc3DViewPort__10SystemData
0x8037d948: sc3DScissor__10SystemData
@ -527,6 +561,16 @@ global:
0x8041b764: scAudioHeapSize__10SystemData
0x8041b768: scAudioAramSize__10SystemData
# TestApp.cpp
0x801f6fc0: create__7TestAppFv
0x801f7010: __ct__7TestAppFv
0x801f7058: __dt__7TestAppFv
0x801f70b8: draw__7TestAppFv
0x801f7114: calc__7TestAppFv
0x8039c400: __vt__7TestApp
0x804168d8: mspTestApp__7TestApp
# GameApp.cpp
0x801f74dc: __ct__7GameAppFUlPCcPv
0x801f7580: __dt__7GameAppFv
@ -537,20 +581,44 @@ global:
0x8039c460: __vt__7GameApp
# MainMenuApp
0x801f7668: call__11MainMenuAppFv
# main.cpp
0x801f75f4: main
# system.cpp
0x801feba0: init__6SystemFv
0x801ff334: run__6SystemFv
0x80416968: mspDisplay__6System
0x8041696c: mspAppHeap__6System
0x80416970: msDvdState__6System
0x80416974: msRenderMode__6System
0x80416978: mspSendTask__6System
0x8041697c: mspRecvTask__6System
0x80416980: mspAramTask__6System
0x80416984: mspLoTask__6System
0x80416988: mspJ2DPrint__6System
0x8041698c: mspJ2DOrtho__6System
0x80416990: mspAudioHeap__6System
# SequenceInfo.cpp
0x803fba80: gSequenceInfo
# kartpad.cpp
0x801fff8c: compress__11KartGamePadFRC9PADStatusP11KartPadData
0x80200110: compress__11KartGamePadFRC10LGPositionP11KartPadData
0x80200328: expand__11KartGamePadFRC11KartPadData
# SaveFile.cpp
0x8020c230: getCRC__8SaveFileFPUcPUc
0x80407334: msaCRCTable__8SaveFile
0x80416a48: msCRCTableComputed__8SaveFile
0x802004b4: __sinit_kartPad_cpp
0x8039caf8: gpaGamePad
0x8039cb08: gpaKartPad
0x803fef60: gGamePad1P
# stMath.cpp
0x8021f5fc: createAllRandom__8stRandomFv

View File

@ -1,6 +1,17 @@
#ifndef GX_H
#define GX_H
typedef struct _GXColor
{
u8 r, g, b, a;
} GXColor;
typedef struct _SDK_GXColorS10
{
s16 r, g, b, a;
} GXColorS10;
typedef GXColorS10 _GXColorS10;
typedef struct _GXRenderModeObj
{
s32 tvMode;

View File

@ -24,6 +24,8 @@ extern "C" {
#define LONG_TAU 6.2831854820251465
double asin(double);
double cos(double);
float cosf(float);
double sin(double);

45
include/Dolphin/mtx.h Normal file
View File

@ -0,0 +1,45 @@
#ifndef _DOLPHIN_MTX_H
#define _DOLPHIN_MTX_H
#include "types.h"
#ifdef __cplusplus
extern "C"
{
#endif // ifdef __cplusplus
typedef float Mtx[3][4];
typedef float Mtx33[3][3];
typedef float Mtx44[4][4];
typedef float PSQuaternion[4];
#define MTXDegToRad(a) ((a)*0.01745329252f)
void PSMTXConcat(const Mtx, const Mtx, Mtx);
void PSMTXCopy(const Mtx, Mtx);
void PSMTXIdentity(Mtx);
void PSMTXTranspose(const Mtx, Mtx);
u32 PSMTXInverse(const Mtx, Mtx);
void PSMTXRotRad(Mtx, char, f32);
void PSMTXRotTrig(Mtx, char, float, float);
void __PSMTXRotAxisRadInternal(Mtx, const struct Vec *, f32, f32);
void PSMTXRotAxisRad(Mtx, const struct Vec *, f32);
void PSMTXTrans(Mtx, float, float, float);
void PSMTXTransApply(const Mtx, Mtx, float, float, float);
void PSMTXScale(Mtx, float, float, float);
void PSMTXScaleApply(const Mtx, Mtx, float, float, float);
void PSMTXQuat(Mtx, const PSQuaternion *);
void PSMTXMultVec(Mtx, Vec *, Vec *);
void PSMTXMultVecSR(Mtx, Vec *, Vec *);
/* TODO: Determine what these params are. */
void PSMTXMultVecArraySR(Mtx, float *, float *, float *);
void PSMTX44Copy(Mtx44, Mtx44);
void C_MTXPerspective(float, float, float, float, Mtx);
void C_MTXOrtho(Mtx44, float, float, float, float, float, float);
void C_MTXLookAt(Mtx, const Vec *, const Vec *, const Vec *);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,114 @@
#ifndef _JSYSTEM_J2D_J2DGRAFCONTEXT_H
#define _JSYSTEM_J2D_J2DGRAFCONTEXT_H
#include "types.h"
#include "JSystem/JGeometry.h"
#include "JSystem/J2D/J2DTypes.h"
#include "JSystem/JUtility/TColor.h"
#include "Dolphin/mtx.h"
/**
* @fabricated
*/
enum J2DGrafType { J2DGraf_Base = 0, J2DGraf_Ortho, J2DGraf_Persp };
struct J2DGrafContext {
J2DGrafContext(float, float, float, float);
virtual ~J2DGrafContext() { } // _08 (weak)
virtual void place(const JGeometry::TBox2f&); // _0C
virtual void place(f32 x, f32 y, f32 width, f32 height)
{
JGeometry::TBox2f box(x, y, x + width, y + height);
place(box);
} // _10 (weak)
virtual void setPort(); // _14
virtual void setup2D(); // _18
virtual void setScissor(); // _1C
virtual J2DGrafType getGrafType() const { return J2DGraf_Base; } // _20 (weak)
virtual void setLookat() { } // _24 (weak)
void drawFrame(const JGeometry::TBox2f&);
void fillBox(const JGeometry::TBox2f&);
void lineTo(JGeometry::TVec2f);
void lineTo(f32 x, f32 y) { lineTo(JGeometry::TVec2f(x, y)); }
void moveTo(f32 x, f32 y) { moveTo(JGeometry::TVec2f(x, y)); }
void moveTo(JGeometry::TVec2f pos) { m_prevPos = pos; }
void scissor(const JGeometry::TBox2f&);
void setColor(JUtility::TColor c) { setColor(c, c, c, c); }
void setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
void setLineWidth(u8);
// inlined
void line(JGeometry::TVec2f, JGeometry::TVec2f);
// _00 VTBL
JGeometry::TBox2f m_bounds; // _04
JGeometry::TBox2f m_scissorBounds; // _14
JUtility::TColor m_colorTL; // _24, top left
JUtility::TColor m_colorTR; // _28, top right
JUtility::TColor m_colorBR; // _2C, bottom right
JUtility::TColor m_colorBL; // _30, bottom left
u8 m_lineWidth; // _34
JGeometry::TVec2f m_prevPos; // _38
Mtx44 m_mtx44; // _40
Mtx m_posMtx; // _80
J2DBlendInfo _B0; // _B0
J2DBlendInfo m_linePart; // _B3
J2DBlendInfo m_boxPart; // _B6
};
struct J2DPerspGraph : public J2DGrafContext {
J2DPerspGraph();
virtual ~J2DPerspGraph() { } // _08 (weak)
virtual void setPort(); // _14
virtual J2DGrafType getGrafType() const { return J2DGraf_Persp; } // _20 (weak)
virtual void setLookat(); // _24
void makeLookat();
void set(float, float, float);
void setFovy(float);
// _00 = VTBL
// _00-_BC = J2DGrafContext
float m_fovY; // _BC
float _C0; // _C0
float _C4; // _C4
float _C8; // _C8
};
struct J2DOrthoGraph : public J2DGrafContext {
virtual ~J2DOrthoGraph() {}; // _08 (weak)
virtual void setPort(); // _14
virtual J2DGrafType getGrafType() const { return J2DGraf_Ortho; }; // _20 (weak)
virtual void setLookat(); // _24
// _00 VTBL
J2DOrthoGraph();
J2DOrthoGraph(f32, f32, f32, f32, f32, f32);
void setOrtho(JGeometry::TBox2f const&, f32, f32);
void scissorBounds(JGeometry::TBox2f*, JGeometry::TBox2f const*);
f32 getWidthPower() const { return m_bounds.getWidth() / m_ortho.getWidth(); }
f32 getHeightPower() const { return m_bounds.getHeight() / m_ortho.getHeight(); }
// _00 = VTBL
// _00-_BC = J2DGrafContext
JGeometry::TBox2f m_ortho; // _BC
f32 m_near; // _CC
f32 m_far; // _D0
};
void J2DFillBox(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor color);
void J2DFillBox(JGeometry::TBox2f const& param_0, JUtility::TColor param_1);
void J2DFillBox(f32, f32, f32, f32, JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
void J2DFillBox(const JGeometry::TBox2f&, JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
void J2DDrawFrame(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor param_4, u8 param_5);
void J2DDrawFrame(JGeometry::TBox2f const& param_0, JUtility::TColor param_1, u8 param_2);
#endif

View File

@ -0,0 +1,69 @@
#ifndef _JSYSTEM_J2D_J2DPRINT_H
#define _JSYSTEM_J2D_J2DPRINT_H
#include "types.h"
#include "JSystem/JUtility/TColor.h"
//#include "JSystem/JUT/JUTFont.h"
struct J2DTextBoxVBinding;
struct J2DTextBoxHBinding;
struct JUTFont; //placeholder
struct J2DPrint
{
struct TSize;
J2DPrint(JUTFont *, float);
J2DPrint(JUTFont *, JUtility::TColor, JUtility::TColor);
J2DPrint(JUTFont *, float, float, JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
virtual ~J2DPrint(); // _08
// virtual void _0C() = 0; // _0C - possibly
void initiate();
void private_initiate(JUTFont *, float, float, JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor, bool);
JUTFont *setFont(JUTFont *);
void setBuffer(u32);
void setFontSize();
void locate(float, float);
double print(float, float, char const *, ...);
void print(float, float, u8, const char *, ...);
void getWidth(const char *, ...);
void printReturn(const char *, float, float, J2DTextBoxHBinding, J2DTextBoxVBinding, float, float, u8);
void parse(const u8 *, int, int, u16 *, J2DPrint::TSize &, u8, bool);
void doCtrlCode(int);
void doEscapeCode(const u8 **, u8);
void initchar();
void getNumberS32(const u8 **, long, long, int);
void getNumberF32(const u8 **, float, float, int);
// _00 VTBL
JUTFont *m_font; // _04
JUtility::TColor _08; // _08
JUtility::TColor _0C; // _0C
float _10; // _10
float _14; // _14
float _18; // _18
float _1C; // _1C
short _20; // _20
u8 _22; // _22 - could be padding
u8 _23; // _23 - could be padding
float _24; // _24
float _28; // _28
float _2C; // _2C
float _30; // _30
float _34; // _34
JUtility::TColor _38; // _38
JUtility::TColor _3C; // _3C
JUtility::TColor _40; // _40
JUtility::TColor _44; // _44
float _48; // _48
float _4C; // _4C
float _50; // _50
float _54; // _54
short _58; // _58
u8 _5A; // _5A
};
#endif

View File

@ -0,0 +1,29 @@
#ifndef _JSYSTEM_J2D_J2DTYPES_H
#define _JSYSTEM_J2D_J2DTYPES_H
#include "types.h"
struct J2DBlendInfo
{
J2DBlendInfo() {}
J2DBlendInfo(u8 type, u8 srcFactor, u8 destFactor)
{
m_type = type;
m_srcFactor = srcFactor;
m_destFactor = destFactor;
}
void operator=(J2DBlendInfo const &other)
{
m_type = other.m_type;
m_srcFactor = other.m_srcFactor;
m_destFactor = other.m_destFactor;
}
u8 m_type;
u8 m_srcFactor;
u8 m_destFactor;
};
#endif

View File

@ -7,6 +7,55 @@
// from SMS decomp
namespace JGeometry
{
template <typename T>
struct TVec2
{
TVec2() {}
TVec2(T x, T y) { set(x, y); }
void set(T x, T y)
{
this->x = x;
this->y = y;
}
void set(const TVec2 &other)
{
x = other.x;
y = other.y;
}
void setMin(const TVec2<f32> &min)
{
if (x >= min.x)
x = min.x;
if (y >= min.y)
y = min.y;
}
void setMax(const TVec2<f32> &max)
{
if (x <= max.x)
x = max.x;
if (y <= max.y)
y = max.y;
}
void add(const TVec2<T> &other)
{
x += other.x;
y += other.y;
}
/** @fabricated */
// TVec2<T> adding(const TVec2<T>& other) { return TVec2<T>(x + other.x, y + other.y); }
bool isAbove(const TVec2<T> &other) const { return (x >= other.x) && (y >= other.y) ? true : false; }
T x;
T y;
};
template <typename T>
class TVec3
{
@ -65,6 +114,99 @@ namespace JGeometry
T y;
T z;
};
// Size: 0x10
template <class T>
struct TBox
{
TBox()
: i(), f()
{
}
TBox(const TBox &other)
: i(other.f), f(other.y)
{
}
T i, f;
};
// clang-format off
template<> struct TBox<TVec2<f32> > {
f32 getWidth() const { return f.x - i.x; }
f32 getHeight() const { return f.y - i.y; }
bool isValid() const { return f.isAbove(i); }
void addPos(f32 x, f32 y) {
addPos(TVec2<f32>(x, y));
}
void addPos(const TVec2<f32>& pos) {
i.add(pos);
f.add(pos);
}
bool intersect(const TBox<TVec2<f32> >& other) {
i.setMax(other.i);
f.setMin(other.f);
return isValid();
}
TVec2<f32> i, f;
};
template <typename T>
struct TBox2 : TBox<TVec2<T> > {
TBox2() {}
TBox2(const TVec2<f32>& i, const TVec2<f32> f) { set(i, f); }
TBox2(f32 x0, f32 y0, f32 x1, f32 y1) { set(x0, y0, x1, y1); }
TBox2(f32 x0, f32 y0, TVec2<f32>& f) { set(x0, y0, x0 + f.x, y0 + f.y); }
TBox2(f32 val)
{
f.y = val;
f.x = val;
i.y = val;
i.x = val;
}
void absolute() {
if (!this->isValid()) {
TBox2<T> box(*this);
this->i.setMin(box.i);
this->i.setMin(box.f);
this->f.setMax(box.i);
this->f.setMax(box.f);
}
}
// /** @fabricated */
// TBox2<T>& addingPos(TBox2<T>& result, const TVec2<T>& pos) {
// return TBox2<T>(i.adding(pos), f.adding(pos));
// }
void set(const TBox2& other) { set(other.i, other.f); }
void set(const TVec2<f32>& i, const TVec2<f32>& f) { this->i.set(i), this->f.set(f); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { i.set(x0, y0); f.set(x1, y1); }
};
// clang-format on
template <typename T>
struct TBox3
{
T minX;
T minY;
T minZ;
T maxX;
T maxY;
T maxZ;
};
typedef TVec2<float> TVec2f;
typedef TVec3<float> TVec3f;
typedef TBox2<float> TBox2f;
typedef TBox3<float> TBox3f;
};
#endif

View File

@ -18,7 +18,7 @@ namespace JMath
template <>
struct TAtanTable<1024, float>
{
TAtanTable()
inline TAtanTable()
{
u32 i = 0;
do
@ -31,6 +31,30 @@ namespace JMath
float m_table[1024];
};
template <int length, typename T>
struct TAsinAcosTable
{
T acos2_(T, T) const;
T acos_(T) const;
T m_table[length];
};
template <>
struct TAsinAcosTable<1024, float>
{
inline TAsinAcosTable()
{
u32 i = 0;
do
{
m_table[i] = asin((double)i * 9.765625E-4);
} while (i < 1024);
}
float acos2_(float, float) const;
float acos_(float) const;
float m_table[1024];
};
template <int length, typename T>
struct TSinCosTable
{
@ -101,8 +125,13 @@ namespace JMath
extern const TSinCosTable<2048, float> sincosTable_;
extern const TAtanTable<1024, float> atanTable_;
extern const TAsinAcosTable<1024, float> asinAcosTable_;
inline const TSinCosTable<2048, float> *getSinCosTable() { return &sincosTable_; }
}
struct Vec
{
f32 x;

View File

@ -67,6 +67,14 @@ public:
void setButtonRepeat(u32, u32, u32);
void update();
bool testButton(u32 mask) {
return mButtons.mInput & mask;
}
bool testTrigger(u32 mask) {
return mButtons.mFrameInput & mask;
}
class CButton
{
public:

View File

@ -0,0 +1,74 @@
#ifndef _JSYSTEM_JUT_TCOLOR_H
#define _JSYSTEM_JUT_TCOLOR_H
#include "types.h"
#include "Dolphin/gx.h"
#define TCOLOR_WHITE JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF)
namespace JUtility
{
struct TColor : public GXColor
{
TColor() { set(0xFFFFFFFF); }
TColor(u8 r, u8 g, u8 b, u8 a) { set(r, g, b, a); }
TColor(u32 u32Color) { set(u32Color); }
TColor(GXColor color) { set(color); }
TColor &operator=(const TColor &other)
{
((GXColor *)this)->operator=(other);
return *this;
}
/** @fabricated */
TColor &operator=(const GXColorS10 &other)
{
r = other.r;
g = other.g;
b = other.b;
a = other.a;
return *this;
}
operator u32() const { return toUInt32(); }
u32 toUInt32() const { return *(u32 *)&r; }
void set(u8 cR, u8 cG, u8 cB, u8 cA)
{
r = cR;
g = cG;
b = cB;
a = cA;
}
void set(u32 u32Color) { *(u32 *)&r = u32Color; }
void set(GXColor gxColor) { *(GXColor *)&r = gxColor; }
void setRGB(u8 cR, u8 cG, u8 cB)
{
r = cR;
g = cG;
b = cB;
}
void setRGB(const TColor &other) { setRGB(other.r, other.g, other.b); }
void setRGBA(const TColor &other)
{
r = other.r;
g = other.g;
b = other.b;
a = other.a;
}
// _00 = GXColor (_00 = r, _01 = g, _02 = b, _03 = a)
};
} // namespace JUtility
#endif

35
include/Osako/AppMgr.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef APPMGR_H
#define APPMGR_H
#include "Osako/GameApp.h"
#include "types.h"
class AppMgr
{
public:
enum KartAppEnum
{
KARTAPP_0 = 0
};
static void draw();
static void calc();
static bool setNextApp(KartAppEnum);
static void insertErrorViewApp();
static GameApp *createApp(KartAppEnum);
static void restartApp();
static bool isRestartable();
static KartAppEnum msGameApp;
static KartAppEnum msNextGameApp;
static KartAppEnum msNextNextGameApp;
static KartAppEnum msPrevGameApp;
static GameApp * mspGameApp;
static int msRequest;
static u8 msDrawStallFrame;
static u8 msCalcStallFrame;
static u8 msChangeStallFrame;
};
#endif

View File

@ -0,0 +1,41 @@
#ifndef MAINMENUAPP_H
#define MAINMENUAPP_H
#include "types.h"
#include "Osako/GameApp.h"
class MainMenuApp {
public:
static void create();
static void call();
MainMenuApp();
virtual ~MainMenuApp();
void up();
void down();
void left();
void decide();
void cancel(); // doesn't exist, inline auto?
virtual void draw(); // override
virtual void calc(); // override
static MainMenuApp * mspMainMenuApp;
int _C;
int _10;
int _14;
int _18;
u8 _1C;
u8 _1D;
u8 _1E;
u8 _1F;
u8 _20;
u8 _21;
u8 mGameFlagIdx;
u8 _23;
u8 _mCupIdx;
u8 _mLevelIdx;
u8 _26;
};
#endif

View File

@ -4,7 +4,7 @@
#include "types.h"
#include "JSystem/JUtility/JUTGamePad.h"
class KartGamePad : JUTGamePad
class KartGamePad : public JUTGamePad
{
public:
// placeholder Enums
@ -53,4 +53,23 @@ private:
PadState mPadState;
};
extern KartGamePad gGamePad1P;
extern KartGamePad gGamePad2P;
extern KartGamePad gGamePad3P;
extern KartGamePad gGamePad4P;
extern KartGamePad gGamePad5P;
extern KartGamePad gGamePad6P;
extern KartGamePad gGamePad7P;
extern KartGamePad gGamePad8P;
extern KartGamePad gGamePad9P;
extern KartGamePad gGamePad10P;
extern KartGamePad gGamePad11P;
extern KartGamePad gGamePad12P;
extern KartGamePad gGamePad13P;
extern KartGamePad gGamePad14P;
extern KartGamePad gGamePad15P;
extern KartGamePad gGamePad16P;
extern KartGamePad * gpaGamePad[16];
#endif KARTPAD_H

View File

@ -2,15 +2,16 @@
#define SYSTEM_H
#include "Dolphin/OS.h"
#include "JSystem/J2D/J2DGrafContext.h"
#include "JSystem/J2D/J2DPrint.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JKernel/JKRAssertHeap.h"
#include "types.h"
class JFWDisplay;
class JKRTask;
class J2DOrthoGraph;
class J2DPrint;
class System {
static JFWDisplay *mspDisplay;
@ -33,10 +34,13 @@ public:
static void changeNormalRenderMode();
static void callbackException(u16, OSContext, u32, u32);
static void haltRumble();
static void run();
static void run();
static JKRAssertHeap *getAppHeap() {
return mspAppHeap;
}
static J2DPrint *getJ2DPrint() {
return mspJ2DPrint;
}
static J2DOrthoGraph *getJ2DOrtho() {
return mspJ2DOrtho;
}

22
include/Osako/testApp.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef TESTAPP_H
#define TESTAPP_H
#include "Osako/GameApp.h"
#include "types.h"
class TestApp : GameApp
{
public:
static TestApp *create();
static TestApp *mspTestApp;
TestApp();
//static void call(); // inline auto behaviour?
virtual ~TestApp();
virtual void draw();
virtual void calc();
private:
int _8;
};
#endif

View File

@ -2,9 +2,6 @@
#include "types.h"
namespace JMath {
const TSinCosTable<2048, float> sincosTable_;
const TAtanTable<1024, float> atanTable_;
float JMath::TAtanTable<1024, float>::atan2_(float param_1, float param_2) const
{
// const register float zero = 0.0f;
@ -118,4 +115,8 @@ namespace JMath {
// return fVar1;
return result;
}
}
const TSinCosTable<2048, float> sincosTable_ = TSinCosTable<2048, float>();
const TAtanTable<1024, float> atanTable_ = TAtanTable<1024, float>();
const TAsinAcosTable<1024, float> asinAcosTable_ = TAsinAcosTable<1024, float>();
}

38
src/Osako/testApp.cpp Normal file
View File

@ -0,0 +1,38 @@
#include "JSystem/JKernel/JKRHeap.h"
#include "Osako/AppMgr.h"
#include "Osako/kartPad.h"
#include "Osako/MainMenuApp.h"
#include "Osako/system.h"
#include "Osako/testApp.h"
TestApp * TestApp::mspTestApp;
TestApp * TestApp::create(void)
{
if (!mspTestApp)
mspTestApp = new(System::getAppHeap(), 0) TestApp();
return mspTestApp;
}
TestApp::TestApp() : GameApp(null, "test", nullptr) {
}
TestApp::~TestApp() {
mspTestApp = 0;
}
void TestApp::draw() {
System::getJ2DOrtho()->setPort();
J2DPrint *j2dPrint = System::getJ2DPrint();
j2dPrint->initiate();
j2dPrint->print(100.0f, 20.0f, "test");
}
void TestApp::calc() {
if (gGamePad1P.testTrigger(0x200)) {
AppMgr::msRequest |= 1;
MainMenuApp::call();
}
}