winnitron / WinnitronLauncher

The official Winnitron launcher! The meat and potatoes of the Winnitron.
winnitron.com
MIT License
34 stars 7 forks source link

input issue in launched game #69

Closed hotcakesdeluxe closed 6 years ago

hotcakesdeluxe commented 7 years ago

having a weird issue. when i build my own version of the launcher/run it in unity editor the inputs on the launcher work fine but games launched from it need the shift key held down to use the same inputs. i downloaded the launcher build from here and that also works fine.

aaronklaassen commented 7 years ago

@spacebit Oh strange. You mean the zip file/build we packaged together works, but if you build it yourself it doesn't?

hotcakesdeluxe commented 7 years ago

yeah exactly. i re-cloned the project and it still does it. i thought it might be since i use InControl input manager but since it works in your build i'm a little lost. i know i had an issue where the build had trouble copying the options folder into the data, so i was copy pasting those in.

Ramifactor commented 7 years ago

I'm having this same issue, except I'm using the downloaded launcher (v2.1.0).

Everything works inside the Winnitron Launcher (navigating playlists & starting a game). The first room in the game I'm testing is a title screen that requires a button input (B1 or B2) to start it up. This also works fine. As soon as the actual game runs, no inputs work unless holding shift. The game is single player so the inputs are arrow keys, period and /.

This running on a Win10 desktop with keyboard input.

aaronklaassen commented 7 years ago

Hm. Okay. Thanks for the heads up - I'll take a look asap :+1:

@Ramifactor Which game? One from the website?

Ramifactor commented 7 years ago

Tested 3 or 4 different games and all have the same problem.

Examples: Earth:Water GenericSpaceShooter0815

aaronklaassen commented 6 years ago

@Ramifactor @spacebit I have to admit I'm having trouble replicating this bug - do either of you have any more details? Are you using any custom key maps for your Winnitrons, or is it all defaults? Uh, caps lock? (It shouldn't matter but who knows 😅) If non-default, seeing the keycodes section of your winnitron_options.json might help.

Could you replicate the bug, and paste in your WINNITRON/WINNITRON_Data/output_log.txt here? Also helpful might be a sample of a game's generated ahk and metadata files: RunGame.ahk and winnitron_metadata.json under WINNITRON_UserData/Playlists/playlist-name/game-title/.

I appreciate the help - if this is widespread it's obviously a pretty big deal, heh.

hotcakesdeluxe commented 6 years ago

this is my output_log Initialize engine version: 2017.1.0f3 (472613c02cf7) GfxDevice: creating device client; threaded=1 Direct3D: Version: Direct3D 11.0 [level 11.0] Renderer: NVIDIA GeForce GTX 870M (ID=0x1199) Vendor: NVIDIA VRAM: 3072 MB Driver: 22.21.13.8205 Begin MonoManager ReloadAssembly Platform assembly: C:\WINNITRON\PHILLYTRON4001_Data\Managed\UnityEngine.dll (this message is harmless) Loading C:\WINNITRON\PHILLYTRON4001_Data\Managed\UnityEngine.dll into Unity Child Domain Platform assembly: C:\WINNITRON\PHILLYTRON4001_Data\Managed\Assembly-CSharp-firstpass.dll (this message is harmless) Loading C:\WINNITRON\PHILLYTRON4001_Data\Managed\Assembly-CSharp-firstpass.dll into Unity Child Domain Platform assembly: C:\WINNITRON\PHILLYTRON4001_Data\Managed\Assembly-CSharp.dll (this message is harmless) Loading C:\WINNITRON\PHILLYTRON4001_Data\Managed\Assembly-CSharp.dll into Unity Child Domain Platform assembly: C:\WINNITRON\PHILLYTRON4001_Data\Managed\UnityEngine.UI.dll (this message is harmless) Loading C:\WINNITRON\PHILLYTRON4001_Data\Managed\UnityEngine.UI.dll into Unity Child Domain Platform assembly: C:\WINNITRON\PHILLYTRON4001_Data\Managed\UnityEngine.Networking.dll (this message is harmless) Loading C:\WINNITRON\PHILLYTRON4001_Data\Managed\UnityEngine.Networking.dll into Unity Child Domain Platform assembly: C:\WINNITRON\PHILLYTRON4001_Data\Managed\UnityEngine.Timeline.dll (this message is harmless) Loading C:\WINNITRON\PHILLYTRON4001_Data\Managed\UnityEngine.Timeline.dll into Unity Child Domain Platform assembly: C:\WINNITRON\PHILLYTRON4001_Data\Managed\ICSharpCode.SharpZipLib.dll (this message is harmless) Loading C:\WINNITRON\PHILLYTRON4001_Data\Managed\ICSharpCode.SharpZipLib.dll into Unity Child Domain Platform assembly: C:\WINNITRON\PHILLYTRON4001_Data\Managed\System.dll (this message is harmless) Platform assembly: C:\WINNITRON\PHILLYTRON4001_Data\Managed\System.Core.dll (this message is harmless)

