Cloudef / ModEngine2

Runtime injection library for modding Souls games. WIP
MIT License
36 stars 1 forks source link

Armored Core VI Seamless Co-op Support #27

Open Jojopiez opened 4 weeks ago

Jojopiez commented 4 weeks ago

The latest update of the Armored Core VI Coop mod added compatibility with Modengine2. But I have encountered an interesting, yet frustrating issue. The proton compatible version in this repository can load my mods, all of them except for seamless. Adding the ac6_coop.dll to external dlls gets me this:

[2024-09-21 20:29:11.967] [modengine] [info] Attempting to load global config at Z:\home\user\.local\share\Steam\steamapps\common\ARMORED CORE VI FIRES OF RUBICON\Game\dllMods\config.toml
[2024-09-21 20:29:11.967] [modengine] [info] Attempting to load mod settings config at Z:\home\user\.local\share\Steam\steamapps\common\ARMORED CORE VI FIRES OF RUBICON\Game\modengine.toml
[2024-09-21 20:29:11.967] [modengine] [info] Local config loaded
[2024-09-21 20:29:12.088] [modengine] [info] ModEngine version 2.1.0-20b7f1a3ba39138f61fdeb5cb88fb16721371130 initializing for Armored Core 6
[2024-09-21 20:29:12.089] [modengine] [info] Local settings loaded: true, Global settings loaded: false
[2024-09-21 20:29:12.089] [modengine] [info] Main thread ID: 292
[2024-09-21 20:29:12.092] [modengine] [info] Loaded external DLL Z:\home\user\.local\share\Steam\steamapps\common\ARMORED CORE VI FIRES OF RUBICON\Game\ac6_coop.dll

It hangs and never actually launches. Now, launching this by adding the normal repository of Modengine2, adding it as a non-steam game and doing the same thing, adding ac6_coop.dll to load as an external dll does work. Seamless does actually load, but the rest of my mods don't. Unsure of the cause, but some changes in the regular modengine2 repository may need to be merged into this one in order to get these things to load. I looked through the log files and couldn't find any errors other than

[modengine] [error] Could not find pattern

alphalest commented 4 weeks ago

What version of LInux are you using? My problem so far has been worse on my end. I can't get it to run doing either method and it's been frustrating me trying to get it to work. I'm on Gentoo Linux, and so far running Co-op by renaming the exe and running that through steam works, running ME2 separately with mods works, but not both.. I'm also commenting to ask about the config toml file you have in your dllMods folder. I want to ask what setup you are using for your mods. I can get content mods like Armory to work but I'm curious if you're also using extra mod support like LazyLoad .

Jojopiez commented 3 weeks ago

All good questions! First of all, I'm an endeavoros user. Basically arch but the setup is easier. I'll tell my elaborate setups in detail, and let me tell you... it's a mess. Only one of these setups use lazyload, and it's the one that uses this proton compatible version of modengine2 to load ac6 mods. To get the proton compatible version of modengine2 to load armored core 6 mods you need to use lazyloader and put the mod folder in the same folder as game, so I'm forced to use it on this setup in particular. Your game folder should have dllMods, the armored core 6 toml file renamed to modengine.toml and a folder called mod. Maybe your modengine2 folder too if you want it, you take the files from modengine2's bin and place those dll's into lazyloader's dllMods folder. https://modslab.net/en/armored_core_vi_fires_of_rubicon/mods/ReAaefZ9fY/ Then add this launch option to steam echo "%command%" | sed 's/start_protected_game/armoredcore6/' | WINEDLLOVERRIDES="dinput8.dll=n,b" sh on armored core 6, not the launchmod bat, just armored core 6 itself. That will allow your modengine mods to load. HOWEVER, ac6 coop doesn't load like this at all. Putting the mods files into the game folder and adding it to modengine.toml will just make it so ac6 never launches. Here's my config for that without the coop mod dll.

# Global mod engine configuration
[modengine]
# If set to true the debug console will appear while the game is running
debug = true

# List of files that will be loaded into the game as DLL mods.
# Absolute paths to mods are supported but must use '\\' to separate path items. For example, if your mod is at E:\coolstuff\coolmod.dll, you must enter
# the path in the config as "E:\\coolstuff\\coolmod.dll".
# If there's no drive specifier (C:, D:, etc), the path is relative to where the launcher is located. For example, having the path as "mod.dll" will tell
# Mod Engine 2 to look for the directory mod inside the Mod Engine 2 directory with the launcher.
#
# Multiple mods must be separated with commas. For example if you have 3 mods, you will have something like the following:
# external_dlls = [ "coolmod.dll", "D:\\nicemods\\nicemod.dll", "sosofolder\sosomod.dll" ]
external_dlls = []

# Mod loader configuration
[extension.mod_loader]
enabled = true

# Not applicable for Armored Core 6
loose_params = false

# List of directories that contain modded files in order of prioritization. Inside each specified mod directory must have the game
# assets in Fromsoft's asset structure. I.e. if you mod parts/something.partsbnd.dcx, the modded version must be at mod/parts/something.partsbnd.dcx.
# Absolute paths to mods are supported but must use '\\' to separate path items. For example, if your mod is at E:\coolstuff\coolmod, you must enter
# the path in the config as "E:\\coolstuff\\coolmod".
# If there's no drive specifier (C:, D:, etc), the path is relative to where the launcher is located. For example, having the path as "mod" will tell
# Mod Engine 2 to look for the directory mod inside the Mod Engine 2 directory with the launcher.
#
# Multiple mods must be separated with commas. For example if you have 3 mods, you will have something like the following:
# mods = [
#    { enabled = true, name = "coolmod", path = "mod1" },
#    { enabled = true, name = "nicemod", path = "mod2" },
#    { enabled = true, name = "sosomod", path = "mod3" }
# ]
# Note that modengine 2 currently has no way to resolve conflicting files including regulation.bin, and thus the mod with the highest priority
# will have the modded file be loaded in the case of conflict. Some support for merging of params and potentially other assets is considered for
# a future release.
mods = [
    { enabled = true, name = "default", path = "mod" }
]

# When enabled, scylla hide will be injected into the game. This allows for antidebug measures in the game to be bypassed so that you can attach
# debuggers such as Cheat Engine, x64dbg, windbg, etc to the game without as much trouble. If you're not reverse engineering the game, this option
# is probably not for you.
[extension.scylla_hide]
enabled = false

Pretty much default. I should also mention for both configs, my ac6 coop files are all in the game folder so instead of going in the ac6coop folder to load the dll I can just add it as ac6_coop.dll, and the same goes for all of the files in the ac6 coop folder. Put them all in game.

My 2nd setup doesn't use lazyload at all, it tries to load the files through the same method I currently use for elden ring's seamless coop. First thing, the proton compatible version does not work with this setup, it will also just hang like the other one does. So, go to the regular modengine2 github and get the latest version: https://github.com/soulsmods/ModEngine2/releases Essentially, instead of just taking out the mod file from modengine2, you take everything from it. So you should have folders called: mod and modengine2 in game. Then all the config.tomls and bats, including modengine2_launcher.exe Next, add launchmod_armoredcore6.bat to steam and add this as your launch option: STEAM_COMPAT_DATA_PATH="/home/YOURUSERNAMEGOESHERE/steamapps/compatdata/1888160/" %command% The reason for this being that if you have to change your proton version at any point it doesn't wipe your save data. You can set the proton version to experimental or ge proton. I'm using ge proton. Now, if all your ac6coop files are in game, add this to config_armoredcore6.toml:

 # Global mod engine configuration
[modengine]
# If set to true the debug console will appear while the game is running
debug = true

