How to adapt the tool RE4 TextExtract/Inject?
-
- Posts: 129
- Joined: Mon Aug 22, 2016 10:30 am
How to adapt the tool RE4 TextExtract/Inject?
Hi guys, I am trying to translate the Resident Evil 4 game, PS2 version for my language. I managed to extract the text scripts of ss_file.dat thanks to the script made by aluigi. The files in MDT folder from ss_file.dat it seems to be MDT 1 format, as in pc version. The header of the files in MDT folder is 0x43 0? 0? 0?. The tool RE4 Text Extract support the scripts texts with 0x43 header, but when I use the tool, the following message is showed; "error string main arg ]"
There is an way to adapt the RE4 TextExtract/Inject tool for 00001.dat, 00002.dat files in RE4 game (ps2 version).
The sample of files are in an attached folder.
There is an way to adapt the RE4 TextExtract/Inject tool for 00001.dat, 00002.dat files in RE4 game (ps2 version).
The sample of files are in an attached folder.
-
- Posts: 129
- Joined: Mon Aug 22, 2016 10:30 am
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: How to adapt the tool RE4 TextExtract/Inject?
Well done with the chartable.
The following is a lame experiment for displaying the strings (no editing, just an experiment):
The following is a lame experiment for displaying the strings (no editing, just an experiment):
Code: Select all
set TABLE binary "\x20\x3f\x3f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x25\x26\x2b\x2d\x2f\x3d\x2c\x2e\x2e\x00\x28\x29\x21\x3f\x22\x3b\x7e\xa4\x3f\x3c\x3e\x5b\x5d\x3b\x3b\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\xe2\xea\xee\xf4\xfb\xc2\xca\xce\xd4\xdb\xe0\xe8\xec\xf2\xf9\xc0\xc8\xcc\xd2\xd9\xe1\xe9\xed\xf3\xfa\xfd\xc1\xc9\xcd\xd3\xda\xdd\xe4\xeb\xef\xf6\xfc\xff\xc4\xcb\xcf\xd6\xdc\x9f\xe3\xf5\xc3\xd5\xf1\xd1\xe5\xc5\xe7\xc7\xf8\xd8\xde\xfe\x9a\x8a\xdf\xd0\x83\xb5\xf0\xe6\x9c\xc6\x8c\xb0\xa1\xbf\x27\x99\x3b\x23\x3b\x3f\x3f\x3f\x3f\x3b\x3b\x3b\xae"
get DUMMY long
get STRINGS long
for i = 0 < STRINGS
get OFFSET long
savepos BCK_OFF
goto OFFSET
log MEMORY_FILE 0 0
for x = 0 < 5
get TMP short
next x
for x = 0
get TMP short
if TMP <= 1
break
endif
if TMP < 0x80 || TMP > 0x130
math TMP = '_'
else
math TMP - 0x80
getvarchr TMP TABLE TMP
endif
put TMP byte MEMORY_FILE
next x
get SIZE asize MEMORY_FILE
#log "" 0 SIZE MEMORY_FILE
goto 0 MEMORY_FILE
getdstring STR SIZE MEMORY_FILE
print "%STR%"
goto BCK_OFF
next i
-
- Posts: 129
- Joined: Mon Aug 22, 2016 10:30 am
Re: How to adapt the tool RE4 TextExtract/Inject?
Thank you very much aluigi, I will be to test the script, and any results I will be post here. Thank you!
-
- Posts: 129
- Joined: Mon Aug 22, 2016 10:30 am
Re: How to adapt the tool RE4 TextExtract/Inject?
aluigi, the quickbms in reading operation show manys messages, i.e. SCRIPT MESSAGE a, etc.
I used the 'log NAME OFFSET SIZE' option in the end of script, before the 'next i' command. So, the quickbms create a file called 'NAME' with many characters into, as you said. Now how I can edit the script to achieve the texts in ASCII default for me edit them?
I used the 'log NAME OFFSET SIZE' option in the end of script, before the 'next i' command. So, the quickbms create a file called 'NAME' with many characters into, as you said. Now how I can edit the script to achieve the texts in ASCII default for me edit them?
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: How to adapt the tool RE4 TextExtract/Inject?
You can only view the data. No editing/reimporting.
Instead of 'log NAME OFFSET SIZE' you can just uncomment the '#log "" 0 SIZE MEMORY_FILE' instruction.
Instead of 'log NAME OFFSET SIZE' you can just uncomment the '#log "" 0 SIZE MEMORY_FILE' instruction.
-
- Posts: 129
- Joined: Mon Aug 22, 2016 10:30 am
Re: How to adapt the tool RE4 TextExtract/Inject?
But is possible to create an script for convert the chars for ASCII in editing mode, I need of the texts ready for editing, so I can continue my translation. I got translate some graphics for my language, some words as 'Buy' 'Sell' and 'Tune Up'. But the main texts and the report files are not in graphics.
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: How to adapt the tool RE4 TextExtract/Inject?
You can try this script.
With ENCODE = 0 it decodes the file.
With ENCODE = 1 it re-encodes the file.
You need to use quickbms with the -w option because it modifies the original file.
With ENCODE = 0 it decodes the file.
With ENCODE = 1 it re-encodes the file.
You need to use quickbms with the -w option because it modifies the original file.
Code: Select all
# EDIT THIS VALUE! 0 to convert and 1 to convert back!
math ENCODE = 0
set MEMORY_FILE10 binary "\x20\xff\xff\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x25\x26\x2b\x2d\x2f\x3d\x2c\x2e\x2e\xff\x28\x29\x21\x3f\x22\x3b\x7e\xa4\xff\x3c\x3e\x5b\x5d\x3b\x3b\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a" # "\xe2\xea\xee\xf4\xfb\xc2\xca\xce\xd4\xdb\xe0\xe8\xec\xf2\xf9\xc0\xc8\xcc\xd2\xd9\xe1\xe9\xed\xf3\xfa\xfd\xc1\xc9\xcd\xd3\xda\xdd\xe4\xeb\xef\xf6\xfc\xff\xc4\xcb\xcf\xd6\xdc\x9f\xe3\xf5\xc3\xd5\xf1\xd1\xe5\xc5\xe7\xc7\xf8\xd8\xde\xfe\x9a\x8a\xdf\xd0\x83\xb5\xf0\xe6\x9c\xc6\x8c\xb0\xa1\xbf\x27\x99\x3b\x23\x3b\xff\xff\xff\xff\x3b\x3b\x3b\xae"
get TABLE_SIZE asize MEMORY_FILE10
math TABLE_SIZE - 1 # final 0x00
get DUMMY long
get STRINGS long
for i = 0 < STRINGS
get OFFSET long
putarray 0 i OFFSET
next i
get OFFSET asize
putarray 0 i OFFSET
for i = 0 < STRINGS
getarray OFFSET 0 i
math i + 1
getarray CHARS 0 i
math CHARS - OFFSET
math CHARS / 2
goto OFFSET
for x = 0 < CHARS
get TMP short
if TMP != 0
if ENCODE == 0
# 0x08 is probably '\r' and 0x01 may be '\n'
if TMP >= 0x80
math TMP - 0x80
if TMP < TABLE_SIZE
getvarchr TMP MEMORY_FILE10 TMP
if TMP != 0xff
goto -2 0 SEEK_CUR
put TMP short
endif
endif
endif
else
math IDX = -1
for z = 0 < TABLE_SIZE
getvarchr TMP2 MEMORY_FILE10 z
if TMP2 == 0xff
elif TMP2 == TMP
math IDX = z
math z = TABLE_SIZE # break
endif
next z
if IDX >= 0
math IDX + 0x80
goto -2 0 SEEK_CUR
put IDX short
endif
endif
endif
next x
next
-
- Posts: 129
- Joined: Mon Aug 22, 2016 10:30 am
Re: How to adapt the tool RE4 TextExtract/Inject?
The script works fine here, my translation is getting good. Thanks for everything aluigi.