Skip to content

Commit 4ba5c3e

Browse files
committed
fix: Pushed grabbing the chapter map array
1 parent 1314a4b commit 4ba5c3e

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

p2sm.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">stdafx.hpp</PrecompiledHeaderFile>
120120
</ClCompile>
121121
<ClCompile Include="src\patch-hook.cpp" />
122+
<ClCompile Include="src\signatures.cpp" />
122123
<ClCompile Include="src\stdafx.cpp">
123124
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
124125
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>

src/commands.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,49 @@ static void ChangePtexVolumetricState(IConVar* var, const char* pOldValue, float
3636
}
3737
ConVar p2sm_ptex_volumetrics("p2sm_ptex_volumetrics", "0", FCVAR_NONE, "Enable or disable volumetrics for projected textures.", ChangePtexVolumetricState);
3838

39+
struct ChapterContext_t
40+
{
41+
const char* mapName;
42+
int chapterNum;
43+
int subChapterNum;
44+
};
45+
46+
static ChapterContext_t newChapters[] =
47+
{
48+
{"testtesttest", 1, 2},
49+
{nullptr, 0, 0 }
50+
};
51+
CON_COMMAND(p2sm_spmaplist, "")
52+
{
53+
// BF F0 2D 94 10 84 DB
54+
// GetNumChapters: 55 8B EC 80 7D ?? ?? 57 74
55+
56+
//uintptr_t GetNumChapters = *static_cast<uintptr_t*>(Memory::Scanner::Scan<void*>(CLIENT, "55 8B EC 80 7D 08 00 57 74 0C", 0));//16));
57+
ChapterContext_t** chapterArrayPtr = Memory::Scan<ChapterContext_t**>(MODULE_CLIENT, "55 8B EC 80 7D 08 00 57 74 0C", 16);
58+
const ChapterContext_t* chapterArray = *chapterArrayPtr;
59+
// chapterArray = *reinterpret_cast<ChapterContext_t*>(tempChapterArray + 16);
60+
//chapterArray = reinterpret_cast<ChapterContext_t*>(GetNumChapters + 16);
61+
//chapterArray = static_cast<ChapterContext_t*>(Memory::Scanner::Scan<void*>(CLIENT, "B8 F0 A8 93 10 8D 64 24", 0));
62+
63+
64+
if (!chapterArrayPtr)
65+
{
66+
Log(WARNING, false, "Failed to get chapterArray!");
67+
return;
68+
}
69+
70+
for (int i = 0; chapterArray[i].mapName != nullptr; i++)
71+
{
72+
Log(INFO, false, "Map: %s, Chapter: %d, Subchapter: %d\n",
73+
chapterArray[i].mapName,
74+
chapterArray[i].chapterNum,
75+
chapterArray[i].subChapterNum);
76+
}
77+
78+
// Change it
79+
Memory::UnProtect(static_cast<void*>(chapterArrayPtr), sizeof(uintptr_t));
80+
81+
*chapterArrayPtr = newChapters;
82+
83+
84+
}

0 commit comments

Comments
 (0)