[Update] Dark Souls 2: Seamless Co-op - Vanilla bug fixes and Server Event Treasure
Hi everyone
Development of the mod continues. In this post I'll be discussing some bug fixes I've made and the sever event treasure mechanic in Dark Souls II.
Vanilla bug fixes and QoL improvements
"Disable double click" bug for keyboard users
A bug that has plagued KB+M players for over a decade at this point is that of the "Disable double click" option in the input settings not applying correctly. While the actual toggle works correctly (ON/OFF persists between game launches), the actual functionality doesn't. This means that players who are playing KB+M and want double clicking disabled have to turn the option off then on again every game re-boot.
The cause is relatively straightforward, and that is when the save file is read and the settings are applied to the keyboard input class, it mistakenly reads the byte from itself instead of the user settings (guaranteeing that it will be OFF).
Game boot volume
A common setting included in the seamless co-op mods is the "default_volume" option in the ini file. This is because, when the game starts, the game's options are originally initialised at default volumes in the GameDataOption class. The volume for music, sound effects, and voice is at 50%. The issue is that the player's save data isn't read until they go past the "Press any button to continue" option on the intro screen which can absolutely destroy your ears if you have high system volume and low game volume.
In Dark Souls II seamless, just like in the other games, I have rewritten the default constructor of GameDataOption so that the volume can be customised (or muted) until your save data is loaded - hopefully saving you from a jump scare.
Invalid weapon upgrade crash
A classic scummy cheat some players use against others is by dropping weapons on the ground with invalid infusions / upgrade levels.
When the game is calculating the stats to be displayed in the in-game menu when you have your inventory open, it tries to read the weapon stability rate from WeaponReinforceParam directly. It does this by moving all of the values onto the stack
You can see how, with an unchecked reinforce level - maximum allowed by the code being 15 - If you pass a reinforce level greater than 10 to this function it's going to start reading random stack objects instead. The function itself is heavily mutated, but you can see where it's accessed here, and with the stack frame of this function being 104 bytes, a weapon upgrade of 14 will access beyond this stack frame causing undefined behavior (in this case an invalid read)
I should note that the scripts malicious cheaters use to give these save-corrupting items to players in the vanilla game are patched in seamless co-op, therefore this was more done as a point of interest rather than a necessity.
Invalid weapon infusion crash
Furthermore, pre-patch, players could forcibly equip invalid infused weapons on your own or their character. Infusions out-of-bounds of what can be found in the game will crash with the following message:
"不正なカスタム属性[%u]が設定されています。バグなのでプログラムを修正してください"
"An invalid custom attribute [%u] has been set. This is a bug; please fix the program."
This was patched by FromSoftware themselves, but as there is still a way of doing it online to other players I figured I'd fix it whilst I was here.
Server Event Treasure
As people who played the original Dark Souls II (32-bit) know, there was a chest inside the Majula mansion that contained special rewards. On the run-up to the DLC release, FromSoftware added a few unique custom weapons to mark this event, however these were only available for a limited period of time and have never been present in the Scholar of the First Sin release (64-bit).
Since there is no server event right now, the chest inside the Majula mansion basement just has a soul vessel in it.
Looking into this mechanic, it's very unique in that a specific param (OnlineEventParam) handles this interaction. I reversed this function in it's entirety. I probably sunk like 10 or 20 hours into it just so I could fully understand what was going on.
There are actually 2 chests in the Majula mansion. One that contains the soul vessel (ItemLotParam2Other: 10045600) and another that contains a torch (ItemLotParam2Svr: 10045500).
There is a 2-byte field in OnlineEventParam that determines the special item reward for this chest, and if that is nonzero then the "Normal" chest will be hidden, and the "Server" chest will be visible. As mentioned however, by default the Sever chest will just have 1 torch in it.
I considered how to approach this best in seamless co-op. As I know people aren't a big fan of time-exclusive items. I will keep this a secret for now, but rest assured the reskinned items will be available for everyone who plays the mod, all of the time.
Thank you for your patience, and a huge thank you to all of my supporters <3
I am currently mid-way through a few different playthroughs with friends. Working (relatively) as intended so far. I will update people further in the future.
Take care
~ Yui