Test the RGBASM state file output (#1472)

This commit is contained in:
Sylvie
2024-08-19 14:13:27 -04:00
committed by GitHub
parent 57f122a04e
commit 8c96293b11
4 changed files with 91 additions and 2 deletions

View File

@@ -490,12 +490,14 @@ static bool dumpMacros(FILE *file) {
}
void out_WriteState(std::string name, std::vector<StateFeature> const &features) {
// State files may include macro bodies, which may contain arbitrary characters,
// so output as binary to preserve them.
FILE *file;
if (name != "-") {
file = fopen(name.c_str(), "w");
file = fopen(name.c_str(), "wb");
} else {
name = "<stdout>";
file = fdopen(STDOUT_FILENO, "w");
file = fdopen(STDOUT_FILENO, "wb");
}
if (!file)
err("Failed to open state file '%s'", name.c_str());