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

Commit 373c011

Browse files
committed
up 1.0.0.8
1 parent 9ae3f92 commit 373c011

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+9135
-11896
lines changed

ConsoleApplication/ConsoleApplication.cpp

Lines changed: 113 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "stdafx.h"
55
#pragma comment (lib, "Version.lib")
6-
6+
void TEST(char* In, char*In2, char*Out);
77
BOOL GetFileVersion()
88
{
99

@@ -89,42 +89,56 @@ int main(int argc, char *argv[])
8989
printf("\n [SpaceEngine 汉化生成器 1.0.0.7]\n\n");
9090
Color(0x7);
9191
if (argc == 3) {
92+
printf("[翻译模式]\n");
9293
WCharAdd.WMainInit();
9394
TEST(argv[1], argv[2]);
9495
}
9596
else if (argc==5) {
97+
printf("[读取内存模式]\n");
9698
ReadAdd RA(argv[1], argv[2], argv[3],atoi(argv[4]));
9799

98100

99101
}
100102
else if (argc==4) {
103+
if(strstr(argv[3],"%")!=0){ printf("[读取CEXML模式]\n");
101104
GetOff GF(argv[1], argv[2], argv[3]);
105+
}
106+
else {
107+
printf("[排除模式]\n");
108+
TEST(argv[1], argv[2], argv[3]); }
102109

103110
}
104111
else {
105112

106113
Color(0XA);
107-
printf("\n用法: %s [输入文件] [输出文件]\n 读取SE内存: %s [偏移列表文件] [输出文件] [输出格式] [PID] \n CE XML格式地址析出 %s [输入文件] [输出文件] [输出格式]", argv[0], argv[0], argv[0]);
114+
printf("\n用法: 自动翻译: %s [输入文件] [输出文件]\n 排除翻译: %s [输入文件] [排除列表文件] [输出文件]\n 读取SE内存: %s [偏移列表文件] [输出文件] [输出格式] [PID] \n CE XML格式地址析出 %s [输入文件] [输出文件] [输出格式]", argv[0], argv[0], argv[0], argv[0]);
108115
Color(0xC);
109-
printf("\n [翻译模式] 输入文件必须使用Unicode编码,现在存在FontConfig\\FontTexture字符的行会被忽略.\n");
116+
printf("\n [翻译模式] 输入文件必须使用Unicode编码,现在存在FontConfig\\FontTexture字符的行会被忽略,请以空行结尾.\n");
110117
Color(0x7);
111118
printf("\n 程序目录下需要Config.ini字符配置文件 若不存在则自动创建\n 翻译一行一个\n 要复制的话最好用UE的[用户剪切板(ctrl+数字)]去复制,系统剪切板会破坏内容\n 即便如此,有时一些内容仍然会被破坏,请自行检查.重点检查换行是否正常(一般是被插入0A)\n 错误的字节用16进制编辑删除.\n \n示例");
112119
Color(0xB);
113-
printf("\n 命令: %s gui.txt chs-gui.cfg\n ", argv[0]);
120+
printf("\n 命令: %s gui.txt chs-gui.cfg\n", argv[0]);
114121
Color(0xE);
115-
printf("输入文件内容: \"SYSTEM\" \"系统\" \n");
122+
printf(" 输入文件内容: \"SYSTEM\" \"系统\" \n");
123+
124+
Color(0x7);
125+
printf("\n [排除翻译] 排除列表文件内粘贴SE.log里提示的未知翻译 输出过滤后的翻译,过滤对于某版本无用的翻译可以增加加载速度\n示例");
126+
Color(0xB);
127+
printf("\n 命令: %s gui.txt exc.txt gui2.txt\n ", argv[0]);
116128
Color(0x7);
117-
printf("\n [读取内存模式] 根据文件内偏移读取内存并输出到文件 格式化需要两个格式化参数 %%X或%%d 和%%s 详参printf函数输出格式");
129+
130+
Color(0x7);
131+
printf("\n [读取内存模式] 根据文件内偏移读取内存并输出到文件 格式化需要两个格式化参数 %%X或%%d 和%%s 详参printf函数输出格式,");
118132
Color(0xC);
119133
printf("\n 若仍不了解请使用示例格式 0x00 %%X = %%s\n 输入文件内必须是偏移值而不是内存地址 错误的偏移值可能会导致程序爆炸 ");
120134
Color(0x7);
121-
printf("\n 用CE搜个绿色基址然后点开看到后面的XXX.exe + ABCD... 的 + XXX部分就是偏移了\n PID是进程ID 打开任务管理器看");
135+
printf("\n 用CE搜个绿色基址然后点开看到后面的XXX.exe + ABCD... 的 + XXX部分就是偏移了\n PID是进程ID 打开任务管理器看 此功能用于汉化无法通过gui.cfg改变的字串\n示例");
122136
Color(0xB);
123-
printf("\n 命令: %s offset.txt out.txt 0x00%%X=%%s \n ", argv[0]);
137+
printf("\n 命令: %s offset.txt out.txt 0x00%%X=%%s [PID] \n ", argv[0]);
124138
Color(0xE);
125139
printf("输入文件内容: 0x0012345 \n");
126140
Color(0x7);
127-
printf("\n [CE XML地址析出] 从CE内复制的地址是XML格式的 无法直接进行读取,故添加此功能 用于配合[读取内存模式]\n 输出格式同上 %%s输出 程序+偏移 %%d或%%X 只输出偏移");
141+
printf("\n [CE XML地址析出] 从CE内复制的地址是XML格式的 无法直接进行读取,故添加此功能 用于配合[读取内存模式]\n 输出格式同上 %%s输出 程序+偏移 %%d或%%X 只输出偏移 \n示例");
128142
Color(0xB);
129143
printf("\n 命令: %s ce.txt ceout.txt %%s\n %s ce.txt ceout.txt %%d\n %s ce.txt ceout.txt %%X\n ", argv[0], argv[0], argv[0]);
130144
Color(0x7);
@@ -171,6 +185,95 @@ int main(int argc, char *argv[])
171185
CloseHandle(hHandle);
172186
return 0;
173187
}
188+
std::vector<std::wstring> wstrv;
189+
190+
void TEST(char* In, char*In2,char*Out) {
191+
FILE*fp, *fp2,*fp3;
192+
fopen_s(&fp, In, "rb");
193+
fopen_s(&fp2, In2, "rb");
194+
fopen_s(&fp3, Out, "wb+");
195+
if (fp == 0|| fp3 == 0 || fp2 == 0) {
196+
printf("打开文件失败");
197+
return;
198+
}
199+
fseek(fp2, 0, SEEK_END);
200+
size_t len = ftell(fp2) / 2;
201+
wchar_t *buf2 = new WCHAR[len];
202+
rewind(fp2);
203+
fread(buf2, sizeof(wchar_t), len, fp2);
204+
//std::wstring ws = buf2;
205+
size_t l = 0,st=0;
206+
WCHAR P = 0;
207+
std::wstring ws;
208+
printf("读取排除列表\n");
209+
while (l < len) {
210+
P = buf2[l++];
211+
212+
if (P == '"') { st++;
213+
continue;
214+
}
215+
if (P == '\r'|| P == '\n')st = 0;
216+
else if (st == 1&&P!='"') {
217+
ws.push_back(P);
218+
219+
}
220+
else if (st == 2) {
221+
if(ws.size()>0){
222+
wstrv.push_back(ws);
223+
ws.clear();
224+
}
225+
//st = 0;
226+
//st = 0;
227+
}
228+
229+
230+
}
231+
delete[] buf2;
232+
fseek(fp, 0, SEEK_END);
233+
len = ftell(fp) / 2;
234+
rewind(fp);
235+
wchar_t *buf = new WCHAR[len];
236+
fread(buf, sizeof(wchar_t), len, fp);
237+
buf[0] = ' ', buf[len - 1] = 0;
238+
239+
l = 0;
240+
st = 0;
241+
ws.clear();
242+
printf("开始排除\n");
243+
std::wstring TMP;
244+
while (l <len) {
245+
P= buf[l++];
246+
ws.push_back(P);
247+
if (P == '"')st++;
248+
if (st == 1 && P != '"')TMP.push_back(P);
249+
if (P == '\r' || P == '\n'){
250+
st = 0;
251+
if (ws.size() > 4) {
252+
for (std::vector < std::wstring>::iterator it = wstrv.begin();it != wstrv.end();it++){
253+
// if(ws.find(L"Accelerating")!=std::string::npos) printf("W2[%d]:[%d] %ws\n", ws.size(), TMP.size(), ws.c_str());
254+
if ((*it).compare(TMP) == 0) { TMP.clear(), ws.clear(); }
255+
}
256+
257+
//WCharAdd.Start(ws, &str);
258+
// printf("W2[%d]\n", ws.size());
259+
if(ws.size()>0){
260+
if (ws.find('\n') == std::wstring::npos)ws.push_back('\n');
261+
fwrite(ws.c_str(), sizeof(WCHAR), ws.size(), fp3);
262+
ws.clear();
263+
}
264+
}
265+
266+
TMP.clear();
267+
//st = 0;
268+
//st = 0;
269+
}
270+
271+
}
272+
delete[] buf;
273+
fclose(fp);
274+
fclose(fp2);
275+
fclose(fp3);
276+
}
174277

175278
void TEST(char* In, char*Out) {
176279
FILE*fp, *fp2;
@@ -201,6 +304,7 @@ void TEST(char* In, char*Out) {
201304
}
202305
i++,j++;
203306
}
307+
delete[] buf;
204308
fclose(fp);
205309
fclose(fp2);
206310
}