# List of files that will be loaded into the game as DLL mods.
# Absolute paths to mods are supported but must use '\\' to separate path items. For example, if your mod is at E:\coolstuff\coolmod.dll, you must enter
# the path in the config as "E:\\coolstuff\\coolmod.dll".
# If there's no drive specifier (C:, D:, etc), the path is relative to where the launcher is located. For example, having the path as "mod.dll" will tell
# Mod Engine 2 to look for the directory mod inside the Mod Engine 2 directory with the launcher.
#
# Multiple mods must be separated with commas. For example if you have 3 mods, you will have something like the following:
# external_dlls = [ "coolmod.dll", "D:\\nicemods\\nicemod.dll", "sosofolder\sosomod.dll" ]
external_dlls = ["ac6_coop.dll"]

# Mod loader configuration
[extension.mod_loader]
enabled = true

# Not applicable for Armored Core 6
loose_params = false

# List of directories that contain modded files in order of prioritization. Inside each specified mod directory must have the game
# assets in Fromsoft's asset structure. I.e. if you mod parts/something.partsbnd.dcx, the modded version must be at mod/parts/something.partsbnd.dcx.
# Absolute paths to mods are supported but must use '\\' to separate path items. For example, if your mod is at E:\coolstuff\coolmod, you must enter
# the path in the config as "E:\\coolstuff\\coolmod".
# If there's no drive specifier (C:, D:, etc), the path is relative to where the launcher is located. For example, having the path as "mod" will tell
# Mod Engine 2 to look for the directory mod inside the Mod Engine 2 directory with the launcher.
#
# Multiple mods must be separated with commas. For example if you have 3 mods, you will have something like the following:
# mods = [
#    { enabled = true, name = "coolmod", path = "mod1" },
#    { enabled = true, name = "nicemod", path = "mod2" },
#    { enabled = true, name = "sosomod", path = "mod3" }
# ]
# Note that modengine 2 currently has no way to resolve conflicting files including regulation.bin, and thus the mod with the highest priority
# will have the modded file be loaded in the case of conflict. Some support for merging of params and potentially other assets is considered for
# a future release.
mods = [
    { enabled = true, name = "default", path = "mod" }
]

# When enabled, scylla hide will be injected into the game. This allows for antidebug measures in the game to be bypassed so that you can attach
# debuggers such as Cheat Engine, x64dbg, windbg, etc to the game without as much trouble. If you're not reverse engineering the game, this option
# is probably not for you.
[extension.scylla_hide]
enabled = false

You don't have to have debug set to true, I just do cause they caused me significant pain. This should launch the game now, but if it doesn't try modifying the launchmod_armoredcore6.bat file with this config:

chcp 65001
cd \home\YOUR USERNAME GOES HERE\.local\share\Steam\steamapps\common\ARMORED CORE VI FIRES OF RUBICON\Game\
:: The above line is necessary in case you edit this file to lead to a path with Unicode characters.
.\modengine2_launcher.exe -t ac6 -c .\config_armoredcore6.toml

Now it should work, assuming you followed my steps correctly. Currently this setup only loads the coop mod and it doesn't allow you to use controller at all. If you wanted to only play ac6 coop there exists a much easier setup. Which is just putting the AC6Coop mods folder in game, and the exe beside it, no need to gut this file. Make sure the setup it provides is untouched unlike I told you to... earlier. Then add this to your ac6's launch option in steam echo "%command%" | sed 's/start_protected_game/ac6_for_coop_launcher/' | bash

