Skip to content

Commit d55f3d6

Browse files
committed
chore: improved app id handing in steam
1 parent 88db48e commit d55f3d6

12 files changed

Lines changed: 102 additions & 17 deletions

File tree

scrolls/lgsm/.build/vars.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"lua_query_servername": "Druid Gameserver (idle) - Start server by joining",
99
"main_port_protocol": "udp",
1010
"start_delay": "0",
11-
"rcon_port": "true"
11+
"rcon_port": "true",
12+
"lua_steam_app_id": "346110"
1213
},
1314
"cs2server": {
1415
"rcon": "enabled",
@@ -19,11 +20,13 @@
1920
"lua_query_map": "server idle",
2021
"lua_query_servername": "Druid Gameserver (idle) - Start server by joining",
2122
"lua_query_port": "main",
22-
"lua_query_start_on_unknown_packet": "yes"
23+
"lua_query_start_on_unknown_packet": "yes",
24+
"lua_steam_app_id": "730"
2325
},
2426
"pwserver": {
2527
"port": "main=8211/udp;rcon=25575",
26-
"main_port_protocol": "udp"
28+
"main_port_protocol": "udp",
29+
"lua_steam_app_id": "1623730"
2730
},
2831
"gmodserver": {
2932
"port": "query=27005/udp;main=/udp;sourcetv=27020/udp;steam=27015",
@@ -35,27 +38,31 @@
3538
"lua_query_map": "server idle",
3639
"lua_query_servername": "Druid Gameserver (idle) - Start server by joining",
3740
"lua_query_port": "main",
38-
"lua_query_start_on_unknown_packet": "yes"
41+
"lua_query_start_on_unknown_packet": "yes",
42+
"lua_steam_app_id": "4000"
3943
},
4044
"sdtdserver": {
4145
"port": "main=26900/udp;main2=26902/udp;maintcp=26900",
4246
"lua_query_game_name": "7 Days To Die",
4347
"lua_query_folder": "7DTD",
4448
"lua_query_map": "server idle",
4549
"lua_query_servername": "Druid Gameserver (idle) - Start server by joining",
46-
"main_port_protocol": "udp"
50+
"main_port_protocol": "udp",
51+
"lua_steam_app_id": "251570"
4752
},
4853
"dayzserver": {
4954
"port": "main=2302/udp;battle-eye=2304/udp;query=27016/udp",
50-
"main_port_protocol": "udp"
55+
"main_port_protocol": "udp",
56+
"lua_steam_app_id": "221100"
5157
},
5258
"untserver": {
5359
"port": "main=27015/udp;mainv6=27016",
5460
"lua_query_game_name": "Unturned Server",
5561
"lua_query_folder": "Unturned",
5662
"lua_query_map": "server idle",
5763
"lua_query_servername": "Druid Gameserver (idle) - Start server by joining",
58-
"main_port_protocol": "udp"
64+
"main_port_protocol": "udp",
65+
"lua_steam_app_id": "304930"
5966
},
6067
"csgoserver": {
6168
"port": "query=27005/udp;main=27015/udp;sourcetv=27020/udp;steam=27015",
@@ -64,15 +71,17 @@
6471
"lua_query_map": "server idle",
6572
"lua_query_servername": "Druid Gameserver (idle) - Start server by joining",
6673
"main_port_protocol": "udp",
67-
"ppm": "600"
74+
"ppm": "600",
75+
"lua_steam_app_id": "730"
6876
},
6977
"terrariaserver": {
7078
"port": "todo=8211/udp",
7179
"lua_query_game_name": "Terraria Server",
7280
"lua_query_folder": "terraria",
7381
"lua_query_map": "server idle",
7482
"lua_query_servername": "Druid Gameserver (idle) - Start server by joining",
75-
"main_port_protocol": "udp"
83+
"main_port_protocol": "udp",
84+
"lua_steam_app_id": "105600"
7685
},
7786
"pzserver": {
7887
"port": "main=26900/udp;main2=26902/udp;maintcp=26900",

scrolls/lgsm/.build/versions/cs2server/packet_handler/query.lua

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ function string.tohex(str)
1010
end))
1111
end
1212

13+
function pack_uint64_le(n)
14+
local bytes = {}
15+
for i = 1, 8 do
16+
bytes[i] = string.char(n % 256)
17+
n = math.floor(n / 256)
18+
end
19+
return table.concat(bytes)
20+
end
21+
1322
function handle(ctx, data)
1423

1524
-- prtocol begins with FFFFFFFF and the packedid
@@ -20,8 +29,14 @@ function handle(ctx, data)
2029

2130
hex = string.tohex(data)
2231

