kkdevs / Patchwork

mod
13 stars 1 forks source link

Breaks camera control with KoikatuVR #6

Closed billyboy12 closed 6 years ago

billyboy12 commented 6 years ago

Mod edit: For anyone reading thsi: It's now working, but there's a ritual around it. See https://github.com/kkdevs/Patchwork/wiki/VR

There's a problem if you want to use Patchwork and KoikatuVR (https://github.com/vrhth/KoikatuVR) at the same time. The game loads in VR as normal, but you can't control your character with the Vive wands anymore. Normal behavior is when the wads are set to "school" the grip button moves the camera to the MC's head and holding the trigger makes him walk. Both these buttons do nothing if you load the game with Patch work. You can still bring up the class and room change windows though. Re-installing KoikatuVR after installing Patchwork (both the launcher version and hardpatch) doesn't solve the problem. KoikatuVR controls normally if you launch the game via the vanilla launcher.

Does Patchwork change the camera in some way that KoikatuVR can no longer control it?

billyboy12 commented 6 years ago

I checked the KoikatuVR's log when running the game with Patchwork, seems like Patchwork is doing something to the camera.

[ERROR][ProtectedBehaviour#SafelyCall] System.MethodAccessException: Method ActionGame.CameraStateDefinitionChange:ModeChange (ActionGame.CameraMode,ActionGame.Chara.Player)' is inaccessible from methodKoikatuVR.Interpreters.ActionSceneInterpreter:ResetCamera ()'

at KoikatuVR.Interpreters.ActionSceneInterpreter.OnUpdate () [0x00000] in :0 at KoikatuVR.Interpreters.KoikatuInterpreter.OnUpdate () [0x00000] in :0 at VRGIN.Core.ProtectedBehaviour.SafelyCall (System.Action action) [0x00000] in :0

ezdiy commented 6 years ago

@billyboy12 That error seems to happen because KKVR depends on IPA-ized assembly. The exe launcher instead contains its own recompiled game assembly about which IPA has no idea. You might try to IPA-ize the hardpatch though. What does IPA-ized means? The crash you posted comes from:

https://github.com/vrhth/KoikatuVR/blob/master/VRGIN.Template/Interpreters/ActionSceneInterpreter.cs#L61

But that method it calls is a private symbol. Though that particular instance can be worked around with just:

_CameraSystem.GetComponent<ActionGame.CameraStateDefinitionChange>().ModeChangeForce(ActionGame.CameraMode.TPS)

I'll try to make the symbols it needs public at some future point so that kkvr can load with just bepin, but for now just using ipa with hardpatch should work.

billyboy12 commented 6 years ago

OK, so since there's no file called "ActionSceneInterpreter.cs" in the release version of KoikatsuVR but there is when you look at the mod's Github, I'm assuming that I need to checkout the Github version, edit the file to fix the problem then build it?

I've never used Visual Studio before, so I don't really have a clue what I'm doing, but when I try to build it, I just get a whole bunch of errors. It seems like it's expecting a filed called "VRGIN.csproj" to be located in VRGIN\VRGIN so I checked out the "VRGIN" fork too and put the files in the folder which seems to have helped, but I still get 1 failed. The kinds of errors it shows are things like:

HSceneInterpreter.cs(32,51,32,69): error CS0246: The type or namespace name 'CameraControl_Ver2' could not be found (are you missing a using directive or an assembly reference?) ActionSceneInterpreter.cs(59,81,59,91): error CS0246: The type or namespace name 'ActionGame' could not be found (are you missing a using directive or an assembly reference?) ActionSceneInterpreter.cs(62,102,62,112): error CS0103: The name 'ActionGame' does not exist in the current context

The best I can do is get VRGIN itself to build. A little help?

ezdiy commented 6 years ago

@billyboy12 Aw, that's brave to compile it yourself if you've not seen VS before. But chances are there will be other missing public members - ultimately the problem is that you're pointing an IPA plugin at non-ipa game.

Have you tried just using IPA with the hardpatch?

The errors you're seeing mean you need to add Assembly-CSharp.dll of the game to references (right click the project->add->reference, select browse, navigta to path of the game dll, click ok). Then it should hopefuly compile.

billyboy12 commented 6 years ago

"Have I tried just using IPA with the hardpatch?" You mean, copying the files from the hardpatch zip into Koikatsu then dragging and dropping Koikatu.exe on top of IPA.exe (the one with the red icon), right? That's what I've already tried. Or am I doing it wrong?

I added Assembly-CSharp.dll as a reference to the KoikatuVR project and that got me down to 32 errors. It was then complaining about another .dll which I found in the Koikatsu install. That got me down to 2 errors:

Error CS1061 'IMouseSimulator' does not contain a definition for 'MiddleButtonDown' and no extension method 'MiddleButtonDown' accepting a first argument of type 'IMouseSimulator' could be found (are you missing a using directive or an assembly reference?)

Error CS1061 'IMouseSimulator' does not contain a definition for 'MiddleButtonUp' and no extension method 'MiddleButtonUp' accepting a first argument of type 'IMouseSimulator' could be found (are you missing a using directive or an assembly reference?)

I can't find any files called "IMouseSimulator" on my install, but I found a IMouseSimulator.cs file on github, but copying that into the project doesn't seem to have helped.

ezdiy commented 6 years ago
"Have I tried just using IPA with the hardpatch?" You mean, copying the files from the hardpatch zip into Koikatsu then dragging and dropping Koikatu.exe on top of IPA.exe (the one with the red icon), right? That's what I've already tried. Or am I doing it wrong?

Hmm, that doesn't sound right. But you're close to compiling this on your own anyhow.

The errors you see are missing references again. Add the dlls from https://github.com/vrhth/VRGIN/tree/d6fb120c5a0503149871660b1d2c5d8718961bca/Libs

billyboy12 commented 6 years ago

"that doesn't sound right"? I'm not using IPA correctly?

I've added those dlls, but it's still complaning about IMouseSimulator! Specifically, in SchoolTool.cs

billyboy12 commented 6 years ago

OK, I deleted the entire thing and re-downloaded KoikatuVR from github from scratch. This time (after adding in the missing resources as before) it successfully compiled! Not sure what I did differently this time, but it seems to work fine now.

But it seems like this has only created more trouble between KoikatuVR and Patchwork. Koikatsu can run if you only install the hardpatch but if you then if you install KoikatuVR (via dragging Koikatu.exe onto IPA the game freezes at the Illusion logo. If you use the launcher version of Patchwork, the game loads, but it's the same problem as before. VR mode works, but you can't control the camera.