MCPcopy Create free account
hub / github.com/N64Recomp/N64Recomp / emit_return

Method emit_return

LiveRecomp/live_generator.cpp:1667–1681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1665}
1666
1667void N64Recomp::LiveGenerator::emit_return(const Context& context, size_t func_index) const {
1668 (void)context;
1669
1670 // Check if this function's return is hooked and emit the hook call if so.
1671 auto find_hook_it = inputs.return_func_hooks.find(func_index);
1672 if (find_hook_it != inputs.return_func_hooks.end()) {
1673 // Load rdram and ctx into R0 and R1.
1674 sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, Registers::rdram, 0, SLJIT_IMM, rdram_offset);
1675 sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, Registers::ctx, 0);
1676 // Load the return hook's index into R2.
1677 sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, find_hook_it->second);
1678 sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS3V(P, P, W), SLJIT_IMM, sljit_sw(inputs.run_hook));
1679 }
1680 sljit_emit_return_void(compiler);
1681}
1682
1683void N64Recomp::LiveGenerator::emit_check_fr(int fpr) const {
1684 (void)fpr;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected