Added syscall GetSystemTick, Added User_Input

This commit is contained in:
inspuration 2014-05-29 01:27:59 -04:00
parent 6448c2f300
commit 85f31fdfc5
9 changed files with 124 additions and 1 deletions

View file

@ -64,6 +64,7 @@ enum LOG_TYPE {
HW,
TIME,
NETPLAY,
USER_INPUT,
NUMBER_OF_LOGS // Must be last
};

View file

@ -73,6 +73,7 @@ LogManager::LogManager()
m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
m_Log[LogTypes::USER_INPUT] = new LogContainer("USER_INPUT", "User Input");
m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str());
m_consoleLog = new ConsoleListener();

View file

@ -180,6 +180,7 @@
<ClCompile Include="hw\hw.cpp" />
<ClCompile Include="hw\lcd.cpp" />
<ClCompile Include="hw\ndma.cpp" />
<ClCompile Include="hw\user_input.cpp" />
<ClCompile Include="loader.cpp" />
<ClCompile Include="mem_map.cpp" />
<ClCompile Include="mem_map_funcs.cpp" />
@ -229,6 +230,7 @@
<ClInclude Include="hw\hw.h" />
<ClInclude Include="hw\lcd.h" />
<ClInclude Include="hw\ndma.h" />
<ClInclude Include="hw\user_input.h" />
<ClInclude Include="loader.h" />
<ClInclude Include="mem_map.h" />
<ClInclude Include="system.h" />

View file

@ -165,6 +165,9 @@
<ClCompile Include="arm\interpreter\armcopro.cpp">
<Filter>arm\interpreter</Filter>
</ClCompile>
<ClCompile Include="hw\user_input.cpp">
<Filter>hw</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="arm\disassembler\arm_disasm.h">
@ -295,6 +298,9 @@
<ClInclude Include="hle\kernel\mutex.h">
<Filter>hle\kernel</Filter>
</ClInclude>
<ClInclude Include="hw\user_input.h">
<Filter>hw</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />

View file

@ -743,3 +743,10 @@ template<int func(void*, void*, u32, u32, s64)> void WrapI_VVUUS64() {
int retval = func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4));
RETURN(retval);
}
//64 bit wrappers
template<u64 func()> void WrapU64_V() {
RETURN(func());
}

View file

@ -226,6 +226,10 @@ Result CreateEvent(void* _event, u32 reset_type) {
return 0;
}
u64 GetSystemTick(void) {
return Core::g_sys_core->GetTicks();
}
const HLE::FunctionDef SVC_Table[] = {
{0x00, NULL, "Unknown"},
{0x01, WrapI_VUUUUU<ControlMemory>, "ControlMemory"},
@ -267,7 +271,7 @@ const HLE::FunctionDef SVC_Table[] = {
{0x25, WrapI_VVUUS64<WaitSynchronizationN>, "WaitSynchronizationN"},
{0x26, NULL, "SignalAndWait"},
{0x27, NULL, "DuplicateHandle"},
{0x28, NULL, "GetSystemTick"},
{ 0x28, WrapU64_V<GetSystemTick>, "GetSystemTick" },
{0x29, NULL, "GetHandleInfo"},
{0x2A, NULL, "GetSystemInfo"},
{0x2B, NULL, "GetProcessInfo"},

View file

@ -8,6 +8,8 @@
#include "core/hw/hw.h"
#include "core/hw/lcd.h"
#include "core/hw/ndma.h"
#include "core/hw/user_input.h"
namespace HW {
@ -89,12 +91,14 @@ template void Write<u8>(u32 addr, const u8 data);
void Update() {
LCD::Update();
NDMA::Update();
USER_INPUT::Update();
}
/// Initialize hardware
void Init() {
LCD::Init();
NDMA::Init();
USER_INPUT::Init();
NOTICE_LOG(HW, "initialized OK");
}

View file

@ -0,0 +1,46 @@
#include "user_input.h"
namespace USER_INPUT {
template <typename T>
inline void Read(T &var, const u32 addr) {
ERROR_LOG(USER_INPUT, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);
}
template <typename T>
inline void Write(u32 addr, const T data) {
ERROR_LOG(NDMA, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr);
}
// Explicitly instantiate template functions because we aren't defining this in the header:
template void Read<u64>(u64 &var, const u32 addr);
template void Read<u32>(u32 &var, const u32 addr);
template void Read<u16>(u16 &var, const u32 addr);
template void Read<u8>(u8 &var, const u32 addr);
template void Write<u64>(u32 addr, const u64 data);
template void Write<u32>(u32 addr, const u32 data);
template void Write<u16>(u32 addr, const u16 data);
template void Write<u8>(u32 addr, const u8 data);
void setButtonReg(u32 buttonData) {
Write<u32>(PADDR_BUTTONS, buttonData);
}
/// Update hardware
void Update() {
}
/// Initialize hardware
void Init() {
NOTICE_LOG(USER_INPUT, "initialized OK");
}
/// Shutdown hardware
void Shutdown() {
NOTICE_LOG(USER_INPUT, "shutdown OK");
}
}

52
src/core/hw/user_input.h Normal file
View file

@ -0,0 +1,52 @@
#pragma once
#include "common/common_types.h"
namespace USER_INPUT {
struct Registers {
u32 buttons;
//u32 pad1; etc...
};
extern Registers g_regs;
enum {
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),
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
};
template <typename T>
inline void Read(T &var, const u32 addr);
template <typename T>
inline void Write(u32 addr, const T data);
/// Update hardware
void Update();
/// Initialize hardware
void Init();
/// Shutdown hardware
void Shutdown();
}