diff --git a/Source/Core/Core/PowerPC/MMU.cpp b/Source/Core/Core/PowerPC/MMU.cpp index e3d86eed3f..b06280151b 100644 --- a/Source/Core/Core/PowerPC/MMU.cpp +++ b/Source/Core/Core/PowerPC/MMU.cpp @@ -581,6 +581,26 @@ u64 HostRead_U64(const u32 address) return ReadFromHardware(address); } +float HostRead_F32(const u32 address) +{ + const u32 integral = HostRead_U32(address); + + float real; + std::memcpy(&real, &integral, sizeof(float)); + + return real; +} + +double HostRead_F64(const u32 address) +{ + const u64 integral = HostRead_U64(address); + + double real; + std::memcpy(&real, &integral, sizeof(double)); + + return real; +} + void HostWrite_U8(const u8 var, const u32 address) { WriteToHardware(address, var); @@ -601,6 +621,22 @@ void HostWrite_U64(const u64 var, const u32 address) WriteToHardware(address, var); } +void HostWrite_F32(const float var, const u32 address) +{ + u32 integral; + std::memcpy(&integral, &var, sizeof(u32)); + + HostWrite_U32(integral, address); +} + +void HostWrite_F64(const double var, const u32 address) +{ + u64 integral; + std::memcpy(&integral, &var, sizeof(u64)); + + HostWrite_U64(integral, address); +} + std::string HostGetString(u32 address, size_t size) { std::string s; diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index 377d931298..fc6de9a417 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -218,12 +218,16 @@ u8 HostRead_U8(u32 address); u16 HostRead_U16(u32 address); u32 HostRead_U32(u32 address); u64 HostRead_U64(u32 address); +float HostRead_F32(u32 address); +double HostRead_F64(u32 address); u32 HostRead_Instruction(u32 address); void HostWrite_U8(u8 var, u32 address); void HostWrite_U16(u16 var, u32 address); void HostWrite_U32(u32 var, u32 address); void HostWrite_U64(u64 var, u32 address); +void HostWrite_F32(float var, u32 address); +void HostWrite_F64(double var, u32 address); // Returns whether a read or write to the given address will resolve to a RAM // access given the current CPU state.