This commit is contained in:
Nekotekina 2014-08-24 02:20:05 +04:00
commit 7c7782cd4c
9 changed files with 785 additions and 42 deletions

View file

@ -25,24 +25,28 @@ int cellNetCtlGetState(mem32_t state)
cellNetCtl->Log("cellNetCtlGetState(state_addr=0x%x)", state.GetAddr());
state = CELL_NET_CTL_STATE_Disconnected; // TODO: Allow other states
return CELL_OK;
}
int cellNetCtlAddHandler()
int cellNetCtlAddHandler(mem_ptr_t<cellNetCtlHandler> handler, mem32_t arg, s32 hid)
{
UNIMPLEMENTED_FUNC(cellNetCtl);
cellNetCtl->Todo("cellNetCtlAddHandler(handler_addr=0x%x, arg_addr=0x%x, hid=%x)", handler.GetAddr(), arg.GetAddr(), hid);
return CELL_OK;
}
int cellNetCtlDelHandler()
int cellNetCtlDelHandler(s32 hid)
{
UNIMPLEMENTED_FUNC(cellNetCtl);
cellNetCtl->Todo("cellNetCtlDelHandler(hid=%x)", hid);
return CELL_OK;
}
int cellNetCtlGetInfo()
int cellNetCtlGetInfo(s32 code, mem_ptr_t<CellNetCtlInfo> info)
{
UNIMPLEMENTED_FUNC(cellNetCtl);
cellNetCtl->Todo("cellNetCtlGetInfo(code=%x, info_addr=0x%x)", code, info.GetAddr());
return CELL_OK;
}
@ -55,7 +59,8 @@ int cellNetCtlNetStartDialogLoadAsync(mem_ptr_t<CellNetCtlNetStartDialogParam> p
int cellNetCtlNetStartDialogAbortAsync()
{
UNIMPLEMENTED_FUNC(cellNetCtl);
cellNetCtl->Todo("cellNetCtlNetStartDialogAbortAsync()");
return CELL_OK;
}

View file

@ -207,7 +207,7 @@ struct CellNetCtlSSID
u8 padding[3];
};
struct CellNetCtlInfo
union CellNetCtlInfo
{
be_t<u32> device;
CellNetCtlEtherAddr ether_addr;
@ -255,4 +255,6 @@ struct CellNetCtlNatInfo
be_t<s32> stun_status;
be_t<s32> nat_type;
be_t<u32> mapped_addr;
};
};
typedef void(cellNetCtlHandler)(s32 prev_state, s32 new_state, s32 event, s32 error_code, mem32_t arg);

View file

@ -1,7 +1,9 @@
#include "stdafx.h"
#include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h"
#include "Emu/SysCalls/lv2/sys_cond.h"
#include "Emu/SysCalls/lv2/sys_mutex.h"
#include "cellSpurs.h"
#include "cellSail.h"
Module *cellSail = nullptr;

View file

@ -3,16 +3,579 @@
// Error Codes
enum
{
CELL_SAIL_ERROR_INVALID_ARG = 0x80610701,
CELL_SAIL_ERROR_INVALID_STATE = 0x80610702,
CELL_SAIL_ERROR_INVALID_ARG = 0x80610701,
CELL_SAIL_ERROR_INVALID_STATE = 0x80610702,
CELL_SAIL_ERROR_UNSUPPORTED_STREAM = 0x80610703,
CELL_SAIL_ERROR_INDEX_OUT_OF_RANGE = 0x80610704,
CELL_SAIL_ERROR_EMPTY = 0x80610705,
CELL_SAIL_ERROR_FULLED = 0x80610706,
CELL_SAIL_ERROR_USING = 0x80610707,
CELL_SAIL_ERROR_NOT_AVAILABLE = 0x80610708,
CELL_SAIL_ERROR_CANCEL = 0x80610709,
CELL_SAIL_ERROR_MEMORY = 0x806107F0,
CELL_SAIL_ERROR_INVALID_FD = 0x806107F1,
CELL_SAIL_ERROR_FATAL = 0x806107FF,
CELL_SAIL_ERROR_EMPTY = 0x80610705,
CELL_SAIL_ERROR_FULLED = 0x80610706,
CELL_SAIL_ERROR_USING = 0x80610707,
CELL_SAIL_ERROR_NOT_AVAILABLE = 0x80610708,
CELL_SAIL_ERROR_CANCEL = 0x80610709,
CELL_SAIL_ERROR_MEMORY = 0x806107F0,
CELL_SAIL_ERROR_INVALID_FD = 0x806107F1,
CELL_SAIL_ERROR_FATAL = 0x806107FF,
};
struct CellSailAudioFormat
{
s8 coding;
s8 chNum;
be_t<s16> sampleNum;
be_t<s32> fs;
be_t<s32> chLayout;
be_t<s32> reserved0; // Specify both -1
be_t<s64> reserved1;
};
struct CellSailAudioFrameInfo
{
be_t<u32> pPcm;
be_t<s32> status;
be_t<u64> pts;
be_t<u64> reserved; // Specify 0
};
struct CellSailVideoFormat
{
s8 coding;
s8 scan;
s8 bitsPerColor;
s8 frameRate;
be_t<s16> width;
be_t<s16> height;
be_t<s32> pitch;
be_t<s32> alpha;
s8 colorMatrix;
s8 aspectRatio;
s8 colorRange;
s8 reserved1; // Specify all three -1
be_t<s32> reserved2;
be_t<s64> reserved3;
};
struct CellSailVideoFrameInfo
{
be_t<u32> pPic;
be_t<s32> status;
be_t<u64> pts;
be_t<u64> reserved; // Specify both 0
be_t<u16> interval;
u8 structure;
s8 repeatNum;
u8 reserved2[4];
};
struct CellSailSourceBufferItem
{
u8 pBuf;
be_t<u32> size;
be_t<u32> sessionId;
be_t<u32> reserved; // Specify 0
};
struct CellSailSourceStartCommand
{
be_t<u64> startFlags;
be_t<s64> startArg;
be_t<s64> lengthArg;
be_t<u64> optionalArg0;
be_t<u64> optionalArg1;
};
struct CellSailSourceStreamingProfile
{
be_t<u32> reserved0; // Specify 0
be_t<u32> numItems;
be_t<u32> maxBitrate;
be_t<u32> reserved1; // Specify 0
be_t<u64> duration;
be_t<u64> streamSize;
};
union CellSailEvent
{
struct u32x2 {
be_t<u32> major;
be_t<u32> minor;
};
struct ui64 {
be_t<u64> value;
};
};
typedef void(*CellSailMemAllocatorFuncAlloc)(u32 pArg, u32 boundary, u32 size);
typedef void(*CellSailMemAllocatorFuncFree)(u32 pArg, u32 boundary, u32 pMemory);
typedef int(*CellSailSoundAdapterFuncMakeup)(u32 pArg);
typedef int(*CellSailSoundAdapterFuncCleanup)(u32 pArg);
typedef void(*CellSailSoundAdapterFuncFormatChanged)(u32 pArg, mem_ptr_t<CellSailAudioFormat> pFormat, u32 sessionId);
typedef int(*CellSailGraphicsAdapterFuncMakeup)(u32 pArg);
typedef int(*CellSailGraphicsAdapterFuncCleanup)(u32 pArg);
typedef void(*CellSailGraphicsAdapterFuncFormatChanged)(u32 pArg, mem_ptr_t<CellSailVideoFormat> pFormat, u32 sessionId);
typedef int(*CellSailGraphicsAdapterFuncAllocFrame)(u32 pArg, u32 size, s32 num, u8 ppFrame);
typedef int(*CellSailGraphicsAdapterFuncFreeFrame)(u32 pArg, s32 num, u8 ppFrame);
typedef int(*CellSailSourceFuncMakeup)(u32 pArg, s8 pProtocolNames);
typedef int(*CellSailSourceFuncCleanup)(u32 pArg);
typedef void(*CellSailSourceFuncOpen)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, mem_ptr_t<CellSailSourceStreamingProfile> pProfile);
typedef void(*CellSailSourceFuncClose)(u32 pArg);
typedef void(*CellSailSourceFuncStart)(u32 pArg, mem_ptr_t<CellSailSourceStartCommand> pCommand, u32 sessionId);
typedef void(*CellSailSourceFuncStop)(u32 pArg);
typedef void(*CellSailSourceFuncCancel)(u32 pArg);
typedef int(*CellSailSourceFuncCheckout)(u32 pArg, mem_ptr_t<CellSailSourceBufferItem> ppItem);
typedef int(*CellSailSourceFuncCheckin)(u32 pArg, mem_ptr_t<CellSailSourceBufferItem> pItem);
typedef int(*CellSailSourceFuncClear)(u32 pArg);
typedef int(*CellSailSourceFuncRead)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, u64 offset, u8 pBuf, u32 size, u64 pTotalSize);
typedef int(*CellSailSourceFuncReadSync)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, u64 offset, u8 pBuf, u32 size, u64 pTotalSize);
typedef int(*CellSailSourceFuncGetCapabilities)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, u64 pCapabilities);
typedef int(*CellSailSourceFuncInquireCapability)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, mem_ptr_t<CellSailSourceStartCommand> pCommand);
typedef void(*CellSailSourceCheckFuncError)(u32 pArg, s8 pMsg, s32 line);
typedef int(*CellSailFsFuncOpen)(s8 pPath, s32 flag, s32 pFd, u32 pArg, u64 size);
typedef int(*CellSailFsFuncOpenSecond)(s8 pPath, s32 flag, s32 fd, u32 pArg, u64 size);
typedef int(*CellSailFsFuncClose)(s32 fd);
typedef int(*CellSailFsFuncFstat)(s32 fd, mem_ptr_t<CellFsStat> pStat);
typedef int(*CellSailFsFuncRead)(s32 fd, u32 pBuf, u64 numBytes, u64 pNumRead);
typedef int(*CellSailFsFuncLseek)(s32 fd, s64 offset, s32 whence, u64 pPosition);
typedef int(*CellSailFsFuncCancel)(s32 fd);
typedef int(*CellSailRendererAudioFuncMakeup)(u32 pArg);
typedef int(*CellSailRendererAudioFuncCleanup)(u32 pArg);
typedef void(*CellSailRendererAudioFuncOpen)(u32 pArg, mem_ptr_t<CellSailAudioFormat> pInfo, u32 frameNum);
typedef void(*CellSailRendererAudioFuncClose)(u32 pArg);
typedef void(*CellSailRendererAudioFuncStart)(u32 pArg, bool buffering);
typedef void(*CellSailRendererAudioFuncStop)(u32 pArg, bool flush);
typedef void(*CellSailRendererAudioFuncCancel)(u32 pArg);
typedef int(*CellSailRendererAudioFuncCheckout)(u32 pArg, mem_ptr_t<CellSailAudioFrameInfo> ppInfo);
typedef int(*CellSailRendererAudioFuncCheckin)(u32 pArg, mem_ptr_t<CellSailAudioFrameInfo> pInfo);
typedef int(*CellSailRendererVideoFuncMakeup)(u32 pArg);
typedef int(*CellSailRendererVideoFuncCleanup)(u32 pArg);
typedef void(*CellSailRendererVideoFuncOpen)(u32 pArg, mem_ptr_t<CellSailVideoFormat> pInfo, u32 frameNum, u32 minFrameNum);
typedef void(*CellSailRendererVideoFuncClose)(u32 pArg);
typedef void(*CellSailRendererVideoFuncStart)(u32 pArg, bool buffering);
typedef void(*CellSailRendererVideoFuncStop)(u32 pArg, bool flush, bool keepRendering);
typedef void(*CellSailRendererVideoFuncCancel)(u32 pArg);
typedef int(*CellSailRendererVideoFuncCheckout)(u32 pArg, mem_ptr_t<CellSailVideoFrameInfo> ppInfo);
typedef int(*CellSailRendererVideoFuncCheckin)(u32 pArg, mem_ptr_t<CellSailVideoFrameInfo> pInfo);
typedef void(*CellSailPlayerFuncNotified)(u32 pArg, mem_ptr_t<CellSailEvent> event, u64 arg0, u64 arg1);
struct CellSailMemAllocatorFuncs
{
CellSailMemAllocatorFuncAlloc pAlloc;
CellSailMemAllocatorFuncFree pFree;
};
struct CellSailMemAllocator
{
CellSailMemAllocatorFuncs callbacks;
be_t<u32> pArg;
};
struct CellSailFuture
{
u32 mutex_id;
u32 cond_id;
volatile be_t<u32> flags;
be_t<s32> result;
be_t<u64> userParam;
};
struct CellSailSoundAdapterFuncs
{
CellSailSoundAdapterFuncMakeup pMakeup;
CellSailSoundAdapterFuncCleanup pCleanup;
CellSailSoundAdapterFuncFormatChanged pFormatChanged;
};
struct CellSailSoundFrameInfo
{
be_t<u32> pBuffer;
be_t<u32> sessionId;
be_t<u32> tag;
be_t<s32> status;
be_t<u64> pts;
};
struct CellSailSoundAdapter
{
be_t<u64> internalData[32];
};
struct CellSailGraphicsAdapterFuncs
{
CellSailGraphicsAdapterFuncMakeup pMakeup;
CellSailGraphicsAdapterFuncCleanup pCleanup;
CellSailGraphicsAdapterFuncFormatChanged pFormatChanged;
CellSailGraphicsAdapterFuncAllocFrame pAlloc;
CellSailGraphicsAdapterFuncFreeFrame pFree;
};
struct CellSailGraphicsFrameInfo
{
be_t<u32> pBuffer;
be_t<u32> sessionId;
be_t<u32> tag;
be_t<s32> status;
be_t<u64> pts;
};
struct CellSailGraphicsAdapter
{
be_t<u64> internalData[32];
};
struct CellSailAuInfo
{
be_t<u32> pAu;
be_t<u32> size;
be_t<s32> status;
be_t<u32> sessionId;
be_t<u64> pts;
be_t<u64> dts;
be_t<u64> reserved; // Specify 0
};
struct CellSailAuReceiver
{
be_t<u64> internalData[64];
};
struct CellSailRendererAudioFuncs
{
CellSailRendererAudioFuncMakeup pMakeup;
CellSailRendererAudioFuncCleanup pCleanup;
CellSailRendererAudioFuncOpen pOpen;
CellSailRendererAudioFuncClose pClose;
CellSailRendererAudioFuncStart pStart;
CellSailRendererAudioFuncStop pStop;
CellSailRendererAudioFuncCancel pCancel;
CellSailRendererAudioFuncCheckout pCheckout;
CellSailRendererAudioFuncCheckin pCheckin;
};
struct CellSailRendererAudioAttribute
{
be_t<u32> thisSize;
CellSailAudioFormat pPreferredFormat;
};
struct CellSailRendererAudio
{
be_t<u64> internalData[32];
};
struct CellSailRendererVideoFuncs
{
CellSailRendererVideoFuncMakeup pMakeup;
CellSailRendererVideoFuncCleanup pCleanup;
CellSailRendererVideoFuncOpen pOpen;
CellSailRendererVideoFuncClose pClose;
CellSailRendererVideoFuncStart pStart;
CellSailRendererVideoFuncStop pStop;
CellSailRendererVideoFuncCancel pCancel;
CellSailRendererVideoFuncCheckout pCheckout;
CellSailRendererVideoFuncCheckin pCheckin;
};
struct CellSailRendererVideoAttribute
{
be_t<u32> thisSize;
CellSailVideoFormat *pPreferredFormat;
};
struct CellSailRendererVideo
{
be_t<u64> internalData[32];
};
struct CellSailSourceFuncs
{
CellSailSourceFuncMakeup pMakeup;
CellSailSourceFuncCleanup pCleanup;
CellSailSourceFuncOpen pOpen;
CellSailSourceFuncClose pClose;
CellSailSourceFuncStart pStart;
CellSailSourceFuncStop pStop;
CellSailSourceFuncCancel pCancel;
CellSailSourceFuncCheckout pCheckout;
CellSailSourceFuncCheckin pCheckin;
CellSailSourceFuncClear pClear;
CellSailSourceFuncRead pRead;
CellSailSourceFuncReadSync pReadSync;
CellSailSourceFuncGetCapabilities pGetCapabilities;
CellSailSourceFuncInquireCapability pInquireCapability;
};
struct CellSailSource
{
be_t<u64> internalData[20];
};
struct CellSailSourceCheckStream
{
be_t<s32> streamType;
be_t<u32> pMediaInfo;
s8 pUri;
};
struct CellSailSourceCheckResource
{
CellSailSourceCheckStream ok;
CellSailSourceCheckStream readError;
CellSailSourceCheckStream openError;
CellSailSourceCheckStream startError;
CellSailSourceCheckStream runningError;
};
struct CellSailMp4DateTime
{
be_t<u16> second;
be_t<u16> minute;
be_t<u16> hour;
be_t<u16> day;
be_t<u16> month;
be_t<u16> year;
//be_t<u16> reserved0;
//be_t<u16> reserved1;
};
struct CellSailMp4Movie
{
be_t<u64> internalData[16];
};
struct CellSailMp4MovieInfo
{
CellSailMp4DateTime creationDateTime;
CellSailMp4DateTime modificationDateTime;
be_t<u32> trackCount;
be_t<u32> movieTimeScale;
be_t<u32> movieDuration;
//be_t<u32> reserved[16];
};
struct CellSailMp4Track
{
be_t<u64> internalData[6];
};
struct CellSailMp4TrackInfo
{
bool isTrackEnabled;
u8 reserved0[3];
be_t<u32> trackId;
be_t<u64> trackDuration;
be_t<s16> layer;
be_t<s16> alternateGroup;
be_t<u16> reserved1[2];
be_t<u32> trackWidth;
be_t<u32> trackHeight;
be_t<u16> language;
be_t<u16> reserved2;
be_t<u16> mediaType;
//be_t<u32> reserved3[3];
};
struct CellSailAviMovie
{
be_t<u64> internalData[16];
};
struct CellSailAviMovieInfo
{
be_t<u32> maxBytesPerSec;
be_t<u32> flags;
be_t<u32> reserved0;
be_t<u32> streams;
be_t<u32> suggestedBufferSize;
be_t<u32> width;
be_t<u32> height;
be_t<u32> scale;
be_t<u32> rate;
be_t<u32> length;
//be_t<u32> reserved1;
//be_t<u32> reserved2;
};
struct CellSailAviMainHeader
{
be_t<u32> microSecPerFrame;
be_t<u32> maxBytesPerSec;
be_t<u32> paddingGranularity;
be_t<u32> flags;
be_t<u32> totalFrames;
be_t<u32> initialFrames;
be_t<u32> streams;
be_t<u32> suggestedBufferSize;
be_t<u32> width;
be_t<u32> height;
//be_t<u32> reserved[4];
};
struct CellSailAviExtendedHeader
{
be_t<u32> totalFrames;
};
struct CellSailAviStream
{
be_t<u64> internalData[2];
};
struct CellSailAviMediaType
{
be_t<u32> fccType;
be_t<u32> fccHandler;
union u {
struct audio {
be_t<u16> formatTag;
be_t<u16> reserved; // Specify 0
union u {
struct mpeg {
be_t<u16> headLayer; // Specify 0
be_t<u16> reserved; // Specify 0
};
};
};
struct video {
be_t<u32> compression;
be_t<u32> reserved; // Specify 0
};
};
};
struct CellSailAviStreamHeader
{
be_t<u32> fccType;
be_t<u32> fccHandler;
be_t<u32> flags;
be_t<u16> priority;
be_t<u32> initialFrames;
be_t<u32> scale;
be_t<u32> rate;
be_t<u32> start;
be_t<u32> length;
be_t<u32> suggestedBufferSize;
be_t<u32> quality;
be_t<u32> sampleSize;
struct frame {
be_t<u16> left;
be_t<u16> top;
be_t<u16> right;
be_t<u16> bottom;
};
};
struct CellSailBitmapInfoHeader
{
be_t<u32> size;
be_t<s32> width;
be_t<s32> height;
be_t<u16> planes;
be_t<u16> bitCount;
be_t<u32> compression;
be_t<u32> sizeImage;
be_t<s32> xPelsPerMeter;
be_t<s32> yPelsPerMeter;
be_t<u32> clrUsed;
be_t<u32> clrImportant;
};
struct CellSailWaveFormatEx
{
be_t<u16> formatTag;
be_t<u16> channels;
be_t<u32> samplesPerSec;
be_t<u32> avgBytesPerSec;
be_t<u16> blockAlign;
be_t<u16> bitsPerSample;
be_t<u16> cbSize;
};
struct CellSailMpeg1WaveFormat
{
CellSailWaveFormatEx wfx;
be_t<u16> headLayer;
be_t<u32> headBitrate;
be_t<u16> headMode;
be_t<u16> headModeExt;
be_t<u16> headEmphasis;
be_t<u16> headFlags;
be_t<u32> PTSLow;
be_t<u32> PTSHigh;
};
struct CellSailMpegLayer3WaveFormat
{
CellSailWaveFormatEx wfx;
be_t<u16> ID;
be_t<u32> flags;
be_t<u16> blockSize;
be_t<u16> framesPerBlock;
be_t<u16> codecDelay;
};
struct CellSailDescriptor
{
be_t<u64> internalData[32];
};
struct CellSailStartCommand
{
be_t<u32> startType;
be_t<u32> seekType;
be_t<u32> terminusType;
be_t<u32> flags;
be_t<u32> startArg;
be_t<u32> reserved;
be_t<u64> seekArg;
be_t<u64> terminusArg;
};
struct CellSailFsReadFuncs
{
CellSailFsFuncOpen pOpen;
CellSailFsFuncOpenSecond pOpenSecond;
CellSailFsFuncClose pClose;
CellSailFsFuncFstat pFstat;
CellSailFsFuncRead pRead;
CellSailFsFuncLseek pLseek;
CellSailFsFuncCancel pCancel;
be_t<u32> reserved[2]; // Specify 0
};
struct CellSailFsRead
{
be_t<u32> capability;
CellSailFsReadFuncs funcs;
};
struct CellSailPlayerAttribute
{
be_t<s32> preset;
be_t<u32> maxAudioStreamNum;
be_t<u32> maxVideoStreamNum;
be_t<u32> maxUserStreamNum;
be_t<u32> queueDepth;
be_t<u32> reserved0; // All three specify 0
be_t<u32> reserved1;
be_t<u32> reserved2;
};
struct CellSailPlayerResource
{
CellSpurs pSpurs;
be_t<u32> reserved0; // All three specify 0
be_t<u32> reserved1;
be_t<u32> reserved2;
};
struct CellSailPlayer
{
be_t<u64> internalData[128];
};

