jpdante / UE4-JoyConDriver

Unreal Engine 4/5 Nintendo Switch Joy Con Driver
BSD 3-Clause "New" or "Revised" License
41 stars 8 forks source link

Editor Crash when using the Plugin #2

Closed YukiTaiyo closed 4 years ago

YukiTaiyo commented 4 years ago

Thanks so much for this cool Plugin.

I'm encountering Crashes when using it (I'm using unreal 4.24.1). It happens a few seconds after opening the project and pressing Play. I have to say I didn't convert my Project into C++ as suggested in the Getting Started section as I don't know how to do this ; nor opened my project in Visual Studio.

Here's the Crash log :

Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformMemory.cpp] [Line: 186] Ran out of memory allocating 252 bytes with alignment 0

UE4Editor_Core UE4Editor_Core UE4Editor_Core UE4Editor_Core UE4Editor_Core UE4Editor_JoyConDriver!FJoyConInformation::FJoyConInformation() UE4Editor_JoyConDriver!FJoyConInput::SearchJoyCons() [C:\Users\Yuki\Documents\Unreal Projects\ProjectName\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConInput.cpp:182] UE4Editor_JoyConDriver!FJoyConDriverModule::SearchForJoyCons() [C:\Users\Yuki\Documents\Unreal Projects\ProjectName\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConDriverModule.cpp:16] UE4Editor_JoyConDriver!UJoyConDriverFunctionLibrary::SearchForJoyCons() [C:\Users\Yuki\Documents\Unreal Projects\ProjectName\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConDriverFunctionLibrary.cpp:60] UE4Editor_JoyConDriver!UJoyConDriverFunctionLibrary::execSearchForJoyCons() [C:\Users\Yuki\Documents\Unreal Projects\ProjectName\Plugins\JoyConDriver\Source\JoyConDriver\Public\JoyConDriverFunctionLibrary.h:16] UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_Engine UE4Editor_Engine UE4Editor_Engine UE4Editor_Engine UE4Editor_Engine UE4Editor_Engine UE4Editor_Engine UE4Editor_UnrealEd UE4Editor_UnrealEd UE4Editor_UnrealEd UE4Editor_UnrealEd UE4Editor_UnrealEd UE4Editor UE4Editor UE4Editor UE4Editor UE4Editor kernel32 ntdll

Also, Joycons sticks are set into the wrong category in the Inputs tab (under Keyboard).

jpdante commented 4 years ago

Hello, first thanks for alerting me about the category of sticks in the input tab of the project settings. I've already made a fix for this.

I recommend that if possible, update your Unreal Engine to the latest version 4.25.3, I have not done any tests in previous versions so I cannot say if this could be a problem with the old version.

If possible try to use one of the releases I published. Just unzip the file inside the "plugins" folder of your Unreal Engine. https://github.com/jpdante/UE4-JoyConDriver/releases/tag/v0.1-alpha

If any other problems occur you can ask for help right here so I can take a look.

YukiTaiyo commented 4 years ago

Hello,

So I updated my UE4 version to 4.25 and updated the Plugin too in my project's folder. I still have crashes when pressing Play a second time (Editor freezes for a minute and shuts off).

Crash log related to the plugin :

UE4Editor_JoyConDriver!TArray<FJoyConInformation,TSizedDefaultAllocator<32> >::ResizeGrow() [C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Core\Public\Containers\Array.h:2539] UE4Editor_JoyConDriver!FJoyConInput::SearchJoyCons() [C:\Users\Yuki\Documents\Unreal Projects\ProjectName\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConInput.cpp:182] UE4Editor_JoyConDriver!FJoyConDriverModule::SearchForJoyCons() [C:\Users\Yuki\Documents\Unreal Projects\ProjectName\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConDriverModule.cpp:16] UE4Editor_JoyConDriver!UJoyConDriverFunctionLibrary::SearchForJoyCons() [C:\Users\Yuki\Documents\Unreal Projects\ProjectName\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConDriverFunctionLibrary.cpp:54] UE4Editor_JoyConDriver!UJoyConDriverFunctionLibrary::execSearchForJoyCons() [C:\Users\Yuki\Documents\Unreal Projects\ProjectName\Plugins\JoyConDriver\Intermediate\Build\Win64\UE4Editor\Inc\JoyConDriver\JoyConDriverFunctionLibrary.gen.cpp:105]

jpdante commented 4 years ago

Hmm ... This error seems strange because I see no reason for it to exist. I wonder if there could be a problem with your project? Could you try to follow the steps below and see if any work for you?

Using an already compiled version

  1. Download one of the versions available at: https://github.com/jpdante/UE4-JoyConDriver/releases/tag/v0.1-alpha (UE4-JoyConDriver-4.24.3.zip or UE4-JoyConDriver-4.25.3.zip)
  2. Extract the zip in your Unreal Engine's plugins folder (Usually located in: C:\Program Files\Epic Games\UE_4.25\Engine\Plugins)
  3. Open Unreal Engine and create a new project
  4. Enable the plugin on Unreal Engine Top Menu -> Edit -> Plugins Side Menu -> Built-In -> Input Devices -> Nintendo Switch JoyCon Driver -> Enabled(Checkbox) -> Restart Unreal Engine
  5. Have fun ?

Compiling the plugin manually

  1. Clone or Download the repository
  2. Open the project folder
  3. Right click on JoyConSample.uproject
  4. Select "Generate Visual Studio project files"
  5. Open the project by double clicking on JoyConSample.uproject
  6. Unreal Engine will ask if you would like to compile the project, click yes.
  7. Have fun ?

Could you also send me a screenshot of the commands you are calling on the blueprint? (and also where they are being called aka: Level Blueprint, Player and so on)

YukiTaiyo commented 4 years ago

The Blueprint setup I use is the same as you show in the Getting Started page (ConnectExample image)

https://i.ibb.co/mqZd2g0/Joycon-Setup.png

Here's what I've tried :

1) Placing the JoyConDriver folder in the Engine's Plugin folder and try again in my existing project (which also have the JoyConDriver folder in it's Plugin folder).

Fatal error!

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION writing address 0x00000008

0x00007ffe119624e7 UE4Editor-JoyConDriver.dll!hid_set_nonblocking() [C:\Users\jpdante\Documents\Unreal Projects\JoyConSample\Plugins\JoyConDriver\Source\JoyConDriver\Private\hid.c:758] 0x00007ffe11954ada UE4Editor-JoyConDriver.dll!FJoyConInput::ConnectJoyCon() [C:\Users\jpdante\Documents\Unreal Projects\JoyConSample\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConInput.cpp:242] 0x00007ffe11954929 UE4Editor-JoyConDriver.dll!FJoyConDriverModule::ConnectJoyCon() [C:\Users\jpdante\Documents\Unreal Projects\JoyConSample\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConDriverModule.cpp:28] 0x00007ffe11954dcc UE4Editor-JoyConDriver.dll!UJoyConDriverFunctionLibrary::ConnectJoyCon() [C:\Users\jpdante\Documents\Unreal Projects\JoyConSample\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConDriverFunctionLibrary.cpp:14] 0x00007ffe11960af3 UE4Editor-JoyConDriver.dll!UJoyConDriverFunctionLibrary::execConnectJoyCon() [C:\Users\jpdante\Documents\Unreal Projects\JoyConSample\Plugins\JoyConDriver\Intermediate\Build\Win64\UE4Editor\Inc\JoyConDriver\JoyConDriverFunctionLibrary.gen.cpp:146] 0x00007ffe4a70a635 UE4Editor-CoreUObject.dll!UnknownFunction [] 0x00007ffe4a6e574d UE4Editor-CoreUObject.dll!UnknownFunction [] 0x00007ffe4a6b3bea UE4Editor-CoreUObject.dll!UnknownFunction [] 0x00007ffe4a6e5392 UE4Editor-CoreUObject.dll!UnknownFunction [] 0x00007ffe4a6e574d UE4Editor-CoreUObject.dll!UnknownFunction [] 0x00007ffe4a6e4c54 UE4Editor-CoreUObject.dll!UnknownFunction [] 0x00007ffe4a470ae4 UE4Editor-CoreUObject.dll!UnknownFunction [] 0x00007ffe4a6e4783 UE4Editor-CoreUObject.dll!UnknownFunction [] 0x00007ffe3109a025 UE4Editor-Engine.dll!UnknownFunction [] 0x00007ffe310647db UE4Editor-Engine.dll!UnknownFunction [] 0x00007ffe310702fc UE4Editor-Engine.dll!UnknownFunction [] 0x00007ffe32317fdd UE4Editor-Engine.dll!UnknownFunction [] 0x00007ffe31752181 UE4Editor-Engine.dll!UnknownFunction [] 0x00007ffe322c247e UE4Editor-Engine.dll!UnknownFunction [] 0x00007ffe31773519 UE4Editor-Engine.dll!UnknownFunction [] 0x00007ffe36eb3e9c UE4Editor-UnrealEd.dll!UnknownFunction [] 0x00007ffe36ed4d6c UE4Editor-UnrealEd.dll!UnknownFunction [] 0x00007ffe36eb4dd9 UE4Editor-UnrealEd.dll!UnknownFunction [] 0x00007ffe36ef08fa UE4Editor-UnrealEd.dll!UnknownFunction [] 0x00007ffe36ef3bbd UE4Editor-UnrealEd.dll!UnknownFunction [] 0x00007ffe36ef3598 UE4Editor-UnrealEd.dll!UnknownFunction [] 0x00007ffe3697a854 UE4Editor-UnrealEd.dll!UnknownFunction [] 0x00007ffe37251d06 UE4Editor-UnrealEd.dll!UnknownFunction [] 0x00007ff687537800 UE4Editor.exe!UnknownFunction [] 0x00007ff68754ba7c UE4Editor.exe!UnknownFunction [] 0x00007ff68754bb5a UE4Editor.exe!UnknownFunction [] 0x00007ff68755e31d UE4Editor.exe!UnknownFunction [] 0x00007ff68756145a UE4Editor.exe!UnknownFunction [] 0x00007ffe960f7bd4 KERNEL32.DLL!UnknownFunction [] 0x00007ffe97ccce51 ntdll.dll!UnknownFunction []

2) Creating a new project and use the same Blueprint setup with the First Person Example Blueprint.

3) Compiling the plugin manually and use the JoyConSample project as you suggested.

UE4Editor_JoyConDriver!TArray<FJoyConInformation,TSizedDefaultAllocator<32> >::ResizeGrow() [C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Core\Public\Containers\Array.h:2539] UE4Editor_JoyConDriver!FJoyConInput::SearchJoyCons() [C:\Users\jpdante\Documents\Unreal Projects\JoyConSample\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConInput.cpp:182] UE4Editor_JoyConDriver!FJoyConDriverModule::SearchForJoyCons() [C:\Users\jpdante\Documents\Unreal Projects\JoyConSample\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConDriverModule.cpp:16] UE4Editor_JoyConDriver!UJoyConDriverFunctionLibrary::SearchForJoyCons() [C:\Users\jpdante\Documents\Unreal Projects\JoyConSample\Plugins\JoyConDriver\Source\JoyConDriver\Private\JoyConDriverFunctionLibrary.cpp:54] UE4Editor_JoyConDriver!UJoyConDriverFunctionLibrary::execSearchForJoyCons() [C:\Users\jpdante\Documents\Unreal Projects\JoyConSample\Plugins\JoyConDriver\Intermediate\Build\Win64\UE4Editor\Inc\JoyConDriver\JoyConDriverFunctionLibrary.gen.cpp:105]

What I understand so far :

jpdante commented 4 years ago

I think I understand the reason for the crashes, I probably forgot to update the documentation and include that it was extremely necessary to detach and disconnect the JoyCons before making a new connection, otherwise a conflict occurs and crashes the engine.

Technically this should have been fixed, but there were some errors in the code that checked this. I just updated the code, it fixes the crashes and added a new node that resumes the JoyCons without having to reconnect them every time. (https://github.com/jpdante/UE4-JoyConDriver/wiki/Blueprint-Functions#resume-joy-con-connection)

Possibly it may be that the GripMode is set up wrong, I didn't document much about it because I'm still experimenting with it, there is a command called "Set Joy Con Grip Mode", it controls whether the controls will be inverted to play in GamePad mode (left and right JoyCons together) or separated in portrait or landscape mode. Depending on the configuration, the buttons may change. (https://github.com/jpdante/UE4-JoyConDriver/wiki/Grip-Modes)

In short I think I fixed the problems, I will update the wiki in a few hours.

YukiTaiyo commented 4 years ago

The jerky move inputs issue seem to have been introduced in my project when I placed the plugin's master folder in my project's one and replaced stuff... I don't really understand what happened with it but I could solve the issue by copying again the 4.24 version of my project to 4.25.

About connecting the Joycons by Bluetooth, I need some help. Sometimes they connect properly under "mouse, keyboard and stylus" and they work in this case, but now they're just being paired under "other devices" and I can't use them. How do I connect them properly and avoid being stuck on "paired" ?

jpdante commented 4 years ago

Unfortunately this seems to be a Windows problem, every time I have to connect the joycons I need to make Windows forget about the device and add it again when pairing. The message saying that the controller is paired is probably a bug since the controller is turned off.

If I read the JoyCons reverse engineering documentation correctly there may be a way to synchronize them by saving the MAC of the bluetooth device, but I need to perform tests first. Developing at Unreal is one of the biggest headaches because it is slow, needs to restart for each build and I'm not a C++ fan so I do the tests in C# and then move on to C++