forked from ReScrap/ScrapHacks
		
	Update notes
This commit is contained in:
		
							parent
							
								
									7afdfb5869
								
							
						
					
					
						commit
						88737f29e4
					
				
					 14 changed files with 94675 additions and 70 deletions
				
			
		|  | @ -4,22 +4,14 @@ language = "en" | |||
| multilingual = false | ||||
| src = "src" | ||||
| title = "Scrapland Reverse Engineering Notes" | ||||
| [output.linkcheck] | ||||
| 
 | ||||
| [output.html] | ||||
| preferred-dark-theme = "ayu" | ||||
| preferred-dark-theme = "rust" | ||||
| mathjax-support = true | ||||
| additional-js = ["mermaid.min.js", "mermaid-init.js"] | ||||
| site-url = "https://earthnuker.keybase.pub/ScrapHacks/" | ||||
| 
 | ||||
| # [preprocessor.graphviz] | ||||
| # command = "mdbook-graphviz" | ||||
| 
 | ||||
| [preprocessor.svgbob] | ||||
| text_width = 8.0 | ||||
| text_height = 16.0 | ||||
| class = "bob" | ||||
| font_family = "arial" | ||||
| font_size = 14.0 | ||||
| stroke_width = 2.0 | ||||
| # there's using css-variables from theme: | ||||
| stroke_color = "var(--fg)" # see default theme / variables.css | ||||
| background_color = "transparent" # also useful `var(--bg)` | ||||
| # all properties are optional. | ||||
| [preprocessor.mermaid] | ||||
| command = "mdbook-mermaid" | ||||
|  |  | |||
							
								
								
									
										3
									
								
								notes/mermaid-init.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								notes/mermaid-init.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| mermaid.initialize({ | ||||
|     startOnLoad:true, | ||||
| }); | ||||
							
								
								
									
										32
									
								
								notes/mermaid.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								notes/mermaid.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								notes/src/Appendix.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								notes/src/Appendix.md
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| # Appendix | ||||
							
								
								
									
										130
									
								
								notes/src/Classes.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										130
									
								
								notes/src/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 | ||||
|  | @ -1 +0,0 @@ | |||
| # Entities | ||||
							
								
								
									
										17
									
								
								notes/src/MultiSpriteTable.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								notes/src/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]; | ||||
| } | ||||
| ``` | ||||
|  | @ -1 +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
									
								
								notes/src/PE_metadata.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										92561
									
								
								notes/src/PE_metadata.md
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -3,9 +3,9 @@ | |||
| ## SScorer | ||||
| 
 | ||||
| - *SetCursor*: `<built-in function SetCursor>` | ||||
| ``` | ||||
| 
 | ||||
| SetCursor(playernumber,CursorName) : pone un item del scorer como cursor | ||||
| ``` | ||||
| 
 | ||||
| - *Show*: `<built-in function Show>` | ||||
| ``` | ||||
| Show(playernumber) : Activa el scorer. | ||||
|  | @ -2,12 +2,17 @@ | |||
| 
 | ||||
| - [Overview](./Overview.md) | ||||
| - [ScrapEngine](./ScrapEngine.md) | ||||
|     - [World](./World.md) | ||||
|     - [Entities](./Entities.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) | ||||
| - [ScrapHacks](./ScrapHacks.md) | ||||
|       - [MultiSpriteTable](MultiSpriteTable.md) | ||||
| - [ScrapHacks](./ScrapHacks.md) | ||||
| - [Appendix](./Appendix.md) | ||||
|   - [PE Metadata](./PE_metadata.md) | ||||
|  | @ -1,15 +1,45 @@ | |||
| # ScrapEngine | ||||
| 
 | ||||
| - Based on Mercury Engine | ||||
| - Ingame Scripting Language: Python 1.5.2 | ||||
| - Interesting memory locations and functions are noted in `config.yml` | ||||
| 
 | ||||
| ## Launch options | ||||
| 
 | ||||
| Checked in `0x00401010` | ||||
| 
 | ||||
| - `-console`: open external console window on start | ||||
| - `-wideWindow`: start game in widescreen mode | ||||
| - `-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 | ||||
| - `-build`: Rebuild `Data.packed` (needs a `filelist.2Bpack`) | ||||
| 
 | ||||
| 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 | ||||
| 
 | ||||
|  | @ -21,9 +51,9 @@ | |||
| * `?`: Show all Game Engine Variables | ||||
| * `?<String>`: Show all Game Engine Variables matching `<String>` | ||||
| * `/<command>`: Run Command defined in `QuickConsole.py` | ||||
|   * `import quickconsole;quickconsole.%s()` | ||||
|   * Expands to `import quickconsole;quickconsole.%s()` | ||||
| * `/<command> <arg>,<arg>`: Run function in `QuickConsole.py` with argument(s) | ||||
|   * `import quickconsole;quickconsole.%s(%s)` | ||||
|   * Expands to `import quickconsole;quickconsole.%s(%s)` | ||||
| 
 | ||||
| ## External Console | ||||
| 
 | ||||
|  | @ -31,7 +61,7 @@ | |||
| 
 | ||||
| * `listar luces` List lights in scene | ||||
| * `listar` list models in scene | ||||
| * `arbol <model_name>` show details for model  | ||||
| * `arbol <model_name>` show details for model | ||||
| * `mem` (doesn't do anything?) | ||||
| * `ver uniones`  | ||||
| * Easter Eggs: | ||||
|  | @ -52,3 +82,4 @@ | |||
| - `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` | ||||
|  |  | |||
							
								
								
									
										1823
									
								
								notes/src/Variables.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1823
									
								
								notes/src/Variables.md
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -2,48 +2,54 @@ | |||
| 
 | ||||
| ## 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`                    | ||||
|   | ||||
| 
 | ||||
| | 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*`  | ???                   | ||||
| Offset |   Type   |     Description | ||||
| ------ | -------- | -------------------- | ||||
| 0x0000 | `void**` | Virtual Method Table | ||||
| 0x0004 | `char*`  | Name | ||||
| 0x0008 | `void*`  | ??? | ||||
| 
 | ||||
| 
 | ||||
| ## Entity Hash Table | ||||
|  | @ -62,12 +68,12 @@ struct HT_Entry { | |||
| 
 | ||||
| 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    | ||||
| 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 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue