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

Commit 3bb4d8c

Browse files
committed
up 1.0.0.9
1 parent 373c011 commit 3bb4d8c

28 files changed

+6275
-4264
lines changed

ConsoleApplication/ConsoleApplication.cpp

Lines changed: 72 additions & 23 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-
void TEST(char* In, char*In2, char*Out);
6+
void TEST(char* In, char*In2, char*Out,int mode);
77
BOOL GetFileVersion()
88
{
99

@@ -94,9 +94,15 @@ int main(int argc, char *argv[])
9494
TEST(argv[1], argv[2]);
9595
}
9696
else if (argc==5) {
97+
98+
if(strcmp(argv[1],"-A")==0){
99+
printf("[排除并翻译]\n");
100+
WCharAdd.WMainInit();
101+
TEST(argv[2], argv[3],argv[4],0);
102+
}else{
97103
printf("[读取内存模式]\n");
98104
ReadAdd RA(argv[1], argv[2], argv[3],atoi(argv[4]));
99-
105+
}
100106

101107
}
102108
else if (argc==4) {
@@ -105,13 +111,13 @@ int main(int argc, char *argv[])
105111
}
106112
else {
107113
printf("[排除模式]\n");
108-
TEST(argv[1], argv[2], argv[3]); }
114+
TEST(argv[1], argv[2], argv[3],1); }
109115

