Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
hzqst committed Oct 8, 2024
1 parent d99bc29 commit cfebec7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 11 deletions.
59 changes: 49 additions & 10 deletions fallguys/meta_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,24 +431,63 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME /* now */,

if (1)
{
auto sv_addr = (char*)LOCATE_FROM_SIGNATURE(engine, sv_Signature);
if (!sv_addr)
auto sv_models_addr = (char*)LOCATE_FROM_SIGNATURE(engine, sv_model_Signature);
if (!sv_models_addr)
{
LOG_ERROR(PLID, "sv not found in engine dll!");
LOG_ERROR(PLID, "sv_models_addr not found in engine dll!");
return FALSE;
}
CDisasmFindGotPltTargetContext ctx = { 0 };
ctx.imageBase = engineBase;
ctx.imageEnd = engineEnd;
ctx.gotplt = got_plt;
if (!sv)
{
CDisasmFindGotPltTargetContext ctx = { 0 };
ctx.imageBase = engineBase;
ctx.imageEnd = engineEnd;
ctx.gotplt = got_plt;

gpMetaUtilFuncs->pfnDisasmSingleInstruction(sv_addr, DisasmSingleCallback_FindGotPltTarget, &ctx);
gpMetaUtilFuncs->pfnDisasmSingleInstruction(sv_models_addr - 5, DisasmSingleCallback_FindGotPltTarget, &ctx);

if (ctx.result)
if (ctx.result)
{
sv = (decltype(sv))ctx.result;
}
}
if (!sv)
{
CDisasmFindGotPltTargetContext ctx = { 0 };
ctx.imageBase = engineBase;
ctx.imageEnd = engineEnd;
ctx.gotplt = got_plt;

gpMetaUtilFuncs->pfnDisasmSingleInstruction(sv_models_addr - 6, DisasmSingleCallback_FindGotPltTarget, &ctx);

if (ctx.result)
{
sv = (decltype(sv))ctx.result;
}
}
if (!sv)
{
sv = (decltype(sv))ctx.result;
CDisasmFindGotPltTargetContext ctx = { 0 };
ctx.imageBase = engineBase;
ctx.imageEnd = engineEnd;
ctx.gotplt = got_plt;

gpMetaUtilFuncs->pfnDisasmSingleInstruction(sv_models_addr - 7, DisasmSingleCallback_FindGotPltTarget, &ctx);

if (ctx.result)
{
sv = (decltype(sv))ctx.result;
}
}

if (!sv)
{
LOG_ERROR(PLID, "sv not found in engine dll!");
return FALSE;
}

LOG_MESSAGE(PLID, "sv found at %p!", sv);

sv_models = (decltype(sv_models))((char*)sv + offset_sv_models);

if (!sv_models)
Expand Down
2 changes: 1 addition & 1 deletion fallguys/signatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

#define gotplt_prolog_Signature "\x53\x83\xEC\x18\x8B\x44\x24\x20\xE8\x2A\x2A\x2A\x2A\x81\xC3\x2A\x2A\x2A\x2A"

#define sv_Signature "\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x84\x82\x2A\x2A\x2A\x00\x89\x04\x24\xE8"
#define sv_model_Signature "\x8B\x84\x82\x2A\x2A\x2A\x00\x89\x04\x24\xE8"
#define sv_Symbol "sv"
#define offset_sv_models 0x276148

Expand Down

0 comments on commit cfebec7

Please sign in to comment.