Difference between revisions of "Relocatable chunk"
(Created page with "In GTA Liberty City Stories and Vice City Stories Rockstar Leeds used a reloctable chunk format for all types of data. struct base::sChunkHeader { uint32 ident; uint32...") |
m |
||
(One intermediate revision by one other user not shown) | |||
Line 72: | Line 72: | ||
(local) pointers, vtables and function pointers. These are described elsewhere. | (local) pointers, vtables and function pointers. These are described elsewhere. | ||
− | [[Category: | + | {{N|LCS}} |
− | + | [[Category:File Formats]] | |
[[Category:GTA VCS]] | [[Category:GTA VCS]] |
Latest revision as of 23:35, 11 January 2019
In GTA Liberty City Stories and Vice City Stories Rockstar Leeds used a reloctable chunk format for all types of data.
struct base::sChunkHeader { uint32 ident; uint32 shrink; uint32 fileEnd; uint32 dataEnd; uint32 relocTab; uint32 numRelocs; uint32 globalTab; uint16 numClasses; uint16 numFuncs; };
Where ident is a character constant and shrink is a boolean that coincides with the game's decision to free the relocation tables after loading. It is checked together with the character constant but does otherwise not seem to be used directly for anything. In the following all offsets are from the beginning of the chunk header.
The different file types are:
ident | shrink | description |
WRLD | 0 | level |
GTAG | 1 | resource image/game data |
mdl | 0 | 3d model |
tex | 0 | texture |
anim | 0 | animation |
col2 | 0 | collision |
FileEnd and DataEnd are offsets to the end of file and actual data respectively.
After the data comes a relocation table (at offset relocTab with numRelocs entries) that contains offsets to all pointers in the data. On load those pointers (stored as offsets in the file) are converted to pointers by adding to them the address of the loaded file in memory.
After the relocation table comes a table of class and function fixups (at offset globalTab with numClasses class fixups and numFuncs function fixups). The class values in the file are hashes of their class names and are replaced by pointers to the vtable on load. The function values are indices that are replaced by function pointers. Class fixups are used for the classes stored in game.dtz. Function fixups are used for atomic render callbacks.
The actual contents of the files are then just C(++) structures with relocated (local) pointers, vtables and function pointers. These are described elsewhere.
Grand Theft Auto: Liberty City Stories | |
---|---|
File Formats | .cfg • .chk • .dat • .dtz • .gxt • .ide • .img • .ipl • .mdl • .pss • .scm • .vb |
Documentation | Leeds Engine • Opcodes • Radio Stations • Saves • Scrollbar • Vehicles |
Tools | Sanny Builder |
Useful Links | Community Portal • Discussion Forum • Modding Topic • Mobile Modding |