@@ -36,3 +36,49 @@ static void ChangePtexVolumetricState(IConVar* var, const char* pOldValue, float
3636}
3737ConVar 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