dirkwhoffmann / virtualc64

VirtualC64 is a cycle-accurate C64 emulator for macOS
https://dirkwhoffmann.github.io/virtualc64
Other
342 stars 33 forks source link

Selected and saved Dot Mask-Prefs not applied by new virtual machine #775

Closed ha24-1 closed 5 months ago

ha24-1 commented 7 months ago

Hi, it seems, that in version 4.6 the selected dot mask prefs (f.e. "Trisected and shifted") will not be saved by pressing "use as default". Or more accurate: it will be saved, but after restart VirtualC64 this selection will not be applied by the virtual machine - but the elected option is active. Switching the options in dot mask-dropdownbox will change the effect. Other prefs (in the same prefs-tab, too!) will be applied successfully and stays as expected.

Can anyone confirm? Thank you!

dirkwhoffmann commented 6 months ago

Thanks for reporting!

The error was in the code for setting the dot mask brightness (the slider did not work):

    var dotMaskBrightness: Float = 0 {
        didSet {
            renderer.shaderOptions.dotMaskBrightness = dotMaskBrightness
            ressourceManager.buildDotMasks()
            ressourceManager.selectDotMask(dotMask)
        }
    }

The old code was missing the selectDotMask statement which tells the fragment shader to update the dot mask texture. As a result, the fragment shader used the dot mask texture with brightness 0 which had no visual effect (when reading in the user defaults, the brightness is set after the dot mask type).

ha24-1 commented 6 months ago

perfect! thank you once again for this great emulator!

dirkwhoffmann commented 5 months ago

Fixed in v4.7b1