unexpectedpanda / retool

Retool: a better filter tool for Redump and No-Intro DAT files.
BSD 3-Clause "New" or "Revised" License
343 stars 22 forks source link

Lower revision multi-region titles being selected over higher revision individual region titles #292

Closed Daeymon closed 7 months ago

Daeymon commented 7 months ago

For the GBC NoIntro dat (Nintendo - Game Boy Color (Parent-Clone) (20231203-225121))

Super Mario Bros. Deluxe (USA, Europe) (Rev 1).zip

is being chosen instead of

Super Mario Bros. Deluxe (Europe) (Rev 2).zip

Region Priority is: World, UK, Europe, USA, Canada, Australia, New Zealand. No Title Options are enabled. Using version 2.01.7

In all the examples I am seeing this, the prioritised file is multi-region. Maybe that is affecting the grouping when determining which is the best revision?

unexpectedpanda commented 7 months ago

This isn't a bug, but by design. And yes, multi-region is prioritized.

Revisions should be thought of as unique to their regions, as the code for each region can be different (whether that be 60/50Hz related, different languages supported, censorship, or otherwise).

A rev 1 from Europe for example doesn't necessarily include the same code changes as a rev 1 from the USA. One region might have required fixes that the other did not.

Retool treats (USA, Europe) as different to (Europe) when it comes to revisions for this reason. By covering multiple regions, the code is likely different to the releases that only cover one.

A note on the revision numbers themselves — often they're copied directly from the cartridge to the filename. In this instance, it's possible that Super Mario Bros. Deluxe (Europe) (Rev 2) isn't a revision on Super Mario Bros. Deluxe (USA, Europe) (Rev 1) at all. It's just that Super Mario Bros. Deluxe (Europe) (Rev 1) hasn't been dumped, or never saw release.

The other way of looking at it is Europe got an update that the USA never did, that was unique to that market. In that case I can see if you're prioritizing Europe why you'd want that update. That requires new code and some thinking to implement though.

unexpectedpanda commented 7 months ago

Reopening for consideration as a new feature (and changed the title of the issue as a result). The issues at play:

Daeymon commented 7 months ago

Fully appreciate you having a deeper look into this. Though I have found another example that throws a stone into the logic you stated where multi-regions have more priority.

With "Sega - Game Gear (Parent-Clone) (20231124-140549)"

"PGA Tour Golf (USA) (Rev 1)" was priortised over "PGA Tour Golf (USA, Europe)".

Same region order as before. Does this mean the USA region is priortised over multi-region in this instance? Especially when I ordered USA below Europe in terms of region priorities.

unexpectedpanda commented 7 months ago

Well that certainly shows my memory of how the whole thing works needs refreshing 😅 That and I should wait to double check the code on my PC first instead of answering as quickly as possible from my phone.

At risk of making the same error again -- your Game Gear example rings a bell (and shows I wasn't correct about multi-region titles).

If I recall correctly, what you're seeing in both DATs is caused by this:

I have vague memories of toying with setting the primary region of a multi-region title to whatever was higher in the user's region order (so a (USA, Europe) title would be assigned to Europe instead if it was higher), but of things also going horribly wrong in terms of selecting the right thing when I did.

It's definitely starting to look like a hole in the logic though, and that it's time to revisit the code and see what's going on. It might be as simple as adding another revision check at the cross-region stage, or it might be something more involved.

unexpectedpanda commented 7 months ago

This took a bit of testing and teasing out, but you should find that title selection is much better in v2.01.8 as far as multi-region titles are concerned.

The short version is: multi-region titles are still assigned to a single region for initial comparison, but they're assigned to the region higher up in the user's region order rather than to something fixed. So something with (USA, Europe) is no longer permanently assigned to USA -- if Europe is higher in your region order than USA, it'll be assigned to Europe instead.

There were benefits here beyond getting the highest European revision -- Retool's also making smarter choices now for compilations versus individual titles for those who put Europe higher than USA in the list.

Thanks for raising this, and really appreciate you sticking with it when I got things wrong.