ConsoleApplication/stdafx.h

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,15 @@ struct STA{
2020
char *str;
2121
};
2222
// TODO: 在此处引用程序需要的其他头文件
23-
/*
24-
struct OffSet {
25-
int Off = 0;
26-
int Width = 12;
27-
};
2823

29-
struct PageInfo {
30-
char *File;
31-
int OffSetX = 0;
32-
int OffSetY = 0;
33-
int PX = 0;
34-
int PY = 0;
35-
bool use = false;
36-
};
37-
*/
3824
struct WChar {
3925
bool use = false;
4026
BYTE str[2] = { 0 };
4127
BYTE ID = 0;
4228
long Size = 0;
4329
int UseSize = 0;
4430
};
45-
31+
extern std::vector<std::wstring> wstrv;
4632
void TEST(char* In, char*Out);
4733
class SEL {
4834
const char* ConfigFile = "Config.ini";
@@ -198,6 +184,66 @@ class SEL {
198184
// Start(ID, L"\"dwadDAWF\" \"昵称自定义\" ");
199185
}
200186
bool O = true;
187+
std::string* Start(std::wstring str, std::string *pstr) {
188+
189+
if (str.find(L"FontConfig")!=std::wstring::npos || str.find(L"FontTexture") != std::wstring::npos) {
190+
191+
//std::string T= WcharToChar(str.c_str());
192+
pstr->operator=(WcharToChar(str.c_str()));
193+
194+
return pstr;
195+
196+
197+
}
198+
std::wstring TMP;
199+
size_t size = str.size(),st=0,i = 0;
200+
201+
while (i < size&&str[i] != ';') {
202+
203+
if(st==0)pstr->push_back(BYTE(str[i]));
204+
else if (st == 1) {
205+
206+
if(str[i]!='"')TMP.push_back(str[i]);
207+
// printf("W4[%d]\n",TMP.size());
208+
pstr->push_back(BYTE(str[i]));
209+
}
210+
else if (st == 2) {
211+
for (std::vector < std::wstring>::iterator it = wstrv.begin();it != wstrv.end();it++) if ((*it).compare(TMP) == 0) {pstr->clear();break;}
212+
213+
TMP.clear();
214+
// pstr->insert(0, " \"");
215+
pstr->push_back(BYTE(str[i]));
216+
// pstr->insert(pstr->size(), "\" \"");
217+
218+
}
219+
else if (st == 3) {
220+
if (Wstr[str[i]].str[1] == 0) {
221+
pstr->push_back('#');
222+
if (Wstr[str[i]].Size == 0) {
223+
STA S;
224+
S.str = WcharToCharOne(&str[i]);
225+
S.ID[0] = str[i];
226+
No.push_back(S);
227+
}
228+
Wstr[str[i]].Size++;
229+
}
230+
else
231+
if (Wstr[str[i]].str[0] == 0) {
232+
pstr->push_back(Wstr[str[i]].str[1]);
233+
}
234+
else {
235+
pstr->push_back(Wstr[str[i]].str[0]);
236+
pstr->push_back(Wstr[str[i]].str[1]);
237+
Wstr[str[i]].UseSize++;
238+
}
239+
240+
}
241+
else if (st == 4)st = 0;
242+
if (str[i++] == '"') st++;
243+
244+
}
245+
return pstr;
246+
}
201247
char* Start(wchar_t*str,int size) {
202248

203249
if(wcsstr(str,L"FontConfig")|| wcsstr(str, L"FontTexture")){
@@ -312,7 +358,7 @@ class SEL {
312358
m_char[2] = '\0';
313359
return m_char;
314360
}
315-
char* WcharToChar(wchar_t* wc)
361+
char* WcharToChar(const wchar_t* wc)
316362
{
317363

318364
int len = WideCharToMultiByte(CP_ACP, 0, wc, wcslen(wc), NULL, 0, NULL, NULL);
@@ -400,4 +446,6 @@ class ReadAdd {
400446
}
401447

402448

403-
};
449+
};
450+
451+

0 commit comments

Comments
 (0)