Skip to content

Commit 8f258db

Browse files
committed
DemonwareOverride: allows using new online services replacement
Right now the replacement server allows creating/joining/searching lobbies There's no support for the rankings or ghost uploads right now, but hopefully will be added in future To use the online just go to multiplayer menu, choose online, then register a new account Your username/password will be stored in hashed form on the server To host games you may need to forward ports 41455 / 41456 / 41457 in your router, until we add a UPnP solution for the game
1 parent b3c1825 commit 8f258db

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed

OutRun2006Tweaks.ini

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ UITextureDump = false
100100
EnableTextureCache = true
101101

102102
# Replaces games texture allocator with a faster simplified version, greatly reducing stutter & load times
103-
UseNewTextureAllocator = true
103+
UseNewTextureAllocator = false
104104

105105
[Audio]
106106
# Allows using horn outside of the "beep the horn!" girlfriend missions
@@ -206,6 +206,11 @@ RestoreJPClarissa = false
206206
# (this doesn't completely randomize which animation will play - anims will still have conditions that have to be met)
207207
RandomHighwayAnimSets = false
208208

209+
# Allows redirecting the Demonware master server to a custom server instead
210+
# This host should be hosting lobby/auth/STUN
211+
# (Note that to host games you may need to forward ports 41455 / 41456 / 41457, for the time being)
212+
DemonwareServerOverride = 7.176.116.34.bc.googleusercontent.com
213+
209214
[Bugfixes]
210215
# Fixes looping clop sound effect remaining active through the session.
211216
FixPegasusClopping = true

src/dllmain.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ namespace Settings
108108
spdlog::info(" - DisableCountdownTimer: {}", DisableCountdownTimer);
109109
spdlog::info(" - RestoreJPClarissa: {}", RestoreJPClarissa);
110110
spdlog::info(" - RandomHighwayAnimSets: {}", RandomHighwayAnimSets);
111+
spdlog::info(" - DemonwareServerOverride: {}", DemonwareServerOverride);
111112

112113
spdlog::info(" - FixPegasusClopping: {}", FixPegasusClopping);
113114
spdlog::info(" - FixC2CRankings: {}", FixC2CRankings);
@@ -221,6 +222,7 @@ namespace Settings
221222
DisableCountdownTimer = ini.Get("Misc", "DisableCountdownTimer", std::move(DisableCountdownTimer));
222223
RestoreJPClarissa = ini.Get("Misc", "RestoreJPClarissa", std::move(RestoreJPClarissa));
223224
RandomHighwayAnimSets = ini.Get("Misc", "RandomHighwayAnimSets", std::move(RandomHighwayAnimSets));
225+
DemonwareServerOverride = ini.Get("Misc", "DemonwareServerOverride", std::move(DemonwareServerOverride));
224226

225227
FixPegasusClopping = ini.Get("Bugfixes", "FixPegasusClopping", std::move(FixPegasusClopping));
226228
FixC2CRankings = ini.Get("Bugfixes", "FixC2CRankings", std::move(FixC2CRankings));

src/hooks_misc.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,58 @@
66
#include "game_addrs.hpp"
77
#include <random>
88

9+
class DemonwareServerOverride : public Hook
10+
{
11+
inline static SafetyHookInline bdPlatformSocket__getHostByName_hook = {};
12+
static uint32_t __cdecl destination(const char* name, void* a2, int a3)
13+
{
14+
spdlog::debug("getHostByName: overriding host {} to {}", name, Settings::DemonwareServerOverride);
15+
auto ret = bdPlatformSocket__getHostByName_hook.ccall<uint32_t>(Settings::DemonwareServerOverride.c_str(), a2, a3);
16+
return ret;
17+
}
18+
19+
public:
20+
std::string_view description() override
21+
{
22+
return "DemonwareServerOverride";
23+
}
24+
25+
bool validate() override
26+
{
27+
return !Settings::DemonwareServerOverride.empty();
28+
}
29+
30+
bool apply() override
31+
{
32+
constexpr int bdPlatformSocket__getHostByName_Addr = 0x1349B0;
33+
34+
bdPlatformSocket__getHostByName_hook = safetyhook::create_inline(Module::exe_ptr(bdPlatformSocket__getHostByName_Addr), destination);
35+
36+
// DW has a very simple check to see if hostname is an IP: if first digit is a number, it's an IP addr
37+
// this is unfortunate when google cloud gives hostnames that start with a number...
38+
// Disable isalpha check if our override isn't an IP address
39+
{
40+
constexpr int bdPlatformSocket__getHostByName_isalpha_Addr = 0x1349C7;
41+
42+
bool isIPAddr = true;
43+
for (auto c : Settings::DemonwareServerOverride)
44+
if (isalpha(c))
45+
{
46+
isIPAddr = false;
47+
break;
48+
}
49+
50+
if (!isIPAddr)
51+
Memory::VP::Nop(Module::exe_ptr(bdPlatformSocket__getHostByName_isalpha_Addr), 2);
52+
}
53+
54+
return !!bdPlatformSocket__getHostByName_hook;
55+
}
56+
57+
static DemonwareServerOverride instance;
58+
};
59+
DemonwareServerOverride DemonwareServerOverride::instance;
60+
961
class RandomHighwayAnimSets : public Hook
1062
{
1163
inline static SafetyHookMid GetBranchRenditionType_midhook = {};

src/plugin.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ namespace Settings
102102
inline bool DisableCountdownTimer = false;
103103
inline bool RestoreJPClarissa = false;
104104
inline bool RandomHighwayAnimSets = false;
105+
inline std::string DemonwareServerOverride = "7.176.116.34.bc.googleusercontent.com";
105106

106107
inline bool FixPegasusClopping = true;
107108
inline bool FixC2CRankings = true;

0 commit comments

Comments
 (0)