Skip to content
This repository was archived by the owner on Apr 7, 2021. It is now read-only.

Commit

Permalink
Phase 3 - Patch Support Extension. Updated MsgStringTable Addon and
Browse files Browse the repository at this point in the history
TranslateClient patch for upcoming client
  • Loading branch information
Neo-Mind committed Oct 8, 2015
1 parent 02ee0c7 commit 8e92ac1
Show file tree
Hide file tree
Showing 7 changed files with 3,290 additions and 166 deletions.
70 changes: 46 additions & 24 deletions Addons/ExtractMsgTable.qs
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,50 @@ function ExtractMsgTable() {
//Step 1d - Extract the tblAddr
offset = exe.Rva2Raw(exe.fetchDWord(offset2 + code.hexlength() - 4)) - 4;

//Step 2a - Read the reference file to an array - Korean in Hex
var fp = new TextFile();
var hArr = new Object();

var refArr = {};
var engArr = [];
var str = "";

//Step 2a - Read the reference file to an array - Korean ASCII
var index = 0;
fp.open(APP_PATH + "/Input/msgStringHex.txt", "r");
while(!fp.eof()) {
var line = fp.readline().trim();
hArr[line] = index;
index++;
}
var debug, i;
fp.open(APP_PATH + "/Input/msgStringRef.txt", "r");
while (!fp.eof()) {
var line = fp.readline();
str += line.toHex();

if (line.indexOf('#', line.length - 1) !== -1) {
refArr[str] = index;
str = "";
index++;
}
else {
str += " 0d 0a";
debug = str;
i = index;
}
}
fp.close();

//Step 2b - Read the reference file to an array - English translations
var engArr = [];

str = "";
fp.open(APP_PATH + "/Input/msgStringEng.txt", "r");
while(!fp.eof()) {
engArr.push(fp.readline());
}
fp.close();

while (!fp.eof()) {
var line = fp.readline();
str += line;

if (line.indexOf('#', line.length - 1) !== -1) {
engArr.push(str);
str = "";
}
else {
str += "\n";
}
}
fp.close();

//return i + ":" + debug + " " + engArr[i];

//Step 3 - Loop through the table inside the client - Each Entry
var done = false;
var id = 0;
Expand All @@ -79,14 +102,13 @@ function ExtractMsgTable() {
var start_offset = exe.Rva2Raw(exe.fetchDWord(offset+4));
var end_offset = exe.find("00", PTYPE_HEX, false, "", start_offset);

var msgstr = exe.fetchHex(start_offset, end_offset - start_offset);
msgstr = msgstr.replace(/ 0d 0a/g, " 5c 6e").trim();

var msgstr = exe.fetchHex(start_offset, end_offset - start_offset) + " 23";

//Step 3b - Map the Korean string to English
if (typeof(hArr[msgstr]) !== "undefined" && typeof(engArr[hArr[msgstr]]) !== "undefined")
fp.writeline(engArr[hArr[msgstr]]);
else
fp.writeline(msgstr.toAscii() + "#");
if (typeof(refArr[msgstr]) !== "undefined" && typeof(engArr[refArr[msgstr]]) !== "undefined")
fp.writeline(engArr[refArr[msgstr]]);
else
fp.writeline(msgstr.toAscii() + "#");

offset += 8;
id++;
Expand Down
Binary file modified CORE.dll
Binary file not shown.
8 changes: 8 additions & 0 deletions Core/funcs.qs
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,12 @@ Number.prototype.packToHex = function(size) {

Number.prototype.toBE = function(size) {
return this.packToHex(size).toBE();
}

Array.prototype.toRvaBE = function() {
var result = [];
for (var i = 0; i < this.length; i++) {
result.push(exe.Raw2Rva(this[i]).toBE());
}
return result;
}
Loading

0 comments on commit 8e92ac1

Please sign in to comment.