Merge pull request #893 from nullworks/lightcat

Fix signature
This commit is contained in:
LightCat 2020-01-04 21:28:08 +01:00 committed by GitHub
commit 17efa24e1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 58 additions and 15 deletions

View File

@ -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);
}; };

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -247,6 +247,7 @@ static void ReduceRamUsage()
* cannot play on error.mdl * cannot play on error.mdl
*/ */
} }
if (g_IBaseClient) if (g_IBaseClient)
{ {
static BytePatch playSequence{ gSignatures.GetClientSignature, "55 89 E5 57 56 53 83 EC ? 8B 75 0C 8B 5D 08 85 F6 74 ? 83 BB", 0x00, { 0xC3 } }; static BytePatch playSequence{ gSignatures.GetClientSignature, "55 89 E5 57 56 53 83 EC ? 8B 75 0C 8B 5D 08 85 F6 74 ? 83 BB", 0x00, { 0xC3 } };
@ -270,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
@ -296,8 +324,10 @@ static InitRoutine nullifiy_textmode2([]() {
UnHookFs(); UnHookFs();
}); });
#if ENABLE_TEXTMODE #if ENABLE_TEXTMODE
auto addr = gSignatures.GetEngineSignature("E8 ? ? ? ? C7 04 24 ? ? ? ? E8 ? ? ? ? C7 04 24 ? ? ? ? E8 ? ? ? ? E8 ? ? ? ?"); // Catbots still hit properly, this just makes it easier to Stub stuff not needed in textmode
addr = e8call_direct(addr); bool *g_bTextMode_ptr = *((bool **) (gSignatures.GetEngineSignature("A2 ? ? ? ? 8B 43 04") + 0x1));
*g_bTextMode_ptr = true;
/*auto addr = gSignatures.GetEngineSignature("55 89 E5 57 56 53 81 EC ? ? ? ? C7 45 ? ? ? ? ? A1 ? ? ? ? C7 45 ? ? ? ? ? 8B 75 08 85 C0 0F 84 ? ? ? ? 8D 55 88 89 04 24 31 DB 89 54 24 04");
static BytePatch patch(addr, { 0x31, 0xc0, 0xc3 }); static BytePatch patch(addr, { 0x31, 0xc0, 0xc3 });
patch.Patch(); patch.Patch();
EC::Register( EC::Register(
@ -307,11 +337,11 @@ static InitRoutine nullifiy_textmode2([]() {
return; return;
if (CE_GOOD(LOCAL_E)) if (CE_GOOD(LOCAL_E))
return; return;
static auto addr = e8call_direct(gSignatures.GetEngineSignature("E8 ? ? ? ? 8B 85 ? ? ? ? 89 C7 E9 ? ? ? ? ")); static auto addr = e8call_direct(gSignatures.GetEngineSignature("E8 ? ? ? ? 8B 85 ? ? ? ? 89 C7 E9"));
typedef void (*SendFinishedSync_t)(CBaseClientState *); typedef void (*SendFinishedSync_t)(CBaseClientState *);
static SendFinishedSync_t SendFinishedSync_fn = SendFinishedSync_t(addr); static SendFinishedSync_t SendFinishedSync_fn = SendFinishedSync_t(addr);
SendFinishedSync_fn(g_IBaseClientState); SendFinishedSync_fn(g_IBaseClientState);
}, },
"nographics_cm"); "nographics_cm");*/
#endif #endif
}); });

View File

@ -106,8 +106,7 @@ bool re::CTFPartyClient::BInQueueForStandby()
char re::CTFPartyClient::RequestLeaveForMatch(int type) char re::CTFPartyClient::RequestLeaveForMatch(int type)
{ {
typedef char (*RequestLeaveForMatch_t)(re::CTFPartyClient *, int); typedef char (*RequestLeaveForMatch_t)(re::CTFPartyClient *, int);
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 83 EC ? 8B 45 ? 89 44 24 ? 8B 45 ? 89 04 24 E8 ? ? " static uintptr_t addr = e8call_direct(gSignatures.GetClientSignature("E8 ? ? ? ? 90 8B 45 E4"));
"? ? 84 C0 89 C6 75");
static RequestLeaveForMatch_t RequestLeaveForMatch_fn = RequestLeaveForMatch_t(addr); static RequestLeaveForMatch_t RequestLeaveForMatch_fn = RequestLeaveForMatch_t(addr);
return RequestLeaveForMatch_fn(this, type); return RequestLeaveForMatch_fn(this, type);
@ -115,14 +114,13 @@ char re::CTFPartyClient::RequestLeaveForMatch(int type)
int re::CTFPartyClient::BInvitePlayerToParty(CSteamID steamid) int re::CTFPartyClient::BInvitePlayerToParty(CSteamID steamid)
{ {
typedef int (*BInvitePlayerToParty_t)(re::CTFPartyClient *, CSteamID, bool); typedef int (*BInvitePlayerToParty_t)(re::CTFPartyClient *, CSteamID, bool);
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 81 EC ? ? ? ? 8B 45 ? 8B 5D ? 8B 55 ? 89 85 ? ? ? ? " static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 81 EC ? ? ? ? 8B 45 ? 8B 5D ? 8B 55 ? 89 85"
"65 A1 ? ? ? ? 89 45 ? 31 C0 8B 45"); "65 A1 ? ? ? ? 89 45 ? 31 C0 8B 45");
static BInvitePlayerToParty_t BInvitePlayerToParty_fn = BInvitePlayerToParty_t(addr); static BInvitePlayerToParty_t BInvitePlayerToParty_fn = BInvitePlayerToParty_t(addr);
return BInvitePlayerToParty_fn(this, steamid, false); return BInvitePlayerToParty_fn(this, steamid, false);
} }
int re::CTFPartyClient::BRequestJoinPlayer(CSteamID steamid) int re::CTFPartyClient::BRequestJoinPlayer(CSteamID steamid)
{ {
// 55 89 E5 57 56 53 81 EC 8C 00 00 00 8B 45 14 8B 55 10 89 45 A4 8B 45 0C
typedef int (*BRequestJoinPlayer_t)(re::CTFPartyClient *, CSteamID, bool); typedef int (*BRequestJoinPlayer_t)(re::CTFPartyClient *, CSteamID, bool);
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 81 EC ? ? ? ? 8B 45 14 8B 55 ? 89 45 ? 8B"); static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 81 EC ? ? ? ? 8B 45 14 8B 55 ? 89 45 ? 8B");
static BRequestJoinPlayer_t BRequestJoinPlayer_fn = BRequestJoinPlayer_t(addr); static BRequestJoinPlayer_t BRequestJoinPlayer_fn = BRequestJoinPlayer_t(addr);

View File

@ -12,7 +12,7 @@ C_MannVsMachineStats *C_MannVsMachineStats::G_MannVsMachineStats()
{ {
typedef C_MannVsMachineStats *(*G_MannVsMachineStats_t)(); typedef C_MannVsMachineStats *(*G_MannVsMachineStats_t)();
static uintptr_t addr = gSignatures.GetClientSignature("55 A1 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 55 89 E5 53 83 EC ? 8B 5D " static uintptr_t addr = gSignatures.GetClientSignature("55 A1 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 55 89 E5 53 83 EC ? 8B 5D "
"? C7 83 ? ? ? ? ? ? ? ?"); "? C7 83");
static G_MannVsMachineStats_t G_MannVsMachineStats_fn = G_MannVsMachineStats_t(addr); static G_MannVsMachineStats_t G_MannVsMachineStats_fn = G_MannVsMachineStats_t(addr);
return G_MannVsMachineStats_fn(); return G_MannVsMachineStats_fn();
@ -22,7 +22,7 @@ int *C_MannVsMachineStats::AddLocalPlayerUpgrade(int id, int &a3)
typedef int *(*AddLocalPlayerUpgrade_t)(C_MannVsMachineStats *, int, int); typedef int *(*AddLocalPlayerUpgrade_t)(C_MannVsMachineStats *, int, int);
static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 83 EC ? 8B 5D ? 8B 75 ? 8B 7D ? 8B 43 ? 8B 53 ? 83 " static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 83 EC ? 8B 5D ? 8B 75 ? 8B 7D ? 8B 43 ? 8B 53 ? 83 "
"C0 ? 39 D0 7E ? 29 D0 89 1C 24 89 44 24 ? E8 ? ? ? ? 8B 43 ? 83 C0 ? " "C0 ? 39 D0 7E ? 29 D0 89 1C 24 89 44 24 ? E8 ? ? ? ? 8B 43 ? 83 C0 ? "
"8B 13 89 43 ? 29 F0 83 E8 ? 89 F1 C1 E1 ?"); "8B 13 89 43 ? 29 F0 83 E8 ? 89 F1 C1 E1");
static AddLocalPlayerUpgrade_t AddLocalPlayerUpgrade_fn = AddLocalPlayerUpgrade_t(addr); static AddLocalPlayerUpgrade_t AddLocalPlayerUpgrade_fn = AddLocalPlayerUpgrade_t(addr);
return AddLocalPlayerUpgrade_fn(this, id, a3); return AddLocalPlayerUpgrade_fn(this, id, a3);