Repository navigation
Conversation
5e9ebb5 to
760a5e1
Compare
13d4322 to
707b17e
Compare
| #include "CommonFramework/Options/LabelCellOption.h" | ||
| #include "CommonTools/Options/LanguageOCROption.h" | ||
| #include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h" | ||
| #include "PokemonFRLG_RngProgram.h" |
There was a problem hiding this comment.
This is in the wrong place
There was a problem hiding this comment.
should PokemonFRLG_RngProgram not be sorted?
There was a problem hiding this comment.
Moved: PokemonFRLG_RngProgram.h now sits with the other same-folder includes at the end, in alphabetical order among them, in all seven program headers (9f36e0d).
| using namespace Pokemon; | ||
|
|
||
| void check_party_has_free_slot(ConsoleHandle& console, ProControllerContext& context, StartMenuContext menu_context){ | ||
| console.log("Checking for a free party slot..."); |
There was a problem hiding this comment.
why is not just in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RngProgram.cpp?
There was a problem hiding this comment.
Agreed, nothing else uses it. It's now a private helper in PokemonFRLG_RngProgram.cpp, and RngNavigation is back to upstream's version (9f36e0d).
Static, Wild, Gift and Roaming RNG read the Pokemon they catch or receive from the end of the party. With a full party it goes to the PC instead, every attempt reads the wrong Pokemon, and after a few resets the program stops with "The target Seed is missing from the list of nearby seeds", which points at the wrong setting. SingleSwitchProgramInstance gets start_program_game_checks(), a no-op hook called with the controller ready just before program(), for checking that the game is set up the way a program needs. The FRLG RNG programs now derive from RngProgramInstance, which implements it from a required party_requirement() (and start_menu_context() for the Safari Zone): with FREE_SLOT it opens the party and stops with a setup error naming the real problem, or skips the check if the party menu can't be opened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…clude The free-slot check is only used by RngProgramInstance, so it lives in PokemonFRLG_RngProgram.cpp instead of RngNavigation. The base class's header joins the other same-folder includes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
707b17e to
9f36e0d
Compare
|
LGTM |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Take the party check's game steps through a small PartyCheckActions interface, so check_party_requirement() runs against scripted steps in tests, and read the last occupied party slot from an image, so it runs on the party menu screenshots already in CommandLineTests. Behavior is unchanged. Tests: PokemonFRLG::RngPartyCheck (no requirement, free slot, full party, menu not opened) and PokemonFRLG::LastOccupiedPartySlot (Party_1..6 and the held-item/JPN/SPA party screenshots). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
|
Added unit tests in bdbeb41 (new commit on top; behavior unchanged). The check now takes its two game steps (open the party menu, read the last occupied slot) through a small |
|
well I was thinking whether we can actually check the program actually perform the party check, with the right setttings -- maybe harder / impossible? |
Build each FRLG RNG program, load its settings from JSON, and check the party requirement and start menu its start check uses (WildRng on Route 1 and in the Safari Zone). Make RngProgramInstance's start hook final, so no RNG program can skip the check by overriding it. Behavior is unchanged. Tests: PokemonFRLG::RngProgramPartyRequirement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The party screenshot test expected three; the existing empty-slot tests for the same image mark slots 5 and 6 empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Mostly, yes. fda0033 adds What isn't unit tested: that 85c066e fixes my expected count for |
| const RngProgramPartyScenario scenarios[] = { | ||
| {.name = "RngHelper", .make_program = make_rng_program<RngHelper>, .expected_requirement = NONE}, | ||
| {.name = "StarterRng", .make_program = make_rng_program<StarterRng>, .expected_requirement = NONE}, | ||
| {.name = "EggRng", .make_program = make_rng_program<EggRng>, .expected_requirement = NONE}, |
There was a problem hiding this comment.
actually this need 3 open slots: https://pokemonautomation.github.io/Programs/PokemonFRLG/EggRng.html#in-game-instructions
EggRng needs three free slots (the egg and the two wild Pokemon it catches to confirm the seed), and what RngHelper needs depends on its target: gifts, prizes, Togepi and the daycare egg pickup read the received Pokemon from the party, while encounters are only watched. So programs now say how many free slots they need instead of whether they need one, and RngHelper derives it from its Target setting. Tests: PokemonFRLG::RngPartyCheck adds three-slot cases; PokemonFRLG::RngProgramPartyRequirement covers EggRng and RngHelper targets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E # Conflicts: # SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp
….cpp at its size origin/main grew the file to its code-health allowance (1656 lines over the 1000-line limit); the image overload this PR adds needs three lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
# Conflicts: # SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp
Fix the stale function name in the PartyCheckActions comment, name the party size, word the one-slot message for gifts too, sort the new Navigation.h include, and take the test image path as string_view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Table-driven input/expectation cases for the party check tests, a comment on each RNG program class and the new overload, and closing namespace comments in the new files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
| return "Your party is full. Leave a party slot free so the program can check the " | ||
| + Pokemon::STRING_POKEMON + " it catches or receives."; | ||
| } | ||
| return "Your party has " + std::to_string(party_size) + " " + Pokemon::STRING_POKEMON |
There was a problem hiding this comment.
Now std::format for both messages (8490e0c); the text is unchanged, so the tests still match. I left out the raw string: the messages have no quotes or backslashes, so R"(...)" would read the same.
| PA_ADD_OPTION(NOTIFICATIONS); | ||
| } | ||
|
|
||
| size_t RngHelper::free_party_slots_needed() const{ |
There was a problem hiding this comment.
do we need this? I hope not?
There was a problem hiding this comment.
It's there because RngHelper is the one program whose target is a setting, and only some targets read the received Pokemon from the end of the party (check_for_shiny() → shiny_check_summary()). Options to drop the switch: (a) always ask for 1 free slot except for starters (wild/static users would need a free slot they don't strictly need), (b) no check in RngHelper (return 0; it's the manual tool), (c) one shared shiny_check_reads_party(target) next to check_for_shiny() so the list lives in one place (touches RngNavigation again). Which do you prefer?
There was a problem hiding this comment.
Went with (b): RngHelper returns 0 with a one-line comment, the per-target switch is gone, and RngHelper.cpp is back to upstream's version. The party tests keep one RngHelper case (expects 0). (a48b54d)
…g needs no slot Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
|
Upstream: PokemonAutomation#1881 (branch |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The documentation pages of the RNG programs document the number of free party slots needed. Programs might fail after catching / receiving when there is no free slot, as the pokemon got sent to box.
This PR actually checks for those requirements at program startup, by introducing a general pre-startup hook for programs.
Testing
On a lab Switch with a full party (when catching Mewtwo), Static RNG on this build stopped with that message 5 seconds after starting, before any of its own setup; before, it ran five resets (about 30 minutes) and stopped with the seed error.