tab是什么格式

tab是什么格式

1..tab文件格式

是存放游戏所有英文脚本的文件,文件内容是加密存储的,用一般文本编辑器打开是看不到任何可用信息。解密内容的方法是对文件所有字节与0xDD进行异或操作。
以下是解密文件的源码(C#):

private void button1_Click(object sender, System.EventArgs e)
{
// Create the reader for data.
FileStream fs = new FileStream("c:\\grim.tab", FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);

FileStream fs2 = new FileStream("c:\\text.txt", FileMode.Create);
BinaryWriter w = new BinaryWriter(fs2);
fs.Position = 4;
while(fs.Position < fs.Length)
{
w.Write((byte)(r.ReadByte()^ 0xdd));
}
r.Close();
w.Close();
fs.Close();
fs2.Close();

}

解密后的文件内容就是一般的文本,可以看到所有游戏对话都在其中。下面节选文件内容的2段进行分析:

sito030 Oh yeah, yeah. Yeah. That is what I told him.

sito031 Are you kidding me?

sito032 gave him the idea in the first place!

可以看出左边是说话人的名称标识,右边是说话的内容,分割这两者的是看似一个空格,其实是ASCII码表中的制表符Tab,16进制表示是0x09。

对游戏角本的汉化修改此文件的内容为中文就可以了,还有一点值得注意,修改完此文件后无需再对其反加密,只要将解密的文件保存成以前加密文件的文件名覆盖即可。应该是游戏运行时候会对文件是否加密进行判断

参考资料:http://zhidao.baidu.com/question/13853566.html?fr=ala0

温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-09-10
\r\n,是这个吗?