Skip to content

Commit

Permalink
Match some TUs from Kaneshige
Browse files Browse the repository at this point in the history
  • Loading branch information
SwareJonge committed Jan 9, 2025
1 parent fbfa26a commit 79c026e
Show file tree
Hide file tree
Showing 75 changed files with 3,395 additions and 429 deletions.
12 changes: 6 additions & 6 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,13 +1104,13 @@ def MatchingFor(*versions):
Object(Equivalent, "Kaneshige/RaceMgr.cpp"),
Object(Matching, "Kaneshige/SysDebug.cpp"),
Object(Matching, "Kaneshige/CrsArea.cpp"),
Object(NonMatching, "Kaneshige/LightMgr.cpp"),
Object(Matching, "Kaneshige/LightMgr.cpp"),
Object(Matching, "Kaneshige/ScrnShot.cpp"),
Object(Matching, "Kaneshige/GeoStartLine.cpp"),
Object(Matching, "Kaneshige/CenterLine.cpp"),
Object(Matching, "Kaneshige/RaceInfo.cpp"),
Object(Matching, "Kaneshige/RaceLight.cpp"),
Object(NonMatching, "Kaneshige/RaceDrawBuffer.cpp"),
Object(Matching, "Kaneshige/RaceDrawBuffer.cpp"),
Object(Matching, "Kaneshige/KartDrawer.cpp"),
Object(Matching, "Kaneshige/TexLODControl.cpp"),
Object(Matching, "Kaneshige/ShapePktControl.cpp"),
Expand All @@ -1134,14 +1134,14 @@ def MatchingFor(*versions):
Object(NonMatching, "Kaneshige/GeoVision.cpp"),
Object(NonMatching, "Kaneshige/GeoSubWater.cpp"),
Object(Matching, "Kaneshige/RaceBGMPlayer.cpp"),
Object(NonMatching, "Kaneshige/RaceDirector.cpp"),
Object(NonMatching, "Kaneshige/RaceDrawer.cpp"),
Object(Matching, "Kaneshige/RaceDirector.cpp"),
Object(Matching, "Kaneshige/RaceDrawer.cpp"),
Object(NonMatching, "Kaneshige/GeoDkCloud.cpp"),
Object(NonMatching, "Kaneshige/KartMotion.cpp"),
Object(NonMatching, "Kaneshige/GeoKuribo.cpp"),
Object(Matching, "Kaneshige/GeoAirJet.cpp"),
Object(Matching, "Kaneshige/BlurScreen.cpp"),
Object(NonMatching, "Kaneshige/GeoRabbitMark.cpp"),
Object(Matching, "Kaneshige/GeoRabbitMark.cpp"),
Object(Matching, "Kaneshige/KartMtx.cpp"),
Object(Matching, "Kaneshige/DemoTimeKeeper.cpp"),
Object(NonMatching, "Kaneshige/GeoKinojii.cpp"),
Expand Down Expand Up @@ -1285,7 +1285,7 @@ def MatchingFor(*versions):
Object(NonMatching, "Sato/stEfctRoad.cpp"),
Object(NonMatching, "Sato/AnmController.cpp"),
Object(Matching, "Sato/RivalKart.cpp"),
Object(NonMatching, "Sato/StateObserver.cpp"),
Object(Matching, "Sato/StateObserver.cpp"),
Object(NonMatching, "Sato/NeckCtrl.cpp"),
Object(NonMatching, "Sato/LumbarCtrl.cpp"),
Object(NonMatching, "Sato/ArmCtrl.cpp"),
Expand Down
1 change: 1 addition & 0 deletions include/JSystem/J3D/J3DSys.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct J3DSys
void loadPosMtxIndx(int, u16) const;
void loadNrmMtxIndx(int, u16) const;
void ErrorReport(J3DErrType) const;
void setTexCacheRegion(GXTexCacheSize);

void setDrawBuffer(J3DDrawBuffer *drawBuffer, int idx) { mDrawBuffer[idx] = drawBuffer; }
void setDrawModeOpaTexEdge() { mDrawMode = 3; }
Expand Down
8 changes: 4 additions & 4 deletions include/JSystem/JFramework/JFWDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ class JFWDisplay
_38 = val;
}

int startFadeOut(int duration) {
bool startFadeOut(int duration) {
if (mFader != nullptr) {
return mFader->startFadeOut(duration);
}
return 1;
return true;
}

int startFadeIn(int duration) {
bool startFadeIn(int duration) {
if (mFader != nullptr) {
return mFader->startFadeIn(duration);
}
return 1;
return true;
}

void setTickRate(u32 rate) {
Expand Down
98 changes: 98 additions & 0 deletions include/JSystem/JGadget/std-list.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#ifndef JSYSTEM_LIST_H
#define JSYSTEM_LIST_H

#include "JSystem/JGadget/define.h"
#include "JSystem/JGadget/linklist.h"
#include "JSystem/JGadget/std-memory.h"
#include "types.h"

// massive TODO, pls help me

namespace JGadget {

template <typename T, typename Allocator = JGadget::TAllocator<T> >
struct TList {
struct TNode_ {
TNode_ *pPrev_;
TNode_ *pNext_;
};

class iterator {
public:
iterator() { this->p_ = nullptr; }
iterator(TNode_* node) { this->p_ = node; }

iterator& operator++() {
this->p_ = this->p_->getNext();
return *this;
}

iterator& operator--() {
this->p_ = this->p_->getPrev();
return *this;
}

TNode_& operator*() const {
JGADGET_ASSERT(p_!=0);
return *this->p_;
}

TNode_* operator->() const { return this->p_; }

TNode_* p_;
};

class const_iterator {
public:
const_iterator(const TNode_* node) { this->p_ = node; }
const_iterator(iterator it) { this->p_ = it.p_; }

const const_iterator& operator++() {
this->p_ = this->p_->getNext();
return *this;
}

const const_iterator& operator--() {
this->p_ = this->p_->getPrev();
return *this;
}

const TNode_* operator->() const { return this->p_; }

const TNode_* p_;
};

TList(const TAllocator<T> &allocator=0) {
oSize_ = 0;
Initialize_();
}

void Initialize_() {
oEnd_.pNext_ = &this->oNode_;
oEnd_.pPrev_ = &this->oNode_;
}

void DestroyNode_(TNode_ *p) {
// probably doesn't match
JGADGET_ASSERT(p!=0);
JGADGET_ASSERT(p!=&oEnd_);
JGADGET_ASSERT(p->pNext_->pPrev_!=p);
JGADGET_ASSERT(p->pPrev_->pNext_!=p);
oAllocator_.destroy(p + 1);
oAllocator_.DeallocateRaw(p);
}

iterator end() {return &this->oNode_; }
const_iterator end() const { return &this->oNode_; }

private:
TAllocator<T> oAllocator_; // 0
u32 oSize_; // 4
TNode_ oEnd_; // 8
};

}



#endif
33 changes: 33 additions & 0 deletions include/JSystem/JGadget/std-memory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef STD_MEMORY_H
#define STD_MEMORY_H

#include "JSystem/JUtility/JUTAssert.h"

namespace JGadget {
template <typename T>
struct TAllocator {
T* allocate(u32 count, void *param_2) {
return AllocateRaw(count * sizeof(T));
}

T* AllocateRaw(u32 size) {
return (T*)operator new(size);
}

void deallocate(T* mem, u32 size) {
DeallocateRaw(mem);
}

void DeallocateRaw(T* mem) {
delete mem;
}

void destroy(T* p) {
JUT_ASSERT(p!=0);
}

u8 mAllocator; // 00
};
}

#endif /* STD_MEMORY_H */
5 changes: 1 addition & 4 deletions include/JSystem/JKernel/JKRHeap.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ class JKRHeap : public JKRDisposer
return mHeapTree.getParent()->getObject();
}

const JSUTree<JKRHeap> &getHeapTree()
{
return mHeapTree;
}
const JSUTree<JKRHeap> &getHeapTree() { return mHeapTree; }

// Unused
void checkMemoryFilled(u8 *, u32 size, u8);
Expand Down
3 changes: 2 additions & 1 deletion include/JSystem/JSupport/JSUList.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class JSUList : public JSUPtrList
{
}

void initiate() { JSUPtrList::initiate(); }
bool append(JSULink<T> *link) { return JSUPtrList::append((JSUPtrLink *)link); }
bool prepend(JSULink<T> *link) { return JSUPtrList::prepend((JSUPtrLink *)link); }
bool insert(JSULink<T> *before, JSULink<T> *link) { return JSUPtrList::insert((JSUPtrLink *)before, (JSUPtrLink *)link); }
Expand Down Expand Up @@ -218,4 +219,4 @@ class JSUTreeIterator
JSUTree<T> *mTree;
};

#endif /* JSULIST_H */
#endif /* JSULIST_H */
4 changes: 2 additions & 2 deletions include/Kameda/Demo2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class Demo2D
{ // Autogenerated
// Global
public:
Demo2D(JKRHeap *); // 0x8018313c
void init(); // 0x8018325c
void draw(); // 0x801832d0
Expand All @@ -25,4 +25,4 @@ class Demo2D
// Inline/Unused
~Demo2D();
}; // class Demo2D
#endif // DEMO2D_H
#endif // DEMO2D_H
4 changes: 2 additions & 2 deletions include/Kameda/J2DManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class J2DManager
void setStatus2Kart(int, int); // 0x80131d98
void setUsisi(int, ECharID); // 0x80131f40
void startPreRace(); // 0x80132034
void getPreRaceStatus(); // 0x80132058
int getPreRaceStatus(); // 0x80132058
int getPreRaceWipeType(); // 0x80132064
void setRace2DDrawFlag(bool); // 0x80132070
void hideRace2D(); // 0x80132084
Expand Down Expand Up @@ -87,4 +87,4 @@ class J2DManager

inline J2DManager *GETJ2DManager() { return J2DManager::getManager(); }

#endif
#endif
46 changes: 30 additions & 16 deletions include/Kameda/PauseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,49 @@
#define PAUSEMANAGER_H

#include "JSystem/JKernel/JKRHeap.h"
#include "Osako/kartPad.h"
#include "types.h"

class PauseManager {
public:
PauseManager(JKRHeap *);
static bool tstPause(); // 0x80135288;
void setExecFlag(bool flag) {
mExecFlag = flag;
}
void reset();
PauseManager(JKRHeap *); // 0x801343d0
void reset(); // 0x801345fc
void draw(); // 0x801346d0
void exec(); // 0x801348f8
static bool tstPause(); // 0x80135288
void wipeOut(int); // 0x80135290
static int getPauseChoice(); // 0x801352d0

void enablePause() {
_14 = 0;
}
void setResultStartFlag(bool flag) {mResultStart = flag; }
void setGameOverFlag(bool flag) { mGameOver = flag; }
void setExecFlag(bool flag) { mExec = flag; }
void setPauseEndFlag(bool flag) { mPauseEnd = flag; }

void enablePause() { _14 = 0; }

static PauseManager *getManager() {
return mThis;
}
static PauseManager *mThis;

private:
u8 _00[0x13];
bool mExecFlag;
static PauseManager *mThis; // 0x80416298
static bool mIsPause; // 0x8041629c
static int mPauseSelector; // 0x804162a0
static int mPauseChoice; // 0x804162a4
static int mPauseNextChoice; // 0x804162a8
static KartGamePad *mPausePad; // 0x804162ac

u8 _0[0xe];
bool mResultStart;
bool _f;
bool mGameOver;
u8 _11[0x13 - 0x11];
bool mExec;
u32 _14;
bool mPauseEnd;
u8 _18[0x3c - 0x18];
};

inline PauseManager *GETPauseManager() {
return PauseManager::getManager();
}
inline PauseManager *GETPauseManager() { return PauseManager::getManager(); }

#endif
#endif
7 changes: 4 additions & 3 deletions include/Kaneshige/Course/Course.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ class Course
void drawBase(u32, u32 *, s16, bool); // 0x8019d028
void drawSky(u32); // 0x8019d6ac
void getStartLine(JGeometry::TVec3f *, JGeometry::TVec3f *); // 0x8019d7e8
void getLightColor(JUtility::TColor *); // 0x8019d914
void getLightColor(JUTColor *); // 0x8019d914
void getLightOffsetPosition(JGeometry::TVec3f *); // 0x8019d948
void getAmbientColor(JUtility::TColor *); // 0x8019d97c
void getAmbientColor(JUTColor *); // 0x8019d97c
u32 getCourseBGM(); // 0x8019d9b0
u32 getFinalLapBGM(); // 0x8019db78
void drawModelForDebug(u32); // 0x8019dc2c
Expand Down Expand Up @@ -215,6 +215,7 @@ class Course
bool isTexPatAnmEnable() const { return mTexPattern != nullptr; }; // 0x80199534

bool isShaking() const { return getCrsData()->isShaking(); }
void disableShaking() { mShakeEnabled = false; }

int getAreaNumber() const { return mAreaNum; }
Area *getArea(int no) const { return &mAreas[no]; }
Expand Down Expand Up @@ -258,7 +259,7 @@ class Course
f32 mFogEndZ;
f32 mFogNearZ;
f32 mFogFarZ;
JUtility::TColor mFogColor;
JUTColor mFogColor;
ExModel mTexModel;
J3DAnmTextureSRTKey *mTexSRTKey[3];
J3DAnmObjMaterial mTexSRTAnm[3];
Expand Down
7 changes: 6 additions & 1 deletion include/Kaneshige/Course/CrsData.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class CrsData
JGeometry::TVec3<s16> zNorm; // 18
JGeometry::TVec3<s16> yNorm; // 1e
u16 objID;
s16 pathID; // 26
u16 pathID; // 26
s16 _28; //
s16 pointIdx; // 2a
struct {
Expand Down Expand Up @@ -240,6 +240,7 @@ class CrsData
s16 getPathSpeed() const { return mPathSpeed; }
s16 getPathID() const { return mPathID; }
int getTime() const { return mTime; }
int getNextCameraID() const { return mNextID; }

bool isStartCamera() const { return mID != 0; }

Expand Down Expand Up @@ -308,6 +309,10 @@ class CrsData

struct MGParam // Minigame Parameters
{
s16 getRabbitWinSec() const { return rabbitWinSec; }
s16 getRabbitMinSec() const { return rabbitMinSec; }
s16 getRabbitDecSec() const { return rabbitDecSec; }

s16 rabbitWinSec;
s16 rabbitMinSec;
s16 rabbitDecSec;
Expand Down
Loading

0 comments on commit 79c026e

Please sign in to comment.