YANBForwarder / YANBF

Yet another nds-bootstrap forwarder. Runs from 3DS-mode!
GNU General Public License v2.0
161 stars 4 forks source link

Support multiple versions and romhacks for the same title id. #52

Open pivotiiii opened 1 year ago

pivotiiii commented 1 year ago

Hi, this allows the generator to select between multiple versions of assets for the same title id, in cases such as romhacks or PAL games that have different banners per language. To create a version for Pokemon Platinum [CPU_], the assets would need to be saved in the repo as "CPU.1", "CPU.2" etc. Each of these added versions also needs a "description.txt" file which contains as name for the version (e.g. "Pokemon - Renegade Platinum") that can be displayed to the user. The assets would just be called "CPU.png" and "CPU.wav" again to not cause any trouble. In the future the description.txt could also be used for custom titles for romhacks.

How it currently works is that before downloading anything from Github, the repo is checked for a one of these versions. Since downloading directly from Github is not really the cleanest method, this currently needs the numbers to be consecutive (or only skip one at the most) and start at 1. This means if the first version would be (for whatever reason) CPU.5, it would not be detected. Versions for both the short "CPU" and the long "CPUE" are detected at the same time.

If a different version is detected, the user is presented with a simple selection menu to choose what he wants (including default ofc). If the custom version only provides a banner, the sound will be downloaded from the regular version.

I had to change all the links in the generator.py to point to my fork in order to test stuff and have also uploaded two versions of Platinum for that purpose, this would obv have to be changed to point to the main asset repo.

The main problem with the way this is currently implemented is that it breaks the GUI, since the user input to select a version is mandatory. I could change this so that versions are only checked if an argument is passed, but I think checking versions should eventually become default behaviour.

Idk how this should work with #50, probably just trust the user :D

lifehackerhansol commented 1 year ago

I think ROM hacks should explicitly be one region only.

Renegade Plat for example only applies to CPUE, Moon Black 2 only applies to IREO, and otherwise. As far as I'm aware, this is the case for pretty much ALL ROM hacks out there. If there happens to be a ROM hack that provides multiple regions, then we can just do it separately. (As is the case for normal ROMs too, if there are multiple regions, then we make a specific directory for that region.

So we can take advantage of this and explicitly only use that region, this way it wouldn't confuse it in the 3-letter version.

To make this easier, we should probably provide some way to show which files actually exist in the assets repository. I'll get to that soon, it shouldn't be too difficult.

lifehackerhansol commented 1 year ago

I added a directory list in JSON format: https://github.com/YANBForwarder/assets/blob/main/assets.json

It could use some improvement, but maybe it helps here?

pivotiiii commented 1 year ago

I thought about that too, but wasn't sure that there aren't any. If hack assets are guaranteed to only go in the 4-letter folders there could be some redundant assets, but I guess thats not the worst. It would be necessary to simplify the code.

lifehackerhansol commented 1 year ago

We can get to deduplication when we get there. For now, I'm not terribly worried. I'll say just do 4 letters, since multi-region ROM hacks are the anomaly rather than the norm.

pivotiiii commented 1 year ago

Tbh I'm not too familiar with JSON handling, but I can see how this would help, especially with actually finding all versions. What do you think about the way the folders are set up currently (CPU.1, CPU.2 ...)? I thought about having them inside of the original CPU folder, but I figured that it is easier to use the way they are now.

pivotiiii commented 1 year ago

We can get to deduplication when we get there. For now, I'm not terribly worried. I'll say just do 4 letters, since multi-region ROM hacks are the anomaly rather than the norm.

Alright, shouldn't take too long. Maybe tomorrow though, my midterms are coming up as well and this was a welcome distraction today.

lifehackerhansol commented 1 year ago

This will definitely need some work over at the assets repo, since we should add descriptions for the ROM hacks etc. We should abstract the "is there a ROM hack present?" checks in the assets side over that json file.

json in python is pretty easy, it's just a Dict object. You'll have to requests.get the file first, obviously.

I'll have to think on how the directory structure is going to work.