sceCtrl stub

This commit is contained in:
Nekotekina 2015-01-27 04:39:43 +03:00
parent 3141cc9bc7
commit 912e3fc213
5 changed files with 94 additions and 3 deletions

View file

@ -0,0 +1,85 @@
#include "stdafx.h"
#include "Emu/System.h"
#include "Emu/ARMv7/PSVFuncList.h"
extern psv_log_base sceCtrl;
struct SceCtrlData
{
u64 timeStamp;
u32 buttons;
u8 lx;
u8 ly;
u8 rx;
u8 ry;
u8 rsrv[16];
};
struct SceCtrlRapidFireRule
{
u32 uiMask;
u32 uiTrigger;
u32 uiTarget;
u32 uiDelay;
u32 uiMake;
u32 uiBreak;
};
s32 sceCtrlSetSamplingMode(u32 uiMode)
{
throw __FUNCTION__;
}
s32 sceCtrlGetSamplingMode(vm::psv::ptr<u32> puiMode)
{
throw __FUNCTION__;
}
s32 sceCtrlPeekBufferPositive(s32 port, vm::psv::ptr<SceCtrlData>pData, s32 nBufs)
{
throw __FUNCTION__;
}
s32 sceCtrlPeekBufferNegative(s32 port, vm::psv::ptr<SceCtrlData>pData, s32 nBufs)
{
throw __FUNCTION__;
}
s32 sceCtrlReadBufferPositive(s32 port, vm::psv::ptr<SceCtrlData>pData, s32 nBufs)
{
throw __FUNCTION__;
}
s32 sceCtrlReadBufferNegative(s32 port, vm::psv::ptr<SceCtrlData>pData, s32 nBufs)
{
throw __FUNCTION__;
}
s32 sceCtrlSetRapidFire(s32 port, s32 idx, vm::psv::ptr<const SceCtrlRapidFireRule> pRule)
{
throw __FUNCTION__;
}
s32 sceCtrlClearRapidFire(s32 port, s32 idx)
{
throw __FUNCTION__;
}
#define REG_FUNC(nid, name) reg_psv_func(nid, &sceCtrl, #name, name)
psv_log_base sceCtrl("SceCtrl", []()
{
sceCtrl.on_load = nullptr;
sceCtrl.on_unload = nullptr;
sceCtrl.on_stop = nullptr;
REG_FUNC(0xA497B150, sceCtrlSetSamplingMode);
REG_FUNC(0xEC752AAF, sceCtrlGetSamplingMode);
REG_FUNC(0xA9C3CED6, sceCtrlPeekBufferPositive);
REG_FUNC(0x104ED1A7, sceCtrlPeekBufferNegative);
REG_FUNC(0x67E7AB83, sceCtrlReadBufferPositive);
REG_FUNC(0x15F96FB0, sceCtrlReadBufferNegative);
REG_FUNC(0xE9CB69C8, sceCtrlSetRapidFire);
REG_FUNC(0xD8294C9C, sceCtrlClearRapidFire);
});

View file

@ -50,6 +50,7 @@ extern psv_log_base sceLibstdcxx;
extern psv_log_base sceLibKernel;
extern psv_log_base sceSysmodule;
extern psv_log_base scePerf;
extern psv_log_base sceCtrl;
void initialize_psv_modules()
{
@ -62,6 +63,7 @@ void initialize_psv_modules()
g_psv_modules.push_back(&sceLibKernel);
g_psv_modules.push_back(&sceSysmodule);
g_psv_modules.push_back(&scePerf);
g_psv_modules.push_back(&sceCtrl);
// setup special functions (without NIDs)
psv_func unimplemented;

View file

@ -215,7 +215,7 @@ namespace loader
const u32 addr = *++code;
vm::psv::write16(addr + 0, 0xf240 | (data & 0x800) >> 1 | (data & 0xf000) >> 12); // MOVW
vm::psv::write16(addr + 2, 0x0c00 | (data & 0x700) << 4 | (data & 0xff));
LOG_NOTICE(LOADER, "sceRefs: movw written at 0x%x (data=0x%x)", addr, data);
//LOG_NOTICE(LOADER, "sceRefs: movw written at 0x%x (data=0x%x)", addr, data);
break;
}
case 0x00000030:
@ -224,13 +224,13 @@ namespace loader
const u32 addr = *++code;
vm::psv::write16(addr + 0, 0xf2c0 | (data & 0x8000000) >> 17 | (data & 0xf0000000) >> 28); // MOVT
vm::psv::write16(addr + 2, 0x0c00 | (data & 0x7000000) >> 12 | (data & 0xff0000) >> 16);
LOG_NOTICE(LOADER, "sceRefs: movt written at 0x%x (data=0x%x)", addr, data);
//LOG_NOTICE(LOADER, "sceRefs: movt written at 0x%x (data=0x%x)", addr, data);
break;
}
case 0x00000000:
{
// probably, no operation
LOG_NOTICE(LOADER, "sceRefs: zero code");
//LOG_NOTICE(LOADER, "sceRefs: zero code");
break;
}
default:

View file

@ -58,6 +58,7 @@
<ClCompile Include="Emu\ARMv7\ARMv7Thread.cpp" />
<ClCompile Include="Emu\ARMv7\Modules\psv_event_flag.cpp" />
<ClCompile Include="Emu\ARMv7\Modules\psv_sema.cpp" />
<ClCompile Include="Emu\ARMv7\Modules\sceCtrl.cpp" />
<ClCompile Include="Emu\ARMv7\Modules\sceLibKernel.cpp" />
<ClCompile Include="Emu\ARMv7\Modules\sceLibc.cpp" />
<ClCompile Include="Emu\ARMv7\Modules\sceLibm.cpp" />

View file

@ -683,6 +683,9 @@
<ClCompile Include="Emu\ARMv7\Modules\scePerf.cpp">
<Filter>Emu\CPU\ARMv7\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\ARMv7\Modules\sceCtrl.cpp">
<Filter>Emu\CPU\ARMv7\Modules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Crypto\aes.h">