BaseGameSection progress (#153)

* Update and init stuff

* baseGameSection work

* fix baseGameSection mess

* Repair baseGameSection vars + format

---------

Co-authored-by: HeartPiece <deancsouthwood@gmail.com>
This commit is contained in:
Drought-Ender 2023-02-08 23:07:45 -06:00 committed by GitHub
parent 03a47e6434
commit 63404aa9e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 539 additions and 1754 deletions

View File

@ -108,7 +108,7 @@ struct BaseGameSection : public BaseHIOSection {
virtual char* getCaveFilename(); // _84 (weak)
virtual char* getEditorFilename(); // _88 (weak)
virtual int getVsEditNumber(); // _8C (weak)
virtual void openContainerWindow(); // _90 (weak)
virtual bool openContainerWindow(); // _90 (weak)
virtual void closeContainerWindow(); // _94 (weak)
virtual void playMovie_firstexperience(int, Creature*); // _98 (weak)
virtual void playMovie_bootup(Onyon*); // _9C (weak)
@ -154,12 +154,13 @@ struct BaseGameSection : public BaseHIOSection {
void useSpecificFBTexture(JUTTexture*);
void restoreFBTexture();
void loadSync(IDelegate*, bool);
void waitSyncLoad(bool);
u32 waitSyncLoad(bool);
void dvdloadGameSystem();
void movieDone(Game::MovieConfig*, u32, u32);
void advanceDayCount();
void saveToGeneratorCache(Game::CourseInfo*);
void pmTogglePlayer();
void pmPlayerJoin();
void setPlayerMode(int);
void onCameraBlendFinished(Game::CameraArg*);
void setFixNearFar(bool, f32, f32);
@ -186,7 +187,7 @@ struct BaseGameSection : public BaseHIOSection {
void clearHeap();
void setupFixMemory();
void setupFixMemory_dvdload();
void enableAllocHalt();
bool enableAllocHalt();
bool disableAllocHalt();
void setupFloatMemory();
void setDrawBuffer(int);
@ -203,59 +204,82 @@ struct BaseGameSection : public BaseHIOSection {
void startKantei2D();
void onKanteiDone(Rect<f32>&);
int getNumWindows();
int getActivePlayerID();
void setupViewportMatrix(Graphics&);
void j3dDraw(Viewport*);
void j3dDrawPostShadow(Viewport*);
void j3dDrawObjectLast(Viewport*);
void j3dDrawPost(Viewport*);
void j3dDrawLast(Viewport*);
void j3dViewCalc(Viewport*);
void initBlendCamera();
void blend1to2();
void blend2to1();
void startSplit();
void changeSplit();
void endSplit();
void startHeap();
bool isAllocHalt();
void drawRadarmap(Graphics&);
// _00 = VTBL
// _00-_48 = BaseHIOSection
// should there not be another 0x4 here in USA (not demo)? ...
u32 _PADDING00; // STRUCTURE SIZE IS WRONG BY 8 BYTES!
u32 _PADDING01; // STRUCTURE SIZE IS WRONG BY 8 BYTES!
BlendCamera* mBlendCamera; // _50
f32 mBlendFactor; // _54
bool mIsBlendCameraActive; // _58
DvdThreadCommand mDvdThreadCommand; // _5C
IDelegate3<MovieConfig*, u32, u32>* mMovieFinishCallback; // _C8
IDelegate3<MovieConfig*, void*, u32>* mMovieStartCallback; // _CC
BlackFader* mBlackFader; // _D0
WipeInFader* mWipeInFader; // _D4
WipeOutFader* mWipeOutFader; // _D8
WipeOutInFader* mWipeOutInFader; // _DC
u32 _E0; // _E0
int mPrevNaviIdx; // _E4
f32 mSecondViewportHeight; // _E8
f32 mSplit; // _EC
u8 mSetSplit; // _F0
JUTTexture* mMizuTexture; // _F4
TreasureLight::Mgr* mTreasureLightMgr; // _F8
JKRHeap* mTheExpHeap; // _FC
JKRHeap* _100; // _100
PlayCamera* mOlimarCamera; // _104
PlayCamera* mLouieCamera; // _108
Controller* mControllerP1; // _10C
Controller* mControllerP2; // _110
int mPlayerMode; // _114
HorizonalSplitter* mSplitter; // _118
u8 _11C; // _11C
int _120; // _120
u32 _124; // _124
GameLightMgr* mLightMgr; // _128
Sys::DrawBuffers* _12C; // _12C
Sys::DrawBuffers* _130; // _130
int mTreasureGetState; // _134
Viewport* mTreasureGetViewport; // _138
Creature* mDraw2DCreature; // _13C
f32 mDraw2DCreatureScale; // _140
f32 _144; // _144
Delegate1<BaseGameSection, Rectf&>* mKanteiDelegate; // _148
ZoomCamera* mTreasureZoomCamera; // _14C
u32 _150; // _150
JUTTexture* mXfbImage; // _154
JUTTexture* mFbTexture; // _158
int mXfbTexture1; // _15C
int mXfbTexture2; // _160
u8 mXfbFlags; // _164
JUTTexture* _168; // _168
int mTexData1; // _16C
int _170; // _170
// u8 _174[0xA0]; // _174
u32 mMoney; // _48
u32 _4C; // _4C
BlendCamera* mBlendCamera; // _50
f32 mBlendFactor; // _54
bool mIsBlendCameraActive; // _58
DvdThreadCommand mDvdThreadCommand; // _5C
IDelegate3<MovieConfig*, u32, u32>* mMovieFinishCallback; // _C8
IDelegate3<MovieConfig*, u32, u32>* mMovieStartCallback; // _CC
BlackFader* mBlackFader; // _D0
WipeInFader* mWipeInFader; // _D4
WipeOutFader* mWipeOutFader; // _D8
WipeOutInFader* mWipeOutInFader; // _DC
u32 _E0; // _E0
int mPrevNaviIdx; // _E4
f32 mSecondViewportHeight; // _E8
f32 mSplit; // _EC
u8 mSetSplit; // _F0
JUTTexture* mMizuTexture; // _F4
TreasureLight::Mgr* mTreasureLightMgr; // _F8
JKRHeap* mTheExpHeap; // _FC
JKRHeap* _100; // _100
PlayCamera* mOlimarCamera; // _104
PlayCamera* mLouieCamera; // _108
Controller* mControllerP1; // _10C
Controller* mControllerP2; // _110
int mPlayerMode; // _114
HorizonalSplitter* mSplitter; // _118
u8 _11C; // _11C
int _120; // _120
u32 _124; // _124
GameLightMgr* mLightMgr; // _128
Sys::DrawBuffers* _12C; // _12C
Sys::DrawBuffers* _130; // _130
int mTreasureGetState; // _134
Viewport* mTreasureGetViewport; // _138
Creature* mDraw2DCreature; // _13C
f32 mDraw2DCreatureScale; // _140
f32 _144; // _144
Delegate1<BaseGameSection, Rectf&>* mKanteiDelegate; // _148
ZoomCamera* mTreasureZoomCamera; // _14C
u32 _150; // _150
JUTTexture* mXfbImage; // _154
JUTTexture* mFbTexture; // _158
int mXfbTexture1; // _15C
int mXfbTexture2; // _160
u8 mXfbFlags; // _164
JUTTexture* _168; // _168
int mTexData1; // _16C
int _170; // _170
// u8 _174[0xA0]; // _174
// not sure where this goes, but it goes after mTexData1 and before mContainer1 (VsGameSection).
#if BUILDTARGET == USADEMO1
u8 _DemoPadding3[0x4];
@ -263,4 +287,6 @@ struct BaseGameSection : public BaseHIOSection {
};
} // namespace Game
extern JKRHeap* theExpHeap;
#endif

View File

@ -67,7 +67,7 @@ struct GameSystem : public NodeObjectMgr<GenericObjectMgr> {
void setDrawBuffer(int);
void setFrozen(bool, char*);
void setMoviePause(bool, char*);
void setPause(bool, char*, int);
u32 setPause(bool, char*, int);
int startPause(bool, int, char*);
inline bool isVersusMode() { return mMode == GSM_VERSUS_MODE; }

View File

@ -124,17 +124,17 @@ struct MoviePlayArg {
mAngle = creature->getFaceDir();
}
char* mMovieName; // _00
char* mCourseName; // _04
char* mPelletName; // _08
IDelegate3<MovieConfig*, u32, u32>* mDelegateEnd; // _0C
IDelegate3<MovieConfig*, void*, u32>* mDelegateStart; // _10 /* Second type is unknown. */
u32 _14; // _14
Vector3f mOrigin; // _18 /* previously called mItemPosition */
f32 mAngle; // _24 /* previously called mItemFaceDirection */
u32 mNaviID; // _28
u32 mStreamID; // _2C
Vector3f* mSoundPosition; // _30
char* mMovieName; // _00
char* mCourseName; // _04
char* mPelletName; // _08
IDelegate3<MovieConfig*, u32, u32>* mDelegateEnd; // _0C
IDelegate3<MovieConfig*, u32, u32>* mDelegateStart; // _10 /* Second type is unknown. */
u32 _14; // _14
Vector3f mOrigin; // _18 /* previously called mItemPosition */
f32 mAngle; // _24 /* previously called mItemFaceDirection */
u32 mNaviID; // _28
u32 mStreamID; // _2C
Vector3f* mSoundPosition; // _30
};
// Size: 0x5C

View File

@ -30,7 +30,7 @@ struct Generator : public CNode {
virtual void doSetView(int viewportNumber); // _18
virtual void doViewCalc(); // _1C
void initialiseSystem();
static void initialiseSystem();
void generate();
void render(Graphics&);
void update();

View File

@ -11,7 +11,9 @@
namespace PSSystem {
inline SceneMgr* getSceneMgr()
{
P2ASSERTLINE(467, spSceneMgr);
return spSceneMgr;
}

View File

@ -32,7 +32,7 @@ struct ParticleMgr : public CNode {
static void globalInstance();
static void deleteInstance();
static void Instance_TPkEffectMgr();
static void deleteInstance_TPkEffectMgr();
void deleteInstance_TPkEffectMgr();
void createHeap(u32);
void createMgr(char*, u32, u32, u32);

View File

@ -9,6 +9,24 @@ struct Rect {
Vector2<T> p1; // _00 /* topLeft */
Vector2<T> p2; // _08 /* bottomRight */
inline Rect() { }
inline Rect(Vector2<T> a, Vector2<T> b)
{
p1 = a;
p2 = b;
}
inline Rect(T a, T b, T c, T d)
{
p1.x = a;
p1.y = b;
p2.x = c;
p2.y = d;
}
static inline Rect rectBySize(Vector2<T>& start, Vector2<T>& size) { return Rect(start, start + size); }
inline void reset()
{
p1.x = 0.0f;

View File

@ -3,6 +3,11 @@
#include "types.h"
inline Vector2<u16> getScreenSize()
{
return Vector2<u16>(System::getRenderModeObj()->fbWidth, System::getRenderModeObj()->efbHeight);
} // doesn't have to be an inline
struct Graphics;
struct Splitter {
@ -12,8 +17,8 @@ struct Splitter {
// _00 VTBL
};
struct HorizontalSplitter : public Splitter {
HorizontalSplitter(Graphics*);
struct HorizonalSplitter : public Splitter {
HorizonalSplitter(Graphics*);
virtual void split2(f32); // _08

View File

@ -18,8 +18,16 @@ struct DrawBuffer : public CNode {
};
struct CreateArg {
CreateArg()
{
mSize = 1;
mName = "noname\0"; // IMPORTANT !!!
mFlags.clear();
}
u32 mSize; // _00
u16 mFlags; // _04
BitFlag<u16> mFlags; // _04
const char* mName; // _08
J3DDrawBuffer::ESortType mSortType; // _0C
J3DDrawBuffer::EDrawType mDrawType; // _10

View File

@ -40,7 +40,7 @@ struct Model : public MtxObject {
s16 getJointIndex(char*);
Joint* getJoint(char*);
void setViewCalcModeImm();
void setViewCalcModeInd();
static void setViewCalcModeInd();
void viewCalc();
void setCurrentViewNo(u32);
void isMtxImmediate();
@ -82,6 +82,8 @@ struct Model : public MtxObject {
int mJointCount; // _0C
Joint* mJoints; // _10
static int cullCount;
static u8 viewCalcMode;
};

View File

@ -38,6 +38,8 @@ inline Vector2f operator*(const Vector2f& a, f32 b) { return Vector2f(a.x * b, a
inline Vector2f operator+(const Vector2f& a, const Vector2f& b) { return Vector2f(a.x + b.x, a.y + b.y); }
inline Vector2f operator+=(const Vector2f& a, const Vector2f& b) { return Vector2f(a.x + b.x, a.y + b.y); }
inline Vector2f operator-(const Vector2f& a, const Vector2f& b) { return Vector2f(a.x - b.x, a.y - b.y); }
inline f32 _lenVec2D(Vector2f& vec)

View File

@ -3,8 +3,10 @@
#include "Rect.h"
#include "types.h"
#include "CNode.h"
struct Camera;
struct LookAtCamera;
struct J2DGrafContext;
struct J2DOrthoGraph;
struct Matrixf;
@ -31,24 +33,24 @@ struct Viewport : CNode {
void updateCameraAspect();
bool viewable();
u16 mVpId; // _18
u8 _1A; // _1A
u8 _1B; // _1B
f32 mVpX1; // _1C
f32 mVpY1; // _20
f32 mVpX2; // _24
f32 mVpY2; // _28
f32 mX1; // _2C
f32 mY1; // _30
f32 mX2; // _34
f32 mY2; // _38
s8 mFlags; // _3C
Matrixf* mViewMat; // _40
Camera* mCamera; // _44
f32 _48; // _48
f32 mVpScaleY; // _4C
f32 port; // _50
f32 mVpScaleX; // _54
u16 mVpId; // _18
u8 _1A; // _1A
u8 _1B; // _1B
f32 mVpX1; // _1C
f32 mVpY1; // _20
f32 mVpX2; // _24
f32 mVpY2; // _28
f32 mX1; // _2C
f32 mY1; // _30
f32 mX2; // _34
f32 mY2; // _38
s8 mFlags; // _3C
Matrixf* mViewMat; // _40
LookAtCamera* mCamera; // _44
f32 _48; // _48
f32 mVpScaleY; // _4C
f32 port; // _50
f32 mVpScaleX; // _54
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -498,7 +498,7 @@ bool InteractSuckDone::actOnyon(Onyon* item)
if (gameSystem->mIsInCave) {
playData->mCavePokoCount += money;
} else {
gameSystem->mSection->_PADDING00 += money;
gameSystem->mSection->mMoney += money;
}
}

View File

@ -149,7 +149,7 @@ void Section::doLoadingStart()
{
mMoviePlayer.load((Game::THPPlayer::EMovieIndex)sMovieIndexTable[sMovieIndex]);
Delegate<Section>* delegate = new Delegate<Section>(this, loadResource);
Delegate<Section>* delegate = new Delegate<Section>(this, &loadResource);
sys->dvdLoadUseCallBack(&mThreadCommand, delegate);
}

View File

@ -34,7 +34,7 @@ DrawBuffer::~DrawBuffer() { }
void DrawBuffer::create(Sys::DrawBuffer::CreateArg& arg)
{
u32 bufferSize = arg.mSize;
setFlag(arg.mFlags);
setFlag(arg.mFlags.typeView);
mName = arg.mName;
P2ASSERTLINE(42, mBuffer == nullptr);
mBuffer = new J3DDrawBuffer(bufferSize);