Attempt to locate this symbol.
| 679 | |
| 680 | // Attempt to locate this symbol. |
| 681 | bool 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 )) |
no test coverage detected