mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 12:51:42 +00:00
function: support more types for function pointers
This commit is contained in:
parent
8623f5d778
commit
e97f9b40e9
1 changed files with 11 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cpu/ppc_context.h>
|
#include <cpu/ppc_context.h>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include "xbox.h"
|
#include "xbox.h"
|
||||||
|
|
@ -159,6 +160,14 @@ struct ArgTranslator
|
||||||
{
|
{
|
||||||
SetPrecisionArgumentValue(ctx, base, idx, value);
|
SetPrecisionArgumentValue(ctx, base, idx, value);
|
||||||
}
|
}
|
||||||
|
else if constexpr (std::is_null_pointer_v<T>)
|
||||||
|
{
|
||||||
|
SetIntegerArgumentValue(ctx, base, idx, 0);
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_pointer_v<T>)
|
||||||
|
{
|
||||||
|
SetIntegerArgumentValue(ctx, base, idx, g_memory.MapVirtual(value));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetIntegerArgumentValue(ctx, base, idx, value);
|
SetIntegerArgumentValue(ctx, base, idx, value);
|
||||||
|
|
@ -168,7 +177,7 @@ struct ArgTranslator
|
||||||
template<typename T>
|
template<typename T>
|
||||||
FORCEINLINE constexpr static std::enable_if_t<std::is_pointer_v<T>, void> SetValue(PPCContext& ctx, uint8_t* base, size_t idx, T value) noexcept
|
FORCEINLINE constexpr static std::enable_if_t<std::is_pointer_v<T>, void> SetValue(PPCContext& ctx, uint8_t* base, size_t idx, T value) noexcept
|
||||||
{
|
{
|
||||||
const auto v = g_memory.MapVirtual(value);
|
const auto v = g_memory.MapVirtual((void*)value);
|
||||||
if (!v)
|
if (!v)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -317,7 +326,7 @@ FORCEINLINE T GuestToHostFunction(uint32_t addr, TArgs... argv)
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_pointer_v<T>)
|
else if constexpr (std::is_pointer_v<T>)
|
||||||
{
|
{
|
||||||
return static_cast<T>((uint64_t)g_memory.Translate(newCtx.r3.u32));
|
return reinterpret_cast<T>((uint64_t)g_memory.Translate(newCtx.r3.u32));
|
||||||
}
|
}
|
||||||
else if constexpr (is_precise_v<T>)
|
else if constexpr (is_precise_v<T>)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue