Gistix / portal2vr

Portal 2 VR Mod
760 stars 21 forks source link

Portal Reloaded support #109

Open techtonic65 opened 11 months ago

techtonic65 commented 11 months ago

Just finished playing through base game - it was awesome in VR - so thanks for creating the mod!

Now I started playing Portal Reloaded Mod. It all works great until you get to the point where you have to manually fire a green portal - but none of the controller buttons are configured for the green portal.

Can you please add a controller button to fire the green portal? Looks like everything else works in the mod except for this one thing.

KirbNinjaBoy commented 10 months ago

Cant you just bind the green portal button in the steam vr binding menu?

Scriptor25 commented 9 months ago

It doesn't seem to be that easy... So far I found out that to shoot the time portal you have to enter the command ent_fire @att3 Trigger. So I tried to add a vr action handle for it but with my build it doesn't work, the game just crashed when loading a level.

I had just started working on this today so if anyone knows what I'm doing wrong please tell me: The only things I've changed are in vr.h below line 173 I added vr::VRActionHandle_t m_ThirdAttack;. In vr.cpp line 140 m_Input->GetActionHandle("/actions/main/in/ThirdAttack", &m_ThirdAttack); and line 675

if (PressedDigitalAction(m_ThirdAttack))
{
    m_Game->ClientCmd_Unrestricted("ent_fire @att3 Trigger");
}

I also added the action paths in the action manifest and default bindings for the oculus touch:

(action_manifest.json)

"actions": [
...
    {
        "name": "/actions/main/in/ThirdAttack",
        "type": "boolean"
    },
...
]
"localization" : [
...
    "/actions/main/in/ThirdAttack" : "Third Attack",
...
]

(bindings_oculus_touch.json)

"/actions/main" : {
         "sources" : [
...
             {
               "inputs" : {
                  "click" : {
                     "output" : "/actions/main/in/ThirdAttack"
                  }
               },
               "mode" : "button",
               "path" : "/user/hand/left/input/trigger"
            },
...
}

Why does it crash? Idk. Pls HeLP...

Scriptor25 commented 9 months ago

Never mind, just fixed the crashing by building in release mode... but now the third portal isn't working: it makes a sound when shooting, but does not place anything. When typing the command by hand into the dev console it works, but then when i try to place it again in vr it REMOVES the manually placed portal, except, thats the weird part, for the light emitted by the portal; WTF

techtonic65 commented 9 months ago

Just guessing from the code for attack and attack2, but maybe try this instead

if (PressedDigitalAction(m_ThirdAttack)) { m_Game->ClientCmd_Unrestricted("+attack3"); } else { m_Game->ClientCmd_Unrestricted("-attack3"); }

Scriptor25 commented 9 months ago

Already tested with "attack3" in the dev console, it didn't work; I'm sure that the command I used works (at least it did in the console) but it seems like the command does not get executed correctly by the engine.

stsichler commented 7 months ago

Is there any progress on this?

Scriptor25 commented 7 months ago

Sorry, did not work on this for about a month, but if you (or anyone else) wants to work on a fix for themselves I'll upload my changes to a fork and paste the repo link here.

Scriptor25 commented 7 months ago

Here is my fork of portal2vr. I did not test before i pushed it, so if something does not work, it's likely my fault.

stsichler commented 7 months ago

Thank you. Build + Installation worked. Let's see whether I can find out some more...

stsichler commented 7 months ago

I think I fixed it 👍 see https://github.com/stsichler/portal_reloaded_vr

Scriptor25 commented 7 months ago

I didn't try yet, but nice work, I'll test this afternoon 👍 also thanks for mentioning me 🙂

techtonic65 commented 7 months ago

Awesome! Thanks for working on this! I'll certainly give it a try just as soon as I finish Far Cry 5 VR.

Scriptor25 commented 7 months ago

So far I played the first few levels, and it works very well. The only small bug I found was that you can trigger the time portal before you get the gun, so the fixed portal gets re-placed on the same spot every time. I also got it to not even spawn by triggering it before entering the chamber. BUT, if you play the game the intended way it works like it should; nice work again 👍

stsichler commented 7 months ago

Hm, I'd prefer to leave that issue opened until the PR is actually merged. And if Gistix no longer works on this, people have a chance to find my fork when they are searching the issues for "Reloaded".

techtonic65 commented 7 months ago

No problem - just reopened it.

mcitew commented 7 months ago

Does the creation of time portal work ? It does not seem to work. The bind setting is made on left trigger as third attack, but not working. However, setting as secondary attack and primary attack work. Or it is my own configuration issue ?

stsichler commented 7 months ago

Did you install the ZIP Release from my Repo? See v0.2.0p1-reloaded

mcitew commented 7 months ago

Yes. Is there a way to check for sure that the dll is bind to the correct version ? The date of d3d9.dll is Feb 25.

stsichler commented 7 months ago

Yes. Is there a way to check for sure that the dll is bind to the correct version ? The date of d3d9.dll is Feb 25.

That should be the right one. If the player height is initially correct (and no need to press left thumb stick), you can be sure to bind to the correct dll. For me, it's working with this version (on Quest 2 and Steam Link), time portals can be placed by left trigger.

mcitew commented 7 months ago

Ok the source has been confirmed the right copy as I am able to compile the source. Given the source, what do you suggest I could do to debug this issue on time portal placement specific to my platform ?

mcitew commented 7 months ago

Somewhere in the source,

if (CheckDigitalActionChanged(m_ThirdAttack, state) && state) { m_Game->ClientCmd_Unrestricted("ent_fire @att3 trigger"); }

The state is always null, and code inside the braces never get executed, but even if I modify the source to ignore the null state and force it to perform whatever in the braces, it has no effect.

Any clues ?

( Time portal can be placed via gamepad and mouse )

Scriptor25 commented 7 months ago

Are you sure you did use @stsichler 's repo? The version I uploaded is still broken.

stsichler commented 7 months ago

It seems to be the correct code from my repo. but,

( Time portal can be placed via gamepad and mouse )

brings me to a weird idea: It turned out that it was not possible to place time portals, because the VR controllers sent "button up" (= "not pressed") events all the time to the game engine. This is the bug that I fixed. Is it possible that your gamepad does the same?

So, @mcitew, please disconnect all input devices except keyboard and mouse (and VR hardware) and try again. Btw. what is the VR platform you are using?

mcitew commented 7 months ago

Did not work.

Actually the gamepad was connected just to work around the issue. It is not supposed to be there.

The mouse and keyboard are on the host PC. I am using virtual desktop and Pico 4. I even turn off the gamepad emulation on the virtual desktop setting but it is still not working.

Any of you using virtual desktop ?

stsichler commented 7 months ago

Any of you using virtual desktop ?

Yes. Both Steam Link and Virtual Desktop is working for me, but I have a Quest 2.

mcitew commented 7 months ago

Is the entire zip file including the manifest json files compatible between portal 2 and portal reloaded ?

I have also portal 2 installed but on a different folder, with same name dll ( d3d9.dll ) but slightly different manifest json files. Could it be globally it only permits one set of definitions, so the copy on the portal 2 interfere with the copies here ?

mcitew commented 6 months ago

The time portal issue has been resolved by deleting and reinstall, probably I had a corruption somewhere. The time portal now can be placed with left trigger.

Now I have a new issue I faced with chamber 11. It is mentioned that by using pagedown I could display the location of the portal in different time. What is that mapped to in VR controller ?

stsichler commented 6 months ago

What is that mapped to in VR controller ?

This is currently not supported.