MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / Patch_LocateFunction

Function Patch_LocateFunction

Source/OSHLE/patch.cpp:681–711  ·  view source on GitHub ↗

Attempt to locate this symbol.

Source from the content-addressed store, hash-verified

679
680// Attempt to locate this symbol.
681bool Patch_LocateFunction(PatchSymbol * ps)
682{
683 OpCode op;
684 const u32 * code_base( g_pu32RamBase );
685
686 for (u32 s = 0; s < ps->Signatures[s].NumOps; s++)
687 {
688 PatchSignature * psig;
689 psig = &ps->Signatures[s];
690
691 // Sweep through OS range
692 for (u32 i = 0; i < (gRamSize>>2); i++)
693 {
694 op._u32 = code_base[i];
695 op = GetCorrectOp( op );
696
697 // First op must match!
698 if ( psig->FirstOp != op.op )
699 continue;
700
701 // See if function i exists at this location
702 if (Patch_VerifyLocation_CheckSignature(ps, psig, i))
703 {
704 return true;
705 }
706
707 }
708 }
709
710 return false;
711}
712
713
714#define JumpTarget(op, addr) (((addr) & 0xF0000000) | ( op.target << 2 ))

Callers 1

Patch_RecurseAndFindFunction · 0.85

Calls 2

GetCorrectOpFunction · 0.85

Tested by

no test coverage detected