32+
startOnUnknownPacket = get_var("StartOnUnknownPacket")
2333
if string.sub(hex, 1, 8) ~= "FFFFFFFF" then
2434
debug_print("Invalid Packet " .. hex)
35+
36+
if startOnUnknownPacket == "yes" then
37+
print("Starting server on invalid packet: " .. hex)
38+
finish()
39+
end
2540
return
2641
end
2742

@@ -137,6 +152,14 @@ function handle(ctx, data)
137152
versionPrefix = get_var("GameVersionPrefix")
138153
serverPort = get_port("main")
139154

155+
156+
edfGameIdStr = get_var("SteamAppId")
157+
edfGameId = nil
158+
if edfGameIdStr ~= nil then
159+
edfGameId = tonumber(edfGameIdStr)
160+
end
161+
162+
140163
-- EDF & 0x80: Port
141164
-- EDF & 0x10: SteamID
142165
-- EDF & 0x20 Keywords
@@ -149,7 +172,6 @@ function handle(ctx, data)
149172
edfKeywords = get_var("GameKeywords") or ",OWNINGID:90202064633057281,OWNINGNAME:90202064633057281,NUMOPENPUBCONN:50,P2PADDR:90202064633057281,P2PPORT:" ..
150173
serverPort .. ",LEGACY_i:0"
151174

152-
edfGameId = "a00f000000000000"
153175

154176
serverinfopacket = ServeInfoPacket:new()
155177
serverinfopacket.name = name
@@ -183,7 +205,6 @@ function handle(ctx, data)
183205
end
184206

185207
print("Unknown Packet: " .. hex)
186-
startOnUnknownPacket = get_var("StartOnUnknownPacket")
187208
if startOnUnknownPacket == "yes" then
188209
print("Starting server on unknown packet: " .. hex)
189210
finish()
@@ -226,6 +247,10 @@ function Packet:appendByte(data)
226247
self.bytes = self.bytes .. string.char(data)
227248
end
228249

250+
function Packet:appendRawBytes(data)
251+
self.bytes = self.bytes .. data
252+
end
253+
229254
function Packet:appendShort(num)
230255
self.bytes = self.bytes .. string.fromhex(number_to_little_endian_short(num))
231256
end
@@ -318,7 +343,8 @@ function ServeInfoPacket:GetRawPacket()
318343
p:appendString(self.edfKeywords)
319344
end
320345
if self.edfGameId ~= nil then
321-
p:appendHex(self.edfGameId)
346+
local bytes = pack_uint64_le(self.edfGameId)
347+
p:appendRawBytes(bytes)
322348
end
323349

324350

scrolls/lgsm/.build/versions/pzserver/packet_handler/query.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ function handle(ctx, data)
2929

3030
hex = string.tohex(data)
3131

32+
startOnUnknownPacket = get_var("StartOnUnknownPacket")
3233
if string.sub(hex, 1, 8) ~= "FFFFFFFF" then
3334
debug_print("Invalid Packet " .. hex)
35+
36+
if startOnUnknownPacket == "yes" then
37+
print("Starting server on invalid packet: " .. hex)
38+
finish()
39+
end
3440
return
3541
end
3642

@@ -199,7 +205,6 @@ function handle(ctx, data)
199205
end
200206

201207
print("Unknown Packet: " .. hex)
202-
startOnUnknownPacket = get_var("StartOnUnknownPacket")
203208
if startOnUnknownPacket == "yes" then
204209
print("Starting server on unknown packet: " .. hex)
205210
finish()

scrolls/lgsm/arkserver/scroll.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ ports:
2121
value: server idle
2222
- name: ServerListName
2323
value: "Druid Gameserver (idle) - Start server by joining"
24+
- name: SteamAppId
25+
value: "346110"
2426
- name: main
2527
description: Main game port. Use this port inside of your game client to connect to the server. Depending on the game you might need the query port to connect.
2628
protocol: udp

scrolls/lgsm/cs2server/packet_handler/query.lua

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ function string.tohex(str)
1010
end))
1111
end
1212

13+
function pack_uint64_le(n)
14+
local bytes = {}
15+
for i = 1, 8 do
16+
bytes[i] = string.char(n % 256)
17+
n = math.floor(n / 256)
18+
end
19+
return table.concat(bytes)
20+
end
21+
1322
function handle(ctx, data)
1423

1524
-- prtocol begins with FFFFFFFF and the packedid
@@ -20,8 +29,14 @@ function handle(ctx, data)
2029

2130
hex = string.tohex(data)
2231

32+
startOnUnknownPacket = get_var("StartOnUnknownPacket")
2333
if string.sub(hex, 1, 8) ~= "FFFFFFFF" then
2434
debug_print("Invalid Packet " .. hex)
35+
36+
if startOnUnknownPacket == "yes" then
37+
print("Starting server on invalid packet: " .. hex)
38+
finish()
39+
end
2540
return
2641
end
2742

