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[] = {
@ -271,7 +272,7 @@ const HLE::FunctionDef SVC_Table[] = {
{0x25, WrapI_VVUUS64<WaitSynchronizationN>, "WaitSynchronizationN"}, {0x25, WrapI_VVUUS64<WaitSynchronizationN>, "WaitSynchronizationN"},
{0x26, NULL, "SignalAndWait"}, {0x26, NULL, "SignalAndWait"},
{0x27, NULL, "DuplicateHandle"}, {0x27, NULL, "DuplicateHandle"},
{ 0x28, WrapU64_V<GetSystemTick>, "GetSystemTick" }, { 0x28, WrapU64_V<GetSystemTick>, "GetSystemTick" },
{0x29, NULL, "GetHandleInfo"}, {0x29, NULL, "GetHandleInfo"},
{0x2A, NULL, "GetSystemInfo"}, {0x2A, NULL, "GetSystemInfo"},
{0x2B, NULL, "GetProcessInfo"}, {0x2B, NULL, "GetProcessInfo"},

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)
Memory::Write32(PADDR_BUTTONS, buttonData); void SetButtonReg(u32 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,69 +5,69 @@
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),
PAD_START = (1 << 3), PAD_START = (1 << 3),
PAD_RIGHT = (1 << 4), PAD_RIGHT = (1 << 4),
PAD_LEFT = (1 << 5), PAD_LEFT = (1 << 5),
PAD_UP = (1 << 6), PAD_UP = (1 << 6),
PAD_DOWN = (1 << 7), PAD_DOWN = (1 << 7),
PAD_R = (1 << 8), PAD_R = (1 << 8),
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",
"PAD_START", "PAD_START",
"PAD_RIGHT", "PAD_RIGHT",
"PAD_LEFT", "PAD_LEFT",
"PAD_UP", "PAD_UP",
"PAD_DOWN", "PAD_DOWN",
"PAD_R", "PAD_R",
"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();
} }

View file

@ -91,14 +91,14 @@ template void Write<u8>(u32 addr, const u8 data);
void Update() { void Update() {
LCD::Update(); LCD::Update();
NDMA::Update(); NDMA::Update();
HID::Update(); HID::Update();
} }
/// Initialize hardware /// Initialize hardware
void Init() { void Init() {
LCD::Init(); LCD::Init();
NDMA::Init(); NDMA::Init();
HID::Init(); HID::Init();
NOTICE_LOG(HW, "initialized OK"); NOTICE_LOG(HW, "initialized OK");
} }