/* This file is part of the dynarmic project. * Copyright (c) 2018 MerryMage * This software may be used and distributed according to the terms of the GNU * General Public License version 2 or any later version. */ #pragma once #include #include "backend_x64/callback.h" #include "common/common_types.h" #include "common/mp.h" namespace Dynarmic { namespace BackendX64 { namespace impl { template struct ThunkBuilder; template struct ThunkBuilder { static R Thunk(C* this_, Args... args) { return (this_->*mfp)(std::forward(args)...); } }; } // namespace impl template ArgCallback Devirtualize(mp::class_type_t* this_) { return ArgCallback{&impl::ThunkBuilder::Thunk, reinterpret_cast(this_)}; } #define DEVIRT(this_, mfp) Dynarmic::BackendX64::Devirtualize(this_) } // namespace BackendX64 } // namespace Dynarmic