yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
test_helpers_commands.h
Go to the documentation of this file.
1
12#ifndef YAZE_SRC_CLI_HANDLERS_TOOLS_TEST_HELPERS_COMMANDS_H_
13#define YAZE_SRC_CLI_HANDLERS_TOOLS_TEST_HELPERS_COMMANDS_H_
14
15#include <fstream>
16#include <iomanip>
17#include <sstream>
18#include <string>
19#include <vector>
20
21#include "absl/status/status.h"
22#include "app/emu/snes.h"
23#include "rom/rom.h"
27
28namespace yaze {
29namespace cli {
30namespace handlers {
31
39 public:
40 std::string GetName() const override { return "tools-harness-state"; }
41 std::string GetDescription() const {
42 return "Generate WRAM state for test harnesses by running emulator to "
43 "game loop";
44 }
45 std::string GetUsage() const override {
46 return "tools-harness-state --rom=<path> --output=<path>";
47 }
48
49 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
50 return parser.RequireArgs({"rom", "output"});
51 }
52
53 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
54 resources::OutputFormatter& formatter) override;
55
56 private:
57 absl::Status GenerateHarnessState(const std::string& rom_path,
58 const std::string& output_path);
59};
60
68 public:
69 std::string GetName() const override { return "tools-extract-values"; }
70 std::string GetDescription() const {
71 return "Extract vanilla ROM values for test reference";
72 }
73 std::string GetUsage() const override {
74 return "tools-extract-values --rom=<path> [--format=<json|cpp>]";
75 }
76
77 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
78 return parser.RequireArgs({"rom"});
79 }
80
81 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
82 resources::OutputFormatter& formatter) override;
83};
84
92 public:
93 std::string GetName() const override { return "tools-extract-golden"; }
94 std::string GetDescription() const {
95 return "Extract comprehensive golden data from ROM for E2E testing";
96 }
97 std::string GetUsage() const override {
98 return "tools-extract-golden --rom=<path> --output=<path>";
99 }
100
101 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
102 return parser.RequireArgs({"rom", "output"});
103 }
104
105 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
106 resources::OutputFormatter& formatter) override;
107
108 private:
109 void WriteHeader(std::ofstream& out, const std::string& rom_path);
110 void WriteBasicROMInfo(std::ofstream& out, Rom& rom);
111 void WriteASMVersionInfo(std::ofstream& out, Rom& rom);
112 void WriteOverworldMapsData(std::ofstream& out,
113 zelda3::Overworld& overworld);
114 void WriteTileData(std::ofstream& out, zelda3::Overworld& overworld);
115 void WriteEntranceData(std::ofstream& out, zelda3::Overworld& overworld);
116 void WriteFooter(std::ofstream& out);
117};
118
126 public:
127 std::string GetName() const override { return "tools-patch-v3"; }
128 std::string GetDescription() const {
129 return "Create v3 ZSCustomOverworld patched ROM for testing";
130 }
131 std::string GetUsage() const override {
132 return "tools-patch-v3 --rom=<input> --output=<output>";
133 }
134
135 absl::Status ValidateArgs(const resources::ArgumentParser& parser) override {
136 return parser.RequireArgs({"rom", "output"});
137 }
138
139 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
140 resources::OutputFormatter& formatter) override;
141
142 private:
143 absl::Status ApplyV3Patch(Rom& rom);
144};
145
152 public:
153 std::string GetName() const override { return "tools-list"; }
154 std::string GetDescription() const {
155 return "List available test helper tools";
156 }
157 std::string GetUsage() const override { return "tools-list"; }
158
159 absl::Status ValidateArgs(
160 const resources::ArgumentParser& /*parser*/) override {
161 return absl::OkStatus();
162 }
163
164 absl::Status Execute(Rom* rom, const resources::ArgumentParser& parser,
165 resources::OutputFormatter& formatter) override;
166
167 bool RequiresRom() const override { return false; }
168};
169
170} // namespace handlers
171} // namespace cli
172} // namespace yaze
173
174#endif // YAZE_SRC_CLI_HANDLERS_TOOLS_TEST_HELPERS_COMMANDS_H_
175
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
Extract comprehensive golden data from ROM.
void WriteOverworldMapsData(std::ofstream &out, zelda3::Overworld &overworld)
std::string GetUsage() const override
Get the command usage string.
void WriteTileData(std::ofstream &out, zelda3::Overworld &overworld)
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
void WriteHeader(std::ofstream &out, const std::string &rom_path)
std::string GetName() const override
Get the command name.
void WriteEntranceData(std::ofstream &out, zelda3::Overworld &overworld)
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
std::string GetUsage() const override
Get the command usage string.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetName() const override
Get the command name.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
absl::Status GenerateHarnessState(const std::string &rom_path, const std::string &output_path)
std::string GetUsage() const override
Get the command usage string.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
std::string GetName() const override
Get the command name.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
bool RequiresRom() const override
Check if the command requires a loaded ROM.
absl::Status ValidateArgs(const resources::ArgumentParser &) override
Validate command arguments.
std::string GetName() const override
Get the command name.
std::string GetUsage() const override
Get the command usage string.
Create v3 ZSCustomOverworld patched ROM.
std::string GetUsage() const override
Get the command usage string.
std::string GetName() const override
Get the command name.
absl::Status Execute(Rom *rom, const resources::ArgumentParser &parser, resources::OutputFormatter &formatter) override
Execute the command business logic.
absl::Status ValidateArgs(const resources::ArgumentParser &parser) override
Validate command arguments.
Utility for parsing common CLI argument patterns.
absl::Status RequireArgs(const std::vector< std::string > &required) const
Validate that required arguments are present.
Base class for CLI command handlers.
Utility for consistent output formatting across commands.
Represents the full Overworld data, light and dark world.
Definition overworld.h:217