libretro / vice-libretro

Versatile Commodore 8-bit Emulator
GNU General Public License v2.0
40 stars 70 forks source link

Per-Content vicerc Loading #296

Closed Zombeaver closed 3 years ago

Zombeaver commented 3 years ago

I was playing around with the SFXSoundExpander function in vicerc to enable YM3812 support for SID compositions that use it (like this one which you can preview here) and it worked great in Retroarch! You can use the following options if you want to test it out for yourself:

[C64] SFXSoundExpander=1 SFXSoundExpanderChip=3812

The thought occurred to me though that there are some vicerc functions that you might not necessarily want to be used across the board. Now of course some things are going to be added to core options over time in which case you can use content specific core option files (.opt) to enable or disable as you see fit per game, but it's unlikely that this is ever going to cover every possible option (nor should it, because the core options would become quite a mess).

Is there any possibility of implementing something like [game name].vicerc which could be used in config\VICE x64 and loaded per-content just like .cfg and .opt files?

sonninnos commented 3 years ago

Sure a content based vicerc would be good in the long run, but I believe it is not ok for a core to write to frontend config dirs. I don't see a reason why it couldn't be done under saves though.

I'd also rather add those as proper core options, even if they are very seldom needed. But why not both.

Zombeaver commented 3 years ago

Sure a content based vicerc would be good in the long run, but I believe it is not ok for a core to write to frontend config dirs. I don't see a reason why it couldn't be done under saves though.

Ah okay, yeah I guess that makes sense. That should be fine too though.

I'd also rather add those as proper core options, even if they are very seldom needed.

Fair enough, but I assume that not everything in vicerc will ever be included in core options surely (it's 300+ lines of options). There's a ton of really obscure stuff in there (like the case above) that seem like they'd just end up cluttering the options to an unusable degree. I had to know exactly what to look for beforehand in order to find that one. I suppose you could hide it behind its own "vicerc options" or "advanced options" or some such toggle, but even then it just seems like your list of options would become super unwieldy.

sonninnos commented 3 years ago

Of course. I did not mean adding every option available, but only those that make even some sense.

Perhaps the vicerc option should also get a few more states added to current ON/OFF. Like "Per-Content only" and "Global only". ON would read Global rc if Per-Content rc is not found. Or maybe that is enough.

But in any case, mixing core options and vicerc otions will require some planning, because every option that is added in core option form is currently removed from the dumps.

Allowing the use of both simultaneously will be complicated due to conflicts caused by core options overriding everything on change. Sure it is also possible to disable those core options that are defined in the file, but that will be messy and pretty clumsy. So for the time being vicerc is only for leftover options which either won't fit as core options, or are too useless to have one.

The next batch will bring these core options:

Zombeaver commented 3 years ago

Perhaps the vicerc option should also get a few more states added to current ON/OFF. Like "Per-Content only" and "Global only". ON would read Global rc if Per-Content rc is not found. Or maybe that is enough.

I guess that could work. Basically what I had in mind was something essentially identical to the way overrides work, i.e. [game name].cfg > [core name].cfg > retroarch.cfg except .vicerc instead of .cfg, with the system\vice\vicerc file functioning as the equivalent of retroarch.cfg instead. Whatever's specified there is loaded with any Vice core, anything in a core subfolder (VICE x64, VICE x64sc, etc.) is applied to that core if there's a [core name].vicerc file and any named after specific content is applied to that content if there's a [game name].vicerc.

But in any case, mixing core options and vicerc otions will require some planning, because every option that is added in core option form is currently removed from the dumps.

Yes, that makes sense so as not to cause a conflict.

The next batch will bring these core options:

Virtual Device Traps RAM Expansion Unit (C64) SFX Sound Expander (C64 & C128) EasyFlash Write Protection (C64 & C128)

That's good. Those would all be worthwhile.

sonninnos commented 3 years ago

anything in a core subfolder (VICE x64, VICE x64sc, etc.) is applied to that core if there's a [core name].vicerc file

That step won't be necessary because the rc file requires the section, [C64SC] etc.

and any named after specific content is applied to that content if there's a [game name].vicerc.

I got this working now. Will try to push tomorrow after a proper testing session of other additions.

If [content].vicerc exists in saves, it will be read, otherwise global system/vice/vicerc will be read. I don't think I can easily combine them so they would be appended. Every wanted option needs to be in the single file, at least for now.