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);
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);
}

View File

@ -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>, "WaitSynchronizationN"},
{0x26, NULL, "SignalAndWait"},
{0x27, NULL, "DuplicateHandle"},
{ 0x28, WrapU64_V<GetSystemTick>, "GetSystemTick" },
{ 0x28, WrapU64_V<GetSystemTick>, "GetSystemTick" },
{0x29, NULL, "GetHandleInfo"},
{0x2A, NULL, "GetSystemInfo"},
{0x2B, NULL, "GetProcessInfo"},

View File

@ -3,32 +3,33 @@
namespace HID {
template <typename T>
inline void Read(T &var, const u32 addr) {
ERROR_LOG(HID, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);
}
template <typename T>
inline void Read(T &var, const u32 addr) {
ERROR_LOG(HID, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);
}
template <typename T>
inline void Write(u32 addr, const T data) {
ERROR_LOG(HID, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr);
}
template <typename T>
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");
}
}

View File

@ -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 <typename T>
inline void Read(T &var, const u32 addr);
template <typename T>
inline void Read(T &var, const u32 addr);
template <typename T>
inline void Write(u32 addr, const T data);
template <typename T>
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();
}

View File

@ -91,14 +91,14 @@ template void Write<u8>(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");
}