@@ -137,6 +152,14 @@ function handle(ctx, data)
137152
versionPrefix = get_var("GameVersionPrefix")
138153
serverPort = get_port("main")
139154

155+
156+
edfGameIdStr = get_var("SteamAppId")
157+
edfGameId = nil
158+
if edfGameIdStr ~= nil then
159+
edfGameId = tonumber(edfGameIdStr)
160+
end
161+
162+
140163
-- EDF & 0x80: Port
141164
-- EDF & 0x10: SteamID
142165
-- EDF & 0x20 Keywords
@@ -149,7 +172,6 @@ function handle(ctx, data)
149172
edfKeywords = get_var("GameKeywords") or ",OWNINGID:90202064633057281,OWNINGNAME:90202064633057281,NUMOPENPUBCONN:50,P2PADDR:90202064633057281,P2PPORT:" ..
150173
serverPort .. ",LEGACY_i:0"
151174

152-
edfGameId = "a00f000000000000"
153175

154176
serverinfopacket = ServeInfoPacket:new()
155177
serverinfopacket.name = name
@@ -183,7 +205,6 @@ function handle(ctx, data)
183205
end
184206

185207
print("Unknown Packet: " .. hex)
186-
startOnUnknownPacket = get_var("StartOnUnknownPacket")
187208
if startOnUnknownPacket == "yes" then
188209
print("Starting server on unknown packet: " .. hex)
189210
finish()
@@ -226,6 +247,10 @@ function Packet:appendByte(data)
226247
self.bytes = self.bytes .. string.char(data)
227248
end
228249

250+
function Packet:appendRawBytes(data)
251+
self.bytes = self.bytes .. data
252+
end
253+
229254
function Packet:appendShort(num)
230255
self.bytes = self.bytes .. string.fromhex(number_to_little_endian_short(num))
231256
end
@@ -318,7 +343,8 @@ function ServeInfoPacket:GetRawPacket()
318343
p:appendString(self.edfKeywords)
319344
end
320345
if self.edfGameId ~= nil then
321-
p:appendHex(self.edfGameId)
346+
local bytes = pack_uint64_le(self.edfGameId)
347+
p:appendRawBytes(bytes)
322348
end
323349

324350

scrolls/lgsm/cs2server/scroll.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ ports:
2323
value: "Druid Gameserver (idle) - Start server by joining"
2424
- name: StartOnUnknownPacket
2525
value: "yes"
26+
- name: SteamAppId
27+
value: "730"
2628
init: "console"
2729
commands:
2830
console:

scrolls/lgsm/csgoserver/scroll.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ ports:
2121
value: server idle
2222
- name: ServerListName
2323
value: "Druid Gameserver (idle) - Start server by joining"
24+
- name: SteamAppId
25+
value: "730"
2426
- name: main
2527
description: Main game port. Use this port inside of your game client to connect to the server. Depending on the game you might need the query port to connect.
2628
protocol: udp

scrolls/lgsm/gmodserver/scroll.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ ports:
2929
value: "01"
3030
- name: StartOnUnknownPacket
3131
value: "yes"
32+
- name: SteamAppId
33+
value: "4000"
3234
init: "console"
3335
commands:
3436
console:

scrolls/lgsm/pzserver/packet_handler/query.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ function handle(ctx, data)
2929

3030
hex = string.tohex(data)
3131

32+
startOnUnknownPacket = get_var("StartOnUnknownPacket")
3233
if string.sub(hex, 1, 8) ~= "FFFFFFFF" then
3334
debug_print("Invalid Packet " .. hex)
35+
36+
if startOnUnknownPacket == "yes" then
37+
print("Starting server on invalid packet: " .. hex)
38+
finish()
39+
end
3440
return
3541
end
3642

@@ -199,7 +205,6 @@ function handle(ctx, data)
199205
end
200206

201207
print("Unknown Packet: " .. hex)
202-
startOnUnknownPacket = get_var("StartOnUnknownPacket")
203208
if startOnUnknownPacket == "yes" then
204209
print("Starting server on unknown packet: " .. hex)
205210
finish()

scrolls/lgsm/sdtdserver/scroll.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ ports:
2121
value: server idle
2222
- name: ServerListName
2323
value: "Druid Gameserver (idle) - Start server by joining"
24+
- name: SteamAppId
25+
value: "251570"
2426
- name: main
2527
description: Main game port. Use this port inside of your game client to connect to the server. Depending on the game you might need the query port to connect.
2628
protocol: udp

0 commit comments

Comments
 (0)