With these 3 setups I have: Content mods, Coop but worse(some mods like songs of rubicon work but that's it), and coop but normal. Hope this helps you some. I'd really like to get it to work, like I've even tried loading this with protontricks but it always crashes at the white screen, so no luck there.

Jojopiez commented 3 weeks ago

image Oh, and if you want to see my file structure, it's anarchy. I have tried everything, so it's multiple setups clumped into one big mess. Don't try to comprehend it. I've been frustrated trying to get it to work, cause my windows friends can just play the mod right now with me2 support, but I can't. I'm stuck with vanilla ac6 until either this version of me2 gets updated or another method gets discovered.

alphalest commented 3 weeks ago

Yep, I tried both ways too and I couldn't get the coop mod to run, as it would 'hang' on the kernel_writewatch sequence. The damn client doens't even load I can load other regulation.bin mods but that's about it. At least I know putting the coop dll shows some kind of reaction. For now I'll have to wait for either this project to update or the inevitable ModEngine3 to come about.

Jojopiez commented 3 weeks ago

Yeah, if this project doesn't get updated, modengine3 would certainly fix it. Though, that will be a while. I'm patient enough to wait, and do at least have an old laptop I can use to play it in the meantime. Though I do hope the developer of this proton compatible branch updates the project if they're available. And it's nice to know I'm not the only one to have driven myself nuts trying to get this to work.

Jojopiez commented 1 week ago

Writing again to say, I did find a kind of working solution for myself. I figure since I can get seamless to run through modengine that I could at least try uxm again to see if I can get my problem mod, which is inferno, to work while co-op is active. It doesn't if I run it through the exe co-op has, so I tried with modengine2, and... it works. It actually loads both of them just fine. BUT, since running modengine2 as a non-steam game kills any ps4 or 5 controller compatibility I had that to fix as well.

EDIT: I should probably add that I accidentally put the files of inferno in both the modengine2 mod folder and in the actual files through uxm, I have NO IDEA how relevant that is but I figure I should mention it just in case that's what actually fixed it. I was too afraid to remove it after it worked. Link to the mod here: https://www.nexusmods.com/armoredcore6firesofrubicon/mods/221

There were 2 potential solutions. First is xboxdrv, so I can convert my ps5 controller to xinput with a command:

xboxdrv \
  --evdev /dev/input/by-id/usb-Sony_Interactive_Entertainment_DualSense_Wireless_Controller-if03-event-joystick \
  --evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y,ABS_X=X1,ABS_Y=Y1,ABS_RX=X2,ABS_RY=Y2,ABS_Z=LT,ABS_RZ=RT \
  --evdev-keymap BTN_SOUTH=A,BTN_EAST=B,BTN_NORTH=Y,BTN_WEST=X,BTN_START=start,BTN_MODE=guide,BTN_SELECT=back \
  --evdev-keymap BTN_TL=LB,BTN_TR=RB,BTN_TL2=LT,BTN_TR2=RT,BTN_THUMBL=TL,BTN_THUMBR=TR \
  --axismap -y1=y1,-y2=y2                          \
  --mimic-xpad                                     \
  --silent

OR, I could write a script that runs the batch file through proton in the sh format, so I can retain the controller compatibility. Which is kind of my final solution. I added the script to ac6's launch options and it works. So, here's that for my linux folks ripping their hair out trying to get a specific mod to work:

#!/bin/bash

# Set environment variables
export STEAM_COMPAT_CLIENT_INSTALL_PATH="/home/username/.steam/steam"
export STEAM_COMPAT_DATA_PATH="/home/username/steamapps/compatdata/1888160/"

# Run Proton with the batch file
#run command prompt and trigger the batch file through proton
/home/username/.steam/steam/compatibilitytools.d/GE-Proton9-15/proton run cmd /c /home/username/ac6/Game/launchmod_armoredcore6.bat %command%

Replaced my user with username so you can fill in your own. I also am using proton ge 9-15 for this. I named the file launchmod_armoredcore6.sh, not confusing at all, and added it like this in my ac6 launch options: bash -c "/home/username/.steam/steam/steamapps/common/ARMORED CORE VI FIRES OF RUBICON/Game/launchmod_armoredcore6.sh" %command% Although, personally I just made a symlink in my home directory so I don't have to go through as much file surfing. so my launch option actually looks more like this: bash -c "/home/username/ac6/Game/launchmod_armoredcore6.sh" %command% And that's how I got inferno mod working with co-op on linux with ps5 controller compatibility. This sucked, but hey, at least I never have to write this script again. Was really my first time doing it, so it's a miracle I even got this to work. Not a perfect solution at all though, I'd much rather we get an update to the me2 fork, or me3 completes.