Fixed minor suggestions by bunnei

This commit is contained in:
inspuration 2014-05-29 16:42:37 -04:00
parent 53cc3e8f67
commit 6682f9173b
5 changed files with 82 additions and 80 deletions

View file

@ -206,7 +206,7 @@ void GRenderWindow::keyPressEvent(QKeyEvent* event)
buttonReg |= GetKeyBinding(event); buttonReg |= GetKeyBinding(event);
HID::setButtonReg(buttonReg); HID::SetButtonReg(buttonReg);
return; return;
} }
@ -223,5 +223,5 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event)
*/ */
buttonReg &= 0xffffffff ^ GetKeyBinding(event); buttonReg &= 0xffffffff ^ GetKeyBinding(event);
HID::setButtonReg(buttonReg); HID::SetButtonReg(buttonReg);
} }

View file

@ -226,8 +226,9 @@ Result CreateEvent(void* _event, u32 reset_type) {
return 0; return 0;
} }
u64 GetSystemTick(void) { //TODO: verify with a kernel dump
return Core::g_sys_core->GetTicks(); u64 GetSystemTick() {
return Core::g_app_core->GetTicks();
} }
const HLE::FunctionDef SVC_Table[] = { const HLE::FunctionDef SVC_Table[] = {

View file

@ -3,32 +3,33 @@
namespace HID { namespace HID {
template <typename T> template <typename T>
inline void Read(T &var, const u32 addr) { inline void Read(T &var, const u32 addr) {
ERROR_LOG(HID, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr); ERROR_LOG(HID, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);
} }
template <typename T> template <typename T>
inline void Write(u32 addr, const T data) { inline void Write(u32 addr, const T data) {
ERROR_LOG(HID, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr); ERROR_LOG(HID, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr);
} }
void setButtonReg(u32 buttonData) { //TODO: replace with an interface that doesnt suck (bravia)
void SetButtonReg(u32 buttonData) {
Memory::Write32(PADDR_BUTTONS, buttonData); Memory::Write32(PADDR_BUTTONS, buttonData);
} }
/// Update hardware /// Update hardware
void Update() { void Update() {
} }
/// Initialize hardware /// Initialize hardware
void Init() { void Init() {
NOTICE_LOG(HID, "initialized OK"); NOTICE_LOG(HID, "initialized OK");
} }
/// Shutdown hardware /// Shutdown hardware
void Shutdown() { void Shutdown() {
NOTICE_LOG(HID, "shutdown OK"); NOTICE_LOG(HID, "shutdown OK");
} }
} }

View file

@ -5,25 +5,25 @@
namespace HID { namespace HID {
struct Registers { struct Registers {
u32 buttons; u32 buttons;
//u32 pad1; etc... //u32 pad1; etc...
}; };
extern Registers g_regs; extern Registers g_regs;
enum { enum {
PADDR_BUTTONS = 0x1000001c, //TODO: it works using the shared mem mapping with all homebrew tested, however the wiki states 0x10146000 as the paddr PADDR_BUTTONS = 0x1000001c, //TODO: it works using the shared mem mapping with all homebrew tested, however the wiki states 0x10146000 as the paddr
}; };
enum { enum {
REG_BUTTONS = 0x1EC46000 //does not work due to confusion between shared mem and hardware IO 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 { enum PAD {
PAD_A = (1 << 0), PAD_A = (1 << 0),
PAD_B = (1 << 1), PAD_B = (1 << 1),
PAD_SELECT = (1 << 2), PAD_SELECT = (1 << 2),
@ -36,9 +36,9 @@ namespace HID {
PAD_L = (1 << 9), PAD_L = (1 << 9),
PAD_X = (1 << 10), PAD_X = (1 << 10),
PAD_Y = (1 << 11), PAD_Y = (1 << 11),
}; };
char * const PAD_NAMES[] = { char * const PAD_NAMES[] = {
"PAD_A", "PAD_A",
"PAD_B", "PAD_B",
"PAD_SELECT", "PAD_SELECT",
@ -51,23 +51,23 @@ namespace HID {
"PAD_L", "PAD_L",
"PAD_X", "PAD_X",
"PAD_Y" "PAD_Y"
}; };
template <typename T> template <typename T>
inline void Read(T &var, const u32 addr); inline void Read(T &var, const u32 addr);
template <typename T> template <typename T>
inline void Write(u32 addr, const T data); inline void Write(u32 addr, const T data);
void setButtonReg(u32 buttonData); void SetButtonReg(u32 buttonData);
/// Update hardware /// Update hardware
void Update(); void Update();
/// Initialize hardware /// Initialize hardware
void Init(); void Init();
/// Shutdown hardware /// Shutdown hardware
void Shutdown(); void Shutdown();
} }