Some Modules updated to use mem*_t class

cellKb, cellMouse and cellSysutil now use the mem*_t instances instead
of using "u32 *_addr" variables.
This commit is contained in:
Alexandro Sánchez Bach 2013-09-28 16:30:04 +02:00
parent afb9273823
commit 9bb2d082e6
4 changed files with 43 additions and 51 deletions

View File

@ -107,11 +107,11 @@ void cellVideoOutGetDeviceInfo()
UNIMPLEMENTED_FUNC(cellSysutil); UNIMPLEMENTED_FUNC(cellSysutil);
} }
int cellSysutilGetSystemParamInt(int id, u32 value_addr) int cellSysutilGetSystemParamInt(int id, mem32_t value)
{ {
cellSysutil.Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value_addr); cellSysutil.Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.GetAddr());
if(!Memory.IsGoodAddr(value_addr)) if(!Memory.IsGoodAddr(value.IsGood()))
{ {
return CELL_EFAULT; return CELL_EFAULT;
} }
@ -120,77 +120,77 @@ int cellSysutilGetSystemParamInt(int id, u32 value_addr)
{ {
case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG: case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_LANG"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_LANG");
Memory.Write32(value_addr, CELL_SYSUTIL_LANG_ENGLISH_US); value = CELL_SYSUTIL_LANG_ENGLISH_US;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN: case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN");
Memory.Write32(value_addr, CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS); value = CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT: case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT");
Memory.Write32(value_addr, CELL_SYSUTIL_DATE_FMT_DDMMYYYY); value = CELL_SYSUTIL_DATE_FMT_DDMMYYYY;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT: case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT");
Memory.Write32(value_addr, CELL_SYSUTIL_TIME_FMT_CLOCK24); value = CELL_SYSUTIL_TIME_FMT_CLOCK24;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE: case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE");
Memory.Write32(value_addr, 3); value = 3;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME: case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME");
Memory.Write32(value_addr, 1); value = 1;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL: case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL");
Memory.Write32(value_addr, CELL_SYSUTIL_GAME_PARENTAL_OFF); value = CELL_SYSUTIL_GAME_PARENTAL_OFF;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT: case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT");
Memory.Write32(value_addr, CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF); value = CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT: case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT");
Memory.Write32(value_addr, 0); value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ: case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ");
Memory.Write32(value_addr, CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED); value = CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE: case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE");
Memory.Write32(value_addr, CELL_SYSUTIL_PAD_RUMBLE_OFF); value = CELL_SYSUTIL_PAD_RUMBLE_OFF;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE: case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE");
Memory.Write32(value_addr, 0); value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD: case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD");
Memory.Write32(value_addr, 0); value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD: case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD");
Memory.Write32(value_addr, 0); value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF: case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF"); cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF");
Memory.Write32(value_addr, 0); value = 0;
break; break;
default: default:

View File

@ -224,24 +224,24 @@ extern int cellKbInit(u32 max_connect);
extern int cellKbEnd(); extern int cellKbEnd();
extern int cellKbClearBuf(u32 port_no); extern int cellKbClearBuf(u32 port_no);
extern u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode); extern u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode);
extern int cellKbGetInfo(u32 info_addr); extern int cellKbGetInfo(mem_class_t info);
extern int cellKbRead(u32 port_no, u32 data_addr); extern int cellKbRead(u32 port_no, mem_class_t data);
extern int cellKbSetCodeType(u32 port_no, u32 type); extern int cellKbSetCodeType(u32 port_no, u32 type);
extern int cellKbSetLEDStatus(u32 port_no, u8 led); extern int cellKbSetLEDStatus(u32 port_no, u8 led);
extern int cellKbSetReadMode(u32 port_no, u32 rmode); extern int cellKbSetReadMode(u32 port_no, u32 rmode);
extern int cellKbGetConfiguration(u32 port_no, u32 config_addr); extern int cellKbGetConfiguration(u32 port_no, mem_class_t config);
//cellMouse //cellMouse
extern int cellMouseInit(u32 max_connect); extern int cellMouseInit(u32 max_connect);
extern int cellMouseClearBuf(u32 port_no); extern int cellMouseClearBuf(u32 port_no);
extern int cellMouseEnd(); extern int cellMouseEnd();
extern int cellMouseGetInfo(u32 info_addr); extern int cellMouseGetInfo(mem_class_t info);
extern int cellMouseInfoTabletMode(u32 port_no, u32 info_addr); extern int cellMouseInfoTabletMode(u32 port_no, mem_class_t info);
extern int cellMouseGetData(u32 port_no, u32 data_addr); extern int cellMouseGetData(u32 port_no, mem_class_t data);
extern int cellMouseGetDataList(u32 port_no, u32 data_addr); extern int cellMouseGetDataList(u32 port_no, mem_class_t data);
extern int cellMouseSetTabletMode(u32 port_no, u32 mode); extern int cellMouseSetTabletMode(u32 port_no, u32 mode);
extern int cellMouseGetTabletDataList(u32 port_no, u32 data_addr); extern int cellMouseGetTabletDataList(u32 port_no, mem_class_t data);
extern int cellMouseGetRawData(u32 port_no, u32 data_addr); extern int cellMouseGetRawData(u32 port_no, mem_class_t data);
//cellGcm //cellGcm
extern int cellGcmCallback(u32 context_addr, u32 count); extern int cellGcmCallback(u32 context_addr, u32 count);

