mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Force inline a few simple functions that Clang is refusing to inline.
This commit is contained in:
parent
d29dd06dce
commit
64d9cfbd9b
5 changed files with 18 additions and 16 deletions
|
|
@ -1,6 +1,11 @@
|
|||
project("UnleashedRecomp")
|
||||
set(TARGET_NAME "SWA")
|
||||
|
||||
add_compile_options(
|
||||
"/fp:strict"
|
||||
"-march=sandybridge"
|
||||
"-fno-strict-aliasing")
|
||||
|
||||
add_compile_definitions(SWA_IMPL)
|
||||
add_compile_definitions(SDL_MAIN_HANDLED)
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ struct DirtyStates
|
|||
static DirtyStates g_dirtyStates(true);
|
||||
|
||||
template<typename T>
|
||||
static void SetDirtyValue(bool& dirtyState, T& dest, const T& src)
|
||||
static FORCEINLINE void SetDirtyValue(bool& dirtyState, T& dest, const T& src)
|
||||
{
|
||||
if (dest != src)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -157,13 +157,13 @@ struct arg_ordinal_t
|
|||
};
|
||||
|
||||
template<auto Func, int I = 0, typename ...TArgs>
|
||||
void _translate_args(PPCContext& ctx, uint8_t* base, std::tuple<TArgs...>&) noexcept
|
||||
FORCEINLINE void _translate_args(PPCContext& ctx, uint8_t* base, std::tuple<TArgs...>&) noexcept
|
||||
requires (I >= sizeof...(TArgs))
|
||||
{
|
||||
}
|
||||
|
||||
template <auto Func, int I = 0, typename ...TArgs>
|
||||
std::enable_if_t<(I < sizeof...(TArgs)), void> _translate_args(PPCContext& ctx, uint8_t* base, std::tuple<TArgs...>& tpl) noexcept
|
||||
FORCEINLINE std::enable_if_t<(I < sizeof...(TArgs)), void> _translate_args(PPCContext& ctx, uint8_t* base, std::tuple<TArgs...>& tpl) noexcept
|
||||
{
|
||||
using T = std::tuple_element_t<I, std::remove_reference_t<decltype(tpl)>>;
|
||||
std::get<I>(tpl) = ArgTranslator::GetValue<T>(ctx, base, arg_ordinal_t<Func, I>::value);
|
||||
|
|
@ -172,7 +172,7 @@ std::enable_if_t<(I < sizeof...(TArgs)), void> _translate_args(PPCContext& ctx,
|
|||
}
|
||||
|
||||
template<auto Func>
|
||||
PPC_FUNC(GuestFunction)
|
||||
FORCEINLINE PPC_FUNC(GuestFunction)
|
||||
{
|
||||
using ret_t = decltype(std::apply(Func, function_args(Func)));
|
||||
|
||||
|
|
|
|||
|
|
@ -21,16 +21,6 @@ void* Memory::Reserve(size_t offset, size_t size)
|
|||
return Alloc(offset, size, MEM_RESERVE);
|
||||
}
|
||||
|
||||
void* Memory::Translate(size_t offset) const noexcept
|
||||
{
|
||||
return base + offset;
|
||||
}
|
||||
|
||||
uint32_t Memory::MapVirtual(void* host) const noexcept
|
||||
{
|
||||
return static_cast<uint32_t>(static_cast<char*>(host) - base);
|
||||
}
|
||||
|
||||
SWA_API void* MmGetHostAddress(uint32_t ptr)
|
||||
{
|
||||
return g_memory.Translate(ptr);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,15 @@ public:
|
|||
void* Commit(size_t offset, size_t size);
|
||||
void* Reserve(size_t offset, size_t size);
|
||||
|
||||
void* Translate(size_t offset) const noexcept;
|
||||
uint32_t MapVirtual(void* host) const noexcept;
|
||||
void* Translate(size_t offset) const noexcept
|
||||
{
|
||||
return base + offset;
|
||||
}
|
||||
|
||||
uint32_t MapVirtual(void* host) const noexcept
|
||||
{
|
||||
return static_cast<uint32_t>(static_cast<char*>(host) - base);
|
||||
}
|
||||
};
|
||||
|
||||
SWA_API void* MmGetHostAddress(uint32_t ptr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue