mem_bptr_t replaced

This commit is contained in:
Nekotekina 2014-09-02 02:22:13 +04:00
parent 37da5589e4
commit 9c94a6943d
9 changed files with 107 additions and 54 deletions

View file

@ -650,9 +650,6 @@ public:
template<typename NT> operator const mem_ptr_t<NT, 1, AT>&() const { return (const mem_ptr_t<NT, 1, AT>&)*this; } template<typename NT> operator const mem_ptr_t<NT, 1, AT>&() const { return (const mem_ptr_t<NT, 1, AT>&)*this; }
}; };
template<typename T, int lvl = 1, typename AT = u32>
class mem_beptr_t : public mem_ptr_t<T, lvl, be_t<AT>> {};
template<typename T, typename AT = u32> class mem_t : public mem_base_t<T, AT> template<typename T, typename AT = u32> class mem_t : public mem_base_t<T, AT>
{ {
public: public:

View file

@ -314,7 +314,7 @@ namespace vm
namespace ps3 namespace ps3
{ {
template<typename T, int lvl, typename AT> class ptr; template<typename T, int lvl, typename AT> struct ptr;
} }
template<typename AT, typename RT, typename ...T> template<typename AT, typename RT, typename ...T>
@ -413,32 +413,88 @@ namespace vm
}; };
//BE pointer to LE data //BE pointer to LE data
template<typename T, int lvl = 1, typename AT = u32> class bptrl : public _ptr_base<T, lvl, typename to_be_t<AT>::type> {}; template<typename T, int lvl = 1, typename AT = u32> struct bptrl : public _ptr_base<T, lvl, typename to_be_t<AT>::type>
{
static bptrl make(AT addr)
{
return (bptrl&)addr;
}
using _ptr_base<T, lvl, typename to_be_t<AT>::type>::operator=;
};
//BE pointer to BE data //BE pointer to BE data
template<typename T, int lvl = 1, typename AT = u32> class bptrb : public _ptr_base<typename to_be_t<T>::type, lvl, typename to_be_t<AT>::type> {}; template<typename T, int lvl = 1, typename AT = u32> struct bptrb : public _ptr_base<typename to_be_t<T>::type, lvl, typename to_be_t<AT>::type>
{
static bptrb make(AT addr)
{
return (bptrb&)addr;
}
using _ptr_base<typename to_be_t<T>::type, lvl, typename to_be_t<AT>::type>::operator=;
};
//LE pointer to BE data //LE pointer to BE data
template<typename T, int lvl = 1, typename AT = u32> class lptrb : public _ptr_base<typename to_be_t<T>::type, lvl, AT> {}; template<typename T, int lvl = 1, typename AT = u32> struct lptrb : public _ptr_base<typename to_be_t<T>::type, lvl, AT>
{
static lptrb make(AT addr)
{
return (lptrb&)addr;
}
using _ptr_base<typename to_be_t<T>::type, lvl, AT>::operator=;
};
//LE pointer to LE data //LE pointer to LE data
template<typename T, int lvl = 1, typename AT = u32> class lptrl : public _ptr_base<T, lvl, AT> {}; template<typename T, int lvl = 1, typename AT = u32> struct lptrl : public _ptr_base<T, lvl, AT>
{
static lptrl make(AT addr)
{
return (lptrl&)addr;
}
using _ptr_base<T, lvl, AT>::operator=;
};
namespace ps3 namespace ps3
{ {
//default pointer for HLE functions (LE ptrerence to BE data) //default pointer for HLE functions (LE ptrerence to BE data)
template<typename T, int lvl = 1, typename AT = u32> class ptr : public lptrb<T, lvl, AT> template<typename T, int lvl = 1, typename AT = u32> struct ptr : public lptrb<T, lvl, AT>
{ {
public:
static ptr make(AT addr) static ptr make(AT addr)
{ {
return (ptr&)addr; return (ptr&)addr;
} }
using lptrb<T, lvl, AT>::operator=;
}; };
//default pointer for HLE structures (BE ptrerence to BE data) //default pointer for HLE structures (BE ptrerence to BE data)
template<typename T, int lvl = 1, typename AT = u32> class bptr : public bptrb<T, lvl, AT> {}; template<typename T, int lvl = 1, typename AT = u32> struct bptr : public bptrb<T, lvl, AT>
{
static bptr make(AT addr)
{
return (bptr&)addr;
}
using bptrb<T, lvl, AT>::operator=;
};
} }
namespace psv namespace psv
{ {
//default pointer for HLE functions & structures (LE ptrerence to LE data) //default pointer for HLE functions & structures (LE ptrerence to LE data)
template<typename T, int lvl = 1, typename AT = u32> class ptr : public lptrl<T, lvl, AT> {}; template<typename T, int lvl = 1, typename AT = u32> struct ptr : public lptrl<T, lvl, AT>
{
static ptr make(AT addr)
{
return (ptr&)addr;
}
using lptrl<T, lvl, AT>::operator=;
};
} }
//PS3 emulation is main now, so lets it be as default //PS3 emulation is main now, so lets it be as default
using namespace ps3; using namespace ps3;
} }

View file

@ -267,10 +267,10 @@ int cellGameDataCheckCreate2(u32 version, vm::ptr<const char> dirName, u32 errDi
funcStat(cbResult, cbGet, cbSet); funcStat(cbResult, cbGet, cbSet);
if (cbSet->setParam.GetAddr()) if (cbSet->setParam)
{ {
// TODO: write PARAM.SFO from cbSet // TODO: write PARAM.SFO from cbSet
cellGame->Todo("cellGameDataCheckCreate2(): writing PARAM.SFO parameters (addr=0x%x)", cbSet->setParam.GetAddr()); cellGame->Todo("cellGameDataCheckCreate2(): writing PARAM.SFO parameters (addr=0x%x)", cbSet->setParam.addr());
} }
switch ((s32)cbResult->result) switch ((s32)cbResult->result)

View file

@ -197,6 +197,6 @@ struct CellGameDataStatGet
struct CellGameDataStatSet struct CellGameDataStatSet
{ {
mem_beptr_t<CellGameDataSystemFileParam> setParam; vm::bptr<CellGameDataSystemFileParam> setParam;
be_t<u32> reserved; be_t<u32> reserved;
}; };

View file

@ -202,7 +202,7 @@ struct CellHddGameStatGet
struct CellHddGameStatSet struct CellHddGameStatSet
{ {
mem_beptr_t<CellHddGameSystemFileParam> setParam; vm::bptr<CellHddGameSystemFileParam> setParam;
be_t<u32> reserved_addr; // void* be_t<u32> reserved_addr; // void*
}; };

View file

@ -145,7 +145,7 @@ void setSaveDataFixed(std::vector<SaveDataEntry>& saveEntries, mem_ptr_t<CellSav
saveEntries.push_back(entry); saveEntries.push_back(entry);
} }
if (fixedSet->newIcon.GetAddr()) if (fixedSet->newIcon)
{ {
saveEntries[0].iconBuf = Memory.VirtualToRealAddr(fixedSet->newIcon->iconBuf_addr); saveEntries[0].iconBuf = Memory.VirtualToRealAddr(fixedSet->newIcon->iconBuf_addr);
saveEntries[0].iconBufSize = fixedSet->newIcon->iconBufSize; saveEntries[0].iconBufSize = fixedSet->newIcon->iconBufSize;
@ -177,7 +177,7 @@ void getSaveDataStat(SaveDataEntry entry, mem_ptr_t<CellSaveDataStatGet> statGet
memcpy(statGet->getParam.listParam, entry.listParam.c_str(), CELL_SAVEDATA_SYSP_LPARAM_SIZE); memcpy(statGet->getParam.listParam, entry.listParam.c_str(), CELL_SAVEDATA_SYSP_LPARAM_SIZE);
statGet->fileNum = 0; statGet->fileNum = 0;
statGet->fileList.SetAddr(be_t<u32>::MakeFromBE(0)); statGet->fileList = vm::bptr<CellSaveDataFileStat>::make(0);
statGet->fileListNum = 0; statGet->fileListNum = 0;
std::string saveDir = "/dev_hdd0/home/00000001/savedata/" + entry.dirName; // TODO: Get the path of the current user std::string saveDir = "/dev_hdd0/home/00000001/savedata/" + entry.dirName; // TODO: Get the path of the current user
vfsDir dir(saveDir); vfsDir dir(saveDir);
@ -209,7 +209,7 @@ void getSaveDataStat(SaveDataEntry entry, mem_ptr_t<CellSaveDataStatGet> statGet
} }
} }
statGet->fileList.SetAddr(be_t<u32>::MakeFromLE((u32)Memory.Alloc(sizeof(CellSaveDataFileStat) * (u32)fileEntries.size(), sizeof(CellSaveDataFileStat)))); statGet->fileList = vm::bptr<CellSaveDataFileStat>::make(be_t<u32>::MakeFromLE((u32)Memory.Alloc(sizeof(CellSaveDataFileStat) * (u32)fileEntries.size(), sizeof(CellSaveDataFileStat))));
for (u32 i=0; i<fileEntries.size(); i++) for (u32 i=0; i<fileEntries.size(); i++)
memcpy(&statGet->fileList[i], &fileEntries[i], sizeof(CellSaveDataFileStat)); memcpy(&statGet->fileList[i], &fileEntries[i], sizeof(CellSaveDataFileStat));
} }
@ -325,8 +325,8 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
// Sort the entries and fill the listGet->dirList array // Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr); listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr()); CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
for (u32 i=0; i<saveEntries.size(); i++) { for (u32 i=0; i<saveEntries.size(); i++) {
memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE); memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE);
@ -340,9 +340,9 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
setSaveDataList(saveEntries, (u32)listSet->fixedList.GetAddr(), listSet->fixedListNum); setSaveDataList(saveEntries, (u32)listSet->fixedList.addr(), listSet->fixedListNum);
if (listSet->newData.GetAddr()) if (listSet->newData)
addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr()); addNewSaveDataEntry(saveEntries, (u32)listSet->newData.addr());
if (saveEntries.size() == 0) { if (saveEntries.size() == 0) {
cellSysutil->Warning("cellSaveDataListSave2: No save entries found!"); // TODO: Find a better way to handle this error cellSysutil->Warning("cellSaveDataListSave2: No save entries found!"); // TODO: Find a better way to handle this error
return CELL_SAVEDATA_RET_OK; return CELL_SAVEDATA_RET_OK;
@ -355,7 +355,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
result->userdata_addr = userdata_addr; result->userdata_addr = userdata_addr;
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.GetAddr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil->Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
@ -410,8 +410,8 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
// Sort the entries and fill the listGet->dirList array // Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr); listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr()); CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
for (u32 i=0; i<saveEntries.size(); i++) { for (u32 i=0; i<saveEntries.size(); i++) {
memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE); memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE);
@ -425,9 +425,9 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
} }
setSaveDataList(saveEntries, (u32)listSet->fixedList.GetAddr(), listSet->fixedListNum); setSaveDataList(saveEntries, (u32)listSet->fixedList.addr(), listSet->fixedListNum);
if (listSet->newData.GetAddr()) if (listSet->newData)
addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr()); addNewSaveDataEntry(saveEntries, (u32)listSet->newData.addr());
if (saveEntries.size() == 0) { if (saveEntries.size() == 0) {
cellSysutil->Warning("cellSaveDataListLoad2: No save entries found!"); // TODO: Find a better way to handle this error cellSysutil->Warning("cellSaveDataListLoad2: No save entries found!"); // TODO: Find a better way to handle this error
return CELL_SAVEDATA_RET_OK; return CELL_SAVEDATA_RET_OK;
@ -440,7 +440,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
result->userdata_addr = userdata_addr; result->userdata_addr = userdata_addr;
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.GetAddr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil->Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
@ -493,8 +493,8 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
// Sort the entries and fill the listGet->dirList array // Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr); listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr()); CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
for (u32 i = 0; i<saveEntries.size(); i++) { for (u32 i = 0; i<saveEntries.size(); i++) {
memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE); memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE);
memcpy(dirList[i].listParam, saveEntries[i].listParam.c_str(), CELL_SAVEDATA_SYSP_LPARAM_SIZE); memcpy(dirList[i].listParam, saveEntries[i].listParam.c_str(), CELL_SAVEDATA_SYSP_LPARAM_SIZE);
@ -510,7 +510,7 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
result->userdata_addr = userdata_addr; result->userdata_addr = userdata_addr;
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.GetAddr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataFixedSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil->Error("cellSaveDataFixedSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
@ -562,8 +562,8 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
// Sort the entries and fill the listGet->dirList array // Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr); listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr()); CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
for (u32 i = 0; i<saveEntries.size(); i++) { for (u32 i = 0; i<saveEntries.size(); i++) {
memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE); memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE);
memcpy(dirList[i].listParam, saveEntries[i].listParam.c_str(), CELL_SAVEDATA_SYSP_LPARAM_SIZE); memcpy(dirList[i].listParam, saveEntries[i].listParam.c_str(), CELL_SAVEDATA_SYSP_LPARAM_SIZE);
@ -579,7 +579,7 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
result->userdata_addr = userdata_addr; result->userdata_addr = userdata_addr;
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.GetAddr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil->Error("cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
@ -632,7 +632,7 @@ int cellSaveDataAutoSave2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
result->userdata_addr = userdata_addr; result->userdata_addr = userdata_addr;
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.GetAddr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataAutoSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil->Error("cellSaveDataAutoSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
@ -682,7 +682,7 @@ int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
result->userdata_addr = userdata_addr; result->userdata_addr = userdata_addr;
funcStat(result, statGet, statSet); funcStat(result, statGet, statSet);
Memory.Free(statGet->fileList.GetAddr()); Memory.Free(statGet->fileList.addr());
if (result->result < 0) { if (result->result < 0) {
cellSysutil->Error("cellSaveDataAutoLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. cellSysutil->Error("cellSaveDataAutoLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT; return CELL_SAVEDATA_ERROR_CBRESULT;
@ -735,8 +735,8 @@ int cellSaveDataListAutoSave(u32 version, u32 errDialog, mem_ptr_t<CellSaveDataS
// Sort the entries and fill the listGet->dirList array // Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr); listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr()); CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
for (u32 i = 0; i<saveEntries.size(); i++) { for (u32 i = 0; i<saveEntries.size(); i++) {
memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE); memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE);
@ -820,8 +820,8 @@ int cellSaveDataListAutoLoad(u32 version, u32 errDialog, mem_ptr_t<CellSaveDataS
// Sort the entries and fill the listGet->dirList array // Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder)); std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr); listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr()); CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
for (u32 i = 0; i<saveEntries.size(); i++) { for (u32 i = 0; i<saveEntries.size(); i++) {
memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE); memcpy(dirList[i].dirName, saveEntries[i].dirName.c_str(), CELL_SAVEDATA_DIRNAME_SIZE);

View file

@ -116,7 +116,7 @@ struct CellSaveDataListNewData
{ {
be_t<u32> iconPosition; be_t<u32> iconPosition;
be_t<u32> dirName_addr; // char* be_t<u32> dirName_addr; // char*
mem_beptr_t<CellSaveDataNewDataIcon> icon; vm::bptr<CellSaveDataNewDataIcon> icon;
}; };
struct CellSaveDataDirList struct CellSaveDataDirList
@ -129,7 +129,7 @@ struct CellSaveDataListGet
{ {
be_t<u32> dirNum; be_t<u32> dirNum;
be_t<u32> dirListNum; be_t<u32> dirListNum;
mem_beptr_t<CellSaveDataDirList> dirList; vm::bptr<CellSaveDataDirList> dirList;
}; };
struct CellSaveDataListSet struct CellSaveDataListSet
@ -137,15 +137,15 @@ struct CellSaveDataListSet
be_t<u32> focusPosition; be_t<u32> focusPosition;
be_t<u32> focusDirName_addr; // char* be_t<u32> focusDirName_addr; // char*
be_t<u32> fixedListNum; be_t<u32> fixedListNum;
mem_beptr_t<CellSaveDataDirList> fixedList; vm::bptr<CellSaveDataDirList> fixedList;
mem_beptr_t<CellSaveDataListNewData> newData; vm::bptr<CellSaveDataListNewData> newData;
be_t<u32> reserved_addr; // void* be_t<u32> reserved_addr; // void*
}; };
struct CellSaveDataFixedSet struct CellSaveDataFixedSet
{ {
be_t<u32> dirName_addr; // char* be_t<u32> dirName_addr; // char*
mem_beptr_t<CellSaveDataNewDataIcon> newIcon; vm::bptr<CellSaveDataNewDataIcon> newIcon;
be_t<u32> option; be_t<u32> option;
}; };
@ -191,7 +191,7 @@ struct CellSaveDataStatGet
be_t<s32> sysSizeKB; be_t<s32> sysSizeKB;
be_t<u32> fileNum; be_t<u32> fileNum;
be_t<u32> fileListNum; be_t<u32> fileListNum;
mem_beptr_t<CellSaveDataFileStat> fileList; vm::bptr<CellSaveDataFileStat> fileList;
}; };
struct CellSaveDataAutoIndicator struct CellSaveDataAutoIndicator
@ -205,9 +205,9 @@ struct CellSaveDataAutoIndicator
struct CellSaveDataStatSet struct CellSaveDataStatSet
{ {
mem_beptr_t<CellSaveDataSystemFileParam> setParam; vm::bptr<CellSaveDataSystemFileParam> setParam;
be_t<u32> reCreateMode; be_t<u32> reCreateMode;
mem_beptr_t<CellSaveDataAutoIndicator> indicator; vm::bptr<CellSaveDataAutoIndicator> indicator;
}; };
struct CellSaveDataFileGet struct CellSaveDataFileGet

View file

@ -11,7 +11,7 @@
SysCallBase sys_semaphore("sys_semaphore"); SysCallBase sys_semaphore("sys_semaphore");
s32 sys_semaphore_create(vm::ref<u32> sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count) s32 sys_semaphore_create(vm::ptr<be_t<u32>> sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count)
{ {
sys_semaphore.Warning("sys_semaphore_create(sem_addr=0x%x, attr_addr=0x%x, initial_count=%d, max_count=%d)", sys_semaphore.Warning("sys_semaphore_create(sem_addr=0x%x, attr_addr=0x%x, initial_count=%d, max_count=%d)",
sem.addr(), attr.GetAddr(), initial_count, max_count); sem.addr(), attr.GetAddr(), initial_count, max_count);
@ -38,7 +38,7 @@ s32 sys_semaphore_create(vm::ref<u32> sem, mem_ptr_t<sys_semaphore_attribute> at
} }
u32 id = sys_semaphore.GetNewId(new Semaphore(initial_count, max_count, attr->protocol, attr->name_u64), TYPE_SEMAPHORE); u32 id = sys_semaphore.GetNewId(new Semaphore(initial_count, max_count, attr->protocol, attr->name_u64), TYPE_SEMAPHORE);
sem = id; *sem = id;
sys_semaphore.Notice("*** semaphore created [%s] (protocol=0x%x): id = %d", sys_semaphore.Notice("*** semaphore created [%s] (protocol=0x%x): id = %d",
std::string(attr->name, 8).c_str(), (u32)attr->protocol, id); std::string(attr->name, 8).c_str(), (u32)attr->protocol, id);

View file

@ -38,7 +38,7 @@ struct Semaphore
}; };
// SysCalls // SysCalls
s32 sys_semaphore_create(vm::ref<u32> sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count); s32 sys_semaphore_create(vm::ptr<be_t<u32>> sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count);
s32 sys_semaphore_destroy(u32 sem_id); s32 sys_semaphore_destroy(u32 sem_id);
s32 sys_semaphore_wait(u32 sem_id, u64 timeout); s32 sys_semaphore_wait(u32 sem_id, u64 timeout);
s32 sys_semaphore_trywait(u32 sem_id); s32 sys_semaphore_trywait(u32 sem_id);