Line 1: |
Line 1: |
| This page details the technical '''inner workings of ManiaPlanet''' (and the original TrackMania). It describes the game's classes, data structures and functions, and is as such geared towards reverse engineers and programmers. | | This page details the technical '''inner workings of ManiaPlanet''' (and the original TrackMania). It describes the game's classes, data structures and functions, and is as such geared towards reverse engineers and programmers. |
| + | |
| + | == Basic data types == |
| + | Nadeo uses its own primitive data types in its game engine. Since they can't be reversed, they are not used on this page and are listed here only for the sake of completeness. |
| + | |
| + | typedef int Integer; |
| + | typedef unsigned int Bool; |
| + | typedef unsigned char Nat8; |
| + | typedef unsigned short Nat16; |
| + | typedef unsigned int Natural, Nat32; |
| + | typedef unsigned __int64 Nat64; |
| + | typedef float Real, Real32; |
| | | |
| == Basic data structures == | | == Basic data structures == |
Line 679: |
Line 690: |
| class CSystemFid : public CMwNod // Base class for files | | class CSystemFid : public CMwNod // Base class for files |
| { | | { |
| + | public: |
| + | int ArchiveHeaderUserData(CClassicArchive *); // Reads or writes header user data |
| + | void BuildHeaderUserData(CSystemArchiveNod const &); // Prepares the header chunk data for writing |
| + | |
| + | private: |
| + | int HeaderUserDataCreateFromArchive(CClassicArchive *, unsigned long size); // Reads the header chunk data |
| + | |
| private: | | private: |
| int unknown0; | | int unknown0; |
Line 923: |
Line 941: |
| | | |
| void ReadData(void *, unsigned long); | | void ReadData(void *, unsigned long); |
− | void ReadBool(int *, unsigned long); | + | void ReadBool(bool *, unsigned long); |
| void ReadMask(unsigned long *, unsigned long); | | void ReadMask(unsigned long *, unsigned long); |
| void ReadNat8(unsigned char *, unsigned long, int); | | void ReadNat8(unsigned char *, unsigned long, int); |
Line 936: |
Line 954: |
| | | |
| void WriteData(void const *, unsigned long); | | void WriteData(void const *, unsigned long); |
− | void WriteBool(int const *, unsigned long); | + | void WriteBool(bool const *, unsigned long); |
| void WriteMask(unsigned long const *, unsigned long); | | void WriteMask(unsigned long const *, unsigned long); |
| void WriteNat8(unsigned char const *, unsigned long, int); | | void WriteNat8(unsigned char const *, unsigned long, int); |
Line 950: |
Line 968: |
| void DoMarker(char const *); // Reads or writes markup, like <Thumbnail.jpg> or </Thumbnail.jpg> | | void DoMarker(char const *); // Reads or writes markup, like <Thumbnail.jpg> or </Thumbnail.jpg> |
| void DoData(void *, unsigned long count); // Reads or writes the specified number of bytes | | void DoData(void *, unsigned long count); // Reads or writes the specified number of bytes |
− | void DoBool(int *, unsigned long count); // Reads or writes a truth value | + | void DoBool(bool *, unsigned long count); // Reads or writes a truth value |
| void DoMask(unsigned long *, unsigned long count); // Reads or writes a hex value (typically a class ID) | | void DoMask(unsigned long *, unsigned long count); // Reads or writes a hex value (typically a class ID) |
| void DoNat8(unsigned char *, unsigned long count, int isHex); | | void DoNat8(unsigned char *, unsigned long count, int isHex); |
Line 1,005: |
Line 1,023: |
| int LoadCurrentHeader(enum EVersion); // Reads the file header of a .gbx file | | int LoadCurrentHeader(enum EVersion); // Reads the file header of a .gbx file |
| int DoLoadHeader(void); // Reads the magic 'GBX' and version of a .gbx file, and then calls LoadCurrentHeader() | | int DoLoadHeader(void); // Reads the magic 'GBX' and version of a .gbx file, and then calls LoadCurrentHeader() |
− | int DoSaveHeader(void); | + | int DoSaveHeader(void); // Writes the header of a .gbx file |
| int DoLoadRef(void); // Reads the reference table of a .gbx file | | int DoLoadRef(void); // Reads the reference table of a .gbx file |
− | int DoSaveRef(void); | + | int DoSaveRef(void); // Writes the reference table of a .gbx file |
| int DoLoadAllRef(void); // Reads the header and the reference table of a .gbx file | | int DoLoadAllRef(void); // Reads the header and the reference table of a .gbx file |
| int DoLoadBody(CMwNod * &); // Reads the body of a .gbx file | | int DoLoadBody(CMwNod * &); // Reads the body of a .gbx file |
− | int DoSaveBody(void); | + | int DoSaveBody(void); // Writes the body of a .gbx file |
| + | int DoLoadAll(CMwNod * &); // Reads the header, the reference table and the body of a .gbx file |
| + | int DoSaveAll(void); // Writes the header, the reference table and the body of a .gbx file |
| int DoSaveBodyMemory(CMwNod *); | | int DoSaveBodyMemory(CMwNod *); |
− | int DoLoadAll(CMwNod * &); // Reads the header, the reference table and the body of a .gbx file
| |
− | int DoSaveAll(void);
| |
| int DoSave(CMwNod *, unsigned long, enum EArchive, int); | | int DoSave(CMwNod *, unsigned long, enum EArchive, int); |
| int DoLoadResource(unsigned long, CMwNod * &); | | int DoLoadResource(unsigned long, CMwNod * &); |
Line 1,049: |
Line 1,067: |
| private: | | private: |
| void ParametrizedFinalization(CMwNod *); | | void ParametrizedFinalization(CMwNod *); |
− | void ParametrizedFindOrAddFid(CSystemFid *, CMwNod *); | + | void ParametrizedFindOrAddFid(CSystemFid *, CMwNod *); |
| | | |
| private: | | private: |