@@ -64,7 +64,9 @@ class ghost_terminal final: public simple_terminal {
64
64
HWND ghost_hwnd = NULL ;
65
65
wstring command;
66
66
wstring sakurascript;
67
- bool register2wt = 0 ;
67
+ bool has_command = 0 ;
68
+ bool has_sakurascript = 0 ;
69
+ bool register2wt = 0 ;
68
70
69
71
bool disable_root_text = 0 ;
70
72
bool disable_event_text = 0 ;
@@ -140,13 +142,15 @@ class ghost_terminal final: public simple_terminal {
140
142
// const auto& fira_code_font_found = data_until_login.fira_code_font_found;
141
143
const auto & LOCALAPPDATA = data_until_login.LOCALAPPDATA ;
142
144
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 ;
150
154
// disables
151
155
auto & disable_root_text = args_info.disable_root_text ;
152
156
auto & disable_event_text = args_info.disable_event_text ;
@@ -160,6 +164,7 @@ class ghost_terminal final: public simple_terminal {
160
164
while (i < argc) {
161
165
if (argv[i] == L" -c" || argv[i] == L" --command" ) { // command
162
166
i++;
167
+ has_command = 1 ;
163
168
if (i < argc)
164
169
command = argv[i];
165
170
else {
@@ -169,6 +174,7 @@ class ghost_terminal final: public simple_terminal {
169
174
}
170
175
else if (argv[i] == L" -s" || argv[i] == L" --sakura-script" ) { // sakura script
171
176
i++;
177
+ has_sakurascript = 1 ;
172
178
if (i < argc)
173
179
sakurascript = argv[i];
174
180
else {
@@ -448,13 +454,15 @@ class ghost_terminal final: public simple_terminal {
448
454
// make destroy_flag as data is no longer needed after this function
449
455
auto destroy_flag = data_until_login_saver.make_destroy_flag ();
450
456
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 ;
458
466
// disables
459
467
const auto & disable_root_text = args_info.disable_root_text ;
460
468
const auto & disable_event_text = args_info.disable_event_text ;
@@ -527,9 +535,10 @@ class ghost_terminal final: public simple_terminal {
527
535
{
528
536
const auto ghostnum = fmobj.info_map .size ();
529
537
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;
532
540
exit (1 );
541
+ }
533
542
start_ghost ();
534
543
}
535
544
else if (!ghost_link_to.empty ()) {
@@ -633,13 +642,14 @@ class ghost_terminal final: public simple_terminal {
633
642
linker.link_to_ghost (ghost_hwnd);
634
643
}
635
644
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;
638
647
exit (1 );
648
+ }
639
649
start_ghost ();
640
650
goto link_to_ghost;
641
651
}
642
- if (sakurascript. empty () ) // 发送ss不需要shiori就绪
652
+ if (!has_sakurascript ) // 发送ss不需要shiori就绪
643
653
waiter ([&] {
644
654
return fmobj.Update_info () && fmobj.info_map [ghost_uid].get_modulestate (L" shiori" ) == L" running" ;
645
655
},L" ghost's shiori ready" );
@@ -680,9 +690,9 @@ class ghost_terminal final: public simple_terminal {
680
690
{L" Event" , L" ShioriEcho.Begin" },
681
691
{L" Reference0" , L" " VERSION_STRING},
682
692
{L" Reference1" , [&] { // mode
683
- if (!command. empty () )
693
+ if (has_command )
684
694
return L" Command" ;
685
- if (!sakurascript. empty () )
695
+ if (has_sakurascript )
686
696
return L" SakuraScript" ;
687
697
return L" Common" ;
688
698
}()},
@@ -717,9 +727,11 @@ class ghost_terminal final: public simple_terminal {
717
727
SetConsoleIcon (icon_info);
718
728
}
719
729
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)) {
723
735
out << CYAN_TEXT (" terminal login\n " );
724
736
if (names.has (L" GhostName" ))
725
737
out << " Ghost: " << LIGHT_YELLOW_OUTPUT (names[L" GhostName" ]) << ' \n ' ;
@@ -729,11 +741,11 @@ class ghost_terminal final: public simple_terminal {
729
741
}
730
742
731
743
bool need_end = 0 ;
732
- if (!command. empty () ) {
744
+ if (has_command ) {
733
745
terminal_run (command);
734
746
need_end = 1 ;
735
747
}
736
- if (!sakurascript. empty () ) {
748
+ if (has_sakurascript ) {
737
749
linker.SEND ({{L" ID" , ghost_uid}, {L" Script" , sakurascript}});
738
750
need_end = 1 ;
739
751
}
0 commit comments