View File

@ -93,13 +93,12 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode)
return 0x0000; return 0x0000;
} }
int cellKbGetInfo(u32 info_addr) int cellKbGetInfo(mem_class_t info)
{ {
sys_io.Log("cellKbGetInfo(info_addr=0x%x)", info_addr); sys_io.Log("cellKbGetInfo(info_addr=0x%x)", info.GetAddr());
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
const KbInfo& current_info = Emu.GetKeyboardManager().GetInfo(); const KbInfo& current_info = Emu.GetKeyboardManager().GetInfo();
mem_class_t info(info_addr);
info += current_info.max_connect; info += current_info.max_connect;
info += current_info.now_connect; info += current_info.now_connect;
info += current_info.info; info += current_info.info;
@ -111,17 +110,15 @@ int cellKbGetInfo(u32 info_addr)
return CELL_OK; return CELL_OK;
} }
int cellKbRead(u32 port_no, u32 data_addr) int cellKbRead(u32 port_no, mem_class_t data)
{ {
sys_io.Log("cellKbRead(port_no=%d,info_addr=0x%x)", port_no, data_addr); sys_io.Log("cellKbRead(port_no=%d,info_addr=0x%x)", port_no, data.GetAddr());
const Array<Keyboard>& keyboards = Emu.GetKeyboardManager().GetKeyboards(); const Array<Keyboard>& keyboards = Emu.GetKeyboardManager().GetKeyboards();
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
if(port_no >= keyboards.GetCount()) return CELL_KB_ERROR_INVALID_PARAMETER; if(port_no >= keyboards.GetCount()) return CELL_KB_ERROR_INVALID_PARAMETER;
CellKbData& current_data = Emu.GetKeyboardManager().GetData(port_no); CellKbData& current_data = Emu.GetKeyboardManager().GetData(port_no);
mem_class_t data(data_addr);
data += current_data.led; data += current_data.led;
data += current_data.mkey; data += current_data.mkey;
data += min((u32)current_data.len, CELL_KB_MAX_KEYCODES); data += min((u32)current_data.len, CELL_KB_MAX_KEYCODES);
@ -162,13 +159,12 @@ int cellKbSetReadMode(u32 port_no, u32 rmode)
return CELL_OK; return CELL_OK;
} }
int cellKbGetConfiguration(u32 port_no, u32 config_addr) int cellKbGetConfiguration(u32 port_no, mem_class_t config)
{ {
sys_io.Log("cellKbGetConfiguration(port_no=%d,config_addr=0x%x)", port_no, config_addr); sys_io.Log("cellKbGetConfiguration(port_no=%d,config_addr=0x%x)", port_no, config.GetAddr());
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
const CellKbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no); const CellKbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
mem_class_t config(config_addr);
config += current_config.arrange; config += current_config.arrange;
config += current_config.read_mode; config += current_config.read_mode;
config += current_config.code_type; config += current_config.code_type;

View File

@ -46,13 +46,12 @@ int cellMouseEnd()
return CELL_OK; return CELL_OK;
} }
int cellMouseGetInfo(u32 info_addr) int cellMouseGetInfo(mem_class_t info)
{ {
sys_io.Log("cellMouseGetInfo(info_addr=0x%x)", info_addr); sys_io.Log("cellMouseGetInfo(info_addr=0x%x)", info.GetAddr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
const MouseInfo& current_info = Emu.GetMouseManager().GetInfo(); const MouseInfo& current_info = Emu.GetMouseManager().GetInfo();
mem_class_t info(info_addr);
info += current_info.max_connect; info += current_info.max_connect;
info += current_info.now_connect; info += current_info.now_connect;
info += current_info.info; info += current_info.info;
@ -63,27 +62,25 @@ int cellMouseGetInfo(u32 info_addr)
return CELL_OK; return CELL_OK;
} }
int cellMouseInfoTabletMode(u32 port_no, u32 info_addr) int cellMouseInfoTabletMode(u32 port_no, mem_class_t info)
{ {
sys_io.Log("cellMouseInfoTabletMode(port_no=%d,info_addr=0x%x)", port_no,info_addr); sys_io.Log("cellMouseInfoTabletMode(port_no=%d,info_addr=0x%x)", port_no, info.GetAddr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_INVALID_PARAMETER; if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
mem_class_t info(info_addr);
info += 0; // Unimplemented: (0=Tablet mode is not supported) info += 0; // Unimplemented: (0=Tablet mode is not supported)
info += 1; // Unimplemented: (1=Mouse mode) info += 1; // Unimplemented: (1=Mouse mode)
return CELL_OK; return CELL_OK;
} }
int cellMouseGetData(u32 port_no, u32 data_addr) int cellMouseGetData(u32 port_no, mem_class_t data)
{ {
sys_io.Log("cellMouseGetData(port_no=%d,data_addr=0x%x)", port_no,data_addr); sys_io.Log("cellMouseGetData(port_no=%d,data_addr=0x%x)", port_no, data.GetAddr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_NO_DEVICE; if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_NO_DEVICE;
CellMouseData& current_data = Emu.GetMouseManager().GetData(port_no); CellMouseData& current_data = Emu.GetMouseManager().GetData(port_no);
mem_class_t data(data_addr);
data += current_data.update; data += current_data.update;
data += current_data.buttons; data += current_data.buttons;
data += current_data.x_axis; data += current_data.x_axis;
@ -99,7 +96,7 @@ int cellMouseGetData(u32 port_no, u32 data_addr)
return CELL_OK; return CELL_OK;
} }
int cellMouseGetDataList(u32 port_no, u32 data_addr) int cellMouseGetDataList(u32 port_no, mem_class_t data)
{ {
UNIMPLEMENTED_FUNC(sys_io); UNIMPLEMENTED_FUNC(sys_io);
@ -113,23 +110,22 @@ int cellMouseSetTabletMode(u32 port_no, u32 mode)
return CELL_OK; return CELL_OK;
} }
int cellMouseGetTabletDataList(u32 port_no, u32 data_addr) int cellMouseGetTabletDataList(u32 port_no, mem_class_t data)
{ {
UNIMPLEMENTED_FUNC(sys_io); UNIMPLEMENTED_FUNC(sys_io);
return CELL_OK; return CELL_OK;
} }
int cellMouseGetRawData(u32 port_no, u32 data_addr) int cellMouseGetRawData(u32 port_no, mem_class_t data)
{ {
UNIMPLEMENTED_FUNC(sys_io); UNIMPLEMENTED_FUNC(sys_io);
/*sys_io.Log("cellMouseGetRawData(port_no=%d,data_addr=0x%x)", port_no,data_addr); /*sys_io.Log("cellMouseGetRawData(port_no=%d,data_addr=0x%x)", port_no, data.GetAddr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_NO_DEVICE; if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_NO_DEVICE;
CellMouseRawData& current_rawdata = Emu.GetMouseManager().GetRawData(port_no); CellMouseRawData& current_rawdata = Emu.GetMouseManager().GetRawData(port_no);
mem_class_t data(data_addr);
data += current_rawdata.len; data += current_rawdata.len;
for(s32 i=0; i<current_rawdata.len; i++) for(s32 i=0; i<current_rawdata.len; i++)
{ {