13 int is_enabled; // 0/1, If command is enabled.
15 char executable[260]; // Name of EXE to run.
16 char args[260]; // Arguments for executable.
17 int is_long_filename; // Obsolete, but always set to true. Disables MS-DOS 8-char filenames.
18 int ensure_check; // Ensure file post-exists after compilation
19 char ensure_file[260]; // File to check exists.
20 int use_proc_win; // Use Process Window (ignored if exectuable = $game_exe).
23 int no_wait; // Wait for keypress when done compiling.
28 char name[128]{ '\0' };
29 uint32_t command_count; // Number of commands
35 std::vector<Command> commands;
36 bool write_enable = true;
40 char signature[31] = { 'W','o','r','l','d','c','r','a','f','t',' ','C','o','m','m','a','n','d',' ','S','e','q','u','e','n','c','e','s','\r','\n','\x1a' }; // Yikes.
50 std::vector<Sequence> sequences;
52 filedata(std::string path)
54 std::ifstream reader(path, std::ios::in | std::ios::binary);
57 throw std::exception("WC::LOAD Failed"); return;
60 Header header = Header();
61 reader.read((char*)&header, sizeof(header));
63 for (int i = 0; i < header.seq_count; i++)
65 Sequence sequence = Sequence();
66 reader.read((char*)&sequence.name, 128);
68 uint32_t command_count;
69 reader.read((char*)&command_count, sizeof(uint32_t));
71 if (command_count > 1024) {
72 throw std::exception("Too many commands!!!");
75 for (int cc = 0; cc < command_count; cc++)
77 Command command = Command();
79 reader.read((char*)&command, sizeof(Command));
81 sequence.commands.push_back(command);
84 this->sequences.push_back(sequence);
90 void serialize(std::string path)
92 std::fstream writer(path, std::ios::out | std::ios::binary);
95 Header header = Header();
97 int count = sequences.size();
98 for (auto && seq : this->sequences) if (!seq.write_enable) count--;
100 header.seq_count = count;
101 writer.write((char*)&header, sizeof(header));
104 for (auto && sequence : this->sequences){
106 if (!sequence.write_enable) continue;
108 writer.write((char*)&sequence.name, 128);
109 uint32_t cmdCount = sequence.commands.size();
111 writer.write((char*)&cmdCount, sizeof(uint32_t));
113 for (auto && command : sequence.commands)
115 writer.write((char*)&command, sizeof(command));