mirror of
https://codeberg.org/KeybadeBlox/JSRF-Decompilation.git
synced 2026-02-20 18:27:04 +03:00
Begin populating JSRF/Core
This commit is contained in:
parent
22a8c350eb
commit
71937e4a97
5 changed files with 237 additions and 52 deletions
|
|
@ -15,10 +15,10 @@
|
||||||
},
|
},
|
||||||
"symbol_mappings": {
|
"symbol_mappings": {
|
||||||
"[.rdata-0]": "[.xdata$x-0]",
|
"[.rdata-0]": "[.xdata$x-0]",
|
||||||
"_main_funcinfo": "$T519",
|
"_main_funcinfo": "$T737",
|
||||||
"_main_handler": "$L523",
|
"_main_handler": "$L741",
|
||||||
"_main_handler_unwind1": "$L515",
|
"_main_handler_unwind1": "$L733",
|
||||||
"_main_unwindmap": "$T525"
|
"_main_unwindmap": "$T743"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -28,6 +28,11 @@
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"complete": false,
|
"complete": false,
|
||||||
"source_path": "src/JSRF/Core.cpp"
|
"source_path": "src/JSRF/Core.cpp"
|
||||||
|
},
|
||||||
|
"symbol_mappings": {
|
||||||
|
"GameObj::`scalar_deleting_destructor'": "??_GGameObj@@UAEPAXI@Z",
|
||||||
|
"GameObj::`vftable'": "??_7GameObj@@6B@",
|
||||||
|
"GameObj::~GameObj": "??1GameObj@@UAE@XZ"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,9 @@ Game and GameObj classes that form the foundation of the JSRF game code.
|
||||||
#pragma bss_seg(".data")
|
#pragma bss_seg(".data")
|
||||||
|
|
||||||
#include "Core.hpp"
|
#include "Core.hpp"
|
||||||
|
|
||||||
|
// Address: 0x00011000
|
||||||
|
// Matching: no
|
||||||
|
GameObj::~GameObj() {
|
||||||
|
g_game->gameObjCnt -= 1;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,16 +21,15 @@ struct GraphicsPerformanceCounters {
|
||||||
unsigned unknown0x14;
|
unsigned unknown0x14;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Base class of most objects (and everything in g_game->objects)
|
|
||||||
class GameObj {
|
|
||||||
enum GameObjFlags {
|
enum GameObjFlags {
|
||||||
GOF_SOMETHINGLINKED_ALTLIST = 1 << 0,
|
GOF_DRAWTREEHEAD = 1 << 0,
|
||||||
GOF_SKIPDRAWCHILDREN = 1 << 16,
|
GOF_SKIPDRAWINGSOMETHING = 1 << 1,
|
||||||
GOF_SKIPDRAWASCHILD = 1 << 18,
|
GOF_NODRAWPHASE2 = 1 << 16,
|
||||||
GOF_SKIPDRAWASROOT = 1 << 22,
|
GOF_DRAWTREE2 = 1 << 18,
|
||||||
GOF_EXCLUDEFROMSOMETHINGLINKED = 1 << 30,
|
GOF_DRAWPHASE1 = 1 << 22,
|
||||||
|
GOF_DRAWTREECHILD = 1 << 30,
|
||||||
GOF_DELETEAFTEREXEC = 1 << 31
|
GOF_DELETEAFTEREXEC = 1 << 31
|
||||||
} flags;
|
};
|
||||||
|
|
||||||
// Position in g_game->objects array
|
// Position in g_game->objects array
|
||||||
// Different indices and ranges are dedicated to different kinds of
|
// Different indices and ranges are dedicated to different kinds of
|
||||||
|
|
@ -39,7 +38,12 @@ class GameObj {
|
||||||
OBJ_NOTINDEXED = -1, // Not stored in array
|
OBJ_NOTINDEXED = -1, // Not stored in array
|
||||||
OBJ_DIRECTOR = 0
|
OBJ_DIRECTOR = 0
|
||||||
// TODO
|
// TODO
|
||||||
} index;
|
};
|
||||||
|
|
||||||
|
// Base class of most objects (and everything in g_game->objects)
|
||||||
|
class GameObj {
|
||||||
|
GameObjFlags flags;
|
||||||
|
GameObjIndex index;
|
||||||
|
|
||||||
unsigned otherBitfield;
|
unsigned otherBitfield;
|
||||||
float reverseSortKey; // Sign flipped to produced sortKey
|
float reverseSortKey; // Sign flipped to produced sortKey
|
||||||
|
|
@ -62,7 +66,79 @@ class GameObj {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~GameObj();
|
virtual ~GameObj();
|
||||||
GameObj(GameObj * parent, GameObjIndex index, GameObjFlags flags);
|
|
||||||
|
void recursiveExecDefault();
|
||||||
|
void drawListDefault(
|
||||||
|
GameObjFlags flagFilterAny1,
|
||||||
|
int drawArg1,
|
||||||
|
int drawArg2,
|
||||||
|
GameObjFlags flagFilterAll,
|
||||||
|
unsigned otherBitfieldFilterAny,
|
||||||
|
GameObjFlags flagFilterNone,
|
||||||
|
GameObjFlags flagFilterAny2
|
||||||
|
);
|
||||||
|
void drawTreeDefault1();
|
||||||
|
void drawTreeDefault2();
|
||||||
|
|
||||||
|
void recursiveExecEvent();
|
||||||
|
void drawListEvent(
|
||||||
|
GameObjFlags flagFilterAny1,
|
||||||
|
int drawArg1,
|
||||||
|
int drawArg2,
|
||||||
|
GameObjFlags flagFilterAll,
|
||||||
|
unsigned otherBitfieldFilterAny,
|
||||||
|
GameObjFlags flagFilterNone,
|
||||||
|
GameObjFlags flagFilterAny2
|
||||||
|
);
|
||||||
|
void drawTreeEvent1();
|
||||||
|
void drawTreeEvent2();
|
||||||
|
|
||||||
|
void recursiveExecCoveredPause();
|
||||||
|
void drawListCoveredPause(
|
||||||
|
GameObjFlags flagFilterAny1,
|
||||||
|
int drawArg1,
|
||||||
|
int drawArg2,
|
||||||
|
GameObjFlags flagFilterAll,
|
||||||
|
unsigned otherBitfieldFilterAny,
|
||||||
|
GameObjFlags flagFilterNone,
|
||||||
|
GameObjFlags flagFilterAny2
|
||||||
|
);
|
||||||
|
void drawTreeCoveredPause1();
|
||||||
|
void drawTreeCoveredPause2();
|
||||||
|
|
||||||
|
void recursiveExecFreezeCam();
|
||||||
|
void drawListFreezeCam(
|
||||||
|
GameObjFlags flagFilterAny1,
|
||||||
|
int drawArg1,
|
||||||
|
int drawArg2,
|
||||||
|
GameObjFlags flagFilterAll,
|
||||||
|
unsigned otherBitfieldFilterAny,
|
||||||
|
GameObjFlags flagFilterNone,
|
||||||
|
GameObjFlags flagFilterAny2
|
||||||
|
);
|
||||||
|
void drawTreeFreezeCam1();
|
||||||
|
void drawTreeFreezeCam2();
|
||||||
|
|
||||||
|
void recursiveExecUncoveredPause();
|
||||||
|
void drawListUncoveredPause(
|
||||||
|
GameObjFlags flagFilterAny1,
|
||||||
|
int drawArg1,
|
||||||
|
int drawArg2,
|
||||||
|
GameObjFlags flagFilterAll,
|
||||||
|
unsigned otherBitfieldFilterAny,
|
||||||
|
GameObjFlags flagFilterNone,
|
||||||
|
GameObjFlags flagFilterAny2
|
||||||
|
);
|
||||||
|
void drawTreeUncoveredPause1();
|
||||||
|
void drawTreeUncoveredPause2();
|
||||||
|
|
||||||
|
void addToSiblings(GameObj * sibling, GameObj * parent);
|
||||||
|
void destructChildren(GameObj * firstChild);
|
||||||
|
GameObj * getParent();
|
||||||
|
|
||||||
|
void removeFromObjList (GameObj * obj);
|
||||||
|
void removeChildrenFromObjList(GameObj * firstChild);
|
||||||
|
|
||||||
|
|
||||||
// Each frame, one of these trios of methods is called depending on
|
// Each frame, one of these trios of methods is called depending on
|
||||||
// which state the game is in
|
// which state the game is in
|
||||||
|
|
@ -89,12 +165,57 @@ public:
|
||||||
virtual void postExecUncoveredPause();
|
virtual void postExecUncoveredPause();
|
||||||
virtual void drawUncoveredPause();
|
virtual void drawUncoveredPause();
|
||||||
|
|
||||||
// TODO: non-virtual methods
|
void recursivePostExecDefault();
|
||||||
|
void recursivePostExecEvent();
|
||||||
|
void recursivePostExecCoveredPause();
|
||||||
|
void recursivePostExecFreezeCam();
|
||||||
|
void recursivePostExecUncoveredPause();
|
||||||
|
|
||||||
|
void setParent(GameObj * parent);
|
||||||
|
|
||||||
|
GameObj(GameObj * parent, GameObjIndex index, GameObjFlags flags);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Base class of objects serving as the head of a tree of objects to draw
|
||||||
|
// recursively
|
||||||
|
class DrawTree : GameObj {
|
||||||
|
D3DVECTOR unknown0x44;
|
||||||
|
D3DVECTOR unknown0x50;
|
||||||
|
D3DVECTOR unknown0x5C;
|
||||||
|
D3DVECTOR unknown0x68;
|
||||||
|
unsigned unknown0x74;
|
||||||
|
unsigned unknown0x78;
|
||||||
|
unsigned unknown0x7C;
|
||||||
|
unsigned unknown0x80;
|
||||||
|
D3DRECT viewport;
|
||||||
|
unsigned someIndex;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void copySomeVectors();
|
||||||
|
DrawTree(GameObj * parent, GameObjIndex index, GameObjFlags flags);
|
||||||
|
virtual ~DrawTree();
|
||||||
|
};
|
||||||
|
|
||||||
|
class PlayerObj : GameObj {
|
||||||
|
unsigned unknown0x44;
|
||||||
|
unsigned unknown0x48;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PlayerObj(GameObj * parent, GameObjIndex index, GameObjFlags flags);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Top-level globally-accessible "god object" that runs the main loop and
|
// Top-level globally-accessible "god object" that runs the main loop and
|
||||||
// provides global access to most other objects and many variables
|
// provides global access to most other objects and many variables
|
||||||
extern class Game {
|
enum DrawMode {
|
||||||
|
DRAW_YES,
|
||||||
|
DRAW_WAITVBLANK,
|
||||||
|
DRAW_NO
|
||||||
|
};
|
||||||
|
|
||||||
|
enum GlobalIndex {
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct Game {
|
||||||
char unknown0x4[4];
|
char unknown0x4[4];
|
||||||
unsigned unknown0x8;
|
unsigned unknown0x8;
|
||||||
unsigned * unknown0xC;
|
unsigned * unknown0xC;
|
||||||
|
|
@ -121,25 +242,21 @@ extern class Game {
|
||||||
BOOL uncoveredPause; // Game paused with world visible, or
|
BOOL uncoveredPause; // Game paused with world visible, or
|
||||||
// automatic pause at start of mission
|
// automatic pause at start of mission
|
||||||
|
|
||||||
BOOL setCoveredPauseNextFrame;
|
BOOL coveredPauseNextFrame;
|
||||||
BOOL unsetCoveredPauseNextFrame;
|
BOOL noCoveredPauseNextFrame;
|
||||||
BOOL setEventNextFrame;
|
BOOL eventNextFrame;
|
||||||
BOOL unsetEventNextFrame;
|
BOOL noEventNextFrame;
|
||||||
BOOL setFreezeCamNextFrame;
|
BOOL freezeCamNextFrame;
|
||||||
BOOL unsetFreezeCamNextFrame;
|
BOOL noFreezeCamNextFrame;
|
||||||
BOOL setUncoveredPauseNextFrame;
|
BOOL uncoveredPauseNextFrame;
|
||||||
BOOL unsetUncoveredPauseNextFrame;
|
BOOL noUncoveredPauseNextFrame;
|
||||||
|
|
||||||
unsigned unknown0x70;
|
unsigned unknown0x70;
|
||||||
BOOL skipDraw;
|
BOOL skipDraw;
|
||||||
int zeroedByExec;
|
int zeroedByExec;
|
||||||
GraphicsPerformanceCounters perfCounters;
|
GraphicsPerformanceCounters perfCounters;
|
||||||
|
|
||||||
enum DrawMode {
|
DrawMode drawMode;
|
||||||
DRAW_YES,
|
|
||||||
DRAW_WAITVBLANK,
|
|
||||||
DRAW_NO
|
|
||||||
} drawMode;
|
|
||||||
|
|
||||||
// Globally accessible objects and variables
|
// Globally accessible objects and variables
|
||||||
GameObj * objects[7668];
|
GameObj * objects[7668];
|
||||||
|
|
@ -176,14 +293,69 @@ extern class Game {
|
||||||
unsigned unknown0x8838;
|
unsigned unknown0x8838;
|
||||||
unsigned unknown0x883C;
|
unsigned unknown0x883C;
|
||||||
|
|
||||||
public:
|
|
||||||
Game(unsigned *, unsigned);
|
Game(unsigned *, unsigned);
|
||||||
virtual ~Game();
|
virtual ~Game();
|
||||||
|
void exec();
|
||||||
|
void drawObj(GameObj * obj, int);
|
||||||
|
void drawList_(
|
||||||
|
GameObjFlags flagFilterAny1,
|
||||||
|
int drawArg1,
|
||||||
|
int drawArg2,
|
||||||
|
GameObjFlags flagFilterAll,
|
||||||
|
unsigned otherBitfieldFilterAny,
|
||||||
|
GameObjFlags flagFilterNone,
|
||||||
|
GameObjFlags flagFilterAny2
|
||||||
|
);
|
||||||
|
void drawTree1(GameObj * obj);
|
||||||
|
|
||||||
|
void setCoveredPauseNextFrame (BOOL val);
|
||||||
|
void setEventNextFrame (BOOL val);
|
||||||
|
void setFreezeCamNextFrame (BOOL val);
|
||||||
|
void setUncoveredPauseNextFrame(BOOL val);
|
||||||
|
|
||||||
|
void enableDrawChildren();
|
||||||
|
void setSkipDraw();
|
||||||
|
void fatal();
|
||||||
|
void setDrawMode(DrawMode mode);
|
||||||
|
|
||||||
|
void setGlobal(GlobalIndex index, unsigned val);
|
||||||
|
unsigned getGlobal(GlobalIndex index);
|
||||||
|
|
||||||
|
void addToDrawList (GameObj * obj);
|
||||||
|
void removeFromDrawList(GameObj * obj);
|
||||||
|
|
||||||
|
void setObj (GameObjIndex index );
|
||||||
|
void unsetObj (GameObjIndex index , GameObj * obj);
|
||||||
|
GameObj * getObj (GameObjIndex index );
|
||||||
|
int allocObjIndex(GameObjIndex min , GameObjIndex max);
|
||||||
|
BOOL objIndexAvail(GameObjIndex index );
|
||||||
|
void swapObjs (GameObjIndex index1, GameObjIndex index2);
|
||||||
|
|
||||||
|
void clearScreen();
|
||||||
|
void enableSomeExtraDrawListCode();
|
||||||
|
void setLogosStarted(BOOL val);
|
||||||
|
|
||||||
|
void clearDrawPriorityList();
|
||||||
|
GameObj * getDrawPriorityListHead();
|
||||||
|
void appendToDrawPriorityList();
|
||||||
|
void sortDrawPriorityListSingleLevel(char sortKeyBitOffset);
|
||||||
|
|
||||||
|
void setFallbackBgColour(D3DCOLOR colour, BOOL useFallback);
|
||||||
void initExecRootObj();
|
void initExecRootObj();
|
||||||
void mainLoop();
|
void drawList(GameObjFlags flagFilterAll, BOOL);
|
||||||
// TODO: other methods
|
void sortDrawPriorityList();
|
||||||
|
void drawObjs();
|
||||||
|
void draw();
|
||||||
|
void frame();
|
||||||
|
int mainLoop();
|
||||||
} * g_game;
|
} * g_game;
|
||||||
|
|
||||||
|
// Root of the exec GameObj tree
|
||||||
|
class RootExecObj : GameObj {
|
||||||
|
RootExecObj(GameObj * parent, GameObjIndex index, GameObjFlags flags);
|
||||||
|
virtual ~RootExecObj();
|
||||||
|
};
|
||||||
|
|
||||||
|
void removeFromObjListByIndex(GameObjIndex index);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,6 @@ typedef DWORD D3DCOLOR;
|
||||||
struct D3DVECTOR { float x, y, z ; };
|
struct D3DVECTOR { float x, y, z ; };
|
||||||
struct D3DVECTOR4 { float x, y, z, w; };
|
struct D3DVECTOR4 { float x, y, z, w; };
|
||||||
|
|
||||||
|
struct D3DRECT { LONG x1, y1, x2, y2; };
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,14 @@ drawListUncoveredPause 00011960 f
|
||||||
drawTreeUncoveredPause1 00011ae0 f
|
drawTreeUncoveredPause1 00011ae0 f
|
||||||
drawTreeUncoveredPause2 00011b20 f
|
drawTreeUncoveredPause2 00011b20 f
|
||||||
addToSiblings 00011b60 f
|
addToSiblings 00011b60 f
|
||||||
destructRecursive 00011b90 f
|
destructChildren 00011b90 f
|
||||||
getParent 00011bd0 f
|
getParent 00011bd0 f
|
||||||
removeFromObjList 00011be0 f
|
removeFromObjList 00011be0 f
|
||||||
removeFromObjListRecursive 00011c20 f
|
removeChildrenFromObjList 00011c20 f
|
||||||
nopDraw 00011c80 f
|
nopDraw 00011c80 f
|
||||||
nopExec 00011c90 f
|
nopExec 00011c90 f
|
||||||
copySomeVectors 00011ca0 f
|
copySomeVectors 00011ca0 f
|
||||||
_~GameObj 00011ce0 f
|
`scalar_deleting_destructor' 00011ce0 f
|
||||||
recursivePostExecDefault 00011d00 f
|
recursivePostExecDefault 00011d00 f
|
||||||
recursivePostExecEvent 00011da0 f
|
recursivePostExecEvent 00011da0 f
|
||||||
recursivePostExecCoveredPause 00011e40 f
|
recursivePostExecCoveredPause 00011e40 f
|
||||||
|
|
@ -36,7 +36,7 @@ recursivePostExecUncoveredPause 00011f80 f
|
||||||
setParent 00012020 f
|
setParent 00012020 f
|
||||||
GameObj 00012100 f
|
GameObj 00012100 f
|
||||||
DrawTree 00012170 f
|
DrawTree 00012170 f
|
||||||
_~DrawTree 000121b0 f
|
`scalar_deleting_destructor' 000121b0 f
|
||||||
PlayerObj 000121e0 f
|
PlayerObj 000121e0 f
|
||||||
Game 00012210 f
|
Game 00012210 f
|
||||||
~Game 00012390 f
|
~Game 00012390 f
|
||||||
|
|
@ -60,7 +60,7 @@ setObj 00012870 f
|
||||||
unsetObj 00012890 f
|
unsetObj 00012890 f
|
||||||
getObj 000128c0 f
|
getObj 000128c0 f
|
||||||
allocObjIndex 000128e0 f
|
allocObjIndex 000128e0 f
|
||||||
objIndexAvailable 00012910 f
|
objIndexAvail 00012910 f
|
||||||
swapObjs 00012930 f
|
swapObjs 00012930 f
|
||||||
clearScreen 00012980 f
|
clearScreen 00012980 f
|
||||||
enableSomeExtraDrawListCode 000129b0 f
|
enableSomeExtraDrawListCode 000129b0 f
|
||||||
|
|
@ -72,11 +72,11 @@ sortDrawPriorityListSingleLevel 00012a20 f
|
||||||
setFallbackBgColour 00012ac0 f
|
setFallbackBgColour 00012ac0 f
|
||||||
RootExecObj 00012ae0 f
|
RootExecObj 00012ae0 f
|
||||||
~RootExecObj 00012be0 f
|
~RootExecObj 00012be0 f
|
||||||
_~Game 00012bf0 f
|
`scalar_deleting_destructor' 00012bf0 f
|
||||||
initRootExecObj 00012c10 f
|
initRootExecObj 00012c10 f
|
||||||
drawList 00012c80 f
|
drawList 00012c80 f
|
||||||
sortDrawPriorityList 000131a0 f
|
sortDrawPriorityList 000131a0 f
|
||||||
_~RootExecObj 000131d0 f
|
`scalar_deleting_destructor' 000131d0 f
|
||||||
drawObjs 000131f0 f
|
drawObjs 000131f0 f
|
||||||
draw 00013930 f
|
draw 00013930 f
|
||||||
frame 00013a80 f
|
frame 00013a80 f
|
||||||
|
|
@ -921,11 +921,11 @@ vector_constructor_iterator 001bd03b f
|
||||||
initUnknownStaticXPP 001bdaa9 f
|
initUnknownStaticXPP 001bdaa9 f
|
||||||
D3DDIRTYFROMTEXTURESTATE 001c4160 l
|
D3DDIRTYFROMTEXTURESTATE 001c4160 l
|
||||||
D3DSIMPLERENDERSTATEENCODE 001c4248 l
|
D3DSIMPLERENDERSTATEENCODE 001c4248 l
|
||||||
vtable 001c4390 l
|
`vftable' 001c4390 l
|
||||||
vtable 001c43d8 l
|
`vftable' 001c43d8 l
|
||||||
vtable 001c4418 l
|
`vftable' 001c4418 l
|
||||||
vtable 001c4458 l
|
`vftable' 001c4458 l
|
||||||
vtable 001c4480 l
|
`vftable' 001c4480 l
|
||||||
vtable 001c4544 l
|
vtable 001c4544 l
|
||||||
2^32 001c4558 l
|
2^32 001c4558 l
|
||||||
vtable 001c4580 l
|
vtable 001c4580 l
|
||||||
|
|
|
||||||
|
Loading…
Add table
Add a link
Reference in a new issue