Look for map files in a "Map" subfolder, with root fallback#3607
Open
THandke wants to merge 6 commits into
Open
Look for map files in a "Map" subfolder, with root fallback#3607THandke wants to merge 6 commits into
THandke wants to merge 6 commits into
Conversation
Member
|
jenkins: ok to test |
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. |
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.
RequestMap() previously probed FileFinder::Game() to decide whether to fetch a map from the "Maps" subfolder or the root directory. On Emscripten, files aren't present in the (virtual) filesystem until they've actually been downloaded, so that probe was always false and maps relocated to "Maps/" would never be fetched from there. Move the fallback logic into AsyncHandler instead: a request can now carry a fallback directory, and if the initial download attempt fails, FileRequestAsync retries once in the fallback directory before reporting failure to listeners. RequestMap() just requests "Maps" with "." as fallback and lets the actual download attempt determine existence, which works regardless of platform. Review feedback from EasyRPG#3607.
This reverts commit 27a4548.
Author
|
@Ghabry Thanks, updated the author name and changed the folder name to Map. The new logic in AsyncHandler should now handle maps correctly when requested by the web player. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MapNNNN.lmu/.emufiles directly in the game's root folder. This adds support for storing them in aMapsubfolder instead, for a tidier project layout.Map/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.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.lmtonly 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, solcf::LMT_Readerparsing needed no changes; only the file-lookup logic that turns a map ID into an on-disk path was updated.Reviewer notes
Game_Map::FindMapFile()centralizes the "tryMap/, then fall back to root" logic soLoadMapFile,RequestMap, andDefaultLmuStartFileExistsstay consistent.Map/directory is cheap and silent:DirectoryTree::FindFilecaches missing-directory lookups and defaultsfile_not_found_warningtofalse(existing pattern used elsewhere in this codebase for the same reason).ctestbefore merging is strongly recommended.🤖 Generated with Claude Code