Input initialized. Initialized touch support. UnloadTime: 1.477608 ms INFO -- 10/2/2017 11:28:25 AM -- ##### VERSION 2.0.0 ##### (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:25 AM -- DEFAULT OPTIONS PATH:C:/WINNITRON/PHILLYTRON4001_Data\Options (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:25 AM -- reading userdata location from C:/WINNITRON/PHILLYTRON4001_Data\Options\winnitron_userdata_path.json (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:25 AM -- DATA PATH:C:/WINNITRON_UserData (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:25 AM -- CONFIGURED OPTIONS PATH:C:/WINNITRON_UserData\Options (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:25 AM -- Loading options from C:/WINNITRON_UserData\Options\winnitron_options.json (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:25 AM -- GAME: Loading custom screenshot C:\WINNITRON_UserData\Playlists\_PhillyTron\beatboxing\beatboxing.png (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Create scripts for game Beat Boxing (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Writing file C:\WINNITRON_UserData\Playlists\_PhillyTron\beatboxing\RunGame.ahk (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Loading default screenshot (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Create scripts for game DFA 1979 (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Writing file C:\WINNITRON_UserData\Playlists\_PhillyTron\deathfromabove\RunGame.ahk (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Loading default screenshot (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Create scripts for game Space Shooter (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Writing file C:\WINNITRON_UserData\Playlists\_PhillyTron\spaceshooter\RunGame.ahk (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Loading custom screenshot C:\WINNITRON_UserData\Playlists\_PhillyTron\The Sky Is Falling\TheSkyIsFalling.png (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- Determined EXE! (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Create scripts for game The Sky Is Falling (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51) INFO -- 10/2/2017 11:28:26 AM -- GAME: Writing file C:\WINNITRON_UserData\Playlists\_PhillyTron\The Sky Is Falling\RunGame.ahk (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
hotcakesdeluxe commented 6 years ago

sorry also here is my RunGame.ahk ; DEFAULT RUN SCRIPT

Persistent

MaxHotkeysPerInterval 200

SingleInstance Force

debug := true

executable := "C:\WINNITRON_UserData\Playlists_PhillyTron\beatboxing\beatboxing.exe" exec_file := "beatboxing.exe" game_name := "Beat Boxing" forceQuitHoldTime := 3000 idleLimit := 180000 initialWait := 30000

start := SecondsToday() WriteLog("START ---------------- " . A_Now)

SetTitleMatchMode, 2

; RUN THE GAME Run, %executable%, , , process_id_1 WriteLog("Launched " . executable . " with pid " . process_id_1)

SetTimer, InitialWait, -%initialWait% ; negative period disables timer after first trigger MouseMove 3000, 3000, 0

; This is the function that quits the game (hopefully) KillApp() { global process_id_1 global process_id_2

WriteLog("Killing app with pids " . process_id_1 . " and " . process_id_2)

; Nuke the site from orbit. SOMETHING should work....

WinKill, ahk_exe %executable% ; Tries to close using .exe WinKill, ahk_exe %exec_file%

WinKill, ahk_pid process_id_2 ; Tries to close using process id WinKill, ahk_pid process_id_1

WinKill, %game_name%

Run, TaskKill /f /pid %process_id_2% Run, TaskKill /f /pid %process_id_1% Run, TaskKill /f /im %exec_file%

SetTitleMatchMode, RegEx IfWinExist, i)WinnitronLauncher { WriteLog("winnitron window id " . WinExist("A")) WinActivate, i)WinnitronLauncher WinWaitActive, i)WinnitronLauncher, , 2 PostMessage, 0x112, 0xF030,,, i)WinnitronLauncher ; 0x112 = WM_SYSCOMMAND, 0xF030 = SC_MAXIMIZE } else { WriteLog("couldn't find winnitron window") }

