SubnauticaNitrox / Nitrox

An open-source, multiplayer modification for the game Subnautica.
GNU General Public License v3.0
1.69k stars 1.03k forks source link

cant run game after injecting NitroxPatcher #589

Closed ChAos48 closed 5 years ago

ChAos48 commented 5 years ago

so I followed the Setting up a development environment for Nitrox guide. and after injecting the NitroxPatcher into Aasembly-CSharp, the game gets stuck in "loading..." before the menu.

to inject the Patcher I modified Assembly-CSharp.GameInput.Awake() this is what it looks like:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using NitroxPatcher;
using UnityEngine;

// Token: 0x0200045D RID: 1117
public partial class GameInput : MonoBehaviour
{
    // Token: 0x06001982 RID: 6530 RVA: 0x000AC16C File Offset: 0x000AA36C
    private void Awake()
    {
        Main.Execute();
        if (GameInput.instance != null)
        {
            UnityEngine.Object.Destroy(base.gameObject);
            return;
        }
        GameInput.instance = this;
        GameInput.instance.Initialize();
        for (int i = 0; i < GameInput.numDevices; i++)
        {
            GameInput.SetupDefaultBindings((GameInput.Device)i);
        }
    }
}

I did notice the Output_log.txt had an game Error ing


Initialize engine version: 5.6.2p4UnknownWorlds (0)
GfxDevice: creating device client; threaded=1
Direct3D:
    Version:  Direct3D 11.0 [level 11.0]
    Renderer: NVIDIA GeForce GTX 560 Ti (ID=0x1200)
    Vendor:   NVIDIA
    VRAM:     969 MB
    Driver:   23.21.13.9135
Begin MonoManager ReloadAssembly
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\Assembly-CSharp-firstpass.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\Assembly-CSharp-firstpass.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\Assembly-CSharp.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\Assembly-CSharp.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\Assembly-UnityScript-firstpass.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\Assembly-UnityScript-firstpass.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\Assembly-UnityScript.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\Assembly-UnityScript.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.UI.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.UI.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.Networking.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.Networking.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.PerformanceTesting.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.PerformanceTesting.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.VR.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\UnityEngine.VR.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\Poly2Tri.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\Poly2Tri.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\iTween.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\iTween.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\LibNoise.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\LibNoise.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\LitJson.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\LitJson.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\LumenWorks.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\LumenWorks.dll into Unity Child Domain
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\Newtonsoft.Json.dll (this message is harmless)
Loading G:\Games\Subnautica\Subnautica_Data\Managed\Newtonsoft.Json.dll into Unity Child Domain
- Completed reload, in  0.034 seconds
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\System.Core.dll (this message is harmless)
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\System.dll (this message is harmless)
OnLevelWasLoaded was found on OVRScreenFade
This message has been deprecated and will be removed in a later version of Unity.
Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed

(Filename:  Line: 376)

<RI> Initializing input.

<RI> Input initialized.

desktop: 1920x1080 60Hz; virtual: 1920x1080 at 0,0
<RI> Initialized touch support.

VR: OpenVR Error! OpenVR failed initialization with error code VRInitError_Init_PathRegistryNotFound: "Installation path could not be located (110)"!

(Filename:  Line: 1028)

UnloadTime: 1.022151 ms
User id = 978d7a764e6849f8be89c96574494a15

(Filename: C:/Subnautica/plastic_workspace_unity/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\NitroxPatcher.dll (this message is harmless)
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\0Harmony.dll (this message is harmless)
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\NitroxModel.dll (this message is harmless)
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\NitroxClient.dll (this message is harmless)
Platform assembly: G:\Games\Subnautica\Subnautica_Data\Managed\Autofac.dll (this message is harmless)
TypeLoadException: A type load exception has occurred.
  at GameInput.Awake () [0x00000] in <filename unknown>:0 
UnityEngine.Object:INTERNAL_CALL_Internal_InstantiateSingle(Object, Vector3&, Quaternion&)
UnityEngine.Object:Internal_InstantiateSingle(Object, Vector3, Quaternion)
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
UnityEngine.Object:Instantiate(GameObject, Vector3, Quaternion)
SystemsSpawner:Awake()

(Filename:  Line: -1)

FMOD Studio: Creating runtime system instance

(Filename: C:/Subnautica/plastic_workspace_unity/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Loading game settings

(Filename: C:/Subnautica/plastic_workspace_unity/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

NullReferenceException: Object reference not set to an instance of an object
  at GameInput.GetBindingInternal (Device device, Button button, BindingSet bindingSet) [0x00000] in <filename unknown>:0 
  at GameInput.GetBinding (Device device, Button button, BindingSet bindingSet) [0x00000] in <filename unknown>:0 
  at GameSettings.SerializeInputSettings (ISerializer serializer) [0x00000] in <filename unknown>:0 
  at GameSettings.SerializeSettings (ISerializer serializer) [0x00000] in <filename unknown>:0 
  at GameSettings+<LoadAsync>c__Iterator2.MoveNext () [0x00000] in <filename unknown>:0 
  at CoroutineTask`1[System.Boolean].MoveNext () [0x00000] in <filename unknown>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0 

(Filename:  Line: -1)

Setting up 2 worker threads for Enlighten.
  Thread -> id: 4a14 -> priority: 1 
  Thread -> id: 35a8 -> priority: 1 
FMOD Studio: Destroying runtime system instance

(Filename: C:/Subnautica/plastic_workspace_unity/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Not sure if it makes a differance but Ive changed all the framework versions in my .sln to .net 4.0.0 to fix the issue at #446

ChAos48 commented 5 years ago

so verifying, and then re installing Nitrox on the client fixed it. do I have to do that each time a new version comes out?, or how can I add the mod from my compiled bins?

Chewbaka69 commented 5 years ago

You have inject the code in the wrong place: your code:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using NitroxPatcher;
using UnityEngine;

// Token: 0x0200045D RID: 1117
public partial class GameInput : MonoBehaviour
{
    // Token: 0x06001982 RID: 6530 RVA: 0x000AC16C File Offset: 0x000AA36C
    private void Awake()
    {
        Main.Execute();
        if (GameInput.instance != null)
        {
            UnityEngine.Object.Destroy(base.gameObject);
            return;
        }
        GameInput.instance = this;
        GameInput.instance.Initialize();
        for (int i = 0; i < GameInput.numDevices; i++)
        {
            GameInput.SetupDefaultBindings((GameInput.Device)i);
        }
    }
}

The right code:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using NitroxPatcher;
using UnityEngine;

// Token: 0x0200045D RID: 1117
public partial class GameInput : MonoBehaviour
{
    // Token: 0x06001982 RID: 6530 RVA: 0x000AC16C File Offset: 0x000AA36C
    private void Awake()
    {
        if (GameInput.instance != null)
        {
            UnityEngine.Object.Destroy(base.gameObject);
            return;
        }
        GameInput.instance = this;
        GameInput.instance.Initialize();
        for (int i = 0; i < GameInput.numDevices; i++)
        {
            GameInput.SetupDefaultBindings((GameInput.Device)i);
            Main.Execute();
        }
    }
}
ChAos48 commented 5 years ago

that fixed it thank you