mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 17:00:19 +02:00
Library Forwarding: Use the fixed-size guest type for passthrough parameters
This commit is contained in:
1 parent
033b1ce449
commit
b275c96889
1 file changed
+5
-6
@@ -536,8 +536,8 @@ struct CallbackUnpack<Result(Args...)> {
|
||||
}
|
||||
};
|
||||
|
||||
template<bool Cond, typename T>
|
||||
using as_guest_layout_if = std::conditional_t<Cond, guest_layout<T>, T>;
|
||||
template<bool Cond, typename T, typename GuestT>
|
||||
using as_guest_layout_if = std::conditional_t<Cond, guest_layout<GuestT>, T>;
|
||||
|
||||
template<typename, typename...>
|
||||
struct GuestWrapperForHostFunction;
|
||||
@@ -552,7 +552,7 @@ struct GuestWrapperForHostFunction<Result(Args...), GuestArgs...> {
|
||||
static_assert(sizeof...(GuestArgs) == sizeof...(Args));
|
||||
|
||||
auto args =
|
||||
reinterpret_cast<PackedArguments<as_guest_layout_if<!std::is_void_v<Result>, Result>, guest_layout<GuestArgs>..., uintptr_t>*>(argsv);
|
||||
reinterpret_cast<PackedArguments<as_guest_layout_if<!std::is_void_v<Result>, Result, Result>, guest_layout<GuestArgs>..., uintptr_t>*>(argsv);
|
||||
constexpr auto CBIndex = sizeof...(GuestArgs);
|
||||
uintptr_t cb;
|
||||
static_assert(CBIndex <= 18 || CBIndex == 23);
|
||||
@@ -600,9 +600,8 @@ struct GuestWrapperForHostFunction<Result(Args...), GuestArgs...> {
|
||||
|
||||
// This is almost the same type as "Result func(Args..., uintptr_t)", but
|
||||
// individual types annotated as passthrough are wrapped in guest_layout<>
|
||||
auto callback =
|
||||
reinterpret_cast<as_guest_layout_if<RetAnnotations.is_passthrough, Result> (*)(as_guest_layout_if<Annotations.is_passthrough, Args>..., uintptr_t)>(
|
||||
cb);
|
||||
auto callback = reinterpret_cast<as_guest_layout_if<RetAnnotations.is_passthrough, Result, Result> (*)(
|
||||
as_guest_layout_if<Annotations.is_passthrough, Args, GuestArgs>..., uintptr_t)>(cb);
|
||||
|
||||
auto f = [&callback](guest_layout<GuestArgs>... args, uintptr_t target) {
|
||||
// Fold over each of Annotations, Args, and args. This will match up the elements in triplets.
|
||||
|
||||
Reference in new issue
Block a user