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

Commit a7ed4a0

Browse files
committed
添加各种功能 版本升至1.0.0.7
1 parent 59169c5 commit a7ed4a0

File tree

78 files changed

+1712
-215
lines changed

Some content is hidden

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

78 files changed

+1712
-215
lines changed

ConsoleApplication/Config.ini

46 Bytes
Binary file not shown.

ConsoleApplication/ConsoleApplication.cpp

Lines changed: 95 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ BOOL GetFileVersion()
1010
DWORD dwVerSize;
1111
DWORD dwHandle;
1212
TCHAR szFullPath[MAX_PATH];
13-
// DWORD dwVerInfoSize = 0;
14-
// DWORD dwVerHnd;
15-
// VS_FIXEDFILEINFO * pFileInfo;
1613

1714
GetModuleFileName(NULL, szFullPath, MAX_PATH);
1815
//printf("信息:");
@@ -39,41 +36,108 @@ BOOL GetFileVersion()
3936
return FALSE;
4037
}
4138

42-
//CharAdd CharADD;
4339
SEL WCharAdd;
44-
//char Ver[] = "[SpaceEngine 汉化生成器 1.0.0.4]";
40+
HANDLE hHandle;
41+
void Color(WORD C) {
42+
SetConsoleTextAttribute(hHandle,C);
43+
}
44+
class GetOff {
45+
46+
public:
47+
GetOff(std::string Path, std::string O, std::string F) {
48+
std::ifstream IF(Path);
49+
std::string L;
50+
char Line[256],*str=new char[1024];
51+
int T = 0;
52+
std::ofstream OF(O);
53+
if(F.find("%s")!=std::string::npos)T=1;
54+
else if (F.find("%d") != std::string::npos|| F.find("%X") != std::string::npos)T = 2;
55+
while (IF.getline(Line, 256)) {
56+
L = Line;
57+
char *P = 0,*P2=0;
58+
if ((P = strstr(Line, "<Address>")) != 0) {
59+
P += 9;
60+
if ((P2 = strstr(Line, "</Address>")) != 0)*P2 = 0;
61+
62+
63+
if (T == 2) {
64+
if ((P = strstr(Line, "+")) != 0) { P += 1;
65+
snprintf(str, 1024, F.c_str(), strtol(P,0,16));
66+
printf(" %s\n", str);
67+
OF << str << std::endl;
68+
}
69+
70+
}
71+
else {
72+
snprintf(str, 1024, F.c_str(), P);
73+
printf(" %s\n", str);
74+
OF << str << std::endl;
75+
}
76+
77+
78+
}
79+
80+
}
81+
delete[] str;
82+
};
83+
84+
};
4585
int main(int argc, char *argv[])
4686
{
47-
HANDLE hHandle = GetStdHandle(STD_OUTPUT_HANDLE);
48-
SetConsoleTextAttribute(hHandle, 0xB);
49-
printf("\n [SpaceEngine 汉化生成器 1.0.0.4]\n\n");
50-
SetConsoleTextAttribute(hHandle, 0x7);
51-
if (argc != 3) {
52-
SetConsoleTextAttribute(hHandle, 0xA);
53-
printf("\n用法: %s [输入文件] [输出文件]\n", argv[0]);
54-
SetConsoleTextAttribute(hHandle, 0xC);
55-
printf("\n 输入文件必须使用Unicode字符集,现在存在FontConfig\\FontTexture字符的行会被忽略.\n");
56-
SetConsoleTextAttribute(hHandle, 0x7);
57-
printf("\n 程序目录下需要Config.ini字符配置文件 若不存在则自动创建\n 翻译一行一个\n 要复制的话最好用UE的[用户剪切板(ctrl+数字)]去复制,系统剪切板会破坏内容\n 即便如此,有时一些内容仍然会被破坏,请自行检查.重点检查换行是否正常(一般是被插入0A)\n 错误的字节用16进制编辑删除.\n \n示例");
58-
SetConsoleTextAttribute(hHandle, 0xB);
59-
printf("\n 命令: %s gui.txt chs-gui.cfg\n ", argv[0]);
60-
SetConsoleTextAttribute(hHandle, 0xE);
61-
printf("文件内容: \"SYSTEM\" \"系统\" \n");
62-
SetConsoleTextAttribute(hHandle, 0x7);
63-
}
64-
else {
87+
hHandle = GetStdHandle(STD_OUTPUT_HANDLE);
88+
Color(0xB);
89+
printf("\n [SpaceEngine 汉化生成器 1.0.0.7]\n\n");
90+
Color(0x7);
91+
if (argc == 3) {
6592
WCharAdd.WMainInit();
6693
TEST(argv[1], argv[2]);
94+
}
95+
else if (argc==5) {
96+
ReadAdd RA(argv[1], argv[2], argv[3],atoi(argv[4]));
97+
98+
99+
}
100+
else if (argc==4) {
101+
GetOff GF(argv[1], argv[2], argv[3]);
67102

103+
}
104+
else {
105+
106+
Color(0XA);
107+
printf("\n用法: %s [输入文件] [输出文件]\n 读取SE内存: %s [偏移列表文件] [输出文件] [输出格式] [PID] \n CE XML格式地址析出 %s [输入文件] [输出文件] [输出格式]", argv[0], argv[0], argv[0]);
108+
Color(0xC);
109+
printf("\n [翻译模式] 输入文件必须使用Unicode编码,现在存在FontConfig\\FontTexture字符的行会被忽略.\n");
110+
Color(0x7);
111+
printf("\n 程序目录下需要Config.ini字符配置文件 若不存在则自动创建\n 翻译一行一个\n 要复制的话最好用UE的[用户剪切板(ctrl+数字)]去复制,系统剪切板会破坏内容\n 即便如此,有时一些内容仍然会被破坏,请自行检查.重点检查换行是否正常(一般是被插入0A)\n 错误的字节用16进制编辑删除.\n \n示例");
112+
Color(0xB);
113+
printf("\n 命令: %s gui.txt chs-gui.cfg\n ", argv[0]);
114+
Color(0xE);
115+
printf("输入文件内容: \"SYSTEM\" \"系统\" \n");
116+
Color(0x7);
117+
printf("\n [读取内存模式] 根据文件内偏移读取内存并输出到文件 格式化需要两个格式化参数 %%X或%%d 和%%s 详参printf函数输出格式");
118+
Color(0xC);
119+
printf("\n 若仍不了解请使用示例格式 0x00 %%X = %%s\n 输入文件内必须是偏移值而不是内存地址 错误的偏移值可能会导致程序爆炸 ");
120+
Color(0x7);
121+
printf("\n 用CE搜个绿色基址然后点开看到后面的XXX.exe + ABCD... 的 + XXX部分就是偏移了\n PID是进程ID 打开任务管理器看");
122+
Color(0xB);
123+
printf("\n 命令: %s offset.txt out.txt 0x00%%X=%%s \n ", argv[0]);
124+
Color(0xE);
125+
printf("输入文件内容: 0x0012345 \n");
126+
Color(0x7);
127+
printf("\n [CE XML地址析出] 从CE内复制的地址是XML格式的 无法直接进行读取,故添加此功能 用于配合[读取内存模式]\n 输出格式同上 %%s输出 程序+偏移 %%d或%%X 只输出偏移");
128+
Color(0xB);
129+
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]);
130+
Color(0x7);
131+
68132
}
69133
setlocale(LC_CTYPE, ".936");
70134

71135
std::vector<STA> A = WCharAdd.No;
72136
DWORD Err = 0;
73137
if (!A.empty()) {
74-
SetConsoleTextAttribute(hHandle, 0xE);
138+
Color(0xE);
75139
printf("以下字符未配置 ");
76-
SetConsoleTextAttribute(hHandle, 0x7);
140+
Color(0x7);
77141
printf("输出格式 [字符:频度]\n");
78142
for (unsigned int i = 0;i < A.size();i++) {
79143
printf("%s:%d ", A[i].str, WCharAdd.Wstr[A[i].ID[0]].Size);
@@ -82,17 +146,17 @@ int main(int argc, char *argv[])
82146
else if ((Err = GetLastError()) != 0) {
83147
char MsgBuf[256];
84148
FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM , NULL, Err, 0,MsgBuf,256, NULL);
85-
SetConsoleTextAttribute(hHandle, 0xC);
149+
Color(0xC);
86150
printf("错误:%d", Err);
87-
SetConsoleTextAttribute(hHandle, 0x7);
151+
Color(0x7);
88152
printf(" 描述:%s\n", MsgBuf);
89153

90154
}
91155

92156
else {
93-
SetConsoleTextAttribute(hHandle, 0xA);
157+
Color(0xA);
94158
printf("\n完成");
95-
SetConsoleTextAttribute(hHandle, 0x7);
159+
Color(0x7);
96160
};
97161

98162
printf("\n");
@@ -103,7 +167,8 @@ int main(int argc, char *argv[])
103167

104168
}
105169

106-
SetConsoleTextAttribute(hHandle, 0x7);
170+
Color(0x7);
171+
CloseHandle(hHandle);
107172
return 0;
108173
}
109174

ConsoleApplication/Resource.rc

24 Bytes
Binary file not shown.

ConsoleApplication/stdafx.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,4 +333,71 @@ class SEL {
333333
WChar Wstr[65535];
334334
std::vector<STA> No;
335335

336+
};
337+
#include<TlHelp32.h>
338+
class ReadAdd {
339+
DWORD Base=0;
340+
DWORD GetBase(DWORD Pid)
341+
{
342+
343+
HANDLE phSnapshot;
344+
hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, Pid);
345+
MODULEENTRY32 me32;
346+
phSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, Pid);
347+
if (phSnapshot == INVALID_HANDLE_VALUE)return false;
348+
me32.dwSize = sizeof(MODULEENTRY32);
349+
if (!Module32First(phSnapshot, &me32))return false;
350+
351+
do
352+
{
353+
if (me32.th32ProcessID == Pid)
354+
{
355+
Base = (DWORD)me32.modBaseAddr;
356+
break;
357+
}
358+
} while (Module32Next(phSnapshot, &me32));
359+
360+
CloseHandle(phSnapshot);
361+
if (Base != 0)return Base;
362+
return false;
363+
}
364+
size_t ReadMem(DWORD OF,char *p) {
365+
size_t l = 0;
366+
char *p2 = p;
367+
if(p!=0){
368+
DWORD LP = Base + OF;
369+
while(l<256&&ReadProcessMemory(hProc, (LPVOID)LP++, p2, 1, 0)&&*(p2++)!=0)l++;
370+
p[l] = 0;
371+
}
372+
return l;
373+
}
374+
HANDLE hProc = 0;
375+
public:
376+
~ReadAdd() {
377+
CloseHandle(hProc);
378+
}
379+
ReadAdd(char *Path, char*Out, char *F,DWORD PID) {
380+
std::ifstream IF(Path);
381+
char str[256],str2[256],str3[512];
382+
GetBase(PID);
383+
if (hProc == NULL) return;
384+
std::ofstream OF(Out);
385+
while(IF.getline(str,256)){
386+
size_t L = 0;
387+
DWORD LP=strtol(str, 0, 16);
388+
if (L = ReadMem(LP, str2)) {
389+
snprintf(str3, 512, F, LP, str2);
390+
printf("%s\n", str3);
391+
OF << str3 << std::endl;
392+
393+
}
394+
395+
//ReadProcessMemory(hProc, (LPVOID)(Base+strtol(str,0,16)), PVOID pvBufferLocal, DWORD dwSize, PDWORD pdwNumBytesRead);
396+
397+
}
398+
IF.close();
399+
OF.close();
400+
}
401+
402+
336403
};
-357 KB
Binary file not shown.
-12.9 KB
Binary file not shown.
-334 KB
Binary file not shown.
-4.89 KB
Binary file not shown.
-5.7 KB
Binary file not shown.
-2.94 KB
Binary file not shown.

0 commit comments

Comments
 (0)