forked from Kaplas80/TranslationFramework2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Yakuza Kiwami GOG Edition
- Loading branch information
Showing
11 changed files
with
1,225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace TFGame.YakuzaKiwamiGOG | ||
{ | ||
public class Encoding : System.Text.Encoding | ||
{ | ||
private readonly System.Text.Encoding utf8Encoding = GetEncoding("UTF-8"); | ||
|
||
private List<Tuple<string, string>> DecodingReplacements; | ||
private List<Tuple<string, string>> EncodingReplacements; | ||
|
||
public Encoding() : base() | ||
{ | ||
DecodingReplacements = new List<Tuple<string, string>> | ||
{ | ||
new Tuple<string, string>("\\", "¥"), | ||
new Tuple<string, string>("\u007F", "®"), | ||
new Tuple<string, string>("\r", "\\r"), | ||
new Tuple<string, string>("\n", "\\n"), | ||
|
||
}; | ||
|
||
EncodingReplacements = new List<Tuple<string, string>> | ||
{ | ||
new Tuple<string, string>("\\r", "\r"), | ||
new Tuple<string, string>("\\n", "\n"), | ||
//new Tuple<string, string>("®", "\u007F"), | ||
new Tuple<string, string>("¥", "\\"), | ||
}; | ||
|
||
} | ||
|
||
public override int GetByteCount(string str) | ||
{ | ||
var bytes = GetBytes(str); | ||
return bytes.Length; | ||
} | ||
|
||
public override int GetByteCount(char[] chars, int index, int count) | ||
{ | ||
return utf8Encoding.GetEncoder().GetByteCount(chars, index, count, true); | ||
} | ||
|
||
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) | ||
{ | ||
return utf8Encoding.GetEncoder().GetBytes(chars, charIndex, charCount, bytes, byteIndex, true); | ||
} | ||
|
||
public override byte[] GetBytes(string s) | ||
{ | ||
var str = s; | ||
|
||
foreach (var t in EncodingReplacements) | ||
{ | ||
str = str.Replace(t.Item1, t.Item2); | ||
} | ||
|
||
return GetBytes(str.ToCharArray(), 0, str.Length); | ||
} | ||
|
||
public override int GetCharCount(byte[] bytes, int index, int count) | ||
{ | ||
return utf8Encoding.GetDecoder().GetCharCount(bytes, index, count, true); | ||
} | ||
|
||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) | ||
{ | ||
return utf8Encoding.GetDecoder().GetChars(bytes, byteIndex, byteCount, chars, charIndex, true); | ||
} | ||
|
||
public override int GetMaxByteCount(int charCount) | ||
{ | ||
return utf8Encoding.GetMaxByteCount(charCount); | ||
} | ||
|
||
public override int GetMaxCharCount(int byteCount) | ||
{ | ||
return utf8Encoding.GetMaxCharCount(byteCount); | ||
} | ||
|
||
public override string GetString(byte[] bytes, int index, int count) | ||
{ | ||
var str = new string(GetChars(bytes, index, count)); | ||
|
||
foreach (var t in DecodingReplacements) | ||
{ | ||
str = str.Replace(t.Item1, t.Item2); | ||
} | ||
|
||
return str; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace TFGame.YakuzaKiwamiGOG.Files.Dll | ||
{ | ||
public class File : YakuzaGame.Files.Exe.PEFile | ||
{ | ||
protected override string PointerSectionName => ".data\0\0\0"; | ||
protected override string StringsSectionName => ".rdata\0\0"; | ||
|
||
protected override List<Tuple<long, long>> AllowedStringOffsets => new List<Tuple<long, long>> | ||
{ | ||
new Tuple<long, long>(0x16CC80, 0x16DDB0), | ||
new Tuple<long, long>(0x186F50, 0x1A5E50), | ||
}; | ||
|
||
public File(string gameName, string path, string changesFolder, System.Text.Encoding encoding) : base(gameName, path, changesFolder, encoding) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using YakuzaGame.Files.Exe; | ||
|
||
namespace TFGame.YakuzaKiwamiGOG.Files.Exe | ||
{ | ||
public class File : YakuzaGame.Files.Exe.File | ||
{ | ||
// Buscar "data/font". La tabla empieza 0x1900 bytes antes | ||
protected override long FontTableOffset => 0xCB8A60; | ||
protected override string PointerSectionName => ".data\0\0\0"; | ||
protected override string StringsSectionName => ".rdata\0\0"; | ||
|
||
protected override int ChangesFileVersion => 2; | ||
protected override List<Tuple<long, long>> AllowedStringOffsets => new List<Tuple<long, long>>() | ||
{ | ||
new Tuple<long, long>(0x00C4C628, 0x00C4C628), | ||
new Tuple<long, long>(0x00C51B58, 0x00C51B70), | ||
new Tuple<long, long>(0x00C5AE68, 0x00C5AE78), | ||
new Tuple<long, long>(0x00C5B0B8, 0x00C5B2F8), | ||
new Tuple<long, long>(0x00C5BEA0, 0x00C5BEE0), | ||
new Tuple<long, long>(0x00C5C868, 0x00C5D6A0), | ||
new Tuple<long, long>(0x00C5EB50, 0x00C5EB60), | ||
new Tuple<long, long>(0x00C5EBD8, 0x00C5EBF0), | ||
new Tuple<long, long>(0x00C5F6E0, 0x00C63030), | ||
new Tuple<long, long>(0x00D0EA20, 0x00D0EA20), | ||
new Tuple<long, long>(0x00D0F780, 0x00D0F7F0), | ||
new Tuple<long, long>(0x00D0FD50, 0x00D0FD50), | ||
new Tuple<long, long>(0x00D54A90, 0x00D54A90), | ||
new Tuple<long, long>(0x00D56A48, 0x00D56A68), | ||
new Tuple<long, long>(0x00D5ABD0, 0x00D611A0), | ||
new Tuple<long, long>(0x00DC7E20, 0x00DC7E84), | ||
new Tuple<long, long>(0x00DC8510, 0x00DE1D18), | ||
}; | ||
|
||
protected override List<ExePatch> Patches => new List<ExePatch>() | ||
{ | ||
new ExePatch | ||
{ | ||
Name = "Usar codificación ISO-8895-1", | ||
Description = "Cambia la codificación de los textos a ISO-8895-1 (NO SE REPRESENTARÁN CARACTERES UTF-8)", | ||
Enabled = false, | ||
Patches = new List<Tuple<long, byte[]>> | ||
{ | ||
new Tuple<long, byte[]>(0x158E77, new byte[] {0xEB, 0x1E, 0x90}), | ||
}, | ||
}, | ||
|
||
// Buscar el primer "CoInitialize". La cadena está justo antes | ||
new ExePatch | ||
{ | ||
Name = "Cambiar posición de ¥", | ||
Description = "Cambia la posición del símbolo ¥ a la derecha de la cifra (de ¥1000 a 1000¥)", | ||
Enabled = false, | ||
Patches = new List<Tuple<long, byte[]>> | ||
{ | ||
new Tuple<long, byte[]>(0xDF35AC, new byte[] {0x25, 0x73, 0x5c}) | ||
}, | ||
}, | ||
}; | ||
|
||
public File(string gameName, string path, string changesFolder, System.Text.Encoding encoding) : base(gameName, path, changesFolder, encoding) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.