Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Darksiders 2 - Trying to fix HUD/UI for widescreen

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Cortex
How do I cheat?
Reputation: 0

Joined: 20 May 2018
Posts: 2

PostPosted: Sun May 20, 2018 7:16 pm    Post subject: Darksiders 2 - Trying to fix HUD/UI for widescreen Reply with quote

[Introduction - Short]
Let me directly jump to the reason I'm posting: The game Darksiders 2 Deathinitive Edition has a UI which doesnt translate correctly when changing resolution aspect ratio. Specifically it's the Minimap which becomes absolutly unusable because the Symbols of the Minimap aren't on the Minimap (Link1)(I added Pictures for better understanding and uploaded them to imgur so anybody who want to see them, I'll pm the links to you as I don't want to get banned on my first post )

[Goal]
A script which can alter the position of the minimap so it becomes usable with aspect ratios bigger than 16:9

[My try to fix]
Because the value of the position of the minimap isn't changing I did try get near the value. The only value of the minimap I can change which I can think of is the visibility. So I searched for 4Bytes[1] when ingame and 4Bytes[0] when in the esc menu (Link2)[quick note:You could additionally see the weird left alignment of the esc menu]. So I got to 5 Addresses which change their values similar to the minimap but none of them can be frozen so the visibility wouldn't change. Then I did "check what writes to this". Now when the visibility of the minimap is changed you get dozens of addresses so I tried opening the esc menu 2 times so the visibility value is changed 4 times and the write access should be at count=4 just to filter out most of the writing addresses. I am certain that the command in that address should be like mov etc and preferably it should be that the destination address should be in brackets so the value is written. Now I tested these addresses with nop to see if anything changes when I'm reopening the esc menu to change the value of the visibility and after some time I found some, which are also static. So I got a script which can let the ESC menu HUD not trigger(Link3) I have 3 scripts with different addresses which can let the ESC menu hud and the ingame hud except the minimap symbols not get triggered(Link4) and I have a script which manages to change the minimap position a bit to the left(Link5). The last one seems pretty close to what I'm searching so now I tried to search for the position of the minimap with Float[unknown]. Then I activated the script which changes the position of the minimap a bit to the left, then searched for Float[changed] and so on till I reached 3 dynamic addresses. These addresses change exactly with the minimap position but when the values of these addresses are changed nothing happens. I also tried structure dissecting some of the addresses I found in which I couldn't recognize a single value, I tried "find out what addresses this instruction acceses" from the address of the last script and this led to couple hundred values, which I was able to filter down to 0 values with number of accesses filtering and non fluctuating values so another dead end. As you can see here in the memory viewer(Link6) the Addresses name is Darksiders2.Scaleform::Render::Matrix2x4<float>::SetIdentity etc. so I tried to look at Autodesk Help to understand how all these function but that didn't help. So when looking at other .dlls maybe something that could be related to minimap position other than Matrix2x4 (Link7)(Link8)(Link9)(Link10).


[CE Forum]
Well now you know why I'm here. I hope somebody here has seen something similar (I saw that Witcher 3 also uses Scaleform) and can help me


[Introduction - Long]
Well the first thing to do when you're playing on 21:9 and the HUD, FOV etc. isn't correct you go to wsgf and look for fixes(there's a Cheat table to fix the FOV[I mean I personally still haven't played much but people say that the FOV is terrible and you get hit from behind all the time because you literally can't see enemies 1m behind you])). If it isn't an easy config file to edit or a hex edit in the exe to change the aspect ratio you can look at 2 programms: Flawless Widescreen and Widescreen Fixer. Now I found out that the non-remastered Edition, Darksiders 2 has gotten all the necesarry fixes by Widescreen Fixer which is a programm which has its own .dll plugins for each game. So as the remaster didn't change that much on it's core level and both are DX9 the plugin could work. But when you try to start the plugin it immeadiatly crashes[this is because in the .dll it is set to search on start so it crashed when Darksiders2.exe is running]. So as I thought this was the easiest way to change that minimap problem I tried to fix the .dll for the remaster. To change a .dll you have to decompile it, make your changes and than recompile it but because of how Visual Studio works you have to decompile the exe too so Visual Studio can test/compile the .dll because you can't directly start a .dll. Okay so before I even change the .dll I have to test if I can recompile it without any changes made. But unfortunatly it couldn't because of Error CS0103 for "_003CEnable_003Eo__SiteContainer0" which I have no clue what it is(Link11)(Link12). Because I had absolutly no idea how to fix that problem I thought that I should be as the name suggests a part of the game which is responsible for changing the things this .dll fixes. To find them I came to Cheat Engine to get to look into the process and maybe find this mysterious thing that causes the error. To that point I knew Cheat Engine enough for simple value changes but I didnt even knew how to find pointers. Now in the present day I know enough to do the cheat engine tutorial and a little bit more
Back to top
View user's profile Send private message
Cortex
How do I cheat?
Reputation: 0

Joined: 20 May 2018
Posts: 2

PostPosted: Fri May 25, 2018 3:50 am    Post subject: Reply with quote

Well I'd like to update this post to maybe get promising advice or atleast just tell what I learned on the way. Spoiler: I wasn't able to do a desireable fix


Well If you're reading this you probably have some interest. Which is weird but that's up to you.

[Trying to find the value by scratch]
Cheat Engine
As you know to get to the value of the never changing position of the minimap symbols I tried to get to the values which might be close to it. These values are for once the visibility of the symbols and the other the orientation of the symbols meaning e.g. the player marker is pointing north and the relative position of the markers to each other e.g. when I rotate the camera the minimap rotates too and therefore the position of the questmarker and the players raven change. I sorted each of these values by my guess of their chances being near my goal and then searched by my guessed value type(visibility=boolean(and inverted boolean)) with possible value number(e.g. orientation is probably between -1&+1). When I reached a point where the value quantity didn't decline I got them all into the address list and tried freezing the value and when the found value didn't change but the real value did I increased range of value type and searched by value Changed/Unchanged (relative to last scan/to first scan). When the values did still change after freezing them I looked for writing operands and by replacing those with nothing which lead to the found value not changing while the actual value changed but often it just lead to game crash or even pc crash. When a crash occured I still had to verify that this address/operand wasn't the real address so I looked for writing/accessing addresses for the operands and doing break and trace with easy condition for the break which in 90% cases led to nothing but then I reached 2 different cases where I would go with breakpoints and see step-by-step-operand running when exactly the value for visibility was actually written and it led to one time where going over the breakpoint between 1-6 times did change the value so this was an end where it could be written before or after meaning this is probably not the right address and that other time where I was tracing for 400k steps on some operand to see when the visibility changed until I reached something like DS2.convertHextoRGB and changing something led to everything freezing and thousands of accessed addresses where I wasn't able to backtrace any further.

Another take I tried was the hook D3D feature to find the draw of that specific element on the screen and even after getting pictures of exactly the minimap markers I still don't know what to do with the results because I can't find any tutorial on this feature, the F1 help doesn't contain any information specifically on this feature(I think) and I can't interpret the result of the dissected data structure.

On a handful of addresses I also tried pointer scanning with up to offset 5000 and level 15 on addresses which were changing their values at the same time as my searched value meaning that their might be a chance that their pointer might change my sought address too but even after hours of scanning and filtering the results I still didn't find my desired address.

After all these tries I have scripts which can now trigger various things e.g. when replacing address "Darksiders2.exe"+A4A86 (Set.Identity 2-15) any HUD element vanishes except those minimap symbols which shows directly that the code/function that is responsible for the placement/boundaries of the HUD is perfect with one single mistake which are those symbols which just don't get restricted if aspect ratio exceeds 16:9.




[Trying to find the value by trying to fix]
Visual Studio 2017/ILSpy/dnSpy
As I said I took a look on the fix of the non-remastered Edition, which is 32bit, by Helifax back in 2012 released as a .dll for Widescreen Fixer by dopefish. After decompiling the .dll by ILSpy/dnSpy I tried to understand how his fix works but because when compiling some crucial information get lost(and the source code isn't on the internet)[there is however a github with the source code of widescreen fixer with some projects which helped alot] it was really hard to understand the .dll. If we forget that whole 0sitecontainer0 which won't let me compile anyway, one of the easy fixes of the .dll was the name of the Window class which was wrong and led to the .exe directly crashing when recognizing Darksiders2.exe because having both the if and the default case for a wrong window class name. Another one was the change of get.baseaddress to get.baseaddress64 without it nothing would work either but that all doesn't matter anyway because the .dll works the same as Cheat Engine works. It has its code for searching a codecave and allocating memory for itself(which is all that sitecontainer garbage) it's offsets from the base address for found values like compassX, compassY, mapAspectRatio etc. and variables which are the current resolution of the user which gets written to these addresses. Like Cheat Engine. So i thought that if I search for the code that gets replaced in the old one I could search for the same instructions in CE for the remaster. But because his values are stored in value type byte I first had to find a method of translating/converting them into hex/string. I created a topic at stackoverflow "Converting Assembler Byte Instruction to String" so I won't explain those Capstone things here too. To my pity none of these instructions/hex codes/aobs could be found in the remaster so I got myself an .exe of the non remaster from the internet and that's where we get to the next program:

IDA (Pro)
I actually used IDA alongside Cheat Engine before but that didn't yield any results either. To not make this any longer I found the addresses in the non-remaster and tried to find same-functions/functions that are near/any pattern to find these in the remaster but no luck.

I also tried some other things like GeDoSaTo trying to find the hashes for the hud and injecting GeDoSaTo at those points so it can disable the symbols but that didn't work or I didn't try hard enough although the other options like aa, ao, pp and bloom are working fine.


[My garbage "fix"]
1. Set the game to windowed and the last 16:9 resolution before yours(e.g. my OG Resolution is 3440x1440 so that means I set my reso to 2560x1440)
2. Restart game to apply effects
3. Open SRWE(SimpleRuntimeWindowEditor) in admin mode and remove borders and fake fullscreen
4. Get my CheatTable* in the attachment (or simply add address "Darksiders2.exe+1FF44E8) and change to your aspect ratio (default is 1.777 for me its 2.3888)
5. Optional in the CheatTable is a FOV Changer (full credits to Akuma) which you can find on other places too




If you're still reading than thank you for lending me your ears for like 5 min for what I wasted a whole week but this made me realize just how much time all these people put into these fixes and programms and I just wanna thank those people like Helifax but most importantly the one above all Dark Byte for creating a tool that has this much power. Not only for cheating in games but fixing things

P.S.: Adding additional scan tabs is awesome but additional address lists like browser tabs would be nice

PPS: It won't let me add the 2KB attachment because 8KB is the max size. Yes.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites