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

Commit 5dce932

Browse files
committed
upupupup
1 parent 73dd42f commit 5dce932

Some content is hidden

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

94 files changed

+13661
-1602
lines changed

ConsoleApplication/ConsoleApplication.cpp

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ class GetOff {
8282
};
8383

8484
};
85+
bool stacmp(STA&a, STA &b) {
86+
return WCharAdd.Wstr[a.ID[0]].Size > WCharAdd.Wstr[b.ID[0]].Size;
87+
}
8588
int main(int argc, char *argv[])
8689
{
8790
hHandle = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -128,7 +131,7 @@ int main(int argc, char *argv[])
128131
printf(" 输入文件内容: \"SYSTEM\" \"系统\" \n");
129132

130133
Color(0x7);
131-
printf("\n [排除翻译] 排除列表文件内粘贴SE.log里提示的未知翻译 输出过滤后的翻译,过滤对于某版本无用的翻译可以增加加载速度\n 使用-A在排除的同时进行翻译\n示例");
134+
printf("\n [排除翻译] 排除列表文件内粘贴SE.log里提示的未知翻译 输出过滤后的翻译,过滤对于某版本无用的翻译可以增加加载速度\n 前置-A选项在排除的同时进行翻译\n示例");
132135
Color(0xB);
133136
printf("\n 命令: %s gui.txt exc.txt gui2.txt\n ", argv[0]);
134137
Color(0x7);
@@ -152,22 +155,44 @@ int main(int argc, char *argv[])
152155
}
153156
setlocale(LC_CTYPE, ".936");
154157

155-
std::vector<STA> A = WCharAdd.No;
158+
std::vector<STA> &A = WCharAdd.No;
159+
std::sort(A.begin(), A.end(), stacmp);
156160
DWORD Err = 0;
161+
for (WCHAR T = 0XFF; T < 0XFFFF; T++) {
162+
WChar &wc = WCharAdd.Wstr[T];
163+
if (wc.use&&wc.UseSize == 0) {
164+
if (Err == 0)printf("未使用的字符(不包含内存修改部分):\n"), Err = 1;
165+
//printf("%d:", T);
166+
printf("%s", WCharAdd.WcharToCharOne(&T));
167+
168+
}
169+
}
170+
/* for (const WChar &wc : WCharAdd.Wstr) {
171+
172+
if (wc.use&&wc.Size==0) {
173+
if (Err == 0)printf("未使用的字符:\n"),Err=1;
174+
WCHAR T = (&wc - WCharAdd.Wstr) / sizeof(WChar);
175+
printf("%d:", T);
176+
printf("%s ", WCharAdd.WcharToCharOne(&T));
177+
178+
}
179+
}*/
180+
Err = 0;
181+
printf("\n");
157182
if (!A.empty()) {
158183
Color(0xE);
159184
printf("以下字符未配置 ");
160185
Color(0x7);
161186
printf("输出格式 [字符:频度]\n");
162-
for (unsigned int i = 0;i < A.size();i++) {
187+
for (size_t i = 0;i < A.size();i++) {
163188
printf("%s:%d ", A[i].str, WCharAdd.Wstr[A[i].ID[0]].Size);
164189
}
165190
}
166191
else if ((Err = GetLastError()) != 0) {
167192
char MsgBuf[256];
168193
FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM , NULL, Err, 0,MsgBuf,256, NULL);
169194
Color(0xC);
170-
printf("错误:%d", Err);
195+
printf("过程中出现错误:%d", Err);
171196
Color(0x7);
172197
printf(" 描述:%s\n", MsgBuf);
173198

@@ -180,12 +205,17 @@ int main(int argc, char *argv[])
180205
};
181206

182207
printf("\n");
183-
while (!A.empty()) {
208+
for (const STA &a : A) {
209+
printf("%s", a.str);
210+
delete[] a.str;
211+
}
212+
A.clear();
213+
/*while (!A.empty()) {
184214
printf("%s", A.back().str);
185215
delete[] A.back().str;
186216
A.pop_back();
187217
188-
}
218+
}*/
189219

190220
Color(0x7);
191221
CloseHandle(hHandle);
@@ -316,7 +346,7 @@ void TEST(char* In, char*In2,char*Out,int mode) {
316346

317347
}
318348
dew.clear();
319-
printf("共排除 %d/%d/%d 个\n", X, Y,Z);
349+
printf("统计:[输出/排除/总数] %d/%d/%d 个\n", X, Y,Z);
320350
if (X == Z)printf("=>>>>文件编码可能不是Unicode\n");
321351
if(buf)delete[] buf;
322352
if(fp)fclose(fp);

ConsoleApplication/ConsoleApplication.vcxproj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@
3030
<ProjectGuid>{838AD147-56A9-4F1D-98B9-52D9B9844A2D}</ProjectGuid>
3131
<Keyword>Win32Proj</Keyword>
3232
<RootNamespace>ConsoleApplication3</RootNamespace>
33-
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
33+
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
3434
</PropertyGroup>
3535
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
3636
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
3737
<ConfigurationType>Application</ConfigurationType>
3838
<UseDebugLibraries>true</UseDebugLibraries>
39-
<PlatformToolset>v140</PlatformToolset>
39+
<PlatformToolset>v141</PlatformToolset>
4040
<CharacterSet>Unicode</CharacterSet>
4141
</PropertyGroup>
4242
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
4343
<ConfigurationType>Application</ConfigurationType>
4444
<UseDebugLibraries>false</UseDebugLibraries>
45-
<PlatformToolset>v140</PlatformToolset>
45+
<PlatformToolset>v141</PlatformToolset>
4646
<WholeProgramOptimization>true</WholeProgramOptimization>
4747
<CharacterSet>Unicode</CharacterSet>
4848
</PropertyGroup>
@@ -56,13 +56,13 @@
5656
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
5757
<ConfigurationType>Application</ConfigurationType>
5858
<UseDebugLibraries>true</UseDebugLibraries>
59-
<PlatformToolset>v140</PlatformToolset>
59+
<PlatformToolset>v141</PlatformToolset>
6060
<CharacterSet>Unicode</CharacterSet>
6161
</PropertyGroup>
6262
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
6363
<ConfigurationType>Application</ConfigurationType>
6464
<UseDebugLibraries>false</UseDebugLibraries>
65-
<PlatformToolset>v140</PlatformToolset>
65+
<PlatformToolset>v141</PlatformToolset>
6666
<WholeProgramOptimization>true</WholeProgramOptimization>
6767
<CharacterSet>Unicode</CharacterSet>
6868
</PropertyGroup>
@@ -122,6 +122,9 @@
122122
<Optimization>Disabled</Optimization>
123123
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
124124
<SDLCheck>true</SDLCheck>
125+
<StringPooling>true</StringPooling>
126+
<MinimalRebuild>false</MinimalRebuild>
127+
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
125128
</ClCompile>
126129
<Link>
127130
<SubSystem>Console</SubSystem>

ConsoleApplication/stdafx.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
struct STA{
1919
wchar_t ID[1];
2020
char *str;
21+
/*bool operator<(STA&a) {
22+
23+
};*/
2124
};
2225
// TODO: 在此处引用程序需要的其他头文件
2326

@@ -32,8 +35,8 @@ extern std::vector<std::wstring> wstrv;
3235
void TEST(char* In, char*Out);
3336
class SEL {
3437
const char* ConfigFile = "Config.ini";
35-
char *Pstr[9] = { "File","1","2","3","4","5","6","7","DEF" };
36-
wchar_t *WPstr[9] = { L"File",L"1",L"2",L"3",L"4",L"5",L"6",L"7",L"DEF" };
38+
//char *Pstr[9] = { "File","1","2","3","4","5","6","7","DEF" };
39+
// wchar_t *WPstr[9] = { L"File",L"1",L"2",L"3",L"4",L"5",L"6",L"7",L"DEF" };
3740
public:
3841

3942

@@ -123,11 +126,11 @@ class SEL {
123126
//bool Inread = false;int PageId = 0;
124127

125128
wchar_t* WGetConfig(int ID, wchar_t* str) {
126-
wchar_t TMP[256];
129+
wchar_t TMP[32];
127130

128131
if (ID == -1)return wcsstr(str, L"PageFile");
129132
else if(ID==0)return wcsstr(str, L"PageDEF");
130-
swprintf(TMP, 256, L"Page%d", ID);
133+
swprintf(TMP, 32, L"Page%d", ID);
131134
return wcsstr(str, TMP);
132135
}
133136
void Init(int ID,const wchar_t* str) {
@@ -155,7 +158,7 @@ class SEL {
155158
WChar* WT = &Wstr[str[i]];
156159
if (WT->use&&str[i] !='?') {
157160
//printf(Pstr[WIDToID(WT->ID)]);
158-
printf("警告:%X->%X:%X str:%d 重复\n",C,WT->ID,WT->str[1], str[i]);
161+
printf("警告:%X->%X:%X str:%X 重复\n",C,WT->ID,WT->str[1], str[i]);
159162

160163
}
161164
else {
@@ -200,6 +203,7 @@ class SEL {
200203

201204
}
202205
else if (st == 3) {
206+
Wstr[str[i]].UseSize++;
203207
if (Wstr[str[i]].str[1] == 0) {
204208
pstr->push_back('#');
205209
if (Wstr[str[i]].Size == 0) {
@@ -217,7 +221,7 @@ class SEL {
217221
else {
218222
pstr->push_back(Wstr[str[i]].str[0]);
219223
pstr->push_back(Wstr[str[i]].str[1]);
220-
Wstr[str[i]].UseSize++;
224+
221225
}
222226

223227
}
@@ -317,7 +321,7 @@ class SEL {
317321
// void Release();
318322
// int len = WideCharToMultiByte(CP_ACP, 0, wc, wcslen(wc), NULL, 0, NULL, NULL);
319323
char* m_char = new char[2+1];
320-
WideCharToMultiByte(CP_ACP, 0, wc, wcslen(wc), m_char, 2, NULL, NULL);
324+
WideCharToMultiByte(CP_ACP, 0, wc, 1, m_char, 2, NULL, NULL);
321325
m_char[2] = '\0';
322326
return m_char;
323327
}

FontTex/1.png

68.2 KB
Loading

FontTex/FontTex.cpp

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// FontTex.cpp : 定义控制台应用程序的入口点。
2+
//
3+
4+
#include "stdafx.h"
5+
#include "Windows.h"
6+
#include <fstream>
7+
int main(int argc,char**argv) {
8+
if (argc == 6){
9+
long w = atoi(argv[2]),h=w,tw= atoi(argv[3]),th=tw;
10+
char*p = strstr(argv[2], "*");
11+
if (p)h = atoi(p + 1);
12+
p=strstr(argv[3], "*");
13+
if (p)th = atoi(p + 1);
14+
printf("FontFile:\t%s\nFontSize(w*h):\t%d*%d\nTexSize(w*h):\t%d*%d\nStrMap:\t%s\nImgOut:\t%s\n", argv[1], w,h, tw, th, argv[4], argv[5]);
15+
FreeType ft(argv[1],w,h, tw,th);
16+
ft.Start(argv[4]);
17+
ft.write(argv[5]);
18+
}
19+
else printf("ARGERR\n\t%s [字体文件] [字体大小] [纹理尺寸] [字符表(UNICODE编码)] [纹理输出]\n示例:\t%s msyh.ttc;msjh.ttc 12*12 256*256 map.txt font.png", argv[0], argv[0]);
20+
return 0;
21+
}
22+
HWND hWnds = NULL;
23+
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
24+
{
25+
char Name[256];
26+
GetClassNameA(hWnd, Name, 255);
27+
if (stricmp(Name, "WorkerW") == 0)
28+
{
29+
GetWindowTextA(hWnd, Name, 255);
30+
if (Name[0] == 0) {
31+
if (GetParent(hWnd) != 0) {
32+
if (GetWindowLongPtr(hWnd, GWL_STYLE)&WS_DISABLED) {
33+
hWnds = hWnd;
34+
return FALSE;
35+
};
36+
}
37+
}
38+
}
39+
return TRUE;
40+
}
41+
42+
int main2()
43+
{
44+
45+
/*HDESK hDesk = CreateDesktop(_T("MyDesk1"), NULL, NULL, 0, GENERIC_ALL| DESKTOP_CREATEWINDOW, NULL);
46+
if (hDesk == NULL)printf("ERR");
47+
STARTUPINFO si = { 0 };
48+
si.lpDesktop = _T("MyDesk1");
49+
si.dwFlags = STARTF_USESHOWWINDOW;
50+
si.wShowWindow = SW_HIDE;
51+
PROCESS_INFORMATION pi = { 0 };
52+
53+
TCHAR szApp[MAX_PATH] = { _T("cmd.exe") };
54+
if (CreateProcess(NULL, szApp, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
55+
{
56+
getchar();
57+
CloseHandle(pi.hThread);
58+
SetThreadDesktop(hDesk);
59+
CloseHandle(pi.hProcess);
60+
}
61+
getchar();
62+
CloseDesktop(hDesk);
63+
*/
64+
65+
/*EnumWindows(EnumWindowsProc, 0);
66+
HWND a, b;
67+
printf("Hwnds:%X\n", hWnds);
68+
while (1) {
69+
scanf_s("%X %X", &a, &b);
70+
long style = GetWindowLong(a, GWL_STYLE),cx= GetSystemMetrics(SM_CXSCREEN),cy= GetSystemMetrics(SM_CYSCREEN);
71+
SetWindowLong(a, GWL_STYLE, WS_VISIBLE | WS_CHILD);
72+
printf("%X->%X:%d %d\n", a, b,cx,cy);
73+
RECT rt;
74+
GetWindowRect(b, &rt);
75+
//MoveWindow(b, 0, 0, cx, cy, 0);
76+
//MoveWindow(a, 0, 0,cx, cy, 0);
77+
SetWindowPos(a, HWND_TOPMOST, 0, 0, 1200, 600, SWP_NOZORDER);
78+
SetWindowPos(a, HWND_TOPMOST, 0, 0,cx,cy, SWP_NOZORDER);
79+
SetParent(a, b);
80+
system("pause");
81+
SetWindowLong(a, GWL_STYLE, style);
82+
SetParent(a, NULL);
83+
printf("%X->NULL\n", a);
84+
}*/
85+
return 0;
86+
}
87+
HDC hdc;
88+
BOOL APIENTRY DllMain(HMODULE hModule,
89+
DWORD ul_reason_for_call,
90+
LPVOID lpReserved
91+
)
92+
{
93+
switch (ul_reason_for_call)
94+
{
95+
case DLL_PROCESS_ATTACH: {
96+
EnumWindows(EnumWindowsProc, 0);
97+
hdc = GetDC(hWnds);
98+
char A[512];
99+
snprintf(A, 512, "%p %p", &hdc, &hWnds);
100+
std::ofstream OF("111.log");
101+
OF << &hdc << ":" << hdc<<"\n"<< &hWnds<<":"<< hWnds;
102+
OF.close();
103+
//MessageBoxA(NULL, A, "I", MB_OK);
104+
//wglMakeCurrent;
105+
106+
}break;
107+
case DLL_THREAD_ATTACH:break;
108+
case DLL_THREAD_DETACH:break;
109+
case DLL_PROCESS_DETACH:
110+
break;
111+
}
112+
return TRUE;
113+
}

0 commit comments

Comments
 (0)