Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
09acde1
BDSP AutoStory: pick the language and the player's look in the new-ga…
dayfine Nov 9, 2026
3f009a4
BDSP AutoStory: read the language select with a detector
dayfine Nov 9, 2026
f84574a
BDSP AutoStory: language select test reads each screenshot it finds
dayfine Nov 9, 2026
69a7c37
BDSP AutoStory: read the look select with a detector
dayfine Nov 9, 2026
bf12212
Merge branch 'bdsp/autostory-mine-floaroma-wip' into bdsp/autostory-i…
dayfine Nov 10, 2026
742345b
BDSP AutoStory intro picks: code-health fixes and std::string_view mi…
dayfine Nov 10, 2026
4cb09a3
Merge branch 'bdsp/autostory-mine-floaroma-wip' into bdsp/autostory-i…
dayfine Nov 10, 2026
dc6fb75
Merge bdsp/autostory-mine-floaroma-wip into bdsp/autostory-intro-picks
dayfine Nov 11, 2026
302f074
Merge origin/bdsp/autostory-mine-floaroma-wip into bdsp/autostory-int…
dayfine Nov 11, 2026
9a05263
Merge branch 'bdsp/autostory-mine-floaroma-wip' into bdsp/autostory-i…
dayfine Nov 11, 2026
4ff8442
Merge origin/bdsp/autostory-mine-floaroma-wip into bdsp/autostory-int…
dayfine Nov 11, 2026
dc2dc93
Merge remote-tracking branch 'origin/bdsp/autostory-mine-floaroma-wip…
dayfine Nov 11, 2026
222ec38
Merge origin/bdsp/autostory-mine-floaroma-wip into bdsp/autostory-int…
dayfine Nov 12, 2026
006bcb9
Merge origin/bdsp/autostory-mine-floaroma-wip into bdsp/autostory-int…
dayfine Nov 12, 2026
5be1839
Merge origin/bdsp/center-run-settle into bdsp/autostory-intro-picks
dayfine Nov 12, 2026
4c994f3
Merge origin/bdsp/center-run-settle into bdsp/autostory-intro-picks
dayfine Nov 12, 2026
585ae26
Merge origin/bdsp/center-run-settle into bdsp/autostory-intro-picks
dayfine Nov 12, 2026
03a9b31
Merge origin/bdsp/center-run-settle into bdsp/autostory-intro-picks
dayfine Nov 12, 2026
449381f
BDSP AutoStory: an empty or off-frame move name box reads as unread, …
dayfine Nov 13, 2026
1f51d6a
Merge origin/bdsp/center-run-settle into bdsp/autostory-intro-picks
dayfine Nov 13, 2026
7795897
Merge origin/bdsp/autostory-intro-picks (#305) into bdsp/intro-pickers
dayfine Nov 15, 2026
c8ee764
BDSP AutoStory intro: resume on an intro screen, name limit check, ca…
dayfine Nov 15, 2026
5f37c5a
BDSP AutoStory intro capture: record what follows the look
dayfine Nov 15, 2026
5185b39
BDSP AutoStory capture: three-digit frame numbers so up to 121 frames…
dayfine Nov 15, 2026
cde226f
BDSP intro: red tests for taking the intro up past the language pick …
dayfine Nov 15, 2026
c7c5416
BDSP intro: restart past the language pick; let the language select s…
dayfine Nov 15, 2026
5d64b5f
BDSP AutoStory intro: wait on unknown screens between the language an…
dayfine Nov 15, 2026
e384ab4
BDSP AutoStory settings: Options rows per game language
dayfine Nov 15, 2026
a7dcd77
BDSP walker: read big rooms as indoors (edge black 15% -> 8%)
dayfine Nov 15, 2026
82c8d9e
BDSP walker: log each tap's view shift, keep frames of still taps nea…
dayfine Nov 15, 2026
c35250d
BDSP walker: read a step's scroll band by band
dayfine Nov 15, 2026
2d4073e
Merge branch 'bdsp/starter-rng-adopt' into bdsp/intro-pickers
dayfine Nov 15, 2026
640d198
BDSP AutoStory tests: a cutscene before the look pick waits; unreadab…
dayfine Nov 15, 2026
9316744
Merge bdsp/starter-rng-adopt into bdsp/intro-pickers
dayfine Nov 15, 2026
9d8a931
BDSP AutoStory sim: taps that move but read still; 00.01's walk up Tw…
dayfine Nov 15, 2026
06aa51f
BDSP AutoStory 00.01: run north up Twinleaf's exit until Barry's warning
dayfine Nov 15, 2026
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
@@ -0,0 +1,63 @@
/* Menu Cursor
*
* From: https://github.com/PokemonAutomation/
*
*/

#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "NintendoSwitch_MenuCursor.h"

namespace PokemonAutomation{
namespace NintendoSwitch{

using namespace std::chrono_literals;


namespace{

void add_presses(std::vector<DpadPosition>& moves, DpadPosition direction, size_t count){

Check warning on line 18 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: add_presses: output parameter 'std::vector<DpadPosition>& moves' comes before an input; put inputs (by value, const&) first and non-const references last (Google "Function Parameter Ordering")
moves.insert(moves.end(), count, direction);
}
void add_sideways(std::vector<DpadPosition>& moves, size_t from_column, size_t to_column){

Check warning on line 21 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: add_sideways: output parameter 'std::vector<DpadPosition>& moves' comes before an input; put inputs (by value, const&) first and non-const references last (Google "Function Parameter Ordering")
if (to_column > from_column){
add_presses(moves, DPAD_RIGHT, to_column - from_column);
}else{
add_presses(moves, DPAD_LEFT, from_column - to_column);
}
}

} // namespace


std::optional<std::vector<DpadPosition>> menu_cursor_moves(const MenuGrid& grid, size_t from, size_t to){
if (grid.columns == 0 || from >= grid.count || to >= grid.count){
return std::nullopt;
}
const size_t from_row = from / grid.columns;
const size_t from_column = from % grid.columns;
const size_t to_row = to / grid.columns;
const size_t to_column = to % grid.columns;
std::vector<DpadPosition> moves;
if (to_row > from_row){
// The start's row is above the target's, so it is full: sideways first.
add_sideways(moves, from_column, to_column);
add_presses(moves, DPAD_DOWN, to_row - from_row);
}else{
// Up to the target's row first, which is full unless it is the start's.
add_presses(moves, DPAD_UP, from_row - to_row);
add_sideways(moves, from_column, to_column);
}
return moves;
}


void press_cursor_moves(ProControllerContext& context, const std::vector<DpadPosition>& moves){
for (DpadPosition move : moves){
pbf_press_dpad(context, move, 80ms, 320ms);
}
}



} // namespace NintendoSwitch
} // namespace PokemonAutomation
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* Menu Cursor
*
* From: https://github.com/PokemonAutomation/
*
* Moves the cursor of a fixed list or grid (a game's language select, the
* player's look) to an item by its index. The menu's shape is data; the
* presses follow from it; a detector for the menu reads where the cursor is.
*
*/

#ifndef PokemonAutomation_NintendoSwitch_MenuCursor_H
#define PokemonAutomation_NintendoSwitch_MenuCursor_H

#include <cstddef>
#include <optional>
#include <vector>
#include "NintendoSwitch/Controllers/NintendoSwitch_ControllerButtons.h"
#include "NintendoSwitch/Controllers/Procon/NintendoSwitch_ProController.h"

namespace PokemonAutomation{
namespace NintendoSwitch{


// A menu of `count` items in rows of `columns`, numbered left to right, then
// top to bottom; a list has one column. Only the last row may be short.
struct MenuGrid{
size_t columns = 1;
size_t count = 0;
};

// The D-pad presses that take the cursor from item `from` to item `to`.
// None crosses an edge, so they hold whether or not the menu wraps, and
// sideways presses happen on a full row. nullopt when either item is outside
// the grid.
std::optional<std::vector<DpadPosition>> menu_cursor_moves(const MenuGrid& grid, size_t from, size_t to);

// Presses `moves` in order, one D-pad tap each.
void press_cursor_moves(ProControllerContext& context, const std::vector<DpadPosition>& moves);



} // namespace NintendoSwitch
} // namespace PokemonAutomation
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/* Menu Cursor - Tests
*
* From: https://github.com/PokemonAutomation/
*
*/

#include <string>
#include <vector>
#include "Common/Cpp/TestRunners/UnitTest.h"
#include "Common/Cpp/TestRunners/UnitTestDatabase.h"
#include "NintendoSwitch_MenuCursor.h"
#include "NintendoSwitch_MenuCursor_Tests.h"

namespace PokemonAutomation{
namespace NintendoSwitch{

namespace{


std::string describe(const std::vector<DpadPosition>& moves){
std::string out;
for (DpadPosition move : moves){
out += (out.empty() ? "" : " ") + dpad_to_string(move);
}
return out.empty() ? "(none)" : out;
}

struct MovesCase{
std::string_view what;
MenuGrid grid;
size_t from;
size_t to;
std::vector<DpadPosition> expected;
};

UnitTestResult test_cursor_moves(){

Check warning on line 36 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::test_cursor_moves(): function_lines=32 (advisory above 25, limit 50)
const MenuGrid list{1, 9};
const MenuGrid looks{4, 8};
// Seven items in rows of three: the last row holds one.
const MenuGrid ragged{3, 7};
const MovesCase cases[] = {
{"list: stay", list, 1, 1, {}},
{"list: down", list, 1, 2, {DPAD_DOWN}},
{"list: up to the top", list, 1, 0, {DPAD_UP}},
{"list: top to bottom, no wrap", list, 0, 8, std::vector<DpadPosition>(8, DPAD_DOWN)},
{"grid: right on the top row", looks, 0, 2, {DPAD_RIGHT, DPAD_RIGHT}},
{"grid: down a row", looks, 0, 4, {DPAD_DOWN}},
{"grid: sideways, then down", looks, 1, 7, {DPAD_RIGHT, DPAD_RIGHT, DPAD_DOWN}},
{"grid: up, then sideways", looks, 7, 0, {DPAD_UP, DPAD_LEFT, DPAD_LEFT, DPAD_LEFT}},
// The short row has only column 0: sideways happens on the full row above.
{"ragged: into the short row", ragged, 2, 6, {DPAD_LEFT, DPAD_LEFT, DPAD_DOWN, DPAD_DOWN}},
{"ragged: out of the short row", ragged, 6, 5, {DPAD_UP, DPAD_RIGHT, DPAD_RIGHT}},
};
for (const MovesCase& c : cases){
const std::optional<std::vector<DpadPosition>> moves = menu_cursor_moves(c.grid, c.from, c.to);
if (!moves){
return std::string(c.what) + ": no moves.";

Check warning on line 57 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
}
if (*moves != c.expected){
return std::string(c.what) + ": " + describe(*moves) + ", expected " + describe(c.expected) + ".";

Check warning on line 60 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
}
}
if (menu_cursor_moves(looks, 0, 8) || menu_cursor_moves(looks, 8, 0) || menu_cursor_moves(MenuGrid{0, 4}, 0, 1)){
return "An item outside the grid, or a grid with no columns, must give no moves.";
}
return true;
}

// Walks the moves from `from` to `to` on `grid`; what went wrong, or "".
std::string check_walk(const MenuGrid& grid, size_t from, size_t to){
const std::string pair = std::to_string(grid.columns) + "x" + std::to_string(grid.count) +

Check warning on line 71 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
" from " + std::to_string(from) + " to " + std::to_string(to);

Check warning on line 72 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
const std::optional<std::vector<DpadPosition>> moves = menu_cursor_moves(grid, from, to);
if (!moves){
return pair + ": no moves.";

Check warning on line 75 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
}
long row = (long)(from / grid.columns);
long column = (long)(from % grid.columns);
for (DpadPosition move : *moves){
row += move == DPAD_DOWN ? 1 : move == DPAD_UP ? -1 : 0;
column += move == DPAD_RIGHT ? 1 : move == DPAD_LEFT ? -1 : 0;
const long index = row * (long)grid.columns + column;
if (row < 0 || column < 0 || column >= (long)grid.columns || index >= (long)grid.count){
return pair + ": " + describe(*moves) + " leaves the grid.";

Check warning on line 84 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
}
}
if (row * (long)grid.columns + column != (long)to){
return pair + ": " + describe(*moves) + " ends elsewhere.";

Check warning on line 88 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
}
return "";
}

// Every pair of items in a few shapes: the moves land on the target and never
// leave the grid or step on a missing item.
UnitTestResult test_cursor_moves_stay_inside(){
for (const MenuGrid& grid : {MenuGrid{1, 9}, MenuGrid{4, 8}, MenuGrid{3, 7}, MenuGrid{5, 1}}){
for (size_t from = 0; from < grid.count; from++){
for (size_t to = 0; to < grid.count; to++){
const std::string error = check_walk(grid, from, to);
if (!error.empty()){
return error;
}
}
}
}
return true;
}

struct MenuCursorInput{
std::string name;
UnitTestResult (*body)();
};

struct MenuCursorExpectation{
};

struct MenuCursorCase{
MenuCursorInput input;
MenuCursorExpectation expectation;
};

class Test_MenuCursor : public UnitTest{

Check failure on line 122 in SerialPrograms/Source/NintendoSwitch/Programs/MenuCursor/NintendoSwitch_MenuCursor_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health

test-case: construct each UnitTest from one case struct with name, input and expectation fields (input and expectation structs, the name outside the input); register a named table of designated cases in a range-for
public:
explicit Test_MenuCursor(MenuCursorCase test_case)
: UnitTest("NintendoSwitch::MenuCursor - " + test_case.input.name)
, m_case(std::move(test_case))
{}
virtual UnitTestResult run(Logger&, CancellableScope&) const override{
return m_case.input.body();
}

private:
MenuCursorCase m_case;
};

const MenuCursorCase MENU_CURSOR_CASES[] = {
{
.input = {"presses from item to item", test_cursor_moves},
.expectation = {},
},
{
.input = {"presses stay inside the grid", test_cursor_moves_stay_inside},
.expectation = {},
},
};


} // namespace


void add_tests_MenuCursor(UnitTestDatabase& database){
for (const MenuCursorCase& item : MENU_CURSOR_CASES){
database.add<Test_MenuCursor>(item);
}
}



} // namespace NintendoSwitch
} // namespace PokemonAutomation
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* Menu Cursor - Tests
*
* From: https://github.com/PokemonAutomation/
*
*/

#ifndef PokemonAutomation_NintendoSwitch_MenuCursor_Tests_H
#define PokemonAutomation_NintendoSwitch_MenuCursor_Tests_H

#include "Common/Cpp/TestRunners/UnitTestDatabase.h"

namespace PokemonAutomation{
namespace NintendoSwitch{


// The cursor presses for list and grid items. No console.
void add_tests_MenuCursor(UnitTestDatabase& database);



} // namespace NintendoSwitch
} // namespace PokemonAutomation
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <string>
#include <utility>
#include <vector>
#include "CommonFramework/GlobalAutoPaths.h"
#include "CommonFramework/ImageTypes/ImageRGB32.h"
Expand Down Expand Up @@ -42,9 +43,14 @@ const PlayerModelIcons& PLAYER_MODEL_ICONS(){


PlayerModelOption::PlayerModelOption()
: StringSelectOption(
: PlayerModelOption(
"<b>Character model:</b><br>The appearance chosen for the player character. "
"Each one is watched through a different eye template.",
"Each one is watched through a different eye template."
)
{}
PlayerModelOption::PlayerModelOption(std::string label)
: StringSelectOption(
std::move(label),
PLAYER_MODEL_ICONS().database,
LockMode::LOCK_WHILE_RUNNING,
"model-1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define PokemonAutomation_PokemonBDSP_PlayerModelOption_H

#include <stdint.h>
#include <string>
#include "CommonTools/Options/StringSelectOption.h"

namespace PokemonAutomation{
Expand All @@ -22,6 +23,8 @@ const uint8_t BDSP_PLAYER_MODEL_COUNT = 8;
class PlayerModelOption : public StringSelectOption{
public:
PlayerModelOption();
// The same choices, under another label.
explicit PlayerModelOption(std::string label);
uint8_t model_number() const{ return (uint8_t)(index() + 1); }
};

Expand Down
2 changes: 2 additions & 0 deletions SerialPrograms/Source/PokemonBDSP/PokemonBDSP_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "Inference/PokemonBDSP_DialogDetector.h"
#include "Inference/PokemonBDSP_MenuDetector.h"
#include "Programs/AutoStory/Actions/PokemonBDSP_AutoStory_Actions_Tests.h"
#include "Programs/AutoStory/Actions/PokemonBDSP_AutoStory_Settings_Tests.h"
#include "Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_GridSim_Tests.h"
#include "Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_FaultSweep_Tests.h"
#include "Programs/AutoStory/Simulation/PokemonBDSP_AutoStory_SimFailureCases_Tests.h"
Expand Down Expand Up @@ -42,6 +43,7 @@ void add_tests(UnitTestDatabase& database){
add_tests_DialogDetector(database);
add_tests_MenuDetector(database);
add_tests_AutoStory_Actions(database);
add_tests_AutoStory_Settings(database);
add_tests_AutoStory_Launch(database);
add_tests_AutoStory_Maps(database);
add_tests_AutoStory_StoryWorld(database);
Expand Down
Loading
Loading