Hide SDL window for catbots entirely
due to mesa having problems with Xvfb we should stop using Xvfb and instead just use the normal display again, but this time hide the window
This commit is contained in:
parent
d28f5e9eca
commit
e5d75893d3
@ -30,6 +30,7 @@ enum SharedObjects
|
|||||||
engine,
|
engine,
|
||||||
steamapi,
|
steamapi,
|
||||||
vstd,
|
vstd,
|
||||||
|
launcher,
|
||||||
// Whatever you do, keep this one last
|
// Whatever you do, keep this one last
|
||||||
entry_count
|
entry_count
|
||||||
};
|
};
|
||||||
@ -43,6 +44,7 @@ public:
|
|||||||
static uintptr_t GetSignature(const char *chPattern, sharedobj::SharedObject &obj, int idx);
|
static uintptr_t GetSignature(const char *chPattern, sharedobj::SharedObject &obj, int idx);
|
||||||
static uintptr_t GetClientSignature(const char *chPattern);
|
static uintptr_t GetClientSignature(const char *chPattern);
|
||||||
static uintptr_t GetEngineSignature(const char *chPattern);
|
static uintptr_t GetEngineSignature(const char *chPattern);
|
||||||
|
static uintptr_t GetLauncherSignature(const char *chaPattern);
|
||||||
static uintptr_t GetSteamAPISignature(const char *chPattern);
|
static uintptr_t GetSteamAPISignature(const char *chPattern);
|
||||||
static uintptr_t GetVstdSignature(const char *chPattern);
|
static uintptr_t GetVstdSignature(const char *chPattern);
|
||||||
};
|
};
|
||||||
|
@ -42,6 +42,7 @@ SharedObject &serverbrowser();
|
|||||||
SharedObject &steamclient();
|
SharedObject &steamclient();
|
||||||
SharedObject &client();
|
SharedObject &client();
|
||||||
SharedObject &engine();
|
SharedObject &engine();
|
||||||
|
SharedObject &launcher();
|
||||||
SharedObject &steamapi();
|
SharedObject &steamapi();
|
||||||
SharedObject &vstdlib();
|
SharedObject &vstdlib();
|
||||||
SharedObject &tier0();
|
SharedObject &tier0();
|
||||||
|
@ -212,6 +212,11 @@ uintptr_t CSignature::GetEngineSignature(const char *chPattern)
|
|||||||
return GetSignature(chPattern, sharedobj::engine(), CSignature_space::engine);
|
return GetSignature(chPattern, sharedobj::engine(), CSignature_space::engine);
|
||||||
}
|
}
|
||||||
//===================================================================================
|
//===================================================================================
|
||||||
|
uintptr_t CSignature::GetLauncherSignature(const char *chPattern)
|
||||||
|
{
|
||||||
|
return GetSignature(chPattern, sharedobj::launcher(), CSignature_space::launcher);
|
||||||
|
}
|
||||||
|
//===================================================================================
|
||||||
uintptr_t CSignature::GetSteamAPISignature(const char *chPattern)
|
uintptr_t CSignature::GetSteamAPISignature(const char *chPattern)
|
||||||
{
|
{
|
||||||
return GetSignature(chPattern, sharedobj::steamapi(), CSignature_space::steamapi);
|
return GetSignature(chPattern, sharedobj::steamapi(), CSignature_space::steamapi);
|
||||||
|
@ -99,6 +99,7 @@ void LoadEarlyObjects()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
engine().Load();
|
engine().Load();
|
||||||
|
launcher().Load();
|
||||||
filesystem_stdio().Load();
|
filesystem_stdio().Load();
|
||||||
tier0().Load();
|
tier0().Load();
|
||||||
materialsystem().Load();
|
materialsystem().Load();
|
||||||
@ -146,6 +147,7 @@ void UnloadAllSharedObjects()
|
|||||||
studiorender().Unload();
|
studiorender().Unload();
|
||||||
libsdl().Unload();
|
libsdl().Unload();
|
||||||
#endif
|
#endif
|
||||||
|
launcher().Unload();
|
||||||
engine().Unload();
|
engine().Unload();
|
||||||
filesystem_stdio().Unload();
|
filesystem_stdio().Unload();
|
||||||
tier0().Unload();
|
tier0().Unload();
|
||||||
@ -172,6 +174,11 @@ SharedObject &engine()
|
|||||||
static SharedObject obj("engine.so", true);
|
static SharedObject obj("engine.so", true);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
SharedObject &launcher()
|
||||||
|
{
|
||||||
|
static SharedObject obj("launcher.so", true);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
SharedObject &vstdlib()
|
SharedObject &vstdlib()
|
||||||
{
|
{
|
||||||
static SharedObject obj("libvstdlib.so", true);
|
static SharedObject obj("libvstdlib.so", true);
|
||||||
|
@ -271,17 +271,44 @@ static void UnHookFs()
|
|||||||
if (g_IBaseClient)
|
if (g_IBaseClient)
|
||||||
g_IBaseClient->InvalidateMdlCache();
|
g_IBaseClient->InvalidateMdlCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_TEXTMODE
|
#if ENABLE_TEXTMODE
|
||||||
static InitRoutineEarly nullify_textmode([]() {
|
static InitRoutineEarly nullify_textmode([]() {
|
||||||
ReduceRamUsage();
|
// SDL_CreateWindow has a "flag" parameter. We simply give it HIDDEN as a flag
|
||||||
static auto addr1 = e8call_direct(gSignatures.GetEngineSignature("E8 ? ? ? ? 8B 93 ? ? ? ? 85 D2 0F 84")) + 0x18;
|
static auto addr1 = gSignatures.GetLauncherSignature("C7 43 ? ? ? ? ? C7 44 24 ? ? ? ? ? C7 44 24") + 0xb;
|
||||||
static auto addr2 = sharedobj::materialsystem().Pointer(0x3EC08);
|
// All of these are needed so tf2 doesn't just unhide the window
|
||||||
|
static auto addr2 = gSignatures.GetLauncherSignature("E8 ? ? ? ? C6 43 25 01 83 C4 5C");
|
||||||
|
static auto addr3 = gSignatures.GetLauncherSignature("E8 ? ? ? ? 8B 43 14 89 04 24 E8 ? ? ? ? C6 43 25 01 83 C4 1C");
|
||||||
|
static auto addr4 = gSignatures.GetLauncherSignature("89 14 24 E8 ? ? ? ? 8B 45 B4") + 0x3;
|
||||||
|
|
||||||
static BytePatch patch1(addr1, { 0x81, 0xC4, 0x6C, 0x20, 0x00, 0x00, 0x5B, 0x5E, 0x5F, 0x5D, 0xC3 });
|
// 0x8 = SDL_HIDDEN
|
||||||
static BytePatch patch2(addr2, { 0x83, 0xC4, 0x50, 0x5B, 0x5E, 0x5D, 0xC3 });
|
static BytePatch patch1(addr1, { 0x8 });
|
||||||
|
|
||||||
|
// all are the same size so use same patch for all
|
||||||
|
std::vector<unsigned char> patch_arr = { 0x90, 0x90, 0x90, 0x90, 0x90 };
|
||||||
|
|
||||||
|
static BytePatch patch2(addr2, patch_arr);
|
||||||
|
static BytePatch patch3(addr3, patch_arr);
|
||||||
|
static BytePatch patch4(addr4, patch_arr);
|
||||||
|
|
||||||
patch1.Patch();
|
patch1.Patch();
|
||||||
patch2.Patch();
|
patch2.Patch();
|
||||||
|
patch3.Patch();
|
||||||
|
patch4.Patch();
|
||||||
|
|
||||||
|
ReduceRamUsage();
|
||||||
|
// CVideoMode_Common::Init SetupStartupGraphic
|
||||||
|
static auto addr5 = e8call_direct(gSignatures.GetEngineSignature("E8 ? ? ? ? 8B 93 ? ? ? ? 85 D2 0F 84")) + 0x18;
|
||||||
|
// make materials illegal
|
||||||
|
static auto addr6 = sharedobj::materialsystem().Pointer(0x3EC08);
|
||||||
|
|
||||||
|
// Make SetupStartupGraphic instantly return
|
||||||
|
static BytePatch patch5(addr5, { 0x81, 0xC4, 0x6C, 0x20, 0x00, 0x00, 0x5B, 0x5E, 0x5F, 0x5D, 0xC3 });
|
||||||
|
// materials are gone :crab:
|
||||||
|
static BytePatch patch6(addr6, { 0x83, 0xC4, 0x50, 0x5B, 0x5E, 0x5D, 0xC3 });
|
||||||
|
|
||||||
|
patch5.Patch();
|
||||||
|
patch6.Patch();
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user