ExitApp }

Loop { ; Ensure that the AHK script exits when the game does, because it's this ; process that the Launcher is watching so it knows when to wake up and ; kick back to menu. Process, Exist, %process_id_1% if (ErrorLevel == 0) { WriteLog("detected game not running") KillApp() }

}

InitialWait: ; Some games launch a second process WinGet, process_id_2, PID, %game_name%

WriteLog("Completed initial wait (pid2: " . process_id_2 . ")")

SetTimer, CloseOnIdle, % idleLimit+150 return

; This is the timer CloseOnIdle: if (A_TimeIdle >= idleLimit) { WriteLog("Idle timeout!") KillApp() SetTimer,CloseOnIdle, Off } else { SetTimer,CloseOnIdle, % idleLimit-A_TimeIdle+150 } return

; Do this stuff when Esc is pressed ~Esc:: If escIsPressed return escIsPressed := true SetTimer, WaitForESCRelease, %forceQuitHoldTime% return

; Do this stuff when Esc is UP ~Esc Up:: SetTimer, WaitForESCRelease, Off escIsPressed := false return

WaitForESCRelease: SetTimer, WaitForESCRelease, Off KillApp() return

; DEBUGGING STUFF

; Number of seconds since midnight. SecondsToday() { return A_Hour 3600 + A_Min 60 + A_Sec }

WriteLog(message) { global debug global start

if (debug) { runningTimeSec := SecondsToday() - start debugLog := "ahk_output.txt" FileAppend, ( %runningTimeSec%s %A_Tab% %message%

), %debugLog%, UTF-8

} }

; KEYMAPS BELOW Up::return Down::return Left::return Right::return .::return /::return w::return s::return a::return d::return `::return 1::return i::return k::return j::return l::return g::return h::return Numpad8::return Numpad5::return Numpad4::return Numpad6::return Numpad1::return Numpad2::return

Ramifactor commented 6 years ago

Please see below. Everything is default to my knowledge.

output_log.txt RunGame.ahk.txt winnitron_metadata.json.txt winnitron_options.json.txt

Notes / Updates: The game I'm testing here is Earth:Water. I can navigate the Winnitron launcher using the controls, but as soon as the game launches, either Shift, Alt or Ctrl must be held in order to recognize the inputs.

Note that this only appears to apply to the keys on the Winnitron layout (arrow keys, period, /, WASD, etc.). Other keys appear to be recognized without having to hold Shift/Alt/Ctrl. For example, Earth:Water can be controlled with Z and X and these work fine.

Finally, the Esc key works regardless of whether or not Shift/Alt/Ctrl is held.

aaronklaassen commented 6 years ago

Craziness. Thanks a lot for the extra info.

hotcakesdeluxe commented 6 years ago

Hey not to be a bother but did you ever get a chance to look at this? Is there anything else I can do to help? right now i'm resting a C battery on my keyboard inside the cabinet to hold shift down.

aaronklaassen commented 6 years ago

@spacebit Hah oh my god that is both hilarious and terrible.

Sorry this took a while - I was have a hell of a time replicating this bug, but coming back to it, the problem was staring me in the face (ain't that always the way). I'm not sure exactly what's causing this yet, but it looks like the key remapping doesn't get written to the AHK file properly if the games winnitron_metadata.json is missing explicit keybindings. e.g., if it looks like this:

{
  "title":"Sumo Topplers",
  // ...
  "keys": {
    "template": "legacy"
  }
}

instead of like this:

{
  "title":"Sumo Topplers",
  // ...
  "keys": {
    "template": "legacy"
    "bindings": {
      "1": {
        "up":"Up",
        "down":"Down",
        // ...
        }
    }
  }
}

Both should be valid - that's the bug. So! Now I know what the problem is, which means a fix is right around the corner. :+1: Thanks for the patience here, folks.

hotcakesdeluxe commented 6 years ago

awesome thanks so much Aaron, you're the best!

aaronklaassen commented 6 years ago

@spacebit I haven't put together an official release quite yet, but if you want to build it yourself, you can pull down master (v2.2.1).