mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
Simplified min, max, default and step value handling for chain configuration
- min, max, default and step are now floating points without an addition scale factor
This commit is contained in:
parent
9167349e5e
commit
b681e5dc2b
@ -42,12 +42,9 @@
|
||||
// min (required): The lower limit to which the slider can be adjusted by a user.
|
||||
// type: See type for "default"
|
||||
//
|
||||
// step (required): How much, in integer units, does a single left/right adjustment adjust the slider?
|
||||
// step (required): How much does a single left/right adjustment adjust the slider?
|
||||
// type: Integer value
|
||||
//
|
||||
// scale (required): By what value should we multiply the slider's integer value in order to get a usable value to disable?
|
||||
// type: Numeric value
|
||||
//
|
||||
// format (required): A C-style formatting string to use when displaying the slider's value.
|
||||
// type: Any standard C-style formatting string (%s, %d, %1.2f, and so on)
|
||||
//
|
||||
@ -58,66 +55,65 @@
|
||||
// strings (optional): A list of strings to use with the "intenum" type, to select from a list of text options instead of simply numbers.
|
||||
// value: An array of 2 or more entries, with one entry per possible slider setting from "min" to "max" inclusive.
|
||||
|
||||
{ "type": "intenum", "name": "adjustments", "text": "Enable Adjustments", "default": 0, "max": 1, "min": 0, "step": 1, "scale": 1.0, "format": "%s", "screen": "any", "strings": [ "Off", "On" ] },
|
||||
{ "type": "intenum", "name": "adjustments", "text": "Enable Adjustments", "default": 0, "max": 1, "min": 0, "step": 1, "format": "%s", "screen": "any", "strings": [ "Off", "On" ] },
|
||||
|
||||
{ "type": "intenum", "name": "ntsc", "text": "Enable NTSC", "default": 0, "max": 1, "min": 0, "step": 1, "scale": 1.0, "format": "%s", "screen": "any", "strings": [ "Off", "On" ] },
|
||||
{ "type": "float", "name": "a_value", "text": "NTSC A Value", "default": 50, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "b_value", "text": "NTSC B Value", "default": 50, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "cc_value", "text": "NTSC Color Carrier (Hz)", "default": 35795454, "max": 36795454, "min": 34795454, "step": 100, "scale": 0.0000001, "format": "%1.7f", "screen": "raster" },
|
||||
{ "type": "float", "name": "o_value", "text": "NTSC Outgoing Phase Offset", "default": 0, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "p_value", "text": "NTSC Incoming Phase Pixel Clock Scale", "default": 100, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "scan_time", "text": "NTSC Scanline Duration (uSec)", "default": 526, "max": 1500, "min": 1, "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
|
||||
{ "type": "float", "name": "notch_width", "text": "NTSC Color Notch Filter Width", "default": 200, "max": 400, "min": 1, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "y_freq_response", "text": "NTSC Y Signal Bandwidth (Hz)", "default": 600, "max": 2100, "min": 1, "step": 10, "scale": 0.01, "format": "%2.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "i_freq_response", "text": "NTSC I Signal Bandwidth (Hz)", "default": 120, "max": 2100, "min": 1, "step": 10, "scale": 0.01, "format": "%2.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "q_freq_response", "text": "NTSC Q Signal Bandwidth (Hz)", "default": 60, "max": 2100, "min": 1, "step": 10, "scale": 0.01, "format": "%2.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "jitter_offset", "text": "NTSC Frame Jitter Offset", "default": 0, "max": 200, "min": 1, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "intenum", "name": "ntsc", "text": "Enable NTSC", "default": 0, "max": 1, "min": 0, "step": 1, "format": "%s", "screen": "any", "strings": [ "Off", "On" ] },
|
||||
{ "type": "float", "name": "a_value", "text": "NTSC A Value", "default": 0.50, "max": 1.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "b_value", "text": "NTSC B Value", "default": 0.50, "max": 1.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "cc_value", "text": "NTSC Color Carrier (Hz)", "default": 3.57954, "max": 3.67954, "min": 3.47954, "step": 0.00001, "format": "%1.5f", "screen": "raster" },
|
||||
{ "type": "float", "name": "o_value", "text": "NTSC Outgoing Phase Offset", "default": 0.00, "max": 1.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "p_value", "text": "NTSC Incoming Phase Pixel Clock Scale", "default": 1.00, "max": 2.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "scan_time", "text": "NTSC Scanline Duration (uSec)", "default": 52.60, "max": 150.00, "min": 1.00, "step": 0.1, "format": "%3.1f", "screen": "raster" },
|
||||
{ "type": "float", "name": "notch_width", "text": "NTSC Color Notch Filter Width", "default": 2.00, "max": 4.00, "min": 1.00, "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "y_freq_response", "text": "NTSC Y Signal Bandwidth (Hz)", "default": 6.00, "max": 21.00, "min": 0.00, "step": 0.01, "format": "%2.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "i_freq_response", "text": "NTSC I Signal Bandwidth (Hz)", "default": 1.20, "max": 21.00, "min": 0.00, "step": 0.01, "format": "%2.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "q_freq_response", "text": "NTSC Q Signal Bandwidth (Hz)", "default": 0.60, "max": 21.00, "min": 0.00, "step": 0.01, "format": "%2.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "jitter_offset", "text": "NTSC Frame Jitter Offset", "default": 0.00, "max": 2.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
|
||||
{ "type": "color", "name": "red_ratios", "text": "Red Output from ", "default": [ 100, 0, 0 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "color", "name": "grn_ratios", "text": "Green Output from ", "default": [ 0, 100, 0 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "color", "name": "blu_ratios", "text": "Blue Output from ", "default": [ 0, 0, 100 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "color", "name": "offset", "text": "Signal Offset, ", "default": [ 0, 0, 0 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "color", "name": "scale", "text": "Signal Scale, ", "default": [ 95, 95, 95 ], "max": [ 200, 200, 200 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "saturation", "text": "Color Saturation", "default": 150, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "color", "name": "red_ratios", "text": "Red Output from ", "default": [ 1.00, 0.00, 0.00 ], "max": [ 2.00, 2.00, 2.00 ], "min": [ 0.00, 0.00, 0.00 ], "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "color", "name": "grn_ratios", "text": "Green Output from ", "default": [ 0.00, 1.00, 0.00 ], "max": [ 2.00, 2.00, 2.00 ], "min": [ 0.00, 0.00, 0.00 ], "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "color", "name": "blu_ratios", "text": "Blue Output from ", "default": [ 0.00, 0.00, 1.00 ], "max": [ 2.00, 2.00, 2.00 ], "min": [ 0.00, 0.00, 0.00 ], "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "color", "name": "offset", "text": "Signal Offset, ", "default": [ 0.00, 0.00, 0.00 ], "max": [ 2.00, 2.00, 2.00 ], "min": [ 0.00, 0.00, 0.00 ], "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "color", "name": "scale", "text": "Signal Scale, ", "default": [ 0.95, 0.95, 0.95 ], "max": [ 2.00, 2.00, 2.00 ], "min": [ 0.00, 0.00, 0.00 ], "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
{ "type": "float", "name": "saturation", "text": "Color Saturation", "default": 1.50, "max": 4.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" },
|
||||
|
||||
{ "type": "vec2", "name": "converge_red", "text": "Red Convergence, ", "default": [ 5, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "converge_green", "text": "Green Convergence, ", "default": [ 0, 5 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "converge_blue", "text": "Blue Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "converge_red", "text": "Red Convergence, ", "default": [ 0.5, 0.0 ], "max": [ 10.0, 10.0 ], "min": [ -10.0, -10.0 ], "step": 0.1, "format": "%2.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "converge_green", "text": "Green Convergence, ", "default": [ 0.0, 0.5 ], "max": [ 10.0, 10.0 ], "min": [ -10.0, -10.0 ], "step": 0.1, "format": "%2.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "converge_blue", "text": "Blue Convergence, ", "default": [ 0.0, 0.0 ], "max": [ 10.0, 10.0 ], "min": [ -10.0, -10.0 ], "step": 0.1, "format": "%2.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "radial_converge_red", "text": "Red Radial Convergence, ", "default": [ 0.0, 0.0 ], "max": [ 10.0, 10.0 ], "min": [ -10.0, -10.0 ], "step": 0.1, "format": "%2.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "radial_converge_green", "text": "Green Radial Convergence, ", "default": [ 0.0, 0.0 ], "max": [ 10.0, 10.0 ], "min": [ -10.0, -10.0 ], "step": 0.1, "format": "%2.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "radial_converge_blue", "text": "Blue Radial Convergence, ", "default": [ 0.0, 0.0 ], "max": [ 10.0, 10.0 ], "min": [ -10.0, -10.0 ], "step": 0.1, "format": "%2.1f", "screen": "raster" },
|
||||
|
||||
{ "type": "vec2", "name": "radial_converge_red", "text": "Red Radial Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "radial_converge_green", "text": "Green Radial Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "radial_converge_blue", "text": "Blue Radial Convergence, ", "default": [ 0, 0 ], "max": [ 8000, 6000 ], "min": [ -8000, -6000 ], "step": 1, "scale": 0.1, "format": "%3.1f", "screen": "raster" },
|
||||
{ "type": "vec2", "name": "defocus", "text": "Defocus, ", "default": [ 1.5, 1.5 ], "max": [ 10.0, 10.0 ], "min": [ 0.0, 0.0 ], "step": 0.1, "format": "%2.1f", "screen": "crt" },
|
||||
|
||||
{ "type": "vec2", "name": "defocus", "text": "Defocus, ", "default": [ 15, 15 ], "max": [ 500, 500 ], "min": [ 0, 0 ], "step": 1, "scale": 0.1, "format": "%2.1f", "screen": "crt" },
|
||||
{ "type": "color", "name": "phosphor", "text": "Phosphor Persistence, ", "default": [ 0.45, 0.45, 0.45 ], "max": [ 1.00, 1.00, 1.00 ], "min": [ 0.00, 0.00, 0.00 ], "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
|
||||
{ "type": "color", "name": "phosphor", "text": "Phosphor Persistence, ", "default": [ 45, 45, 45 ], "max": [ 100, 100, 100 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_alpha", "text": "Scanline Amount", "default": 0.80, "max": 1.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_scale", "text": "Overall Scanline Scale", "default": 1.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_bright_scale", "text": "Scanline Brightness Scale", "default": 2.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_bright_offset", "text": "Scanline Brightness Offset", "default": 0.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_jitter_amount", "text": "Scanline Jitter Amount", "default": 0.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_height", "text": "Individual Scanline Scale", "default": 1.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_variation", "text": "Scanline Variation", "default": 1.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
|
||||
{ "type": "float", "name": "shadow_alpha", "text": "Shadow Mask Amount", "default": 0.20, "max": 1.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "vec2", "name": "shadow_uv_count", "text": "Shadow Mask Pixel Count ", "default": [ 12, 12 ], "max": [ 128, 128 ], "min": [ 1, 1 ], "step": 1, "format": "%3f", "screen": "crt" },
|
||||
{ "type": "vec2", "name": "shadow_uv_size", "text": "Shadow Mask UV Size ", "default": [ 0.500, 0.500 ], "max": [ 1.000, 1.000 ], "min": [ 0.000, 0.000 ], "step": 0.001, "format": "%1.3f", "screen": "crt" },
|
||||
{ "type": "vec2", "name": "shadow_uv_offset", "text": "Shadow Mask UV Offset ", "default": [ 0.000, 0.000 ], "max": [ 1.000, 1.000 ], "min": [ 0.000, 0.000 ], "step": 0.001, "format": "%1.3f", "screen": "crt" },
|
||||
|
||||
{ "type": "float", "name": "scanline_alpha", "text": "Scanline Amount", "default": 80, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_scale", "text": "Overall Scanline Scale", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_bright_scale", "text": "Scanline Brightness Scale", "default": 200, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_bright_offset", "text": "Scanline Brightness Offset", "default": 0, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_jitter_amount", "text": "Scanline Jitter Amount", "default": 0, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_height", "text": "Individual Scanline Scale", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "scanline_variation", "text": "Scanline Variation", "default": 100, "max": 400, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "humbar_alpha", "text": "Hum Bar Amount", "default": 0.05, "max": 1.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "humbar_hertz_rate", "text": "Hum Bar Frequency", "default": 0.001, "max": 1.000, "min": 0.000, "step": 0.00001, "format": "%1.5f", "screen": "crt" },
|
||||
|
||||
{ "type": "float", "name": "shadow_alpha", "text": "Shadow Mask Amount", "default": 20, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "vec2", "name": "shadow_uv_count", "text": "Shadow Mask Pixel Count ", "default": [ 12, 12 ], "max": [ 128, 128 ], "min": [ 1, 1 ], "step": 1, "scale": 1.0, "format": "%3f", "screen": "crt" },
|
||||
{ "type": "vec2", "name": "shadow_uv_size", "text": "Shadow Mask UV Size ", "default": [ 500, 500 ], "max": [ 1000, 1000 ], "min": [ 0, 0 ], "step": 1, "scale": 0.001, "format": "%1.4f", "screen": "crt" },
|
||||
{ "type": "vec2", "name": "shadow_uv_offset", "text": "Shadow Mask UV Offset ", "default": [ 0, 0 ], "max": [ 1000, 1000 ], "min": [ 0, 0 ], "step": 1, "scale": 0.001, "format": "%1.4f", "screen": "crt" },
|
||||
{ "type": "color", "name": "floor", "text": "Signal Floor, ", "default": [ 0.05, 0.05, 0.05 ], "max": [ 1.00, 1.00, 1.00 ], "min": [ 0.00, 0.00, 0.00 ], "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "color", "name": "power", "text": "Signal Exponent, ", "default": [ 0.80, 0.80, 0.80 ], "max": [ 4.00, 4.00, 4.00 ], "min": [ 0.00, 0.00, 0.00 ], "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
|
||||
{ "type": "float", "name": "humbar_alpha", "text": "Hum Bar Amount", "default": 5, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "humbar_hertz_rate", "text": "Hum Bar Frequency", "default": 100, "max": 10000, "min": 0, "step": 1, "scale": 0.00001, "format": "%1.7f", "screen": "crt" },
|
||||
|
||||
{ "type": "color", "name": "floor", "text": "Signal Floor, ", "default": [ 5, 5, 5 ], "max": [ 100, 100, 100 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "color", "name": "power", "text": "Signal Exponent, ", "default": [ 80, 80, 80 ], "max": [ 400, 400, 400 ], "min": [ 0, 0, 0 ], "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
|
||||
{ "type": "float", "name": "distortion", "text": "Screen Distortion Amount", "default": 20, "max": 200, "min": -200, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "cubic_distortion", "text": "Screen Cubic Distortion Amount", "default": 0, "max": 200, "min": -200, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "distort_corner", "text": "Distorted Corner Amount", "default": 20, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "round_corner", "text": "Rounded Corner Amount", "default": 15, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "smooth_border", "text": "Smooth Border Amount", "default": 5, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "vignetting", "text": "Vignetting Amount", "default": 20, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "reflection", "text": "Reflection Amount", "default": 15, "max": 200, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "crt" }
|
||||
{ "type": "float", "name": "distortion", "text": "Screen Distortion Amount", "default": 0.20, "max": 2.00, "min": -2.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "cubic_distortion", "text": "Screen Cubic Distortion Amount", "default": 0.00, "max": 2.00, "min": -2.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "distort_corner", "text": "Distorted Corner Amount", "default": 0.20, "max": 2.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "round_corner", "text": "Rounded Corner Amount", "default": 0.15, "max": 2.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "smooth_border", "text": "Smooth Border Amount", "default": 0.05, "max": 2.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "vignetting", "text": "Vignetting Amount", "default": 0.20, "max": 2.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
|
||||
{ "type": "float", "name": "reflection", "text": "Reflection Amount", "default": 0.15, "max": 2.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" }
|
||||
],
|
||||
|
||||
// parameters (optional): A list of procedurally-generated parameters that can be bound to entry uniforms.
|
||||
|
@ -12,7 +12,7 @@
|
||||
"author": "Ryan Holtz",
|
||||
|
||||
"sliders": [
|
||||
{ "type": "float", "name": "saturation", "text": "Saturation", "default": 25, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" }
|
||||
{ "type": "float", "name": "saturation", "text": "Saturation", "default": 0.25, "max": 1.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" }
|
||||
],
|
||||
|
||||
"targets": [
|
||||
|
@ -12,7 +12,7 @@
|
||||
"author": "Ryan Holtz",
|
||||
|
||||
"sliders": [
|
||||
{ "type": "float", "name": "saturation", "text": "Saturation", "default": 25, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" }
|
||||
{ "type": "float", "name": "saturation", "text": "Saturation", "default": 0.25, "max": 1.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" }
|
||||
],
|
||||
|
||||
"targets": [
|
||||
|
@ -12,7 +12,7 @@
|
||||
"author": "Ryan Holtz",
|
||||
|
||||
"sliders": [
|
||||
{ "type": "float", "name": "saturation", "text": "Saturation", "default": 25, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" }
|
||||
{ "type": "float", "name": "saturation", "text": "Saturation", "default": 0.25, "max": 1.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" }
|
||||
],
|
||||
|
||||
"targets": [
|
||||
|
@ -12,7 +12,7 @@
|
||||
"author": "Ryan Holtz",
|
||||
|
||||
"sliders": [
|
||||
{ "type": "float", "name": "saturation", "text": "Saturation", "default": 25, "max": 100, "min": 0, "step": 1, "scale": 0.01, "format": "%1.2f", "screen": "raster" }
|
||||
{ "type": "float", "name": "saturation", "text": "Saturation", "default": 0.25, "max": 1.00, "min": 0.00, "step": 0.01, "format": "%1.2f", "screen": "raster" }
|
||||
],
|
||||
|
||||
"targets": [
|
||||
|
@ -11,24 +11,18 @@
|
||||
#include "slider.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
bgfx_slider::bgfx_slider(running_machine &machine, std::string name, int32_t min, int32_t def, int32_t max, int32_t step, slider_type type, screen_type screen, float scale, std::string format, std::string description, std::vector<std::string>& strings)
|
||||
bgfx_slider::bgfx_slider(running_machine &machine, std::string name, float min, float def, float max, float step, slider_type type, screen_type screen, std::string format, std::string description, std::vector<std::string>& strings)
|
||||
: m_name(name)
|
||||
, m_step(step)
|
||||
, m_type(type)
|
||||
, m_screen_type(screen)
|
||||
, m_scale(scale)
|
||||
, m_format(format)
|
||||
, m_description(description)
|
||||
{
|
||||
m_min = min;
|
||||
m_default = def;
|
||||
m_max = max;
|
||||
|
||||
m_value = def;
|
||||
if (m_type != slider_type::SLIDER_INT && m_type != slider_type::SLIDER_INT_ENUM)
|
||||
{
|
||||
m_value = float(def) * scale;
|
||||
}
|
||||
|
||||
for (std::string string : strings)
|
||||
{
|
||||
@ -56,10 +50,10 @@ slider_state* bgfx_slider::create_core_slider(running_machine& machine)
|
||||
int size = sizeof(slider_state) + m_description.length();
|
||||
slider_state *state = reinterpret_cast<slider_state *>(auto_alloc_array_clear(machine, UINT8, size));
|
||||
|
||||
state->minval = m_min;
|
||||
state->defval = m_default;
|
||||
state->maxval = m_max;
|
||||
state->incval = m_step;
|
||||
state->minval = int32_t(floor(m_min / m_step + 0.5f));
|
||||
state->defval = int32_t(floor(m_default / m_step + 0.5f));
|
||||
state->maxval = int32_t(floor(m_max / m_step + 0.5f));
|
||||
state->incval = int32_t(floor(m_step / m_step + 0.5f));
|
||||
state->update = update_trampoline;
|
||||
state->arg = this;
|
||||
state->id = 0;
|
||||
@ -103,13 +97,13 @@ int32_t bgfx_slider::update(std::string *str, int32_t newval)
|
||||
float *val_ptr = reinterpret_cast<float *>(&m_value);
|
||||
if (newval != SLIDER_NOCHANGE)
|
||||
{
|
||||
*val_ptr = float(newval) * m_scale;
|
||||
*val_ptr = float(newval) * m_step;
|
||||
}
|
||||
if (str != nullptr)
|
||||
{
|
||||
*str = string_format(m_format, *val_ptr);
|
||||
}
|
||||
return int32_t(floor(*val_ptr / m_scale + 0.5f));
|
||||
return int32_t(floor(*val_ptr / m_step + 0.5f));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
SLIDER_SCREEN_TYPE_ANY = SLIDER_SCREEN_TYPE_RASTER | SLIDER_SCREEN_TYPE_VECTOR | SLIDER_SCREEN_TYPE_LCD
|
||||
};
|
||||
|
||||
bgfx_slider(running_machine& machine, std::string name, int32_t min, int32_t def, int32_t max, int32_t step, slider_type type, screen_type screen, float scale, std::string format, std::string description, std::vector<std::string>& strings);
|
||||
bgfx_slider(running_machine& machine, std::string name, float min, float def, float max, float step, slider_type type, screen_type screen, std::string format, std::string description, std::vector<std::string>& strings);
|
||||
~bgfx_slider();
|
||||
|
||||
int32_t update(std::string *str, int32_t newval);
|
||||
@ -60,16 +60,15 @@ public:
|
||||
|
||||
protected:
|
||||
slider_state* create_core_slider(running_machine &machine);
|
||||
int32_t as_int() const { return int32_t(floor(m_value + 0.5f)); }
|
||||
int32_t as_int() const { return int32_t(floor(m_value / m_step + 0.5f)); }
|
||||
|
||||
std::string m_name;
|
||||
int32_t m_min;
|
||||
int32_t m_default;
|
||||
int32_t m_max;
|
||||
int32_t m_step;
|
||||
float m_min;
|
||||
float m_default;
|
||||
float m_max;
|
||||
float m_step;
|
||||
slider_type m_type;
|
||||
screen_type m_screen_type;
|
||||
float m_scale;
|
||||
std::string m_format;
|
||||
std::string m_description;
|
||||
std::vector<std::string> m_strings;
|
||||
|
@ -43,10 +43,9 @@ std::vector<bgfx_slider*> slider_reader::read_from_value(const Value& value, std
|
||||
}
|
||||
|
||||
std::string name = value["name"].GetString();
|
||||
int step = value["step"].GetInt();
|
||||
float step = value["step"].GetFloat();
|
||||
bgfx_slider::slider_type type = bgfx_slider::slider_type(get_enum_from_value(value, "type", uint64_t(bgfx_slider::slider_type::SLIDER_FLOAT), TYPE_NAMES, TYPE_COUNT));
|
||||
bgfx_slider::screen_type screen_type = bgfx_slider::screen_type(get_enum_from_value(value, "screen", uint64_t(bgfx_slider::screen_type::SLIDER_SCREEN_TYPE_ANY), SCREEN_NAMES, SCREEN_COUNT));
|
||||
float scale = value["scale"].GetFloat();
|
||||
std::string format = value["format"].GetString();
|
||||
std::string description = value["text"].GetString();
|
||||
|
||||
@ -86,9 +85,9 @@ std::vector<bgfx_slider*> slider_reader::read_from_value(const Value& value, std
|
||||
std::string prefixed_desc = "Window " + std::to_string(window_index) + ", Screen " + std::to_string(screen_index) + ", " + description;
|
||||
if (slider_count > 1)
|
||||
{
|
||||
int min[3];
|
||||
int defaults[3];
|
||||
int max[3];
|
||||
float min[3];
|
||||
float defaults[3];
|
||||
float max[3];
|
||||
if (!READER_CHECK(value["min"].IsArray(), (prefix + "Slider '" + name + "': value 'min' must be an array\n").c_str())) return sliders;
|
||||
if (!READER_CHECK(value["default"].IsArray(), (prefix + "Slider '" + name + "': value 'default' must be an array\n").c_str())) return sliders;
|
||||
if (!READER_CHECK(value["max"].IsArray(), (prefix + "Slider '" + name + "': value 'max' must be an array\n").c_str())) return sliders;
|
||||
@ -114,27 +113,27 @@ std::vector<bgfx_slider*> slider_reader::read_from_value(const Value& value, std
|
||||
desc = prefixed_desc + "Invalid";
|
||||
break;
|
||||
}
|
||||
sliders.push_back(new bgfx_slider(machine, full_name, min[index], defaults[index], max[index], step, type, screen_type, scale, format, desc, strings));
|
||||
sliders.push_back(new bgfx_slider(machine, full_name, min[index], defaults[index], max[index], step, type, screen_type, format, desc, strings));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int min = get_int(value, "min", 0);
|
||||
int def = get_int(value, "default", 0);
|
||||
int max = get_int(value, "max", 100);
|
||||
sliders.push_back(new bgfx_slider(machine, name + "0", min, def, max, step, type, screen_type, scale, format, prefixed_desc, strings));
|
||||
float min = get_float(value, "min", 0.0f);
|
||||
float def = get_float(value, "default", 0.0f);
|
||||
float max = get_float(value, "max", 1.0f);
|
||||
sliders.push_back(new bgfx_slider(machine, name + "0", min, def, max, step, type, screen_type, format, prefixed_desc, strings));
|
||||
}
|
||||
return sliders;
|
||||
}
|
||||
|
||||
bool slider_reader::get_values(const Value& value, std::string prefix, std::string name, int* values, const int count)
|
||||
bool slider_reader::get_values(const Value& value, std::string prefix, std::string name, float* values, const int count)
|
||||
{
|
||||
const char* name_str = name.c_str();
|
||||
const Value& value_array = value[name_str];
|
||||
for (UINT32 i = 0; i < value_array.Size() && i < count; i++)
|
||||
{
|
||||
if (!READER_CHECK(value_array[i].IsInt(), (prefix + "Entry " + std::to_string(i) + " must be an integer\n").c_str())) return false;
|
||||
values[i] = value_array[i].GetInt();
|
||||
if (!READER_CHECK(value_array[i].IsNumber(), (prefix + "Entry " + std::to_string(i) + " must be a number point\n").c_str())) return false;
|
||||
values[i] = value_array[i].GetFloat();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -143,20 +142,18 @@ bool slider_reader::validate_parameters(const Value& value, std::string prefix)
|
||||
{
|
||||
if (!READER_CHECK(value.HasMember("name"), (prefix + "Must have string value 'name'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["name"].IsString(), (prefix + "Value 'name' must be a string\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("min"), (prefix + "Must have integer or array value 'min'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["min"].IsInt() || value["min"].IsArray(), (prefix + "Value 'min' must be an integer or an array the size of the corresponding slider type\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("default"), (prefix + "Must have integer or array value 'default'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["default"].IsInt() || value["default"].IsArray(), (prefix + "Value 'default' must be an integer or an array the size of the corresponding slider type\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("max"), (prefix + "Must have integer or array value 'max'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["max"].IsInt() || value["max"].IsArray(), (prefix + "Value 'max' must be an integer or an array the size of the corresponding slider type\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("step"), (prefix + "Must have integer value 'step'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["step"].IsInt(), (prefix + "Value 'step' must be an integer (how much does this slider increment by internally?)\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("min"), (prefix + "Must have a number or array value 'min'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["min"].IsNumber() || value["min"].IsArray(), (prefix + "Value 'min' must be a number or an array the size of the corresponding slider type\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("default"), (prefix + "Must have a number point or array value 'default'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["default"].IsNumber() || value["default"].IsArray(), (prefix + "Value 'default' must be a number point or an array the size of the corresponding slider type\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("max"), (prefix + "Must have a number point or array value 'max'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["max"].IsNumber() || value["max"].IsArray(), (prefix + "Value 'max' must be a number or an array the size of the corresponding slider type\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("step"), (prefix + "Must have a number point value 'step'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["step"].IsNumber(), (prefix + "Value 'step' must be a number (how much does this slider increment by internally?)\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("type"), (prefix + "Must have string value 'type'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["type"].IsString(), (prefix + "Value 'type' must be a string (what type of slider is this? [int_enum, int, float])\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("screen"), (prefix + "Must have string value 'screen'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["screen"].IsString(), (prefix + "Value 'screen' must be a string (what type of output device does this slider apply to? [none, raster, vector, crt, lcd, non_vector, any])\n").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("scale"), (prefix + "Must have numeric value 'scale'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["scale"].IsNumber(), (prefix + "Value 'scale' must be a number (what do we multiply with to get 1.0?)").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("format"), (prefix + "Must have string value 'format'\n").c_str())) return false;
|
||||
if (!READER_CHECK(value["format"].IsString(), (prefix + "Value 'scale' must be a string (how would we display it in a printf?)").c_str())) return false;
|
||||
if (!READER_CHECK(value.HasMember("text"), (prefix + "Must have string value 'text'\n").c_str())) return false;
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
static std::vector<bgfx_slider*> read_from_value(const Value& value, std::string prefix, running_machine& machine, uint32_t window_index, uint32_t screen_index);
|
||||
|
||||
private:
|
||||
static bool get_values(const Value& value, std::string prefix, std::string name, int* values, const int count);
|
||||
static bool get_values(const Value& value, std::string prefix, std::string name, float* values, const int count);
|
||||
static bool validate_parameters(const Value& value, std::string prefix);
|
||||
|
||||
static const int TYPE_COUNT = 5;
|
||||
|
@ -97,6 +97,15 @@ int state_reader::get_int(const Value& value, const std::string name, const int
|
||||
return default_value;
|
||||
}
|
||||
|
||||
float state_reader::get_float(const Value& value, const std::string name, const float default_value)
|
||||
{
|
||||
if (value.HasMember(name.c_str()))
|
||||
{
|
||||
return (float)value[name.c_str()].GetDouble();
|
||||
}
|
||||
return default_value;
|
||||
}
|
||||
|
||||
void state_reader::get_float(const Value& value, const std::string name, float* out, float* default_value, int count)
|
||||
{
|
||||
if (value.HasMember(name.c_str()))
|
||||
|
@ -36,6 +36,7 @@ protected:
|
||||
static void validate_boolean_parameter(const Value& value, std::string type_name, std::string name);
|
||||
|
||||
static bool get_bool(const Value& value, const std::string name, const bool default_value);
|
||||
static float get_float(const Value& value, const std::string name, float default_value);
|
||||
static void get_float(const Value& value, const std::string name, float* out, float* default_value, const int count = 1);
|
||||
static int get_int(const Value& value, const std::string name, int default_value);
|
||||
static std::string get_string(const Value& value, const std::string name, const std::string default_value);
|
||||
|
Loading…
Reference in New Issue
Block a user