2013-09-14 20:20:57 +02:00
|
|
|
#include "stdafx.h"
|
2014-06-02 19:27:24 +02:00
|
|
|
#include "Emu/Memory/Memory.h"
|
|
|
|
|
#include "Emu/System.h"
|
|
|
|
|
#include "Emu/SysCalls/Modules.h"
|
2014-08-23 22:40:04 +02:00
|
|
|
|
2013-09-14 20:20:57 +02:00
|
|
|
#include "Emu/Io/Mouse.h"
|
2014-08-28 03:18:35 +02:00
|
|
|
#include "SC_Mouse.h"
|
2013-09-14 20:20:57 +02:00
|
|
|
|
2014-05-02 08:30:32 +02:00
|
|
|
extern Module *sys_io;
|
2013-09-14 20:20:57 +02:00
|
|
|
|
|
|
|
|
int cellMouseInit(u32 max_connect)
|
|
|
|
|
{
|
2014-08-06 00:19:33 +02:00
|
|
|
sys_io->Warning("cellMouseInit(max_connect=%d)", max_connect);
|
2013-09-14 20:20:57 +02:00
|
|
|
if(Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_ALREADY_INITIALIZED;
|
|
|
|
|
if(max_connect > 7) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
|
|
Emu.GetMouseManager().Init(max_connect);
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cellMouseClearBuf(u32 port_no)
|
|
|
|
|
{
|
2014-05-02 08:30:32 +02:00
|
|
|
sys_io->Log("cellMouseClearBuf(port_no=%d)", port_no);
|
2013-09-14 20:20:57 +02:00
|
|
|
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
|
2014-03-31 16:18:44 +02:00
|
|
|
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
|
2013-09-14 20:20:57 +02:00
|
|
|
|
|
|
|
|
//?
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int cellMouseEnd()
|
|
|
|
|
{
|
2014-05-02 08:30:32 +02:00
|
|
|
sys_io->Log("cellMouseEnd()");
|
2013-09-14 20:20:57 +02:00
|
|
|
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
|
|
|
|
|
Emu.GetMouseManager().Close();
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-02 03:05:13 +02:00
|
|
|
int cellMouseGetInfo(vm::ptr<CellMouseInfo> info)
|
2013-09-14 20:20:57 +02:00
|
|
|
{
|
2014-09-02 03:05:13 +02:00
|
|
|
sys_io->Log("cellMouseGetInfo(info_addr=0x%x)", info.addr());
|
2013-09-14 20:20:57 +02:00
|
|
|
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
|
|
|
|
|
|
|
|
|
|
const MouseInfo& current_info = Emu.GetMouseManager().GetInfo();
|
2014-08-28 03:18:35 +02:00
|
|
|
info->max_connect = current_info.max_connect;
|
|
|
|
|
info->now_connect = current_info.now_connect;
|
|
|
|
|
info->info = current_info.info;
|
|
|
|
|
for(u32 i=0; i<CELL_MAX_MICE; i++) info->vendor_id[i] = current_info.vendor_id[i];
|
|
|
|
|
for(u32 i=0; i<CELL_MAX_MICE; i++) info->product_id[i] = current_info.product_id[i];
|
|
|
|
|
for(u32 i=0; i<CELL_MAX_MICE; i++) info->status[i] = current_info.status[i];
|
2013-09-14 20:20:57 +02:00
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-02 03:05:13 +02:00
|
|
|
int cellMouseInfoTabletMode(u32 port_no, vm::ptr<CellMouseInfoTablet> info)
|
2013-09-14 20:20:57 +02:00
|
|
|
{
|
2014-09-02 03:05:13 +02:00
|
|
|
sys_io->Log("cellMouseInfoTabletMode(port_no=%d,info_addr=0x%x)", port_no, info.addr());
|
2013-09-14 20:20:57 +02:00
|
|
|
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
|
2014-03-31 16:18:44 +02:00
|
|
|
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
|
2013-09-14 20:20:57 +02:00
|
|
|
|
2014-08-28 03:18:35 +02:00
|
|
|
info->is_supported = 0; // Unimplemented: (0=Tablet mode is not supported)
|
|
|
|
|
info->mode = 1; // Unimplemented: (1=Mouse mode)
|
2013-09-14 20:20:57 +02:00
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-02 03:05:13 +02:00
|
|
|
int cellMouseGetData(u32 port_no, vm::ptr<CellMouseData> data)
|
2013-09-14 20:20:57 +02:00
|
|
|
{
|
2014-09-02 03:05:13 +02:00
|
|
|
sys_io->Log("cellMouseGetData(port_no=%d,data_addr=0x%x)", port_no, data.addr());
|
2013-09-14 20:20:57 +02:00
|
|
|
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
|
2014-03-31 16:18:44 +02:00
|
|
|
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE;
|
2013-09-14 20:20:57 +02:00
|
|
|
|
2014-08-28 03:18:35 +02:00
|
|
|
MouseData& current_data = Emu.GetMouseManager().GetData(port_no);
|
|
|
|
|
data->update = current_data.update;
|
|
|
|
|
data->buttons = current_data.buttons;
|
|
|
|
|
data->x_axis = current_data.x_axis;
|
|
|
|
|
data->y_axis = current_data.y_axis;
|
|
|
|
|
data->wheel = current_data.wheel;
|
|
|
|
|
data->tilt = current_data.tilt;
|
2013-09-14 20:20:57 +02:00
|
|
|
|
|
|
|
|
current_data.update = CELL_MOUSE_DATA_NON;
|
|
|
|
|
current_data.x_axis = 0;
|
|
|
|
|
current_data.y_axis = 0;
|
|
|
|
|
current_data.wheel = 0;
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-02 03:05:13 +02:00
|
|
|
int cellMouseGetDataList(u32 port_no, vm::ptr<CellMouseDataList> data)
|
2013-09-14 20:20:57 +02:00
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED_FUNC(sys_io);
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int cellMouseSetTabletMode(u32 port_no, u32 mode)
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED_FUNC(sys_io);
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-28 03:18:35 +02:00
|
|
|
int cellMouseGetTabletDataList(u32 port_no, u32 data_addr)
|
2013-09-14 20:20:57 +02:00
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED_FUNC(sys_io);
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-28 03:18:35 +02:00
|
|
|
int cellMouseGetRawData(u32 port_no, u32 data_addr)
|
2013-09-14 20:20:57 +02:00
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED_FUNC(sys_io);
|
|
|
|
|
|
2014-09-02 03:05:13 +02:00
|
|
|
/*sys_io->Log("cellMouseGetRawData(port_no=%d,data_addr=0x%x)", port_no, data.addr());
|
2013-09-14 20:20:57 +02:00
|
|
|
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
|
2014-03-31 16:18:44 +02:00
|
|
|
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE;
|
2013-09-14 20:20:57 +02:00
|
|
|
|
|
|
|
|
CellMouseRawData& current_rawdata = Emu.GetMouseManager().GetRawData(port_no);
|
|
|
|
|
data += current_rawdata.len;
|
|
|
|
|
for(s32 i=0; i<current_rawdata.len; i++)
|
|
|
|
|
{
|
|
|
|
|
data += current_rawdata.data[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current_rawdata.len = 0;*/
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|