diff --git a/src/backend_x64/callback.cpp b/src/backend_x64/callback.cpp index 693326ff..4b2aee30 100644 --- a/src/backend_x64/callback.cpp +++ b/src/backend_x64/callback.cpp @@ -9,23 +9,23 @@ namespace Dynarmic::BackendX64 { -void SimpleCallback::EmitCall(BlockOfCode& code, std::function l) { +void SimpleCallback::EmitCall(BlockOfCode& code, std::function l) const { l({code.ABI_PARAM1, code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4}); code.CallFunction(fn); } -void SimpleCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function l) { +void SimpleCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function l) const { l(code.ABI_PARAM1, {code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4}); code.CallFunction(fn); } -void ArgCallback::EmitCall(BlockOfCode& code, std::function l) { +void ArgCallback::EmitCall(BlockOfCode& code, std::function l) const { l({code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4}); code.mov(code.ABI_PARAM1, arg); code.CallFunction(fn); } -void ArgCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function l) { +void ArgCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function l) const { #if defined(WIN32) && !defined(__MINGW64__) l(code.ABI_PARAM2, {code.ABI_PARAM3, code.ABI_PARAM4}); code.mov(code.ABI_PARAM1, arg); diff --git a/src/backend_x64/callback.h b/src/backend_x64/callback.h index 6ce4da4a..2d474649 100644 --- a/src/backend_x64/callback.h +++ b/src/backend_x64/callback.h @@ -23,8 +23,8 @@ class Callback { public: virtual ~Callback() = default; - virtual void EmitCall(BlockOfCode& code, std::function fn = [](RegList){}) = 0; - virtual void EmitCallWithReturnPointer(BlockOfCode& code, std::function fn) = 0; + virtual void EmitCall(BlockOfCode& code, std::function fn = [](RegList){}) const = 0; + virtual void EmitCallWithReturnPointer(BlockOfCode& code, std::function fn) const = 0; }; class SimpleCallback final : public Callback { @@ -34,8 +34,8 @@ public: ~SimpleCallback() override = default; - void EmitCall(BlockOfCode& code, std::function fn = [](RegList){}) override; - void EmitCallWithReturnPointer(BlockOfCode& code, std::function fn) override; + void EmitCall(BlockOfCode& code, std::function fn = [](RegList){}) const override; + void EmitCallWithReturnPointer(BlockOfCode& code, std::function fn) const override; private: void (*fn)(); @@ -48,8 +48,8 @@ public: ~ArgCallback() override = default; - void EmitCall(BlockOfCode& code, std::function fn = [](RegList){}) override; - void EmitCallWithReturnPointer(BlockOfCode& code, std::function fn) override; + void EmitCall(BlockOfCode& code, std::function fn = [](RegList){}) const override; + void EmitCallWithReturnPointer(BlockOfCode& code, std::function fn) const override; private: void (*fn)();