vault backup: 2023-02-04 14:56:18
This commit is contained in:
parent
51d39cbbe4
commit
65f5a81960
20 changed files with 97213 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.obsidian
|
1
Appendix.md
Normal file
1
Appendix.md
Normal file
|
@ -0,0 +1 @@
|
|||
# Appendix
|
140
Chunked.md
Normal file
140
Chunked.md
Normal file
|
@ -0,0 +1,140 @@
|
|||
# Chunked Formats
|
||||
|
||||
# General Block format
|
||||
|
||||
```cpp
|
||||
struct Block {
|
||||
unsigned char block_id[4],
|
||||
uint32_t size,
|
||||
unsigned char data[size],
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct Block {
|
||||
unsigned char block_id[4],
|
||||
uint32_t size,
|
||||
T data,
|
||||
}
|
||||
```
|
||||
|
||||
# Block IDs
|
||||
|
||||
File ID | Chunk IDs
|
||||
------- | ------------------------------------------------------------------------------
|
||||
AMC | AMC, CMSH, QUAD
|
||||
CM3 | ANI, CM3, EVA, NAE, NAM, SCN
|
||||
DUM | DUM, INI
|
||||
EMI | EMI, LFVF, MAP, MAT, TRI
|
||||
SM3 | ANI, CAM, INI, LFVF, LUZ, MAP, MAT, MD3D, NAE, NAM, PORT, SCN, SM3, SPR3, SUEL
|
||||
|
||||
Read types:
|
||||
|
||||
- `i`: 4-byte unsigned integer
|
||||
- `s`: 4-byte signed integer
|
||||
- `p`: length prefixed string
|
||||
- `f`: 4-byte float
|
||||
- `3f`: array of 3 4-byte floats
|
||||
- `3i`: array of 3 4-byte unsigned integers
|
||||
|
||||
Chunk ID | Description | Reads
|
||||
-------- | --------------------------- | ------------------------
|
||||
AMC | Collision Data |
|
||||
ANI | Animation data? |
|
||||
CAM | Camera info? |
|
||||
CMSH | Collision Mesh Data |
|
||||
DUM | Dummy (map object) data |
|
||||
INI | INI-Configuration data |
|
||||
LFVF | FVF Vertex Data |
|
||||
LUZ | Lighting information |
|
||||
MAP | UV Map? |
|
||||
MAT | Material information |
|
||||
NAE | Animation Data? |
|
||||
NAM | Animation Data? |
|
||||
PORT | Map portals? | i==1, i, i, 4, 4
|
||||
QUAD | Mesh data? |
|
||||
SCN | Scene data? |
|
||||
SUEL | Ground plane? | 0x18, 0xc, 4, 4, 4, 0x18
|
||||
TRI | Triangle strip definitions? |
|
||||
MD3D | 3D Model definition? |
|
||||
|
||||
# Format of Specific chunks
|
||||
|
||||
## INI
|
||||
|
||||
Configuration Data
|
||||
|
||||
```cpp
|
||||
struct INI {
|
||||
uint32_t num_sections;
|
||||
struct {
|
||||
uint32_t num_lines;
|
||||
struct {
|
||||
uint32_t num_chars;
|
||||
char line[num_chars]
|
||||
} lines[num_lines];
|
||||
} sections[num_sections];
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## LFVF
|
||||
|
||||
DirectX Flexible Vertex Format Data
|
||||
|
||||
```cpp
|
||||
struct Vertex { // fields according to flags
|
||||
float position[3]; // D3DFVF_XYZ | D3DFVF_XYZRHW | D3DFVF_XYZB*
|
||||
float rhw; // D3DFVF_XYZRHW
|
||||
float weights[3]; // D3DFVF_XYZB*
|
||||
float normal[3]; // D3DFVF_NORMAL
|
||||
float point_size; // D3DFVF_PSIZE
|
||||
uint32_t diffuse; // D3DFVF_DIFFUSE, RGBA
|
||||
uint32_t specular; //D3DFVF_SPECULAR, RGBA
|
||||
float tex_coords[D3DFVF_TEXTUREFORMAT][D3DFVF_TEX]; // D3DFVF_TEX* and D3DFVF_TEXTUREFORMAT*
|
||||
};
|
||||
|
||||
struct LFVF {
|
||||
uint32_t unk;
|
||||
uint32_t num_entries;
|
||||
struct {
|
||||
uint32_t FVF; // FVF vertex data configuration
|
||||
uint32_t vert_size; //?,
|
||||
uint32_t num_verts;
|
||||
Vertex vertices[num_vers];
|
||||
} entry[num_entries];
|
||||
};
|
||||
```
|
||||
|
||||
## DUM
|
||||
|
||||
Map object data
|
||||
|
||||
```cpp
|
||||
struct DUM {
|
||||
uint32_t unk_1;
|
||||
uint32_t num_dummies;
|
||||
uint32_t unk_2;
|
||||
struct {
|
||||
uint32_t name_length;
|
||||
char name[name_length];
|
||||
float position[3];
|
||||
float rotation[3];
|
||||
uint32_t has_ini;
|
||||
if (has_ini) {
|
||||
Block<INI> ini;
|
||||
};
|
||||
uint32_t unk_1; // has_next?
|
||||
} sections[num_sections];
|
||||
};
|
||||
```
|
||||
|
||||
## MAP
|
||||
|
||||
```cpp
|
||||
struct MAP {
|
||||
uint32_t version;
|
||||
uint32_t tex_name_len;
|
||||
char tex_name[tex_name_len];
|
||||
// TODO: rest
|
||||
}
|
||||
```
|
130
Classes.md
Normal file
130
Classes.md
Normal file
|
@ -0,0 +1,130 @@
|
|||
# Classes
|
||||
|
||||
<!-- TODO: autogenerate? -->
|
||||
|
||||
`new()` @ 0x415ca0
|
||||
|
||||
`delete()` @ 0x415cb0
|
||||
|
||||
> Lots of constructor calls at `0x68367b`
|
||||
|
||||
| Name | Size | Constructor | VMT | Inherits From |
|
||||
| --------------- | ------ | ----------- | -------- | ------------- |
|
||||
| Action | 0xc | 0x584d50 | 0x790fe0 | |
|
||||
| ActionClassList | 0x724 | 0x582eb0 | 0x790fb4 | |
|
||||
| App | ??? | 0x4023e0 | 0x78b4d8 | |
|
||||
| Cam | 0x13c | 0x4b1210 | 0x78d2d8 | Entity |
|
||||
| CamPath | 0x1788 | 0x4b1a50 | 0x78d340 | Cam |
|
||||
| Car | 0x970 | 0x49b300 | 0x78cd40 | WithLife |
|
||||
| Entity | 0x7c | 0x4e97e0 | 0x78da88 | |
|
||||
| EntityList | 0xa4 | 0x474d70 | ??? | |
|
||||
| FCam | 0x274 | 0x4b28e0 | 0x78d3a8 | Cam |
|
||||
| Missile | 0x9a4 | 0x4ec120 | 0x78db90 | WithLife |
|
||||
| Obj | 0x288 | 0x4efa40 | 0x78dca8 | Entity |
|
||||
| SaveVar | 0xc | 0x416540 | | |
|
||||
| WalkChar | 0x760 | 0x4cdf90 | 0x78d4d8 | WithLife |
|
||||
| Window | 0x88 | 0x4010e0 | 0x78b480 | App |
|
||||
| WithLife | 0x544 | 0x4f2a60 | 0x78de00 | Obj |
|
||||
| World | 0x225c | 0x479870 | 0x78cc6c | |
|
||||
| item | 0x458 | 0x4ea790 | 0x78dad8 | Obj |
|
||||
| Py_Entity | ???? | ??? | ??? | |
|
||||
|
||||
## Class Inheritance
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
World
|
||||
ActionClassList
|
||||
SaveVar
|
||||
App --> Window
|
||||
Cam --> CamPath
|
||||
Entity --> Cam
|
||||
Cam --> FCam
|
||||
Entity --> Obj
|
||||
Obj --> item
|
||||
Obj --> WithLife
|
||||
WithLife --> Car
|
||||
WithLife --> WalkChar
|
||||
WithLife --> Missile
|
||||
```
|
||||
|
||||
# Attributes (VMT index 16,17,18 for accessor functions)
|
||||
|
||||
## Entity
|
||||
|
||||
- LLogic
|
||||
- Name
|
||||
- Type
|
||||
- EntityList
|
||||
- NextInSlot
|
||||
- NextInList
|
||||
|
||||
## FCam
|
||||
|
||||
- OnSwitch
|
||||
- QuakeFactor
|
||||
- MainTarget
|
||||
- Target
|
||||
- EntityLink
|
||||
- QuakeFactor
|
||||
- QuakeTime
|
||||
- HSpeed
|
||||
- VSpeed
|
||||
- RetSpd
|
||||
- CamDist
|
||||
- CamAng
|
||||
- CamRot
|
||||
- AddTurn
|
||||
- AddTurnSpeed
|
||||
|
||||
## Cam
|
||||
|
||||
- Fov
|
||||
- clipNear
|
||||
- clipFar
|
||||
-
|
||||
|
||||
|
||||
|
||||
## Obj
|
||||
|
||||
- OnEndMove
|
||||
- CamName
|
||||
- NetRes
|
||||
- OnObjSlot
|
||||
- LinkModel?
|
||||
|
||||
## item
|
||||
|
||||
- TakeSound
|
||||
- OnReset
|
||||
- OnTake
|
||||
- Owner
|
||||
- TgTypeMarker
|
||||
|
||||
## Car
|
||||
|
||||
- Traf
|
||||
- Model
|
||||
- Target
|
||||
|
||||
## WithLife
|
||||
|
||||
- Descriptor
|
||||
- Attacker
|
||||
- ActCtrl
|
||||
- HeadModel
|
||||
- Pyromaniac
|
||||
- OnDeath
|
||||
- Hit?
|
||||
- OnDamage
|
||||
- CanPhoto
|
||||
- AlwaysUse
|
||||
- ArrowCanView
|
||||
- ArrowCanMission
|
||||
- ArrowCanUse
|
||||
- ArrnOpt
|
||||
- ArriOpt
|
||||
- UseAngSel
|
||||
- UseMapCheck
|
||||
- UseAbsAngSel
|
18
File.md
Normal file
18
File.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# File Formats
|
||||
|
||||
|
||||
File Extension | Description | Chunked
|
||||
-------------- | ------------------------ | -------
|
||||
.packed | Game Data Archive | n
|
||||
.cm3 | Animation file | y
|
||||
.sm3 | 3d model file | y
|
||||
.dum | Dummy (map object) file | y
|
||||
.pth | AI Path | n
|
||||
.emi | Emission maps/Materials? | y
|
||||
.amc | Collision Data | y
|
||||
.ini | Configuration | n
|
||||
.txa | Texture Animation Config | n
|
||||
|
||||
- [Chunked](Chunked.md)
|
||||
- [Packed](Packed.md)
|
||||
- [AI Pathfinding Graph](Nodegraph.md)
|
1
File_Formats.md
Normal file
1
File_Formats.md
Normal file
|
@ -0,0 +1 @@
|
|||
# File Formats
|
17
MultiSpriteTable.md
Normal file
17
MultiSpriteTable.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# MultiSpriteTable
|
||||
|
||||
```cpp
|
||||
struct Tile {
|
||||
uint16_t pos[2];
|
||||
uint16_t size[2];
|
||||
}
|
||||
|
||||
struct MST {
|
||||
char magic[4]; // always "MST\0"
|
||||
uint32_t data_size;
|
||||
uint32_t version; // should be 100
|
||||
uint32_t image_size[2]; // width and height of base image
|
||||
uint32_t num_tiles; // number of tiles/subsprites
|
||||
Tile tiles[num_tiles];
|
||||
}
|
||||
```
|
75
Netplay/Netplay.md
Normal file
75
Netplay/Netplay.md
Normal file
|
@ -0,0 +1,75 @@
|
|||
# Encryption (v1.1)
|
||||
|
||||
Fixed Key: `020406080a0c0e10121416181a1c1e20222426282a2c2e30323436383a3c3e40`
|
||||
Packet Structure:
|
||||
```
|
||||
[0..nonce_len]: nonce
|
||||
[nonce_len..(16-nonce_len%16)]: padding
|
||||
[16..ciphertext_len]: Ciphertext
|
||||
[nonce_len+(16-nonce_len%16)+ciphertext_len]
|
||||
|
||||
|
||||
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||
0000 ED C9 C2 F4 7C 6D F2 54 42 EF 46 F6 00 00 00 00 ....|m.TB.F.....
|
||||
0010 68 13 5C 9A 2B 18 DB 9C 76 BE A0 8A 3E 49 79 3C h.\.+...v...>Iy<
|
||||
0020 8D 7A C4 4C 8B B0 A4 94 E5 B5 89 54 A6 ED 6D 75 .z.L.......T..mu
|
||||
0030 1A CA A8 4B 22 B5 03 84 F7 3C DE 4E B0 30 81 29 ...K"....<.N.0.)
|
||||
0040 3B 70 45 15 33 C0 97 67 85 6B 28 EF 2E 2E D1 83 ;pE.3..g.k(.....
|
||||
0050 E6 56 A7 81 53 89 3E 52 D8 82 CF 77 92 CF C2 D6 .V..S.>R...w....
|
||||
0060 9F 37 C5 DE EE 14 4D 3F 1F 82 32 7E 00 00 00 00 .7....M?..2~....
|
||||
0070 0C 00 00 00 00 00 00 00 5C 00 00 00 00 00 00 00 ........\.......
|
||||
0080 89 7A A8 32 93 56 B6 68 24 E0 58 63 7F 70 5A D2 .z.2.V.h$.Xc.pZ.
|
||||
```
|
||||
Decrypted:
|
||||
```
|
||||
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||
0000 BA CE 01 01 8B 6D 06 00 00 00 01 4D 53 45 31 3A .....m.....MSE1:
|
||||
0010 20 46 6C 61 67 20 48 75 6E 74 20 32 2D 36 00 05 Flag Hunt 2-6..
|
||||
0020 00 00 00 00 00 05 18 01 88 AA 9B 46 6C 61 67 48 ...........FlagH
|
||||
0030 75 6E 74 00 54 A9 2F 05 F0 B4 4F 43 41 00 00 00 unt.T./...OCA...
|
||||
0040 4D 07 18 01 60 A3 00 05 00 00 80 3F 20 4A DA 3D M...`......? J.=
|
||||
0050 68 F8 8F 01 19 6A 71 77 20 8B FB 76 h....jqw ..v
|
||||
```
|
||||
|
||||
# Netplay
|
||||
|
||||
Game Info Packet
|
||||
|
||||
```
|
||||
Server 'B':FZ (0/10) Ver 1.0 at 192.168.99.1:28086
|
||||
[0-2] ID (0xbace)
|
||||
[2-4] Version
|
||||
[4-5] port (16-bit)
|
||||
[6-7] max_players (16-bit)
|
||||
[8-9] curr_player (16-bit)
|
||||
[10-x] server name (char*)
|
||||
|
||||
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
|
||||
0019fdc0 ba ce 00 01 b6 6d 0a 00 00 00 42 00 30 fe 19 00 .....m....B.0...
|
||||
0019fdd0 ff ff ff ff 27 2b b3 9b c7 3e bb 00 9c af 29 00 ....'+...>....).
|
||||
0019fde0 db 69 00 00 00 00 00 00 00 00 44 65 61 74 68 4d .i........DeathM
|
||||
0019fdf0 61 74 63 68 00 00 00 00 ff ff 46 5a 00 4a 91 f0 atch......FZ.J..
|
||||
0019fe00 92 8b 57 4e 7f 00 00 00 10 21 fe 38 0d ae 00 00 ..WN.....!.8....
|
||||
0019fe10 f0 ce f3 36 a0 e8 0b 77 a0 e8 ...6...w..
|
||||
```
|
||||
|
||||
|
||||
Player Join Packet
|
||||
|
||||
```
|
||||
[0-3] header/ID?
|
||||
[6-x] Player name
|
||||
|
||||
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
|
||||
09c9dfe8 7f 47 00 00 00 0e 55 6e 6e 61 6d 65 64 20 50 6c .G....Unnamed Pl
|
||||
09c9dff8 61 79 65 72 06 53 42 6f 73 73 31 b9 00 07 50 5f ayer.SBoss1...P_
|
||||
09c9e008 42 65 74 74 79 06 4d 42 4f 53 53 31 06 4d 42 4f Betty.MBOSS1.MBO
|
||||
09c9e018 53 53 31 00 00 10 30 2c 31 35 2c 30 2c 30 2c 31 SS1...0,15,0,0,1
|
||||
09c9e028 35 2c 31 35 2c 31 02 00 00 00 5,15,1....
|
||||
```
|
||||
|
||||
Message | Description
|
||||
---------------------------------------- | -----------------------------------------------------------------
|
||||
`5c68625c32383230395c73637261706c616e64` | "Scrapland Server" announcement broadcast (`\hb\28209\scrapland`)
|
||||
`7f01000007` | Retrieve Game info
|
||||
`48423d35323932322c3235363a323830383600` | Connection Information (`HB=52922,256:28086`)
|
146
Netplay/Protocol.md
Normal file
146
Netplay/Protocol.md
Normal file
|
@ -0,0 +1,146 @@
|
|||
# Protocol notes
|
||||
|
||||
Raw UDP Payload:
|
||||
|
||||
```
|
||||
0f0000020007007544b3c59018374774c6b246009805000009955f3c00067134
|
||||
0281062c090900001d007f5e0e22c6ddf52247cce2b64655163b8c8e0b4a272f
|
||||
44e7afc745ef91354600000000000000000008155f8300035186005100e9fb08
|
||||
050040007e5700ffff6301000010ff2365f96e1e00000002000000105f000006
|
||||
21e000daf7b1f73a0000c800ff7544b3c59018374774c6b24697f5d702000000
|
||||
00000000000000000000000000000000002c2502159ba419d1c4012d3c47252d
|
||||
af465359899e7745e6531142b96009c4ffff2402159e7f005800b5ff20f1f019
|
||||
04210bd5f5ffff2302159f4a6cd1c44625314792e5b04614cb45d6da5c26aa4e
|
||||
44a2ca72c5cdb4edc3ffff2202159e7e0014009efff6e8c89f0822fc8ff3ffff
|
||||
```
|
||||
|
||||
Hexdump:
|
||||
|
||||
```
|
||||
0000 0F 00 00 02 00 07 00 75 44 B3 C5 90 18 37 47 74 .......uD....7Gt
|
||||
0010 C6 B2 46 00 98 05 00 00 09 95 5F 3C 00 06 71 34 ..F......._<..q4
|
||||
0020 02 81 06 2C 09 09 00 00 1D 00 7F 5E 0E 22 C6 DD ...,.......^."..
|
||||
0030 F5 22 47 CC E2 B6 46 55 16 3B 8C 8E 0B 4A 27 2F ."G...FU.;...J'/
|
||||
0040 44 E7 AF C7 45 EF 91 35 46 00 00 00 00 00 00 00 D...E..5F.......
|
||||
0050 00 00 08 15 5F 83 00 03 51 86 00 51 00 E9 FB 08 ...._...Q..Q....
|
||||
0060 05 00 40 00 7E 57 00 FF FF 63 01 00 00 10 FF 23 ..@.~W...c.....#
|
||||
0070 65 F9 6E 1E 00 00 00 02 00 00 00 10 5F 00 00 06 e.n........._...
|
||||
0080 21 E0 00 DA F7 B1 F7 3A 00 00 C8 00 FF 75 44 B3 !......:.....uD.
|
||||
0090 C5 90 18 37 47 74 C6 B2 46 97 F5 D7 02 00 00 00 ...7Gt..F.......
|
||||
00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
00b0 00 2C 25 02 15 9B A4 19 D1 C4 01 2D 3C 47 25 2D .,%........-<G%-
|
||||
00c0 AF 46 53 59 89 9E 77 45 E6 53 11 42 B9 60 09 C4 .FSY..wE.S.B.`..
|
||||
00d0 FF FF 24 02 15 9E 7F 00 58 00 B5 FF 20 F1 F0 19 ..$.....X... ...
|
||||
00e0 04 21 0B D5 F5 FF FF 23 02 15 9F 4A 6C D1 C4 46 .!.....#...Jl..F
|
||||
00f0 25 31 47 92 E5 B0 46 14 CB 45 D6 DA 5C 26 AA 4E %1G...F..E..\&.N
|
||||
0100 44 A2 CA 72 C5 CD B4 ED C3 FF FF 22 02 15 9E 7E D..r......."...~
|
||||
0110 00 14 00 9E FF F6 E8 C8 9F 08 22 FC 8F F3 FF FF ..........".....
|
||||
```
|
||||
|
||||
Split up into chunks:
|
||||
|
||||
```
|
||||
0f 00 0002 0007 00 7544b3c5 90183747 74c6b246 0098
|
||||
|
||||
0500 00 09955f3c000671340281062c090900001d007f5e0e22c6ddf52247cce2b64655163b8c8e0b4a272f44e7afc745ef913546000000000000
|
||||
0000 00 08155f8300035186005100e9fb08050040007e5700ffff6301000010ff2365f96e1e000000
|
||||
0200 00 00105f00000621e000daf7b1f73a0000c800ff7544b3c59018374774c6b24697f5d70200000000000000000000000000000000000000002c
|
||||
2502 15 9ba419d1c4012d3c47252daf465359899e7745e6531142b96009c4ffff
|
||||
2402 15 9e7f005800b5ff20f1f01904210bd5f5ffff
|
||||
2302 15 9f4a6cd1c44625314792e5b04614cb45d6da5c26aa4e44a2ca72c5cdb4edc3ffff
|
||||
2202 15 9e7e0014009efff6e8c89f0822fc8ff3ffff
|
||||
```
|
||||
|
||||
Log message:
|
||||
|
||||
```
|
||||
Size: 0285 PlyId: 002 NumVals: 007
|
||||
( 0:'net 5'-00) 09955f3c000671340281062c090900001d007f5e0e22c6ddf52247cce2b64655163b8c8e0b4a272f44e7afc745ef913546000000000000
|
||||
( 1:'net 0'-00) 08155f8300035186005100e9fb08050040007e5700ffff6301000010ff2365f96e1e000000
|
||||
( 2:'net 2'-00) 00105f00000621e000daf7b1f73a0000c800ff7544b3c59018374774c6b24697f5d70200000000000000000000000000000000000000002c
|
||||
( 3:'net549'-15) 9ba419d1c4012d3c47252daf465359899e7745e6531142b96009c4ffff
|
||||
( 4:'net548'-15) 9e7f005800b5ff20f1f01904210bd5f5ffff
|
||||
( 5:'net547'-15) 9f4a6cd1c44625314792e5b04614cb45d6da5c26aa4e44a2ca72c5cdb4edc3ffff
|
||||
( 6:'net546'-15) 9e7e0014009efff6e8c89f0822fc8ff3ffff
|
||||
```
|
||||
|
||||
Structure:
|
||||
|
||||
```
|
||||
|
||||
0f00 # Unk
|
||||
0002 # PlayerID
|
||||
0007 # Num Vals
|
||||
00 # Unk
|
||||
7544b3c5 # Pos.X
|
||||
90183747 # Pos.Y
|
||||
74c6b246 # Pos.Z
|
||||
00 # Player Index
|
||||
98 # Rtt
|
||||
0500 00 09955f3c000671340281062c090900001d007f5e0e22c6ddf52247cce2b64655163b8c8e0b4a272f44e7afc745ef913546000000000000
|
||||
0000 00 08155f8300035186005100e9fb08050040007e5700ffff6301000010ff2365f96e1e000000
|
||||
0200 00 00105f00000621e000daf7b1f73a0000c800ff7544b3c59018374774c6b24697f5d70200000000000000000000000000000000000000002c
|
||||
2502 15 9ba419d1c4012d3c47252daf465359899e7745e6531142b96009c4ffff
|
||||
2402 15 9e7f005800b5ff20f1f01904210bd5f5ffff
|
||||
2302 15 9f4a6cd1c44625314792e5b04614cb45d6da5c26aa4e44a2ca72c5cdb4edc3ffff
|
||||
2202 15 9e7e0014009efff6e8c89f0822fc8ff3ffff
|
||||
|
||||
```
|
||||
|
||||
```c
|
||||
#pragma endian big
|
||||
|
||||
struct NetValue {
|
||||
le u16 entity_index;
|
||||
u8 entity_type;
|
||||
char data[?]; // TODO: how is length determined?
|
||||
};
|
||||
|
||||
struct NetData {
|
||||
le u16 unk;
|
||||
u16 player_id;
|
||||
u16 num_vals;
|
||||
u8 unk_2;
|
||||
le float pos[3];
|
||||
u8 player_idx;
|
||||
u8 rtt_ms;
|
||||
NetValue values[num_vals];
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
Packets are split into Data packets (map change, resources, chat message, etc) and entity (position?) updates
|
||||
|
||||
## Packet types
|
||||
|
||||
- 00: MapChange:
|
||||
- str map_name
|
||||
- str game_mode
|
||||
|
||||
- 01: Resource:
|
||||
- u8: unk
|
||||
- u16?: num_resources
|
||||
- [str: resource_name]*num_resources
|
||||
|
||||
- 02: Unknown (Keepalive?)
|
||||
|
||||
- 03: ChatMessage
|
||||
- str: message
|
||||
|
||||
- 04: UsrString:
|
||||
- str: data
|
||||
|
||||
- 05: Player join:
|
||||
- u8: player_id
|
||||
- str: player_name
|
||||
- str: ship_model
|
||||
- u16: max_health
|
||||
- str[4]: engine_models
|
||||
- str: pilot_model
|
||||
- str: loadout
|
||||
- u32: unknown
|
||||
|
||||
- 06: unknown
|
||||
- u8: ent_index
|
||||
|
||||
- 07: unknown (reload?)
|
26
Nodegraph.md
Normal file
26
Nodegraph.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
# AI Nodegraph
|
||||
|
||||
Used for pathfinding using the A*-Algorithm.
|
||||
|
||||
```cpp
|
||||
// n= number of dimension (3 or 2)
|
||||
|
||||
template<size_t n>
|
||||
struct Node {
|
||||
float pos[n];
|
||||
};
|
||||
|
||||
template<size_t n>
|
||||
struct Edge {
|
||||
uint32_t num_edge_nodes;
|
||||
Node<n> nodes[];
|
||||
};
|
||||
|
||||
template<size_t n>
|
||||
struct Graph {
|
||||
uint32_t num_nodes;
|
||||
Node<n> nodes[];
|
||||
uint32_t num_edges;
|
||||
Edge<n> edges[];
|
||||
};
|
||||
```
|
6
Overview.md
Normal file
6
Overview.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Overview
|
||||
|
||||
- Developer Studio: Mercury Steam
|
||||
- Engine: [ScrapEngine](./ScrapEngine.md)
|
||||
- Scripting System: embedded Python 1.5.2 interpreter
|
||||
- Game Data Archive Format: [.packed](./packed.md)
|
92561
PE_metadata.md
Normal file
92561
PE_metadata.md
Normal file
File diff suppressed because it is too large
Load diff
15
Packed.md
Normal file
15
Packed.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Packed
|
||||
|
||||
```cpp
|
||||
struct Header {
|
||||
unsigned char magic[4]; // always BFPK
|
||||
uint32_t version;
|
||||
uint32_t number_of_files;
|
||||
struct File {
|
||||
uint32_t path_length;
|
||||
char path[]; // latin1 encoding
|
||||
uint32_t data_size;
|
||||
uint32_t data_offset; // offset includes header size so it can be used directly in a seek() call
|
||||
} files[];
|
||||
};
|
||||
```
|
1
Python_API.md
Normal file
1
Python_API.md
Normal file
|
@ -0,0 +1 @@
|
|||
# Python API
|
2369
Python_Modules.md
Normal file
2369
Python_Modules.md
Normal file
File diff suppressed because one or more lines are too long
18
SUMMARY.md
Normal file
18
SUMMARY.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Summary
|
||||
|
||||
- [Overview](./Overview.md)
|
||||
- [ScrapEngine](./ScrapEngine.md)
|
||||
- [Engine Variables](./Variables.md)
|
||||
- [Classes](./Classes.md)
|
||||
- [World](./World.md)
|
||||
- [Netplay](Netplay.md)
|
||||
- [Python API](./Python_API.md)
|
||||
- [Modules](./Python_Modules.md)
|
||||
- [File Formats](./File_Formats.md)
|
||||
- [Chunked Formats](./Chunked.md)
|
||||
- [Packed](./Packed.md)
|
||||
- [AI Nodegraph](./Nodegraph.md)
|
||||
- [MultiSpriteTable](MultiSpriteTable.md)
|
||||
- [ScrapHacks](./ScrapHacks.md)
|
||||
- [Appendix](./Appendix.md)
|
||||
- [PE Metadata](./PE_metadata.md)
|
89
ScrapEngine.md
Normal file
89
ScrapEngine.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
# ScrapEngine
|
||||
|
||||
- Based on Mercury Engine
|
||||
- Ingame Scripting Language: Python 1.5.2
|
||||
|
||||
## Launch options
|
||||
|
||||
Checked in `0x00401010`
|
||||
|
||||
- `-console`: open external console window on start
|
||||
- `-inifile`: *unknown* some kind of `.ini` file, seems to be related to `m3d.ini` in `Data.packed`
|
||||
|
||||
Checked in `0x004039b0`
|
||||
|
||||
- `-build`: Rebuild `Data.packed` (needs a `filelist.2Bpack`)
|
||||
- `-dedicated`: start in multiplayer dedicated server mode (needs to be used with `-server`)
|
||||
- `-server`: start in multiplayer server mode
|
||||
- `-<var_name>:<var_value>`: override engine variable (example: `-debug:10`)
|
||||
|
||||
Checked in `0x00401180`
|
||||
|
||||
- `-wideWindow`: start game in widescreen mode
|
||||
|
||||
|
||||
## Files
|
||||
|
||||
- `engine.txt`: Contains engine commands? Lexer/Parser @ `0x6168a0`
|
||||
- Errors get printed to Scene graph debugging console
|
||||
- Command buffer @ `0x8c1b30`
|
||||
- Commands:
|
||||
- `Load`: Load Model?
|
||||
- `AddAnim`: Load Animation data?
|
||||
- `PlayAnim`: Play Animation?
|
||||
- `PivotPos`: ?
|
||||
- `FUNDIR_NODOS`: ?
|
||||
- `EFEC_MALLA`: ?
|
||||
- Values:
|
||||
- `true`
|
||||
- `false`
|
||||
- `engine.log`: Created when `engine.txt` exists
|
||||
|
||||
`engine.txt` containing `Load("Models/Vehicles/Ships/SBoss1/SBoss1.SM3", 1)` results in error `D:\Games\Deep Silver\Scrapland\engine.txt (1): Error: missing a ( character`
|
||||
|
||||
|
||||
## Ingame-Console
|
||||
|
||||
(Ctrl+\^ or right click on window title bar and select "switch console") (Handler @ `0x402190`)
|
||||
|
||||
* `<Code>`: Evaluate Python code
|
||||
* `:<Var>`: Get Game Engine Variable
|
||||
* `:<Var> <Val>`: Set Game Engine Variable
|
||||
* `?`: Show all Game Engine Variables
|
||||
* `?<String>`: Show all Game Engine Variables matching `<String>`
|
||||
* `/<command>`: Run Command defined in `QuickConsole.py`
|
||||
* Expands to `import quickconsole;quickconsole.%s()`
|
||||
* `/<command> <arg>,<arg>`: Run function in `QuickConsole.py` with argument(s)
|
||||
* Expands to `import quickconsole;quickconsole.%s(%s)`
|
||||
|
||||
## External Console
|
||||
|
||||
(Scene graph debugging?) (Handler @ `0x5f9520`)
|
||||
|
||||
* `listar luces` List lights in scene
|
||||
* `listar` list models in scene
|
||||
* `arbol <model_name>` show details for model
|
||||
* `mem` (doesn't do anything?)
|
||||
* `ver uniones`
|
||||
* Easter Eggs:
|
||||
* `imbecil`
|
||||
* `idiota`
|
||||
* `capullo`
|
||||
|
||||
## Window Messages
|
||||
|
||||
**TODO**
|
||||
|
||||
## Other interesting Memory Addresses
|
||||
|
||||
- `0x852914`: D3D8-Device pointer
|
||||
- `0x7FCC00`: number of opened `.packed` files
|
||||
- `0x84cb64`: pointer to console command handler
|
||||
- `0x7fac84`: pointer to C++ callback list structure
|
||||
- `0x80b2cc`: pointer to ActionClassList (???)
|
||||
- `0x807a20`: pointer to SScorer (ingame GUI/Menu/Text system) structure (???)
|
||||
- `0x80a398`: pointer to SoundSystem (???)
|
||||
- `0x8b18f0`: pointer to Models Data (can be dumped using scene graph debugging console)
|
||||
- `0x8b18f4`: pointer to Scenes Data (can be dumped using scene graph debugging console)
|
||||
- `0x8b18f8`: pointer to active Models Data (can be dumped using scene graph debugging console)
|
||||
- for more see `config.yml`
|
1
ScrapHacks.md
Normal file
1
ScrapHacks.md
Normal file
|
@ -0,0 +1 @@
|
|||
# ScrapHacks
|
1512
Variables.md
Normal file
1512
Variables.md
Normal file
File diff suppressed because it is too large
Load diff
86
World.md
Normal file
86
World.md
Normal file
|
@ -0,0 +1,86 @@
|
|||
# World
|
||||
|
||||
## Game World/State Pointer @ `0x7fe944`
|
||||
|
||||
Object size: `0x225c` bytes
|
||||
|
||||
Constructor Address: `0x479870`
|
||||
|
||||
Points to World struct
|
||||
|
||||
|
||||
| Offset | Type | Description |
|
||||
| ------ | ------------------------ | -------------------------------------- |
|
||||
| 0x0000 | `void**` | Virtual Method Table |
|
||||
| 0x0004 | `uint32_t` | Slots in Entity Hashtable |
|
||||
| 0x0008 | `void**` | Pointer to Entity Hashtable |
|
||||
| 0x00B0 | `??` | Pointer to Ground Object (?) |
|
||||
| 0x0288 | `pyEntity*` | UsrEntity_0 |
|
||||
| 0x028C | `pyEntity*` | UsrEntity_1 |
|
||||
| 0x0290 | `pyEntity*` | UsrEntity_2 |
|
||||
| 0x0294 | `pyEntity*` | UsrEntity_3 |
|
||||
| 0x0298 | `uint32_t` | Slots in Model Hashtable |
|
||||
| 0x029C | `void**` | Pointer to Model Hashtable |
|
||||
| 0x02B8 | `uint32_t` | Slots in Entity lists Hashtable |
|
||||
| 0x02BC | `void**` | Pointer to Entity list Hashtable |
|
||||
| 0x0330 | `float[3]` | Time (why 3 times?) |
|
||||
| 0x1C6C | `float` | Alarm level |
|
||||
| 0x1C68 | `float` | Alarm Grow Level |
|
||||
| 0x2158 | `float` | Used in `World_Init` |
|
||||
| 0x2170 | `???` | Used in `World_Init` |
|
||||
| 0x2180 | `float` | Used in `World_Init` |
|
||||
| 0x2188 | `void*` | Used in `World_Init` |
|
||||
| 0x218C | `void*` | Used in `World_Init` |
|
||||
| 0x2190 | `float` | Used in `World_Init` |
|
||||
| 0x2198 | `void*` | Used in `World_Init` |
|
||||
| 0x219C | `void*` | Used in `World_Init` |
|
||||
| 0x21A0 | `void**` | Used in `World_Init` (VTable pointer?) |
|
||||
| 0x21B4 | `void**` | Used in `World_Init` (VTable pointer?) |
|
||||
| 0x21C8 | `???` | Used in `World_Init` |
|
||||
| 0x2204 | `uint32_t` or `uint16_t` | Used in `World_Init` |
|
||||
| 0x2230 | `float` | Used in `World_Init` |
|
||||
| 0x2238 | `???` | Used in `World_Init` |
|
||||
| 0x2254 | `float` | Used in `World_Init` |
|
||||
|
||||
|
||||
## cPyEntity structure
|
||||
|
||||
Offset | Type | Description
|
||||
------ | -------- | --------------------
|
||||
0x0000 | `void**` | Virtual Method Table
|
||||
0x0004 | `char*` | Name
|
||||
0x0008 | `void*` | ???
|
||||
|
||||
|
||||
## Entity Hash Table
|
||||
|
||||
Hash-function used: [PJW](https://en.wikipedia.org/wiki/PJW_hash_function) (Same parameters as the example implementation)
|
||||
|
||||
Entry format:
|
||||
|
||||
```cpp
|
||||
struct HT_Entry {
|
||||
void* data;
|
||||
const char* key;
|
||||
HT_Entry* next;
|
||||
}
|
||||
```
|
||||
|
||||
Data format:
|
||||
|
||||
Offset | Type | Description
|
||||
------ | ------------- | ------------------------
|
||||
0x0 | `void**` | Virtual Method Table (?)
|
||||
0x4 | `const char*` | name as string
|
||||
0x14 | `void*` | pointer to self (why?)
|
||||
0x28 | `float[3]` | Position in Game World
|
||||
|
||||
## EntityList Hash Table
|
||||
|
||||
Attributes:
|
||||
- `Near`
|
||||
- `First`
|
||||
- `Num`
|
||||
- `OnDeath`
|
||||
- `OnDamage`
|
||||
- ...
|
Loading…
Reference in a new issue