feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a4399472.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
This commit is contained in:
@@ -36,6 +36,37 @@ static SceRemoteStorageStatus statParams;
|
||||
|
||||
|
||||
|
||||
void SonyRemoteStorage::SetRetrievedDescData()
|
||||
{
|
||||
DescriptionData* pDescDataTest = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
ESavePlatform testPlatform = (ESavePlatform)MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3]);
|
||||
if(testPlatform == SAVE_FILE_PLATFORM_NONE)
|
||||
{
|
||||
// new version of the descData
|
||||
DescriptionData_V2* pDescData2 = (DescriptionData_V2*)m_remoteFileInfo->fileDescription;
|
||||
m_retrievedDescData.m_descDataVersion = GetU32FromHexBytes(pDescData2->m_descDataVersion);
|
||||
m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3]);
|
||||
m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData2->m_seed);
|
||||
m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData2->m_hostOptions);
|
||||
m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData2->m_texturePack);
|
||||
m_retrievedDescData.m_saveVersion = GetU32FromHexBytes(pDescData2->m_saveVersion);
|
||||
memcpy(m_retrievedDescData.m_saveNameUTF8, pDescData2->m_saveNameUTF8, sizeof(pDescData2->m_saveNameUTF8));
|
||||
assert(m_retrievedDescData.m_descDataVersion > 1 && m_retrievedDescData.m_descDataVersion <= sc_CurrentDescDataVersion);
|
||||
}
|
||||
else
|
||||
{
|
||||
// old version,copy the data across to the new version
|
||||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
m_retrievedDescData.m_descDataVersion = 1;
|
||||
m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3]);
|
||||
m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData->m_seed);
|
||||
m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData->m_hostOptions);
|
||||
m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData->m_texturePack);
|
||||
m_retrievedDescData.m_saveVersion = SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE; // the last save version before we added it to this data
|
||||
memcpy(m_retrievedDescData.m_saveNameUTF8, pDescData->m_saveNameUTF8, sizeof(pDescData->m_saveNameUTF8));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,8 +82,9 @@ void getSaveInfoReturnCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int
|
||||
if(strcmp(statParams.data[i].fileName, sc_remoteSaveFilename) == 0)
|
||||
{
|
||||
// found the file we need in the cloud
|
||||
pRemoteStorage->m_getInfoStatus = SonyRemoteStorage::e_infoFound;
|
||||
pRemoteStorage->m_remoteFileInfo = &statParams.data[i];
|
||||
pRemoteStorage->SetRetrievedDescData();
|
||||
pRemoteStorage->m_getInfoStatus = SonyRemoteStorage::e_infoFound;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +136,7 @@ void SonyRemoteStorage::getSaveInfo()
|
||||
bool SonyRemoteStorage::getSaveData( const char* localDirname, CallbackFunc cb, LPVOID lpParam )
|
||||
{
|
||||
m_startTime = System::currentTimeMillis();
|
||||
m_dataProgress = 0;
|
||||
m_dataProgress = -1;
|
||||
return getData(sc_remoteSaveFilename, localDirname, cb, lpParam);
|
||||
}
|
||||
|
||||
@@ -131,7 +163,9 @@ bool SonyRemoteStorage::setSaveData(PSAVE_INFO info, CallbackFunc cb, void* lpPa
|
||||
m_setDataStatus = e_settingData;
|
||||
m_initCallbackFunc = cb;
|
||||
m_initCallbackParam = lpParam;
|
||||
m_dataProgress = 0;
|
||||
m_dataProgress = -1;
|
||||
m_uploadSaveSize = 0;
|
||||
m_startTime = System::currentTimeMillis();
|
||||
bool bOK = init(setSaveDataInitCallback, this);
|
||||
if(!bOK)
|
||||
m_setDataStatus = e_settingDataFailed;
|
||||
@@ -148,16 +182,14 @@ const char* SonyRemoteStorage::getSaveNameUTF8()
|
||||
{
|
||||
if(m_getInfoStatus != e_infoFound)
|
||||
return NULL;
|
||||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
return pDescData->m_saveNameUTF8;
|
||||
return m_retrievedDescData.m_saveNameUTF8;
|
||||
}
|
||||
|
||||
ESavePlatform SonyRemoteStorage::getSavePlatform()
|
||||
{
|
||||
if(m_getInfoStatus != e_infoFound)
|
||||
return SAVE_FILE_PLATFORM_NONE;
|
||||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
return (ESavePlatform)MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3]);
|
||||
return m_retrievedDescData.m_savePlatform;
|
||||
|
||||
}
|
||||
|
||||
@@ -165,51 +197,23 @@ __int64 SonyRemoteStorage::getSaveSeed()
|
||||
{
|
||||
if(m_getInfoStatus != e_infoFound)
|
||||
return 0;
|
||||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
|
||||
char seedString[17];
|
||||
ZeroMemory(seedString,17);
|
||||
memcpy(seedString, pDescData->m_seed,16);
|
||||
|
||||
__uint64 seed = 0;
|
||||
std::stringstream ss;
|
||||
ss << seedString;
|
||||
ss >> std::hex >> seed;
|
||||
return seed;
|
||||
return m_retrievedDescData.m_seed;
|
||||
}
|
||||
|
||||
unsigned int SonyRemoteStorage::getSaveHostOptions()
|
||||
{
|
||||
if(m_getInfoStatus != e_infoFound)
|
||||
return 0;
|
||||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
|
||||
char optionsString[9];
|
||||
ZeroMemory(optionsString,9);
|
||||
memcpy(optionsString, pDescData->m_hostOptions,8);
|
||||
|
||||
unsigned int uiHostOptions = 0;
|
||||
std::stringstream ss;
|
||||
ss << optionsString;
|
||||
ss >> std::hex >> uiHostOptions;
|
||||
return uiHostOptions;
|
||||
return m_retrievedDescData.m_hostOptions;
|
||||
}
|
||||
|
||||
unsigned int SonyRemoteStorage::getSaveTexturePack()
|
||||
{
|
||||
if(m_getInfoStatus != e_infoFound)
|
||||
return 0;
|
||||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
|
||||
char textureString[9];
|
||||
ZeroMemory(textureString,9);
|
||||
memcpy(textureString, pDescData->m_texturePack,8);
|
||||
|
||||
unsigned int uiTexturePack = 0;
|
||||
std::stringstream ss;
|
||||
ss << textureString;
|
||||
ss >> std::hex >> uiTexturePack;
|
||||
return uiTexturePack;
|
||||
return m_retrievedDescData.m_texturePack;
|
||||
}
|
||||
|
||||
const char* SonyRemoteStorage::getRemoteSaveFilename()
|
||||
@@ -292,14 +296,41 @@ bool SonyRemoteStorage::saveIsAvailable()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SonyRemoteStorage::saveVersionSupported()
|
||||
{
|
||||
return (m_retrievedDescData.m_saveVersion <= SAVE_FILE_VERSION_NUMBER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int SonyRemoteStorage::getDataProgress()
|
||||
{
|
||||
if(m_dataProgress < 0)
|
||||
return 0;
|
||||
int chunkSize = 1024*1024; // 1mb chunks when downloading
|
||||
int totalSize = getSaveFilesize();
|
||||
int transferRatePerSec = 300*1024; // a pessimistic download transfer rate
|
||||
if(getStatus() == e_setDataInProgress)
|
||||
{
|
||||
chunkSize = 5 * 1024 * 1024; // 5mb chunks when uploading
|
||||
totalSize = m_uploadSaveSize;
|
||||
transferRatePerSec = 20*1024; // a pessimistic upload transfer rate
|
||||
}
|
||||
int sizeTransferred = (totalSize * m_dataProgress) / 100;
|
||||
int nextChunk = ((sizeTransferred + chunkSize) * 100) / totalSize;
|
||||
|
||||
|
||||
__int64 time = System::currentTimeMillis();
|
||||
int elapsedSecs = (time - m_startTime) / 1000;
|
||||
int progVal = m_dataProgress + (elapsedSecs/3);
|
||||
if(progVal > 95)
|
||||
float estimatedTransfered = float(elapsedSecs * transferRatePerSec);
|
||||
int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100;
|
||||
if(progVal > nextChunk)
|
||||
return nextChunk;
|
||||
if(progVal > 99)
|
||||
{
|
||||
return m_dataProgress;
|
||||
if(m_dataProgress > 99)
|
||||
return m_dataProgress;
|
||||
return 99;
|
||||
}
|
||||
return progVal;
|
||||
}
|
||||
@@ -338,3 +369,139 @@ void SonyRemoteStorage::waitForStorageManagerIdle()
|
||||
storageState = StorageManager.GetSaveState();
|
||||
}
|
||||
}
|
||||
void SonyRemoteStorage::GetDescriptionData(char* descData)
|
||||
{
|
||||
switch(sc_CurrentDescDataVersion)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
DescriptionData descData_V1;
|
||||
GetDescriptionData(descData_V1);
|
||||
memcpy(descData, &descData_V1, sizeof(descData_V1));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
DescriptionData_V2 descData_V2;
|
||||
GetDescriptionData(descData_V2);
|
||||
memcpy(descData, &descData_V2, sizeof(descData_V2));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData)
|
||||
{
|
||||
ZeroMemory(&descData, sizeof(DescriptionData));
|
||||
descData.m_platform[0] = SAVE_FILE_PLATFORM_LOCAL & 0xff;
|
||||
descData.m_platform[1] = (SAVE_FILE_PLATFORM_LOCAL >> 8) & 0xff;
|
||||
descData.m_platform[2] = (SAVE_FILE_PLATFORM_LOCAL >> 16) & 0xff;
|
||||
descData.m_platform[3] = (SAVE_FILE_PLATFORM_LOCAL >> 24)& 0xff;
|
||||
|
||||
if(m_thumbnailData)
|
||||
{
|
||||
unsigned int uiHostOptions;
|
||||
bool bHostOptionsRead;
|
||||
DWORD uiTexturePack;
|
||||
char seed[22];
|
||||
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
||||
|
||||
__int64 iSeed = strtoll(seed,NULL,10);
|
||||
SetU64HexBytes(descData.m_seed, iSeed);
|
||||
// Save the host options that this world was last played with
|
||||
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
||||
// Save the texture pack id
|
||||
SetU32HexBytes(descData.m_texturePack, uiTexturePack);
|
||||
}
|
||||
|
||||
memcpy(descData.m_saveNameUTF8, m_saveFileDesc, strlen(m_saveFileDesc));
|
||||
|
||||
}
|
||||
|
||||
void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
|
||||
{
|
||||
ZeroMemory(&descData, sizeof(DescriptionData_V2));
|
||||
descData.m_platformNone[0] = SAVE_FILE_PLATFORM_NONE & 0xff;
|
||||
descData.m_platformNone[1] = (SAVE_FILE_PLATFORM_NONE >> 8) & 0xff;
|
||||
descData.m_platformNone[2] = (SAVE_FILE_PLATFORM_NONE >> 16) & 0xff;
|
||||
descData.m_platformNone[3] = (SAVE_FILE_PLATFORM_NONE >> 24)& 0xff;
|
||||
|
||||
// Save descData version
|
||||
char descDataVersion[9];
|
||||
sprintf(descDataVersion,"%08x",sc_CurrentDescDataVersion);
|
||||
memcpy(descData.m_descDataVersion,descDataVersion,8); // Don't copy null
|
||||
|
||||
|
||||
descData.m_platform[0] = SAVE_FILE_PLATFORM_LOCAL & 0xff;
|
||||
descData.m_platform[1] = (SAVE_FILE_PLATFORM_LOCAL >> 8) & 0xff;
|
||||
descData.m_platform[2] = (SAVE_FILE_PLATFORM_LOCAL >> 16) & 0xff;
|
||||
descData.m_platform[3] = (SAVE_FILE_PLATFORM_LOCAL >> 24)& 0xff;
|
||||
|
||||
if(m_thumbnailData)
|
||||
{
|
||||
unsigned int uiHostOptions;
|
||||
bool bHostOptionsRead;
|
||||
DWORD uiTexturePack;
|
||||
char seed[22];
|
||||
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
||||
|
||||
__int64 iSeed = strtoll(seed,NULL,10);
|
||||
SetU64HexBytes(descData.m_seed, iSeed);
|
||||
// Save the host options that this world was last played with
|
||||
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
||||
// Save the texture pack id
|
||||
SetU32HexBytes(descData.m_texturePack, uiTexturePack);
|
||||
// Save the savefile version
|
||||
SetU32HexBytes(descData.m_saveVersion, SAVE_FILE_VERSION_NUMBER);
|
||||
// clear out the future data with underscores
|
||||
memset(descData.m_futureData, '_', sizeof(descData.m_futureData));
|
||||
}
|
||||
|
||||
memcpy(descData.m_saveNameUTF8, m_saveFileDesc, strlen(m_saveFileDesc));
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes)
|
||||
{
|
||||
char hexString[9];
|
||||
ZeroMemory(hexString,9);
|
||||
memcpy(hexString, hexBytes,8);
|
||||
|
||||
uint32_t u32Val = 0;
|
||||
std::stringstream ss;
|
||||
ss << hexString;
|
||||
ss >> std::hex >> u32Val;
|
||||
return u32Val;
|
||||
}
|
||||
|
||||
uint64_t SonyRemoteStorage::GetU64FromHexBytes(char* hexBytes)
|
||||
{
|
||||
char hexString[17];
|
||||
ZeroMemory(hexString,17);
|
||||
memcpy(hexString, hexBytes,16);
|
||||
|
||||
uint64_t u64Val = 0;
|
||||
std::stringstream ss;
|
||||
ss << hexString;
|
||||
ss >> std::hex >> u64Val;
|
||||
return u64Val;
|
||||
|
||||
}
|
||||
|
||||
void SonyRemoteStorage::SetU32HexBytes(char* hexBytes, uint32_t u32)
|
||||
{
|
||||
char hexString[9];
|
||||
sprintf(hexString,"%08x",u32);
|
||||
memcpy(hexBytes,hexString,8); // Don't copy null
|
||||
}
|
||||
|
||||
void SonyRemoteStorage::SetU64HexBytes(char* hexBytes, uint64_t u64)
|
||||
{
|
||||
char hexString[17];
|
||||
sprintf(hexString,"%016llx",u64);
|
||||
memcpy(hexBytes,hexString,16); // Don't copy null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user