Skip to content

cm3d2.dll API

Geoffrey Horsington edited this page Jun 16, 2018 · 25 revisions

Filesystem types

CM3D2.dll recognizes two filesystem types: Windows (0) and Archive (1).

Filesystem structures

Externally, a filesystem is a struct:

struct FileSystem {
    int* internals_ptr;    // Pointer to the internal structure
    int  fs_type;          // Type of the filesystem (0 = windows, 1 = archive)
};

Internal file system

An internal file system consists of the following interfaces: InterfaceFileShare, InterfaceFileSystemAnsi, InterfaceFileSystemWide, InterfaceFileSystemUtf8, InterfaceFileSystem.

Archive internals

Internally, the class of

The archives' internals contains the following values.

The location is in bytes and relative to structure's start address.

Type Location (HEX) Value Notes
Address 0 0x7FFF0F641A10 Pointer to a part of vftable for FileSystemArchive
Address 8 0x7FFF0F6419E8 Pointer to compile-time constant; Value: 0xF8FF FFFF 7000 0000
Address 10 0x7FFF0F641498 Pointer to a part of vftable for FileSystemArchive
Address 18 0x7FFF0F641D88 Pointer to compile-time constant; Value: 0xF8FF FFFF 6000 0000
Address 20 0x7FFF0F641A50 Pointer to a part of vftable for FileSystemArchive
Address 28 0x7FFF0F641C30 Pointer to compile-time constant; Value: 0xF8FF FFFF 5000 0000
Value 30 0x0000ADBA0DF0ADBA Junk?
Value 40 0x0 NULL
Address 48 NULL
Address 50 qword, varies between runs
Value 58 0x0 NULL
Address 60 qword, varies between runs
Value 68 0x0 NULL
Value 70 0x0DF0ADBA00000000 Junk?
Address 78 0x7FFF0F6419D8 Pointer to vftable of FileSystemArchive

Notes

  • Only the 4 top bytes are used fron 8, 18 and 28. Thus essentially they contain values 70, 60 and 50 respectively
  • qword at 0x7FFF26350DE8 contains a running counter (of how many filesystems are initialized?)

FileSystemArchive

Signature:

public class FileSystemArchive: public InterfaceFileSystem;

public class InterfaceFileSystem: public InterfaceFileSystemAnsi, public InterfaceFileSystemWide, public InterfaceFileSystemUtf8;

public class InterfaceFileSystemAnsi: public InterfaceFileShare;
public class InterfaceFileSystemWide: public InterfaceFileShare;
public class InterfaceFileSystemUtf8: public InterfaceFileShare;

public virtual class InterfaceFileShare;

FileSystemArchive has the following functions:

First VFTable

Index Function signature
0
1
2
3
4
5 void SetBaseDirectory(*this, char* path)
6
7
8 void AddFolder(*this, char* path)
9 void AddArchive(*this, char* path)
10 void AddAutoPathForAllFolder(*this)
11
12
13 void AddAutoPath(*this, char* path)
14
15
16
17
18
19
20
21 Pointer to _LocaleUpdate::GetLocaleT()

Second VFTable

Index Function signature
0
1
2

Third VFTable

Index Function signature
0 FileMemory* GetFile(*this, char* file_str)
1 void* CreateList(*this, void* memory, char* path, ListType list_type)
2
3 (NOTE: Is structure; likely a lambda)
4
5
6
7
8 BOOL IsExistentFile(*this, char* path)
9
10

Fourth VFTable (InterfaceFileShare)

Index Function signature
0 bool IsValid(*this)
1
Clone this wiki locally