Merge pull request #944 from tambry/master

Implement cellPadPeriphGetInfo
This commit is contained in:
Raul Tambre 2015-01-01 15:32:15 +02:00
commit 406eff5ef0
4 changed files with 54 additions and 8 deletions

View File

@ -385,8 +385,7 @@ int cellFontGetEffectSlant(vm::ptr<CellFont> font, vm::ptr<be_t<float>> slantPar
int cellFontGetFontIdCode(vm::ptr<CellFont> font, u32 code, vm::ptr<u32> fontId, vm::ptr<u32> fontCode)
{
cellFont->Todo("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x",
font.addr(), code, fontId.addr(), fontCode.addr());
cellFont->Todo("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x)", font.addr(), code, fontId.addr(), fontCode.addr());
// TODO: ?
return CELL_FONT_OK;
@ -406,8 +405,7 @@ int cellFontCloseFont(vm::ptr<CellFont> font)
int cellFontGetCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontGlyphMetrics> metrics)
{
cellFont->Log("cellFontGetCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x",
font.addr(), code, metrics.addr());
cellFont->Log("cellFontGetCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x)", font.addr(), code, metrics.addr());
int x0, y0, x1, y1;
int advanceWidth, leftSideBearing;

View File

@ -92,7 +92,7 @@ vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 lo
}
if (location == CELL_GCM_LOCATION_MAIN) {
if (index >= 1024*1024) {
if (index >= 1024 * 1024) {
cellGcmSys->Error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index);
return vm::ptr<CellGcmReportData>::make(0);
}

View File

@ -54,16 +54,39 @@ int cellPadClearBuf(u32 port_no)
return CELL_OK;
}
int cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info)
{
sys_io->Warning("cellPadPeriphGetInfo(info_addr=0x%x)", info.addr());
// TODO: Support other types of controllers
for (int i = 0; i < info->now_connect; i++)
{
info->pclass_type[i] = CELL_PAD_PCLASS_TYPE_STANDARD;
}
return CELL_OK;
}
int cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
{
sys_io->Log("cellPadGetData(port_no=%d, data_addr=0x%x)", port_no, data.addr());
std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
if (!Emu.GetPadManager().IsInited()) {
return CELL_PAD_ERROR_UNINITIALIZED;
}
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
if(port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER;
if (port_no >= rinfo.max_connect) {
return CELL_PAD_ERROR_INVALID_PARAMETER;
}
//We have a choice here of NO_DEVICE or READ_FAILED...lets try no device for now
if(port_no >= rinfo.now_connect) return CELL_PAD_ERROR_NO_DEVICE;
if (port_no >= rinfo.now_connect) {
return CELL_PAD_ERROR_NO_DEVICE;
}
Pad& pad = pads[port_no];
@ -409,6 +432,7 @@ void cellPad_init()
sys_io->AddFunc(0xf65544ee, cellPadSetActDirect);
sys_io->AddFunc(0x3aaad464, cellPadGetInfo);
sys_io->AddFunc(0xa703a51d, cellPadGetInfo2);
sys_io->AddFunc(0x4cc9b68d, cellPadPeriphGetInfo);
sys_io->AddFunc(0x578e3c98, cellPadSetPortSetting);
sys_io->AddFunc(0x0e2dfaad, cellPadInfoPressMode);
sys_io->AddFunc(0x78200559, cellPadInfoSensorMode);

View File

@ -14,6 +14,17 @@ enum CELL_PAD_ERROR_CODE
CELL_PAD_ERROR_EBUSY = 0x8012110a,
};
// Controller types
enum
{
CELL_PAD_PCLASS_TYPE_STANDARD = 0x00,
CELL_PAD_PCLASS_TYPE_GUITAR = 0x01,
CELL_PAD_PCLASS_TYPE_DRUM = 0x02,
CELL_PAD_PCLASS_TYPE_DJ = 0x03,
CELL_PAD_PCLASS_TYPE_DANCEMAT = 0x04,
CELL_PAD_PCLASS_TYPE_NAVIGATION = 0x05,
};
struct CellPadData
{
be_t<s32> len;
@ -41,6 +52,19 @@ struct CellPadInfo2
be_t<u32> device_type[CELL_PAD_MAX_PORT_NUM];
};
struct CellPadPeriphInfo
{
be_t<u32> max_connect;
be_t<u32> now_connect;
be_t<u32> system_info;
be_t<u32> port_status[CELL_PAD_MAX_PORT_NUM];
be_t<u32> port_setting[CELL_PAD_MAX_PORT_NUM];
be_t<u32> device_capability[CELL_PAD_MAX_PORT_NUM];
be_t<u32> device_type[CELL_PAD_MAX_PORT_NUM];
be_t<u32> pclass_type[CELL_PAD_MAX_PORT_NUM];
be_t<u32> pclass_profile[CELL_PAD_MAX_PORT_NUM];
};
struct CellCapabilityInfo
{
be_t<u32> info[CELL_PAD_MAX_CAPABILITY_INFO];