Skip to content

Commit 9adc30d

Browse files
committed
Update
1 parent b5de6a0 commit 9adc30d

File tree

3 files changed

+41
-29
lines changed

3 files changed

+41
-29
lines changed

src/Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define VERSION_NUM1 13
22
#define VERSION_NUM2 9
33
#define VERSION_NUM3 0
4-
#define VERSION_NUM4 2
4+
#define VERSION_NUM4 3
55

66
#define STRINGIZER_HELPER(a) #a
77
#define STRINGIZER(a) STRINGIZER_HELPER(a)

src/ghost_terminal.cpp

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ class ghost_terminal final: public simple_terminal {
6464
HWND ghost_hwnd = NULL;
6565
wstring command;
6666
wstring sakurascript;
67-
bool register2wt = 0;
67+
bool has_command = 0;
68+
bool has_sakurascript = 0;
69+
bool register2wt = 0;
6870

6971
bool disable_root_text = 0;
7072
bool disable_event_text = 0;
@@ -140,13 +142,15 @@ class ghost_terminal final: public simple_terminal {
140142
//const auto& fira_code_font_found = data_until_login.fira_code_font_found;
141143
const auto& LOCALAPPDATA = data_until_login.LOCALAPPDATA;
142144

143-
auto& ghost_path = args_info.ghost_path;
144-
auto& run_ghost = args_info.run_ghost;
145-
auto& ghost_link_to = args_info.ghost_link_to;
146-
auto& ghost_hwnd = args_info.ghost_hwnd;
147-
auto& command = args_info.command;
148-
auto& sakurascript = args_info.sakurascript;
149-
auto& register2wt = args_info.register2wt;
145+
auto& ghost_path = args_info.ghost_path;
146+
auto& run_ghost = args_info.run_ghost;
147+
auto& ghost_link_to = args_info.ghost_link_to;
148+
auto& ghost_hwnd = args_info.ghost_hwnd;
149+
auto& command = args_info.command;
150+
auto& sakurascript = args_info.sakurascript;
151+
auto& register2wt = args_info.register2wt;
152+
auto& has_command = args_info.has_command;
153+
auto& has_sakurascript = args_info.has_sakurascript;
150154
//disables
151155
auto& disable_root_text = args_info.disable_root_text;
152156
auto& disable_event_text = args_info.disable_event_text;
@@ -160,6 +164,7 @@ class ghost_terminal final: public simple_terminal {
160164
while(i < argc) {
161165
if(argv[i] == L"-c" || argv[i] == L"--command") { //command
162166
i++;
167+
has_command = 1;
163168
if(i < argc)
164169
command = argv[i];
165170
else {
@@ -169,6 +174,7 @@ class ghost_terminal final: public simple_terminal {
169174
}
170175
else if(argv[i] == L"-s" || argv[i] == L"--sakura-script") { //sakura script
171176
i++;
177+
has_sakurascript = 1;
172178
if(i < argc)
173179
sakurascript = argv[i];
174180
else {
@@ -448,13 +454,15 @@ class ghost_terminal final: public simple_terminal {
448454
//make destroy_flag as data is no longer needed after this function
449455
auto destroy_flag = data_until_login_saver.make_destroy_flag();
450456

451-
auto& ghost_link_to = args_info.ghost_link_to;
452-
auto& ghost_path = args_info.ghost_path;
453-
const auto& run_ghost = args_info.run_ghost;
454-
auto& ghost_hwnd = args_info.ghost_hwnd;
455-
const auto& command = args_info.command;
456-
const auto& sakurascript = args_info.sakurascript;
457-
const auto& register2wt = args_info.register2wt;
457+
auto& ghost_link_to = args_info.ghost_link_to;
458+
auto& ghost_path = args_info.ghost_path;
459+
const auto& run_ghost = args_info.run_ghost;
460+
auto& ghost_hwnd = args_info.ghost_hwnd;
461+
const auto& register2wt = args_info.register2wt;
462+
const auto& command = args_info.command;
463+
const auto& sakurascript = args_info.sakurascript;
464+
const auto& has_command = args_info.has_command;
465+
const auto& has_sakurascript = args_info.has_sakurascript;
458466
//disables
459467
const auto& disable_root_text = args_info.disable_root_text;
460468
const auto& disable_event_text = args_info.disable_event_text;
@@ -527,9 +535,10 @@ class ghost_terminal final: public simple_terminal {
527535
{
528536
const auto ghostnum = fmobj.info_map.size();
529537
if(ghostnum == 0) {
530-
err << RED_TEXT("None of ghost was running.") << endline;
531-
if(!run_ghost)
538+
if(!run_ghost) {
539+
err << RED_TEXT("None of ghost was running.") << endline;
532540
exit(1);
541+
}
533542
start_ghost();
534543
}
535544
else if(!ghost_link_to.empty()) {
@@ -633,13 +642,14 @@ class ghost_terminal final: public simple_terminal {
633642
linker.link_to_ghost(ghost_hwnd);
634643
}
635644
else {
636-
err << RED_TEXT("Can\'t read FMO info.") << endline;
637-
if(!run_ghost)
645+
if(!run_ghost) {
646+
err << RED_TEXT("Can\'t read FMO info.") << endline;
638647
exit(1);
648+
}
639649
start_ghost();
640650
goto link_to_ghost;
641651
}
642-
if(sakurascript.empty()) //发送ss不需要shiori就绪
652+
if(!has_sakurascript) //发送ss不需要shiori就绪
643653
waiter([&] {
644654
return fmobj.Update_info() && fmobj.info_map[ghost_uid].get_modulestate(L"shiori") == L"running";
645655
},L"ghost's shiori ready");
@@ -680,9 +690,9 @@ class ghost_terminal final: public simple_terminal {
680690
{L"Event", L"ShioriEcho.Begin"},
681691
{L"Reference0", L"" VERSION_STRING},
682692
{L"Reference1", [&] { //mode
683-
if(!command.empty())
693+
if(has_command)
684694
return L"Command";
685-
if(!sakurascript.empty())
695+
if(has_sakurascript)
686696
return L"SakuraScript";
687697
return L"Common";
688698
}()},
@@ -717,9 +727,11 @@ class ghost_terminal final: public simple_terminal {
717727
SetConsoleIcon(icon_info);
718728
}
719729

720-
if(result.has(L"CustomLoginInfo"))
721-
out << LIGHT_YELLOW_OUTPUT(do_transfer(result[L"CustomLoginInfo"])) << '\n';
722-
else {
730+
if(result.has(L"CustomLoginInfo")) {
731+
if(result[L"CustomLoginInfo"].size())
732+
out << LIGHT_YELLOW_OUTPUT(do_transfer(result[L"CustomLoginInfo"])) << '\n';
733+
}
734+
else if(!(has_command || has_sakurascript)) {
723735
out << CYAN_TEXT("terminal login\n");
724736
if(names.has(L"GhostName"))
725737
out << "Ghost: " << LIGHT_YELLOW_OUTPUT(names[L"GhostName"]) << '\n';
@@ -729,11 +741,11 @@ class ghost_terminal final: public simple_terminal {
729741
}
730742

731743
bool need_end = 0;
732-
if(!command.empty()) {
744+
if(has_command) {
733745
terminal_run(command);
734746
need_end = 1;
735747
}
736-
if(!sakurascript.empty()) {
748+
if(has_sakurascript) {
737749
linker.SEND({{L"ID", ghost_uid}, {L"Script", sakurascript}});
738750
need_end = 1;
739751
}

src/my-gists

0 commit comments

Comments
 (0)