Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
de27314
BDSP maps: the story's maps as JSON, generated from the Diamond decomp
dayfine Nov 1, 2026
3a67d56
BDSP maps: load the built-in maps, with their points and regions, and…
dayfine Nov 1, 2026
796dd56
BDSP maps: the five interiors of 00.01 to 00.03
dayfine Nov 1, 2026
e7ead80
BDSP maps: Route 202's training and exit areas as regions
dayfine Nov 1, 2026
45a2eaf
BDSP maps: the loader takes names as string_view
dayfine Nov 1, 2026
7c21897
Merge nav/story-steps (e67d36ccb, #122: code health) into bdsp/maps-v4
dayfine Nov 1, 2026
a0a71c8
Merge nav/story-steps (b966c5d93, #122) into bdsp/maps-v4
dayfine Nov 1, 2026
1c0ffea
BDSP maps: the house's 1F row 8 is open at x 4 (console)
dayfine Nov 2, 2026
2a21276
Revert "BDSP maps: the lab's door mat in Sandgem, a row below its door"
dayfine Nov 2, 2026
ed3b0b0
BDSP maps: Sandgem's row 11 has no door at the lab's mat after all
dayfine Nov 2, 2026
29b51da
Merge origin/nav/story-steps into bdsp/maps-v4
dayfine Nov 2, 2026
cc0bd03
BDSP maps: read a warp's destination from MapData's optional `to`
dayfine Nov 2, 2026
cc669ea
BDSP maps: list every cell a map's rectangle touches in its source
dayfine Nov 2, 2026
5d60152
BDSP maps: PlayerHouse1F and Route201's console fixes as generator pa…
dayfine Nov 2, 2026
45144bf
BDSP maps: write each map's coord events from the decomp
dayfine Nov 2, 2026
eb0df85
Merge nav/story-steps into bdsp/maps-v4
dayfine Nov 2, 2026
20b518e
Merge nav/story-steps (24444f0fc: verify mode from #122) into bdsp/ma…
dayfine Nov 3, 2026
7e1bc25
Merge commit 'bb6db58990bd528ef9f0c54534ea3492dbbcf1e3' into HEAD
dayfine Nov 5, 2026
4958325
Merge origin/nav/story-steps into bdsp/maps-v4
dayfine Nov 6, 2026
2039872
BDSP AutoStory maps: align with PR #231 lint conventions
dayfine Nov 6, 2026
f7cd7cc
BDSP AutoStory maps: sync runtime maps from dayfine/PokemonSimulation
dayfine Nov 7, 2026
d2b8956
BDSP: consume pinned Simulation map resources and pickup identities (…
dayfine Nov 8, 2026
51b181b
Merge origin/nav/story-steps into bdsp/maps-v4
dayfine Nov 8, 2026
ea1c3c4
Merge remote-tracking branch 'origin/nav/story-steps' into bdsp/maps-v4
dayfine Nov 8, 2026
ce09998
Merge origin/nav/story-steps into bdsp/maps-v4
dayfine Nov 8, 2026
479cbf8
Merge remote-tracking branch 'origin/nav/story-steps' into HEAD
dayfine Nov 9, 2026
1c9414f
Merge nav/story-steps into bdsp/maps-v4
dayfine Nov 9, 2026
1ad0b64
BDSP: fold #226 fixes into the map resource lock
dayfine Nov 9, 2026
d30b866
Merge nav/story-steps into bdsp/maps-v4
dayfine Nov 9, 2026
000a9d9
Merge remote-tracking branch 'origin/nav/story-steps' into HEAD
dayfine Nov 9, 2026
2326cf7
Merge remote-tracking branch 'origin/nav/story-steps' into merge/maps…
dayfine Nov 9, 2026
f316979
Merge origin/nav/story-steps into bdsp/maps-v4
dayfine Nov 9, 2026
39a714f
Merge nav/story-steps into bdsp/maps-v4
dayfine Nov 9, 2026
0dcf7d5
Merge nav/story-steps into bdsp/maps-v4
dayfine Nov 9, 2026
7a2e267
Merge nav/story-steps into bdsp/maps-v4 (wait for a battle's opening …
dayfine Nov 9, 2026
8d5134a
Merge nav/story-steps into bdsp/maps-v4 (scene ends after its fade; s…
dayfine Nov 9, 2026
b0c0ab1
Merge nav/story-steps into bdsp/maps-v4: a step on the Switch HOME me…
dayfine Nov 9, 2026
0383a49
Merge origin/nav/story-steps into bdsp/maps-v4
dayfine Nov 10, 2026
febb4d8
Merge remote-tracking branch 'origin/nav/story-steps' into bdsp/maps-v4
dayfine Nov 10, 2026
ac23121
Merge origin/nav/grid-story-steps into bdsp/maps-v4
dayfine Nov 11, 2026
c961cdb
Merge nav/grid-story-steps into bdsp/maps-v4
dayfine Nov 11, 2026
ba318ee
Merge origin/nav/grid-story-steps into bdsp/maps-v4
dayfine Nov 12, 2026
dd39b09
Merge branch 'nav/grid-story-steps' into bdsp/maps-v4
dayfine Nov 12, 2026
d772087
Merge branch 'nav/grid-story-steps' into bdsp/maps-v4
dayfine Nov 12, 2026
2263e6e
Merge origin/nav/grid-story-steps into bdsp/maps-v4
dayfine Nov 12, 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
14 changes: 14 additions & 0 deletions .github/workflows/bdsp-map-resources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: BDSP map resources
on:
pull_request:
workflow_dispatch:
jobs:
integrity:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Prepare and check the approved BDSP resource pin
uses: dayfine/PokemonSimulation/integrations/arduino-source/verify-map-packs@4de7742a764d27293b4525d6ad2a6fc8a95f3e3a
with:
layout: resources
operation: prepare
10 changes: 10 additions & 0 deletions .github/workflows/cpp-ci-serial-programs-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ jobs:
ref: 'master'
path: 'Arduino-Source/Packages'

- name: Prepare pinned BDSP map resources
id: map-resources
uses: dayfine/PokemonSimulation/integrations/arduino-source/verify-map-packs@4de7742a764d27293b4525d6ad2a6fc8a95f3e3a
with:
layout: resources
operation: prepare
consumer-directory: Arduino-Source

- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
Expand Down Expand Up @@ -204,6 +212,8 @@ jobs:
# every file missed, compiling took 10-40% longer than before on Linux and macOS, and
# about twice as long on Windows.
CCACHE_DEPEND: 1
POKESIM_TOOLS_SOURCE: ${{ steps.map-resources.outputs.tools-source }}
POKESIM_SOURCE_CACHE: ${{ steps.map-resources.outputs.source-cache }}
run: |
cd Arduino-Source/SerialPrograms
mkdir bin
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/runtime-map-reader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
- uses: actions/checkout@v7
with:
repository: dayfine/PokemonSimulation
ref: 906956e94fc912ae9adb0e44845da780f3bc7e4c
ref: 4de7742a764d27293b4525d6ad2a6fc8a95f3e3a
path: publisher
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- run: python devtools/runtime-map-tests/prepare_parity.py --publisher publisher --publisher-revision 906956e94fc912ae9adb0e44845da780f3bc7e4c --out runtime-map-pairs.json
- run: python devtools/runtime-map-tests/prepare_parity.py --publisher publisher --publisher-revision 4de7742a764d27293b4525d6ad2a6fc8a95f3e3a --out runtime-map-pairs.json
- run: cmake -S devtools/runtime-map-tests -B build-runtime-maps -DCMAKE_BUILD_TYPE=Debug
- run: cmake --build build-runtime-maps --config Debug -j4
- run: ctest --test-dir build-runtime-maps -C Debug --output-on-failure
Expand Down
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ build_*/
.cache/*
Packages/*


# Local agent/linter environments.
.venv-code-health/
__pycache__/

# Local agent/linter environments.
.venv-code-health/
__pycache__/

# Prepared, pinned PokemonSimulation maps are external build inputs.
Packages/Resources/Pokemon/Maps/
.pokesim-map-source/
13 changes: 13 additions & 0 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,19 @@ add_library(SerialProgramsLib STATIC ${CORE_LIBRARY_SOURCES} ${LIBRARY_SOURCES})
include(cmake/EmbedTextFiles.cmake)
pa_embed_text_files(SerialProgramsLib Source/Pokemon/Navigation/TestMaps
Pokemon/Navigation/Pokemon_NavigationTestMaps.h PokemonAutomation::Pokemon navigation_test_map_json)
# Prepared data is validated by the shared publisher tooling. No source-map
# fallback or network download is performed during configuration.
set(POKESIM_TOOLS_SOURCE "$ENV{POKESIM_TOOLS_SOURCE}" CACHE PATH "Pinned PokemonSimulation tools checkout")
set(POKESIM_SOURCE_CACHE "$ENV{POKESIM_SOURCE_CACHE}" CACHE PATH "Approved publishing Git cache")
if(NOT POKESIM_TOOLS_SOURCE OR NOT POKESIM_SOURCE_CACHE)
message(FATAL_ERROR "Prepare devtools/maps/map-resources.lock.json and set POKESIM_TOOLS_SOURCE/POKESIM_SOURCE_CACHE; see devtools/maps/RESOURCE_MAPS.md.")
endif()
include("${POKESIM_TOOLS_SOURCE}/integrations/arduino-source/resource-maps.cmake")
get_filename_component(POKESIM_CONSUMER "${CMAKE_CURRENT_SOURCE_DIR}/.." ABSOLUTE)
pa_pokesim_map_directory(BDSP_MAP_DIRECTORY bdsp "${POKESIM_CONSUMER}" "${POKESIM_SOURCE_CACHE}")
file(RELATIVE_PATH BDSP_MAP_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}" "${BDSP_MAP_DIRECTORY}")
pa_embed_text_files(SerialProgramsLib "${BDSP_MAP_RESOURCES}"
PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps.h PokemonAutomation::NintendoSwitch::PokemonBDSP bdsp_map_json)


# Create binary target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "Pokemon/Navigation/Pokemon_RouteLog_Tests.h"
#include "Pokemon/Navigation/Pokemon_RuntimeMap_Tests.h"
#include "Pokemon/Navigation/Pokemon_WallRecovery_Tests.h"
#include "PokemonBDSP/PokemonBDSP_Tests.h"
#include "VideoGames/PokemonHome/PokemonHome_Tests.h"
#include "VideoGames/PokemonSwSh/PokemonSwSh_Tests.h"
#include "VideoGames/PokemonLA/PokemonLA_Tests.h"
Expand All @@ -61,7 +62,7 @@



UnitTestDatabase make_UNIT_TESTS_ALL(){

Check warning on line 65 in SerialPrograms/Source/ComputerPrograms/ComputerPrograms_UnitTestRunner.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::ComputerPrograms::make_UNIT_TESTS_ALL(): function_lines=46 (advisory above 25, limit 50)
UnitTestDatabase ret;

add_tests_QtEventThreadPool(ret, GlobalThreadPools::computation_normal());
Expand Down Expand Up @@ -94,6 +95,7 @@
NintendoSwitch::add_tests_FailedToConnectDetector(ret);
NintendoSwitch::add_tests_UpdatePopupDetector(ret);
NintendoSwitch::Typewriter::add_tests_TypewriterTextMapping(ret);
NintendoSwitch::PokemonBDSP::add_tests(ret);
NintendoSwitch::PokemonBDSP::add_tests_DialogDetector(ret);
NintendoSwitch::PokemonBDSP::add_tests_MenuDetector(ret);
NintendoSwitch::PokemonFRLG::add_tests(ret);
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 @@ -5,6 +5,7 @@
*/

#include "Common/Cpp/TestRunners/UnitTestDatabase.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_Maps_Tests.h"
#include "PokemonBDSP_Tests.h"

namespace PokemonAutomation{
Expand All @@ -14,6 +15,7 @@ namespace PokemonBDSP{


void add_tests(UnitTestDatabase& database){
add_tests_AutoStory_Maps(database);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* BDSP AutoStory - Maps
*
* From: https://github.com/PokemonAutomation/
*
*/

#include <format>
#include <map>
#include "Common/Cpp/Exceptions.h"
#include "Common/Cpp/Json/JsonValue.h"
#include "PokemonBDSP_AutoStory_Maps.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonBDSP{

using Pokemon::MapData;
using Pokemon::TilePos;


namespace{

const std::map<std::string, MapData, std::less<>>& story_maps_by_name(){
static const std::map<std::string, MapData, std::less<>> maps = []{
std::map<std::string, MapData, std::less<>> parsed;
for (const auto& [name, json] : bdsp_map_json()){
MapData map = Pokemon::parse_map(parse_json(json), name + ".json");

Check warning on line 27 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps.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 (map.name != name){
throw ParseException(std::format("{}.json: name is \"{}\".", name, map.name));
}
parsed.emplace(name, std::move(map));
}
return parsed;
}();
return maps;
}

} // namespace


const MapData& story_map(std::string_view name){
const auto& maps = story_maps_by_name();
if (auto iter = maps.find(name); iter != maps.end()){
return iter->second;
}
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, std::format("No BDSP story map named \"{}\".", name));
}

TilePos map_point(std::string_view map, std::string_view point){
const MapData& data = story_map(map);
if (auto iter = data.points.find(std::string(point)); iter != data.points.end()){
return iter->second;
}
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, std::format("{} has no point \"{}\".", map, point));
}

std::vector<TilePos> map_region(std::string_view map, std::string_view region){
const MapData& data = story_map(map);
std::vector<TilePos> tiles;
while (true){
const auto iter = data.points.find(std::format("{}.{}", region, tiles.size() + 1));
if (iter == data.points.end()){
break;
}
tiles.push_back(iter->second);
}
if (tiles.empty()){
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, std::format("{} has no region \"{}\".", map, region));
}
return tiles;
}



} // namespace PokemonBDSP
} // namespace NintendoSwitch
} // namespace PokemonAutomation
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* BDSP AutoStory - Maps
*
* From: https://github.com/PokemonAutomation/
*
* The maps the story walks, as JSON files in the shared map schema
* (Pokemon_MapData.h): PokemonBDSP/Programs/AutoStory/Maps, written by
* devtools/maps/bdsp_maps.py from the Diamond decompilation and built into
* the program by CMake. Each is named as its file ("Route202").
*
* A map's named tiles are its points. A region, a list of tiles, is the
* points "<region>.1", "<region>.2", ... in order: the schema has
* single-tile points only.
*
* TODO: move the maps to PokemonAutomation/Packages (Resources/PokemonBDSP/Maps) when ready
*
*/

#ifndef PokemonAutomation_PokemonBDSP_AutoStory_Maps_H
#define PokemonAutomation_PokemonBDSP_AutoStory_Maps_H

#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "Pokemon/Navigation/Pokemon_Grid.h"
#include "Pokemon/Navigation/Pokemon_MapData.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonBDSP{


// (name, JSON text) of each map in PokemonBDSP/Programs/AutoStory/Maps/,
// built into the program by pa_embed_text_files() (cmake/EmbedTextFiles.cmake).
const std::vector<std::pair<std::string, std::string>>& bdsp_map_json();

// The map `name`, read from bdsp_map_json() on first use, with its patches
// applied. Throws InternalProgramError for a name it does not have, and
// ParseException if a map does not parse or is not named as its file.
// The name is a string_view so that a temporary string argument is not
// mistaken (by GCC's -Wdangling-reference) for what the result refers to.
const Pokemon::MapData& story_map(std::string_view name);

// The point `point` of the map `map`. Throws InternalProgramError for an
// unknown map or point.
Pokemon::TilePos map_point(std::string_view map, std::string_view point);

// The tiles of the region `region` of the map `map`, in order. Throws
// InternalProgramError for an unknown map, or a region with no tiles.
std::vector<Pokemon::TilePos> map_region(std::string_view map, std::string_view region);



} // namespace PokemonBDSP
} // namespace NintendoSwitch
} // namespace PokemonAutomation
#endif
Loading
Loading