110116
}
111117
else {
112118

113119
Color(0XA);
114-
printf("\n用法: 自动翻译: %s [输入文件] [输出文件]\n 排除翻译: %s [输入文件] [排除列表文件] [输出文件]\n 读取SE内存: %s [偏移列表文件] [输出文件] [输出格式] [PID] \n CE XML格式地址析出 %s [输入文件] [输出文件] [输出格式]", argv[0], argv[0], argv[0], argv[0]);
120+
printf("\n用法: 自动翻译: %s [输入文件] [输出文件]\n 排除翻译: %s [-A] [输入文件] [排除列表文件] [输出文件]\n 读取SE内存: %s [偏移列表文件] [输出文件] [输出格式] [PID] \n CE XML格式地址析出 %s [输入文件] [输出文件] [输出格式]", argv[0], argv[0], argv[0], argv[0]);
115121
Color(0xC);
116122
printf("\n [翻译模式] 输入文件必须使用Unicode编码,现在存在FontConfig\\FontTexture字符的行会被忽略,请以空行结尾.\n");
117123
Color(0x7);
@@ -122,7 +128,7 @@ int main(int argc, char *argv[])
122128
printf(" 输入文件内容: \"SYSTEM\" \"系统\" \n");
123129

124130
Color(0x7);
125-
printf("\n [排除翻译] 排除列表文件内粘贴SE.log里提示的未知翻译 输出过滤后的翻译,过滤对于某版本无用的翻译可以增加加载速度\n示例");
131+
printf("\n [排除翻译] 排除列表文件内粘贴SE.log里提示的未知翻译 输出过滤后的翻译,过滤对于某版本无用的翻译可以增加加载速度\n 使用-A在排除的同时进行翻译\n示例");
126132
Color(0xB);
127133
printf("\n 命令: %s gui.txt exc.txt gui2.txt\n ", argv[0]);
128134
Color(0x7);
@@ -186,16 +192,23 @@ int main(int argc, char *argv[])
186192
return 0;
187193
}
188194
std::vector<std::wstring> wstrv;
189-
190-
void TEST(char* In, char*In2,char*Out) {
191-
FILE*fp, *fp2,*fp3;
195+
#include <deque>
196+
void TEST(char* In, char*In2,char*Out,int mode) {
197+
FILE*fp=0, *fp2=0,*fp3=0;
198+
//bool mode = 0;
192199
fopen_s(&fp, In, "rb");
200+
if (!fp) { printf("无法打开%s\n",In);return;
201+
}
202+
203+
//mode = 1;
193204
fopen_s(&fp2, In2, "rb");
205+
if (!fp2) { printf("无法打开%s\n", In2); return;
206+
}
207+
194208
fopen_s(&fp3, Out, "wb+");
195-
if (fp == 0|| fp3 == 0 || fp2 == 0) {
196-
printf("打开文件失败");
197-
return;
209+
if (!fp3) { printf("无法打开%s\n", Out); return;
198210
}
211+
std::vector<std::wstring> dew;
199212
fseek(fp2, 0, SEEK_END);
200213
size_t len = ftell(fp2) / 2;
201214
wchar_t *buf2 = new WCHAR[len];
@@ -206,6 +219,7 @@ void TEST(char* In, char*In2,char*Out) {
206219
WCHAR P = 0;
207220
std::wstring ws;
208221
printf("读取排除列表\n");
222+
209223
while (l < len) {
210224
P = buf2[l++];
211225

@@ -220,6 +234,7 @@ void TEST(char* In, char*In2,char*Out) {
220234
else if (st == 2) {
221235
if(ws.size()>0){
222236
wstrv.push_back(ws);
237+
// printf("PUSH:%ws\n", ws.c_str());
223238
ws.clear();
224239
}
225240
//st = 0;
@@ -228,7 +243,7 @@ void TEST(char* In, char*In2,char*Out) {
228243

229244

230245
}
231-
delete[] buf2;
246+
if(buf2)delete[] buf2;
232247
fseek(fp, 0, SEEK_END);
233248
len = ftell(fp) / 2;
234249
rewind(fp);
@@ -240,6 +255,7 @@ void TEST(char* In, char*In2,char*Out) {
240255
st = 0;
241256
ws.clear();
242257
printf("开始排除\n");
258+
int Y=0,Z=0,X=0;
243259
std::wstring TMP;
244260
while (l <len) {
245261
P= buf[l++];
@@ -248,31 +264,64 @@ void TEST(char* In, char*In2,char*Out) {
248264
if (st == 1 && P != '"')TMP.push_back(P);
249265
if (P == '\r' || P == '\n'){
250266
st = 0;
251-
if (ws.size() > 4) {
267+
268+
if (ws.size()> 4) {
269+
270+
271+
Z++;
272+
for (std::vector<std::wstring>::iterator i = dew.begin();i != dew.end();i++) {
273+
if ((*i).compare(ws) == 0) {
274+
printf("已检测到重复[%d]->%ws", Z, ws.c_str());
275+
printf("\n");
276+
goto NO;
277+
}
278+
279+
}
252280
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(); }
281+
282+
283+
284+
if ((*it).compare(TMP) == 0) {
285+
Y++;
286+
TMP.clear(), ws.clear();
287+
break;
288+
}
255289
}
256290

257-
//WCharAdd.Start(ws, &str);
258-
// printf("W2[%d]\n", ws.size());
259291
if(ws.size()>0){
292+
X++;
293+
294+
dew.push_back(ws);
260295
if (ws.find('\n') == std::wstring::npos)ws.push_back('\n');
296+
if (mode)
297+
261298
fwrite(ws.c_str(), sizeof(WCHAR), ws.size(), fp3);
262-
ws.clear();
299+
else {
300+
std::string str;
301+
WCharAdd.Start(ws, &str);
302+
if (!str.empty()) {
303+
fwrite(str.c_str(), sizeof(CHAR), str.size(), fp3);
304+
}
305+
else { printf("分配内存失败\n"); }
306+
}//dew.push_back(ws);
307+
263308
}
264309
}
265-
310+
NO:
311+
ws.clear();
266312
TMP.clear();
267313
//st = 0;
268314
//st = 0;
269315
}
270316

271317
}
272-
delete[] buf;
273-
fclose(fp);
274-
fclose(fp2);
275-
fclose(fp3);
318+
dew.clear();
319+
printf("共排除 %d/%d/%d 个\n", X, Y,Z);
320+
if (X == Z)printf("=>>>>文件编码可能不是Unicode\n");
321+
if(buf)delete[] buf;
322+
if(fp)fclose(fp);
323+
if (fp2)fclose(fp2);
324+
if (fp3)(fp3);
276325
}
277326

278327
void TEST(char* In, char*Out) {

ConsoleApplication/Resource.rc

0 Bytes
Binary file not shown.

ConsoleApplication/stdafx.h

Lines changed: 14 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,24 @@ class SEL {
6262
unsigned int len = ftell(fp) / 2;
6363
wchar_t* Config = new wchar_t[len];
6464

65-
//把指针移动到文件开头 因为我们一开始把指针移动到结尾,如果不移动回来 会出错
6665
rewind(fp);
67-
//跳过unicode标志位 0xfeff
68-
// fread(Config, 2, 1, fp);
6966
fseek(fp, 2L, SEEK_SET);
7067

7168
//size_t SIZE =
7269
fread(Config, sizeof(wchar_t), len - 1, fp);
73-
// printf("%X %X", Config[0], Config[1]);
7470
Config[len - 1] = 0;
75-
// int tick = 0;
76-
//wchar_t* Config[81920] = { 0 };
77-
// BYTE Buf[1];
78-
//size_t SIZE = fread(Config, sizeof(char), 81920, fp);
79-
// int i = 0;
8071
bool Incom = false, Inread = false, begin = false;
8172
//char str[8192];
8273
std::wstring str;
8374
wchar_t *ps;//, *ps2;
84-
for (int P = 0;P < 9;P++) {
75+
for (int P = -1;P < 256;P++) {
8576
if ((ps = WGetConfig(P, Config)) != 0) {
8677
Inread = true;
8778
}
8879
else {
8980
continue;
9081
}
91-
printf("读取配置:Page%s...", Pstr[P]);
82+
printf("读取配置:Page%d...", P);
9283
int s = 0;// s2 = 0;
9384
while (Inread) {
9485
if (ps[s] == '/'&&ps[s + 1] == '/') {
@@ -114,13 +105,9 @@ class SEL {
114105
// printf("结束");
115106
begin = Inread = false;
116107
str.push_back('\0');
117-
//wchar_t *TMP = new wchar_t[str.size()];
118-
// printf("\n复制副本 Size:%d str:\n %p", str.size(), str.c_str(), TMP);
119-
//wcscpy_s(TMP, str.size(), str.c_str());
120-
//printf("%X %X :%X %X",str[0],str[1], TMP[0], TMP[1]);
121108
Init(P, str.c_str());
122109
str.clear();
123-
printf(" 完成\n\n");
110+
printf(" 完成\n");
124111
break;
125112
}
126113
if (begin) {
@@ -137,11 +124,14 @@ class SEL {
137124

138125
wchar_t* WGetConfig(int ID, wchar_t* str) {
139126
wchar_t TMP[256];
140-
swprintf(TMP, 256, L"Page%s", WPstr[ID]);
127+
128+
if (ID == -1)return wcsstr(str, L"PageFile");
129+
else if(ID==0)return wcsstr(str, L"PageDEF");
130+
swprintf(TMP, 256, L"Page%d", ID);
141131
return wcsstr(str, TMP);
142132
}
143133
void Init(int ID,const wchar_t* str) {
144-
if (ID == 0) {
134+
if (ID == -1) {
145135
SetPage(str);
146136
return;
147137
}
@@ -170,25 +160,20 @@ class SEL {
170160
}
171161
else {
172162
WT->use = true;
173-
WT->ID = WID[ID-1];
174-
WT->str[0] = ID==8?0:WID[ID-1];
163+
WT->ID = WID[ID];
164+
WT->str[0] = WID[ID];
175165
WT->str[1] = BYTE(C);
176166
}
177167

178-
//printf("")
179-
// C << ID << i << std::endl;
180168
i++, C++;// C++;
181169

182170
}
183-
184-
// Start(ID, L"\"dwadDAWF\" \"昵称自定义\" ");
185171
}
186172
bool O = true;
187173
std::string* Start(std::wstring str, std::string *pstr) {
188174

189175
if (str.find(L"FontConfig")!=std::wstring::npos || str.find(L"FontTexture") != std::wstring::npos) {
190176

191-
//std::string T= WcharToChar(str.c_str());
192177
pstr->operator=(WcharToChar(str.c_str()));
193178

194179
return pstr;
@@ -211,9 +196,7 @@ class SEL {
211196
for (std::vector < std::wstring>::iterator it = wstrv.begin();it != wstrv.end();it++) if ((*it).compare(TMP) == 0) {pstr->clear();break;}
212197

213198
TMP.clear();
214-
// pstr->insert(0, " \"");
215199
pstr->push_back(BYTE(str[i]));
216-
// pstr->insert(pstr->size(), "\" \"");
217200

218201
}
219202
else if (st == 3) {
@@ -244,16 +227,11 @@ class SEL {
244227
}
245228
return pstr;
246229
}
247-
char* Start(wchar_t*str,int size) {
230+
char* Start(const wchar_t*str,int size) {
248231

249232
if(wcsstr(str,L"FontConfig")|| wcsstr(str, L"FontTexture")){
250233
// int i = 0;
251234
return WcharToChar(str);
252-
/* while (i < size&&str[i]!=0) {
253-
CON[i] = BYTE(str[i]);
254-
i++;*/
255-
//}
256-
// return CON;
257235
}
258236
char *CON = new char[size * 2];
259237
// for (int a = 0;a < size;a++) {
@@ -270,7 +248,6 @@ class SEL {
270248
}
271249
}
272250
if (j == 3) {
273-
// printf("T:%d I:%d byte:%X %X\n",T,Wstr[str[i]].str[0], Wstr[str[i]].str[1]);
274251
if (Wstr[str[i]].str[1] == 0) {
275252
CON[T] = '#';
276253
if (Wstr[str[i]].Size == 0) {
@@ -304,13 +281,6 @@ class SEL {
304281
}
305282
CON[T] = '\0';
306283
return CON;
307-
//CON[T - 2] = '"';
308-
/* FILE* fp;
309-
char F[256];
310-
snprintf(F, 256, "%s.txt", Pstr[ID]);
311-
fopen_s(&fp, F, "wb");
312-
fwrite(CON, sizeof(char), T-1, fp);
313-
fclose(fp);*/
314284
}
315285
void SetPage(const wchar_t*str) {
316286
WChar* S = &Wstr[' '];
@@ -325,7 +295,7 @@ class SEL {
325295
S->str[1] = '?';
326296
int i = 0;
327297
wchar_t sum[256];
328-
int ID=0,j=0;
298+
int ID=1,j=0;
329299
//printf("\n");
330300
while ((sum[j++]=str[i++]) != '\0') {
331301

@@ -349,7 +319,7 @@ class SEL {
349319
}
350320
return 0;
351321
}
352-
char* WcharToCharOne(wchar_t* wc)
322+
char* WcharToCharOne(const wchar_t* wc)
353323
{
354324
// void Release();
355325
// int len = WideCharToMultiByte(CP_ACP, 0, wc, wcslen(wc), NULL, 0, NULL, NULL);
@@ -367,15 +337,7 @@ class SEL {
367337
m_char[len] = '\0';
368338
return m_char;
369339
}
370-
BYTE WID[8] = { 0 };
371-
/* WChar IDToW(int ID) {
372-
switch (ID) {
373-
case 1:break;
374-
case 2:
375-
case 3:
376-
}
377-
378-
}*/
340+
BYTE WID[256] = { 0 };
379341
WChar Wstr[65535];
380342
std::vector<STA> No;
381343

@@ -438,7 +400,6 @@ class ReadAdd {
438400

439401
}
440402

441-
//ReadProcessMemory(hProc, (LPVOID)(Base+strtol(str,0,16)), PVOID pvBufferLocal, DWORD dwSize, PDWORD pdwNumBytesRead);
442403

443404
}
444405
IF.close();
-86.5 KB
Binary file not shown.

Win32Project1/Config.ini

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)