Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sar_workshop_skip #206

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Modules/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,21 @@ DETOUR_T(void, Client::AddShadowToReceiver, unsigned short handle, void *pRender
}
Hook g_AddShadowToReceiverHook(&Client::AddShadowToReceiver_Hook);

static void (*MsgPreSkipToNextLevel)();

CON_COMMAND(sar_workshop_skip, "sar_workshop_skip - Skips to the next level in workshop\n") {
if (!sv_cheats.GetBool()) {
return console->Print("This command requires sv_cheats\n");
}
if (strncmp("workshop/", engine->GetCurrentMapName().c_str(), 9)) {
return console->Print("This command only works in workshop maps.\n");
}
// open the console so that it works on binds lmao (the menu has to be visible probably)
// debug with -vguimessages launch option
engine->ExecuteCommand("showconsole");
MsgPreSkipToNextLevel();
}

bool Client::Init() {
bool readJmp = false;

Expand Down Expand Up @@ -645,6 +660,12 @@ bool Client::Init() {
g_DrawTranslucentRenderablesHook.SetFunc(Client::DrawTranslucentRenderables);
g_DrawOpaqueRenderablesHook.SetFunc(Client::DrawOpaqueRenderables);

#ifdef _WIN32
MsgPreSkipToNextLevel = (decltype(MsgPreSkipToNextLevel))Memory::Scan(client->Name(), "57 8B F9 E8 ? ? ? ? 8B C8 E8 ? ? ? ? 0B C2");
#else
MsgPreSkipToNextLevel = (decltype(MsgPreSkipToNextLevel))Memory::Scan(client->Name(), "53 83 EC 08 E8 ? ? ? ? 83 EC 0C 50 E8 ? ? ? ? 83 C4 10 09 C2");
#endif

if (sar.game->Is(SourceGame_Portal2)) {
#ifdef _WIN32
Client::CalcViewModelLag = (decltype(Client::CalcViewModelLag))Memory::Scan(client->Name(), "53 8B DC 83 EC 08 83 E4 F0 83 C4 04 55 8B 6B 04 89 6C 24 04 8B EC 83 EC 1C 56 6A 00 6A 00 8D 45 F4 8B F1 8B 4B 0C 50 51 E8 ? ? ? ?");
Expand Down
Loading