Skip to content

Commit

Permalink
fix: almost linux support
Browse files Browse the repository at this point in the history
for beginners guide. stanley parable doesn't even want to exist in the same universe as sar and idk why yet
  • Loading branch information
ThisAMJ committed Feb 1, 2025
1 parent 3a706f9 commit 7eff9d7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 3 additions & 1 deletion src/Features/Hud/Watermark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class WatermarkHud : public Hud {

auto font = "Trebuchet MS";
#ifndef _WIN32
font = "DejaVu Sans";
if (!sar.game->Is(SourceGame_BeginnersGuide)) {
font = "DejaVu Sans";
}
#endif
static Surface::HFont headerFont = scheme->FindFont(font, 72);
static Surface::HFont subTextFont = scheme->FindFont(font, 24);
Expand Down
12 changes: 7 additions & 5 deletions src/Offsets/Beginners Guide 6167.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ OFFSET_WINDOWS(m_pShadowCrouch, 3168)
OFFSET_WINDOWS(DrawColoredCircle, 158)
OFFSET_WINDOWS(DrawColoredText, 159)
OFFSET_WINDOWS(DrawTextLen, 162)
OFFSET_LINUX(FinishDrawing, 619)

// CInputSystem
OFFSET_WINDOWS(GetRawMouseAccumulators, 52)
Expand Down Expand Up @@ -46,24 +47,25 @@ OFFSET_WINDOWS(m_pCommands, 224)
OFFSET_WINDOWS(CUserCmdSize, 96)
OFFSET_WINDOWS(PerUserInput_tSize, 212)
OFFSET_WINDOWS(GetLocalClient, 138)
OFFSET_WINDOWS(VideoMode_Create, 90)
OFFSET_DEFAULT(VideoMode_Create, 90, 106)
OFFSET_WINDOWS(UncacheUnusedMaterials, 76)

// clang-format off

// Pathmatch
SIGSCAN_LINUX(PathMatch, "")
SIGSCAN_LINUX(PathMatch, "55 89 E5 57 56 53 83 EC 2C 8B 45 ? 80 3D ? ? ? ? 00")


// Renderer
SIGSCAN_WINDOWS(SND_RecordBuffer, "55 8B EC 80 3D ? ? ? ? 00 56")
SIGSCAN_DEFAULT(SND_RecordBuffer, "55 8B EC 80 3D ? ? ? ? 00 56",
"55 89 E5 57 56 53 83 EC 3C 65 A1 ? ? ? ? 89 45 ? 31 C0 80 3D ? ? ? ? 00")

// Client
SIGSCAN_WINDOWS(MatrixBuildRotationAboutAxis, "55 8B EC 51 F3 0F 10 45 ? 0F 5A C0 F2 0F 59 05 ? ? ? ? 66 0F 5A C0 F3 0F 11 45 ? F3 0F 5A C0 E8 ? ? ? ? F2 0F 5A C0 F3 0F 11 45 ? F3 0F 10 45 ? 0F 5A C0 E8 ? ? ? ? 8B 45 ? F3 0F 10 60")
SIGSCAN_DEFAULT(DrawTranslucentRenderables, "55 8B EC 81 EC 80 00 00 00 53 56 8B F1 8B 0D",
"")
"55 89 E5 57 56 53 81 EC DC 00 00 00 8B 45 ? 8B 5D")
SIGSCAN_DEFAULT(DrawOpaqueRenderables, "55 8B EC 83 EC 54 83 7D ? 00 A1",
"")
"55 89 E5 57 56 53 81 EC 8C 00 00 00 8B 45 ? 8B 5D ? 89 45 ? 8B 45 ? 89 45 ? 65 A1 ? ? ? ? 89 45 ? 31 C0 A1")
SIGSCAN_WINDOWS(DrawPortal, "")
SIGSCAN_WINDOWS(DrawPortalSpBranch, "")
OFFSET_WINDOWS(DrawPortalSpBranchOff, -1)
Expand Down
7 changes: 3 additions & 4 deletions src/Offsets/Portal 2 9568.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,12 @@ OFFSET_DEFAULT(portalsThruPortals, 391, 388)
// clang-format off

// Pathmatch
SIGSCAN_DEFAULT(PathMatch, "", "55 57 56 53 83 EC 0C 8B 6C 24 28 8B 5C 24 2C 0F B6 05 ? ? ? ? 84 C0 0F 84 ? ? ? ?")
SIGSCAN_DEFAULT(PathMatch, "", "55 57 56 53 83 EC 0C 8B 6C 24 28 8B 5C 24 2C 0F B6 05 ? ? ? ? 84 C0 0F 84 ? ? ? ?") // "DBG_PATHMATCH"


