RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
w3w4.h
1#ifndef W3EXE_H
2#define W3EXE_H
3
4#include <array>
5#include "leexe.h"
6#include "../common.h"
7#include "../dumper/dumper.h"
8#include "../linker/reader.h"
9#include "../linker/segment_manager.h"
10#include "../linker/writer.h"
11
12/* TODO: unimplemented */
13
14namespace Microsoft
15{
19 class W3Format : public virtual Linker::OutputFormat
20 {
21 public:
22 class Entry
23 {
24 public:
25 std::string filename;
26 uint32_t file_offset;
27 uint32_t header_size;
28 std::shared_ptr<LEFormat> contents;
29 };
30
31 offset_t file_offset;
32 struct version
33 {
34 uint8_t major, minor;
35 };
36 version system_version;
37 std::vector<Entry> entries;
38 uint32_t file_end;
39
40// void Clear() override;
41// void CalculateValues() override;
42 void ReadFile(Linker::Reader& rd) override;
44 offset_t WriteFile(Linker::Writer& wr) const override;
45 void Dump(Dumper::Dumper& dump) const override;
46 /* TODO */
47
48// using Linker::OutputFormat::GetDefaultExtension;
49// std::string GetDefaultExtension(Linker::Module& module, std::string filename) override;
50 };
51
55 class W4Format : public virtual Linker::OutputFormat
56 {
57 public:
58 // as documented in https://github.com/JHRobotics/patcher9x/blob/main/doc/VXDLIB_UTF8.txt
59
60 class Chunk
61 {
62 public:
63 uint32_t file_offset = 0;
64 uint32_t length = 0;
65 std::shared_ptr<Linker::Buffer> contents = nullptr;
66 };
67
68 offset_t file_offset;
69 struct version
70 {
71 uint8_t major, minor;
72 };
73 version system_version;
74 uint16_t chunk_size;
75 std::vector<Chunk> chunks;
76 uint32_t file_end;
77 W3Format w3format;
78
79 std::shared_ptr<Linker::Buffer> DecompressW4();
80
81// void Clear() override;
82// void CalculateValues() override;
83 void ReadFile(Linker::Reader& rd) override;
85 offset_t WriteFile(Linker::Writer& wr) const override;
86 void Dump(Dumper::Dumper& dump) const override;
87 /* TODO */
88
89// using Linker::OutputFormat::GetDefaultExtension;
90// std::string GetDefaultExtension(Linker::Module& module, std::string filename) override;
91 };
92}
93
94#endif /* W3EXE_H */
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:662
offset_t WriteFile(Writer &wr) const override=0
Stores data in memory to file.
A class that provides a general interface to setting up generation for a format.
Definition format.h:64
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:20
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15
Definition w3w4.h:23
WIN386.EXE (TODO: not implemented)
Definition w3w4.h:20
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition w3w4.cc:36
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition w3w4.cc:8
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition w3w4.cc:56
Definition w3w4.h:61
WMM32.VXD (TODO: not implemented)
Definition w3w4.h:56
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition w3w4.cc:353
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition w3w4.cc:290
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition w3w4.cc:333
Definition w3w4.h:33
Definition w3w4.h:70