Last active
March 7, 2025 04:56
-
-
Save diogotito/5bd84642bf7e511fe7af85013f133ce9 to your computer and use it in GitHub Desktop.
Mednafen per-game override configuration for Layer Section AKA Rayforce AKA Galactic Attack AKA Gunlock for the SEGA Saturn, with custom DualShock 4 mappings for ergonomic in-game controls and save scumming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;;;;;;;;;;;;;;;;;; | |
| ;; == Visuals == ;; | |
| ;;;;;;;;;;;;;;;;;;; | |
| ; Stretch to fill screen. | |
| ; Default: aspect_mult2 - Aspect Preserve + Integer Multiple-of-2 Scale | |
| ; aspect_int - Aspect Preserve + Integer Scale: Full-screen stretch, same as "aspect" except that the equivalent xscalefs and yscalefs are rounded down to the nearest integer. | |
| ss.stretch aspect_int | |
| ;Enable scanlines with specified opacity. (0 makes them invisible) | |
| ss.scanlines 0 | |
| ;Taste the pixel art | |
| ; ss.special nn3x | |
| ss.shader autoipsharper | |
| ;;;;;;;;;;;;;;;;; | |
| ;; == Input == ;; | |
| ;;;;;;;;;;;;;;;;; | |
| ; Analog axis binary press detection threshold. | |
| ; Threshold for detecting a digital-like "button" press on analog axis, in percent. | |
| ; 0 through 100, default = 75 | |
| ; NOTE: This doesn't seem to change anything, so I'll have to resort to finding a [SCALE] value for abs_[01][-+] below | |
| input.joystick.axis_threshold 10 | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; === DualShock 4 controls === ;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ; My DS4's ID: 0x05c4054c000000000000504944564944 | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ; button_0 --> □ | |
| ; button_1 --> x | |
| ; button_2 --> ○ | |
| ; button_3 --> △ | |
| ; button_4 --> [L1] | |
| ; button_5 --> [R1] | |
| ; button_6 --> \L2/ | |
| ; button_7 --> \R2/ | |
| ; button_8 --> SHARE | |
| ; button_9 --> OPTIONS | |
| ; button_10 --> (L3) | |
| ; button_11 --> (R3) | |
| ; button_12 --> PS button | |
| ; button_13 --> touchpad | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ; abs_0- --> left stick ← | |
| ; abs_0+ --> left stick → | |
| ; abs_1- --> left stick ↑ | |
| ; abs_1+ --> left stick ↓ | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ; abs_2- --> right stick ← | |
| ; abs_2+ --> right stick → | |
| ; abs_5- --> right stick ↑ | |
| ; abs_5+ --> right stick ↓ | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ; abs_6- --> d-pad ← | |
| ; abs_6+ --> d-pad → | |
| ; abs_7- --> d-pad ↑ | |
| ; abs_7+ --> d-pad ↓ | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;ss, Virtual Port 1, Digital Gamepad: A -- SHOOT -- PlayStation SQUARE □ or R2 | |
| ss.input.port1.gamepad.a joystick 0x05c4054c000000000000504944564944 button_0 || joystick 0x05c4054c000000000000504944564944 button_7 | |
| ;ss, Virtual Port 1, Digital Gamepad: B -- LASER -- PlayStation CROSS x or CIRCLE ○ or TRIANGLE △ or R1 or L1 or L2 | |
| ; joystick 0x05c4054c000000000000504944564944 abs_4- | |
| ss.input.port1.gamepad.b joystick 0x05c4054c000000000000504944564944 button_1 || joystick 0x05c4054c000000000000504944564944 button_2 || joystick 0x05c4054c000000000000504944564944 button_3 || joystick 0x05c4054c000000000000504944564944 button_5 || joystick 0x05c4054c000000000000504944564944 button_4 || joystick 0x05c4054c000000000000504944564944 button_6 | |
| ; [8 CREDITS CHEAT] Make my DS4's touchpad press L R Left C START simultaneously | |
| ss.input.port1.gamepad.ls joystick 0x05c4054c000000000000504944564944 button_13 | |
| ss.input.port1.gamepad.rs joystick 0x05c4054c000000000000504944564944 button_13 | |
| ss.input.port1.gamepad.c joystick 0x05c4054c000000000000504944564944 button_13 | |
| ; ------------------------- "joystick" DEVICE_ID DEVICE_INPUT [SCALE] [LOGIC] [...] | |
| ; [SCALE] is a 4.12 fixed point number (4 bits for the integer part, 12 bits for the fractional part) | |
| ; written as an unsigned 16-bit integer (`u16` in Rust) in this configuration file (0-65535, with 1 corresponding to ~0.0244%) | |
| ; Useful values | |
| ; 0.50 --> 0000.1000 0000 0000 --> 2048 | |
| ; 1.00 --> 0001.0000 0000 0000 --> 4096 (default) | |
| ; 2.00 --> 0010.0000 0000 0000 --> 8192 | |
| ; 2.50 --> 0010.1000 0000 0000 --> 10240 (what I'm using below right now) | |
| ; 4.00 --> 0100.0000 0000 0000 --> 16384 | |
| ; 8.00 --> 1000.0000 0000 0000 --> 32768 | |
| ; Tip: Look for a "Programmer" mode with a bit toggling keypad in your desktop's Calculator app (if it has any) | |
| ;ss, Virtual Port 1, Digital Gamepad: UP ↑ | |
| ss.input.port1.gamepad.up joystick 0x05c4054c000000000000504944564944 abs_1- 10240 || joystick 0x05c4054c000000000000504944564944 abs_7- | |
| ;ss, Virtual Port 1, Digital Gamepad: DOWN ↓ | |
| ss.input.port1.gamepad.down joystick 0x05c4054c000000000000504944564944 abs_1+ 10240 || joystick 0x05c4054c000000000000504944564944 abs_7+ | |
| ;ss, Virtual Port 1, Digital Gamepad: LEFT ← (also used for 8 credits cheat) | |
| ss.input.port1.gamepad.left joystick 0x05c4054c000000000000504944564944 abs_0- 10240 || joystick 0x05c4054c000000000000504944564944 abs_6- || joystick 0x05c4054c000000000000504944564944 button_13 | |
| ;ss, Virtual Port 1, Digital Gamepad: RIGHT → | |
| ss.input.port1.gamepad.right joystick 0x05c4054c000000000000504944564944 abs_0+ 10240 || joystick 0x05c4054c000000000000504944564944 abs_6+ | |
| ;ss, Virtual Port 1, Digital Gamepad: START (also used for 8 credits cheat) | |
| ss.input.port1.gamepad.start joystick 0x05c4054c000000000000504944564944 button_9 || joystick 0x05c4054c000000000000504944564944 button_13 | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; === Command bindings to DS4 === ;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;Advance frame | |
| command.advance_frame keyboard 0x0 4+alt | |
| ;Return to normal mode after advancing frames | |
| command.run_normal keyboard 0x0 21+alt | |
| ;Insert coin | |
| command.insert_coin keyboard 0x0 65 | |
| ;Pause/Unpause | |
| command.pause keyboard 0x0 72 | |
| ;Reset | |
| command.reset keyboard 0x0 67 | |
| ;Save state F5 PS button + [R1] | |
| command.save_state keyboard 0x0 62 || joystick 0x05c4054c000000000000504944564944 button_12 && joystick 0x05c4054c000000000000504944564944 button_5 | |
| ;Load state F7 PS button + [L1] | |
| command.load_state keyboard 0x0 64 || joystick 0x05c4054c000000000000504944564944 button_12 && joystick 0x05c4054c000000000000504944564944 button_4 | |
| ;Decrease selected save state slot by 1 PS button + d-pad left | |
| command.state_slot_dec keyboard 0x0 45 || joystick 0x05c4054c000000000000504944564944 button_12 && joystick 0x05c4054c000000000000504944564944 abs_6- | |
| ;Increase selected save state slot by 1 PS button + d-pad right | |
| command.state_slot_inc keyboard 0x0 46 || joystick 0x05c4054c000000000000504944564944 button_12 && joystick 0x05c4054c000000000000504944564944 abs_6+ | |
| ;Take scaled(and filtered) screen snapshot | |
| command.take_scaled_snapshot keyboard 0x0 66+shift || joystick 0x05c4054c000000000000504944564944 button_8 &! joystick 0x05c4054c000000000000504944564944 button_12 | |
| ;Take screen snapshot | |
| command.take_snapshot keyboard 0x0 66 || joystick 0x05c4054c000000000000504944564944 button_12 && joystick 0x05c4054c000000000000504944564944 button_8 | |
| ;Rotate screen Alt+O PS button + ○ | |
| command.rotate_screen keyboard 0x0 18+alt || joystick 0x05c4054c000000000000504944564944 button_12 && joystick 0x05c4054c000000000000504944564944 button_2 | |
| ;Toggle state rewind functionality Alt+S PS button + △ | |
| command.toggle_state_rewind keyboard 0x0 22+alt || joystick 0x05c4054c000000000000504944564944 button_12 && joystick 0x05c4054c000000000000504944564944 button_3 | |
| ;Rewind Backspace PS button + [L2] right stick ← | |
| command.state_rewind keyboard 0x0 42 || joystick 0x05c4054c000000000000504944564944 button_12 && joystick 0x05c4054c000000000000504944564944 button_6 || joystick 0x05c4054c000000000000504944564944 abs_2- | |
| ;Fast-forward ` PS button + [R2] right stick → | |
| command.fast_forward keyboard 0x0 53 || joystick 0x05c4054c000000000000504944564944 button_12 && joystick 0x05c4054c000000000000504944564944 button_7 || joystick 0x05c4054c000000000000504944564944 abs_2+ | |
| ;Slow-forward \ right stick ↓ | |
| command.slow_forward keyboard 0x0 49 || joystick 0x05c4054c000000000000504944564944 abs_5+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %YAML 1.2 | |
| --- | |
| # See http://www.sublimetext.com/docs/3/syntax.html | |
| name: Mednafen configuration | |
| version: 2 | |
| file_extensions: | |
| - cfg | |
| scope: source.mednafen-cfg | |
| variables: | |
| systems: apple2|lynx|cdplay|gb|gba|ngp|nes|pce|pce_fast|pcfx|sasplay|gg|md|sms|ss|ssfplay|psx|snes|snes_faust|vb|wswan | |
| DEVICE_TYPE: '\b(?:3dpad|dmission|gamepad|gun|gun_chairs|joystick|jpkeyboard|keyboard|mission|mouse|wheel)\b' | |
| DEVICE_ID: '\b0x[0-9a-fA-F]+\b' | |
| input_buttons: '\bbutton_\d+|\babs_\d+[-+]{,2}g?|\b(?:a|b|c|x|y|z|ls|rs|up|down|left|right|start)\b' | |
| input_keys: '\b\d+(?:\+(?:ctrl|alt|shift))*\b' | |
| input_mouse: '(?:cursor|rel)_(?:x|y)(?:-|+|-+|+-)|button_(?:left|middle|right|x1|x2|\d{1,2})' | |
| DEVICE_INPUT: '{{input_buttons}}|{{input_keys}}|{{input_mouse}}' | |
| contexts: | |
| # The prototype context is prepended to all contexts but those setting | |
| # meta_include_prototype: false. | |
| prototype: | |
| - include: comments | |
| main: | |
| # The main context is the initial starting point of our syntax. | |
| # Include other contexts from here (or specify them directly). | |
| - include: mapping | |
| mapping: | |
| - match: ^(?=\S) | |
| push: | |
| - key-meta | |
| - key-identifier | |
| key-meta: | |
| - meta_scope: meta.mapping.key.mednafen-cfg # meta.path.mednafen-cfg | |
| - match: '' | |
| set: separator | |
| key-identifier: | |
| - meta_scope: entity.name.class.mednafen-cfg | |
| - match: '{{systems}}' | |
| scope: entity.name.namespace.mednafen-cfg | |
| - match: '{{DEVICE_INPUT}}' | |
| scope: entity.name.constant.mednafen-cfg | |
| - match: '[^\s.]+' | |
| scope: entity.name.type.mednafen-cfg | |
| - match: \. | |
| scope: punctuation.separator.namespace.mednafen-cfg | |
| - match: (?=\s) | |
| pop: true | |
| separator: | |
| - meta_scope: meta.mapping.mednafen-cfg | |
| - match: \s+ | |
| scope: punctuation.separator.key-value.mednafen-cfg | |
| - match: '' | |
| set: value | |
| value: | |
| - meta_scope: meta.mapping.value.mednafen-cfg | |
| - include: button-names | |
| - include: logic | |
| - include: numbers | |
| - include: bare-string | |
| - match: '$\n' | |
| pop: true | |
| button-names: | |
| - match: '({{DEVICE_TYPE}}\s+{{DEVICE_ID}})\s+({{DEVICE_INPUT}})' | |
| captures: | |
| 1: variable.other.constant.mednafen-cfg | |
| 2: entity.name.constant.mednafen-cfg | |
| logic: | |
| - match: '(\|\||&&|&!)' | |
| scope: keyword.operator.logical.js | |
| numbers: | |
| - match: '\b(-)?[0-9.]+\b' | |
| scope: constant.numeric.mednafen-cfg | |
| bare-string: | |
| - match: \S+ | |
| scope: string.unquoted.mednafen-cfg | |
| comments: | |
| # Comments begin with a ';' and finish at the end of the line. | |
| - match: ';' | |
| scope: punctuation.definition.comment.mednafen-cfg | |
| push: | |
| # This is an anonymous context push for brevity. | |
| - meta_scope: comment.line.semi-colon.mednafen-cfg | |
| - match: '((={2,})\s+(.*)\s+(\2))' | |
| captures: | |
| 1: meta.toc-list.mednafen-cfg | |
| 2: punctuation.definition.heading.begin.mednafen-cfg | |
| 3: markup.heading | |
| 4: punctuation.definition.heading.end.mednafen-cfg | |
| - match: $\n? | |
| pop: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment