Thread: [TEC] Modding SH3
View Single Post
Old 11-13-18, 08:12 AM   #104
Tycho
Sonar Guy
 
Join Date: Oct 2009
Location: Sofia, Bg
Posts: 384
Downloads: 264
Uploads: 1


Default Screenshots

Some time ago I realised, that to make the screenshots to go in separated folder will be very easy.
You know, the screenshots are written in the main directory, between the other files.
I have two variants for that.
Will put this here, until update my TychoSh3Patch.

So, I open sh3.exe with HexEditor and use search for text - ".bmp", and found this string: "SH3Img@%u-%u-%u_%u.%u.%u_%u.bmp"
 



It is in rdata section, and must be used somewhere in the code section, by it address.
I look the address of the first byte, and I go in beginning of the file and use search for hex value: ecda5100
And found it here:
 



I see that it is pushed there, but let's look the disassembled code for more explicit view.
I take the address for the previous byte "68" and go there in the disassembled code:
 



So, I see that the string is pushed, then something else is pushed, and then have call for function that will use this pushes.
Further research shows that this function is: MSVCR71.DLL!sprintf
Looking further, how this function is used in other places in the code, I see that there is no problem the string to be pointed with location.
The conclusion is that, I can very easy make the game to write the screenshots in separate folder, with change of only one byte.

I go back to the string and change this byte (address: 0011DAF2) from 40 to 5C, from @ to \
 



For use with TychoSh3Patch:
 
Code:
@@@ The screenshots will go to the SH3Img folder
#
0011DAF2: 40 5c
#
#

I go in the main game directory and I create a new folder named exactly SH3Img.
Now, the screenshot will be written to the "SH3Img" folder, but the screenshot will not have this prefix: SH3Img@date_hour.minutes...bmp,
but will start directly with the date, for example: 17-10-2018_18.35.42_681.bmp

But, for me is more satisfactory the folder to be named "Screenshots", so I make something else.
I see that to the end of the rdata section have some free space. So, I write there:
Screenshots\SH3Img@%u-%u-%u_%u.%u.%u_%u.bmp
 



Then, I take the address of the first byte: 0013A100, I go to where the string is pushed (00001A4E) and change the bytes there, from: ECDA5100 to 00A15300.
 



For use with TychoSh3Patch:
 
Code:
@@@ The screenshots will go to the Screenshots folder
#
00001A4E: ec 00
00001A4F: da a1
00001A50: 51 53
00001A51: 00 00
@
0013A100: 00 53
0013A101: 00 63
0013A102: 00 72
0013A103: 00 65
0013A104: 00 65
0013A105: 00 6e
0013A106: 00 73
0013A107: 00 68
0013A108: 00 6f
0013A109: 00 74
0013A10A: 00 73
0013A10B: 00 5c
0013A10C: 00 53
0013A10D: 00 48
0013A10E: 00 33
0013A10F: 00 49
0013A110: 00 6d
0013A111: 00 67
0013A112: 00 40
0013A113: 00 25
0013A114: 00 75
0013A115: 00 2d
0013A116: 00 25
0013A117: 00 75
0013A118: 00 2d
0013A119: 00 25
0013A11A: 00 75
0013A11B: 00 5f
0013A11C: 00 25
0013A11D: 00 75
0013A11E: 00 2e
0013A11F: 00 25
0013A120: 00 75
0013A121: 00 2e
0013A122: 00 25
0013A123: 00 75
0013A124: 00 5f
0013A125: 00 25
0013A126: 00 75
0013A127: 00 2e
0013A128: 00 62
0013A129: 00 6d
0013A12A: 00 70
#
#

I go in the main game directory and I create a new folder named exactly Screenshots.
Now, the screenshot will be written to the "Screenshots" folder.
__________________
If you ride like lightning, you're gonna crash like thunder.
Tycho is offline   Reply With Quote