diff options
| author | 2014-10-12 22:40:26 -0700 | |
|---|---|---|
| committer | 2015-03-09 15:51:41 -0700 | |
| commit | 041e99b6132775ff52822060512b8384b735e582 (patch) | |
| tree | cd8dee92a0b578e512a188cd7e70239b627a5341 /src/core/hw/lcd.cpp | |
| parent | Implement SetLcdForceBlack, move register enum to hw.h (diff) | |
| download | yuzu-041e99b6132775ff52822060512b8384b735e582.tar.gz yuzu-041e99b6132775ff52822060512b8384b735e582.tar.xz yuzu-041e99b6132775ff52822060512b8384b735e582.zip | |
Added LCD registers, and implementation for color filling in OGL code.
Diffstat (limited to 'src/core/hw/lcd.cpp')
| -rw-r--r-- | src/core/hw/lcd.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cpp new file mode 100644 index 000000000..7986f3ddb --- /dev/null +++ b/src/core/hw/lcd.cpp | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/common_types.h" | ||
| 6 | |||
| 7 | #include "core/arm/arm_interface.h" | ||
| 8 | #include "core/hle/hle.h" | ||
| 9 | #include "core/hw/hw.h" | ||
| 10 | #include "core/hw/lcd.h" | ||
| 11 | |||
| 12 | namespace LCD { | ||
| 13 | |||
| 14 | Regs g_regs; | ||
| 15 | |||
| 16 | template <typename T> | ||
| 17 | inline void Read(T &var, const u32 raw_addr) { | ||
| 18 | u32 addr = raw_addr - HW::VADDR_LCD; | ||
| 19 | u32 index = addr / 4; | ||
| 20 | |||
| 21 | // Reads other than u32 are untested, so I'd rather have them abort than silently fail | ||
| 22 | if (index >= 0x400 || !std::is_same<T, u32>::value) { | ||
| 23 | LOG_ERROR(HW_LCD, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr); | ||
| 24 | return; | ||
| 25 | } | ||
| 26 | |||
| 27 | var = g_regs[index]; | ||
| 28 | } | ||
| 29 | |||
| 30 | template <typename T> | ||
| 31 | inline void Write(u32 addr, const T data) { | ||
| 32 | addr -= HW::VADDR_LCD; | ||
| 33 | u32 index = addr / 4; | ||
| 34 | |||
| 35 | // Writes other than u32 are untested, so I'd rather have them abort than silently fail | ||
| 36 | if (index >= 0x400 || !std::is_same<T, u32>::value) { | ||
| 37 | LOG_ERROR(HW_LCD, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr); | ||
| 38 | return; | ||
| 39 | } | ||
| 40 | |||
| 41 | g_regs[index] = static_cast<u32>(data); | ||
| 42 | } | ||
| 43 | |||
| 44 | // Explicitly instantiate template functions because we aren't defining this in the header: | ||
| 45 | |||
| 46 | template void Read<u64>(u64 &var, const u32 addr); | ||
| 47 | template void Read<u32>(u32 &var, const u32 addr); | ||
| 48 | template void Read<u16>(u16 &var, const u32 addr); | ||
| 49 | template void Read<u8>(u8 &var, const u32 addr); | ||
| 50 | |||
| 51 | template void Write<u64>(u32 addr, const u64 data); | ||
| 52 | template void Write<u32>(u32 addr, const u32 data); | ||
| 53 | template void Write<u16>(u32 addr, const u16 data); | ||
| 54 | template void Write<u8>(u32 addr, const u8 data); | ||
| 55 | |||
| 56 | /// Initialize hardware | ||
| 57 | void Init() { | ||
| 58 | LOG_DEBUG(HW_LCD, "initialized OK"); | ||
| 59 | } | ||
| 60 | |||
| 61 | /// Shutdown hardware | ||
| 62 | void Shutdown() { | ||
| 63 | LOG_DEBUG(HW_LCD, "shutdown OK"); | ||
| 64 | } | ||
| 65 | |||
| 66 | } // namespace | ||