-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 Answers1

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
  • 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. – osaru badiaru Jul 09 '18 at 17:08
  • To view the edited program: https://yadi.sk/d/uIzNNqJ03YyQ4w To test the program's performance on saving: https://yadi.sk/d/d5Wb4CVM3XzPQx I really hope a solution can be contrived – osaru badiaru Jul 09 '18 at 17:16
  • seems like it works. is there a problem or did i just misunderstood? –  Jul 09 '18 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. – osaru badiaru Jul 09 '18 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. – osaru badiaru Jul 11 '18 at 00:41
  • The version of the program(0.0.0.3) that I sent to you before saved perfectly - meaning it saves my edits - however it corrupts the .sds files in the process. The version (0.0.0.1) that I resorted to editing instead - with your method - does not corrupt .sds files; however, it does not even save my edits. What a dilemma. I suspected that there was an issue in the method "Save Frame" but I do not know what part of the component is erroneous. My efforts to locate the cause of file corruption in version 0.0.0.3 would probably be in vain because I am inexperienced https://yadi.sk/d/RNjyTGy93YBDs4 – osaru badiaru Jul 13 '18 at 13:18
  • I'll try to find a solution. – osaru badiaru Jul 15 '18 at 18:20
  • Hey, Amirag. For weeks, you remained silent. Perhaps, there is a miscommunication between the two of us. To effectively describe my issue with the program, here is a saved webpage. It features a concern of mine which was closed by administrators and eventually deleted by their machine referred to as "Community". I documented the flaws of this program - the file corruption is explained. Basically, the new version corrupts files and the old version does not actually save edits performed on files. Please it read to your understanding. The webpage saved as a HTML: https://yadi.sk/d/UiRMZGNS3ZaEaF – osaru badiaru Jul 25 '18 at 21:44
  • Yes, i'm sorry about that. I got stressed at work and by the time i finished the project I forgot to check your problem. i'll have a look –  Jul 26 '18 at 10:51
  • Sounds interesting, where do you work and as what position? – osaru badiaru Jul 26 '18 at 11:35
  • you can find the patched executable here: http://www.filedropper.com/framereseditor5. turns out the original problem was caused because the original programmer replaced every dot with a comma and that caused the float conversion to treat numbers differently. for example, -0.997794330120087 was treated as -9.9E-13. i just repalced the commas back to dots. <too long, 1 sec> –  Jul 26 '18 at 12:01
  • in addition, i wrapped the conversion in try catch and returned Single.MinValue or Single.MaxValue, depending on the sign in the first char in the supplied string. that means you can enter any value you want, if it's too big, it'll just become Single.MaxValue. –  Jul 26 '18 at 12:01
  • and i am currently a web developer though i won't say i'm a good one –  Jul 26 '18 at 12:02
  • Can you list some of your projects? Are they public? Do you work single-handedly - without assistance? – osaru badiaru Jul 26 '18 at 14:54
  • I recently started, haven't done anything note-worthy. my background is mostly low level and programming stuff for ctf and such. sadly, nothing much to share. –  Jul 26 '18 at 15:52
  • @osarubadiaru so, is the most recent executable ok? is it working fine? –  Jul 31 '18 at 14:51
  • Yes, thank you, it works perfectly. It's malfunctioning is crazy and unexplainable. Although you detected errors in the program's components (i.e. Methods), I am sure that this was not the creator's intention. In fact many of the Russian users on Playground.ru reported that the program functioned flawlessly. This is where I obtained version 0.0.0.3: https://drive.google.com/file/d/0B5pcr1AnCX0LOUJlSS1QU0h5Tm8/view This where I obtained version 0.0.0.1: http://www.playground.ru/files/mafia_2_self_tools_nabor_utilit-83905/ I speculated that the program's respond differentlu to RussIan systems. – osaru badiaru Aug 02 '18 at 21:43
  • That's because of localization. I have no idea how, but you can make c# treat the data differently according to your system settings. for example, "3,123" might mean "3 thousand one hundred and twenty three" or "3 and eighth". anyway, glad that it worked –  Aug 03 '18 at 22:06
  • You said that the creator of the executable, Y.u.s.i.k, placed commas in a script instead of periods. In which Method was this blunder made? – osaru badiaru Aug 04 '18 at 18:40
  • in quite a few places. you can ctrl+f and search for "," (with quotes) to find every line he did it in. i only placed one line that repalces "," with "." becuase i wrapped every float conversion with the same function –  Aug 04 '18 at 23:39
  • Hey Amirag. I don't if you can still help me. There was another program that I wanted to bring to your attention; however, it seemed difficult for me t convey the issues that I had with such program - since the symptoms of error were in its effect on the game. I am sorry, if I am causing any inconvenience to you, as you were clearly able to help me during the summer of 2018,and it is uncertain if you are willing during this time period. Anyway, I abandoned it since August 2018, but have now been able to present you with data that will indicate that there is a corruption of files – osaru badiaru Mar 31 '19 at 20:50
  • The program is called Vechile_Editor.exe - https://ibb.co/kcnFXLt - which was created by Yusik - the programmer that also created another program that you are familiar with: FrameResEditor.exe. – osaru badiaru Mar 31 '19 at 21:47
  • Upon saving car files, such as jefferson_provincial.sds, on Vehicle_Editor, the edited cars begin to malfunction in the game, i.e., they start to accelerate at full speed, while weirdly remaining stationary, without any action performed by the player - such will often result in the 180 degree rotation of the car, its top facing the floor. This occurrence is displayed in the following image: https://ibb.co/BN97ZFj . This representation - i.e., the in-game image - of the error is what discouraged me from notifying you of this error before; I thought, from this image, you might have be confused – osaru badiaru Mar 31 '19 at 21:53
  • That is why I now decided to collect data that would indicate that the Vehicle_Editor.exe tool did corrupt files, and could elucidate such corruption.The program has a feature that exports the XML of the EntityDataStorage.bin(EDS) of car files. I took advantage of this feature and exported the XML of the original car file - "jefferson_provincialoriginal" - and the version that had been corrupted after saving it on the program -"jefferson_provincialpost-edit".I then proceeded to compare the two texts, and discovered that there were differences: https://ibb.co/tK1V92m and https://ibb.co/8Ny2XdL – osaru badiaru Mar 31 '19 at 22:02
  • In the images that display the comparison of the two different XML texts, the XML of the original file is located on the left column, while that of the corrupted file is displayed on right column. In such display, it is indicated that the program converts decimal values to whole values, as numbers such as 0.32 and 0.4 are changed to 32 and 4, respectively. These are the issues that I can perceive; perhaps your expertise in editing code written in C# will grant you a more thorough assessment of the flaws of this program. Here are the files that are required: https://yadi.sk/d/Kd6BYoOmb3kxmg – osaru badiaru Mar 31 '19 at 22:24
  • @osarubadiaru http://amirag.altervista.org/reversing/Vehicle_Editor_patched.exe the bug was again the localization of floats –  Apr 05 '19 at 21:43