brndd / vanilla-tweaks

Custom QoL patches to the 1.12.1 WoW client
MIT License
162 stars 25 forks source link

[Bug] Unable to control camera on secondary monitor #8

Open Soromeister opened 2 years ago

Soromeister commented 2 years ago

Reproductible:

Requirements:

Steps:

The other patcher listed on the Turtle-WoW forums work fine when doing this (source code is also there in the forum post), although it's not as detailed as this one here.

My WoW Vanilla client config.wtf:

SET gxWindow "1"
SET gxMaximize "1"
SET scriptMemory "0"
SET hwDetect "0"
SET gxColorBits "24"
SET gxDepthBits "24"
SET gxResolution "3840x2160"
SET gxRefresh "60"
SET gxVSync "0"
SET gxMultisampleQuality "0.000000"
SET lod "0"
SET fullAlpha "1"
SET lodDist "250"
SET SmallCull "0.010000"
SET DistCull "888.8"
SET shadowLevel "0"
SET trilinear "1"
SET frillDensity "256"
SET farclip "777"
SET specular "1"
SET pixelShaders "1"
SET particleDensity "1.000000"
SET unitDrawDist "300.000000"
SET anisotropic "16"
SET M2UsePixelShaders "1"
SET movie "0"
SET movieSubtitle "1"
SET mouseSpeed "1"
SET DesktopGamma "1"
SET Gamma "1.000000"
SET readTOS "1"
SET readEULA "1"
SET MusicVolume "0.40000000596046"
SET SoundVolume "1"
SET MasterVolume "1"
SET realmList "logon.turtle-wow.org"
SET weatherDensity "3"
SET cameraYawMoveSpeed "120"
SET cameraYawSmoothSpeed "180"
SET cameraSmoothStyle "0"
SET cameraDistanceMaxFactor "5"
SET realmName "Turtle WoW"
SET gameTip "12"
SET ChatBubblesParty "1"
SET AmbienceVolume "0.60000002384186"
SET uiScale "0.71111111111111"
SET useUiScale "1"
SET UnitNameNPC "1"
SET guildMemberNotify "1"
SET checkAddonVersion "0"
SET profanityFilter "0"
SET cameraView "3"
SET cameraDistanceC "15.000000"
SET cameraPitchC "26.449976"
SET cameraYawC "0.000000"
SET cameraCustomViewSmoothing "1"
SET autoSelfCast "1"
SET texLodBias "-1"
SET nearclip "0.3"
SET mapObjLightLOD "2"
SET footstepBias "1"
SET minimapZoom "0"
SET SkyCloudLOD "1"
SET gxFixLag "0"
brndd commented 2 years ago

Try disabling the sound in background patch and let me know if this still happens.

edit: On second thought, that patch should not cause anything like this -- I believe I checked all the relevant code paths and it's purely sound-related stuff. The only other thing I can think of is the executable name, as GPU drivers sometimes apply optimizations based on the process name. Try backing up your existing WoW.exe and then renaming WoW_tweaked.exe to WoW.exe.

derpda commented 2 years ago

I'm having the same issue. I disabled all settings in CMD, and the issue still exists :O vanilla-tweaks.exe -o WoW_tweaked.exe --no-quickloot --no-soundchannels --no-fov --no-farclip --no-frilldistance --no-nameplatedistance --no-largeaddressaware --no-sound-in-background WoW.exe

Furthermore, the issue only happens when the game is fullscreen, or the windowed game is very close to the full size of the screen. If I have the game windowed and at about 85% size of the screen its fine...

derpda commented 2 years ago

Renaming the exe is sadly not an option as the game will reject the login due to "corrupted files".

derpda commented 2 years ago

Sorry for the multiple posts, I'm writing these as I am testing some stuff. I don't normally use Windows for anything programming related, but looks like there is a diff tool on Windows called fc. I ran it to compare the two exe files, here is the ouput

fc /B WoW.exe WoW_tweaked.exe
Comparing files WoW.exe and WOW_TWEAKED.EXE
FC: no differences encountered

The /B flag is apparently for comparing binary files. Note that I turned off all tweaks as per above post, and indeed the binary seems to be unmodified (which I guess is good).

This makes your theory about GPU drivers somewhat more likely.

EDIT: Indeed when renaming the tweaked file to WoW.exe, the problem goes away (and the server doesn't complain at login since the files are the same).

derpda commented 2 years ago

Its funny that it seems to check some kind of hash of the WoW.exe file, even if that's not the file being executed... if we can circumvent that, as in make it generate the hash off of a different file, that might solve the problem.

derpda commented 2 years ago

Solved it I think! At 0045DF30 in WoW.exe it seems to do the checksum change. The line is Followed by some stuff about a ChecksumExecutables.cpp, so I think I'm right on the money here. The original content is

00 00 00 00 57 6F 57 2E 65 78 65 00 00 00 00 00

which reads as ����WoW.exe����� (� being often displayed as a . in hex readers I think...) Changing this to below value (which is ����WoW2.exe����)

00 00 00 00 57 6F 57 32 2E 65 78 65 00 00 00 00

solved the issue for me.

Note that you your backup unmodified WoW.exe has to be renamed to WoW2.exe for this.

Seeing as they apparently use this as an anti-cheat, it surprised me how easy it was to circumvent...

brndd commented 2 years ago

It probably isn't meant to be an anticheat but rather just a general integrity check for file corruption. I suspect it would be enough to compute CRC for the executable after we apply the patches and then patch that in somewhere.

I'll try and get around to looking into this Soon™, but I've been quite busy (and also lazy) the past couple of months. In the mean time you may be able to work around this by adding the tweaked executable into your GPU drivers somewhere and making sure it uses the same driver profile as WoW.exe does. I don't really remember how that works because it's been some years since I last had to deal with GPU drivers on Windows.

Soromeister commented 1 year ago

This should be part of the patcher itself. I have reported as an issue to be integrated in a later release of this patcher.

brndd commented 1 year ago

I took a look at this a couple of days ago and it isn't going to be as easy to fix as I had hoped. The checksum verification described by @derpda above probably has something to do with updating the game, and the checksum it compares against is loaded at runtime (maybe sent by server, I didn't check), so patching it statically isn't trivial.

brndd commented 1 year ago

Testing this on Turtle WoW, I'm not having any trouble connecting to the server and playing the game when WoW_tweaked.exe is renamed to WoW.exe. Perhaps the error only happens when there is a patch to be downloaded?