Skip to content

Commit a62e9e3

Browse files
committed
v13.8
1 parent b33aea4 commit a62e9e3

File tree

11 files changed

+153
-9
lines changed

11 files changed

+153
-9
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Easy to use for ghost development
1717
## Command line arguments
1818

1919
```text
20-
ghost terminal v13.4
20+
ghost terminal v13.8
2121
2222
ghost_terminal [options]
2323
options:
@@ -73,6 +73,11 @@ The rest of the events should only be defined if you want to change the default
7373
ghost_terminal event when this ghost starts
7474
- `Reference0`
7575
Terminal version
76+
- `Reference1`
77+
Terminal session type
78+
`SakuraScript` if terminal start with `-s`
79+
`Command` if terminal start with `-c`
80+
`Common` if terminal start commonly
7681
- Return value
7782
- `X-SSTP-PassThru-Tittle` (optional)
7883
Set the terminal title

docs/README_CN.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ up/down切换命令,鼠标右键快速粘贴,支持tab补全(如果人格
1313
## 命令行参数
1414

1515
```text
16-
ghost terminal v13.4
16+
ghost terminal v13.8
1717
1818
ghost_terminal [options]
1919
选项:
@@ -69,6 +69,11 @@ ghost_terminal通过`X-SSTP-PassThru-*`进行与人格间的信息沟通(见[
6969
ghost_terminal对此ghost启动时事件
7070
- `Reference0`
7171
终端版本
72+
- `Reference1`
73+
终端启动方式
74+
当terminal以`-s`启动时,为`SakuraScript`
75+
当terminal以`-c`启动时,为`Command`
76+
否则为`Common`
7277
- 返值
7378
- `X-SSTP-PassThru-Tittle`(可选)
7479
设置终端标题

docs/README_EN.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Easy to use for ghost development
1313
## Command line arguments
1414

1515
```text
16-
ghost terminal v13.4
16+
ghost terminal v13.8
1717
1818
ghost_terminal [options]
1919
options:
@@ -69,6 +69,11 @@ The rest of the events should only be defined if you want to change the default
6969
ghost_terminal event when this ghost starts
7070
- `Reference0`
7171
Terminal version
72+
- `Reference1`
73+
Terminal session type
74+
`SakuraScript` if terminal start with `-s`
75+
`Command` if terminal start with `-c`
76+
`Common` if terminal start commonly
7277
- Return value
7378
- `X-SSTP-PassThru-Tittle` (optional)
7479
Set the terminal title

docs/README_JP.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ghost_terminalをシステム端末のように使用する
1515
テキスト
1616

1717
```text
18-
ghost terminal v13.4
18+
ghost terminal v13.8
1919
2020
ghost_terminal [オプション]を指定します。
2121
オプションで指定します。
@@ -71,6 +71,11 @@ ghost_terminalの出力は、プレーンテキストではなく、仮想端末
7171
このゴーストが起動したときのghost_terminalイベント
7272
- `Reference0`
7373
ターミナルバージョン
74+
- `Reference1`
75+
端末のセッションタイプ
76+
端末が `-s` で始まる場合は `SakuraScript` となる。
77+
端末が `-c` で始まる場合は `Command` となる。
78+
端末が共通で起動する場合は `Common` となる。
7479
- 戻り値
7580
- `X-SSTP-PassThru-Tittle` (オプション)
7681
端末のタイトルを設定する

ghost_terminal.vcxproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
<ClCompile Include="src\ghost_terminal.cpp" />
2323
<ClCompile Include="src\_gists.cpp" />
2424
</ItemGroup>
25+
<ItemGroup>
26+
<ResourceCompile Include="src\resource\ghost_terminal.rc" />
27+
</ItemGroup>
28+
<ItemGroup>
29+
<ClInclude Include="src\resource\resource.h" />
30+
<ClInclude Include="src\Version.h" />
31+
</ItemGroup>
2532
<PropertyGroup Label="Globals">
2633
<VCProjectVersion>16.0</VCProjectVersion>
2734
<Keyword>Win32Proj</Keyword>

ghost_terminal.vcxproj.filters

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,17 @@
2222
<Filter>源文件</Filter>
2323
</ClCompile>
2424
</ItemGroup>
25+
<ItemGroup>
26+
<ResourceCompile Include="src\resource\ghost_terminal.rc">
27+
<Filter>资源文件</Filter>
28+
</ResourceCompile>
29+
</ItemGroup>
30+
<ItemGroup>
31+
<ClInclude Include="src\resource\resource.h">
32+
<Filter>头文件</Filter>
33+
</ClInclude>
34+
<ClInclude Include="src\Version.h">
35+
<Filter>头文件</Filter>
36+
</ClInclude>
37+
</ItemGroup>
2538
</Project>

src/Version.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#define VERSION_NUM1 13
2+
#define VERSION_NUM2 8
3+
4+
#define STRINGIZER_HELPER(a) #a
5+
#define STRINGIZER(a) STRINGIZER_HELPER(a)
6+
7+
#define VERSION_NUMS VERSION_NUM1,VERSION_NUM2
8+
#define VERSION_STRING STRINGIZER(VERSION_NUM1) "." STRINGIZER(VERSION_NUM2)
9+
10+
#define VERSION_STRING_WITH_V "v" VERSION_STRING
11+
12+
#define RC_VERSION_STRING(num1,num2) STRINGIZER(num1) "." STRINGIZER(num2)

src/ghost_terminal.cpp

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#define floop while(1)
3131

32-
#define GT_VAR_STR "13.7"
32+
#include "Version.h"
3333

3434
using namespace SSTP_link_n;
3535
using namespace std;
@@ -301,8 +301,17 @@ class ghost_terminal final: public simple_terminal {
301301
}
302302
{
303303
auto names = linker.NOTYFY({{L"Event", L"ShioriEcho.GetName"}});
304-
auto result = linker.NOTYFY({{L"Event", L"ShioriEcho.Begin"},
305-
{L"Reference0", L"" GT_VAR_STR}});
304+
auto result = linker.NOTYFY({
305+
{L"Event", L"ShioriEcho.Begin"},
306+
{L"Reference0", L"" VERSION_STRING},
307+
{L"Reference1", [&]{//mode
308+
if(!command.empty())
309+
return L"Command";
310+
if(!sakurascript.empty())
311+
return L"SakuraScript";
312+
return L"Common";
313+
}()},
314+
});
306315
{
307316
//set console title
308317
wstring title = L"Ghost Terminal";
@@ -610,26 +619,46 @@ class ghost_terminal final: public simple_terminal {
610619
i++;
611620
if(i < argc)
612621
command = argv[i];
622+
else{
623+
err << RED_OUTPUT("No command after "<< argv[i - 1] << ".") << endline;
624+
exit(1);
625+
}
613626
}
614627
else if(argv[i] == L"-s" || argv[i] == L"--sakura-script") { //sakura script
615628
i++;
616629
if(i < argc)
617630
sakurascript = argv[i];
631+
else{
632+
err << RED_OUTPUT("No sakura script after "<< argv[i - 1] << ".") << endline;
633+
exit(1);
634+
}
618635
}
619636
else if(argv[i] == L"-g" || argv[i] == L"--ghost") { //ghost
620637
i++;
621638
if(i < argc)
622639
ghost_link_to = argv[i];
640+
else{
641+
err << RED_OUTPUT("No ghost name after "<< argv[i - 1] << ".") << endline;
642+
exit(1);
643+
}
623644
}
624645
else if(argv[i] == L"-gh" || argv[i] == L"--ghost-hwnd") { //ghost hwnd
625646
i++;
626647
if(i < argc)
627648
ghost_hwnd = (HWND)wcstoll(argv[i].c_str(), nullptr, 10);
649+
else{
650+
err << RED_OUTPUT("No ghost hwnd after "<< argv[i - 1] << ".") << endline;
651+
exit(1);
652+
}
628653
}
629654
else if(argv[i] == L"-gp" || argv[i] == L"--ghost-folder-path") {
630655
i++;
631656
if(i < argc)
632657
ghost_path = make_ghost_path(argv[i]);
658+
else{
659+
err << RED_OUTPUT("No ghost folder path after "<< argv[i - 1] << ".") << endline;
660+
exit(1);
661+
}
633662
}
634663
else if(argv[i] == L"-r" || argv[i] == L"--run-ghost") { //run ghost if not running
635664
run_ghost = 1;
@@ -649,6 +678,10 @@ class ghost_terminal final: public simple_terminal {
649678
}
650679
else if(argv[i] == L"--disable-text") {
651680
i++;
681+
if(i >= argc){
682+
err << RED_OUTPUT("No disable text types after "<< argv[i - 1] << ".") << endline;
683+
exit(1);
684+
}
652685
const wstring& disable_text = argv[i];
653686
if(disable_text == L"all")
654687
disable_root_text=disable_event_text=disable_WindowsTerminal_text=disable_FiraCode_text=true;
@@ -669,7 +702,7 @@ class ghost_terminal final: public simple_terminal {
669702
}
670703
}
671704
else if(argv[i] == L"-h" || argv[i] == L"--help") { //help
672-
out <<"ghost terminal v" GT_VAR_STR "\n\n"<<
705+
out <<"ghost terminal " VERSION_STRING_WITH_V "\n\n"<<
673706
LIGHT_YELLOW_OUTPUT(argv[0]) << SET_CYAN " [options]\n" RESET_COLOR
674707
"options:\n"
675708
" " SET_GREEN "-h" SET_YELLOW "," SET_GREEN " --help" SET_WHITE " : " SET_GRAY "shows this help message " SET_RED "and exits.\n"
@@ -695,7 +728,7 @@ class ghost_terminal final: public simple_terminal {
695728
exit(0);
696729
}
697730
else if(argv[i] == L"-v" || argv[i] == L"--version") {
698-
out << SET_GRAY "ghost terminal v" GT_VAR_STR "\n" RESET_COLOR;
731+
out << SET_GRAY "ghost terminal " VERSION_STRING_WITH_V "\n" RESET_COLOR;
699732
exit(0);
700733
}
701734
else {

src/resource/ghost_terminal.rc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Microsoft Visual C++ generated resource script.
2+
//
3+
#include "resource.h"
4+
5+
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
6+
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
7+
8+
/////////////////////////////////////////////////////////////////////////////
9+
//
10+
// Icon
11+
//
12+
13+
// Icon with lowest ID value placed first to ensure application icon
14+
// remains consistent on all systems.
15+
16+
IDI_SMALL ICON "icon/icon.ico"
17+
18+
/////////////////////////////////////////////////////////////////////////////
19+
//
20+
// Version
21+
//
22+
23+
VS_VERSION_INFO VERSIONINFO
24+
FILEVERSION VERSION_NUMS
25+
PRODUCTVERSION VERSION_NUMS
26+
FILEFLAGSMASK 0x3fL
27+
#ifdef _DEBUG
28+
FILEFLAGS 0x1L
29+
#else
30+
FILEFLAGS 0x0L
31+
#endif
32+
FILEOS 0x40004L
33+
FILETYPE 0x1L
34+
FILESUBTYPE 0x0L
35+
BEGIN
36+
BLOCK "StringFileInfo"
37+
BEGIN
38+
BLOCK "000004b0"
39+
BEGIN
40+
VALUE "FileDescription", "ghost terminal for every ghost!"
41+
VALUE "FileVersion", RC_VERSION_STRING(VERSION_NUM1,VERSION_NUM2)
42+
VALUE "OriginalFilename", "ghost_terminal.exe"
43+
VALUE "ProductVersion", RC_VERSION_STRING(VERSION_NUM1,VERSION_NUM2)
44+
VALUE "ProductName", "ghost terminal"
45+
END
46+
END
47+
BLOCK "VarFileInfo"
48+
BEGIN
49+
VALUE "Translation", 0x0, 1200
50+
END
51+
END
52+
53+
#endif

src/resource/icon/icon.ico

318 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)