Skip to content

Commit

Permalink
v13.8
Browse files Browse the repository at this point in the history
  • Loading branch information
steve02081504 committed May 14, 2023
1 parent b33aea4 commit a62e9e3
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 9 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Easy to use for ghost development
## Command line arguments

```text
ghost terminal v13.4
ghost terminal v13.8
ghost_terminal [options]
options:
Expand Down Expand Up @@ -73,6 +73,11 @@ The rest of the events should only be defined if you want to change the default
ghost_terminal event when this ghost starts
- `Reference0`
Terminal version
- `Reference1`
Terminal session type
`SakuraScript` if terminal start with `-s`
`Command` if terminal start with `-c`
`Common` if terminal start commonly
- Return value
- `X-SSTP-PassThru-Tittle` (optional)
Set the terminal title
Expand Down
7 changes: 6 additions & 1 deletion docs/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ up/down切换命令,鼠标右键快速粘贴,支持tab补全(如果人格
## 命令行参数

```text
ghost terminal v13.4
ghost terminal v13.8
ghost_terminal [options]
选项:
Expand Down Expand Up @@ -69,6 +69,11 @@ ghost_terminal通过`X-SSTP-PassThru-*`进行与人格间的信息沟通(见[
ghost_terminal对此ghost启动时事件
- `Reference0`
终端版本
- `Reference1`
终端启动方式
当terminal以`-s`启动时,为`SakuraScript`
当terminal以`-c`启动时,为`Command`
否则为`Common`
- 返值
- `X-SSTP-PassThru-Tittle`(可选)
设置终端标题
Expand Down
7 changes: 6 additions & 1 deletion docs/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Easy to use for ghost development
## Command line arguments

```text
ghost terminal v13.4
ghost terminal v13.8
ghost_terminal [options]
options:
Expand Down Expand Up @@ -69,6 +69,11 @@ The rest of the events should only be defined if you want to change the default
ghost_terminal event when this ghost starts
- `Reference0`
Terminal version
- `Reference1`
Terminal session type
`SakuraScript` if terminal start with `-s`
`Command` if terminal start with `-c`
`Common` if terminal start commonly
- Return value
- `X-SSTP-PassThru-Tittle` (optional)
Set the terminal title
Expand Down
7 changes: 6 additions & 1 deletion docs/README_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ghost_terminalをシステム端末のように使用する
テキスト

```text
ghost terminal v13.4
ghost terminal v13.8
ghost_terminal [オプション]を指定します。
オプションで指定します。
Expand Down Expand Up @@ -71,6 +71,11 @@ ghost_terminalの出力は、プレーンテキストではなく、仮想端末
このゴーストが起動したときのghost_terminalイベント
- `Reference0`
ターミナルバージョン
- `Reference1`
端末のセッションタイプ
端末が `-s` で始まる場合は `SakuraScript` となる。
端末が `-c` で始まる場合は `Command` となる。
端末が共通で起動する場合は `Common` となる。
- 戻り値
- `X-SSTP-PassThru-Tittle` (オプション)
端末のタイトルを設定する
Expand Down
7 changes: 7 additions & 0 deletions ghost_terminal.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
<ClCompile Include="src\ghost_terminal.cpp" />
<ClCompile Include="src\_gists.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="src\resource\ghost_terminal.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\resource\resource.h" />
<ClInclude Include="src\Version.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
Expand Down
13 changes: 13 additions & 0 deletions ghost_terminal.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,17 @@
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="src\resource\ghost_terminal.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\resource\resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="src\Version.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions src/Version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#define VERSION_NUM1 13
#define VERSION_NUM2 8

#define STRINGIZER_HELPER(a) #a
#define STRINGIZER(a) STRINGIZER_HELPER(a)

#define VERSION_NUMS VERSION_NUM1,VERSION_NUM2
#define VERSION_STRING STRINGIZER(VERSION_NUM1) "." STRINGIZER(VERSION_NUM2)

#define VERSION_STRING_WITH_V "v" VERSION_STRING

#define RC_VERSION_STRING(num1,num2) STRINGIZER(num1) "." STRINGIZER(num2)
43 changes: 38 additions & 5 deletions src/ghost_terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#define floop while(1)

#define GT_VAR_STR "13.7"
#include "Version.h"

using namespace SSTP_link_n;
using namespace std;
Expand Down Expand Up @@ -301,8 +301,17 @@ class ghost_terminal final: public simple_terminal {
}
{
auto names = linker.NOTYFY({{L"Event", L"ShioriEcho.GetName"}});
auto result = linker.NOTYFY({{L"Event", L"ShioriEcho.Begin"},
{L"Reference0", L"" GT_VAR_STR}});
auto result = linker.NOTYFY({
{L"Event", L"ShioriEcho.Begin"},
{L"Reference0", L"" VERSION_STRING},
{L"Reference1", [&]{//mode
if(!command.empty())
return L"Command";
if(!sakurascript.empty())
return L"SakuraScript";
return L"Common";
}()},
});
{
//set console title
wstring title = L"Ghost Terminal";
Expand Down Expand Up @@ -610,26 +619,46 @@ class ghost_terminal final: public simple_terminal {
i++;
if(i < argc)
command = argv[i];
else{
err << RED_OUTPUT("No command after "<< argv[i - 1] << ".") << endline;
exit(1);
}
}
else if(argv[i] == L"-s" || argv[i] == L"--sakura-script") { //sakura script
i++;
if(i < argc)
sakurascript = argv[i];
else{
err << RED_OUTPUT("No sakura script after "<< argv[i - 1] << ".") << endline;
exit(1);
}
}
else if(argv[i] == L"-g" || argv[i] == L"--ghost") { //ghost
i++;
if(i < argc)
ghost_link_to = argv[i];
else{
err << RED_OUTPUT("No ghost name after "<< argv[i - 1] << ".") << endline;
exit(1);
}
}
else if(argv[i] == L"-gh" || argv[i] == L"--ghost-hwnd") { //ghost hwnd
i++;
if(i < argc)
ghost_hwnd = (HWND)wcstoll(argv[i].c_str(), nullptr, 10);
else{
err << RED_OUTPUT("No ghost hwnd after "<< argv[i - 1] << ".") << endline;
exit(1);
}
}
else if(argv[i] == L"-gp" || argv[i] == L"--ghost-folder-path") {
i++;
if(i < argc)
ghost_path = make_ghost_path(argv[i]);
else{
err << RED_OUTPUT("No ghost folder path after "<< argv[i - 1] << ".") << endline;
exit(1);
}
}
else if(argv[i] == L"-r" || argv[i] == L"--run-ghost") { //run ghost if not running
run_ghost = 1;
Expand All @@ -649,6 +678,10 @@ class ghost_terminal final: public simple_terminal {
}
else if(argv[i] == L"--disable-text") {
i++;
if(i >= argc){
err << RED_OUTPUT("No disable text types after "<< argv[i - 1] << ".") << endline;
exit(1);
}
const wstring& disable_text = argv[i];
if(disable_text == L"all")
disable_root_text=disable_event_text=disable_WindowsTerminal_text=disable_FiraCode_text=true;
Expand All @@ -669,7 +702,7 @@ class ghost_terminal final: public simple_terminal {
}
}
else if(argv[i] == L"-h" || argv[i] == L"--help") { //help
out <<"ghost terminal v" GT_VAR_STR "\n\n"<<
out <<"ghost terminal " VERSION_STRING_WITH_V "\n\n"<<
LIGHT_YELLOW_OUTPUT(argv[0]) << SET_CYAN " [options]\n" RESET_COLOR
"options:\n"
" " SET_GREEN "-h" SET_YELLOW "," SET_GREEN " --help" SET_WHITE " : " SET_GRAY "shows this help message " SET_RED "and exits.\n"
Expand All @@ -695,7 +728,7 @@ class ghost_terminal final: public simple_terminal {
exit(0);
}
else if(argv[i] == L"-v" || argv[i] == L"--version") {
out << SET_GRAY "ghost terminal v" GT_VAR_STR "\n" RESET_COLOR;
out << SET_GRAY "ghost terminal " VERSION_STRING_WITH_V "\n" RESET_COLOR;
exit(0);
}
else {
Expand Down
53 changes: 53 additions & 0 deletions src/resource/ghost_terminal.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.

IDI_SMALL ICON "icon/icon.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_NUMS
PRODUCTVERSION VERSION_NUMS
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "FileDescription", "ghost terminal for every ghost!"
VALUE "FileVersion", RC_VERSION_STRING(VERSION_NUM1,VERSION_NUM2)
VALUE "OriginalFilename", "ghost_terminal.exe"
VALUE "ProductVersion", RC_VERSION_STRING(VERSION_NUM1,VERSION_NUM2)
VALUE "ProductName", "ghost terminal"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END

#endif
Binary file added src/resource/icon/icon.ico
Binary file not shown.
6 changes: 6 additions & 0 deletions src/resource/resource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ghost_terminal.rc

#include "../version.h"
#include "windows.h"

0 comments on commit a62e9e3

Please sign in to comment.