View file

@ -889,8 +889,8 @@ void cellSysutil_init()
cellSysutil->AddFunc(0x2a8eada2, cellSaveDataFixedLoad2);
cellSysutil->AddFunc(0x8b7ed64b, cellSaveDataAutoSave2);
cellSysutil->AddFunc(0xfbd5c856, cellSaveDataAutoLoad2);
//cellSysutil->AddFunc(0x4dd03a4e, cellSaveDataListAutoSave);
//cellSysutil->AddFunc(0x21425307, cellSaveDataListAutoLoad);
cellSysutil->AddFunc(0x4dd03a4e, cellSaveDataListAutoSave);
cellSysutil->AddFunc(0x21425307, cellSaveDataListAutoLoad);
//cellSysutil->AddFunc(0xedadd797, cellSaveDataDelete2);
//cellSysutil->AddFunc(0x0f03cfb0, cellSaveDataUserListSave);
//cellSysutil->AddFunc(0x39dd8425, cellSaveDataUserListLoad);

View file

@ -291,7 +291,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
mem_func_ptr_t<CellSaveDataListCallback> funcList, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr)
{
cellSysutil->Warning("cellSaveDataListSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
cellSysutil->Warning("cellSaveDataListSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=0x%x, userdata_addr=0x%x)",
version, setList.GetAddr(), setBuf.GetAddr(), funcList.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
MemoryAllocator<CellSaveDataCBResult> result;
@ -307,6 +307,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
std::string dirNamePrefix = Memory.ReadString(setList->dirNamePrefix_addr);
std::vector<SaveDataEntry> saveEntries;
for(const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read())
{
if (entry->flags & DirEntry_TypeDir && entry->name.substr(0,dirNamePrefix.size()) == dirNamePrefix)
@ -326,12 +327,14 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr());
for (u32 i=0; i<saveEntries.size(); i++) {
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);
}
funcList(result.GetAddr(), listGet.GetAddr(), listSet.GetAddr());
if (result->result < 0) {
cellSysutil->Error("cellSaveDataListSave2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT;
@ -357,6 +360,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
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;
}
/*if (statSet->setParam.GetAddr())
addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr()); // TODO: This *is* wrong
*/
@ -371,7 +375,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
mem_func_ptr_t<CellSaveDataListCallback> funcList, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr)
{
cellSysutil->Warning("cellSaveDataListLoad2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
cellSysutil->Warning("cellSaveDataListLoad2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=0x%x, userdata_addr=0x%x)",
version, setList.GetAddr(), setBuf.GetAddr(), funcList.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
MemoryAllocator<CellSaveDataCBResult> result;
@ -382,11 +386,13 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
std::string saveBaseDir = "/dev_hdd0/home/00000001/savedata/"; // TODO: Get the path of the current user
vfsDir dir(saveBaseDir);
if(!dir.IsOpened())
return CELL_SAVEDATA_ERROR_INTERNAL;
std::string dirNamePrefix = Memory.ReadString(setList->dirNamePrefix_addr);
std::vector<SaveDataEntry> saveEntries;
for(const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read())
{
if (entry->flags & DirEntry_TypeDir && entry->name.substr(0,dirNamePrefix.size()) == dirNamePrefix)
@ -406,12 +412,14 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr());
for (u32 i=0; i<saveEntries.size(); i++) {
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);
}
funcList(result.GetAddr(), listGet.GetAddr(), listSet.GetAddr());
if (result->result < 0) {
cellSysutil->Error("cellSaveDataListLoad2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT;
@ -437,6 +445,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
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;
}
/*if (statSet->setParam.GetAddr())
// TODO: Write PARAM.SFO file
*/
@ -451,7 +460,7 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr)
{
cellSysutil->Warning("cellSaveDataFixedSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
cellSysutil->Warning("cellSaveDataFixedSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=0x%x, userdata_addr=0x%x)",
version, setList.GetAddr(), setBuf.GetAddr(), funcFixed.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
MemoryAllocator<CellSaveDataCBResult> result;
@ -520,7 +529,7 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr)
{
cellSysutil->Warning("cellSaveDataFixedLoad2(version=%d, setList_addr=0x%x, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)",
cellSysutil->Warning("cellSaveDataFixedLoad2(version=%d, setList_addr=0x%x, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=0x%x, userdata_addr=0x%x)",
version, setList.GetAddr(), setBuf.GetAddr(), funcFixed.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
MemoryAllocator<CellSaveDataCBResult> result;
@ -589,7 +598,7 @@ int cellSaveDataAutoSave2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr)
{
cellSysutil->Warning("cellSaveDataAutoSave2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)",
cellSysutil->Warning("cellSaveDataAutoSave2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=0x%x, userdata_addr=0x%x)",
version, dirName_addr, errDialog, setBuf.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
MemoryAllocator<CellSaveDataCBResult> result;
@ -642,7 +651,7 @@ int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr)
{
cellSysutil->Warning("cellSaveDataAutoLoad2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)",
cellSysutil->Warning("cellSaveDataAutoLoad2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=0x%x, userdata_addr=0x%x)",
version, dirName_addr, errDialog, setBuf.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
MemoryAllocator<CellSaveDataCBResult> result;
@ -688,15 +697,172 @@ int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
return CELL_SAVEDATA_RET_OK;
}
int cellSaveDataListAutoSave() //u32 version, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile,sys_memory_container_t container, void *userdata
int cellSaveDataListAutoSave(u32 version, u32 errDialog, mem_ptr_t<CellSaveDataSetList> setList, mem_ptr_t<CellSaveDataSetBuf> setBuf, mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed,
mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, u32 container, u32 userdata_addr)
{
UNIMPLEMENTED_FUNC(cellSysutil);
cellSysutil->Warning("cellSaveDataListAutoSave(version=%d, errDialog=%d, setBuf=0x%x, funcFixed=0x%x, funcStat=0x%x, funcFile=0x%x, container=0x%x, userdata_addr=0x%x)",
version, errDialog, setList.GetAddr(), setBuf.GetAddr(), funcFixed.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
MemoryAllocator<CellSaveDataCBResult> result;
MemoryAllocator<CellSaveDataListGet> listGet;
MemoryAllocator<CellSaveDataListSet> listSet;
MemoryAllocator<CellSaveDataStatGet> statGet;
MemoryAllocator<CellSaveDataStatSet> statSet;
std::string saveBaseDir = "/dev_hdd0/home/00000001/savedata/"; // TODO: Get the path of the current user
vfsDir dir(saveBaseDir);
if (!dir.IsOpened())
return CELL_SAVEDATA_ERROR_INTERNAL;
std::string dirNamePrefix = Memory.ReadString(setList->dirNamePrefix_addr);
std::vector<SaveDataEntry> saveEntries;
for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read())
{
if (entry->flags & DirEntry_TypeDir && entry->name.substr(0, dirNamePrefix.size()) == dirNamePrefix)
{
// Count the amount of matches and the amount of listed directories
listGet->dirListNum++;
if (listGet->dirListNum > setBuf->dirListMax)
continue;
listGet->dirNum++;
std::string saveDir = saveBaseDir + entry->name;
addSaveDataEntry(saveEntries, saveDir);
}
}
// Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr());
for (u32 i = 0; i<saveEntries.size(); i++) {
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);
}
funcFixed(result.GetAddr(), listGet.GetAddr(), listSet.GetAddr());
if (result->result < 0) {
LOG_ERROR(HLE, "cellSaveDataListAutoSave: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT;
}
setSaveDataList(saveEntries, (u32)listSet->fixedList.GetAddr(), listSet->fixedListNum);
if (listSet->newData.GetAddr())
addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr());
if (saveEntries.size() == 0) {
LOG_WARNING(HLE, "cellSaveDataListAutoSave: No save entries found!"); // TODO: Find a better way to handle this error
return CELL_SAVEDATA_RET_OK;
}
u32 focusIndex = focusSaveDataEntry(saveEntries, listSet->focusPosition);
// TODO: Display the dialog here
u32 selectedIndex = focusIndex; // TODO: Until the dialog is implemented, select always the focused entry
getSaveDataStat(saveEntries[selectedIndex], statGet.GetAddr());
result->userdata_addr = userdata_addr;
funcStat(result.GetAddr(), statGet.GetAddr(), statSet.GetAddr());
Memory.Free(statGet->fileList.GetAddr());
if (result->result < 0) {
LOG_ERROR(HLE, "cellSaveDataListAutoSave: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT;
}
/*if (statSet->setParam.GetAddr())
addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr()); // TODO: This *is* wrong
*/
// Enter the loop where the save files are read/created/deleted.
s32 ret = modifySaveDataFiles(funcFile, result.GetAddr(), saveBaseDir + (char*)statGet->dir.dirName);
return CELL_SAVEDATA_RET_OK;
}
int cellSaveDataListAutoLoad() //u32 version, u32 errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata
int cellSaveDataListAutoLoad(u32 version, u32 errDialog, mem_ptr_t<CellSaveDataSetList> setList, mem_ptr_t<CellSaveDataSetBuf> setBuf, mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed,
mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, u32 container, u32 userdata_addr)
{
UNIMPLEMENTED_FUNC(cellSysutil);
cellSysutil->Warning("cellSaveDataListAutoLoad(version=%d, errDialog=%d, setBuf=0x%x, funcFixed=0x%x, funcStat=0x%x, funcFile=0x%x, container=0x%x, userdata_addr=0x%x)",
version, errDialog, setList.GetAddr(), setBuf.GetAddr(), funcFixed.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
MemoryAllocator<CellSaveDataCBResult> result;
MemoryAllocator<CellSaveDataListGet> listGet;
MemoryAllocator<CellSaveDataListSet> listSet;
MemoryAllocator<CellSaveDataStatGet> statGet;
MemoryAllocator<CellSaveDataStatSet> statSet;
std::string saveBaseDir = "/dev_hdd0/home/00000001/savedata/"; // TODO: Get the path of the current user
vfsDir dir(saveBaseDir);
if (!dir.IsOpened())
return CELL_SAVEDATA_ERROR_INTERNAL;
std::string dirNamePrefix = Memory.ReadString(setList->dirNamePrefix_addr);
std::vector<SaveDataEntry> saveEntries;
for (const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read())
{
if (entry->flags & DirEntry_TypeDir && entry->name.substr(0, dirNamePrefix.size()) == dirNamePrefix)
{
// Count the amount of matches and the amount of listed directories
listGet->dirListNum++;
if (listGet->dirListNum > setBuf->dirListMax)
continue;
listGet->dirNum++;
std::string saveDir = saveBaseDir + entry->name;
addSaveDataEntry(saveEntries, saveDir);
}
}
// Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList.SetAddr(setBuf->buf_addr);
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.GetAddr());
for (u32 i = 0; i<saveEntries.size(); i++) {
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);
}
funcFixed(result.GetAddr(), listGet.GetAddr(), listSet.GetAddr());
if (result->result < 0) {
LOG_ERROR(HLE, "cellSaveDataListAutoLoad: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT;
}
setSaveDataList(saveEntries, (u32)listSet->fixedList.GetAddr(), listSet->fixedListNum);
if (listSet->newData.GetAddr())
addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr());
if (saveEntries.size() == 0) {
LOG_WARNING(HLE, "cellSaveDataListAutoLoad: No save entries found!"); // TODO: Find a better way to handle this error
return CELL_SAVEDATA_RET_OK;
}
u32 focusIndex = focusSaveDataEntry(saveEntries, listSet->focusPosition);
// TODO: Display the dialog here
u32 selectedIndex = focusIndex; // TODO: Until the dialog is implemented, select always the focused entry
getSaveDataStat(saveEntries[selectedIndex], statGet.GetAddr());
result->userdata_addr = userdata_addr;
funcStat(result.GetAddr(), statGet.GetAddr(), statSet.GetAddr());
Memory.Free(statGet->fileList.GetAddr());
if (result->result < 0) {
LOG_ERROR(HLE, "cellSaveDataListAutoLoad: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT;
}
/*if (statSet->setParam.GetAddr())
// TODO: Write PARAM.SFO file
*/
// Enter the loop where the save files are read/created/deleted.
s32 ret = modifySaveDataFiles(funcFile, result.GetAddr(), saveBaseDir + (char*)statGet->dir.dirName);
return CELL_SAVEDATA_RET_OK;
}

View file

@ -296,3 +296,9 @@ int cellSaveDataAutoSave2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_t<CellSaveDataSetBuf> setBuf,
mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr);
int cellSaveDataListAutoSave(u32 version, u32 errDialog, mem_ptr_t<CellSaveDataSetList> setList, mem_ptr_t<CellSaveDataSetBuf> setBuf, mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed,
mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, u32 container, u32 userdata_addr);
int cellSaveDataListAutoLoad(u32 version, u32 errDialog, mem_ptr_t<CellSaveDataSetList> setList, mem_ptr_t<CellSaveDataSetBuf> setBuf, mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed,
mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, u32 container, u32 userdata_addr);

View file

@ -233,18 +233,18 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event))
Emu.Stop();
// Open and install PKG file
wxString filePath = ctrl.GetPath();
rFile pkg_f(filePath.ToStdString(), rFile::read); // TODO: Use VFS to install PKG files
std::string filePath = ctrl.GetPath().ToStdString();
rFile pkg_f(filePath, rFile::read); // TODO: Use VFS to install PKG files
if (pkg_f.IsOpened())
{
PKGLoader pkg(pkg_f);
pkg.Install("/dev_hdd0/game/");
pkg.Close();
}
// Refresh game list
m_game_viewer->Refresh();
// Refresh game list
m_game_viewer->Refresh();
}
}
void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event))

View file

@ -26,17 +26,16 @@ bool PKGLoader::Install(std::string dest)
std::string titleID = std::string(title_id).substr(7, 9);
if (rExists(dest+titleID)) {
if (rExists(dest + titleID)) {
rMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", rYES_NO|rCENTRE);
if (d_overwrite.ShowModal() != rID_YES) {
LOG_ERROR(LOADER, "PKG Loader: Another installation found in: %s", titleID.c_str());
return false;
}
// TODO: Remove the following two lines and remove the folder dest+titleID
LOG_ERROR(LOADER, "PKG Loader: Another installation found in: %s", titleID.c_str());
return false;
rRmdir(dest + titleID);
}
if (!rMkdir(dest+titleID)) {
if (!rMkdir(dest + titleID)) {
LOG_ERROR(LOADER, "PKG Loader: Could not make the installation directory: %s", titleID.c_str());
return false;
}