Skip to content

configurable region detection from filename#248

Merged
Gemba merged 6 commits into
masterfrom
fb_regions_issue_242
Jun 3, 2026
Merged

configurable region detection from filename#248
Gemba merged 6 commits into
masterfrom
fb_regions_issue_242

Conversation

@Gemba

@Gemba Gemba commented May 12, 2026

Copy link
Copy Markdown
Owner

see #242

Gemba and others added 5 commits April 26, 2026 17:08
- regions from file in order of region prios and inlined into region prios by default
- added config option (regionFromFilename) to control region detection from filename
- updated regions doc and testcases
* Go through regionPrios from config before regionMap

Appending regionMap to regionPrios before searching it will prioritise searching the config regionPrios first, and then if not found, move on to regionMap. May need to add a line to remove duplicates from this list as regions in regionPrios and regionMap may appear twice (removing the second occurrence should remove the regionMap appearence and leave the first one added via regionPrios)

* Add an iteration through regionMap based on regionPrios to give new sortedMap order

Made some fixes to ensure it compiles and also to do this is a more logical way (without duplication)
@Gemba Gemba changed the title Fb regions issue 242 configurable region detection from filename May 12, 2026
@Gemba
Gemba merged commit 27b18c5 into master Jun 3, 2026
2 checks passed
@mattfeeder18

Copy link
Copy Markdown

Hi Gemba - thank you for all your help with this, much appreciated. first (put the filename regions at the front in the order they're found) and off (don't detect from filename) are all good, and they make sense.

I've ran some testing on 3.20.0 today, and the inline isn't quite doing what I thought it would. Currently, it looks like inline is just adding any detected regions from the filename that weren't already in the regionPrios to the end. What it really needs to do (in my opinion) is kind of similar to what first does, but when adding/moving the detected filenames at the start of regionPrios, they should be in the order that they were in regionPrios originally, just 'shifted' forward in the list.

Sorry to have to changed it once you've already released the new version. It should be a quick fix, so I'll have a look at what needs to be changed to achieve this ordering. If you work out what needs editing before I work it out, then please let me know.

To help explain, I've used your examples from the docs but edited it to be what I would expect:

Example(s)

Set to inline mode:

[snes]
regionFromFilename="inline"
regionPrios="eu, br, us, jp"

... with game filename 'Game A (Japan, USA).zip'
will result in the region prio list
"us, jp, eu, br". This is because it detects Japan and USA from the filename, so they get shifted to the front, but USA was before Japan in the regionPrios so USA goes in position 1 (this is different to first where there they are added in the order they are in the filename).

... with game filename 'Game B (USA, Europe).zip'
will result in the region prio list
"eu, us, br, jp". This is because it detects USA and Europe from the filename, so they get shifted to the front, but Europe was before USA in the regionPrios so Europe goes in position 1 (this is different to first where there they are added in the order they are in the filename).

... with game filename 'Game C (USA, World, Europe).zip'
will result in the region prio list
"eu, us, wor, br, jp". This is because it detects USA, World, and Europe from the filename, so they get shifted to the front, but Europe was before USA in the regionPrios so Europe goes in position 1, USA in position 2, and then World in position 3 as it wasn't in the original regionPrios (this is different to first where there they are added in the order they are in the filename).

@mattfeeder18

Copy link
Copy Markdown

I have made the required modification in a fork, and created a pull request accordingly. Let me know if you think this is suitable.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants