Skip to content

Look for map files in a "Maps" subfolder, with root fallback#3607

Open
THandke wants to merge 1 commit into
EasyRPG:masterfrom
THandke:maps-subfolder
Open

Look for map files in a "Maps" subfolder, with root fallback#3607
THandke wants to merge 1 commit into
EasyRPG:masterfrom
THandke:maps-subfolder

Conversation

@THandke

@THandke THandke commented Jul 10, 2026

Copy link
Copy Markdown

Summary

  • Player currently only looks for MapNNNN.lmu/.emu files directly in the game's root folder. This adds support for storing them in a Maps subfolder instead, for a tidier project layout.
  • Lookup prefers Maps/ but falls back to the root directory when a map isn't found there, so the large existing library of RPG Maker 2000/2003 games (which universally keep maps in the root) keeps working unmodified.
  • Touches map loading (Game_Map::LoadMapFile), async map prefetching (Game_Map::RequestMap, relevant for Emscripten), the start-map existence check that triggers non-standard-extension guessing (DefaultLmuStartFileExists), and the non-standard LMU extension guesser (FileExtGuesser::GuessAndAddLmuExtension).

Why no RPG_RT.lmt (TreeMap) changes

RPG_RT.lmt only stores map IDs, names, hierarchy and per-map metadata — never file paths. The ID-to-filename mapping (MapNNNN.lmu) is a pure Player-side convention, so lcf::LMT_Reader parsing needed no changes; only the file-lookup logic that turns a map ID into an on-disk path was updated.

Reviewer notes

  • New shared helper Game_Map::FindMapFile() centralizes the "try Maps/, then fall back to root" logic so LoadMapFile, RequestMap, and DefaultLmuStartFileExists stay consistent.
  • Probing a nonexistent Maps/ directory is cheap and silent: DirectoryTree::FindFile caches missing-directory lookups and defaults file_not_found_warning to false (existing pattern used elsewhere in this codebase for the same reason).
  • I was not able to compile or run the test suite in the environment this was authored in (no C++ toolchain available). Changes were verified by careful manual/static review of signatures, includes, and call sites, but a local build + ctest before merging is strongly recommended.

🤖 Generated with Claude Code

RPG Maker 2000/2003 games traditionally keep MapNNNN.lmu files directly
in the project root. This adds support for storing them in a "Maps"
subfolder instead, which existing games and tools can adopt for a
tidier project layout.

RPG_RT.lmt (TreeMap) itself needed no changes: it only stores map IDs,
names and hierarchy/metadata, never file paths. The ID-to-filename
mapping is a pure Player-side convention, so only the file lookup
logic needed updating.

To avoid breaking the large existing library of RPG Maker 2000/2003
games that keep maps in the root, lookup prefers "Maps/" but falls
back to the root directory when not found there. This affects map
loading (Game_Map::LoadMapFile), async map prefetching
(Game_Map::RequestMap), the start-map existence check used to trigger
non-standard-extension guessing, and the non-standard LMU extension
guesser itself.
@carstene1ns

Copy link
Copy Markdown
Member

jenkins: ok to test

@THandke THandke marked this pull request as ready for review July 10, 2026 14:42
@Ghabry

Ghabry commented Jul 10, 2026

Copy link
Copy Markdown
Member

Hi.

You didn't set an author for your git commit. It is just "Your Name".

For consistency with other folders it should be called "Map" instead of "Maps".

The logic in RequestMap for the web player will not work this way: When the map was not requested it is not available in the file system yet so the condition will be always false. Instead this needs additional logic in the AsyncHandler class to fetch the correct file depending on its existance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants