mirror of
https://codeberg.org/KeybadeBlox/JSRF-Decompilation.git
synced 2026-02-20 10:17:03 +03:00
Add objdiff setup
This is intended more as a proof of concept as we figure things out than the start of an actual decompilation in this repository. Target object files are currently "bring your own."
This commit is contained in:
parent
10b3c8c273
commit
7e1785e466
12 changed files with 151 additions and 27 deletions
182
src/Core.hpp
182
src/Core.hpp
|
|
@ -1,182 +0,0 @@
|
|||
#ifndef CORE_HPP
|
||||
|
||||
|
||||
typedef bool32 unsigned; // Need to find a clean way of representing this
|
||||
|
||||
typedef Mat4 D3DVECTOR4[4]; // Should probably be defined somewhere else
|
||||
|
||||
struct GraphicsPerformanceCounters { // Would come from header with Graphics COM object
|
||||
unsigned fps;
|
||||
unsigned trianglesPerSecond;
|
||||
unsigned frameTriangleCnt;
|
||||
unsigned unknown0xC;
|
||||
unsigned unknown0x10;
|
||||
unsigned unknown0x14;
|
||||
}
|
||||
|
||||
// Base class of most objects
|
||||
class GameObj {
|
||||
enum GameObjFlags {
|
||||
GOF_SOMETHINGLINKED_ALTLIST = 1 << 0,
|
||||
GOF_SKIPDRAWCHILDREN = 1 << 16,
|
||||
GOF_SKIPDRAWASCHILD = 1 << 18,
|
||||
GOF_SKIPDRAWASROOT = 1 << 22,
|
||||
GOF_EXCLUDEFROMSOMETHINGLINKED = 1 << 30,
|
||||
GOF_DELETEAFTEREXEC = 1 << 31
|
||||
} flags;
|
||||
|
||||
// Position in g_game->objects array
|
||||
// Different indices and ranges are dedicated to different kinds of
|
||||
// objecs.
|
||||
enum GameObjIndex {
|
||||
OBJ_NOTINDEXED = -1, // Not stored in array
|
||||
OBJ_DIRECTOR = 0
|
||||
// TODO
|
||||
} index;
|
||||
|
||||
unsigned otherBitfield;
|
||||
float reverseSortKey; // Sign flipped to produced sortKey
|
||||
unsigned sortKey; // Four-level key, one byte each
|
||||
D3DVECTOR someTranslation;
|
||||
|
||||
// Links forming a tree of objects
|
||||
GameObj * parent;
|
||||
GameObj * firstChild;
|
||||
GameObj * prevSibling;
|
||||
GameObj * nextSibling;
|
||||
|
||||
// Some kind of linked list walked during rendering
|
||||
GameObj * somethingLinkedNext;
|
||||
GameObj * * somethingLinkedPrevNext;
|
||||
GameObj * * * somethingLinkedEndNextPtr;
|
||||
|
||||
// Another linked list sort of arrangement
|
||||
GameObj * someKindOfNextObj;
|
||||
|
||||
public:
|
||||
virtual ~GameObj();
|
||||
GameObj(GameObj * parent, GameObjIndex index, GameObjFlags flags);
|
||||
|
||||
// Each frame, one of these trios of methods is called depending on
|
||||
// which state the game is in
|
||||
// Default implementation of each does nothing; inheriting objects
|
||||
// override these methods to run some code during each phase of each
|
||||
// frame.
|
||||
virtual void execDefault();
|
||||
virtual void postExecDefault();
|
||||
virtual void drawDefault();
|
||||
|
||||
virtual void execEvent();
|
||||
virtual void postExecEvent();
|
||||
virtual void drawEvent();
|
||||
|
||||
virtual void execCoveredPause();
|
||||
virtual void postExecCoveredPause();
|
||||
virtual void drawCoveredPause();
|
||||
|
||||
virtual void execFreezeCam();
|
||||
virtual void postExecFreezeCam();
|
||||
virtual void drawFreezeCam();
|
||||
|
||||
virtual void execUncoveredPause();
|
||||
virtual void postExecUncoveredPause();
|
||||
virtual void drawUncoveredPause();
|
||||
|
||||
// TODO: non-virtual methods
|
||||
};
|
||||
|
||||
// Top-level globally-accessible "god object" that runs the main loop and
|
||||
// provides global access to most other objects and many variables
|
||||
extern class Game {
|
||||
char unknown0x4[4];
|
||||
unsigned unknown0x8;
|
||||
unsigned * unknown0xC;
|
||||
int initState;
|
||||
unsigned unknown0x14;
|
||||
bool32 drawProfilingInfo;
|
||||
int unknown0x1C;
|
||||
bool32 logosStarted;
|
||||
bool32 fatalErr;
|
||||
|
||||
D3DCOLOR colour;
|
||||
D3DCOLOR ambientColour;
|
||||
D3DCOLOR shadowColour;
|
||||
D3DCOLOR bgColour;
|
||||
D3DCOLOR bgColourFallback;
|
||||
bool32 useFallbackBgColour;
|
||||
|
||||
// Game state used to select GameObj methods to call in main loop
|
||||
// If multiple states are acivated, the precedence is
|
||||
// coveredPause > Event > FreezeCam > UncoveredPause > Default
|
||||
bool32 coveredPause; // Game paused with world not visible
|
||||
bool32 event; // Events (cutscenes)
|
||||
bool32 freezeCam; // Time-frozen camera shots
|
||||
bool32 uncoveredPause; // Game paused with world visible, or
|
||||
// automatic pause at start of mission
|
||||
|
||||
bool32 setCoveredPauseNextFrame;
|
||||
bool32 unsetCoveredPauseNextFrame;
|
||||
bool32 setEventNextFrame;
|
||||
bool32 unsetEventNextFrame;
|
||||
bool32 setFreezeCamNextFrame;
|
||||
bool32 unsetFreezeCamNextFrame;
|
||||
bool32 setUncoveredPauseNextFrame;
|
||||
bool32 unsetUncoveredPauseNextFrame;
|
||||
|
||||
unsigned unknown0x70;
|
||||
bool32 skipDraw;
|
||||
int zeroedByExec;
|
||||
GraphicsPerformanceCounters perfCounters;
|
||||
|
||||
enum DrawMode {
|
||||
DRAW_YES,
|
||||
DRAW_WAITVBLANK,
|
||||
DRAW_NO
|
||||
} drawMode;
|
||||
|
||||
// Globally accessible objects and variables
|
||||
GameObj * objects[7668];
|
||||
unsigned globals[461]; // Items may be any 32-bit type, e.g. ptr
|
||||
|
||||
GameObj * somethingLinkedBHead;
|
||||
GameObj * * somethingLinkedBEndNext;
|
||||
|
||||
GameObj * somethingLinkedAHead;
|
||||
GameObj * * somethingLinkedAEndNext;
|
||||
|
||||
GameObj * sortedLinkedListHead;
|
||||
GameObj * * sortedLinkedListEndNext;
|
||||
|
||||
GameObj * linkedListsByKeyHeads [256];
|
||||
GameObj * * linkedListByKeyEndNexts[256];
|
||||
|
||||
unsigned unknown0x87B4;
|
||||
|
||||
LARGE_INTEGER execPerfCount;
|
||||
LARGE_INTEGER drawPerfCount;
|
||||
|
||||
unsigned unknown0x87C8;
|
||||
unsigned unknown0x87CC;
|
||||
unsigned frameCnt1;
|
||||
unsigned unknown0x87D4;
|
||||
unsigned unknown0x87D8;
|
||||
GameObj * rootExecObj;
|
||||
int frameCnt2;
|
||||
int frameCnt3;
|
||||
unsigned gameObjCnt;
|
||||
GameObj * rootDrawObj;
|
||||
int unknown0x87F0;
|
||||
int unknown0x87F4;
|
||||
Mat4 unknown0x87F8;
|
||||
unsigned unknown0x8838;
|
||||
unsigned unknown0x883C;
|
||||
|
||||
public:
|
||||
Game(unsigned *, unsigned);
|
||||
virtual ~Game();
|
||||
|
||||
// TODO: methods
|
||||
} * g_game;
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue