Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadDumpedAssemblies=true makes it not possible to open two game .exes if they are in the same folder #303

Closed
ManlyMarco opened this issue Sep 21, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ManlyMarco
Copy link
Member

What happened?

LoadDumpedAssemblies dumps to a set folder which causes a collision and a preloader crash (file in use) if a game has multiple exe files in the same directory.

Steps to reproduce

Can be reproduced in KK and most other games with studio by setting LoadDumpedAssemblies=true and starting main game and then studio.

BepInEx Distribution

Stable from GitHub

Log outputs

[Message:   BepInEx] BepInEx 5.4.15.0 - KoikatsuSunshine (14/07/2021 16:02:40)
[Info   :   BepInEx] Running under Unity v2019.4.9.5308042
[Info   :   BepInEx] CLR runtime version: 4.0.30319.42000
[Info   :   BepInEx] Supports SRE: True
[Info   :   BepInEx] System platform: Bits64, Windows
[Message:   BepInEx] Preloader started
[Info   :   BepInEx] Loaded 1 patcher method from [BepInEx.Preloader 5.4.15.0]
[Info   :   BepInEx] Loaded 1 patcher method from [CultureFix 16.1.0.0]
[Info   :   BepInEx] Loaded 1 patcher method from [KKS_ExtensibleSaveFormat_Patcher 0.0.0.0]
[Info   :   BepInEx] Loaded 1 patcher method from [MonoProfilerLoader 8.0.0.0]
[Info   :   BepInEx] 4 patcher plugins loaded
[Info   :   Console] CultureFix - Forcing process culture to ja-JP.
[Error  :MonoProfiler] Could not find F:\Games\KKS\MonoProfiler64.dll
[Info   :   BepInEx] Patching [UnityEngine.CoreModule] with [BepInEx.Chainloader]
[Info   :   BepInEx] Patching [Assembly-CSharp] with [ExtensibleSaveFormat.Patcher]
[Fatal  :   BepInEx] Could not run preloader!
[Fatal  :   BepInEx] System.IO.IOException: Win32 IO returned 1224. Path: F:\Games\KKS\BepInEx\DumpedAssemblies\Assembly-CSharp.dll
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <fb001e01371b4adca20013e0ac763896>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at Mono.Cecil.ModuleDefinition.GetFileStream (System.String fileName, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00006] in <6034b380a22b41a596c9dc29d282c0a9>:0 
  at Mono.Cecil.ModuleDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00006] in <6034b380a22b41a596c9dc29d282c0a9>:0 
  at Mono.Cecil.AssemblyDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <6034b380a22b41a596c9dc29d282c0a9>:0 
  at Mono.Cecil.AssemblyDefinition.Write (System.String fileName) [0x00007] in <6034b380a22b41a596c9dc29d282c0a9>:0 
  at BepInEx.Preloader.Patching.AssemblyPatcher.PatchAndLoad (System.String[] directories) [0x003ca] in <4c3533f771b442b58e3bc86eab9f3ef2>:0 
  at BepInEx.Preloader.Preloader.Run () [0x0020c] in <4c3533f771b442b58e3bc86eab9f3ef2>:0 
System.IO.IOException: Win32 IO returned 1224. Path: F:\Games\KKS\BepInEx\DumpedAssemblies\Assembly-CSharp.dll
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <fb001e01371b4adca20013e0ac763896>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at Mono.Cecil.ModuleDefinition.GetFileStream (System.String fileName, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00006] in <6034b380a22b41a596c9dc29d282c0a9>:0 
  at Mono.Cecil.ModuleDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00006] in <6034b380a22b41a596c9dc29d282c0a9>:0 
  at Mono.Cecil.AssemblyDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <6034b380a22b41a596c9dc29d282c0a9>:0 
  at Mono.Cecil.AssemblyDefinition.Write (System.String fileName) [0x00007] in <6034b380a22b41a596c9dc29d282c0a9>:0 
  at BepInEx.Preloader.Patching.AssemblyPatcher.PatchAndLoad (System.String[] directories) [0x003ca] in <4c3533f771b442b58e3bc86eab9f3ef2>:0 
  at BepInEx.Preloader.Preloader.Run () [0x0020c] in <4c3533f771b442b58e3bc86eab9f3ef2>:0

Environment

- OS: W10
- BepInEx: 5.4.15
- Game: KK/KKS
@ManlyMarco ManlyMarco added the bug Something isn't working label Sep 21, 2021
@ghorsington
Copy link
Contributor

I think the most viable way to fix this without possibly breaking dnSpy/debugger support is to add process name to the dump path, i.e.

BepInEx/DumpedAssemblies/Koikatu/Assembly-CSharp.dll

This should handle the cases where multiple games are inside the same directory. I'll also add a running index in case multiple processes of the game are launched.

Going to push a fix to master and then an equivalent to v5-lts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants