-3

There is this game called Mafia 2 and since its release modders hve been trying to access encrypted files in the game. It was not until the years 2013 and 2014 that a Russian modder that goes by the name of Y.u.s.i.k created programs with the sole purpose of decompiling particular files in the game. One of these programs is the FrameRes_Editor.exe, it gives users the ability to modify certain components of selected vehicles in the game via the alteration of a Frameresource,bin file that is located inside the selected car file.. However, whenever I try to open car files, I receive an error notification that prevents me from saving any work performed. I am always met with an error detection whenever I try to edit a car: " value was either too large or too small ".

http://img.playground.ru/images/5/9/Capture_FrameResource_Error_Possiblly_Faulty_Program.PNG

There are files that were created by the Mafia 2 developers and this program will even classify the work of these professionals as erroneous, incorrect. Some example of this are the "jefferson_provincial.sds" and "smith_200_pha.sds" file. The program will even detect errors in unmodified content. I did nothing to the "jefferson_provincial.sds", the program detects an error in nearly ALL of the cars. This is obviously wrong because the modification of most car files date back to 2010.

http://img.playground.ru/images/1/2/Capture_Mafia_2_Cars_Folder_Unmodified_Content.PNG

I am not requesting that helpers download the game to assist me, rather I am only asking that you download the program along with the provided .sds file. You will see that you cannot save such file - even after running the program as administrator. This is due to a STUPID error that is unnecessary since I mentioned that a majority of cars, regardless of their modification, are classified as erroneous. I am in need of a capable computer programmer. It would be great if someone could edit the FrameRes_Editor.exe program in a way that could allow users to circumvent this error detection. that way, I could still save files after false errors are detected.

Here are the files:

FrameRes_Editor.exe

https://yadi.sk/d/Zjv_wkgj3XzPDr

smith_200_pha.sds

https://yadi.sk/d/d5Wb4CVM3XzPQx

1 Answer 1

3

So, i tracked your bug.

The simple explanation:
some values in the file are too large/small for the program to handle,
you'll need to re-write them. basiclly, everything past 3E+38 will prevent the program from working. I lack knowlage in C# and never tried patching C# programs so that's all i can offer. Also note that some values might affect in-game stuff, I do not know how different the result might be - i can only hope that it'll be unnoticable.

Now, a bit info on the problem:
The program was written in C# so i could get the source code. i used dnSpy.
The error was inside a function named "Bound_Write", it tries to convert a String to float using Convert.toSingle().
A value in the Blend section in the file was "a bit" over 3.4E+38 and it threw an exception. That exception triggered the alert and stopped the saving process.
The Single.MaxValue is around 3.4E+38, so I just rounded the number to 3E+38.
You can find the modified "smith_200_pha.sds" here:

https://files.fm/u/cm4wk8yk

EDIT:
i ended up patching the executable, turns out it wasn't that difficult. dnSpy has a built-in option for that.
note, it only takes care of cases where the input is in the form of 3...E+38, positive and negative. it means that if you have 4.1E39 for example, this patch will NOT work. i am not fully aware of C# limitations and what numbers the game allows his fields to have. this patch is solely for convenience and doesn't make this progrem flawless. the patched executable can be found here:

https://www.filedropper.com/framereseditor1
26
  • Hey, Amirag, thank you for your help; I was able to follow your approach in fixin the Single related error detection issue. However, the program does not save anything at all. I also discovered that it was an issue in the original, unedited version - which would indicate that was not the edit on dnSpy. Once an .sds file is saved in the program via the "Save As" button, the detail in the property .sds file acknowledges such modification, but the file content does not. The program disregards the edits performed on the file and reverts such file to its original condition - nothing can be saved. Jul 9, 2018 at 17:08
  • To view the edited program: yadi.sk/d/uIzNNqJ03YyQ4w To test the program's performance on saving: yadi.sk/d/d5Wb4CVM3XzPQx I really hope a solution can be contrived Jul 9, 2018 at 17:16
  • seems like it works. is there a problem or did i just misunderstood?
    – user22970
    Jul 9, 2018 at 20:35
  • I told you, it doesn't save any edits. You might have thought that I meant that there was an exception in the program's saving. However, that is not the case; the edits to .sds files are not saved. Try altering a number or more in the provided .sds file, and return to such file after saving to see if the saving function of the program is flawless. Jul 9, 2018 at 21:00
  • For example, if you changed a value in the .sds file through the program, then such edit would not be saved. There will be no error notification or exception when the save button is pressed; however, the content of the .sds file remains the same. You could test this by simply changing a value in the .sds file via the program, then saving the file. Afterwards, you can return to the file to discover whether or not such edit was saved. Jul 11, 2018 at 0:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.