bo3b / 3Dmigoto

Chiri's DX11 wrapper to enable fixing broken stereoscopic effects.
Other
788 stars 124 forks source link

Request: Delay for default type? #110

Closed chinagreenelvis closed 5 years ago

chinagreenelvis commented 5 years ago

Currently using the mod with Mad Max; with the HUD disabled, the map and menus also get disabled, so I have to bind those keys to switch the HUD back on. Since there isn't any easy way to switch it back off when entering game mode, I figured I could bind the run/drive key to turn it back off. However, I also have some buttons that temporarily bring the HUD back on and need to have it stay on while the run/drive key is pressed - so a delay option would be very helpful for default key types.

DarkStarSword commented 5 years ago

I'm not positive exactly what you are after from your description, but delays are already supported on all key types, e.g. all of these require the key to be held for half a second to activate:

[KeyDelayedActivate]
key = z
delay = 500
x10 = 1

[KeyDelayedHold]
key = x
type = hold
delay = 500
release_delay = 500
y10 = 1

[KeyDelayedCycle]
key = c
type = cycle
delay = 500
z10 = 0, 1, 2, 3, 4

You can also implement your own custom delay logic if this functionality is insufficient, e.g. to perform some action a certain time after a key has been pressed even if it was since released:

[Include]
; If you want to see the results of any of these live grab this from my 3d-fixes
; repository (custom_shader_cb_live_view) and use it to show IniParams:
; include = ShaderFixes\debug_cb.ini
[Constants]
; Resource\debug_cb\Buf = ref iniparams
global $b_activate_time
[KeyCustomDelayLogic]
key = b
run = CommandListCustomDelayLogicPress
[CommandListCustomDelayLogicPress]
$b_activate_time = time + 0.5    
[Present]
if $b_activate_time && time >= $b_activate_time
    $b_activate_time = 0
    x11 = x11 + 1
endif

e.g. an example implementing custom repeat logic:

[Constants]
global $n_down
global $n_last_time
[KeyCustomRepeatLogic]
key = n
type = hold
run = CommandListCustomRepeatLogic
[CommandListCustomRepeatLogic]
pre $n_down = 1
post $n_down = 0
[Present]
if $n_down && time >= $n_last_time + 1/12
    $n_last_time = time
    y11 = y11 + 1
endif

Closing ticket. If none of these examples solve your problem, please jump on https://discord.gg/tXHYhNK and ask for help in #shaderhacking or #3d-migoto. If you absolutely need some functionality that does not yet exist you can re-open the ticket, but please provide a clearer description of what you need.