Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,30 @@ std::set<std::string> read_note_keys(const JsonObject& execution, std::string_vi
return keys;
}

// The file without its "metadata", which the shared reader doesn't take
// (yet): {"phase": testing, verification or reproduction}, how far the
// checkpoint is trusted to save (the engine's save policy reads it).
JsonValue without_metadata(const JsonValue& value, std::string_view source){
JsonObject stripped;
for (const auto& [key, field] : value.to_object_throw(std::string(source))){
if (key != "metadata"){
stripped[key] = field.clone();
continue;
}
const JsonObject& metadata = field.to_object_throw(std::string(source));
for (const auto& [metadata_key, unused] : metadata){
if (metadata_key != "phase"){
throw ParseException(std::format("{}: unsupported metadata field {}", source, metadata_key));
}
}
const std::string& phase = metadata.get_string_throw("phase", std::string(source));
if (phase != "testing" && phase != "verification" && phase != "reproduction"){
throw ParseException(std::format("{}: unknown phase {}", source, phase));
}
}
return JsonValue(std::move(stripped));
}

} // namespace


Expand All @@ -125,7 +149,7 @@ StoryCheckpoint read_story_checkpoint_file(const JsonValue& value, std::string_v
note_keys = read_note_keys(execution, where);
};
static_cast<Pokemon::StoryCheckpoint&>(checkpoint) = Pokemon::read_authored_checkpoint(
value, "frlg", source, read_execution, story_action_specs()
without_metadata(value, source), "frlg", source, read_execution, story_action_specs()
);
for (const std::string& key : note_keys){
bool found = key == "checkpoint";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
* reasons behind a step that a reader of the file needs.
* The program doesn't read them.
*
* Beside "execution", "metadata": {"phase": testing, verification or
* reproduction}: how far the checkpoint is trusted.
*
*/

#ifndef PokemonAutomation_PokemonFRLG_AutoStoryTable_H
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"new_game.c: the bedroom at (6, 6), facing the TV."
]
}
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"SID Helper confirms the name, finishes the intro and reads the Trainer Card from the START menu, without moving the player or saving."
]
}
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
},
"execution": {
"menu": "before_pokemon"
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
"PlayerEnter walks the player up 8 tiles from the lab's door."
]
}
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"Starter RNG starts from a save south of the table, facing the ball."
]
}
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@
"The rival leaves; PlayerWatchRivalExitAfterBattleRight ends facing down."
]
}
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
"ApproachCounter: up 4 from the mat, then faces the clerk."
]
}
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
},
"execution": {
"menu": "full"
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,6 @@
"The gate's north warp lands on the forest's exit mat (29, 62), facing north. The save there keeps a forest failure from going back to Pallet."
]
}
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@
"Out of the forest, wild battles are run from; trainers are still fought."
]
}
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@
"On to Brock unless red HP or a status is left that no item cures."
]
}
}
},
"metadata": {"phase": "testing"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@
"RunningShoesAideTriggerTop: the aide talks from (46, 20), no YES/NO; the player only turns up. He walks off and is removed; FLAG_SYS_B_DASH is set (console B, 2026-11-02: about 20 B presses to the overworld)."
]
}
}
},
"metadata": {"phase": "testing"}
}
Loading