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
12namespace Microsoft
13{
17 class W3Format : public virtual Linker::OutputFormat
18 {
19 public:
20 class Entry
21 {
22 public:
23 std::string filename;
24 uint32_t file_offset;
25 uint32_t header_size;
26 std::shared_ptr<LEFormat> contents;
27 };
28
29 offset_t file_offset;
30 struct version
31 {
32 uint8_t major, minor;
33 };
34 version system_version;
35 std::vector<Entry> entries;
36 uint32_t file_end;
37
38// void Clear() override;
39// void CalculateValues() override;
40 void ReadFile(const std::shared_ptr<Linker::Reader>& rd) override;
42 offset_t WriteFile(const std::shared_ptr<Linker::Writer>& wr) const override;
43 void Dump(Dumper::Dumper& dump) const override;
44 /* TODO */
45
46// using Linker::OutputFormat::GetDefaultExtension;
47// std::string GetDefaultExtension(Linker::Module& module, std::string filename) override;
48 };
49
53 class W4Format : public virtual Linker::OutputFormat
54 {
55 public:
56 // as documented in https://github.com/JHRobotics/patcher9x/blob/main/doc/VXDLIB_UTF8.txt
57
58 // TODO: VxD resources and non-resident name tables are not parsed correctly
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(const std::shared_ptr<Linker::Reader>& rd) override;
85 offset_t WriteFile(const std::shared_ptr<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:1009
offset_t WriteFile(const std::shared_ptr< 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:69
Definition w3w4.h:21
WIN386.EXE.
Definition w3w4.h:18
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition w3w4.cc:10
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition w3w4.cc:39
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition w3w4.cc:59
Definition w3w4.h:61
WMM32.VXD.
Definition w3w4.h:54
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition w3w4.cc:295
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition w3w4.cc:339
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition w3w4.cc:359
Definition w3w4.h:31
Definition w3w4.h:70