Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/decomp/AppShell.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Start up and the frame loop of the 5960 retail binary. The app object lives at `
| 0x0002d0e0 | Draw | Below |
| 0x0002d7e0 | InitApp | Below |
| 0x0002d930 | CleanupApp | XOnline cleanup, matrix stack, scene, class, `Class_Exit`, XIP sections, `Text_Exit`, DirectSound, app dir |
| 0x0002da00 | XApp | `InitApp`, then forever: clock, keyboard poll, camera, lerpers, scene advance, deferred deletes, `Draw` |
| 0x0002da00 | AppShell_Run | `InitApp`, then forever: clock, keyboard poll, camera, lerpers, scene advance, deferred deletes, `Draw` |
| 0x0002dbc0 | GetStartupClassFile | `y:\default.xap`, current dir `y:/default.xap` |
| 0x0002dc80 | main | Crash handler unless the hardware is a debug kit, then `XApp` |
| 0x0002dc80 | main | Crash handler unless the hardware is a debug kit, then `AppShell_Run` |
| 0x0002dcc0 | XboxFormatMemoryUnit | Device object into a 32 byte name, `XapiFormatFATVolume`, close |
| 0x0002dd20 | Xbox_Init | Below |
| 0x00062750 | DSound_Init | Below |
Expand Down Expand Up @@ -44,7 +44,7 @@ load y:\default.xap, create it, D3DXCreateMatrixStack, call its initialize
DirectSound is not touched here. `DSound_Init` runs the first time a sound buffer is asked for:

```
if (g_BootType == DISC_VIDEO) return false;
if (g_BootType == DISC_DVD) return false;
speaker override = (XGetAudioFlags() low word == mono);
DirectSoundCreate(0, &g_pDirectSound, 0);
SetMixBinHeadroom(bin, 0) for all 31 mix bins;
Expand Down
2 changes: 1 addition & 1 deletion docs/decomp/AssetLoader.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ CMeshNode::load(file): // 0x0005c250

Render stamps the time, loads on first use (the inlined `Initialize`: load if the url is
set, then `Init`), and returns if there's still no mesh. Otherwise it draws with
`bSetFVF = (g_pRenderMeshNode != this)`: the shape renderer sets the FVF itself for the
`bSetFVF = (g_pDrawingShape != this)`: the shape renderer sets the FVF itself for the
node it's drawing. The destructor `free`s an owned mesh without running its destructor,
because the base class has no virtual one.

Expand Down
2 changes: 1 addition & 1 deletion docs/decomp/AudioSystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ The threshold balances DSound buffer allocation cost (static is cheaper but hold
| Address | Function | Notes |
|---------|----------|-------|
| 0x00062750 | DSound_Init | Skipped in DVD boot mode (boot type 4). Reads `XGetAudioFlags`, `DirectSoundCreate(0, &ds, 0)`, then `SetMixBinHeadroom(bin, 0)` for all 31 mix bins and starts the DoWork thread (0x62680) |
| 0x000626b0 | XAppCreateSoundBuffer | Runs DSound_Init on first use, `CreateSoundBuffer` with a 0x18 byte desc, `SetHeadroom(1200)` |
| 0x000626b0 | AppShell_CreateSoundBuffer | Runs DSound_Init on first use, `CreateSoundBuffer` with a 0x18 byte desc, `SetHeadroom(1200)` |
| 0x00062960 | CAudioBuf dtor | Stop, Release |
| 0x000629a0 / 0x000629d0 | Lock / Unlock | Whole buffer from 0 |
| 0x00062a30 | CAudioBuf::Stop | Stop, then spins on GetStatus until it reports stopped |
Expand Down
6 changes: 3 additions & 3 deletions docs/decomp/Camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ it onto the orientation copy. The constants mean the head drifts at most one deg

It stores the position at 0x84, then

D3DXMatrixAffineTransformation(&g_matPosition /*0x17f4a8*/, 1.0, NULL, &rot, &pos);
D3DXMatrixInverse(&g_matView /*0x17f468*/, NULL, &g_matPosition);
g_matView._31.._34 = 0.0 - each; // SUBSS from a zeroed register
D3DXMatrixAffineTransformation(&g_cameraWorld /*0x17f4a8*/, 1.0, NULL, &rot, &pos);
D3DXMatrixInverse(&g_viewMatrix /*0x17f468*/, NULL, &g_cameraWorld);
g_viewMatrix._31.._34 = 0.0 - each; // SUBSS from a zeroed register

copies the 16 floats into the device's view transform at `pDevice + 0xc60`, and ORs
`0xff0200` into the dirty mask at `0x00156080`. Negating the third row is what turns
Expand Down
12 changes: 6 additions & 6 deletions docs/decomp/Disc.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ at `0x0017aee4`; the node's type names are the table at `0x0017453c` (`none`, `u

```
if (g_bHasLaunchData && reason == XLD_LAUNCH_DASHBOARD_DVDPLAYER && DoesFileExist("CDROM0:\video_ts\video_ts.ifo"))
g_BootType = DISC_VIDEO;
if ((g_bHasLaunchData && reason != 0x0C) || g_BootType == DISC_VIDEO || g_BootType == DISC_BAD)
{ m_nDiscType = g_BootType; HalReadSMCTrayState(&m_trayState, 0); }
g_BootType = DISC_DVD;
if ((g_bHasLaunchData && reason != 0x0C) || g_BootType == DISC_DVD || g_BootType == DISC_BAD)
{ m_discKind = g_BootType; HalReadSMCTrayState(&m_trayState, 0); }
else
{ m_nDiscType = DISC_NONE; m_trayState = 0x40; } // the first poll reports the disc
{ m_discKind = DISC_NONE; m_trayState = 0x40; } // the first poll reports the disc
```

Reason `0x0C` is a return from the online dashboard.
Expand All @@ -39,8 +39,8 @@ lastPoll = now;
if (HalReadSMCTrayState(&tray, 0) < 0 || tray == m_trayState) return;
m_trayState = tray; ResetScreenSaver();
g_BootType = GetDiscType();
if (g_BootType == m_nDiscType) return;
m_nDiscType = g_BootType; replace discType string;
if (g_BootType == m_discKind) return;
m_discKind = g_BootType; replace discType string;
if (m_locked) m_bDeferNotification = true; else fire OnDiscInserted (type != none) or OnDiscRemoved;
```

Expand Down
6 changes: 3 additions & 3 deletions docs/decomp/HudNode.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ destructor (`0x00052b80`) only resets the vtable and runs Group's.
D3DXMatrixOrthoLH(&ortho, 720.0, 480.0, -10000.0, 10000.0);
savedProj = g_matProjection /* 0x0017f4e8 */;
g_matProjection = ortho; SetTransform(PROJECTION, &g_matProjection); // 0x00144e30
savedView = g_matView /* 0x0017f468 */;
g_matView = g_matIdentity /* 0x00176338 */; SetTransform(VIEW, ...); // inline copy to device +0xc60
savedView = g_viewMatrix /* 0x0017f468 */;
g_viewMatrix = g_matIdentity /* 0x00176338 */; SetTransform(VIEW, ...); // inline copy to device +0xc60
lighting = rs[LIGHTING] /* 0x0017a218 */; rs[LIGHTING] = 0;
worldStack->Push(); worldStack->LoadIdentity(); // stack 0x0017e7fc, slots 4, 5
SetTransform(WORLD, worldStack->GetTop()); FUN_0005ca00(); // falloff shader constants
Expand All @@ -56,7 +56,7 @@ CGroup::Render(); // 0x000
worldStack->Pop(); SetTransform(WORLD, worldStack->GetTop()); FUN_0005ca00();
rs[LIGHTING] = lighting;
g_matProjection = savedProj; SetTransform(PROJECTION, ...);
g_matView = savedView; SetTransform(VIEW, ...);
g_viewMatrix = savedView; SetTransform(VIEW, ...);
```

The ortho box is a fixed 720x480, so HUD children are laid out in that space no
Expand Down
20 changes: 10 additions & 10 deletions docs/decomp/Node.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The macro patterns were deduced from the init function structure in the binary.
3. Stores the CreateNode factory function pointer
4. Links to the base class's CNodeClass
5. Links to the PRD table
6. Inserts itself into a global linked list (c_pFirstClass)
6. Inserts itself into a global linked list (c_pClassChain)

This was confirmed by Ghidra cross-references resolving each registered class to its CNodeClass instance, one per node type, all linked into the same global list.

Expand Down Expand Up @@ -78,7 +78,7 @@ Example: `sig_si` = returns CStrObject*, takes one int parameter.

### Key Addresses

- `CNodeClass::c_pFirstClass` at `0x0001a068`: head of registered class list
- `CNodeClass::c_pClassChain` at `0x0001a068`: head of registered class list
- `_classCObject` at `0x0001a06c`: CObject's class descriptor
- `_classCTheseusNode`: base node class descriptor
- Individual class descriptors for all 64+ node types
Expand All @@ -97,7 +97,7 @@ Additional virtuals: OnLoad, Advance, Render, GetBBox, GetRadius, GetPalette, Re

### Object Type IDs

The `m_obj` field encodes runtime type. Values recovered from switch statements throughout the VM (CRunner::Step, CObject::Dot, Dereference, etc.):
The `m_kind` field encodes runtime type. Values recovered from switch statements throughout the VM (CRunner::Step, CObject::Dot, Dereference, etc.):

```
0 = objUndefined 8 = objFunctionRef
Expand All @@ -113,7 +113,7 @@ The `m_obj` field encodes runtime type. Values recovered from switch statements

### Typed Array Classes

CIntArray, CNumArray, CVec2Array, CVec3Array, CVec4Array all follow the same pattern: `m_nAlloc`, `m_nSize`, `m_value` pointer. Used by PRD entries with types pt_intarray through pt_vec4array. Confirmed by SetProperty handling for each type.
CIntArray, CNumArray, CVec2Array, CVec3Array, CVec4Array all follow the same pattern: `m_reserved`, `m_nSize`, `m_value` pointer. Used by PRD entries with types pt_intarray through pt_vec4array. Confirmed by SetProperty handling for each type.

### CNodeArray

Expand All @@ -136,18 +136,18 @@ The base classes sit in three runs of code, each in source-file order.
### Object layouts

```
CObject 0x14 bytes +0x00 vtable +0x04 m_nRefCount +0x08 m_obj
+0x0c m_parent +0x10 m_members (CNameSpace*)
CObject 0x14 bytes +0x00 vtable +0x04 m_nRefCount +0x08 m_kind
+0x0c m_parent +0x10 m_pScope (CNameSpace*)
CNode 0x1c bytes +0x14 m_behavior (CRunner*) +0x18 m_visible
CTimeDepNode 0x30 bytes +0x1c m_loop +0x20 m_startTime +0x24 m_stopTime
+0x28 m_isActive +0x2c m_lastStartTime
+0x28 m_isActive +0x2c m_prevStartTime
CNodeClass +0x14 m_className +0x18 m_nObjectSize
+0x1c m_pfnCreateNode +0x20 m_baseClass
+0x1c m_pfnNew +0x20 m_baseClass
+0x24 m_rgprd +0x28 m_nextClass
CClass +0x2c m_url +0x30 m_file +0x58 m_instanceFunctions
+0x64 m_constructor +0x68 m_nVarCount
CInstance 0x54 bytes CGroup up to +0x44, +0x44 m_class +0x48 m_vars
CNodeArray 0x0c bytes +0x00 m_length +0x04 m_nAlloc +0x08 m_rgpNode
CInstance 0x54 bytes CGroup up to +0x44, +0x44 m_classDef +0x48 m_vars
CNodeArray 0x0c bytes +0x00 m_length +0x04 m_reserved +0x08 m_nodes
```

Vtables: CObject `0x00021b00`, CNodeClass `0x00021958`, CNode `0x000219f8`, CTimeDepNode `0x00021990`, CInstance `0x000226a0`, CClass `0x000226fc`. Slots referenced by the code below: `+0x04` GetPropMap, `+0x08` OnSetProperty, `+0x0c` AddRef, `+0x10` Release, `+0x14` GetFunctionMap, `+0x18` GetNodeClass, `+0x1c` ToNum, `+0x20` ToStr, `+0x24` Deref, `+0x34` GetMember, `+0x38` OnLoad, `+0x5c` CTimeDepNode::OnIsActiveChanged.
Expand Down
22 changes: 11 additions & 11 deletions docs/decomp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ When in doubt about an entry, run the address through Ghidra and compare. The po
| 0x000147c8 | `_classCMemoryMonitor` | `CMemoryMonitor::class` (memory_monitor.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the storage-device watcher node. |
| 0x00014b38 | `_classCLayout` | `CLayout::class` (scene_groups.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the radial layout container (used by the dashboard's main menu wheel). |
| 0x00014b3c | `_classCBillboard` | `CBillboard::class` (scene_groups.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the camera-facing quad node. |
| 0x0001a06c | `_classCXAppNode` | `CXAppNode::class` (main.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the application root node type. |
| 0x0001a06c | `_classCAppShellNode` | `CAppShellNode::class` (main.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the application root node type. |
| 0x0001a098 | `_classCTimeDepNode` | `CTimeDepNode::class` (animation_nodes.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for time-dependent node base. |
| 0x0001a0f0 | `_classCArrayObject` | `CArrayObject::class` (array.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the script-visible Array type. |
| 0x0001a1b0 | `_classCDateObject` | `CDateObject::class` (date_node.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the script-visible Date type. |
Expand All @@ -58,18 +58,18 @@ When in doubt about an entry, run the address through Ghidra and compare. The po
| 0x0001f300 | `_classCMaxMaterial` | `CMaxMaterial::class` (materials.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the 3ds Max material translator node. |
| 0x0001f33c | `_classCLayer` | `CLayer::class` (scene_groups.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the 2D-overlay layer node. |
| 0x0001f368 | `_classCKeyboard` | `CKeyboard::class` (keyboard_node.cpp) | [Scene Graph](Node.md) | Static `CNodeClass` registration for the on-screen keyboard node. |
| 0x0002c570 | `CXApp::CXApp` | globals init in `main.cpp` | [App Shell](#app-shell) | Constructor for the original `CXApp` singleton. Theseus replaced this with module-scope globals and free functions; the binary class is preserved for reference. |
| 0x0002c570 | `CAppShell::CAppShell` | globals init in `main.cpp` | [App Shell](#app-shell) | Constructor for the original `CAppShell` singleton. Theseus replaced this with module-scope globals and free functions; the binary class is preserved for reference. |
| 0x0002cc10 | `Xbox_Init` | `Xbox_Init` (main.cpp) | [App Shell](#app-shell) | Early-boot init: `XOnlineStartup`, drive-letter symlinks, `XSetFileCacheSize`, `XInitDevices`, region detection, network bring-up. Runs before scene graph creation. |
| 0x0002d0e0 | `CXApp::Draw` | main loop in `main.cpp` | [App Shell](#app-shell) | Per-frame render entry. Calls scene graph traversal then `Present`. |
| 0x0002d7e0 | `CXApp::InitApp` | `TheseusInit` in `main.cpp` | [App Shell](#app-shell) | Direct3D device creation, scene graph bootstrap, initial XIP load. |
| 0x0002d930 | `CXApp::CleanupApp` | `TheseusShutdown` in `main.cpp` | [App Shell](#app-shell) | Tear-down: scene graph destruction, D3D device release. |
| 0x0002da00 | `XApp` | (vtable / class registration) | [App Shell](#app-shell) | CXApp class-table thunk emitted by the compiler. Theseus's CTheseus equivalent was eliminated; the binary still has it. |
| 0x0002dbc0 | `CXApp::GetStartupClassFile` | startup logic in `main.cpp` | [App Shell](#app-shell) | Resolves the boot XAP file from config. The dashboard's first scene is loaded by string lookup against this path. |
| 0x0002d0e0 | `CAppShell::Draw` | main loop in `main.cpp` | [App Shell](#app-shell) | Per-frame render entry. Calls scene graph traversal then `Present`. |
| 0x0002d7e0 | `CAppShell::InitApp` | `TheseusInit` in `main.cpp` | [App Shell](#app-shell) | Direct3D device creation, scene graph bootstrap, initial XIP load. |
| 0x0002d930 | `CAppShell::CleanupApp` | `TheseusShutdown` in `main.cpp` | [App Shell](#app-shell) | Tear-down: scene graph destruction, D3D device release. |
| 0x0002da00 | `AppShell_Run` | frame loop in `main.cpp` | [App Shell](#app-shell) | Runs `InitApp`, then the frame loop forever: clock, input, camera, lerpers, scene advance, `Draw`. |
| 0x0002dbc0 | `CAppShell::GetStartupClassFile` | startup logic in `main.cpp` | [App Shell](#app-shell) | Resolves the boot XAP file from config. The dashboard's first scene is loaded by string lookup against this path. |
| 0x0002dc50 | `CRecovery::StartRecovery` | `CReboot::Reboot` in `reboot_node.cpp` | [App Shell](#app-shell) | Original entry to factory recovery via `DashRecovery()`. Theseus replaced with `CReboot::Reboot()` returning to firmware; recovery as a concept does not apply on modded hardware. |
| 0x0002dc80 | `main` | `main` (main.cpp) | [App Shell](#app-shell) | C entry point. Calls `Xbox_Init`, constructs the global `CXApp` (`theApp`), enters the per-frame `Draw` loop. |
| 0x0002def0 | `XAppCreateFile` | `TheseusCreateFile` in `main.cpp` | [App Shell](#app-shell) | Wrapper around `CreateFileA` with dashboard-specific share/disposition defaults. |
| 0x0002dc80 | `main` | `main` (main.cpp) | [App Shell](#app-shell) | C entry point. Calls `Xbox_Init`, constructs the global `CAppShell` (`theApp`), enters the per-frame `Draw` loop. |
| 0x0002def0 | `AppShell_CreateFile` | `TheseusCreateFile` in `main.cpp` | [App Shell](#app-shell) | Wrapper around `CreateFileA` with dashboard-specific share/disposition defaults. |
| 0x0002ea20 | `CNodeClass::FindByName` | `CNodeClass::FindByName` in `node_system.cpp` | [Scene Graph](Node.md) | Walks the static class registration list (built from `_classCXxxx_CXxxx__2VCNodeClass__A` entries in .data) looking for a UTF-16 class name match. The XAP compiler uses this when binding `DEF` declarations. |
| 0x0002ee60 | `CXAppNode::Advance` | tick loop in `main.cpp` | [Scene Graph](Node.md) | Per-frame tick on the application root node. Drives the time-dependent node graph. |
| 0x0002ee60 | `CAppShellNode::Advance` | tick loop in `main.cpp` | [Scene Graph](Node.md) | Per-frame tick on the application root node. Drives the time-dependent node graph. |
| 0x00030440 | `CArrayElementReference_CArrayElementReference` | `CArrayElementReference::CArrayElementReference` (array.cpp) | [Script VM](VM.md) | Holds the array and index an `array[i]` expression names. |
| 0x000304c0 | `CArrayElementReference_dtor` | `CArrayElementReference::~CArrayElementReference` (array.cpp) | [Script VM](VM.md) | Releases the array. |
| 0x00030520 | `CArrayElementReference_Assign` | `CArrayElementReference::Assign` (array.cpp) | [Script VM](VM.md) | Stores into the slot, growing the array when the index is past the end. |
Expand Down Expand Up @@ -420,7 +420,7 @@ When in doubt about an entry, run the address through Ghidra and compare. The po
| 0x0006a530 | `CLiveAccounts_GetResult` | `CLiveAccounts::GetResult` (live_accounts.cpp) | [Live Accounts](#live-accounts) | Returns the numeric result code from the most recent Live operation (logon, friends fetch, etc.). |
| 0x0006a590 | `CLiveAccounts_ClearMOTDCache` | `CLiveAccounts::ClearMOTDCache` (live_accounts.cpp) | [Live Accounts](#live-accounts) | Invalidates the cached "message of the day" so the next Live update re-fetches it. |
| 0x0006e6cb | `CFilePump::GetData` | `CFilePump::GetData` (audio_system.cpp) | [Audio](AudioSystem.md) | Reads the next chunk of compressed data from the file pump's source file. Called by the decoder when its input is empty. |
| 0x0007967f | `CXAppNode::GetTextureSurface` | `CXAppNode::GetTextureSurface` (main.cpp) | [Render](#render) | Returns the underlying D3D `IDirect3DSurface8` for a node's bound texture. Used by render-to-texture nodes. |
| 0x0007967f | `CAppShellNode::GetTextureSurface` | `CAppShellNode::GetTextureSurface` (main.cpp) | [Render](#render) | Returns the underlying D3D `IDirect3DSurface8` for a node's bound texture. Used by render-to-texture nodes. |
| 0x000cfe09 | `CLayout::GetRadius` | `CLayout::GetRadius` (scene_groups.cpp) | [Scene Groups](SceneGroups.md) | Returns the layout's circular radius. Inlined in many .text use sites; this is the FND-bound wrapper. |
| 0x0011bec2 | `CXo_XOnlineLogon` | `CXo::XOnlineLogon` (xbox_live.cpp) | [Live Accounts](#live-accounts) | Theseus-side facade over `XOnlineLogon`. Marshals the dashboard's account record into the kernel call's parameter shape. |

Expand Down
4 changes: 2 additions & 2 deletions docs/decomp/ShapeRender.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ for (cls = geometry->GetNodeClass(); cls; cls = cls->base) // class chain wa
if (mesh->core == NULL) return;
}
if (mesh->core == NULL || mesh->core->GetFVF() == 0) return;
g_pRenderMeshNode /* 0x0017e758 */ = mesh;
g_pDrawingShape /* 0x0017e758 */ = mesh;
SetVertexShader(GetFixedFunctionShader(fvf)); // 0x0005c740
break;
}
if (appearance) appearance->Render();
geometry->Render();
copy 16 dwords of the device's world matrix (pDevice + 0xde0);
position = row 3 (x, y, z); g_pRenderMeshNode = NULL;
position = row 3 (x, y, z); g_pDrawingShape = NULL;
```

**GetBBox (`0x00050eb0`)** tail calls the geometry's GetBBox, or zeroes all six floats.
Expand Down
Loading
Loading