diff options
author | bunnei <ericbunnie@gmail.com> | 2014-06-25 00:51:31 +0200 |
---|---|---|
committer | bunnei <ericbunnie@gmail.com> | 2014-06-25 01:30:08 +0200 |
commit | 6aebd4ac9808c189c25185af8fb245c6d282bad0 (patch) | |
tree | 12130ef1d1d8df2280e97bab5f54a63cbf4f4e9e /src/core | |
parent | ELF: Refactored LoadInto(..) to use memcpy, removed unnecessary code. (diff) | |
download | yuzu-6aebd4ac9808c189c25185af8fb245c6d282bad0.tar yuzu-6aebd4ac9808c189c25185af8fb245c6d282bad0.tar.gz yuzu-6aebd4ac9808c189c25185af8fb245c6d282bad0.tar.bz2 yuzu-6aebd4ac9808c189c25185af8fb245c6d282bad0.tar.lz yuzu-6aebd4ac9808c189c25185af8fb245c6d282bad0.tar.xz yuzu-6aebd4ac9808c189c25185af8fb245c6d282bad0.tar.zst yuzu-6aebd4ac9808c189c25185af8fb245c6d282bad0.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/mem_map.h | 2 | ||||
-rw-r--r-- | src/core/mem_map_funcs.cpp | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/core/mem_map.h b/src/core/mem_map.h index 12d497ef3..d5899e4bb 100644 --- a/src/core/mem_map.h +++ b/src/core/mem_map.h @@ -139,6 +139,8 @@ void Write8(const u32 addr, const u8 data); void Write16(const u32 addr, const u16 data); void Write32(const u32 addr, const u32 data); +void WriteBlock(const u32 addr, const u8* data, const int size); + u8* GetPointer(const u32 Address); /** diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index ab014a596..37913119e 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp @@ -293,4 +293,16 @@ void Write64(const u32 addr, const u64 data) { _Write<u64_le>(addr, data); } +void WriteBlock(const u32 addr, const u8* data, const int size) { + int offset = 0; + while (offset < (size & ~3)) + Write32(addr + offset, *(u32*)&data[offset += 4]); + + if (size & 2) + Write16(addr + offset, *(u16*)&data[offset += 2]); + + if (size & 1) + Write8(addr + offset, data[offset]); +} + } // namespace |