From 6682f9173b799c32ce1f44430722630b4b5a8ef0 Mon Sep 17 00:00:00 2001 From: inspuration Date: Thu, 29 May 2014 16:42:37 -0400 Subject: [PATCH] Fixed minor suggestions by bunnei --- src/citra_qt/bootmanager.cpp | 4 +- src/core/hle/svc.cpp | 7 +-- src/core/hw/hid.cpp | 45 ++++++++-------- src/core/hw/hid.h | 102 +++++++++++++++++------------------ src/core/hw/hw.cpp | 4 +- 5 files changed, 82 insertions(+), 80 deletions(-) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index ba8a71bbf..74bd13f9e 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -206,7 +206,7 @@ void GRenderWindow::keyPressEvent(QKeyEvent* event) buttonReg |= GetKeyBinding(event); - HID::setButtonReg(buttonReg); + HID::SetButtonReg(buttonReg); return; } @@ -223,5 +223,5 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event) */ buttonReg &= 0xffffffff ^ GetKeyBinding(event); - HID::setButtonReg(buttonReg); + HID::SetButtonReg(buttonReg); } \ No newline at end of file diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 870e87e17..4cf2d96ad 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -226,8 +226,9 @@ Result CreateEvent(void* _event, u32 reset_type) { return 0; } -u64 GetSystemTick(void) { - return Core::g_sys_core->GetTicks(); +//TODO: verify with a kernel dump +u64 GetSystemTick() { + return Core::g_app_core->GetTicks(); } const HLE::FunctionDef SVC_Table[] = { @@ -271,7 +272,7 @@ const HLE::FunctionDef SVC_Table[] = { {0x25, WrapI_VVUUS64, "WaitSynchronizationN"}, {0x26, NULL, "SignalAndWait"}, {0x27, NULL, "DuplicateHandle"}, - { 0x28, WrapU64_V, "GetSystemTick" }, + { 0x28, WrapU64_V, "GetSystemTick" }, {0x29, NULL, "GetHandleInfo"}, {0x2A, NULL, "GetSystemInfo"}, {0x2B, NULL, "GetProcessInfo"}, diff --git a/src/core/hw/hid.cpp b/src/core/hw/hid.cpp index 9f4867e31..b7fefdd21 100644 --- a/src/core/hw/hid.cpp +++ b/src/core/hw/hid.cpp @@ -3,32 +3,33 @@ namespace HID { - template - inline void Read(T &var, const u32 addr) { - ERROR_LOG(HID, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr); - } +template +inline void Read(T &var, const u32 addr) { + ERROR_LOG(HID, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr); +} - template - inline void Write(u32 addr, const T data) { - ERROR_LOG(HID, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr); - } +template +inline void Write(u32 addr, const T data) { + ERROR_LOG(HID, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr); +} - void setButtonReg(u32 buttonData) { - Memory::Write32(PADDR_BUTTONS, buttonData); - } +//TODO: replace with an interface that doesnt suck (bravia) +void SetButtonReg(u32 buttonData) { + Memory::Write32(PADDR_BUTTONS, buttonData); +} - /// Update hardware - void Update() { - } +/// Update hardware +void Update() { +} - /// Initialize hardware - void Init() { - NOTICE_LOG(HID, "initialized OK"); - } +/// Initialize hardware +void Init() { + NOTICE_LOG(HID, "initialized OK"); +} - /// Shutdown hardware - void Shutdown() { - NOTICE_LOG(HID, "shutdown OK"); - } +/// Shutdown hardware +void Shutdown() { + NOTICE_LOG(HID, "shutdown OK"); +} } \ No newline at end of file diff --git a/src/core/hw/hid.h b/src/core/hw/hid.h index 524b48cca..e80178bcd 100644 --- a/src/core/hw/hid.h +++ b/src/core/hw/hid.h @@ -5,69 +5,69 @@ namespace HID { - struct Registers { - u32 buttons; - //u32 pad1; etc... - }; +struct Registers { + u32 buttons; + //u32 pad1; etc... +}; - extern Registers g_regs; +extern Registers g_regs; - enum { - PADDR_BUTTONS = 0x1000001c, //TODO: it works using the shared mem mapping with all homebrew tested, however the wiki states 0x10146000 as the paddr - }; +enum { + PADDR_BUTTONS = 0x1000001c, //TODO: it works using the shared mem mapping with all homebrew tested, however the wiki states 0x10146000 as the paddr +}; - enum { - REG_BUTTONS = 0x1EC46000 //does not work due to confusion between shared mem and hardware IO - }; +enum { + REG_BUTTONS = 0x1EC46000 //does not work due to confusion between shared mem and hardware IO +}; - const int numPadItems = 12; // figure out a better way :( +const int numPadItems = 12; // figure out a better way :( - enum PAD { - PAD_A = (1 << 0), - PAD_B = (1 << 1), - PAD_SELECT = (1 << 2), - PAD_START = (1 << 3), - PAD_RIGHT = (1 << 4), - PAD_LEFT = (1 << 5), - PAD_UP = (1 << 6), - PAD_DOWN = (1 << 7), - PAD_R = (1 << 8), - PAD_L = (1 << 9), - PAD_X = (1 << 10), - PAD_Y = (1 << 11), - }; +enum PAD { + PAD_A = (1 << 0), + PAD_B = (1 << 1), + PAD_SELECT = (1 << 2), + PAD_START = (1 << 3), + PAD_RIGHT = (1 << 4), + PAD_LEFT = (1 << 5), + PAD_UP = (1 << 6), + PAD_DOWN = (1 << 7), + PAD_R = (1 << 8), + PAD_L = (1 << 9), + PAD_X = (1 << 10), + PAD_Y = (1 << 11), +}; - char * const PAD_NAMES[] = { - "PAD_A", - "PAD_B", - "PAD_SELECT", - "PAD_START", - "PAD_RIGHT", - "PAD_LEFT", - "PAD_UP", - "PAD_DOWN", - "PAD_R", - "PAD_L", - "PAD_X", - "PAD_Y" - }; +char * const PAD_NAMES[] = { + "PAD_A", + "PAD_B", + "PAD_SELECT", + "PAD_START", + "PAD_RIGHT", + "PAD_LEFT", + "PAD_UP", + "PAD_DOWN", + "PAD_R", + "PAD_L", + "PAD_X", + "PAD_Y" +}; - template - inline void Read(T &var, const u32 addr); +template +inline void Read(T &var, const u32 addr); - template - inline void Write(u32 addr, const T data); +template +inline void Write(u32 addr, const T data); - void setButtonReg(u32 buttonData); +void SetButtonReg(u32 buttonData); - /// Update hardware - void Update(); +/// Update hardware +void Update(); - /// Initialize hardware - void Init(); +/// Initialize hardware +void Init(); - /// Shutdown hardware - void Shutdown(); +/// Shutdown hardware +void Shutdown(); } diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 6c809f755..d7705e65b 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -91,14 +91,14 @@ template void Write(u32 addr, const u8 data); void Update() { LCD::Update(); NDMA::Update(); - HID::Update(); + HID::Update(); } /// Initialize hardware void Init() { LCD::Init(); NDMA::Init(); - HID::Init(); + HID::Init(); NOTICE_LOG(HW, "initialized OK"); }