Skip to content

Commit b3d3030

Browse files
committed
refactor: various improvements
GUI is borked. It looks pretty until you try to do anything.
1 parent 119f9f9 commit b3d3030

File tree

7 files changed

+56
-45
lines changed

7 files changed

+56
-45
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*.o
33
*.obj
44

5-
# Executables
5+
# Build artifacts
66
*.exe
77
*.db
88
*.pdb
@@ -13,11 +13,10 @@
1313
GhostServer/Debug/
1414
GhostServer/Release/
1515
.vs/GhostServer/v16/.suo
16-
17-
# Linux build artifacts
1816
GhostServer/ui_mainwindow.h
1917
GhostServer/*_qt.cpp
2018
config.mk
19+
copy.bat
2120
ghost_server
2221
ghost_server_cli
2322

GhostServer/GhostServer.vcxproj

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<TargetExt>.exe</TargetExt>
4949
<OutDir>$(SolutionDir)GhostServer\Debug\CLI\</OutDir>
5050
<IntDir>$(SolutionDir)GhostServer\Debug\CLI\obj\</IntDir>
51+
<QtMsBuild></QtMsBuild>
5152
</PropertyGroup>
5253
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCLI|Win32'" Label="Configuration">
5354
<ConfigurationType>Application</ConfigurationType>
@@ -56,6 +57,7 @@
5657
<TargetExt>.exe</TargetExt>
5758
<OutDir>$(SolutionDir)GhostServer\Release\CLI\</OutDir>
5859
<IntDir>$(SolutionDir)GhostServer\Release\CLI\obj\</IntDir>
60+
<QtMsBuild></QtMsBuild>
5961
</PropertyGroup>
6062
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
6163
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
@@ -74,11 +76,11 @@
7476
<Import Project="$(QtMsBuild)\qt_defaults.props" />
7577
</ImportGroup>
7678
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='DebugGUI|Win32'">
77-
<QtInstall>msvc2017</QtInstall>
79+
<QtInstall>msvc2019</QtInstall>
7880
<QtModules>core;gui;widgets</QtModules>
7981
</PropertyGroup>
8082
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='ReleaseGUI|Win32'">
81-
<QtInstall>msvc2017</QtInstall>
83+
<QtInstall>msvc2019</QtInstall>
8284
<QtModules>core;gui;widgets</QtModules>
8385
</PropertyGroup>
8486
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='DebugCLI|Win32'">
@@ -111,7 +113,10 @@
111113
<AdditionalDependencies>sfml-system-s-d.lib;sfml-network-s-d.lib;winmm.lib;ws2_32.lib;$(Qt_LIBS_);%(AdditionalDependencies)</AdditionalDependencies>
112114
</Link>
113115
<PostBuildEvent>
114-
<Command>copy /Y "$(TargetPath)" "$(SolutionDir)GhostServer.exe"</Command>
116+
<Command>
117+
copy /Y "$(TargetPath)" "$(SolutionDir)GhostServer_CLI.exe"
118+
if exist "$(SolutionDir)copy.bat" call "$(SolutionDir)copy.bat"
119+
</Command>
115120
</PostBuildEvent>
116121
</ItemDefinitionGroup>
117122
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseGUI|Win32'">
@@ -132,7 +137,10 @@
132137
<AdditionalDependencies>sfml-system-s.lib;sfml-network-s.lib;winmm.lib;ws2_32.lib;$(Qt_LIBS_);%(AdditionalDependencies)</AdditionalDependencies>
133138
</Link>
134139
<PostBuildEvent>
135-
<Command>copy /Y "$(TargetPath)" "$(SolutionDir)GhostServer.exe"</Command>
140+
<Command>
141+
copy /Y "$(TargetPath)" "$(SolutionDir)GhostServer_CLI.exe"
142+
if exist "$(SolutionDir)copy.bat" call "$(SolutionDir)copy.bat"
143+
</Command>
136144
</PostBuildEvent>
137145
</ItemDefinitionGroup>
138146
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugCLI|Win32'">
@@ -154,7 +162,10 @@
154162
<AdditionalDependencies>sfml-system-s-d.lib;sfml-network-s-d.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
155163
</Link>
156164
<PostBuildEvent>
157-
<Command>copy /Y "$(TargetPath)" "$(SolutionDir)GhostServer_CLI.exe"</Command>
165+
<Command>
166+
copy /Y "$(TargetPath)" "$(SolutionDir)GhostServer_CLI.exe"
167+
if exist "$(SolutionDir)copy.bat" call "$(SolutionDir)copy.bat"
168+
</Command>
158169
</PostBuildEvent>
159170
</ItemDefinitionGroup>
160171
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseCLI|Win32'">
@@ -176,7 +187,10 @@
176187
<AdditionalDependencies>sfml-system-s.lib;sfml-network-s.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
177188
</Link>
178189
<PostBuildEvent>
179-
<Command>copy /Y "$(TargetPath)" "$(SolutionDir)GhostServer_CLI.exe"</Command>
190+
<Command>
191+
copy /Y "$(TargetPath)" "$(SolutionDir)GhostServer_CLI.exe"
192+
if exist "$(SolutionDir)copy.bat" call "$(SolutionDir)copy.bat"
193+
</Command>
180194
</PostBuildEvent>
181195
</ItemDefinitionGroup>
182196
<ItemGroup>

GhostServer/main_cli.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,10 @@ int main(int argc, char **argv) {
448448
g_network = &network;
449449

450450
puts("Server starting up");
451-
network.StartServer(port);
451+
if (!network.StartServer(port)) {
452+
printf("Failed to start server on port %d", port);
453+
return 1;
454+
}
452455
while (!g_should_stop) {
453456
#ifdef _WIN32
454457
if (_kbhit()) {

GhostServer/mainwindow.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ MainWindow::~MainWindow()
2828
void MainWindow::StartServer()
2929
{
3030
if (!this->network.StartServer(ui.port->value())) {
31-
this->AddEventLog("Server didn't start ! Please check settings !");
31+
this->AddEventLog("Server didn't start! Please check settings!");
3232
return;
3333
}
3434

@@ -59,7 +59,7 @@ void MainWindow::ResetServer()
5959
void MainWindow::StartCountdown()
6060
{
6161
if (!this->isRunning) {
62-
this->AddEventLog("Please start the server before starting a countdown, you moron !");
62+
this->AddEventLog("Please start the server before starting a countdown, you moron!");
6363
return;
6464
}
6565

@@ -87,8 +87,7 @@ void MainWindow::StartCountdown()
8787
int duration = ui.duration->value();
8888
this->network.StartCountdown(pre_cmds.toStdString(), post_cmds.toStdString(), duration);
8989

90-
this->AddEventLog("Countdown will start in " + QString::number(duration));
91-
this->AddEventLog("Pre-command : " + pre_cmds);
92-
this->AddEventLog("Post-command : " + post_cmds);
90+
this->AddEventLog("Countdown starting: " + QString::number(duration) + " seconds");
91+
this->AddEventLog("Pre-command: " + pre_cmds);
92+
this->AddEventLog("Post-command: " + post_cmds);
9393
}
94-

GhostServer/mainwindow.ui

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
14-
<string>FrenchSaves10TicksBtw</string>
14+
<string>Ghost Server</string>
1515
</property>
1616
<layout class="QVBoxLayout" name="verticalLayout">
1717
<item>
@@ -73,7 +73,7 @@
7373
<item row="0" column="0">
7474
<widget class="QLabel" name="label_4">
7575
<property name="text">
76-
<string>Pre countdowncommands</string>
76+
<string>Pre-countdown commands</string>
7777
</property>
7878
</widget>
7979
</item>
@@ -96,7 +96,7 @@
9696
<item row="1" column="0">
9797
<widget class="QLabel" name="label_5">
9898
<property name="text">
99-
<string>Post countdown</string>
99+
<string>Post-countdown commands</string>
100100
</property>
101101
</widget>
102102
</item>
@@ -119,7 +119,7 @@
119119
<item row="2" column="0">
120120
<widget class="QLabel" name="label_6">
121121
<property name="text">
122-
<string>Duration</string>
122+
<string>Countdown duration (seconds)</string>
123123
</property>
124124
</widget>
125125
</item>
@@ -186,7 +186,19 @@
186186
</font>
187187
</property>
188188
<property name="text">
189-
<string>More settings comming soon TM (maybe...)</string>
189+
<string>More settings coming soon TM (maybe...)</string>
190+
</property>
191+
</widget>
192+
</item>
193+
<item row="2" column="1">
194+
<widget class="QLabel" name="label_3">
195+
<property name="font">
196+
<font>
197+
<pointsize>8</pointsize>
198+
</font>
199+
</property>
200+
<property name="text">
201+
<string>French saves 10 ticks, by the way.</string>
190202
</property>
191203
</widget>
192204
</item>

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ Server for the Ghost feature in [SAR](https://github.com/p2sr/SourceAutoRecord)
66

77
## Installation
88

9-
- Download the latest release in [releases page](https://github.com/p2sr/GhostServer/releases)
9+
- Download the latest release from the [releases page](https://github.com/p2sr/GhostServer/releases)
1010
- Unzip the archive
11-
- Launch ``Server.exe``
11+
- Launch ``GhostServer.exe``
1212
- The default port is **53000**. You can change it in the ``Settings`` tab.
13-
- In the settings of your router, open both UDP and TCP xxxxx port, xxxxx being the port you specified in the ``port`` setting.
13+
- In the settings of your router, open both UDP and TCP ports to the above setting.
1414

1515
## Usage
1616

17+
> The GUI mode is currently broken in various ways. Please use the CLI version instead
18+
> in the meantime. The `help` command will show you the available commands.
19+
> Run the server with `.\GhostServer_CLI.exe [port=53000]`
20+
1721
- The server will run as soon as you click on the ``Start Server`` button. Your IP address is shown on the first line along with the port the server uses to communicate.
1822
- Players and spectators connect to the server with the SAR commands `ghost_connect <ip> [port=53000]` or `ghost_spec_connect <ip> [port=53000]`
1923
- You can set a countdown on the right part of the interface
20-
- You can set some commands to execute before and after the countdown. You can write them on one line like `"sv_cheats 0; say lol"` or on multi-line
24+
- You can set some commands to execute before and after the countdown. You can write them on one line like `sv_cheats 0; say lol` or on multi-line
2125
- Server stops by clicking on the ``Stop Server`` button (previously ``Start Server``)
2226

2327
## Contributing

configure

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)