Switch to _le memory layout specs in dialogs.
This commit is contained in:
parent
b307d77b61
commit
777074cfe1
6 changed files with 95 additions and 79 deletions
|
@ -30,19 +30,18 @@ const int SCE_ERROR_UTILITY_INVALID_STATUS = 0x80110001;
|
|||
const int SCE_ERROR_UTILITY_INVALID_PARAM_SIZE = 0x80110004;
|
||||
const int SCE_ERROR_UTILITY_WRONG_TYPE = 0x80110005;
|
||||
|
||||
typedef struct
|
||||
struct pspUtilityDialogCommon
|
||||
{
|
||||
unsigned int size; /** Size of the structure */
|
||||
int language; /** Language */
|
||||
int buttonSwap; /** Set to 1 for X/O button swap */
|
||||
int graphicsThread; /** Graphics thread priority */
|
||||
int accessThread; /** Access/fileio thread priority (SceJobThread) */
|
||||
int fontThread; /** Font thread priority (ScePafThread) */
|
||||
int soundThread; /** Sound thread priority */
|
||||
int result; /** Result */
|
||||
int reserved[4]; /** Set to 0 */
|
||||
|
||||
} pspUtilityDialogCommon;
|
||||
u32_le size; /** Size of the structure */
|
||||
s32_le language; /** Language */
|
||||
s32_le buttonSwap; /** Set to 1 for X/O button swap */
|
||||
s32_le graphicsThread; /** Graphics thread priority */
|
||||
s32_le accessThread; /** Access/fileio thread priority (SceJobThread) */
|
||||
s32_le fontThread; /** Font thread priority (ScePafThread) */
|
||||
s32_le soundThread; /** Sound thread priority */
|
||||
s32_le result; /** Result */
|
||||
s32_le reserved[4]; /** Set to 0 */
|
||||
};
|
||||
|
||||
|
||||
class PSPDialog
|
||||
|
|
|
@ -39,15 +39,15 @@
|
|||
struct pspMessageDialog
|
||||
{
|
||||
pspUtilityDialogCommon common;
|
||||
int result;
|
||||
int type;
|
||||
unsigned int errorNum;
|
||||
s32_le result;
|
||||
s32_le type;
|
||||
u32_le errorNum;
|
||||
char string[512];
|
||||
// End of request V1 (Size 572)
|
||||
unsigned int options;
|
||||
unsigned int buttonPressed;
|
||||
u32_le options;
|
||||
u32_le buttonPressed;
|
||||
// End of request V2 (Size 580)
|
||||
int unknown[32];
|
||||
s32_le unknown[32];
|
||||
// End of request V3 (Size 708)
|
||||
};
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ PSPOskDialog::PSPOskDialog() : PSPDialog() {
|
|||
PSPOskDialog::~PSPOskDialog() {
|
||||
}
|
||||
|
||||
void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16> em_address)
|
||||
void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le> em_address)
|
||||
{
|
||||
if (!em_address.IsValid())
|
||||
{
|
||||
|
@ -839,7 +839,7 @@ int PSPOskDialog::Update()
|
|||
status = SCE_UTILITY_STATUS_SHUTDOWN;
|
||||
}
|
||||
|
||||
u16 *outText = oskParams->fields[0].outtext;
|
||||
u16_le *outText = oskParams->fields[0].outtext;
|
||||
for (u32 i = 0, end = oskParams->fields[0].outtextlength; i < end; ++i)
|
||||
{
|
||||
u16 value = 0;
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "PSPDialog.h"
|
||||
#include "../Core/MemMap.h"
|
||||
|
||||
#include "Core/Dialog/PSPDialog.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@ -91,37 +91,45 @@ enum SceUtilityOskInputType
|
|||
PSP_UTILITY_OSK_INPUTTYPE_URL = 0x00080000
|
||||
};
|
||||
|
||||
#if COMMON_LITTLE_ENDIAN
|
||||
typedef SceUtilityOskState SceUtilityOskState_le;
|
||||
typedef SceUtilityOskInputLanguage SceUtilityOskInputLanguage_le;
|
||||
typedef SceUtilityOskResult SceUtilityOskResult_le;
|
||||
#else
|
||||
#error FIX ME
|
||||
#endif
|
||||
|
||||
/**
|
||||
* OSK Field data
|
||||
*/
|
||||
struct SceUtilityOskData
|
||||
{
|
||||
/** Unknown. Pass 0. */
|
||||
int unk_00;
|
||||
s32_le unk_00;
|
||||
/** Unknown. Pass 0. */
|
||||
int unk_04;
|
||||
s32_le unk_04;
|
||||
/** One of ::SceUtilityOskInputLanguage */
|
||||
int language;
|
||||
SceUtilityOskInputLanguage_le language;
|
||||
/** Unknown. Pass 0. */
|
||||
int unk_12;
|
||||
s32_le unk_12;
|
||||
/** One or more of ::SceUtilityOskInputType (types that are selectable by pressing SELECT) */
|
||||
int inputtype;
|
||||
s32_le inputtype;
|
||||
/** Number of lines */
|
||||
int lines;
|
||||
s32_le lines;
|
||||
/** Unknown. Pass 0. */
|
||||
int unk_24;
|
||||
s32_le unk_24;
|
||||
/** Description text */
|
||||
PSPPointer<u16> desc;
|
||||
PSPPointer<u16_le> desc;
|
||||
/** Initial text */
|
||||
PSPPointer<u16> intext;
|
||||
PSPPointer<u16_le> intext;
|
||||
// Length, in unsigned shorts, including the terminator.
|
||||
u32 outtextlength;
|
||||
u32_le outtextlength;
|
||||
/** Pointer to the output text */
|
||||
PSPPointer<u16> outtext;
|
||||
PSPPointer<u16_le> outtext;
|
||||
/** Result. One of ::SceUtilityOskResult */
|
||||
int result;
|
||||
SceUtilityOskResult_le result;
|
||||
// Number of characters to allow, not including terminator (if less than outtextlength - 1.)
|
||||
u32 outtextlimit;
|
||||
u32_le outtextlimit;
|
||||
};
|
||||
|
||||
// Parameters to sceUtilityOskInitStart
|
||||
|
@ -129,12 +137,12 @@ struct SceUtilityOskParams
|
|||
{
|
||||
pspUtilityDialogCommon base;
|
||||
// Number of fields.
|
||||
int fieldCount;
|
||||
s32_le fieldCount;
|
||||
// Pointer to an array of fields (see SceUtilityOskData.)
|
||||
PSPPointer<SceUtilityOskData> fields;
|
||||
SceUtilityOskState state;
|
||||
SceUtilityOskState_le state;
|
||||
// Maybe just padding?
|
||||
int unk_60;
|
||||
s32_le unk_60;
|
||||
|
||||
};
|
||||
|
||||
|
@ -165,7 +173,7 @@ public:
|
|||
virtual pspUtilityDialogCommon *GetCommonParam();
|
||||
|
||||
private:
|
||||
void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16> em_address);
|
||||
void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le> em_address);
|
||||
void ConvertUCS2ToUTF8(std::string& _string, const wchar_t *input);
|
||||
void RenderKeyboard();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ int PSPSaveDialog::Init(int paramAddr)
|
|||
u32 retval = param.SetPspParam(&request);
|
||||
|
||||
INFO_LOG(HLE,"sceUtilitySavedataInitStart(%08x)", paramAddr);
|
||||
INFO_LOG(HLE,"Mode: %i", param.GetPspParam()->mode);
|
||||
INFO_LOG(HLE,"Mode: %i", (SceUtilitySavedataType)param.GetPspParam()->mode);
|
||||
|
||||
yesnoChoice = 1;
|
||||
switch (param.GetPspParam()->focus)
|
||||
|
@ -164,7 +164,7 @@ int PSPSaveDialog::Init(int paramAddr)
|
|||
break;
|
||||
default:
|
||||
{
|
||||
ERROR_LOG_REPORT(HLE, "Load/Save function %d not coded. Title: %s Save: %s File: %s", param.GetPspParam()->mode, param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str());
|
||||
ERROR_LOG_REPORT(HLE, "Load/Save function %d not coded. Title: %s Save: %s File: %s", (SceUtilitySavedataType)param.GetPspParam()->mode, param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str());
|
||||
param.GetPspParam()->common.result = 0;
|
||||
status = SCE_UTILITY_STATUS_INITIALIZE;
|
||||
display = DS_NONE;
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "Core/HLE/sceRtc.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Dialog/PSPDialog.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#undef st_ctime
|
||||
#undef st_atime
|
||||
#undef st_mtime
|
||||
|
@ -65,6 +67,13 @@ enum SceUtilitySavedataFocus
|
|||
SCE_UTILITY_SAVEDATA_FOCUS_LASTEMPTY = 8, // last empty (what if no empty?)
|
||||
};
|
||||
|
||||
#if COMMON_LITTLE_ENDIAN
|
||||
typedef SceUtilitySavedataType SceUtilitySavedataType_le;
|
||||
typedef SceUtilitySavedataFocus SceUtilitySavedataFocus_le;
|
||||
#else
|
||||
#error FIX ME
|
||||
#endif
|
||||
|
||||
typedef char SceUtilitySavedataSaveName[20];
|
||||
|
||||
// title, savedataTitle, detail: parts of the unencrypted SFO
|
||||
|
@ -80,34 +89,34 @@ struct PspUtilitySavedataSFOParam
|
|||
|
||||
struct PspUtilitySavedataFileData {
|
||||
PSPPointer<u8> buf;
|
||||
SceSize bufSize; // Size of the buffer pointed to by buf
|
||||
SceSize size; // Actual file size to write / was read
|
||||
int unknown;
|
||||
SceSize_le bufSize; // Size of the buffer pointed to by buf
|
||||
SceSize_le size; // Actual file size to write / was read
|
||||
s32_le unknown;
|
||||
};
|
||||
|
||||
struct PspUtilitySavedataSizeEntry {
|
||||
u64 size;
|
||||
u64_le size;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
struct PspUtilitySavedataSizeInfo {
|
||||
int numSecureEntries;
|
||||
int numNormalEntries;
|
||||
s32_le numSecureEntries;
|
||||
s32_le numNormalEntries;
|
||||
PSPPointer<PspUtilitySavedataSizeEntry> secureEntries;
|
||||
PSPPointer<PspUtilitySavedataSizeEntry> normalEntries;
|
||||
int sectorSize;
|
||||
int freeSectors;
|
||||
int freeKB;
|
||||
s32_le sectorSize;
|
||||
s32_le freeSectors;
|
||||
s32_le freeKB;
|
||||
char freeString[8];
|
||||
int neededKB;
|
||||
s32_le neededKB;
|
||||
char neededString[8];
|
||||
int overwriteKB;
|
||||
s32_le overwriteKB;
|
||||
char overwriteString[8];
|
||||
};
|
||||
|
||||
struct SceUtilitySavedataIdListEntry
|
||||
{
|
||||
int st_mode;
|
||||
s32_le st_mode;
|
||||
ScePspDateTime st_ctime;
|
||||
ScePspDateTime st_atime;
|
||||
ScePspDateTime st_mtime;
|
||||
|
@ -116,15 +125,15 @@ struct SceUtilitySavedataIdListEntry
|
|||
|
||||
struct SceUtilitySavedataIdListInfo
|
||||
{
|
||||
int maxCount;
|
||||
int resultCount;
|
||||
s32_le maxCount;
|
||||
s32_le resultCount;
|
||||
PSPPointer<SceUtilitySavedataIdListEntry> entries;
|
||||
};
|
||||
|
||||
struct SceUtilitySavedataFileListEntry
|
||||
{
|
||||
int st_mode;
|
||||
u64 st_size;
|
||||
s32_le st_mode;
|
||||
u64_le st_size;
|
||||
ScePspDateTime st_ctime;
|
||||
ScePspDateTime st_atime;
|
||||
ScePspDateTime st_mtime;
|
||||
|
@ -133,12 +142,12 @@ struct SceUtilitySavedataFileListEntry
|
|||
|
||||
struct SceUtilitySavedataFileListInfo
|
||||
{
|
||||
u32 maxSecureEntries;
|
||||
u32 maxNormalEntries;
|
||||
u32 maxSystemEntries;
|
||||
u32 resultNumSecureEntries;
|
||||
u32 resultNumNormalEntries;
|
||||
u32 resultNumSystemEntries;
|
||||
u32_le maxSecureEntries;
|
||||
u32_le maxNormalEntries;
|
||||
u32_le maxSystemEntries;
|
||||
u32_le resultNumSecureEntries;
|
||||
u32_le resultNumNormalEntries;
|
||||
u32_le resultNumSystemEntries;
|
||||
PSPPointer<SceUtilitySavedataFileListEntry> secureEntries;
|
||||
PSPPointer<SceUtilitySavedataFileListEntry> normalEntries;
|
||||
PSPPointer<SceUtilitySavedataFileListEntry> systemEntries;
|
||||
|
@ -146,18 +155,18 @@ struct SceUtilitySavedataFileListInfo
|
|||
|
||||
struct SceUtilitySavedataMsFreeInfo
|
||||
{
|
||||
int clusterSize;
|
||||
int freeClusters;
|
||||
int freeSpaceKB;
|
||||
s32_le clusterSize;
|
||||
s32_le freeClusters;
|
||||
s32_le freeSpaceKB;
|
||||
char freeSpaceStr[8];
|
||||
};
|
||||
|
||||
struct SceUtilitySavedataUsedDataInfo
|
||||
{
|
||||
int usedClusters;
|
||||
int usedSpaceKB;
|
||||
s32_le usedClusters;
|
||||
s32_le usedSpaceKB;
|
||||
char usedSpaceStr[8];
|
||||
int usedSpace32KB;
|
||||
s32_le usedSpace32KB;
|
||||
char usedSpace32Str[8];
|
||||
};
|
||||
|
||||
|
@ -174,10 +183,10 @@ struct SceUtilitySavedataParam
|
|||
{
|
||||
pspUtilityDialogCommon common;
|
||||
|
||||
int mode; // 0 to load, 1 to save
|
||||
int bind;
|
||||
SceUtilitySavedataType_le mode; // 0 to load, 1 to save
|
||||
s32_le bind;
|
||||
|
||||
int overwriteMode; // use 0x10 ?
|
||||
s32_le overwriteMode; // use 0x10 ?
|
||||
|
||||
/** gameName: name used from the game for saves, equal for all saves */
|
||||
char gameName[13];
|
||||
|
@ -192,8 +201,8 @@ struct SceUtilitySavedataParam
|
|||
/** pointer to a buffer that will contain data file unencrypted data */
|
||||
PSPPointer<u8> dataBuf;
|
||||
/** size of allocated space to dataBuf */
|
||||
SceSize dataBufSize;
|
||||
SceSize dataSize; // Size of the actual save data
|
||||
SceSize_le dataBufSize;
|
||||
SceSize_le dataSize; // Size of the actual save data
|
||||
|
||||
PspUtilitySavedataSFOParam sfoParam;
|
||||
|
||||
|
@ -203,8 +212,8 @@ struct SceUtilitySavedataParam
|
|||
PspUtilitySavedataFileData snd0FileData;
|
||||
|
||||
PSPPointer<PspUtilitySavedataFileData> newData;
|
||||
int focus;
|
||||
int abortStatus;
|
||||
SceUtilitySavedataFocus_le focus;
|
||||
s32_le abortStatus;
|
||||
|
||||
// Function SCE_UTILITY_SAVEDATA_TYPE_SIZES
|
||||
PSPPointer<SceUtilitySavedataMsFreeInfo> msFree;
|
||||
|
@ -213,8 +222,8 @@ struct SceUtilitySavedataParam
|
|||
|
||||
u8 key[16];
|
||||
|
||||
int secureVersion;
|
||||
int multiStatus;
|
||||
s32_le secureVersion;
|
||||
s32_le multiStatus;
|
||||
|
||||
// Function 11 LIST
|
||||
PSPPointer<SceUtilitySavedataIdListInfo> idList;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue