jotego / jtbin

Binary files for MiSTerFPGA, Pocket and other platforms
https://patreon.com/jotego
241 stars 69 forks source link

Sorting the Pocket JSON files into folders (`_alternatives` etc) #328

Closed neil-morrison44 closed 1 year ago

neil-morrison44 commented 1 year ago

Hey,

With CSP1 & CSP2 growing now we've been thinking about how to sort the JSON files, ideally in a way that allows users to define a subset.

While we could add sorting via the updaters it'd be overwritten by every new core update & would probably mean that core devs get more issues from people running old JSON files etc.

In its simplest form I think the suggestion is to keep the "main" .json files at the root as they are now then put extra / alternative ones in a sub-folder similar to how your mra folder works.

If we agree on some naming (could be _alternatives like that folder, or whatever works) then we can include a toggle in the updaters to allow users to specify that they want to process the jsons within that folder.

You'd need to move the preset & interact jsons too to match, but I think the content of the json doesn't need to change regardless of how deeply nested it is.

jotego commented 1 year ago

Yes, I agree that it becomes messy. Could you try a folder layout in the Pocket too and check that it works? The Pocket firmware is a bit buggy and tends to crash for silly things, like empty or unexpected folders. Please attach a suggestion of a working layout in a zip file to this thread and I'll match it in JTBIN.

neil-morrison44 commented 1 year ago

outrun_alter.zip Sure yeah, here's the files for the outrun core with most of them moved into a _alternatives folder, it seems to still run fine. (the PC Engine CD core uses nested JSONs too and they seem to work reasonably well there)

I wasn't sure which one was the proper "main" one, but hopefully you get that logic from whatever's doing it for the .mra files?

jotego commented 1 year ago

Thanks. You didn't have subfolders in _alternatives so Out Run and Turbo Out Run are together. Is it possible to have one more level of subfolders?

neil-morrison44 commented 1 year ago

Yeah that should be fine - there might be a limit of 255 characters for the path length from the root but you can have as much nesting as you want within that I think.

The updaters will just present a toggle to users to ignore everything under the _alternatives level (with it ignored by default to speed things up).

neil-morrison44 commented 1 year ago

I'm just putting a version of Pocket Sync up now that'll (by default) ignore jsons where there's an _alternatives anywhere in the path so both:

and

will work fine, or any similar structure (only name that matters is _alternatives) so feel free to structure the files however makes sense. I'll let Matt know and get his & Retrodrivens updaters to do the same

jotego commented 1 year ago

The underscore in _alternatives was a coding needed for MiSTer and it wasn't displayed in the menu. I think that if we use that in the Pocket, it will be shown. We should drop it and just call it alternatives.

neil-morrison44 commented 1 year ago

I think the underscore is still a good idea on the Pocket - it means the folder is always in the same place in the file list regardless of what other files are called.

(Also makes it a more uncommon token so we don't accidentally ignore non-alternative files that happen to have alternative in the name)

mattpannella commented 1 year ago

just chiming in to say keeping the underscore in _alternatives could be useful because it will ensure the folder is always displayed at the top of the list

jotego commented 1 year ago

@neil-morrison44 could you test the attached zip? If it's fine, I'll move it to JTBIN

pocket_sorted.zip

neil-morrison44 commented 1 year ago

@jotego 👍🏻 looks good


Worth noting that due to the way the installers install the cores (basically just unzipping on top of what's already there) folks'll end up with 2 sets of JSONs for cores already installed. That'll be on me & @mattpannella to deal with, either via messaging or some sort of automated cleanup - plus CPS2 is the "big one" & having _alternatives in there from the start (well, the public release start) should make a big difference

jotego commented 1 year ago

Thank you for checking it. Is it ok if I change the files in JTBIN tomorrow?

neil-morrison44 commented 1 year ago

@jotego yeah that's fine with me - I'm just deploying a version of Pocket Sync that'll deal with the duplicated files just now so hopefully that'll not be a problem soon (at least for Pocket Sync)