mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
Some memory functions removed
This commit is contained in:
parent
d0e532e7ce
commit
1337cf4f04
@ -525,19 +525,22 @@ u8* DynamicMemoryBlockBase::GetMem(u64 addr) const
|
|||||||
|
|
||||||
bool DynamicMemoryBlockBase::IsLocked(u64 addr)
|
bool DynamicMemoryBlockBase::IsLocked(u64 addr)
|
||||||
{
|
{
|
||||||
assert(!__FUNCTION__);
|
LOG_ERROR(MEMORY, "DynamicMemoryBlockBase::IsLocked() not implemented");
|
||||||
|
Emu.Pause();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicMemoryBlockBase::Lock(u64 addr, u32 size)
|
bool DynamicMemoryBlockBase::Lock(u64 addr, u32 size)
|
||||||
{
|
{
|
||||||
assert(!__FUNCTION__);
|
LOG_ERROR(MEMORY, "DynamicMemoryBlockBase::Lock() not implemented");
|
||||||
|
Emu.Pause();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicMemoryBlockBase::Unlock(u64 addr, u32 size)
|
bool DynamicMemoryBlockBase::Unlock(u64 addr, u32 size)
|
||||||
{
|
{
|
||||||
assert(!__FUNCTION__);
|
LOG_ERROR(MEMORY, "DynamicMemoryBlockBase::Unlock() not implemented");
|
||||||
|
Emu.Pause();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,22 +333,15 @@ public:
|
|||||||
for (u32 i = 0; i < size; ++i) Write8(addr + (size - 1 - i), src[i]);
|
for (u32 i = 0; i < size; ++i) Write8(addr + (size - 1 - i), src[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename Td> void WriteData(const T addr, const Td* data)
|
//template<typename T, typename Td> void WriteData(const T addr, const Td* data)
|
||||||
{
|
//{
|
||||||
memcpy(GetMemFromAddr<T>(addr), data, sizeof(Td));
|
// memcpy(GetMemFromAddr<T>(addr), data, sizeof(Td));
|
||||||
}
|
//}
|
||||||
|
|
||||||
template<typename T, typename Td> void WriteData(const T addr, const Td data)
|
//template<typename T, typename Td> void WriteData(const T addr, const Td data)
|
||||||
{
|
//{
|
||||||
*(Td*)GetMemFromAddr<T>(addr) = data;
|
// *(Td*)GetMemFromAddr<T>(addr) = data;
|
||||||
}
|
//}
|
||||||
|
|
||||||
template<typename T> std::string ReadString(const T addr, const u64 len)
|
|
||||||
{
|
|
||||||
std::string ret((const char *)GetMemFromAddr<T>(addr), len);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T> std::string ReadString(const T addr)
|
template<typename T> std::string ReadString(const T addr)
|
||||||
{
|
{
|
||||||
@ -357,7 +350,7 @@ public:
|
|||||||
|
|
||||||
template<typename T> void WriteString(const T addr, const std::string& str)
|
template<typename T> void WriteString(const T addr, const std::string& str)
|
||||||
{
|
{
|
||||||
strcpy((char*)GetMemFromAddr<T>(addr), str.c_str());
|
memcpy((char*)GetMemFromAddr<T>(addr), str.c_str(), str.size() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetUserMemTotalSize()
|
u32 GetUserMemTotalSize()
|
||||||
@ -380,16 +373,6 @@ public:
|
|||||||
return UserMemory->Free(addr);
|
return UserMemory->Free(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Lock(const u64 addr, const u32 size)
|
|
||||||
{
|
|
||||||
return UserMemory->Lock(addr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Unlock(const u64 addr, const u32 size)
|
|
||||||
{
|
|
||||||
return UserMemory->Unlock(addr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Map(const u64 addr, const u32 size);
|
bool Map(const u64 addr, const u32 size);
|
||||||
|
|
||||||
bool Unmap(const u64 addr);
|
bool Unmap(const u64 addr);
|
||||||
|
@ -197,7 +197,12 @@ struct CellVideoOutConfiguration
|
|||||||
u8 format;
|
u8 format;
|
||||||
u8 aspect;
|
u8 aspect;
|
||||||
u8 reserved[9];
|
u8 reserved[9];
|
||||||
u32 pitch;
|
be_t<u32> pitch;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CellVideoOutOption
|
||||||
|
{
|
||||||
|
be_t<u32> reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CellVideoOutEvent
|
enum CellVideoOutEvent
|
||||||
|
@ -377,7 +377,7 @@ s32 _cellGcmInitBody(vm::ptr<CellGcmContextData> context, u32 cmdSize, u32 ioSiz
|
|||||||
gcm_info.context_addr = (u32)Memory.MainMem.AllocAlign(0x1000);
|
gcm_info.context_addr = (u32)Memory.MainMem.AllocAlign(0x1000);
|
||||||
gcm_info.control_addr = gcm_info.context_addr + 0x40;
|
gcm_info.control_addr = gcm_info.context_addr + 0x40;
|
||||||
|
|
||||||
Memory.WriteData(gcm_info.context_addr, current_context);
|
vm::get_ref<CellGcmContextData>(gcm_info.context_addr) = current_context;
|
||||||
Memory.Write32(context.addr(), gcm_info.context_addr);
|
Memory.Write32(context.addr(), gcm_info.context_addr);
|
||||||
|
|
||||||
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
|
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
|
||||||
@ -591,8 +591,8 @@ int cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u
|
|||||||
tile.m_comp = comp;
|
tile.m_comp = comp;
|
||||||
tile.m_base = base;
|
tile.m_base = base;
|
||||||
tile.m_bank = bank;
|
tile.m_bank = bank;
|
||||||
Memory.WriteData(Emu.GetGSManager().GetRender().m_tiles_addr + sizeof(CellGcmTileInfo)* index, tile.Pack());
|
|
||||||
|
|
||||||
|
vm::get_ptr<CellGcmTileInfo>(Emu.GetGSManager().GetRender().m_tiles_addr)[index] = tile.Pack();
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -642,8 +642,7 @@ int cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart,
|
|||||||
zcull.m_sRef = sRef;
|
zcull.m_sRef = sRef;
|
||||||
zcull.m_sMask = sMask;
|
zcull.m_sMask = sMask;
|
||||||
|
|
||||||
Memory.WriteData(Emu.GetGSManager().GetRender().m_zculls_addr + sizeof(CellGcmZcullInfo)* index, zcull.Pack());
|
vm::get_ptr<CellGcmZcullInfo>(Emu.GetGSManager().GetRender().m_zculls_addr)[index] = zcull.Pack();
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1149,8 +1148,8 @@ int cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
|
|||||||
tile.m_comp = comp;
|
tile.m_comp = comp;
|
||||||
tile.m_base = base;
|
tile.m_base = base;
|
||||||
tile.m_bank = bank;
|
tile.m_bank = bank;
|
||||||
Memory.WriteData(Emu.GetGSManager().GetRender().m_tiles_addr + sizeof(CellGcmTileInfo) * index, tile.Pack());
|
|
||||||
|
|
||||||
|
vm::get_ptr<CellGcmTileInfo>(Emu.GetGSManager().GetRender().m_tiles_addr)[index] = tile.Pack();
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "Emu/SysCalls/Modules.h"
|
#include "Emu/SysCalls/Modules.h"
|
||||||
|
|
||||||
#include "Emu/Io/Keyboard.h"
|
#include "Emu/Io/Keyboard.h"
|
||||||
#include "SC_Keyboard.h"
|
#include "cellKb.h"
|
||||||
|
|
||||||
extern Module *sys_io;
|
extern Module *sys_io;
|
||||||
|
|
||||||
@ -163,3 +163,17 @@ int cellKbGetConfiguration(u32 port_no, vm::ptr<CellKbConfig> config)
|
|||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cellKb_init()
|
||||||
|
{
|
||||||
|
sys_io->AddFunc(0x433f6ec0, cellKbInit);
|
||||||
|
sys_io->AddFunc(0xbfce3285, cellKbEnd);
|
||||||
|
sys_io->AddFunc(0x2073b7f6, cellKbClearBuf);
|
||||||
|
sys_io->AddFunc(0x4ab1fa77, cellKbCnvRawCode);
|
||||||
|
sys_io->AddFunc(0x2f1774d5, cellKbGetInfo);
|
||||||
|
sys_io->AddFunc(0xff0a21b7, cellKbRead);
|
||||||
|
sys_io->AddFunc(0xa5f85e4d, cellKbSetCodeType);
|
||||||
|
sys_io->AddFunc(0x3f72c56e, cellKbSetLEDStatus);
|
||||||
|
sys_io->AddFunc(0xdeefdfa7, cellKbSetReadMode);
|
||||||
|
sys_io->AddFunc(0x1f71ecbe, cellKbGetConfiguration);
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
#include "Emu/SysCalls/Modules.h"
|
#include "Emu/SysCalls/Modules.h"
|
||||||
|
|
||||||
#include "Emu/Io/Mouse.h"
|
#include "Emu/Io/Mouse.h"
|
||||||
#include "SC_Mouse.h"
|
#include "cellMouse.h"
|
||||||
|
|
||||||
extern Module *sys_io;
|
extern Module *sys_io;
|
||||||
|
|
||||||
@ -128,3 +128,17 @@ int cellMouseGetRawData(u32 port_no, u32 data_addr)
|
|||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cellMouse_init()
|
||||||
|
{
|
||||||
|
sys_io->AddFunc(0xc9030138, cellMouseInit);
|
||||||
|
sys_io->AddFunc(0x3ef66b95, cellMouseClearBuf);
|
||||||
|
sys_io->AddFunc(0xe10183ce, cellMouseEnd);
|
||||||
|
sys_io->AddFunc(0x5baf30fb, cellMouseGetInfo);
|
||||||
|
sys_io->AddFunc(0x4d0b3b1f, cellMouseInfoTabletMode);
|
||||||
|
sys_io->AddFunc(0x3138e632, cellMouseGetData);
|
||||||
|
sys_io->AddFunc(0x6bd131f0, cellMouseGetDataList);
|
||||||
|
sys_io->AddFunc(0x2d16da4f, cellMouseSetTabletMode);
|
||||||
|
sys_io->AddFunc(0x21a62e9b, cellMouseGetTabletDataList);
|
||||||
|
sys_io->AddFunc(0xa328cc35, cellMouseGetRawData);
|
||||||
|
}
|
@ -4,55 +4,10 @@
|
|||||||
#include "Emu/SysCalls/Modules.h"
|
#include "Emu/SysCalls/Modules.h"
|
||||||
|
|
||||||
#include "Emu/Io/Pad.h"
|
#include "Emu/Io/Pad.h"
|
||||||
|
#include "cellPad.h"
|
||||||
|
|
||||||
extern Module *sys_io;
|
extern Module *sys_io;
|
||||||
|
|
||||||
enum CELL_PAD_ERROR_CODE
|
|
||||||
{
|
|
||||||
CELL_PAD_ERROR_FATAL = 0x80121101,
|
|
||||||
CELL_PAD_ERROR_INVALID_PARAMETER = 0x80121102,
|
|
||||||
CELL_PAD_ERROR_ALREADY_INITIALIZED = 0x80121103,
|
|
||||||
CELL_PAD_ERROR_UNINITIALIZED = 0x80121104,
|
|
||||||
CELL_PAD_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121105,
|
|
||||||
CELL_PAD_ERROR_DATA_READ_FAILED = 0x80121106,
|
|
||||||
CELL_PAD_ERROR_NO_DEVICE = 0x80121107,
|
|
||||||
CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD = 0x80121108,
|
|
||||||
CELL_PAD_ERROR_TOO_MANY_DEVICES = 0x80121109,
|
|
||||||
CELL_PAD_ERROR_EBUSY = 0x8012110a,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CellPadData
|
|
||||||
{
|
|
||||||
be_t<s32> len;
|
|
||||||
be_t<u16> button[CELL_PAD_MAX_CODES];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CellPadInfo
|
|
||||||
{
|
|
||||||
be_t<u32> max_connect;
|
|
||||||
be_t<u32> now_connect;
|
|
||||||
be_t<u32> system_info;
|
|
||||||
be_t<u16> vendor_id[CELL_MAX_PADS];
|
|
||||||
be_t<u16> product_id[CELL_MAX_PADS];
|
|
||||||
u8 status[CELL_MAX_PADS];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CellPadInfo2
|
|
||||||
{
|
|
||||||
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];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CellCapabilityInfo
|
|
||||||
{
|
|
||||||
be_t<u32> info[CELL_PAD_MAX_CAPABILITY_INFO];
|
|
||||||
};
|
|
||||||
|
|
||||||
int cellPadInit(u32 max_connect)
|
int cellPadInit(u32 max_connect)
|
||||||
{
|
{
|
||||||
sys_io->Warning("cellPadInit(max_connect=%d)", max_connect);
|
sys_io->Warning("cellPadInit(max_connect=%d)", max_connect);
|
||||||
@ -99,9 +54,10 @@ int cellPadClearBuf(u32 port_no)
|
|||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellPadGetData(u32 port_no, u32 data_addr)
|
int cellPadGetData(u32 port_no, vm::ptr<CellPadData> data)
|
||||||
{
|
{
|
||||||
sys_io->Log("cellPadGetData[port_no: %d, data_addr: 0x%x]", port_no, data_addr);
|
sys_io->Log("cellPadGetData(port_no=%d, data_addr=0x%x)", port_no, data.addr());
|
||||||
|
|
||||||
std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
|
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();
|
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
||||||
@ -110,7 +66,6 @@ int cellPadGetData(u32 port_no, u32 data_addr)
|
|||||||
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];
|
Pad& pad = pads[port_no];
|
||||||
CellPadData data = {};
|
|
||||||
|
|
||||||
u16 d1Initial, d2Initial;
|
u16 d1Initial, d2Initial;
|
||||||
d1Initial = pad.m_digital_1;
|
d1Initial = pad.m_digital_1;
|
||||||
@ -232,7 +187,7 @@ int cellPadGetData(u32 port_no, u32 data_addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//not sure if this should officially change with capabilities/portsettings :(
|
//not sure if this should officially change with capabilities/portsettings :(
|
||||||
data.len = CELL_PAD_MAX_CODES;
|
data->len = CELL_PAD_MAX_CODES;
|
||||||
|
|
||||||
//report len 0 if nothing changed and if we havent recently cleared buffer
|
//report len 0 if nothing changed and if we havent recently cleared buffer
|
||||||
if (pad.m_buffer_cleared)
|
if (pad.m_buffer_cleared)
|
||||||
@ -241,34 +196,32 @@ int cellPadGetData(u32 port_no, u32 data_addr)
|
|||||||
}
|
}
|
||||||
else if (!btnChanged)
|
else if (!btnChanged)
|
||||||
{
|
{
|
||||||
data.len = 0;
|
data->len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//lets still send new data anyway, not sure whats expected still
|
//lets still send new data anyway, not sure whats expected still
|
||||||
data.button[CELL_PAD_BTN_OFFSET_DIGITAL1] = pad.m_digital_1;
|
data->button[CELL_PAD_BTN_OFFSET_DIGITAL1] = pad.m_digital_1;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] = pad.m_digital_2;
|
data->button[CELL_PAD_BTN_OFFSET_DIGITAL2] = pad.m_digital_2;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X] = pad.m_analog_right_x;
|
data->button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X] = pad.m_analog_right_x;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_Y] = pad.m_analog_right_y;
|
data->button[CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_Y] = pad.m_analog_right_y;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X] = pad.m_analog_left_x;
|
data->button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X] = pad.m_analog_left_x;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y] = pad.m_analog_left_y;
|
data->button[CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y] = pad.m_analog_left_y;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_RIGHT] = pad.m_press_right;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_RIGHT] = pad.m_press_right;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_LEFT] = pad.m_press_left;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_LEFT] = pad.m_press_left;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_UP] = pad.m_press_up;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_UP] = pad.m_press_up;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_DOWN] = pad.m_press_down;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_DOWN] = pad.m_press_down;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_TRIANGLE] = pad.m_press_triangle;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_TRIANGLE] = pad.m_press_triangle;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_CIRCLE] = pad.m_press_circle;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_CIRCLE] = pad.m_press_circle;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_CROSS] = pad.m_press_cross;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_CROSS] = pad.m_press_cross;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_SQUARE] = pad.m_press_square;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_SQUARE] = pad.m_press_square;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_L1] = pad.m_press_L1;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_L1] = pad.m_press_L1;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_L2] = pad.m_press_L2;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_L2] = pad.m_press_L2;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_R1] = pad.m_press_R1;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_R1] = pad.m_press_R1;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_PRESS_R2] = pad.m_press_R2;
|
data->button[CELL_PAD_BTN_OFFSET_PRESS_R2] = pad.m_press_R2;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_SENSOR_X] = pad.m_sensor_x;
|
data->button[CELL_PAD_BTN_OFFSET_SENSOR_X] = pad.m_sensor_x;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_SENSOR_Y] = pad.m_sensor_y;
|
data->button[CELL_PAD_BTN_OFFSET_SENSOR_Y] = pad.m_sensor_y;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_SENSOR_Z] = pad.m_sensor_z;
|
data->button[CELL_PAD_BTN_OFFSET_SENSOR_Z] = pad.m_sensor_z;
|
||||||
data.button[CELL_PAD_BTN_OFFSET_SENSOR_G] = pad.m_sensor_g;
|
data->button[CELL_PAD_BTN_OFFSET_SENSOR_G] = pad.m_sensor_g;
|
||||||
|
|
||||||
Memory.WriteData(data_addr, data);
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
@ -295,17 +248,16 @@ int cellPadSetActDirect(u32 port_no, u32 param_addr)
|
|||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellPadGetInfo(u32 info_addr)
|
int cellPadGetInfo(vm::ptr<CellPadInfo> info)
|
||||||
{
|
{
|
||||||
sys_io->Log("cellPadGetInfo(info_addr=0x%x)", info_addr);
|
sys_io->Log("cellPadGetInfo(info_addr=0x%x)", info.addr());
|
||||||
|
|
||||||
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
CellPadInfo info = {};
|
|
||||||
|
|
||||||
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
||||||
info.max_connect = rinfo.max_connect;
|
info->max_connect = rinfo.max_connect;
|
||||||
info.now_connect = rinfo.now_connect;
|
info->now_connect = rinfo.now_connect;
|
||||||
info.system_info = rinfo.system_info;
|
info->system_info = rinfo.system_info;
|
||||||
|
|
||||||
//Can't have this as const, we need to reset Assign Changes Flag here
|
//Can't have this as const, we need to reset Assign Changes Flag here
|
||||||
std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
|
std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
|
||||||
@ -315,30 +267,25 @@ int cellPadGetInfo(u32 info_addr)
|
|||||||
if(i >= pads.size())
|
if(i >= pads.size())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
info.status[i] = pads[i].m_port_status;
|
info->status[i] = pads[i].m_port_status;
|
||||||
pads[i].m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES;
|
pads[i].m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES;
|
||||||
info.product_id[i] = 0x0268;
|
info->product_id[i] = 0x0268;
|
||||||
info.vendor_id[i] = 0x054C;
|
info->vendor_id[i] = 0x054C;
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory.WriteData(info_addr, info);
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellPadGetInfo2(u32 info_addr)
|
int cellPadGetInfo2(vm::ptr<CellPadInfo2> info)
|
||||||
{
|
{
|
||||||
sys_io->Log("cellPadGetInfo2(info_addr=0x%x)", info_addr);
|
sys_io->Log("cellPadGetInfo2(info_addr=0x%x)", info.addr());
|
||||||
|
|
||||||
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
CellPadInfo2 info = {};
|
|
||||||
//sys_io->Warning("*** info{}: max_connect=0x%x, now_connect=0x%x, system_info=0x%x, port_status[0]=0x%x, port_setting[0]=0x%x",
|
|
||||||
// (u32)info.max_connect, (u32)info.now_connect, (u32)info.system_info, (u32)info.port_status[0], (u32)info.port_setting[0]);
|
|
||||||
|
|
||||||
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
||||||
info.max_connect = rinfo.max_connect;
|
info->max_connect = rinfo.max_connect;
|
||||||
info.now_connect = rinfo.now_connect;
|
info->now_connect = rinfo.now_connect;
|
||||||
info.system_info = rinfo.system_info;
|
info->system_info = rinfo.system_info;
|
||||||
|
|
||||||
std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
|
std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
|
||||||
|
|
||||||
@ -347,21 +294,20 @@ int cellPadGetInfo2(u32 info_addr)
|
|||||||
if(i >= pads.size())
|
if(i >= pads.size())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
info.port_status[i] = pads[i].m_port_status;
|
info->port_status[i] = pads[i].m_port_status;
|
||||||
pads[i].m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES;
|
pads[i].m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES;
|
||||||
info.port_setting[i] = pads[i].m_port_setting;
|
info->port_setting[i] = pads[i].m_port_setting;
|
||||||
info.device_capability[i] = pads[i].m_device_capability;
|
info->device_capability[i] = pads[i].m_device_capability;
|
||||||
info.device_type[i] = pads[i].m_device_type;
|
info->device_type[i] = pads[i].m_device_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory.WriteData(info_addr, info);
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellPadGetCapabilityInfo(u32 port_no, vm::ptr<be_t<u32>> info_addr)
|
int cellPadGetCapabilityInfo(u32 port_no, vm::ptr<CellCapabilityInfo> info)
|
||||||
{
|
{
|
||||||
sys_io->Log("cellPadGetCapabilityInfo[port_no: %d, data_addr: 0x%x]", port_no, info_addr.addr());
|
sys_io->Log("cellPadGetCapabilityInfo(port_no=%d, data_addr:=0x%x)", port_no, info.addr());
|
||||||
|
|
||||||
if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
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;
|
||||||
@ -369,12 +315,8 @@ int cellPadGetCapabilityInfo(u32 port_no, vm::ptr<be_t<u32>> info_addr)
|
|||||||
|
|
||||||
const std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
|
const std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
|
||||||
|
|
||||||
CellCapabilityInfo data = {};
|
|
||||||
|
|
||||||
//Should return the same as device capability mask, psl1ght has it backwards in pad.h
|
//Should return the same as device capability mask, psl1ght has it backwards in pad.h
|
||||||
data.info[0] = pads[port_no].m_device_capability;
|
info->info[0] = pads[port_no].m_device_capability;
|
||||||
|
|
||||||
Memory.WriteData(info_addr.addr(), data);
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
@ -456,3 +398,21 @@ int cellPadSetSensorMode(u32 port_no, u32 mode)
|
|||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cellPad_init()
|
||||||
|
{
|
||||||
|
sys_io->AddFunc(0x1cf98800, cellPadInit);
|
||||||
|
sys_io->AddFunc(0x4d9b75d5, cellPadEnd);
|
||||||
|
sys_io->AddFunc(0x0d5f2c14, cellPadClearBuf);
|
||||||
|
sys_io->AddFunc(0x8b72cda1, cellPadGetData);
|
||||||
|
sys_io->AddFunc(0x6bc09c61, cellPadGetDataExtra);
|
||||||
|
sys_io->AddFunc(0xf65544ee, cellPadSetActDirect);
|
||||||
|
sys_io->AddFunc(0x3aaad464, cellPadGetInfo);
|
||||||
|
sys_io->AddFunc(0xa703a51d, cellPadGetInfo2);
|
||||||
|
sys_io->AddFunc(0x578e3c98, cellPadSetPortSetting);
|
||||||
|
sys_io->AddFunc(0x0e2dfaad, cellPadInfoPressMode);
|
||||||
|
sys_io->AddFunc(0x78200559, cellPadInfoSensorMode);
|
||||||
|
sys_io->AddFunc(0xf83f8182, cellPadSetPressMode);
|
||||||
|
sys_io->AddFunc(0xbe5be3ba, cellPadSetSensorMode);
|
||||||
|
sys_io->AddFunc(0xdbf4c59c, cellPadGetCapabilityInfo);
|
||||||
|
}
|
62
rpcs3/Emu/SysCalls/Modules/cellPad.h
Normal file
62
rpcs3/Emu/SysCalls/Modules/cellPad.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum CELL_PAD_ERROR_CODE
|
||||||
|
{
|
||||||
|
CELL_PAD_ERROR_FATAL = 0x80121101,
|
||||||
|
CELL_PAD_ERROR_INVALID_PARAMETER = 0x80121102,
|
||||||
|
CELL_PAD_ERROR_ALREADY_INITIALIZED = 0x80121103,
|
||||||
|
CELL_PAD_ERROR_UNINITIALIZED = 0x80121104,
|
||||||
|
CELL_PAD_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121105,
|
||||||
|
CELL_PAD_ERROR_DATA_READ_FAILED = 0x80121106,
|
||||||
|
CELL_PAD_ERROR_NO_DEVICE = 0x80121107,
|
||||||
|
CELL_PAD_ERROR_UNSUPPORTED_GAMEPAD = 0x80121108,
|
||||||
|
CELL_PAD_ERROR_TOO_MANY_DEVICES = 0x80121109,
|
||||||
|
CELL_PAD_ERROR_EBUSY = 0x8012110a,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CellPadData
|
||||||
|
{
|
||||||
|
be_t<s32> len;
|
||||||
|
be_t<u16> button[CELL_PAD_MAX_CODES];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CellPadInfo
|
||||||
|
{
|
||||||
|
be_t<u32> max_connect;
|
||||||
|
be_t<u32> now_connect;
|
||||||
|
be_t<u32> system_info;
|
||||||
|
be_t<u16> vendor_id[CELL_MAX_PADS];
|
||||||
|
be_t<u16> product_id[CELL_MAX_PADS];
|
||||||
|
u8 status[CELL_MAX_PADS];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CellPadInfo2
|
||||||
|
{
|
||||||
|
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];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CellCapabilityInfo
|
||||||
|
{
|
||||||
|
be_t<u32> info[CELL_PAD_MAX_CAPABILITY_INFO];
|
||||||
|
};
|
||||||
|
|
||||||
|
int cellPadInit(u32 max_connect);
|
||||||
|
int cellPadEnd();
|
||||||
|
int cellPadClearBuf(u32 port_no);
|
||||||
|
int cellPadGetData(u32 port_no, vm::ptr<CellPadData> data);
|
||||||
|
int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr);
|
||||||
|
int cellPadSetActDirect(u32 port_no, u32 param_addr);
|
||||||
|
int cellPadGetInfo(vm::ptr<CellPadInfo> info);
|
||||||
|
int cellPadGetInfo2(vm::ptr<CellPadInfo2> info);
|
||||||
|
int cellPadGetCapabilityInfo(u32 port_no, vm::ptr<CellCapabilityInfo> info);
|
||||||
|
int cellPadSetPortSetting(u32 port_no, u32 port_setting);
|
||||||
|
int cellPadInfoPressMode(u32 port_no);
|
||||||
|
int cellPadInfoSensorMode(u32 port_no);
|
||||||
|
int cellPadSetPressMode(u32 port_no, u32 mode);
|
||||||
|
int cellPadSetSensorMode(u32 port_no, u32 mode);
|
@ -137,37 +137,26 @@ int cellSysutilGetSystemParamString(s32 id, vm::ptr<char> buf, u32 bufsize)
|
|||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, u32 state_addr)
|
int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutState> state)
|
||||||
{
|
{
|
||||||
cellSysutil->Log("cellVideoOutGetState(videoOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", videoOut, deviceIndex, state_addr);
|
cellSysutil->Log("cellVideoOutGetState(videoOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", videoOut, deviceIndex, state.addr());
|
||||||
|
|
||||||
if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;
|
if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;
|
||||||
|
|
||||||
CellVideoOutState state = {};
|
|
||||||
|
|
||||||
switch(videoOut)
|
switch(videoOut)
|
||||||
{
|
{
|
||||||
case CELL_VIDEO_OUT_PRIMARY:
|
case CELL_VIDEO_OUT_PRIMARY:
|
||||||
{
|
state->state = Emu.GetGSManager().GetState();
|
||||||
state.colorSpace = Emu.GetGSManager().GetColorSpace();
|
state->colorSpace = Emu.GetGSManager().GetColorSpace();
|
||||||
state.state = Emu.GetGSManager().GetState();
|
state->displayMode.resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId;
|
||||||
state.displayMode.resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId;
|
state->displayMode.scanMode = Emu.GetGSManager().GetInfo().mode.scanMode;
|
||||||
state.displayMode.scanMode = Emu.GetGSManager().GetInfo().mode.scanMode;
|
state->displayMode.conversion = Emu.GetGSManager().GetInfo().mode.conversion;
|
||||||
state.displayMode.conversion = Emu.GetGSManager().GetInfo().mode.conversion;
|
state->displayMode.aspect = Emu.GetGSManager().GetInfo().mode.aspect;
|
||||||
state.displayMode.aspect = Emu.GetGSManager().GetInfo().mode.aspect;
|
state->displayMode.refreshRates = re(Emu.GetGSManager().GetInfo().mode.refreshRates);
|
||||||
state.displayMode.refreshRates = re(Emu.GetGSManager().GetInfo().mode.refreshRates);
|
|
||||||
|
|
||||||
Memory.WriteData(state_addr, state);
|
|
||||||
}
|
|
||||||
return CELL_VIDEO_OUT_SUCCEEDED;
|
return CELL_VIDEO_OUT_SUCCEEDED;
|
||||||
|
|
||||||
case CELL_VIDEO_OUT_SECONDARY:
|
case CELL_VIDEO_OUT_SECONDARY:
|
||||||
{
|
//*state = { CELL_VIDEO_OUT_OUTPUT_STATE_DISABLED }; // ???
|
||||||
state.colorSpace = CELL_VIDEO_OUT_COLOR_SPACE_RGB;
|
|
||||||
state.state = CELL_VIDEO_OUT_OUTPUT_STATE_ENABLED;
|
|
||||||
|
|
||||||
Memory.WriteData(state_addr, state);
|
|
||||||
}
|
|
||||||
return CELL_VIDEO_OUT_SUCCEEDED;
|
return CELL_VIDEO_OUT_SUCCEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +202,7 @@ s32 cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 wa
|
|||||||
|
|
||||||
if(config.pitch)
|
if(config.pitch)
|
||||||
{
|
{
|
||||||
Emu.GetGSManager().GetInfo().mode.pitch = re(config.pitch);
|
Emu.GetGSManager().GetInfo().mode.pitch = config.pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CELL_VIDEO_OUT_SUCCEEDED;
|
return CELL_VIDEO_OUT_SUCCEEDED;
|
||||||
@ -225,27 +214,26 @@ s32 cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 wa
|
|||||||
return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
|
return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr)
|
int cellVideoOutGetConfiguration(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option)
|
||||||
{
|
{
|
||||||
cellSysutil->Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)",
|
cellSysutil->Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)",
|
||||||
videoOut, config_addr, option_addr);
|
videoOut, config.addr(), option.addr());
|
||||||
|
|
||||||
CellVideoOutConfiguration config = {};
|
//if (option) *option = {};
|
||||||
|
|
||||||
switch(videoOut)
|
switch(videoOut)
|
||||||
{
|
{
|
||||||
case CELL_VIDEO_OUT_PRIMARY:
|
case CELL_VIDEO_OUT_PRIMARY:
|
||||||
config.resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId;
|
config->resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId;
|
||||||
config.format = Emu.GetGSManager().GetInfo().mode.format;
|
config->format = Emu.GetGSManager().GetInfo().mode.format;
|
||||||
config.aspect = Emu.GetGSManager().GetInfo().mode.aspect;
|
config->aspect = Emu.GetGSManager().GetInfo().mode.aspect;
|
||||||
config.pitch = re(Emu.GetGSManager().GetInfo().mode.pitch);
|
//*config->reserved = {};
|
||||||
|
config->pitch = Emu.GetGSManager().GetInfo().mode.pitch;
|
||||||
Memory.WriteData(config_addr, config);
|
|
||||||
|
|
||||||
return CELL_VIDEO_OUT_SUCCEEDED;
|
return CELL_VIDEO_OUT_SUCCEEDED;
|
||||||
|
|
||||||
case CELL_VIDEO_OUT_SECONDARY:
|
case CELL_VIDEO_OUT_SECONDARY:
|
||||||
Memory.WriteData(config_addr, config);
|
//*config = {}; // ???
|
||||||
|
|
||||||
return CELL_VIDEO_OUT_SUCCEEDED;
|
return CELL_VIDEO_OUT_SUCCEEDED;
|
||||||
}
|
}
|
||||||
@ -371,31 +359,31 @@ int cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option)
|
|||||||
|
|
||||||
switch(fs)
|
switch(fs)
|
||||||
{
|
{
|
||||||
case CELL_AUDIO_OUT_FS_32KHZ:
|
case CELL_AUDIO_OUT_FS_32KHZ:
|
||||||
case CELL_AUDIO_OUT_FS_44KHZ:
|
case CELL_AUDIO_OUT_FS_44KHZ:
|
||||||
case CELL_AUDIO_OUT_FS_48KHZ:
|
case CELL_AUDIO_OUT_FS_48KHZ:
|
||||||
case CELL_AUDIO_OUT_FS_88KHZ:
|
case CELL_AUDIO_OUT_FS_88KHZ:
|
||||||
case CELL_AUDIO_OUT_FS_96KHZ:
|
case CELL_AUDIO_OUT_FS_96KHZ:
|
||||||
case CELL_AUDIO_OUT_FS_176KHZ:
|
case CELL_AUDIO_OUT_FS_176KHZ:
|
||||||
case CELL_AUDIO_OUT_FS_192KHZ:
|
case CELL_AUDIO_OUT_FS_192KHZ:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE;
|
default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case CELL_AUDIO_OUT_CODING_TYPE_LPCM: break;
|
case CELL_AUDIO_OUT_CODING_TYPE_LPCM: break;
|
||||||
case CELL_AUDIO_OUT_CODING_TYPE_AC3: available = 0; break;
|
case CELL_AUDIO_OUT_CODING_TYPE_AC3: available = 0; break;
|
||||||
case CELL_AUDIO_OUT_CODING_TYPE_DTS: available = 0; break;
|
case CELL_AUDIO_OUT_CODING_TYPE_DTS: available = 0; break;
|
||||||
|
|
||||||
default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE;
|
default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(audioOut)
|
switch(audioOut)
|
||||||
{
|
{
|
||||||
case CELL_AUDIO_OUT_PRIMARY: return available;
|
case CELL_AUDIO_OUT_PRIMARY: return available;
|
||||||
case CELL_AUDIO_OUT_SECONDARY: return 0;
|
case CELL_AUDIO_OUT_SECONDARY: return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION;
|
return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION;
|
||||||
@ -451,31 +439,26 @@ int cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u3
|
|||||||
return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION;
|
return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, u32 state_addr)
|
int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutState> state)
|
||||||
{
|
{
|
||||||
cellSysutil->Warning("cellAudioOutGetState(audioOut=0x%x,deviceIndex=0x%x,state_addr=0x%x)",audioOut,deviceIndex,state_addr);
|
cellSysutil->Warning("cellAudioOutGetState(audioOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", audioOut, deviceIndex, state.addr());
|
||||||
CellAudioOutState state = {};
|
|
||||||
|
|
||||||
switch(audioOut)
|
switch(audioOut)
|
||||||
{
|
{
|
||||||
case CELL_AUDIO_OUT_PRIMARY:
|
case CELL_AUDIO_OUT_PRIMARY:
|
||||||
{
|
state->state = Emu.GetAudioManager().GetState();
|
||||||
state.state = Emu.GetAudioManager().GetState();
|
state->encoder = Emu.GetAudioManager().GetInfo().mode.encoder;
|
||||||
state.soundMode.type = Emu.GetAudioManager().GetInfo().mode.type;
|
//*state->reserved = {};
|
||||||
state.soundMode.channel = Emu.GetAudioManager().GetInfo().mode.channel;
|
state->downMixer = Emu.GetAudioManager().GetInfo().mode.downMixer;
|
||||||
state.soundMode.fs = Emu.GetAudioManager().GetInfo().mode.fs;
|
state->soundMode.type = Emu.GetAudioManager().GetInfo().mode.type;
|
||||||
state.soundMode.layout = Emu.GetAudioManager().GetInfo().mode.layout;
|
state->soundMode.channel = Emu.GetAudioManager().GetInfo().mode.channel;
|
||||||
|
state->soundMode.fs = Emu.GetAudioManager().GetInfo().mode.fs;
|
||||||
Memory.WriteData(state_addr, state);
|
state->soundMode.reserved = 0;
|
||||||
}
|
state->soundMode.layout = Emu.GetAudioManager().GetInfo().mode.layout;
|
||||||
return CELL_AUDIO_OUT_SUCCEEDED;
|
return CELL_AUDIO_OUT_SUCCEEDED;
|
||||||
|
|
||||||
case CELL_AUDIO_OUT_SECONDARY:
|
case CELL_AUDIO_OUT_SECONDARY:
|
||||||
{
|
//*state = { CELL_AUDIO_OUT_OUTPUT_STATE_DISABLED };
|
||||||
state.state = CELL_AUDIO_OUT_OUTPUT_STATE_ENABLED;
|
|
||||||
|
|
||||||
Memory.WriteData(state_addr, state);
|
|
||||||
}
|
|
||||||
return CELL_AUDIO_OUT_SUCCEEDED;
|
return CELL_AUDIO_OUT_SUCCEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,7 +467,7 @@ int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, u32 state_addr)
|
|||||||
|
|
||||||
int cellAudioOutConfigure(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option, u32 waitForEvent)
|
int cellAudioOutConfigure(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option, u32 waitForEvent)
|
||||||
{
|
{
|
||||||
cellSysutil->Warning("cellAudioOutConfigure(audioOut=%d, config_addr=0x%x, option_addr=0x%x, (!)waitForEvent=%d)",
|
cellSysutil->Warning("cellAudioOutConfigure(audioOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=%d)",
|
||||||
audioOut, config.addr(), option.addr(), waitForEvent);
|
audioOut, config.addr(), option.addr(), waitForEvent);
|
||||||
|
|
||||||
switch(audioOut)
|
switch(audioOut)
|
||||||
@ -511,26 +494,24 @@ int cellAudioOutConfigure(u32 audioOut, vm::ptr<CellAudioOutConfiguration> confi
|
|||||||
return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
|
return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellAudioOutGetConfiguration(u32 audioOut, u32 config_addr, u32 option_addr)
|
int cellAudioOutGetConfiguration(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option)
|
||||||
{
|
{
|
||||||
cellSysutil->Warning("cellAudioOutGetConfiguration(audioOut=%d, config_addr=0x%x, option_addr=0x%x)",
|
cellSysutil->Warning("cellAudioOutGetConfiguration(audioOut=%d, config_addr=0x%x, option_addr=0x%x)", audioOut, config.addr(), option.addr());
|
||||||
audioOut, config_addr, option_addr);
|
|
||||||
|
|
||||||
CellAudioOutConfiguration config = {};
|
//if (option) *option = {};
|
||||||
|
|
||||||
switch(audioOut)
|
switch(audioOut)
|
||||||
{
|
{
|
||||||
case CELL_AUDIO_OUT_PRIMARY:
|
case CELL_AUDIO_OUT_PRIMARY:
|
||||||
config.channel = Emu.GetAudioManager().GetInfo().mode.channel;
|
config->channel = Emu.GetAudioManager().GetInfo().mode.channel;
|
||||||
config.encoder = Emu.GetAudioManager().GetInfo().mode.encoder;
|
config->encoder = Emu.GetAudioManager().GetInfo().mode.encoder;
|
||||||
config.downMixer = Emu.GetAudioManager().GetInfo().mode.downMixer;
|
//*config->reserved = {};
|
||||||
|
config->downMixer = Emu.GetAudioManager().GetInfo().mode.downMixer;
|
||||||
Memory.WriteData(config_addr, config);
|
|
||||||
|
|
||||||
return CELL_AUDIO_OUT_SUCCEEDED;
|
return CELL_AUDIO_OUT_SUCCEEDED;
|
||||||
|
|
||||||
case CELL_AUDIO_OUT_SECONDARY:
|
case CELL_AUDIO_OUT_SECONDARY:
|
||||||
Memory.WriteData(config_addr, config);
|
//*config = {};
|
||||||
|
|
||||||
return CELL_AUDIO_OUT_SUCCEEDED;
|
return CELL_AUDIO_OUT_SUCCEEDED;
|
||||||
}
|
}
|
||||||
@ -540,12 +521,12 @@ int cellAudioOutGetConfiguration(u32 audioOut, u32 config_addr, u32 option_addr)
|
|||||||
|
|
||||||
int cellAudioOutGetNumberOfDevice(u32 audioOut)
|
int cellAudioOutGetNumberOfDevice(u32 audioOut)
|
||||||
{
|
{
|
||||||
cellSysutil->Warning("cellAudioOutGetNumberOfDevice(videoOut=%d)",audioOut);
|
cellSysutil->Warning("cellAudioOutGetNumberOfDevice(audioOut=%d)", audioOut);
|
||||||
|
|
||||||
switch(audioOut)
|
switch(audioOut)
|
||||||
{
|
{
|
||||||
case CELL_AUDIO_OUT_PRIMARY: return 1;
|
case CELL_AUDIO_OUT_PRIMARY: return 1;
|
||||||
case CELL_AUDIO_OUT_SECONDARY: return 0;
|
case CELL_AUDIO_OUT_SECONDARY: return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
|
return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
|
||||||
@ -553,8 +534,7 @@ int cellAudioOutGetNumberOfDevice(u32 audioOut)
|
|||||||
|
|
||||||
int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutDeviceInfo> info)
|
int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutDeviceInfo> info)
|
||||||
{
|
{
|
||||||
cellSysutil->Todo("cellAudioOutGetDeviceInfo(audioOut=%u, deviceIndex=%u, info_addr=0x%x)",
|
cellSysutil->Todo("cellAudioOutGetDeviceInfo(audioOut=%d, deviceIndex=%d, info_addr=0x%x)", audioOut, deviceIndex, info.addr());
|
||||||
audioOut, deviceIndex, info.addr());
|
|
||||||
|
|
||||||
if(deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND;
|
if(deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND;
|
||||||
|
|
||||||
@ -576,11 +556,11 @@ int cellAudioOutSetCopyControl(u32 audioOut, u32 control)
|
|||||||
|
|
||||||
switch(audioOut)
|
switch(audioOut)
|
||||||
{
|
{
|
||||||
case CELL_AUDIO_OUT_PRIMARY:
|
case CELL_AUDIO_OUT_PRIMARY:
|
||||||
case CELL_AUDIO_OUT_SECONDARY:
|
case CELL_AUDIO_OUT_SECONDARY:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
|
default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(control)
|
switch(control)
|
||||||
|
@ -1,66 +1,17 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Emu/Memory/Memory.h"
|
|
||||||
#include "Emu/SysCalls/Modules.h"
|
#include "Emu/SysCalls/Modules.h"
|
||||||
|
|
||||||
#include "SC_Keyboard.h"
|
|
||||||
#include "SC_Mouse.h"
|
|
||||||
|
|
||||||
//void sys_io_init();
|
//void sys_io_init();
|
||||||
//Module sys_io(0x0017, sys_io_init);
|
//Module sys_io(0x0017, sys_io_init);
|
||||||
Module *sys_io = nullptr;
|
Module *sys_io = nullptr;
|
||||||
|
|
||||||
//cellPad
|
extern void cellPad_init();
|
||||||
extern int cellPadInit(u32 max_connect);
|
extern void cellKb_init();
|
||||||
extern int cellPadEnd();
|
extern void cellMouse_init();
|
||||||
extern int cellPadClearBuf(u32 port_no);
|
|
||||||
extern int cellPadGetData(u32 port_no, u32 data_addr);
|
|
||||||
extern int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr);
|
|
||||||
extern int cellPadSetActDirect(u32 port_no, u32 param_addr);
|
|
||||||
extern int cellPadGetInfo(u32 info_addr);
|
|
||||||
extern int cellPadGetInfo2(u32 info_addr);
|
|
||||||
extern int cellPadSetPortSetting(u32 port_no, u32 port_setting);
|
|
||||||
extern int cellPadInfoPressMode(u32 port_no);
|
|
||||||
extern int cellPadInfoSensorMode(u32 port_no);
|
|
||||||
extern int cellPadSetPressMode(u32 port_no, u32 mode);
|
|
||||||
extern int cellPadSetSensorMode(u32 port_no, u32 mode);
|
|
||||||
extern int cellPadGetCapabilityInfo(u32 port_no, vm::ptr<be_t<u32>> info_addr);
|
|
||||||
|
|
||||||
void sys_io_init()
|
void sys_io_init()
|
||||||
{
|
{
|
||||||
sys_io->AddFunc(0x1cf98800, cellPadInit);
|
cellPad_init();
|
||||||
sys_io->AddFunc(0x4d9b75d5, cellPadEnd);
|
cellKb_init();
|
||||||
sys_io->AddFunc(0x0d5f2c14, cellPadClearBuf);
|
cellMouse_init();
|
||||||
sys_io->AddFunc(0x8b72cda1, cellPadGetData);
|
|
||||||
sys_io->AddFunc(0x6bc09c61, cellPadGetDataExtra);
|
|
||||||
sys_io->AddFunc(0xf65544ee, cellPadSetActDirect);
|
|
||||||
sys_io->AddFunc(0x3aaad464, cellPadGetInfo);
|
|
||||||
sys_io->AddFunc(0xa703a51d, cellPadGetInfo2);
|
|
||||||
sys_io->AddFunc(0x578e3c98, cellPadSetPortSetting);
|
|
||||||
sys_io->AddFunc(0x0e2dfaad, cellPadInfoPressMode);
|
|
||||||
sys_io->AddFunc(0x78200559, cellPadInfoSensorMode);
|
|
||||||
sys_io->AddFunc(0xf83f8182, cellPadSetPressMode);
|
|
||||||
sys_io->AddFunc(0xbe5be3ba, cellPadSetSensorMode);
|
|
||||||
sys_io->AddFunc(0xdbf4c59c, cellPadGetCapabilityInfo);
|
|
||||||
|
|
||||||
sys_io->AddFunc(0x433f6ec0, cellKbInit);
|
|
||||||
sys_io->AddFunc(0xbfce3285, cellKbEnd);
|
|
||||||
sys_io->AddFunc(0x2073b7f6, cellKbClearBuf);
|
|
||||||
sys_io->AddFunc(0x4ab1fa77, cellKbCnvRawCode);
|
|
||||||
sys_io->AddFunc(0x2f1774d5, cellKbGetInfo);
|
|
||||||
sys_io->AddFunc(0xff0a21b7, cellKbRead);
|
|
||||||
sys_io->AddFunc(0xa5f85e4d, cellKbSetCodeType);
|
|
||||||
sys_io->AddFunc(0x3f72c56e, cellKbSetLEDStatus);
|
|
||||||
sys_io->AddFunc(0xdeefdfa7, cellKbSetReadMode);
|
|
||||||
sys_io->AddFunc(0x1f71ecbe, cellKbGetConfiguration);
|
|
||||||
|
|
||||||
sys_io->AddFunc(0xc9030138, cellMouseInit);
|
|
||||||
sys_io->AddFunc(0x3ef66b95, cellMouseClearBuf);
|
|
||||||
sys_io->AddFunc(0xe10183ce, cellMouseEnd);
|
|
||||||
sys_io->AddFunc(0x5baf30fb, cellMouseGetInfo);
|
|
||||||
sys_io->AddFunc(0x4d0b3b1f, cellMouseInfoTabletMode);
|
|
||||||
sys_io->AddFunc(0x3138e632, cellMouseGetData);
|
|
||||||
sys_io->AddFunc(0x6bd131f0, cellMouseGetDataList);
|
|
||||||
sys_io->AddFunc(0x2d16da4f, cellMouseSetTabletMode);
|
|
||||||
sys_io->AddFunc(0x21a62e9b, cellMouseGetTabletDataList);
|
|
||||||
sys_io->AddFunc(0xa328cc35, cellMouseGetRawData);
|
|
||||||
}
|
}
|
||||||
|
@ -71,9 +71,9 @@ s32 sys_spu_thread_initialize(vm::ptr<be_t<u32>> thread, u32 group, u32 spu_num,
|
|||||||
u32 spu_ep = (u32)img->entry_point;
|
u32 spu_ep = (u32)img->entry_point;
|
||||||
|
|
||||||
std::string name = "SPUThread";
|
std::string name = "SPUThread";
|
||||||
if (attr->name_addr)
|
if (attr->name)
|
||||||
{
|
{
|
||||||
name = Memory.ReadString(attr->name_addr, attr->name_len);
|
name = std::string(attr->name.get_ptr(), attr->name_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 a1 = arg->arg1;
|
u64 a1 = arg->arg1;
|
||||||
@ -101,7 +101,7 @@ s32 sys_spu_thread_initialize(vm::ptr<be_t<u32>> thread, u32 group, u32 spu_num,
|
|||||||
(*(SPUThread*)&new_thread).group = group_info;
|
(*(SPUThread*)&new_thread).group = group_info;
|
||||||
|
|
||||||
sys_spu.Warning("*** New SPU Thread [%s] (img_offset=0x%x, ls_offset=0x%x, ep=0x%x, a1=0x%llx, a2=0x%llx, a3=0x%llx, a4=0x%llx): id=%d",
|
sys_spu.Warning("*** New SPU Thread [%s] (img_offset=0x%x, ls_offset=0x%x, ep=0x%x, a1=0x%llx, a2=0x%llx, a3=0x%llx, a4=0x%llx): id=%d",
|
||||||
(attr->name_addr ? name.c_str() : ""), (u32) img->segs_addr, ((SPUThread&) new_thread).dmac.ls_offset, spu_ep, a1, a2, a3, a4, id);
|
(attr->name ? attr->name.get_ptr() : ""), (u32)img->segs_addr, ((SPUThread&)new_thread).dmac.ls_offset, spu_ep, a1, a2, a3, a4, id);
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
@ -410,7 +410,7 @@ s32 sys_spu_thread_group_create(vm::ptr<be_t<u32>> id, u32 num, int prio, vm::pt
|
|||||||
|
|
||||||
if (prio < 16 || prio > 255) return CELL_EINVAL;
|
if (prio < 16 || prio > 255) return CELL_EINVAL;
|
||||||
|
|
||||||
const std::string name = Memory.ReadString(attr->name_addr, attr->name_len);
|
const std::string name(attr->name.get_ptr(), attr->nsize);
|
||||||
|
|
||||||
*id = sys_spu.GetNewId(new SpuGroupInfo(name, num, prio, attr->type, attr->ct));
|
*id = sys_spu.GetNewId(new SpuGroupInfo(name, num, prio, attr->type, attr->ct));
|
||||||
|
|
||||||
|
@ -39,16 +39,15 @@ enum
|
|||||||
|
|
||||||
struct sys_spu_thread_group_attribute
|
struct sys_spu_thread_group_attribute
|
||||||
{
|
{
|
||||||
be_t<u32> name_len;
|
be_t<u32> nsize;
|
||||||
be_t<u32> name_addr;
|
vm::bptr<const char> name;
|
||||||
be_t<int> type;
|
be_t<s32> type;
|
||||||
/* struct {} option; */
|
|
||||||
be_t<u32> ct; // memory container id
|
be_t<u32> ct; // memory container id
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sys_spu_thread_attribute
|
struct sys_spu_thread_attribute
|
||||||
{
|
{
|
||||||
be_t<u32> name_addr;
|
vm::bptr<const char> name;
|
||||||
be_t<u32> name_len;
|
be_t<u32> name_len;
|
||||||
be_t<u32> option;
|
be_t<u32> option;
|
||||||
};
|
};
|
||||||
|
@ -8,31 +8,31 @@
|
|||||||
|
|
||||||
SysCallBase sys_tty("sys_tty");
|
SysCallBase sys_tty("sys_tty");
|
||||||
|
|
||||||
s32 sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr)
|
s32 sys_tty_read(s32 ch, vm::ptr<void> buf, u32 len, vm::ptr<u32> preadlen)
|
||||||
{
|
{
|
||||||
sys_tty.Error("sys_tty_read(ch=%d, buf_addr=%llx, len=%d, preadlen_addr=0x%llx)", ch, buf_addr, len, preadlen_addr);
|
sys_tty.Error("sys_tty_read(ch=%d, buf_addr=0x%x, len=%d, preadlen_addr=0x%x)", ch, buf.addr(), len, preadlen.addr());
|
||||||
|
|
||||||
// We currently do not support reading from the Console
|
// We currently do not support reading from the Console
|
||||||
Memory.Write32(preadlen_addr, len);
|
*preadlen = 0;
|
||||||
Emu.Pause();
|
Emu.Pause();
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 sys_tty_write(u32 ch, u64 buf_addr, u32 len, u64 pwritelen_addr)
|
s32 sys_tty_write(s32 ch, vm::ptr<const void> buf, u32 len, vm::ptr<u32> pwritelen)
|
||||||
{
|
{
|
||||||
sys_tty.Log("sys_tty_write(ch=%d, buf_addr=%llx, len=%d, preadlen_addr=0x%llx)", ch, buf_addr, len, pwritelen_addr);
|
sys_tty.Log("sys_tty_write(ch=%d, buf_addr=0x%x, len=%d, preadlen_addr=0x%x)", ch, buf.addr(), len, pwritelen.addr());
|
||||||
|
|
||||||
if(ch > 15 || (s32)len <= 0) return CELL_EINVAL;
|
if(ch > 15 || (s32)len <= 0) return CELL_EINVAL;
|
||||||
|
|
||||||
|
const std::string data((const char*)buf.get_ptr(), len);
|
||||||
|
|
||||||
if (ch == SYS_TTYP_PPU_STDOUT || ch == SYS_TTYP_SPU_STDOUT || (ch >= SYS_TTYP_USER1 && ch <= SYS_TTYP_USER13)) {
|
if (ch == SYS_TTYP_PPU_STDOUT || ch == SYS_TTYP_SPU_STDOUT || (ch >= SYS_TTYP_USER1 && ch <= SYS_TTYP_USER13)) {
|
||||||
LOG_NOTICE(TTY, "%s", Memory.ReadString(buf_addr, len).c_str());
|
LOG_NOTICE(TTY, "%s", data.c_str());
|
||||||
}
|
}
|
||||||
if (ch == SYS_TTYP_PPU_STDERR) {
|
if (ch == SYS_TTYP_PPU_STDERR) {
|
||||||
LOG_ERROR(TTY, "%s", Memory.ReadString(buf_addr, len).c_str());
|
LOG_ERROR(TTY, "%s", data.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory.Write32(pwritelen_addr, len);
|
*pwritelen = data.size();
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
@ -23,5 +23,5 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
// SysCalls
|
// SysCalls
|
||||||
s32 sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr);
|
s32 sys_tty_read(s32 ch, vm::ptr<void> buf, u32 len, vm::ptr<u32> preadlen);
|
||||||
s32 sys_tty_write(u32 ch, u64 buf_addr, u32 len, u64 pwritelen_addr);
|
s32 sys_tty_write(s32 ch, vm::ptr<const void> buf, u32 len, vm::ptr<u32> pwritelen);
|
||||||
|
@ -11,7 +11,7 @@ MemoryContainerInfo* current_ct;
|
|||||||
|
|
||||||
s32 sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 addr)
|
s32 sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 addr)
|
||||||
{
|
{
|
||||||
sys_vm.Warning("sys_vm_memory_map(vsize=0x%x,psize=0x%x,cidr=0x%x,flags=0x%llx,policy=0x%llx,addr=0x%x)",
|
sys_vm.Todo("sys_vm_memory_map(vsize=0x%x,psize=0x%x,cidr=0x%x,flags=0x%llx,policy=0x%llx,addr=0x%x)",
|
||||||
vsize, psize, cid, flag, policy, addr);
|
vsize, psize, cid, flag, policy, addr);
|
||||||
|
|
||||||
// Check virtual size.
|
// Check virtual size.
|
||||||
@ -65,7 +65,7 @@ s32 sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 a
|
|||||||
|
|
||||||
s32 sys_vm_unmap(u32 addr)
|
s32 sys_vm_unmap(u32 addr)
|
||||||
{
|
{
|
||||||
sys_vm.Warning("sys_vm_unmap(addr=0x%x)", addr);
|
sys_vm.Todo("sys_vm_unmap(addr=0x%x)", addr);
|
||||||
|
|
||||||
// Simply free the memory to unmap.
|
// Simply free the memory to unmap.
|
||||||
if(!Memory.Free(addr)) return CELL_EINVAL;
|
if(!Memory.Free(addr)) return CELL_EINVAL;
|
||||||
@ -75,7 +75,7 @@ s32 sys_vm_unmap(u32 addr)
|
|||||||
|
|
||||||
s32 sys_vm_append_memory(u32 addr, u32 size)
|
s32 sys_vm_append_memory(u32 addr, u32 size)
|
||||||
{
|
{
|
||||||
sys_vm.Warning("sys_vm_append_memory(addr=0x%x,size=0x%x)", addr, size);
|
sys_vm.Todo("sys_vm_append_memory(addr=0x%x,size=0x%x)", addr, size);
|
||||||
|
|
||||||
// Check address and size.
|
// Check address and size.
|
||||||
if((current_ct->addr != addr) || (size <= 0))
|
if((current_ct->addr != addr) || (size <= 0))
|
||||||
@ -97,7 +97,7 @@ s32 sys_vm_append_memory(u32 addr, u32 size)
|
|||||||
|
|
||||||
s32 sys_vm_return_memory(u32 addr, u32 size)
|
s32 sys_vm_return_memory(u32 addr, u32 size)
|
||||||
{
|
{
|
||||||
sys_vm.Warning("sys_vm_return_memory(addr=0x%x,size=0x%x)", addr, size);
|
sys_vm.Todo("sys_vm_return_memory(addr=0x%x,size=0x%x)", addr, size);
|
||||||
|
|
||||||
// Check address and size.
|
// Check address and size.
|
||||||
if((current_ct->addr != addr) || (size <= 0))
|
if((current_ct->addr != addr) || (size <= 0))
|
||||||
@ -119,7 +119,7 @@ s32 sys_vm_return_memory(u32 addr, u32 size)
|
|||||||
|
|
||||||
s32 sys_vm_lock(u32 addr, u32 size)
|
s32 sys_vm_lock(u32 addr, u32 size)
|
||||||
{
|
{
|
||||||
sys_vm.Warning("sys_vm_lock(addr=0x%x,size=0x%x)", addr, size);
|
sys_vm.Todo("sys_vm_lock(addr=0x%x,size=0x%x)", addr, size);
|
||||||
|
|
||||||
// Check address and size.
|
// Check address and size.
|
||||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||||
@ -133,15 +133,13 @@ s32 sys_vm_lock(u32 addr, u32 size)
|
|||||||
return CELL_EBUSY;
|
return CELL_EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The locked memory area keeps allocated and unchanged until sys_vm_unlocked is called.
|
// TODO: The locked memory area keeps allocated and unchanged until sys_vm_unlocked is called.
|
||||||
Memory.Lock(addr, size);
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 sys_vm_unlock(u32 addr, u32 size)
|
s32 sys_vm_unlock(u32 addr, u32 size)
|
||||||
{
|
{
|
||||||
sys_vm.Warning("sys_vm_unlock(addr=0x%x,size=0x%x)", addr, size);
|
sys_vm.Todo("sys_vm_unlock(addr=0x%x,size=0x%x)", addr, size);
|
||||||
|
|
||||||
// Check address and size.
|
// Check address and size.
|
||||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||||
@ -149,8 +147,7 @@ s32 sys_vm_unlock(u32 addr, u32 size)
|
|||||||
return CELL_EINVAL;
|
return CELL_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory.Unlock(addr, size);
|
// TODO: Unlock
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,9 +235,9 @@ s32 sys_vm_sync(u32 addr, u32 size)
|
|||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 sys_vm_test(u32 addr, u32 size, u32 result_addr)
|
s32 sys_vm_test(u32 addr, u32 size, vm::ptr<u64> result)
|
||||||
{
|
{
|
||||||
sys_vm.Todo("sys_vm_test(addr=0x%x,size=0x%x,result_addr=0x%x)", addr, size, result_addr);
|
sys_vm.Todo("sys_vm_test(addr=0x%x, size=0x%x, result_addr=0x%x)", addr, size, result.addr());
|
||||||
|
|
||||||
// Check address and size.
|
// Check address and size.
|
||||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||||
@ -252,14 +249,14 @@ s32 sys_vm_test(u32 addr, u32 size, u32 result_addr)
|
|||||||
// sys_vm_test checks the state of a portion of the virtual memory area.
|
// sys_vm_test checks the state of a portion of the virtual memory area.
|
||||||
|
|
||||||
// Faking.
|
// Faking.
|
||||||
Memory.Write64(result_addr, SYS_VM_TEST_ALLOCATED);
|
*result = SYS_VM_TEST_ALLOCATED;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 sys_vm_get_statistics(u32 addr, u32 stat_addr)
|
s32 sys_vm_get_statistics(u32 addr, vm::ptr<sys_vm_statistics> stat)
|
||||||
{
|
{
|
||||||
sys_vm.Todo("sys_vm_get_statistics(addr=0x%x,stat_addr=0x%x)", addr, stat_addr);
|
sys_vm.Todo("sys_vm_get_statistics(addr=0x%x, stat_addr=0x%x)", addr, stat.addr());
|
||||||
|
|
||||||
// Check address.
|
// Check address.
|
||||||
if(current_ct->addr != addr)
|
if(current_ct->addr != addr)
|
||||||
@ -268,17 +265,12 @@ s32 sys_vm_get_statistics(u32 addr, u32 stat_addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// sys_vm_get_statistics collects virtual memory management stats.
|
stat->page_fault_ppu = 0;
|
||||||
|
stat->page_fault_spu = 0;
|
||||||
sys_vm_statistics stats;
|
stat->page_in = 0;
|
||||||
stats.physical_mem_size = current_ct->size; // Total physical memory allocated for the virtual memory area.
|
stat->page_out = 0;
|
||||||
stats.physical_mem_used = 0; // Physical memory in use by the virtual memory area.
|
stat->pmem_total = current_ct->size;
|
||||||
stats.timestamp = 0; // Current time.
|
stat->pmem_used = 0;
|
||||||
stats.vm_crash_ppu = 0; // Number of bad virtual memory accesses from a PPU thread.
|
stat->timestamp = 0;
|
||||||
stats.vm_crash_spu = 0; // Number of bad virtual memory accesses from a SPU thread.
|
|
||||||
stats.vm_read = 0; // Number of virtual memory backup reading operations.
|
|
||||||
stats.vm_write = 0; // Number of virtual memory backup writing operations.
|
|
||||||
Memory.WriteData(stat_addr, stats); // Faking.
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
@ -1,18 +1,22 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define SYS_VM_TEST_INVALID 0x0000ULL
|
enum : u64
|
||||||
#define SYS_VM_TEST_UNUSED 0x0001ULL
|
{
|
||||||
#define SYS_VM_TEST_ALLOCATED 0x0002ULL
|
SYS_VM_TEST_INVALID = 0,
|
||||||
#define SYS_VM_TEST_STORED 0x0004ULL
|
SYS_VM_TEST_UNUSED = 1,
|
||||||
|
SYS_VM_TEST_ALLOCATED = 2,
|
||||||
|
SYS_VM_TEST_STORED = 4,
|
||||||
|
};
|
||||||
|
|
||||||
struct sys_vm_statistics {
|
struct sys_vm_statistics
|
||||||
u64 vm_crash_ppu;
|
{
|
||||||
u64 vm_crash_spu;
|
be_t<u64> page_fault_ppu; // Number of bad virtual memory accesses from a PPU thread.
|
||||||
u64 vm_read;
|
be_t<u64> page_fault_spu; // Number of bad virtual memory accesses from a SPU thread.
|
||||||
u64 vm_write;
|
be_t<u64> page_in; // Number of virtual memory backup reading operations.
|
||||||
u32 physical_mem_size;
|
be_t<u64> page_out; // Number of virtual memory backup writing operations.
|
||||||
u32 physical_mem_used;
|
be_t<u32> pmem_total; // Total physical memory allocated for the virtual memory area.
|
||||||
u64 timestamp;
|
be_t<u32> pmem_used; // Physical memory in use by the virtual memory area.
|
||||||
|
be_t<u64> timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
// SysCalls
|
// SysCalls
|
||||||
@ -27,5 +31,5 @@ s32 sys_vm_flush(u32 addr, u32 size);
|
|||||||
s32 sys_vm_invalidate(u32 addr, u32 size);
|
s32 sys_vm_invalidate(u32 addr, u32 size);
|
||||||
s32 sys_vm_store(u32 addr, u32 size);
|
s32 sys_vm_store(u32 addr, u32 size);
|
||||||
s32 sys_vm_sync(u32 addr, u32 size);
|
s32 sys_vm_sync(u32 addr, u32 size);
|
||||||
s32 sys_vm_test(u32 addr, u32 size, u32 result_addr);
|
s32 sys_vm_test(u32 addr, u32 size, vm::ptr<u64> result);
|
||||||
s32 sys_vm_get_statistics(u32 addr, u32 stat_addr);
|
s32 sys_vm_get_statistics(u32 addr, vm::ptr<sys_vm_statistics> stat);
|
||||||
|
@ -193,9 +193,9 @@
|
|||||||
<ClCompile Include="Emu\SysCalls\Modules\sceNpSns.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\sceNpSns.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\sceNpTrophy.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\sceNpTrophy.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\sceNpTus.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\sceNpTus.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Keyboard.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\cellKb.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Mouse.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\cellMouse.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Pad.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\cellPad.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\sysPrxForUser.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\sysPrxForUser.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\sys_fs.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\sys_fs.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\sys_http.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\sys_http.cpp" />
|
||||||
@ -374,6 +374,7 @@
|
|||||||
<ClInclude Include="Emu\SysCalls\Modules\cellL10n.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\cellL10n.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\cellNetCtl.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\cellNetCtl.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\cellMsgDialog.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\cellMsgDialog.h" />
|
||||||
|
<ClInclude Include="Emu\SysCalls\Modules\cellPad.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\cellPamf.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\cellPamf.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\cellPngDec.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\cellPngDec.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\cellSail.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\cellSail.h" />
|
||||||
@ -397,8 +398,8 @@
|
|||||||
<ClInclude Include="Emu\SysCalls\Modules\sceNpSns.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\sceNpSns.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\sceNpTrophy.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\sceNpTrophy.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\sceNpTus.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\sceNpTus.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\SC_Keyboard.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\cellKb.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\SC_Mouse.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\cellMouse.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\sysPrxForUser.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\sysPrxForUser.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\sys_net.h" />
|
<ClInclude Include="Emu\SysCalls\Modules\sys_net.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\SC_FUNC.h" />
|
<ClInclude Include="Emu\SysCalls\SC_FUNC.h" />
|
||||||
|
@ -530,15 +530,6 @@
|
|||||||
<ClCompile Include="Emu\SysCalls\lv2\sys_mmapper.cpp">
|
<ClCompile Include="Emu\SysCalls\lv2\sys_mmapper.cpp">
|
||||||
<Filter>Emu\SysCalls\lv2</Filter>
|
<Filter>Emu\SysCalls\lv2</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Mouse.cpp">
|
|
||||||
<Filter>Emu\SysCalls\Modules</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Pad.cpp">
|
|
||||||
<Filter>Emu\SysCalls\Modules</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Keyboard.cpp">
|
|
||||||
<Filter>Emu\SysCalls\Modules</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Emu\SysCalls\lv2\lv2Fs.cpp">
|
<ClCompile Include="Emu\SysCalls\lv2\lv2Fs.cpp">
|
||||||
<Filter>Emu\SysCalls\lv2</Filter>
|
<Filter>Emu\SysCalls\lv2</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -623,6 +614,15 @@
|
|||||||
<ClCompile Include="Emu\Memory\vm.cpp">
|
<ClCompile Include="Emu\Memory\vm.cpp">
|
||||||
<Filter>Emu\Memory</Filter>
|
<Filter>Emu\Memory</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Emu\SysCalls\Modules\cellMouse.cpp">
|
||||||
|
<Filter>Emu\SysCalls\Modules</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Emu\SysCalls\Modules\cellKb.cpp">
|
||||||
|
<Filter>Emu\SysCalls\Modules</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Emu\SysCalls\Modules\cellPad.cpp">
|
||||||
|
<Filter>Emu\SysCalls\Modules</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Crypto\aes.h">
|
<ClInclude Include="Crypto\aes.h">
|
||||||
@ -1159,12 +1159,6 @@
|
|||||||
<ClInclude Include="Emu\SysCalls\Modules\cellFiber.h">
|
<ClInclude Include="Emu\SysCalls\Modules\cellFiber.h">
|
||||||
<Filter>Emu\SysCalls\Modules</Filter>
|
<Filter>Emu\SysCalls\Modules</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\SC_Keyboard.h">
|
|
||||||
<Filter>Emu\SysCalls\Modules</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\SC_Mouse.h">
|
|
||||||
<Filter>Emu\SysCalls\Modules</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\Utilities\MTRingbuffer.h">
|
<ClInclude Include="..\Utilities\MTRingbuffer.h">
|
||||||
<Filter>Utilities</Filter>
|
<Filter>Utilities</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -1201,5 +1195,14 @@
|
|||||||
<ClInclude Include="Emu\Memory\vm_var.h">
|
<ClInclude Include="Emu\Memory\vm_var.h">
|
||||||
<Filter>Emu\Memory</Filter>
|
<Filter>Emu\Memory</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Emu\SysCalls\Modules\cellPad.h">
|
||||||
|
<Filter>Emu\SysCalls\Modules</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Emu\SysCalls\Modules\cellKb.h">
|
||||||
|
<Filter>Emu\SysCalls\Modules</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Emu\SysCalls\Modules\cellMouse.h">
|
||||||
|
<Filter>Emu\SysCalls\Modules</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
x
Reference in New Issue
Block a user