// Renderer
SIGSCAN_DEFAULT(SND_RecordBuffer, "55 8B EC 80 3D ? ? ? ? 00 53 56 57 0F 84 15 01 00 00 E8 ? ? ? ? 84 C0 0F 85 08 01 00 00 A1 ? ? ? ? 3B 05",
"80 3D ? ? ? ? 00 75 07 C3 ? ? ? ? ? ? 55 89 E5 57 56 53 83 EC 1C E8 ? ? ? ? 84 C0 0F 85 ? ? ? ?") // "DS_STEREO" -> CAudioDirectSound::TransferSamples -> S_TransferStereo16 -> SND_RecordBuffer

"80 3D ? ? ? ? 00 75 07 C3 ? ? ? ? ? ? 55 89 E5 57 56 53 83 EC 1C E8 ? ? ? ? 84 C0 0F 85 ? ? ? ?") // "WaveFixupTmpFile( '%s' ) failed to open file for editing\n" -> WaveFixupTmpFile -> ".WAV" xref[1] -> WaveAppendTmpFile -> usage -> SND_RecordBuffer

// Client
SIGSCAN_DEFAULT(MatrixBuildRotationAboutAxis, "55 8B EC 51 F3 0F 10 45 ? 0F 5A C0 F2 0F 59 05 ? ? ? ? 66 0F 5A C0 F3 0F 11 45 ? E8 ? ? ? ? F3 0F 11 45 ? F3 0F 10 45 ? E8 ? ? ? ? 8B 45 ? F3 0F 10 08",
Expand All @@ -404,7 +403,7 @@ SIGSCAN_DEFAULT(DrawPortalGhost, "55 8B EC A1 ? ? ? ? 83 EC 24 83 78 ? ? 0F 84 1
SIGSCAN_DEFAULT(DrawPortalGhostSpBranch, "0F 84 ? ? ? ? 8B 90 ? ? ? ? FF D2 50 33 C0 38 86 ? ? ? ? 8D 4D ? 0F 95 C0",
"0F 84 ? ? ? ? 8B 03 83 EC 0C 53 FF 90 ? ? ? ? 83 C4 10 80 BB ? ? ? ? 01")
SIGSCAN_DEFAULT(DrawOpaqueRenderables, "55 8B EC 83 EC 54 83 7D 0C 00 A1 ? ? ? ? 53 56 0F 9F 45 EC 83 78 30 00 57 8B F1 0F 84 BA 03 00 00",
"55 89 E5 57 56 53 83 EC 7C A1 ? ? ? ? 8B 5D 08 89 45 90 85 C0 0F 85 34 04 00 00 A1 ? ? ? ? 8B 40 30 85 C0") // DrawTranslucentRenderables usage -> 2nd prior function call -> CRendering3dView::DrawOpaqueRenderables
"55 89 E5 57 56 53 83 EC 7C A1 ? ? ? ? 8B 5D 08 89 45 90 85 C0 0F 85 34 04 00 00 A1 ? ? ? ? 8B 40 30 85 C0") // DrawTranslucentRenderables usage -> 2nd prior function call -> CRendering3dView::DrawOpaqueRenderables OR vprof "CViewRender::DrawOpaqueRenderables"
SIGSCAN_DEFAULT(MsgPreSkipToNextLevel, "57 8B F9 E8 ? ? ? ? 8B C8 E8 ? ? ? ? 0B C2",
"53 83 EC 08 E8 ? ? ? ? 83 EC 0C 50 E8 ? ? ? ? 83 C4 10 09 C2")
SIGSCAN_DEFAULT(CalcViewModelLag, "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
10 changes: 6 additions & 4 deletions src/Utils/SDK/CViewSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ void ViewSetupWrite(ViewSetup *view, T *cview) {

static ViewSetup *viewCtx = new ViewSetup;
ViewSetup *ViewSetupCreate(CViewSetup *cview) {
#ifdef _WIN32
if (sar.game->Is(SourceGame_INFRA | SourceGame_BeginnersGuide | SourceGame_StanleyParable)) {
ViewSetupRead(reinterpret_cast<CViewSetupINFRA *>(cview), viewCtx);
} else {
} else
#endif
ViewSetupRead(cview, viewCtx);
}
return viewCtx;
}

void ViewSetupCopy(ViewSetup *view, CViewSetup *cview) {
#ifdef _WIN32
if (sar.game->Is(SourceGame_INFRA | SourceGame_BeginnersGuide | SourceGame_StanleyParable)) {
ViewSetupWrite(view, reinterpret_cast<CViewSetupINFRA *>(cview));
} else {
} else
#endif
ViewSetupWrite(view, cview);
}
}

0 comments on commit 7eff9d7

Please sign in to comment.