Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
void_17
c67db1115a Remove all MSVC __int64 2026-03-07 02:52:52 +07:00
277 changed files with 3672 additions and 3684 deletions

View file

@ -13,7 +13,7 @@ private:
wstring title; wstring title;
wstring desc; wstring desc;
Achievement *ach; Achievement *ach;
__int64 startTime; int64_t startTime;
ItemRenderer *ir; ItemRenderer *ir;
bool isHelper; bool isHelper;

View file

@ -3791,8 +3791,8 @@ extern "C" {
typedef signed int ma_int32; typedef signed int ma_int32;
typedef unsigned int ma_uint32; typedef unsigned int ma_uint32;
#if defined(_MSC_VER) && !defined(__clang__) #if defined(_MSC_VER) && !defined(__clang__)
typedef signed __int64 ma_int64; typedef signed long long ma_int64;
typedef unsigned __int64 ma_uint64; typedef unsigned long long ma_uint64;
#else #else
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -11249,7 +11249,7 @@ struct ma_sound
float* pProcessingCache; /* Will be null if pDataSource is null. */ float* pProcessingCache; /* Will be null if pDataSource is null. */
ma_uint32 processingCacheFramesRemaining; ma_uint32 processingCacheFramesRemaining;
ma_uint32 processingCacheCap; ma_uint32 processingCacheCap;
ma_bool8 ownsDataSource; ma_bool8 ownsDataSource;
/* /*
We're declaring a resource manager data source object here to save us a malloc when loading a We're declaring a resource manager data source object here to save us a malloc when loading a
@ -11596,7 +11596,7 @@ IMPLEMENTATION
#include <sys/time.h> /* select() (used for ma_sleep()). */ #include <sys/time.h> /* select() (used for ma_sleep()). */
#include <time.h> /* For nanosleep() */ #include <time.h> /* For nanosleep() */
#include <unistd.h> #include <unistd.h>
#endif #endif
/* For fstat(), etc. */ /* For fstat(), etc. */
@ -11729,7 +11729,7 @@ IMPLEMENTATION
#endif #endif
#if _MSC_VER >= 1600 && (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219) #if _MSC_VER >= 1600 && (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219)
static MA_INLINE unsigned __int64 ma_xgetbv(int reg) static MA_INLINE unsigned long long ma_xgetbv(int reg)
{ {
return _xgetbv(reg); return _xgetbv(reg);
} }
@ -17622,7 +17622,7 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
(void)stackSize; /* Suppress unused parameter warning. */ (void)stackSize; /* Suppress unused parameter warning. */
} }
#endif #endif
if (scheduler != -1) { if (scheduler != -1) {
int priorityMin = sched_get_priority_min(scheduler); int priorityMin = sched_get_priority_min(scheduler);
@ -23061,7 +23061,7 @@ static ma_result ma_context_get_MMDevice__wasapi(ma_context* pContext, ma_device
CoInitializeResult = ma_CoInitializeEx(pContext, NULL, MA_COINIT_VALUE); CoInitializeResult = ma_CoInitializeEx(pContext, NULL, MA_COINIT_VALUE);
{ {
hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
} }
if (CoInitializeResult == S_OK || CoInitializeResult == S_FALSE) { ma_CoUninitialize(pContext); } if (CoInitializeResult == S_OK || CoInitializeResult == S_FALSE) { ma_CoUninitialize(pContext); }
if (FAILED(hr)) { /* <-- This is checking the call above to ma_CoCreateInstance(). */ if (FAILED(hr)) { /* <-- This is checking the call above to ma_CoCreateInstance(). */
@ -29687,7 +29687,7 @@ static ma_result ma_device_start__alsa(ma_device* pDevice)
} }
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) { if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
/* /*
When data is written to the device we wait for the device to get ready to receive data with poll(). In my testing When data is written to the device we wait for the device to get ready to receive data with poll(). In my testing
I have observed that poll() can sometimes block forever unless the device is started explicitly with snd_pcm_start() I have observed that poll() can sometimes block forever unless the device is started explicitly with snd_pcm_start()
or some data is written with snd_pcm_writei(). or some data is written with snd_pcm_writei().
@ -35996,7 +35996,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
#endif #endif
} }
status = ((ma_AudioUnitSetProperty_proc)pContext->coreaudio.AudioUnitSetProperty)(pData->audioUnit, kAudioUnitProperty_StreamFormat, formatScope, formatElement, &bestFormat, sizeof(bestFormat)); status = ((ma_AudioUnitSetProperty_proc)pContext->coreaudio.AudioUnitSetProperty)(pData->audioUnit, kAudioUnitProperty_StreamFormat, formatScope, formatElement, &bestFormat, sizeof(bestFormat));
if (status != noErr) { if (status != noErr) {
((ma_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)(pData->audioUnit); ((ma_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)(pData->audioUnit);
@ -39310,7 +39310,7 @@ static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUs
(void)error; (void)error;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] ERROR CALLBACK: error=%d, AAudioStream_getState()=%d\n", error, ((MA_PFN_AAudioStream_getState)pDevice->pContext->aaudio.AAudioStream_getState)(pStream)); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] ERROR CALLBACK: error=%d, AAudioStream_getState()=%d\n", error, ((MA_PFN_AAudioStream_getState)pDevice->pContext->aaudio.AAudioStream_getState)(pStream));
/* /*
When we get an error, we'll assume that the stream is in an erroneous state and needs to be restarted. From the documentation, When we get an error, we'll assume that the stream is in an erroneous state and needs to be restarted. From the documentation,
we cannot do this from the error callback. Therefore we are going to use an event thread for the AAudio backend to do this we cannot do this from the error callback. Therefore we are going to use an event thread for the AAudio backend to do this
@ -39322,13 +39322,13 @@ static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUs
else { else {
job = ma_job_init(MA_JOB_TYPE_DEVICE_AAUDIO_REROUTE); job = ma_job_init(MA_JOB_TYPE_DEVICE_AAUDIO_REROUTE);
job.data.device.aaudio.reroute.pDevice = pDevice; job.data.device.aaudio.reroute.pDevice = pDevice;
if (pStream == pDevice->aaudio.pStreamCapture) { if (pStream == pDevice->aaudio.pStreamCapture) {
job.data.device.aaudio.reroute.deviceType = ma_device_type_capture; job.data.device.aaudio.reroute.deviceType = ma_device_type_capture;
} else { } else {
job.data.device.aaudio.reroute.deviceType = ma_device_type_playback; job.data.device.aaudio.reroute.deviceType = ma_device_type_playback;
} }
result = ma_device_job_thread_post(&pDevice->pContext->aaudio.jobThread, &job); result = ma_device_job_thread_post(&pDevice->pContext->aaudio.jobThread, &job);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] Device Disconnected. Failed to post job for rerouting.\n"); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] Device Disconnected. Failed to post job for rerouting.\n");
@ -39925,7 +39925,7 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev
/* We got disconnected! Retry a few times, until we find a connected device! */ /* We got disconnected! Retry a few times, until we find a connected device! */
iAttempt = 0; iAttempt = 0;
while (iAttempt++ < maxAttempts) { while (iAttempt++ < maxAttempts) {
/* Device tearing down? No need to reroute! */ /* Device tearing down? No need to reroute! */
if (ma_atomic_bool32_get(&pDevice->aaudio.isTearingDown)) { if (ma_atomic_bool32_get(&pDevice->aaudio.isTearingDown)) {
result = MA_SUCCESS; /* Caller should continue as normal. */ result = MA_SUCCESS; /* Caller should continue as normal. */
@ -40023,7 +40023,7 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev
break; break;
} }
} }
return result; return result;
} }
@ -61704,7 +61704,7 @@ static ma_result ma_default_vfs_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_inf
/* Not implemented. Fall back to seek/tell/seek. */ /* Not implemented. Fall back to seek/tell/seek. */
ma_int64 cursor; ma_int64 cursor;
ma_int64 sizeInBytes; ma_int64 sizeInBytes;
result = ma_default_vfs_tell(pVFS, file, &cursor); result = ma_default_vfs_tell(pVFS, file, &cursor);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
return result; return result;
@ -76937,7 +76937,7 @@ static void ma_engine_node_process_pcm_frames__sound(ma_node* pNode, const float
if (pSound->processingCacheFramesRemaining > 0) { if (pSound->processingCacheFramesRemaining > 0) {
MA_MOVE_MEMORY(pSound->pProcessingCache, ma_offset_pcm_frames_ptr_f32(pSound->pProcessingCache, frameCountIn, dataSourceChannels), pSound->processingCacheFramesRemaining * ma_get_bytes_per_frame(ma_format_f32, dataSourceChannels)); MA_MOVE_MEMORY(pSound->pProcessingCache, ma_offset_pcm_frames_ptr_f32(pSound->pProcessingCache, frameCountIn, dataSourceChannels), pSound->processingCacheFramesRemaining * ma_get_bytes_per_frame(ma_format_f32, dataSourceChannels));
} }
totalFramesRead += (ma_uint32)frameCountOut; /* Safe cast. */ totalFramesRead += (ma_uint32)frameCountOut; /* Safe cast. */
if (result != MA_SUCCESS || ma_sound_at_end(pSound)) { if (result != MA_SUCCESS || ma_sound_at_end(pSound)) {
@ -78439,7 +78439,7 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con
if (pSound->processingCacheCap == 0) { if (pSound->processingCacheCap == 0) {
pSound->processingCacheCap = 512; pSound->processingCacheCap = 512;
} }
pSound->pProcessingCache = (float*)ma_calloc(pSound->processingCacheCap * ma_get_bytes_per_frame(ma_format_f32, engineNodeConfig.channelsIn), &pEngine->allocationCallbacks); pSound->pProcessingCache = (float*)ma_calloc(pSound->processingCacheCap * ma_get_bytes_per_frame(ma_format_f32, engineNodeConfig.channelsIn), &pEngine->allocationCallbacks);
if (pSound->pProcessingCache == NULL) { if (pSound->pProcessingCache == NULL) {
ma_engine_node_uninit(&pSound->engineNode, &pEngine->allocationCallbacks); ma_engine_node_uninit(&pSound->engineNode, &pEngine->allocationCallbacks);

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,7 @@ typedef struct _JoinFromInviteData
DWORD dwUserIndex; // dwUserIndex DWORD dwUserIndex; // dwUserIndex
DWORD dwLocalUsersMask; // dwUserMask DWORD dwLocalUsersMask; // dwUserMask
const INVITE_INFO *pInviteInfo; // pInviteInfo const INVITE_INFO *pInviteInfo; // pInviteInfo
} }
JoinFromInviteData; JoinFromInviteData;
class Player; class Player;
@ -55,7 +55,7 @@ class Merchant;
class CMinecraftAudio; class CMinecraftAudio;
class CMinecraftApp class CMinecraftApp
#ifdef _XBOX #ifdef _XBOX
: public CXuiModule : public CXuiModule
@ -92,7 +92,7 @@ public:
#ifdef _EXTENDED_ACHIEVEMENTS #ifdef _EXTENDED_ACHIEVEMENTS
/* 4J-JEV: /* 4J-JEV:
* We need more space in the profile data because of the new achievements and statistics * We need more space in the profile data because of the new achievements and statistics
* necessary for the new expanded achievement set. * necessary for the new expanded achievement set.
*/ */
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2*972; // per user static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2*972; // per user
@ -164,7 +164,7 @@ public:
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;} void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];} eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];}
void SetAction(int iPad, eXuiAction action, LPVOID param = NULL); void SetAction(int iPad, eXuiAction action, LPVOID param = NULL);
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; } void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];} eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];} eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];} LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
@ -282,7 +282,7 @@ public:
void SetGameSettingsDebugMask(int iPad, unsigned int uiVal); void SetGameSettingsDebugMask(int iPad, unsigned int uiVal);
void ActionDebugMask(int iPad, bool bSetAllClear=false); void ActionDebugMask(int iPad, bool bSetAllClear=false);
// //
bool IsLocalMultiplayerAvailable(); bool IsLocalMultiplayerAvailable();
// for sign in change monitoring // for sign in change monitoring
@ -359,7 +359,7 @@ public:
// Texture Pack Data files (icon, banner, comparison shot & text) // Texture Pack Data files (icon, banner, comparison shot & text)
void AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes); void AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes);
void RemoveMemoryTPDFile(int iConfig); void RemoveMemoryTPDFile(int iConfig);
bool IsFileInTPD(int iConfig); bool IsFileInTPD(int iConfig);
void GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes); void GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes);
int GetTPDSize() {return m_MEM_TPD.size();} int GetTPDSize() {return m_MEM_TPD.size();}
@ -444,7 +444,7 @@ private:
static int BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult); static int BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult);
static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
VBANNEDLIST *m_vBannedListA[XUSER_MAX_COUNT]; VBANNEDLIST *m_vBannedListA[XUSER_MAX_COUNT];
void HandleButtonPresses(int iPad); void HandleButtonPresses(int iPad);
@ -472,7 +472,7 @@ private:
static unsigned int m_uiLastSignInData; static unsigned int m_uiLastSignInData;
// We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings // We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings
GAME_SETTINGS *GameSettingsA[XUSER_MAX_COUNT]; GAME_SETTINGS *GameSettingsA[XUSER_MAX_COUNT];
// For promo work // For promo work
@ -517,7 +517,7 @@ private:
eXuiAction m_eXuiAction[XUSER_MAX_COUNT]; eXuiAction m_eXuiAction[XUSER_MAX_COUNT];
eTMSAction m_eTMSAction[XUSER_MAX_COUNT]; eTMSAction m_eTMSAction[XUSER_MAX_COUNT];
LPVOID m_eXuiActionParam[XUSER_MAX_COUNT]; LPVOID m_eXuiActionParam[XUSER_MAX_COUNT];
eXuiAction m_eGlobalXuiAction; eXuiAction m_eGlobalXuiAction;
eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT];
LPVOID m_eXuiServerActionParam[XUSER_MAX_COUNT]; LPVOID m_eXuiServerActionParam[XUSER_MAX_COUNT];
eXuiServerAction m_eGlobalXuiServerAction; eXuiServerAction m_eGlobalXuiServerAction;
@ -541,20 +541,20 @@ private:
// Trial timer // Trial timer
float m_fTrialTimerStart,mfTrialPausedTime; float m_fTrialTimerStart,mfTrialPausedTime;
typedef struct TimeInfo typedef struct TimeInfo
{ {
LARGE_INTEGER qwTime; LARGE_INTEGER qwTime;
LARGE_INTEGER qwAppTime; LARGE_INTEGER qwAppTime;
float fAppTime; float fAppTime;
float fElapsedTime; float fElapsedTime;
float fSecsPerTick; float fSecsPerTick;
} TIMEINFO; } TIMEINFO;
TimeInfo m_Time; TimeInfo m_Time;
protected: protected:
static const int MAX_TIPS_GAMETIP = 50; static const int MAX_TIPS_GAMETIP = 50;
static const int MAX_TIPS_TRIVIATIP = 20; static const int MAX_TIPS_TRIVIATIP = 20;
static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP]; static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP];
static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP]; static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP];
static Random *TipRandom; static Random *TipRandom;
@ -606,7 +606,7 @@ public:
DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId); DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId);
DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName); DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName);
#else #else
static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, __uint64, __uint64, WCHAR *, unsigned int, int, WCHAR *pDataFile); static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, uint64_t, uint64_t, WCHAR *, unsigned int, int, WCHAR *pDataFile);
bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal); bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal);
DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial); DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial);
DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full); DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full);
@ -634,7 +634,7 @@ private:
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) #if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData; static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
static unordered_map<int, char * > DLCTextures_PackID; // for mash-up packs & texture packs static unordered_map<int, char * > DLCTextures_PackID; // for mash-up packs & texture packs
static unordered_map<string,DLC_INFO * > DLCInfo; static unordered_map<string,DLC_INFO * > DLCInfo;
static unordered_map<wstring, ULONGLONG > DLCInfo_SkinName; // skin name, full offer id static unordered_map<wstring, ULONGLONG > DLCInfo_SkinName; // skin name, full offer id
#elif defined(_DURANGO) #elif defined(_DURANGO)
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData; static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
@ -729,7 +729,7 @@ public:
// World seed from png image // World seed from png image
void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack); void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack);
unsigned int CreateImageTextData(PBYTE bTextMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId); unsigned int CreateImageTextData(PBYTE bTextMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
// Game rules // Game rules
GameRuleManager m_gameRules; GameRuleManager m_gameRules;
@ -773,7 +773,7 @@ public:
unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote=false); unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote=false);
int GetDLCInfoTexturesOffersCount(); int GetDLCInfoTexturesOffersCount();
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__) #if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
DLC_INFO *GetDLCInfo(int iIndex); DLC_INFO *GetDLCInfo(int iIndex);
DLC_INFO *GetDLCInfo(char *); DLC_INFO *GetDLCInfo(char *);
DLC_INFO *GetDLCInfoFromTPackID(int iTPID); DLC_INFO *GetDLCInfoFromTPackID(int iTPID);
bool GetDLCNameForPackID(const int iPackID,char **ppchKeyID); bool GetDLCNameForPackID(const int iPackID,char **ppchKeyID);
@ -935,5 +935,5 @@ private:
#endif #endif
}; };
//singleton //singleton
//extern CMinecraftApp app; //extern CMinecraftApp app;

View file

@ -19,17 +19,17 @@ private:
ConsoleSchematicFile::ESchematicRotation m_rotation; ConsoleSchematicFile::ESchematicRotation m_rotation;
int m_dimension; int m_dimension;
__int64 m_totalBlocksChanged; int64_t m_totalBlocksChanged;
__int64 m_totalBlocksChangedLighting; int64_t m_totalBlocksChangedLighting;
bool m_completed; bool m_completed;
void updateLocationBox(); void updateLocationBox();
public: public:
ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions); ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions);
~ApplySchematicRuleDefinition(); ~ApplySchematicRuleDefinition();
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; } virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; }
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs); virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);

View file

@ -38,7 +38,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
dos->writeInt(m_zSize); dos->writeInt(m_zSize);
byteArray ba(new BYTE[ m_data.length ], m_data.length); byteArray ba(new BYTE[ m_data.length ], m_data.length);
Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length, Compression::getCompression()->CompressLZXRLE( ba.data, &ba.length,
m_data.data, m_data.length); m_data.data, m_data.length);
dos->writeInt(ba.length); dos->writeInt(ba.length);
@ -71,13 +71,13 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
m_ySize = dis->readInt(); m_ySize = dis->readInt();
m_zSize = dis->readInt(); m_zSize = dis->readInt();
int compressedSize = dis->readInt(); int compressedSize = dis->readInt();
byteArray compressedBuffer(compressedSize); byteArray compressedBuffer(compressedSize);
dis->readFully(compressedBuffer); dis->readFully(compressedBuffer);
if(m_data.data != NULL) if(m_data.data != NULL)
{ {
delete [] m_data.data; delete [] m_data.data;
m_data.data = NULL; m_data.data = NULL;
} }
@ -145,7 +145,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
double z = pos->get(2)->data; double z = pos->get(2)->data;
if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME ) if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME )
{ {
x = ((IntTag *) eTag->get(L"TileX") )->data; x = ((IntTag *) eTag->get(L"TileX") )->data;
y = ((IntTag *) eTag->get(L"TileY") )->data; y = ((IntTag *) eTag->get(L"TileY") )->data;
z = ((IntTag *) eTag->get(L"TileZ") )->data; z = ((IntTag *) eTag->get(L"TileZ") )->data;
@ -184,7 +184,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
delete tag; delete tag;
} }
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{ {
int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16)); int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16));
int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16)); int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
@ -281,7 +281,7 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
// blockData[i] = Tile::endStone_Id; // blockData[i] = Tile::endStone_Id;
// } // }
//} //}
PIXBeginNamedEvent(0,"Setting Block data"); PIXBeginNamedEvent(0,"Setting Block data");
chunk->setBlockData(blockData); chunk->setBlockData(blockData);
PIXEndNamedEvent(); PIXEndNamedEvent();
@ -323,7 +323,7 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
// At the point that this is called, we have all the neighbouring chunks loaded in (and generally post-processed, apart from this lighting pass), so // At the point that this is called, we have all the neighbouring chunks loaded in (and generally post-processed, apart from this lighting pass), so
// we can do the sort of lighting that might propagate out of the chunk. // we can do the sort of lighting that might propagate out of the chunk.
__int64 ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) int64_t ConsoleSchematicFile::applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{ {
int xStart = max(destinationBox->x0, (double)chunk->x*16); int xStart = max(destinationBox->x0, (double)chunk->x*16);
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16); int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
@ -445,7 +445,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
if ( teCopy != NULL ) if ( teCopy != NULL )
{ {
CompoundTag *teData = new CompoundTag(); CompoundTag *teData = new CompoundTag();
te->save(teData); te->save(teData);
@ -478,7 +478,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
for (auto it = m_entities.begin(); it != m_entities.end();) for (auto it = m_entities.begin(); it != m_entities.end();)
{ {
Vec3 *source = it->first; Vec3 *source = it->first;
double targetX = source->x; double targetX = source->x;
double targetY = source->y + destinationBox->y0; double targetY = source->y + destinationBox->y0;
double targetZ = source->z; double targetZ = source->z;
@ -498,7 +498,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
if( e->GetType() == eTYPE_PAINTING ) if( e->GetType() == eTYPE_PAINTING )
{ {
shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e); shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e);
double tileX = painting->xTile; double tileX = painting->xTile;
double tileZ = painting->zTile; double tileZ = painting->zTile;
schematicCoordToChunkCoord(destinationBox, painting->xTile, painting->zTile, rot, tileX, tileZ); schematicCoordToChunkCoord(destinationBox, painting->xTile, painting->zTile, rot, tileX, tileZ);
@ -511,7 +511,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
else if( e->GetType() == eTYPE_ITEM_FRAME ) else if( e->GetType() == eTYPE_ITEM_FRAME )
{ {
shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e); shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
double tileX = frame->xTile; double tileX = frame->xTile;
double tileZ = frame->zTile; double tileZ = frame->zTile;
schematicCoordToChunkCoord(destinationBox, frame->xTile, frame->zTile, rot, tileX, tileZ); schematicCoordToChunkCoord(destinationBox, frame->xTile, frame->zTile, rot, tileX, tileZ);
@ -559,7 +559,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
zStart-=1; zStart-=1;
else if(zStart < 0 && zStart%2 !=0) else if(zStart < 0 && zStart%2 !=0)
zStart-=1; zStart-=1;
// We want the end to be odd to have a total size that is even // We want the end to be odd to have a total size that is even
if(xEnd > 0 && xEnd%2 == 0) if(xEnd > 0 && xEnd%2 == 0)
xEnd+=1; xEnd+=1;
@ -613,7 +613,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
// Every x is a whole row // Every x is a whole row
for(int xPos = xStart; xPos < xStart + xSize; ++xPos) for(int xPos = xStart; xPos < xStart + xSize; ++xPos)
{ {
int xc = xPos >> 4; int xc = xPos >> 4;
int x0 = xPos - xc * 16; int x0 = xPos - xc * 16;
@ -622,7 +622,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
if (x1 > 16) x1 = 16; if (x1 > 16) x1 = 16;
for(int zPos = zStart; zPos < zStart + zSize;) for(int zPos = zStart; zPos < zStart + zSize;)
{ {
int zc = zPos >> 4; int zc = zPos >> 4;
int z0 = zStart - zc * 16; int z0 = zStart - zc * 16;
@ -713,11 +713,11 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
} }
// 4J-JEV: Changed to check for instances of minecarts and hangingEntities instead of just eTYPE_PAINTING, eTYPE_ITEM_FRAME and eTYPE_MINECART // 4J-JEV: Changed to check for instances of minecarts and hangingEntities instead of just eTYPE_PAINTING, eTYPE_ITEM_FRAME and eTYPE_MINECART
if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY)) if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY))
{ {
CompoundTag *eTag = new CompoundTag(); CompoundTag *eTag = new CompoundTag();
if( e->save(eTag) ) if( e->save(eTag) )
{ {
ListTag<DoubleTag> *pos = (ListTag<DoubleTag> *) eTag->getList(L"Pos"); ListTag<DoubleTag> *pos = (ListTag<DoubleTag> *) eTag->getList(L"Pos");
pos->get(0)->data -= xStart; pos->get(0)->data -= xStart;
@ -725,7 +725,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
pos->get(2)->data -= zStart; pos->get(2)->data -= zStart;
if( e->instanceof(eTYPE_HANGING_ENTITY) ) if( e->instanceof(eTYPE_HANGING_ENTITY) )
{ {
((IntTag *) eTag->get(L"TileX") )->data -= xStart; ((IntTag *) eTag->get(L"TileX") )->data -= xStart;
((IntTag *) eTag->get(L"TileY") )->data -= yStart; ((IntTag *) eTag->get(L"TileY") )->data -= yStart;
((IntTag *) eTag->get(L"TileZ") )->data -= zStart; ((IntTag *) eTag->get(L"TileZ") )->data -= zStart;
@ -766,7 +766,7 @@ void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data,
// skyLightP += skyLightData.length; // skyLightP += skyLightData.length;
// return; // return;
//} //}
bool bHasLower, bHasUpper; bool bHasLower, bHasUpper;
bHasLower = bHasUpper = false; bHasLower = bHasUpper = false;
int lowerY0, lowerY1, upperY0, upperY1; int lowerY0, lowerY1, upperY0, upperY1;

View file

@ -58,7 +58,7 @@ private:
vector<shared_ptr<TileEntity> > m_tileEntities; vector<shared_ptr<TileEntity> > m_tileEntities;
vector< pair<Vec3 *, CompoundTag *> > m_entities; vector< pair<Vec3 *, CompoundTag *> > m_entities;
public: public:
byteArray m_data; byteArray m_data;
public: public:
@ -72,8 +72,8 @@ public:
void save(DataOutputStream *dos); void save(DataOutputStream *dos);
void load(DataInputStream *dis); void load(DataInputStream *dis);
__int64 applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot); int64_t applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
__int64 applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot); int64_t applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
void applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot); void applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
static void generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes); static void generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes);

View file

@ -14,7 +14,7 @@ public:
typedef struct _ValueType typedef struct _ValueType
{ {
union{ union{
__int64 i64; int64_t i64;
int i; int i;
char c; char c;
bool b; bool b;
@ -44,7 +44,7 @@ public:
virtual ~GameRule(); virtual ~GameRule();
Connection *getConnection() { return m_connection; } Connection *getConnection() { return m_connection; }
ValueType getParameter(const wstring &parameterName); ValueType getParameter(const wstring &parameterName);
void setParameter(const wstring &parameterName,ValueType value); void setParameter(const wstring &parameterName,ValueType value);
GameRuleDefinition *getGameRuleDefinition(); GameRuleDefinition *getGameRuleDefinition();

View file

@ -385,7 +385,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
// Read File. // Read File.
// version_number // version_number
__int64 version = dis.readShort(); int64_t version = dis.readShort();
unsigned char compressionType = 0; unsigned char compressionType = 0;
if(version == 0) if(version == 0)
{ {

View file

@ -175,7 +175,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
{ {
if(attributeName.compare(L"seed") == 0) if(attributeName.compare(L"seed") == 0)
{ {
m_seed = _fromString<__int64>(attributeValue); m_seed = _fromString<int64_t>(attributeValue);
app.DebugPrintf("LevelGenerationOptions: Adding parameter m_seed=%I64d\n",m_seed); app.DebugPrintf("LevelGenerationOptions: Adding parameter m_seed=%I64d\n",m_seed);
} }
else if(attributeName.compare(L"spawnX") == 0) else if(attributeName.compare(L"spawnX") == 0)
@ -700,7 +700,7 @@ void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; } bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; } void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
__int64 LevelGenerationOptions::getLevelSeed() { return m_seed; } int64_t LevelGenerationOptions::getLevelSeed() { return m_seed; }
int LevelGenerationOptions::getLevelHasBeenInCreative() { return m_bHasBeenInCreative; } int LevelGenerationOptions::getLevelHasBeenInCreative() { return m_bHasBeenInCreative; }
Pos *LevelGenerationOptions::getSpawnPos() { return m_spawnPos; } Pos *LevelGenerationOptions::getSpawnPos() { return m_spawnPos; }
bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; } bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; }

View file

@ -19,7 +19,7 @@ class GrSource
public: public:
// 4J-JEV: // 4J-JEV:
// Moved all this here; I didn't like that all this header information // Moved all this here; I didn't like that all this header information
// was being mixed in with all the game information as they have // was being mixed in with all the game information as they have
// completely different lifespans. // completely different lifespans.
virtual bool requiresTexturePack()=0; virtual bool requiresTexturePack()=0;
@ -146,7 +146,7 @@ public:
private: private:
// This should match the "MapOptionsRule" definition in the XML schema // This should match the "MapOptionsRule" definition in the XML schema
__int64 m_seed; int64_t m_seed;
bool m_useFlatWorld; bool m_useFlatWorld;
Pos *m_spawnPos; Pos *m_spawnPos;
int m_bHasBeenInCreative; int m_bHasBeenInCreative;
@ -171,13 +171,13 @@ public:
~LevelGenerationOptions(); ~LevelGenerationOptions();
virtual ConsoleGameRules::EGameRuleType getActionType(); virtual ConsoleGameRules::EGameRuleType getActionType();
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes); virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
virtual void getChildren(vector<GameRuleDefinition *> *children); virtual void getChildren(vector<GameRuleDefinition *> *children);
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType); virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue); virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
__int64 getLevelSeed(); int64_t getLevelSeed();
int getLevelHasBeenInCreative(); int getLevelHasBeenInCreative();
Pos *getSpawnPos(); Pos *getSpawnPos();
bool getuseFlatWorld(); bool getuseFlatWorld();
@ -190,7 +190,7 @@ public:
private: private:
void clearSchematics(); void clearSchematics();
public: public:
ConsoleSchematicFile *loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen); ConsoleSchematicFile *loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen);
public: public:
@ -211,7 +211,7 @@ public:
void loadBaseSaveData(); void loadBaseSaveData();
static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask); static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask);
// 4J-JEV: // 4J-JEV:
// ApplySchematicRules contain limited state // ApplySchematicRules contain limited state
// which needs to be reset BEFORE a new game starts. // which needs to be reset BEFORE a new game starts.

View file

@ -45,8 +45,8 @@
CGameNetworkManager g_NetworkManager; CGameNetworkManager g_NetworkManager;
CPlatformNetworkManager *CGameNetworkManager::s_pPlatformNetworkManager; CPlatformNetworkManager *CGameNetworkManager::s_pPlatformNetworkManager;
__int64 CGameNetworkManager::messageQueue[512]; int64_t CGameNetworkManager::messageQueue[512];
__int64 CGameNetworkManager::byteQueue[512]; int64_t CGameNetworkManager::byteQueue[512];
int CGameNetworkManager::messageQueuePos = 0; int CGameNetworkManager::messageQueuePos = 0;
CGameNetworkManager::CGameNetworkManager() CGameNetworkManager::CGameNetworkManager()
@ -194,7 +194,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
ProfileManager.SetDeferredSignoutEnabled(true); ProfileManager.SetDeferredSignoutEnabled(true);
#endif #endif
__int64 seed = 0; int64_t seed = 0;
if(lpParameter != NULL) if(lpParameter != NULL)
{ {
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
@ -287,7 +287,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
} }
} }
static __int64 sseed = seed; // Create static version so this will be valid until next call to this function & whilst thread is running static int64_t sseed = seed; // Create static version so this will be valid until next call to this function & whilst thread is running
ServerStoppedCreate(false); ServerStoppedCreate(false);
if( g_NetworkManager.IsHost() ) if( g_NetworkManager.IsHost() )
{ {
@ -929,7 +929,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
int CGameNetworkManager::ServerThreadProc( void* lpParameter ) int CGameNetworkManager::ServerThreadProc( void* lpParameter )
{ {
__int64 seed = 0; int64_t seed = 0;
if(lpParameter != NULL) if(lpParameter != NULL)
{ {
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter; NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;

View file

@ -100,11 +100,11 @@ public:
void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
void ForceFriendsSessionRefresh(); void ForceFriendsSessionRefresh();
// Session joining and leaving // Session joining and leaving
bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo); bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask); eJoinGameResult JoinGame(FriendSessionInfo *searchResult, int localUsersMask);
static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface
bool LeaveGame(bool bMigrateHost); bool LeaveGame(bool bMigrateHost);
static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad); static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad);
@ -113,13 +113,13 @@ public:
void ResetLeavingGame(); void ResetLeavingGame();
// Threads // Threads
bool IsNetworkThreadRunning(); bool IsNetworkThreadRunning();
static int RunNetworkGameThreadProc( void* lpParameter ); static int RunNetworkGameThreadProc( void* lpParameter );
static int ServerThreadProc( void* lpParameter ); static int ServerThreadProc( void* lpParameter );
static int ExitAndJoinFromInviteThreadProc( void* lpParam ); static int ExitAndJoinFromInviteThreadProc( void* lpParam );
#if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__) #if (defined __PS3__) || (defined __ORBIS__) || (defined __PSVITA__)
static int MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result); static int MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result);
static int PSNSignInReturned_0(void* pParam, bool bContinue, int iPad); static int PSNSignInReturned_0(void* pParam, bool bContinue, int iPad);
@ -130,7 +130,7 @@ public:
static void _LeaveGame(); static void _LeaveGame();
static int ChangeSessionTypeThreadProc( void* lpParam ); static int ChangeSessionTypeThreadProc( void* lpParam );
// System flags // System flags
void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index); void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index); bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index);
@ -145,8 +145,8 @@ public:
void ServerStoppedCreate(bool create); // Create the signal void ServerStoppedCreate(bool create); // Create the signal
void ServerStopped(); // Signal that we are ready void ServerStopped(); // Signal that we are ready
void ServerStoppedWait(); // Wait for the signal void ServerStoppedWait(); // Wait for the signal
void ServerStoppedDestroy(); // Destroy signal void ServerStoppedDestroy(); // Destroy signal
bool ServerStoppedValid(); // Is non-NULL bool ServerStoppedValid(); // Is non-NULL
#ifdef __PSVITA__ #ifdef __PSVITA__
@ -164,9 +164,9 @@ public:
// Used for debugging output // Used for debugging output
static const int messageQueue_length = 512; static const int messageQueue_length = 512;
static __int64 messageQueue[messageQueue_length]; static int64_t messageQueue[messageQueue_length];
static const int byteQueue_length = 512; static const int byteQueue_length = 512;
static __int64 byteQueue[byteQueue_length]; static int64_t byteQueue[byteQueue_length];
static int messageQueuePos; static int messageQueuePos;
// Methods called from PlatformNetworkManager // Methods called from PlatformNetworkManager

View file

@ -734,7 +734,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
info->data.playerCount = lanSessions[i].playerCount; info->data.playerCount = lanSessions[i].playerCount;
info->data.maxPlayers = lanSessions[i].maxPlayers; info->data.maxPlayers = lanSessions[i].maxPlayers;
info->sessionId = (SessionID)((unsigned __int64)inet_addr(lanSessions[i].hostIP) | ((unsigned __int64)lanSessions[i].hostPort << 32)); info->sessionId = (SessionID)((uint64_t)inet_addr(lanSessions[i].hostIP) | ((uint64_t)lanSessions[i].hostPort << 32));
friendsSessions[0].push_back(info); friendsSessions[0].push_back(info);
} }

View file

@ -132,6 +132,6 @@ int NetworkPlayerSony::GetTimeSinceLastChunkPacket_ms()
return INT_MAX; return INT_MAX;
} }
__int64 currentTime = System::currentTimeMillis(); int64_t currentTime = System::currentTimeMillis();
return (int)( currentTime - m_lastChunkPacketTime ); return (int)( currentTime - m_lastChunkPacketTime );
} }

View file

@ -39,5 +39,5 @@ public:
private: private:
SQRNetworkPlayer *m_sqrPlayer; SQRNetworkPlayer *m_sqrPlayer;
Socket *m_pSocket; Socket *m_pSocket;
__int64 m_lastChunkPacketTime; int64_t m_lastChunkPacketTime;
}; };

View file

@ -145,7 +145,7 @@ bool SQRNetworkPlayer::IsReady()
{ {
return ( ( m_flags & SNP_FLAG_READY_MASK ) == SNP_FLAG_READY_MASK ); return ( ( m_flags & SNP_FLAG_READY_MASK ) == SNP_FLAG_READY_MASK );
} }
PlayerUID SQRNetworkPlayer::GetUID() PlayerUID SQRNetworkPlayer::GetUID()
{ {
return m_ISD.m_UID; return m_ISD.m_UID;
@ -224,7 +224,7 @@ void SQRNetworkPlayer::SendData( SQRNetworkPlayer *pPlayerTarget, const void *da
{ {
AckFlags ackFlags = ack ? e_flag_AckRequested : e_flag_AckNotRequested; AckFlags ackFlags = ack ? e_flag_AckRequested : e_flag_AckNotRequested;
// Our network is connected as a star. If we are the host, then we can send to any remote player. If we're a client, we can send only to the host. // Our network is connected as a star. If we are the host, then we can send to any remote player. If we're a client, we can send only to the host.
// The host can also send to other local players, but this doesn't need to go through Rudp. // The host can also send to other local players, but this doesn't need to go through Rudp.
if( m_host ) if( m_host )
{ {
if( ( m_type == SNP_TYPE_HOST ) && ( pPlayerTarget->m_type == SNP_TYPE_LOCAL ) ) if( ( m_type == SNP_TYPE_HOST ) && ( pPlayerTarget->m_type == SNP_TYPE_LOCAL ) )
@ -286,7 +286,7 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack
sendBlock.end = NULL; sendBlock.end = NULL;
sendBlock.current = NULL; sendBlock.current = NULL;
sendBlock.ack = ackFlags; sendBlock.ack = ackFlags;
m_sendQueue.push(sendBlock); m_sendQueue.push(sendBlock);
} }
else else
{ {
@ -299,13 +299,13 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack
sendBlock.current = sendBlock.start; sendBlock.current = sendBlock.start;
sendBlock.ack = ackFlags; sendBlock.ack = ackFlags;
memcpy( sendBlock.start, dataCurrent, dataSize); memcpy( sendBlock.start, dataCurrent, dataSize);
m_sendQueue.push(sendBlock); m_sendQueue.push(sendBlock);
dataRemaining -= dataSize; dataRemaining -= dataSize;
dataCurrent += dataSize; dataCurrent += dataSize;
} }
} }
m_totalBytesInSendQueue += dataSize; m_totalBytesInSendQueue += dataSize;
// if the queue had something in it already, then the UDP callback will fire and call SendMoreInternal // if the queue had something in it already, then the UDP callback will fire and call SendMoreInternal
// so we don't call it here, to avoid a deadlock // so we don't call it here, to avoid a deadlock
@ -343,7 +343,7 @@ int SQRNetworkPlayer::WriteDataPacket(const void* data, int dataSize, AckFlags a
// nothing was sent! // nothing was sent!
} }
else else
{ {
assert(ret==packetSize || ret > headerSize); // we must make sure we've sent the entire packet or the header and some data at least assert(ret==packetSize || ret > headerSize); // we must make sure we've sent the entire packet or the header and some data at least
ret -= headerSize; ret -= headerSize;
if(ackFlags == e_flag_AckRequested) if(ackFlags == e_flag_AckRequested)
@ -443,7 +443,7 @@ void SQRNetworkPlayer::ReadAck()
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
#ifdef PRINT_ACK_STATS #ifdef PRINT_ACK_STATS
__int64 timeTaken = System::currentTimeMillis() - m_ackStats[0]; int64_t timeTaken = System::currentTimeMillis() - m_ackStats[0];
if(timeTaken < m_minAckTime) if(timeTaken < m_minAckTime)
m_minAckTime = timeTaken; m_minAckTime = timeTaken;
if(timeTaken > m_maxAckTime) if(timeTaken > m_maxAckTime)
@ -525,7 +525,7 @@ void SQRNetworkPlayer::SendMoreInternal()
{ {
keepSending = true; keepSending = true;
} }
} }
else if( ( ret >= 0 ) || ( ret == sc_wouldBlockFlag ) ) else if( ( ret >= 0 ) || ( ret == sc_wouldBlockFlag ) )
{ {
@ -543,7 +543,7 @@ void SQRNetworkPlayer::SendMoreInternal()
// Is CELL_RUDP_ERROR_WOULDBLOCK, nothing has yet been sent // Is CELL_RUDP_ERROR_WOULDBLOCK, nothing has yet been sent
remainingBytes = dataSize; remainingBytes = dataSize;
} }
m_sendQueue.front().current = m_sendQueue.front().end - remainingBytes; m_sendQueue.front().current = m_sendQueue.front().end - remainingBytes;
} }
} }
} while (keepSending); } while (keepSending);

View file

@ -68,11 +68,11 @@ class SQRNetworkPlayer
}; };
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
std::vector<__int64> m_ackStats; std::vector<int64_t> m_ackStats;
int m_minAckTime; int m_minAckTime;
int m_maxAckTime; int m_maxAckTime;
int m_totalAcks; int m_totalAcks;
__int64 m_totalAckTime; int64_t m_totalAckTime;
int m_averageAckTime; int m_averageAckTime;
#endif #endif
@ -89,7 +89,7 @@ class SQRNetworkPlayer
{ {
public: public:
unsigned char m_smallId; // Id to uniquely and permanently identify this player between machines - assigned by the server unsigned char m_smallId; // Id to uniquely and permanently identify this player between machines - assigned by the server
PlayerUID m_UID; PlayerUID m_UID;
}; };
SQRNetworkPlayer(SQRNetworkManager *manager, eSQRNetworkPlayerType playerType, bool onHost, SceNpMatching2RoomMemberId roomMemberId, int localPlayerIdx, int rudpCtx, PlayerUID *pUID); SQRNetworkPlayer(SQRNetworkManager *manager, eSQRNetworkPlayerType playerType, bool onHost, SceNpMatching2RoomMemberId roomMemberId, int localPlayerIdx, int rudpCtx, PlayerUID *pUID);
@ -114,7 +114,7 @@ class SQRNetworkPlayer
int WriteDataPacket(const void* data, int dataSize, AckFlags ackFlags); int WriteDataPacket(const void* data, int dataSize, AckFlags ackFlags);
void ReadAck(); void ReadAck();
void WriteAck(); void WriteAck();
int GetOutstandingAckCount(); int GetOutstandingAckCount();
int GetSendQueueSizeBytes(); int GetSendQueueSizeBytes();
int GetSendQueueSizeMessages(); int GetSendQueueSizeMessages();

View file

@ -25,11 +25,11 @@ static SceRemoteStorageStatus statParams;
// { // {
// app.DebugPrintf("remoteStorageGetCallback err : 0x%08x\n"); // app.DebugPrintf("remoteStorageGetCallback err : 0x%08x\n");
// } // }
// //
// void remoteStorageCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) // void remoteStorageCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code)
// { // {
// app.DebugPrintf("remoteStorageCallback err : 0x%08x\n"); // app.DebugPrintf("remoteStorageCallback err : 0x%08x\n");
// //
// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL); // app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL);
// } // }
@ -193,7 +193,7 @@ ESavePlatform SonyRemoteStorage::getSavePlatform()
} }
__int64 SonyRemoteStorage::getSaveSeed() int64_t SonyRemoteStorage::getSaveSeed()
{ {
if(m_getInfoStatus != e_infoFound) if(m_getInfoStatus != e_infoFound)
return 0; return 0;
@ -223,9 +223,9 @@ const char* SonyRemoteStorage::getRemoteSaveFilename()
int SonyRemoteStorage::getSaveFilesize() int SonyRemoteStorage::getSaveFilesize()
{ {
if(m_getInfoStatus == e_infoFound) if(m_getInfoStatus == e_infoFound)
{ {
return m_remoteFileInfo->fileSize; return m_remoteFileInfo->fileSize;
} }
return 0; return 0;
} }
@ -288,9 +288,9 @@ bool SonyRemoteStorage::saveIsAvailable()
if(m_getInfoStatus != e_infoFound) if(m_getInfoStatus != e_infoFound)
return false; return false;
#ifdef __PS3__ #ifdef __PS3__
return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA); return (getSavePlatform() == SAVE_FILE_PLATFORM_PSVITA);
#elif defined __PSVITA__ #elif defined __PSVITA__
return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3); return (getSavePlatform() == SAVE_FILE_PLATFORM_PS3);
#else // __ORBIS__ #else // __ORBIS__
return true; return true;
#endif #endif
@ -320,7 +320,7 @@ int SonyRemoteStorage::getDataProgress()
int nextChunk = ((sizeTransferred + chunkSize) * 100) / totalSize; int nextChunk = ((sizeTransferred + chunkSize) * 100) / totalSize;
__int64 time = System::currentTimeMillis(); int64_t time = System::currentTimeMillis();
int elapsedSecs = (time - m_startTime) / 1000; int elapsedSecs = (time - m_startTime) / 1000;
float estimatedTransfered = float(elapsedSecs * transferRatePerSec); float estimatedTransfered = float(elapsedSecs * transferRatePerSec);
int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100; int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100;
@ -341,15 +341,15 @@ bool SonyRemoteStorage::shutdown()
if(m_bInitialised) if(m_bInitialised)
{ {
int ret = sceRemoteStorageTerm(); int ret = sceRemoteStorageTerm();
if(ret >= 0) if(ret >= 0)
{ {
app.DebugPrintf("Term request done \n"); app.DebugPrintf("Term request done \n");
m_bInitialised = false; m_bInitialised = false;
free(m_memPoolBuffer); free(m_memPoolBuffer);
m_memPoolBuffer = NULL; m_memPoolBuffer = NULL;
return true; return true;
} }
else else
{ {
app.DebugPrintf("Error in Term request: 0x%x \n", ret); app.DebugPrintf("Error in Term request: 0x%x \n", ret);
return false; return false;
@ -409,7 +409,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData)
char seed[22]; char seed[22];
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
__int64 iSeed = strtoll(seed,NULL,10); int64_t iSeed = strtoll(seed,NULL,10);
SetU64HexBytes(descData.m_seed, iSeed); SetU64HexBytes(descData.m_seed, iSeed);
// Save the host options that this world was last played with // Save the host options that this world was last played with
SetU32HexBytes(descData.m_hostOptions, uiHostOptions); SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
@ -433,7 +433,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
char descDataVersion[9]; char descDataVersion[9];
sprintf(descDataVersion,"%08x",sc_CurrentDescDataVersion); sprintf(descDataVersion,"%08x",sc_CurrentDescDataVersion);
memcpy(descData.m_descDataVersion,descDataVersion,8); // Don't copy null memcpy(descData.m_descDataVersion,descDataVersion,8); // Don't copy null
descData.m_platform[0] = SAVE_FILE_PLATFORM_LOCAL & 0xff; descData.m_platform[0] = SAVE_FILE_PLATFORM_LOCAL & 0xff;
descData.m_platform[1] = (SAVE_FILE_PLATFORM_LOCAL >> 8) & 0xff; descData.m_platform[1] = (SAVE_FILE_PLATFORM_LOCAL >> 8) & 0xff;
@ -448,7 +448,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
char seed[22]; char seed[22];
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
__int64 iSeed = strtoll(seed,NULL,10); int64_t iSeed = strtoll(seed,NULL,10);
SetU64HexBytes(descData.m_seed, iSeed); SetU64HexBytes(descData.m_seed, iSeed);
// Save the host options that this world was last played with // Save the host options that this world was last played with
SetU32HexBytes(descData.m_hostOptions, uiHostOptions); SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
@ -468,7 +468,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes) uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes)
{ {
char hexString[9]; char hexString[9];
ZeroMemory(hexString,9); ZeroMemory(hexString,9);
memcpy(hexString, hexBytes,8); memcpy(hexString, hexBytes,8);
uint32_t u32Val = 0; uint32_t u32Val = 0;
@ -481,7 +481,7 @@ uint32_t SonyRemoteStorage::GetU32FromHexBytes(char* hexBytes)
uint64_t SonyRemoteStorage::GetU64FromHexBytes(char* hexBytes) uint64_t SonyRemoteStorage::GetU64FromHexBytes(char* hexBytes)
{ {
char hexString[17]; char hexString[17];
ZeroMemory(hexString,17); ZeroMemory(hexString,17);
memcpy(hexString, hexBytes,16); memcpy(hexString, hexBytes,16);
uint64_t u64Val = 0; uint64_t u64Val = 0;

View file

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "..\..\Common\Network\Sony\sceRemoteStorage\header\sceRemoteStorage.h" #include "..\..\Common\Network\Sony\sceRemoteStorage\header\sceRemoteStorage.h"
@ -43,7 +43,7 @@ public:
char m_saveFileDesc[128]; char m_saveFileDesc[128];
class DescriptionData class DescriptionData
{ {
// this stuff is read from a JSON query, so it all has to be text based, max 256 bytes // this stuff is read from a JSON query, so it all has to be text based, max 256 bytes
public: public:
char m_platform[4]; char m_platform[4];
@ -54,7 +54,7 @@ public:
}; };
class DescriptionData_V2 class DescriptionData_V2
{ {
// this stuff is read from a JSON query, so it all has to be text based, max 256 bytes // this stuff is read from a JSON query, so it all has to be text based, max 256 bytes
public: public:
char m_platformNone[4]; // set to no platform, to indicate we're using the newer version of the data char m_platformNone[4]; // set to no platform, to indicate we're using the newer version of the data
@ -73,7 +73,7 @@ public:
public: public:
int m_descDataVersion; int m_descDataVersion;
ESavePlatform m_savePlatform; ESavePlatform m_savePlatform;
__int64 m_seed; int64_t m_seed;
uint32_t m_hostOptions; uint32_t m_hostOptions;
uint32_t m_texturePack; uint32_t m_texturePack;
uint32_t m_saveVersion; uint32_t m_saveVersion;
@ -115,7 +115,7 @@ public:
const char* getLocalFilename(); const char* getLocalFilename();
const char* getSaveNameUTF8(); const char* getSaveNameUTF8();
ESavePlatform getSavePlatform(); ESavePlatform getSavePlatform();
__int64 getSaveSeed(); int64_t getSaveSeed();
unsigned int getSaveHostOptions(); unsigned int getSaveHostOptions();
unsigned int getSaveTexturePack(); unsigned int getSaveTexturePack();
@ -140,7 +140,7 @@ public:
static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes);
static int setDataThread(void* lpParam); static int setDataThread(void* lpParam);
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {} SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
protected: protected:
const char* getRemoteSaveFilename(); const char* getRemoteSaveFilename();
@ -154,7 +154,7 @@ protected:
unsigned int m_thumbnailDataSize; unsigned int m_thumbnailDataSize;
C4JThread* m_SetDataThread; C4JThread* m_SetDataThread;
PSAVE_INFO m_setDataSaveInfo; PSAVE_INFO m_setDataSaveInfo;
__int64 m_startTime; int64_t m_startTime;
bool m_bAborting; bool m_bAborting;
bool m_bTransferStarted; bool m_bTransferStarted;

View file

@ -47,7 +47,7 @@ void UIComponent_Panorama::tick()
EnterCriticalSection(&pMinecraft->m_setLevelCS); EnterCriticalSection(&pMinecraft->m_setLevelCS);
if(pMinecraft->level!=NULL) if(pMinecraft->level!=NULL)
{ {
__int64 i64TimeOfDay =0; int64_t i64TimeOfDay =0;
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight // are we in the Nether? - Leave the time as 0 if we are, so we show daylight
if(pMinecraft->level->dimension->id==0) if(pMinecraft->level->dimension->id==0)
{ {
@ -104,7 +104,7 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp
IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight ); IggyPlayerSetDisplaySize( getMovie(), m_movieWidth, m_movieHeight );
IggyPlayerDrawTilesStart ( getMovie() ); IggyPlayerDrawTilesStart ( getMovie() );
m_renderWidth = tileWidth; m_renderWidth = tileWidth;
m_renderHeight = tileHeight; m_renderHeight = tileHeight;
IggyPlayerDrawTile ( getMovie() , IggyPlayerDrawTile ( getMovie() ,
@ -112,7 +112,7 @@ void UIComponent_Panorama::render(S32 width, S32 height, C4JRender::eViewportTyp
tileYStart , tileYStart ,
tileXStart + tileWidth , tileXStart + tileWidth ,
tileYStart + tileHeight , tileYStart + tileHeight ,
0 ); 0 );
IggyPlayerDrawTilesEnd ( getMovie() ); IggyPlayerDrawTilesEnd ( getMovie() );
} }
else else

View file

@ -24,7 +24,7 @@ bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *pa
return success; return success;
} }
void UIControl_SpaceIndicatorBar::init(UIString label, int id, __int64 min, __int64 max) void UIControl_SpaceIndicatorBar::init(UIString label, int id, int64_t min, int64_t max)
{ {
m_label = label; m_label = label;
m_id = id; m_id = id;
@ -61,11 +61,11 @@ void UIControl_SpaceIndicatorBar::reset()
setSaveGameOffset(0.0f); setSaveGameOffset(0.0f);
} }
void UIControl_SpaceIndicatorBar::addSave(__int64 size) void UIControl_SpaceIndicatorBar::addSave(int64_t size)
{ {
float startPercent = (float)((m_currentTotal-m_min))/(m_max-m_min); float startPercent = (float)((m_currentTotal-m_min))/(m_max-m_min);
m_sizeAndOffsets.push_back( pair<__int64, float>(size, startPercent) ); m_sizeAndOffsets.push_back( pair<int64_t, float>(size, startPercent) );
m_currentTotal += size; m_currentTotal += size;
setTotalSize(m_currentTotal); setTotalSize(m_currentTotal);
@ -75,7 +75,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index)
{ {
if(index >= 0 && index < m_sizeAndOffsets.size()) if(index >= 0 && index < m_sizeAndOffsets.size())
{ {
pair<__int64,float> values = m_sizeAndOffsets[index]; pair<int64_t,float> values = m_sizeAndOffsets[index];
setSaveSize(values.first); setSaveSize(values.first);
setSaveGameOffset(values.second); setSaveGameOffset(values.second);
} }
@ -86,7 +86,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index)
} }
} }
void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size) void UIControl_SpaceIndicatorBar::setSaveSize(int64_t size)
{ {
m_currentSave = size; m_currentSave = size;
@ -99,7 +99,7 @@ void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size)
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setSaveSizeFunc , 1 , value ); IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setSaveSizeFunc , 1 , value );
} }
void UIControl_SpaceIndicatorBar::setTotalSize(__int64 size) void UIControl_SpaceIndicatorBar::setTotalSize(int64_t size)
{ {
float percent = (float)((m_currentTotal-m_min))/(m_max-m_min); float percent = (float)((m_currentTotal-m_min))/(m_max-m_min);

View file

@ -6,28 +6,28 @@ class UIControl_SpaceIndicatorBar : public UIControl_Base
{ {
private: private:
IggyName m_setSaveSizeFunc, m_setTotalSizeFunc, m_setSaveGameOffsetFunc; IggyName m_setSaveSizeFunc, m_setTotalSizeFunc, m_setSaveGameOffsetFunc;
__int64 m_min; int64_t m_min;
__int64 m_max; int64_t m_max;
__int64 m_currentSave, m_currentTotal; int64_t m_currentSave, m_currentTotal;
float m_currentOffset; float m_currentOffset;
vector<pair<__int64,float> > m_sizeAndOffsets; vector<pair<int64_t,float> > m_sizeAndOffsets;
public: public:
UIControl_SpaceIndicatorBar(); UIControl_SpaceIndicatorBar();
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName); virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
void init(UIString label, int id, __int64 min, __int64 max); void init(UIString label, int id, int64_t min, int64_t max);
virtual void ReInit(); virtual void ReInit();
void reset(); void reset();
void addSave(__int64 size); void addSave(int64_t size);
void selectSave(int index); void selectSave(int index);
private: private:
void setSaveSize(__int64 size); void setSaveSize(int64_t size);
void setTotalSize(__int64 totalSize); void setTotalSize(int64_t totalSize);
void setSaveGameOffset(float offset); void setSaveGameOffset(float offset);
}; };

View file

@ -144,7 +144,7 @@ extern "C" void *__real_malloc(size_t t);
extern "C" void __real_free(void *t); extern "C" void __real_free(void *t);
#endif #endif
__int64 UIController::iggyAllocCount = 0; int64_t UIController::iggyAllocCount = 0;
static unordered_map<void *,size_t> allocations; static unordered_map<void *,size_t> allocations;
static void * RADLINK AllocateFunction ( void * alloc_callback_user_data , size_t size_requested , size_t * size_returned ) static void * RADLINK AllocateFunction ( void * alloc_callback_user_data , size_t size_requested , size_t * size_returned )
{ {
@ -502,7 +502,7 @@ void UIController::tick()
} }
// Clear out the cached movie file data // Clear out the cached movie file data
__int64 currentTime = System::currentTimeMillis(); int64_t currentTime = System::currentTimeMillis();
for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();) for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();)
{ {
if(it->second.m_expiry < currentTime) if(it->second.m_expiry < currentTime)
@ -622,7 +622,7 @@ IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinN
IggyMemoryUseInfo memoryInfo; IggyMemoryUseInfo memoryInfo;
rrbool res; rrbool res;
int iteration = 0; int iteration = 0;
__int64 totalStatic = 0; int64_t totalStatic = 0;
while(res = IggyDebugGetMemoryUseInfo ( NULL , while(res = IggyDebugGetMemoryUseInfo ( NULL ,
lib , lib ,
"" , "" ,
@ -753,7 +753,7 @@ void UIController::CleanUpSkinReload()
byteArray UIController::getMovieData(const wstring &filename) byteArray UIController::getMovieData(const wstring &filename)
{ {
// Cache everything we load in the current tick // Cache everything we load in the current tick
__int64 targetTime = System::currentTimeMillis() + (1000LL * 60); int64_t targetTime = System::currentTimeMillis() + (1000LL * 60);
auto it = m_cachedMovieData.find(filename); auto it = m_cachedMovieData.find(filename);
if(it == m_cachedMovieData.end() ) if(it == m_cachedMovieData.end() )
{ {
@ -1441,8 +1441,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
//!(app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_ToggleFont)) && //!(app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_ToggleFont)) &&
key == ACTION_MENU_STICK_PRESS) key == ACTION_MENU_STICK_PRESS)
{ {
__int64 totalStatic = 0; int64_t totalStatic = 0;
__int64 totalDynamic = 0; int64_t totalDynamic = 0;
app.DebugPrintf(app.USER_SR, "********************************\n"); app.DebugPrintf(app.USER_SR, "********************************\n");
app.DebugPrintf(app.USER_SR, "BEGIN TOTAL SWF MEMORY USAGE\n\n"); app.DebugPrintf(app.USER_SR, "BEGIN TOTAL SWF MEMORY USAGE\n\n");
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) for(unsigned int i = 0; i < eUIGroup_COUNT; ++i)
@ -1451,8 +1451,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
} }
for(unsigned int i = 0; i < eLibrary_Count; ++i) for(unsigned int i = 0; i < eLibrary_Count; ++i)
{ {
__int64 libraryStatic = 0; int64_t libraryStatic = 0;
__int64 libraryDynamic = 0; int64_t libraryDynamic = 0;
if(m_iggyLibraries[i] != IGGY_INVALID_LIBRARY) if(m_iggyLibraries[i] != IGGY_INVALID_LIBRARY)
{ {
@ -2479,7 +2479,7 @@ void UIController::OverrideSFX(int iPad, int iAction,bool bVal)
void UIController::PlayUISFX(ESoundEffect eSound) void UIController::PlayUISFX(ESoundEffect eSound)
{ {
__uint64 time = System::currentTimeMillis(); uint64_t time = System::currentTimeMillis();
// Don't play multiple SFX on the same tick // Don't play multiple SFX on the same tick
// (prevents horrible sounds when programmatically setting multiple checkboxes) // (prevents horrible sounds when programmatically setting multiple checkboxes)

View file

@ -16,7 +16,7 @@ class UIControl;
class UIController : public IUIController class UIController : public IUIController
{ {
public: public:
static __int64 iggyAllocCount; static int64_t iggyAllocCount;
// MGH - added to prevent crash loading Iggy movies while the skins were being reloaded // MGH - added to prevent crash loading Iggy movies while the skins were being reloaded
static CRITICAL_SECTION ms_reloadSkinCS; static CRITICAL_SECTION ms_reloadSkinCS;
@ -30,7 +30,7 @@ private:
CRITICAL_SECTION m_navigationLock; CRITICAL_SECTION m_navigationLock;
static const int UI_REPEAT_KEY_DELAY_MS = 300; // How long from press until the first repeat static const int UI_REPEAT_KEY_DELAY_MS = 300; // How long from press until the first repeat
static const int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats static const int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats
DWORD m_actionRepeatTimer[XUSER_MAX_COUNT][ACTION_MAX_MENU+1]; DWORD m_actionRepeatTimer[XUSER_MAX_COUNT][ACTION_MAX_MENU+1];
float m_fScreenWidth; float m_fScreenWidth;
@ -50,7 +50,7 @@ private:
eFont_Korean, eFont_Korean,
}; };
// 4J-JEV: It's important that currentFont == targetFont, unless updateCurrentLanguage is going to be called. // 4J-JEV: It's important that currentFont == targetFont, unless updateCurrentLanguage is going to be called.
EFont m_eCurrentFont, m_eTargetFont; EFont m_eCurrentFont, m_eTargetFont;
@ -76,7 +76,7 @@ private:
// 4J-PB - ui element type for PSVita touch control // 4J-PB - ui element type for PSVita touch control
#ifdef __PSVITA__ #ifdef __PSVITA__
typedef struct typedef struct
{ {
UIControl *pControl; UIControl *pControl;
S32 x1,y1,x2,y2; S32 x1,y1,x2,y2;
@ -141,7 +141,7 @@ private:
C4JRender::eViewportType m_currentRenderViewport; C4JRender::eViewportType m_currentRenderViewport;
bool m_bCustomRenderPosition; bool m_bCustomRenderPosition;
static DWORD m_dwTrialTimerLimitSecs; static DWORD m_dwTrialTimerLimitSecs;
unordered_map<wstring, byteArray> m_substitutionTextures; unordered_map<wstring, byteArray> m_substitutionTextures;
@ -149,7 +149,7 @@ private:
typedef struct _CachedMovieData typedef struct _CachedMovieData
{ {
byteArray m_ba; byteArray m_ba;
__int64 m_expiry; int64_t m_expiry;
} CachedMovieData; } CachedMovieData;
unordered_map<wstring, CachedMovieData> m_cachedMovieData; unordered_map<wstring, CachedMovieData> m_cachedMovieData;
@ -173,7 +173,7 @@ private:
C4JThread *m_reloadSkinThread; C4JThread *m_reloadSkinThread;
bool m_navigateToHomeOnReload; bool m_navigateToHomeOnReload;
int m_accumulatedTicks; int m_accumulatedTicks;
__uint64 m_lastUiSfx; // Tracks time (ms) of last UI sound effect uint64_t m_lastUiSfx; // Tracks time (ms) of last UI sound effect
D3D11_RECT m_customRenderingClearRect; D3D11_RECT m_customRenderingClearRect;
@ -217,7 +217,7 @@ protected:
void postInit(); void postInit();
public: public:
CRITICAL_SECTION m_Allocatorlock; CRITICAL_SECTION m_Allocatorlock;
void SetupFont(); void SetupFont();
bool PendingFontChange(); bool PendingFontChange();
@ -249,7 +249,7 @@ private:
void tickInput(); void tickInput();
void handleInput(); void handleInput();
void handleKeyPress(unsigned int iPad, unsigned int key); void handleKeyPress(unsigned int iPad, unsigned int key);
protected: protected:
static rrbool RADLINK ExternalFunctionCallback( void * user_callback_data , Iggy * player , IggyExternalFunctionCallUTF16 * call ); static rrbool RADLINK ExternalFunctionCallback( void * user_callback_data , Iggy * player , IggyExternalFunctionCallUTF16 * call );
@ -319,7 +319,7 @@ private:
public: public:
void CloseAllPlayersScenes(); void CloseAllPlayersScenes();
void CloseUIScenes(int iPad, bool forceIPad = false); void CloseUIScenes(int iPad, bool forceIPad = false);
virtual bool IsPauseMenuDisplayed(int iPad); virtual bool IsPauseMenuDisplayed(int iPad);
virtual bool IsContainerMenuDisplayed(int iPad); virtual bool IsContainerMenuDisplayed(int iPad);
virtual bool IsIgnorePlayerJoinMenuDisplayed(int iPad); virtual bool IsIgnorePlayerJoinMenuDisplayed(int iPad);

View file

@ -81,7 +81,7 @@ void UIGroup::tick()
} }
// Handle deferred update focus // Handle deferred update focus
if (m_updateFocusStateCountdown > 0) if (m_updateFocusStateCountdown > 0)
{ {
m_updateFocusStateCountdown--; m_updateFocusStateCountdown--;
if (m_updateFocusStateCountdown == 0)_UpdateFocusState(); if (m_updateFocusStateCountdown == 0)_UpdateFocusState();
@ -233,7 +233,7 @@ void UIGroup::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel
} }
} }
// FOCUS // FOCUS
// Check that a layer may recieve focus, specifically that there is no infocus layer above // Check that a layer may recieve focus, specifically that there is no infocus layer above
bool UIGroup::RequestFocus(UILayer* layerPtr) bool UIGroup::RequestFocus(UILayer* layerPtr)
@ -389,16 +389,16 @@ unsigned int UIGroup::GetLayerIndex(UILayer* layerPtr)
// can't get here... // can't get here...
return 0; return 0;
} }
void UIGroup::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic) void UIGroup::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
{ {
__int64 groupStatic = 0; int64_t groupStatic = 0;
__int64 groupDynamic = 0; int64_t groupDynamic = 0;
app.DebugPrintf(app.USER_SR, "-- BEGIN GROUP %d\n",m_group); app.DebugPrintf(app.USER_SR, "-- BEGIN GROUP %d\n",m_group);
for(unsigned int i = 0; i < eUILayer_COUNT; ++i) for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
{ {
app.DebugPrintf(app.USER_SR, " \\- BEGIN LAYER %d\n",i); app.DebugPrintf(app.USER_SR, " \\- BEGIN LAYER %d\n",i);
m_layers[i]->PrintTotalMemoryUsage(groupStatic, groupDynamic); m_layers[i]->PrintTotalMemoryUsage(groupStatic, groupDynamic);
app.DebugPrintf(app.USER_SR, " \\- END LAYER %d\n",i); app.DebugPrintf(app.USER_SR, " \\- END LAYER %d\n",i);
} }
app.DebugPrintf(app.USER_SR, "-- Group static: %d, Group dynamic: %d\n", groupStatic, groupDynamic); app.DebugPrintf(app.USER_SR, "-- Group static: %d, Group dynamic: %d\n", groupStatic, groupDynamic);
@ -412,7 +412,7 @@ int UIGroup::getCommandBufferList()
return m_commandBufferList; return m_commandBufferList;
} }
// Returns the first scene of given type if it exists, NULL otherwise // Returns the first scene of given type if it exists, NULL otherwise
UIScene *UIGroup::FindScene(EUIScene sceneType) UIScene *UIGroup::FindScene(EUIScene sceneType)
{ {
UIScene *pScene = NULL; UIScene *pScene = NULL;

View file

@ -19,10 +19,10 @@ private:
UIScene_HUD *m_hud; UIScene_HUD *m_hud;
C4JRender::eViewportType m_viewportType; C4JRender::eViewportType m_viewportType;
EUIGroup m_group; EUIGroup m_group;
int m_iPad; int m_iPad;
bool m_bMenuDisplayed; bool m_bMenuDisplayed;
bool m_bPauseMenuDisplayed; bool m_bPauseMenuDisplayed;
bool m_bContainerMenuDisplayed; bool m_bContainerMenuDisplayed;
@ -88,7 +88,7 @@ public:
void SetViewportType(C4JRender::eViewportType type); void SetViewportType(C4JRender::eViewportType type);
C4JRender::eViewportType GetViewportType(); C4JRender::eViewportType GetViewportType();
virtual void HandleDLCMountingComplete(); virtual void HandleDLCMountingComplete();
virtual void HandleDLCInstalled(); virtual void HandleDLCInstalled();
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
@ -99,15 +99,15 @@ public:
bool IsFullscreenGroup(); bool IsFullscreenGroup();
void handleUnlockFullVersion(); void handleUnlockFullVersion();
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic); void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
unsigned int GetLayerIndex(UILayer* layerPtr); unsigned int GetLayerIndex(UILayer* layerPtr);
int getCommandBufferList(); int getCommandBufferList();
UIScene *FindScene(EUIScene sceneType); UIScene *FindScene(EUIScene sceneType);
private: private:
void _UpdateFocusState(); void _UpdateFocusState();
void updateStackStates(); void updateStackStates();
}; };

View file

@ -877,10 +877,10 @@ void UILayer::handleUnlockFullVersion()
} }
} }
void UILayer::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic) void UILayer::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
{ {
__int64 layerStatic = 0; int64_t layerStatic = 0;
__int64 layerDynamic = 0; int64_t layerDynamic = 0;
for(auto& it : m_components) for(auto& it : m_components)
{ {
it->PrintTotalMemoryUsage(layerStatic, layerDynamic); it->PrintTotalMemoryUsage(layerStatic, layerDynamic);

View file

@ -66,12 +66,12 @@ public:
// INPUT // INPUT
void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
#ifdef __PSVITA__ #ifdef __PSVITA__
// Current active scene // Current active scene
UIScene *getCurrentScene(); UIScene *getCurrentScene();
#endif #endif
// FOCUS // FOCUS
bool updateFocusState(bool allowedFocus = false); bool updateFocusState(bool allowedFocus = false);
public: public:
@ -87,7 +87,7 @@ public:
void handleUnlockFullVersion(); void handleUnlockFullVersion();
UIScene *FindScene(EUIScene sceneType); UIScene *FindScene(EUIScene sceneType);
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic); void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
}; };

View file

@ -329,11 +329,11 @@ void UIScene::loadMovie()
} }
byteArray baFile = ui.getMovieData(moviePath.c_str()); byteArray baFile = ui.getMovieData(moviePath.c_str());
__int64 beforeLoad = ui.iggyAllocCount; int64_t beforeLoad = ui.iggyAllocCount;
swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL); swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL);
__int64 afterLoad = ui.iggyAllocCount; int64_t afterLoad = ui.iggyAllocCount;
IggyPlayerInitializeAndTickRS ( swf ); IggyPlayerInitializeAndTickRS ( swf );
__int64 afterTick = ui.iggyAllocCount; int64_t afterTick = ui.iggyAllocCount;
if(!swf) if(!swf)
{ {
@ -362,8 +362,8 @@ void UIScene::loadMovie()
IggyMemoryUseInfo memoryInfo; IggyMemoryUseInfo memoryInfo;
rrbool res; rrbool res;
int iteration = 0; int iteration = 0;
__int64 totalStatic = 0; int64_t totalStatic = 0;
__int64 totalDynamic = 0; int64_t totalDynamic = 0;
while(res = IggyDebugGetMemoryUseInfo ( swf , while(res = IggyDebugGetMemoryUseInfo ( swf ,
NULL , NULL ,
0 , 0 ,
@ -406,15 +406,15 @@ void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUse
} }
} }
void UIScene::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic) void UIScene::PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic)
{ {
if(!swf) return; if(!swf) return;
IggyMemoryUseInfo memoryInfo; IggyMemoryUseInfo memoryInfo;
rrbool res; rrbool res;
int iteration = 0; int iteration = 0;
__int64 sceneStatic = 0; int64_t sceneStatic = 0;
__int64 sceneDynamic = 0; int64_t sceneDynamic = 0;
while(res = IggyDebugGetMemoryUseInfo ( swf , while(res = IggyDebugGetMemoryUseInfo ( swf ,
NULL , NULL ,
"" , "" ,

View file

@ -45,7 +45,7 @@ class UILayer;
class UIScene class UIScene
{ {
friend class UILayer; friend class UILayer;
public: public:
IggyValuePath *m_rootPath; IggyValuePath *m_rootPath;
private: private:
@ -85,7 +85,7 @@ public:
protected: protected:
ESceneResolution m_loadedResolution; ESceneResolution m_loadedResolution;
bool m_bIsReloading; bool m_bIsReloading;
bool m_bFocussedOnce; bool m_bFocussedOnce;
@ -101,7 +101,7 @@ protected:
public: public:
virtual Iggy *getMovie() { return swf; } virtual Iggy *getMovie() { return swf; }
void destroyMovie(); void destroyMovie();
virtual void reloadMovie(bool force = false); virtual void reloadMovie(bool force = false);
virtual bool needsReloaded(); virtual bool needsReloaded();
@ -134,7 +134,7 @@ private:
void getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo); void getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUseInfo &memoryInfo);
public: public:
void PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic); void PrintTotalMemoryUsage(int64_t &totalStatic, int64_t &totalDynamic);
public: public:
UIScene(int iPad, UILayer *parentLayer); UIScene(int iPad, UILayer *parentLayer);
@ -169,7 +169,7 @@ public:
void gainFocus(); void gainFocus();
void loseFocus(); void loseFocus();
virtual void updateTooltips(); virtual void updateTooltips();
virtual void updateComponents() {} virtual void updateComponents() {}
virtual void handleGainFocus(bool navBack); virtual void handleGainFocus(bool navBack);
@ -213,7 +213,7 @@ public:
protected: protected:
//void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations); //void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations);
void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations); void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations);
bool m_cacheSlotRenders; bool m_cacheSlotRenders;
bool m_needsCacheRendered; bool m_needsCacheRendered;
int m_expectedCachedSlotCount; int m_expectedCachedSlotCount;
@ -289,7 +289,7 @@ public:
protected: protected:
#ifdef _DURANGO #ifdef _DURANGO
virtual long long getDefaultGtcButtons() { return _360_GTC_BACK; } virtual long long getDefaultGtcButtons() { return _360_GTC_BACK; }
#endif #endif

View file

@ -58,11 +58,11 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
m_labelTexturePackDescription.init(L""); m_labelTexturePackDescription.init(L"");
WCHAR TempString[256]; WCHAR TempString[256];
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]));
m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty));
m_MoreOptionsParams.bGenerateOptions=TRUE; m_MoreOptionsParams.bGenerateOptions=TRUE;
m_MoreOptionsParams.bStructures=TRUE; m_MoreOptionsParams.bStructures=TRUE;
m_MoreOptionsParams.bFlatWorld=FALSE; m_MoreOptionsParams.bFlatWorld=FALSE;
m_MoreOptionsParams.bBonusChest=FALSE; m_MoreOptionsParams.bBonusChest=FALSE;
m_MoreOptionsParams.bPVP = TRUE; m_MoreOptionsParams.bPVP = TRUE;
@ -91,7 +91,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
m_MoreOptionsParams.bOnlineSettingChangedBySystem=false; m_MoreOptionsParams.bOnlineSettingChangedBySystem=false;
// 4J-PB - Removing this so that we can attempt to create an online game on PS3 when we are a restricted child account // 4J-PB - Removing this so that we can attempt to create an online game on PS3 when we are a restricted child account
// It'll fail when we choose create, but this matches the behaviour of load game, and lets the player know why they can't play online, // It'll fail when we choose create, but this matches the behaviour of load game, and lets the player know why they can't play online,
// instead of just greying out the online setting in the More Options // instead of just greying out the online setting in the More Options
// #ifdef __PS3__ // #ifdef __PS3__
// if(ProfileManager.IsSignedInLive( m_iPad )) // if(ProfileManager.IsSignedInLive( m_iPad ))
@ -124,9 +124,9 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
{ {
// The profile settings say Online, but either the player is offline, or they are not allowed to play online // The profile settings say Online, but either the player is offline, or they are not allowed to play online
m_MoreOptionsParams.bOnlineSettingChangedBySystem=true; m_MoreOptionsParams.bOnlineSettingChangedBySystem=true;
} }
} }
// Set up online game checkbox // Set up online game checkbox
bool bOnlineGame = m_MoreOptionsParams.bOnlineGame; bool bOnlineGame = m_MoreOptionsParams.bOnlineGame;
m_checkboxOnline.SetEnable(true); m_checkboxOnline.SetEnable(true);
@ -342,7 +342,7 @@ int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::E
UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam; UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam;
// results switched for this dialog // results switched for this dialog
if(result==C4JStorage::EMessage_ResultAccept) if(result==C4JStorage::EMessage_ResultAccept)
{ {
pClass->m_MoreOptionsParams.bOnlineGame=false; pClass->m_MoreOptionsParams.bOnlineGame=false;
pClass->checkStateAndStartGame(); pClass->checkStateAndStartGame();
@ -393,7 +393,7 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
if ( pressed && controlHasFocus(m_checkboxOnline.getId()) && !m_checkboxOnline.IsEnabled() ) if ( pressed && controlHasFocus(m_checkboxOnline.getId()) && !m_checkboxOnline.IsEnabled() )
{ {
UINT uiIDA[1] = { IDS_CONFIRM_OK }; UINT uiIDA[1] = { IDS_CONFIRM_OK };
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad);
} }
#endif #endif
@ -404,7 +404,7 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
case ACTION_MENU_OTHER_STICK_UP: case ACTION_MENU_OTHER_STICK_UP:
case ACTION_MENU_OTHER_STICK_DOWN: case ACTION_MENU_OTHER_STICK_DOWN:
sendInputToMovie(key, repeat, pressed, released); sendInputToMovie(key, repeat, pressed, released);
bool bOnlineGame = m_checkboxOnline.IsChecked(); bool bOnlineGame = m_checkboxOnline.IsChecked();
if (m_MoreOptionsParams.bOnlineGame != bOnlineGame) if (m_MoreOptionsParams.bOnlineGame != bOnlineGame)
{ {
@ -573,7 +573,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow()
if(m_MoreOptionsParams.dwTexturePack!=0) if(m_MoreOptionsParams.dwTexturePack!=0)
{ {
// texture pack hasn't been set yet, so check what it will be // texture pack hasn't been set yet, so check what it will be
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexturePack; DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexturePack;
m_pDLCPack=pDLCTexPack->getDLCInfoParentPack(); m_pDLCPack=pDLCTexPack->getDLCInfoParentPack();
@ -625,7 +625,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow()
UINT uiIDA[2]; UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK; uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_CANCEL;
ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_USING_TRIAL_TEXUREPACK_WARNING, uiIDA, 2, m_iPad,&TrialTexturePackWarningReturned,this); ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_USING_TRIAL_TEXUREPACK_WARNING, uiIDA, 2, m_iPad,&TrialTexturePackWarningReturned,this);
#endif #endif
#if defined _XBOX_ONE || defined __ORBIS__ #if defined _XBOX_ONE || defined __ORBIS__
@ -652,7 +652,7 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue)
m_sliderDifficulty.handleSliderMove(value); m_sliderDifficulty.handleSliderMove(value);
app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value); app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value);
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value]));
m_sliderDifficulty.setLabel(TempString); m_sliderDifficulty.setLabel(TempString);
break; break;
} }
@ -699,7 +699,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id)
m_MoreOptionsParams.bInviteOnly = FALSE; m_MoreOptionsParams.bInviteOnly = FALSE;
m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE; m_MoreOptionsParams.bAllowFriendsOfFriends = FALSE;
} }
m_checkboxOnline.SetEnable(bMultiplayerAllowed); m_checkboxOnline.SetEnable(bMultiplayerAllowed);
m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame); m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame);
@ -733,7 +733,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id)
PBYTE pbImageData=NULL; PBYTE pbImageData=NULL;
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
ListInfo.fEnabled = TRUE; ListInfo.fEnabled = TRUE;
ListInfo.iData = m_iConfigA[i]; ListInfo.iData = m_iConfigA[i];
HRESULT hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); HRESULT hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
app.DebugPrintf("Adding texturepack %d from TPD\n",m_iConfigA[i]); app.DebugPrintf("Adding texturepack %d from TPD\n",m_iConfigA[i]);
@ -791,7 +791,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
bool isOnlineGame = m_MoreOptionsParams.bOnlineGame; bool isOnlineGame = m_MoreOptionsParams.bOnlineGame;
int iPadNotSignedInLive = -1; int iPadNotSignedInLive = -1;
bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable(); bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable();
for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++) for(unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
{ {
if (ProfileManager.IsSignedIn(i) && (i == primaryPad || isLocalMultiplayerAvailable)) if (ProfileManager.IsSignedIn(i) && (i == primaryPad || isLocalMultiplayerAvailable))
@ -843,7 +843,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
ui.RequestErrorMessage(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE, IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); ui.RequestErrorMessage(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE, IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad());
} }
else else
{ {
// Not signed in to PSN // Not signed in to PSN
UINT uiIDA[1]; UINT uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK; uiIDA[0] = IDS_CONFIRM_OK;
@ -899,7 +899,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
SceNpCommerceDialogParam param; SceNpCommerceDialogParam param;
sceNpCommerceDialogParamInitialize(&param); sceNpCommerceDialogParamInitialize(&param);
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
iResult=sceNpCommerceDialogOpen(&param); iResult=sceNpCommerceDialogOpen(&param);
@ -914,7 +914,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
#endif #endif
if(m_bGameModeCreative == true || m_MoreOptionsParams.bHostPrivileges == TRUE) if(m_bGameModeCreative == true || m_MoreOptionsParams.bHostPrivileges == TRUE)
{ {
UINT uiIDA[2]; UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK; uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_CANCEL;
@ -987,7 +987,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
SceNpCommerceDialogParam param; SceNpCommerceDialogParam param;
sceNpCommerceDialogParamInitialize(&param); sceNpCommerceDialogParamInitialize(&param);
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
iResult=sceNpCommerceDialogOpen(&param); iResult=sceNpCommerceDialogOpen(&param);
@ -1050,8 +1050,8 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
SceNpCommerceDialogParam param; SceNpCommerceDialogParam param;
sceNpCommerceDialogParamInitialize(&param); sceNpCommerceDialogParamInitialize(&param);
param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus);
iResult=sceNpCommerceDialogOpen(&param); iResult=sceNpCommerceDialogOpen(&param);
@ -1124,14 +1124,14 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
// start the game // start the game
bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE); bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE);
__int64 seedValue = 0; int64_t seedValue = 0;
NetworkGameInitData *param = new NetworkGameInitData(); NetworkGameInitData *param = new NetworkGameInitData();
param->levelName = wWorldName; param->levelName = wWorldName;
if (wSeed.length() != 0) if (wSeed.length() != 0)
{ {
__int64 value = 0; int64_t value = 0;
unsigned int len = (unsigned int)wSeed.length(); unsigned int len = (unsigned int)wSeed.length();
//Check if the input string contains a numerical value //Check if the input string contains a numerical value
@ -1150,7 +1150,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
//If the input string is a numerical value, convert it to a number //If the input string is a numerical value, convert it to a number
if( isNumber ) if( isNumber )
value = _fromString<__int64>(wSeed); value = _fromString<int64_t>(wSeed);
//If the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it //If the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it
if( value != 0 ) if( value != 0 )
@ -1194,7 +1194,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
app.SetGameHostOption(eGameHostOption_HostCanFly,pClass->m_MoreOptionsParams.bHostPrivileges); app.SetGameHostOption(eGameHostOption_HostCanFly,pClass->m_MoreOptionsParams.bHostPrivileges);
app.SetGameHostOption(eGameHostOption_HostCanChangeHunger,pClass->m_MoreOptionsParams.bHostPrivileges); app.SetGameHostOption(eGameHostOption_HostCanChangeHunger,pClass->m_MoreOptionsParams.bHostPrivileges);
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,pClass->m_MoreOptionsParams.bHostPrivileges ); app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,pClass->m_MoreOptionsParams.bHostPrivileges );
app.SetGameHostOption(eGameHostOption_MobGriefing, pClass->m_MoreOptionsParams.bMobGriefing); app.SetGameHostOption(eGameHostOption_MobGriefing, pClass->m_MoreOptionsParams.bMobGriefing);
app.SetGameHostOption(eGameHostOption_KeepInventory, pClass->m_MoreOptionsParams.bKeepInventory); app.SetGameHostOption(eGameHostOption_KeepInventory, pClass->m_MoreOptionsParams.bKeepInventory);
app.SetGameHostOption(eGameHostOption_DoMobSpawning, pClass->m_MoreOptionsParams.bDoMobSpawning); app.SetGameHostOption(eGameHostOption_DoMobSpawning, pClass->m_MoreOptionsParams.bDoMobSpawning);
@ -1202,8 +1202,8 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
app.SetGameHostOption(eGameHostOption_DoTileDrops, pClass->m_MoreOptionsParams.bDoTileDrops); app.SetGameHostOption(eGameHostOption_DoTileDrops, pClass->m_MoreOptionsParams.bDoTileDrops);
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, pClass->m_MoreOptionsParams.bNaturalRegeneration); app.SetGameHostOption(eGameHostOption_NaturalRegeneration, pClass->m_MoreOptionsParams.bNaturalRegeneration);
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, pClass->m_MoreOptionsParams.bDoDaylightCycle); app.SetGameHostOption(eGameHostOption_DoDaylightCycle, pClass->m_MoreOptionsParams.bDoDaylightCycle);
app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false); app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false);
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
app.SetGameHostOption(eGameHostOption_WorldSize, pClass->m_MoreOptionsParams.worldSize+1 ); // 0 is GAME_HOST_OPTION_WORLDSIZE_UNKNOWN app.SetGameHostOption(eGameHostOption_WorldSize, pClass->m_MoreOptionsParams.worldSize+1 ); // 0 is GAME_HOST_OPTION_WORLDSIZE_UNKNOWN
pClass->m_MoreOptionsParams.currentWorldSize = (EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize+1); pClass->m_MoreOptionsParams.currentWorldSize = (EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize+1);
@ -1366,7 +1366,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu
} }
} }
else else
{ {
pClass->m_bIgnoreInput = false; pClass->m_bIgnoreInput = false;
} }
return 0; return 0;
@ -1377,7 +1377,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor
{ {
UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam; UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam;
if(result==C4JStorage::EMessage_ResultAccept) if(result==C4JStorage::EMessage_ResultAccept)
{ {
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
@ -1422,7 +1422,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor
ui.RequestAlertMessage( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad()); ui.RequestAlertMessage( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad());
} }
else else
{ {
#if defined( __ORBIS__) || defined(__PSVITA__) #if defined( __ORBIS__) || defined(__PSVITA__)
bool isOnlineGame = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; bool isOnlineGame = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
if(isOnlineGame) if(isOnlineGame)
@ -1452,7 +1452,7 @@ int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStor
UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu *)pParam; UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu *)pParam;
pClass->m_bIgnoreInput = false; pClass->m_bIgnoreInput = false;
if(result==C4JStorage::EMessage_ResultAccept) if(result==C4JStorage::EMessage_ResultAccept)
{ {
SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_CreateWorldMenu::StartGame_SignInReturned, pClass, false, iPad); SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_CreateWorldMenu::StartGame_SignInReturned, pClass, false, iPad);
} }
@ -1464,28 +1464,28 @@ int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStor
// { // {
// int32_t iResult; // int32_t iResult;
// UIScene_CreateWorldMenu *pClass = (UIScene_CreateWorldMenu *)pParam; // UIScene_CreateWorldMenu *pClass = (UIScene_CreateWorldMenu *)pParam;
// //
// // continue offline, or upsell PS Plus? // // continue offline, or upsell PS Plus?
// if(result==C4JStorage::EMessage_ResultDecline) // if(result==C4JStorage::EMessage_ResultDecline)
// { // {
// // upsell psplus // // upsell psplus
// int32_t iResult=sceNpCommerceDialogInitialize(); // int32_t iResult=sceNpCommerceDialogInitialize();
// //
// SceNpCommerceDialogParam param; // SceNpCommerceDialogParam param;
// sceNpCommerceDialogParamInitialize(&param); // sceNpCommerceDialogParamInitialize(&param);
// param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; // param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS;
// param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; // param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY;
// param.userId = ProfileManager.getUserID(pClass->m_iPad); // param.userId = ProfileManager.getUserID(pClass->m_iPad);
// //
// iResult=sceNpCommerceDialogOpen(&param); // iResult=sceNpCommerceDialogOpen(&param);
// } // }
// else if(result==C4JStorage::EMessage_ResultAccept) // else if(result==C4JStorage::EMessage_ResultAccept)
// { // {
// // continue offline // // continue offline
// pClass->m_MoreOptionsParams.bOnlineGame=false; // pClass->m_MoreOptionsParams.bOnlineGame=false;
// pClass->checkStateAndStartGame(); // pClass->checkStateAndStartGame();
// } // }
// //
// pClass->m_bIgnoreInput=false; // pClass->m_bIgnoreInput=false;
// return 0; // return 0;
// } // }

View file

@ -16,7 +16,7 @@ private:
}; };
static int m_iDifficultyTitleSettingA[4]; static int m_iDifficultyTitleSettingA[4];
UIControl m_controlMainPanel; UIControl m_controlMainPanel;
UIControl_Label m_labelGameName, m_labelSeed, m_labelCreatedMode; UIControl_Label m_labelGameName, m_labelSeed, m_labelCreatedMode;
UIControl_Button m_buttonGamemode, m_buttonMoreOptions, m_buttonLoadWorld; UIControl_Button m_buttonGamemode, m_buttonMoreOptions, m_buttonLoadWorld;
@ -43,7 +43,7 @@ private:
LevelGenerationOptions *m_levelGen; LevelGenerationOptions *m_levelGen;
DLCPack * m_pDLCPack; DLCPack * m_pDLCPack;
int m_iSaveGameInfoIndex; int m_iSaveGameInfoIndex;
int m_CurrentDifficulty; int m_CurrentDifficulty;
bool m_bGameModeCreative; bool m_bGameModeCreative;
@ -58,7 +58,7 @@ private:
bool m_bRequestQuadrantSignin; bool m_bRequestQuadrantSignin;
bool m_bIsCorrupt; bool m_bIsCorrupt;
bool m_bThumbnailGetFailed; bool m_bThumbnailGetFailed;
__int64 m_seed; int64_t m_seed;
wstring m_levelName; wstring m_levelName;
#ifdef __PS3__ #ifdef __PS3__
@ -73,7 +73,7 @@ private:
bool m_bRebuildTouchBoxes; bool m_bRebuildTouchBoxes;
public: public:
UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLayer); UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLayer);
virtual void updateTooltips(); virtual void updateTooltips();
virtual void updateComponents(); virtual void updateComponents();
@ -107,7 +107,7 @@ private:
#ifdef _DURANGO #ifdef _DURANGO
static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad); static void checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad);
#endif #endif
static int ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
static void StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocalUsersMask); static void StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocalUsersMask);
static int LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bIsOwner); static int LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bIsOwner);

View file

@ -2171,7 +2171,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save
// Make our next save default to the name of the level // Make our next save default to the name of the level
StorageManager.SetSaveTitle(saveFile->getName().c_str()); StorageManager.SetSaveTitle(saveFile->getName().c_str());
__int64 fileSize = saveFile->length(); int64_t fileSize = saveFile->length();
FileInputStream fis(*saveFile); FileInputStream fis(*saveFile);
byteArray ba(fileSize); byteArray ba(fileSize);
fis.read(ba); fis.read(ba);
@ -2235,7 +2235,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud()
mbstowcs(wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), strlen(app.getRemoteStorage()->getSaveNameUTF8())+1); // plus null mbstowcs(wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), strlen(app.getRemoteStorage()->getSaveNameUTF8())+1); // plus null
StorageManager.SetSaveTitle(wSaveName); StorageManager.SetSaveTitle(wSaveName);
__int64 fileSize = cloudFile.length(); int64_t fileSize = cloudFile.length();
FileInputStream fis(cloudFile); FileInputStream fis(cloudFile);
byteArray ba(fileSize); byteArray ba(fileSize);
fis.read(ba); fis.read(ba);
@ -3579,7 +3579,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter )
bool bHostOptionsRead = false; bool bHostOptionsRead = false;
unsigned int uiHostOptions = 0; unsigned int uiHostOptions = 0;
DWORD dwTexturePack; DWORD dwTexturePack;
__int64 seedVal; int64_t seedVal;
char szSeed[50]; char szSeed[50];
ZeroMemory(szSeed,50); ZeroMemory(szSeed,50);

View file

@ -55,7 +55,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
CreateWorldMenuInitData *params = (CreateWorldMenuInitData *)pInitData->pvInitData; CreateWorldMenuInitData *params = (CreateWorldMenuInitData *)pInitData->pvInitData;
m_MoreOptionsParams.bGenerateOptions=TRUE; m_MoreOptionsParams.bGenerateOptions=TRUE;
m_MoreOptionsParams.bStructures=TRUE; m_MoreOptionsParams.bStructures=TRUE;
m_MoreOptionsParams.bFlatWorld=FALSE; m_MoreOptionsParams.bFlatWorld=FALSE;
m_MoreOptionsParams.bBonusChest=FALSE; m_MoreOptionsParams.bBonusChest=FALSE;
m_MoreOptionsParams.bPVP = TRUE; m_MoreOptionsParams.bPVP = TRUE;
@ -96,7 +96,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
{ {
// The profile settings say Online, but either the player is offline, or they are not allowed to play online // The profile settings say Online, but either the player is offline, or they are not allowed to play online
m_MoreOptionsParams.bOnlineSettingChangedBySystem=true; m_MoreOptionsParams.bOnlineSettingChangedBySystem=true;
} }
} }
m_ButtonGameMode.SetText(app.GetString(IDS_GAMEMODE_SURVIVAL)); m_ButtonGameMode.SetText(app.GetString(IDS_GAMEMODE_SURVIVAL));
@ -104,7 +104,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_CurrentDifficulty=app.GetGameSettings(m_iPad,eGameSetting_Difficulty); m_CurrentDifficulty=app.GetGameSettings(m_iPad,eGameSetting_Difficulty);
m_SliderDifficulty.SetValue(m_CurrentDifficulty); m_SliderDifficulty.SetValue(m_CurrentDifficulty);
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[m_CurrentDifficulty])); swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[m_CurrentDifficulty]));
m_SliderDifficulty.SetText(TempString); m_SliderDifficulty.SetText(TempString);
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK); ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
@ -135,7 +135,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_NewWorld.SetEnable(true); m_NewWorld.SetEnable(true);
m_EditWorldName.SetTextLimit(XCONTENT_MAX_DISPLAYNAME_LENGTH); m_EditWorldName.SetTextLimit(XCONTENT_MAX_DISPLAYNAME_LENGTH);
wstring wWorldName = m_EditWorldName.GetText(); wstring wWorldName = m_EditWorldName.GetText();
// set the caret to the end of the default text // set the caret to the end of the default text
@ -148,7 +148,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
XuiSetTimer(m_hObj,GAME_CREATE_ONLINE_TIMER_ID,GAME_CREATE_ONLINE_TIMER_TIME); XuiSetTimer(m_hObj,GAME_CREATE_ONLINE_TIMER_ID,GAME_CREATE_ONLINE_TIMER_TIME);
XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME); XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME);
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_CreateWorldMenu, 0); TelemetryManager->RecordMenuShown(m_iPad, eUIScene_CreateWorldMenu, 0);
// 4J-PB - Load up any texture pack data we have locally in the XZP // 4J-PB - Load up any texture pack data we have locally in the XZP
@ -176,7 +176,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_pTexturePacksList->SetSelectionChangedHandle(m_hObj); m_pTexturePacksList->SetSelectionChangedHandle(m_hObj);
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
int texturePacksCount = pMinecraft->skins->getTexturePackCount(); int texturePacksCount = pMinecraft->skins->getTexturePackCount();
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo; CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
HRESULT hr; HRESULT hr;
for(unsigned int i = 0; i < texturePacksCount; ++i) for(unsigned int i = 0; i < texturePacksCount; ++i)
@ -189,7 +189,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
if(dwImageBytes > 0 && pbImageData) if(dwImageBytes > 0 && pbImageData)
{ {
ListInfo.fEnabled = TRUE; ListInfo.fEnabled = TRUE;
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;
if(pDLCTexPack) if(pDLCTexPack)
{ {
@ -297,7 +297,7 @@ HRESULT CScene_MultiGameCreate::OnDestroy()
app.RemoveMemoryTPDFile(app.TMSFileA[i].iConfig); app.RemoveMemoryTPDFile(app.TMSFileA[i].iConfig);
} }
} }
app.FreeLocalTMSFiles(eTMSFileType_TexturePack); app.FreeLocalTMSFiles(eTMSFileType_TexturePack);
return S_OK; return S_OK;
@ -338,7 +338,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
// DLC might have been corrupt // DLC might have been corrupt
if(ullOfferID_Full!=0LL) if(ullOfferID_Full!=0LL)
{ {
TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(), eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(), eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF);
UINT uiIDA[3]; UINT uiIDA[3];
@ -374,7 +374,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
// if the profile data has been changed, then force a profile write (we save the online/invite/friends of friends settings) // if the profile data has been changed, then force a profile write (we save the online/invite/friends of friends settings)
// It seems we're allowed to break the 5 minute rule if it's the result of a user action // It seems we're allowed to break the 5 minute rule if it's the result of a user action
// check the checkboxes // check the checkboxes
// Only save the online setting if the user changed it - we may change it because we're offline, but don't want that saved // Only save the online setting if the user changed it - we may change it because we're offline, but don't want that saved
if(!m_MoreOptionsParams.bOnlineSettingChangedBySystem) if(!m_MoreOptionsParams.bOnlineSettingChangedBySystem)
{ {
@ -389,15 +389,15 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
if(m_MoreOptionsParams.dwTexturePack!=0) if(m_MoreOptionsParams.dwTexturePack!=0)
{ {
// texture pack hasn't been set yet, so check what it will be // texture pack hasn't been set yet, so check what it will be
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack); TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
if(pTexturePack==NULL) if(pTexturePack==NULL)
{ {
// corrupt DLC so set it to the default textures // corrupt DLC so set it to the default textures
m_MoreOptionsParams.dwTexturePack=0; m_MoreOptionsParams.dwTexturePack=0;
} }
else else
{ {
m_pDLCPack=pTexturePack->getDLCPack(); m_pDLCPack=pTexturePack->getDLCPack();
// do we have a license? // do we have a license?
if(m_pDLCPack && !m_pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) if(m_pDLCPack && !m_pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
@ -439,11 +439,11 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
return S_OK; return S_OK;
} }
} }
} }
} }
if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges == TRUE) if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges == TRUE)
{ {
UINT uiIDA[2]; UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK; uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_CANCEL;
@ -478,7 +478,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
BOOL pccFriendsAllowed = TRUE; BOOL pccFriendsAllowed = TRUE;
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true; if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
if(isClientSide && noUGC ) if(isClientSide && noUGC )
{ {
m_bIgnoreInput = false; m_bIgnoreInput = false;
@ -495,7 +495,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
} }
} }
else if(hObjPressed==m_MoreOptions) else if(hObjPressed==m_MoreOptions)
{ {
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_LaunchMoreOptionsMenu,&m_MoreOptionsParams); app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_LaunchMoreOptionsMenu,&m_MoreOptionsParams);
} }
else if(hObjPressed == m_ButtonGameMode) else if(hObjPressed == m_ButtonGameMode)
@ -527,7 +527,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS
if(result==C4JStorage::EMessage_ResultAccept) if(result==C4JStorage::EMessage_ResultAccept)
{ {
if(ProfileManager.IsSignedIn(iPad)) if(ProfileManager.IsSignedIn(iPad))
{ {
ULONGLONG ullIndexA[1]; ULONGLONG ullIndexA[1];
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId()); DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId());
@ -542,7 +542,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
// the license change coming in when the offer has been installed will cause this scene to refresh // the license change coming in when the offer has been installed will cause this scene to refresh
} }
} }
else else
@ -629,12 +629,12 @@ HRESULT CScene_MultiGameCreate::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINot
// Enable the done button when we have all of the necessary information // Enable the done button when we have all of the necessary information
wstring wWorldName = m_EditWorldName.GetText(); wstring wWorldName = m_EditWorldName.GetText();
BOOL bHasWorldName = ( wWorldName.length()!=0); BOOL bHasWorldName = ( wWorldName.length()!=0);
m_NewWorld.SetEnable(bHasWorldName); m_NewWorld.SetEnable(bHasWorldName);
} }
else if(hObjSource==m_SliderDifficulty.GetSlider() ) else if(hObjSource==m_SliderDifficulty.GetSlider() )
{ {
app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pValueChangedData->nValue); app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pValueChangedData->nValue);
swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue])); swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue]));
m_SliderDifficulty.SetText(TempString); m_SliderDifficulty.SetText(TempString);
} }
@ -656,11 +656,11 @@ HRESULT CScene_MultiGameCreate::OnControlNavigate(XUIMessageControlNavigate *pCo
HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
{ {
// 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly // 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly
switch(pTimer->nId) switch(pTimer->nId)
{ {
case GAME_CREATE_ONLINE_TIMER_ID: case GAME_CREATE_ONLINE_TIMER_ID:
{ {
bool bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); bool bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
@ -693,7 +693,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
} }
} }
break; break;
case CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID: case CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID:
{ {
// also check for any new texture packs info being available // also check for any new texture packs info being available
@ -718,7 +718,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
PBYTE pbImageData=NULL; PBYTE pbImageData=NULL;
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
ListInfo.fEnabled = TRUE; ListInfo.fEnabled = TRUE;
ListInfo.iData = m_iConfigA[i]; ListInfo.iData = m_iConfigA[i];
HRESULT hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); HRESULT hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
app.DebugPrintf("Adding texturepack %d from TPD\n",m_iConfigA[i]); app.DebugPrintf("Adding texturepack %d from TPD\n",m_iConfigA[i]);
@ -734,7 +734,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
bool bAllDone=true; bool bAllDone=true;
for(int i=0;i<m_iTexturePacksNotInstalled;i++) for(int i=0;i<m_iTexturePacksNotInstalled;i++)
{ {
if(m_iConfigA[i]!=-1) if(m_iConfigA[i]!=-1)
{ {
bAllDone = false; bAllDone = false;
} }
@ -756,7 +756,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora
{ {
CScene_MultiGameCreate* pClass = (CScene_MultiGameCreate*)pParam; CScene_MultiGameCreate* pClass = (CScene_MultiGameCreate*)pParam;
if(result==C4JStorage::EMessage_ResultAccept) if(result==C4JStorage::EMessage_ResultAccept)
{ {
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
@ -780,7 +780,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora
BOOL pccFriendsAllowed = TRUE; BOOL pccFriendsAllowed = TRUE;
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true; if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
if(isClientSide && noUGC ) if(isClientSide && noUGC )
{ {
pClass->m_bIgnoreInput = false; pClass->m_bIgnoreInput = false;
@ -816,7 +816,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
if(ProfileManager.IsSignedIn(iPad)) if(ProfileManager.IsSignedIn(iPad))
{ {
DWORD dwLocalUsersMask = 0; DWORD dwLocalUsersMask = 0;
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
bool noPrivileges = false; bool noPrivileges = false;
@ -835,7 +835,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
BOOL pccFriendsAllowed = TRUE; BOOL pccFriendsAllowed = TRUE;
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true; if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
if(isClientSide && (noPrivileges || noUGC) ) if(isClientSide && (noPrivileges || noUGC) )
{ {
if( noUGC ) if( noUGC )
@ -863,7 +863,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
} }
} }
else else
{ {
pClass->m_bIgnoreInput = false; pClass->m_bIgnoreInput = false;
pClass->SetShow( TRUE ); pClass->SetShow( TRUE );
} }
@ -884,7 +884,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
// create the world and launch // create the world and launch
wstring wWorldName = pClass->m_EditWorldName.GetText(); wstring wWorldName = pClass->m_EditWorldName.GetText();
StorageManager.ResetSaveData(); StorageManager.ResetSaveData();
// Make our next save default to the name of the level // Make our next save default to the name of the level
StorageManager.SetSaveTitle((wchar_t *)wWorldName.c_str()); StorageManager.SetSaveTitle((wchar_t *)wWorldName.c_str());
@ -904,11 +904,11 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
// start the game // start the game
bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE); bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE);
__int64 seedValue = 0; //BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements int64_t seedValue = 0; //BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
if (wSeed.length() != 0) if (wSeed.length() != 0)
{ {
__int64 value = 0; int64_t value = 0;
unsigned int len = (unsigned int)wSeed.length(); unsigned int len = (unsigned int)wSeed.length();
//Check if the input string contains a numerical value //Check if the input string contains a numerical value
@ -923,7 +923,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
//If the input string is a numerical value, convert it to a number //If the input string is a numerical value, convert it to a number
if( isNumber ) if( isNumber )
value = _fromString<__int64>(wSeed); value = _fromString<int64_t>(wSeed);
//If the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it //If the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it
if( value != 0 ) if( value != 0 )
@ -948,7 +948,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
param->seed = seedValue; param->seed = seedValue;
param->saveData = NULL; param->saveData = NULL;
param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack; param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack;
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
pMinecraft->skins->selectTexturePackById(pClass->m_MoreOptionsParams.dwTexturePack); pMinecraft->skins->selectTexturePackById(pClass->m_MoreOptionsParams.dwTexturePack);
//pMinecraft->skins->updateUI(); //pMinecraft->skins->updateUI();
@ -956,7 +956,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
app.SetGameHostOption(eGameHostOption_Difficulty,Minecraft::GetInstance()->options->difficulty); app.SetGameHostOption(eGameHostOption_Difficulty,Minecraft::GetInstance()->options->difficulty);
app.SetGameHostOption(eGameHostOption_FriendsOfFriends,pClass->m_MoreOptionsParams.bAllowFriendsOfFriends); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,pClass->m_MoreOptionsParams.bAllowFriendsOfFriends);
app.SetGameHostOption(eGameHostOption_Gamertags,app.GetGameSettings(pClass->m_iPad,eGameSetting_GamertagsVisible)?1:0); app.SetGameHostOption(eGameHostOption_Gamertags,app.GetGameSettings(pClass->m_iPad,eGameSetting_GamertagsVisible)?1:0);
app.SetGameHostOption(eGameHostOption_BedrockFog,app.GetGameSettings(pClass->m_iPad,eGameSetting_BedrockFog)?1:0); app.SetGameHostOption(eGameHostOption_BedrockFog,app.GetGameSettings(pClass->m_iPad,eGameSetting_BedrockFog)?1:0);
// CXuiList listObject; // CXuiList listObject;
@ -999,7 +999,7 @@ HRESULT CScene_MultiGameCreate::OnTransitionStart( XUIMessageTransition *pTransi
if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK; if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK;
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO) if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
{ {
m_SliderDifficulty.SetValueDisplay(FALSE); m_SliderDifficulty.SetValueDisplay(FALSE);
} }
@ -1015,7 +1015,7 @@ HRESULT CScene_MultiGameCreate::OnTransitionEnd( XUIMessageTransition *pTransiti
{ {
} }
else if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO) else if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
{ {
if(m_bSetup && m_texturePackDescDisplayed) if(m_bSetup && m_texturePackDescDisplayed)
{ {
XUITimeline *timeline; XUITimeline *timeline;
@ -1054,7 +1054,7 @@ HRESULT CScene_MultiGameCreate::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotif
if(hObjSource == m_pTexturePacksList->m_hObj) if(hObjSource == m_pTexturePacksList->m_hObj)
{ {
UpdateTexturePackDescription(pNotifySelChangedData->iItem); UpdateTexturePackDescription(pNotifySelChangedData->iItem);
// 4J-JEV: Removed expand description check, taken care of elsewhere. // 4J-JEV: Removed expand description check, taken care of elsewhere.
} }
@ -1205,9 +1205,9 @@ void CScene_MultiGameCreate::UpdateCurrentTexturePack()
StorageManager.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CScene_MultiGameCreate::TexturePackDialogReturned,this,app.GetStringTable()); StorageManager.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CScene_MultiGameCreate::TexturePackDialogReturned,this,app.GetStringTable());
} }
// do set the texture pack id, and on the user pressing create world, check they have it // do set the texture pack id, and on the user pressing create world, check they have it
m_MoreOptionsParams.dwTexturePack = ListItem.iData; m_MoreOptionsParams.dwTexturePack = ListItem.iData;
return ; return ;
} }
else else
{ {
@ -1221,7 +1221,7 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS
pClass->m_currentTexturePackIndex = pClass->m_pTexturePacksList->GetCurSel(); pClass->m_currentTexturePackIndex = pClass->m_pTexturePacksList->GetCurSel();
// Exit with or without saving // Exit with or without saving
// Decline means install full version of the texture pack in this dialog // Decline means install full version of the texture pack in this dialog
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept) if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept)
{ {
// we need to enable background downloading for the DLC // we need to enable background downloading for the DLC
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
@ -1248,7 +1248,7 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS
ullIndexA[0]=pDLCInfo->ullOfferID_Trial; ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
} }
} }
} }
pClass->m_bIgnoreInput=false; pClass->m_bIgnoreInput=false;
return 0; return 0;
@ -1274,12 +1274,12 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCInstalled()
} }
HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete() HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
{ {
// refill the texture pack list // refill the texture pack list
m_pTexturePacksList->SetSelectionChangedHandle(m_hObj); m_pTexturePacksList->SetSelectionChangedHandle(m_hObj);
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
int texturePacksCount = pMinecraft->skins->getTexturePackCount(); int texturePacksCount = pMinecraft->skins->getTexturePackCount();
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo; CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
HRESULT hr; HRESULT hr;
for(unsigned int i = 0; i < texturePacksCount; ++i) for(unsigned int i = 0; i < texturePacksCount; ++i)
@ -1292,7 +1292,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
if(dwImageBytes > 0 && pbImageData) if(dwImageBytes > 0 && pbImageData)
{ {
ListInfo.fEnabled = TRUE; ListInfo.fEnabled = TRUE;
hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush); hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp; DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;

View file

@ -1945,7 +1945,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
// Make our next save default to the name of the level // Make our next save default to the name of the level
StorageManager.SetSaveTitle(saveFile->getName().c_str()); StorageManager.SetSaveTitle(saveFile->getName().c_str());
__int64 fileSize = saveFile->length(); int64_t fileSize = saveFile->length();
FileInputStream fis(*saveFile); FileInputStream fis(*saveFile);
byteArray ba(fileSize); byteArray ba(fileSize);
fis.read(ba); fis.read(ba);

View file

@ -36,7 +36,7 @@ HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
MapChildControls(); MapChildControls();
// Display the tooltips // Display the tooltips
HRESULT hr = S_OK; HRESULT hr = S_OK;
CXuiElement xuiElement = m_hObj; CXuiElement xuiElement = m_hObj;
HXUIOBJ hTemp; HXUIOBJ hTemp;
@ -169,7 +169,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
// make sure there's not a mount going on before using the textures // make sure there's not a mount going on before using the textures
if(bCheckTexturePack && app.DLCInstallProcessCompleted() ) if(bCheckTexturePack && app.DLCInstallProcessCompleted() )
{ {
TexturePack *tPack = pMinecraft->skins->getSelected(); TexturePack *tPack = pMinecraft->skins->getSelected();
if(tPack->getId()!=app.GetRequiredTexturePackID()) if(tPack->getId()!=app.GetRequiredTexturePackID())
@ -186,7 +186,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID()); pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID());
// probably had background downloads enabled, so turn them off // probably had background downloads enabled, so turn them off
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO);
} }
else else
@ -223,7 +223,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
{ {
if(pMinecraft->localplayers[i] != NULL && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD)) if(pMinecraft->localplayers[i] != NULL && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD))
{ {
int iGuiScale; int iGuiScale;
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{ {
@ -234,7 +234,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
iGuiScale=app.GetGameSettings(i,eGameSetting_UISizeSplitscreen); iGuiScale=app.GetGameSettings(i,eGameSetting_UISizeSplitscreen);
} }
m_BossHealthGroup[i].SetShow(TRUE); m_BossHealthGroup[i].SetShow(TRUE);
m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) ); m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{ {
@ -364,7 +364,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
break; break;
} }
} }
} }
m_pBossHealthProgress[i].SetRange(0, boss->getMaxHealth() ); m_pBossHealthProgress[i].SetRange(0, boss->getMaxHealth() );
m_pBossHealthProgress[i].SetValue( boss->getSynchedHealth() ); m_pBossHealthProgress[i].SetValue( boss->getSynchedHealth() );
@ -468,15 +468,15 @@ void CXuiSceneBase::_TickAllBaseScenes()
XUIMessage xuiMsg; XUIMessage xuiMsg;
CustomMessage_TickScene( &xuiMsg ); CustomMessage_TickScene( &xuiMsg );
XuiSendMessage( app.GetCurrentHUDScene(i), &xuiMsg ); XuiSendMessage( app.GetCurrentHUDScene(i), &xuiMsg );
bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(i) && !(app.GetXuiAction(i)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(i,eGameSetting_DisplayHUD)!=0; bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(i) && !(app.GetXuiAction(i)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(i,eGameSetting_DisplayHUD)!=0;
if(bDisplayGui && pMinecraft->localplayers[i] != NULL) if(bDisplayGui && pMinecraft->localplayers[i] != NULL)
{ {
XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE); XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE);
} }
else else
{ {
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE); XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
} }
} }
} }
@ -495,18 +495,18 @@ HRESULT CXuiSceneBase::_SetEnableTooltips( unsigned int iPad, BOOL bVal )
HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiTooltip, int iTextID ) HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiTooltip, int iTextID )
{ {
ASSERT( uiTooltip < BUTTONS_TOOLTIP_MAX ); ASSERT( uiTooltip < BUTTONS_TOOLTIP_MAX );
XUIRect xuiRect, xuiRectSmall; XUIRect xuiRect, xuiRectSmall;
HRESULT hr=S_OK; HRESULT hr=S_OK;
LPCWSTR pString=NULL; LPCWSTR pString=NULL;
float fWidth,fHeight; float fWidth,fHeight;
// Want to be able to show just a button (for RB LB) // Want to be able to show just a button (for RB LB)
if(iTextID>=0) if(iTextID>=0)
{ {
pString=app.GetString(iTextID); pString=app.GetString(iTextID);
} }
if(hTooltipText[iPad][uiTooltip]==NULL) if(hTooltipText[iPad][uiTooltip]==NULL)
{ {
HXUIOBJ hObj=NULL; HXUIOBJ hObj=NULL;
@ -514,7 +514,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipText[iPad][uiTooltip]); hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipText[iPad][uiTooltip]);
hr=XuiElementGetPosition(hTooltipText[iPad][uiTooltip],&m_vPosTextInTooltip[uiTooltip]); hr=XuiElementGetPosition(hTooltipText[iPad][uiTooltip],&m_vPosTextInTooltip[uiTooltip]);
} }
if(hTooltipTextSmall[iPad][uiTooltip]==NULL) if(hTooltipTextSmall[iPad][uiTooltip]==NULL)
{ {
HXUIOBJ hObj=NULL; HXUIOBJ hObj=NULL;
@ -525,8 +525,8 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
if(iTextID>=0) if(iTextID>=0)
{ {
hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect); hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect);
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic) // Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
XuiElementGetBounds(m_Buttons[iPad][uiTooltip].m_hObj,&fWidth, &fHeight); XuiElementGetBounds(m_Buttons[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
XuiElementSetBounds(m_Buttons[iPad][uiTooltip].m_hObj,xuiRect.right+1+m_vPosTextInTooltip[uiTooltip].x,fHeight); XuiElementSetBounds(m_Buttons[iPad][uiTooltip].m_hObj,xuiRect.right+1+m_vPosTextInTooltip[uiTooltip].x,fHeight);
@ -537,7 +537,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
hr=XuiTextPresenterMeasureText(hTooltipTextSmall[iPad][uiTooltip], pString, &xuiRectSmall); hr=XuiTextPresenterMeasureText(hTooltipTextSmall[iPad][uiTooltip], pString, &xuiRectSmall);
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic) // Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
XuiElementGetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&fWidth, &fHeight); XuiElementGetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
XuiElementSetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,xuiRectSmall.right+1+m_vPosTextInTooltipSmall[uiTooltip].x,fHeight); XuiElementSetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,xuiRectSmall.right+1+m_vPosTextInTooltipSmall[uiTooltip].x,fHeight);
@ -749,7 +749,7 @@ HRESULT CXuiSceneBase::_SetTooltipsEnabled( unsigned int iPad, bool bA, bool bB,
m_Buttons[iPad][BUTTON_TOOLTIP_LB].SetEnable( bLB ); m_Buttons[iPad][BUTTON_TOOLTIP_LB].SetEnable( bLB );
m_Buttons[iPad][BUTTON_TOOLTIP_RB].SetEnable( bRB ); m_Buttons[iPad][BUTTON_TOOLTIP_RB].SetEnable( bRB );
m_Buttons[iPad][BUTTON_TOOLTIP_LS].SetEnable( bLS ); m_Buttons[iPad][BUTTON_TOOLTIP_LS].SetEnable( bLS );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_A].SetEnable( bA ); m_ButtonsSmall[iPad][BUTTON_TOOLTIP_A].SetEnable( bA );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_B].SetEnable( bB ); m_ButtonsSmall[iPad][BUTTON_TOOLTIP_B].SetEnable( bB );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_X].SetEnable( bX ); m_ButtonsSmall[iPad][BUTTON_TOOLTIP_X].SetEnable( bX );
@ -860,7 +860,7 @@ HRESULT CXuiSceneBase::_ShowBackground( unsigned int iPad, BOOL bShow )
if(bShow && pMinecraft->level!=NULL) if(bShow && pMinecraft->level!=NULL)
{ {
__int64 i64TimeOfDay =0; int64_t i64TimeOfDay =0;
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight // are we in the Nether? - Leave the time as 0 if we are, so we show daylight
if(pMinecraft->level->dimension->id==0) if(pMinecraft->level->dimension->id==0)
{ {
@ -945,11 +945,11 @@ HRESULT CXuiSceneBase::_ShowPressStart(unsigned int iPad)
int nStart, nEnd; int nStart, nEnd;
// XuiElementFindNamedFrame( m_hObj, L"StartFlash", &nStart ); // XuiElementFindNamedFrame( m_hObj, L"StartFlash", &nStart );
// XuiElementFindNamedFrame( m_hObj, L"EndFlash", &nEnd ); // XuiElementFindNamedFrame( m_hObj, L"EndFlash", &nEnd );
// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE ); // XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE );
XuiElementFindNamedFrame( hObj, L"StartFlash", &nStart ); XuiElementFindNamedFrame( hObj, L"StartFlash", &nStart );
XuiElementFindNamedFrame( hObj, L"EndFlash", &nEnd ); XuiElementFindNamedFrame( hObj, L"EndFlash", &nEnd );
XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE ); XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE );
return S_OK; return S_OK;
} }
@ -960,7 +960,7 @@ HRESULT CXuiSceneBase::_HidePressStart()
HRESULT CXuiSceneBase::_UpdateAutosaveCountdownTimer(unsigned int uiSeconds) HRESULT CXuiSceneBase::_UpdateAutosaveCountdownTimer(unsigned int uiSeconds)
{ {
WCHAR wcAutosaveCountdown[100]; WCHAR wcAutosaveCountdown[100];
swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds);
m_TrialTimer.SetText(wcAutosaveCountdown); m_TrialTimer.SetText(wcAutosaveCountdown);
return S_OK; return S_OK;
@ -974,7 +974,7 @@ HRESULT CXuiSceneBase::_ShowAutosaveCountdownTimer(BOOL bVal)
HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad) HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
{ {
WCHAR wcTime[20]; WCHAR wcTime[20];
DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); DWORD dwTimeTicks=(DWORD)app.getTrialTimer();
@ -982,7 +982,7 @@ HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
{ {
dwTimeTicks=m_dwTrialTimerLimitSecs; dwTimeTicks=m_dwTrialTimerLimitSecs;
} }
dwTimeTicks=m_dwTrialTimerLimitSecs-dwTimeTicks; dwTimeTicks=m_dwTrialTimerLimitSecs-dwTimeTicks;
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
@ -1038,7 +1038,7 @@ bool CXuiSceneBase::_PressStartPlaying(unsigned int iPad)
HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScenePosition position ) HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScenePosition position )
{ {
// turn off the empty quadrant logo // turn off the empty quadrant logo
if(m_hEmptyQuadrantLogo!=NULL) if(m_hEmptyQuadrantLogo!=NULL)
{ {
XuiElementSetShow(m_hEmptyQuadrantLogo,FALSE); XuiElementSetShow(m_hEmptyQuadrantLogo,FALSE);
} }
@ -1086,12 +1086,12 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
XuiElementSetShow( m_TooltipGroupSmall[iPad].m_hObj, TRUE); XuiElementSetShow( m_TooltipGroupSmall[iPad].m_hObj, TRUE);
} }
if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
{ {
//640x480 ->1280x720 //640x480 ->1280x720
scale.x = 2.0f; scale.y = 1.5f; scale.z = 1.0f; scale.x = 2.0f; scale.y = 1.5f; scale.z = 1.0f;
XuiElementSetScale(m_hObj, &scale); XuiElementSetScale(m_hObj, &scale);
return S_OK; return S_OK;
} }
@ -1127,7 +1127,7 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
// No position adjustment // No position adjustment
case e_BaseScene_Fullscreen: case e_BaseScene_Fullscreen:
tooltipsPos.x=SAFEZONE_HALF_WIDTH; tooltipsPos.x=SAFEZONE_HALF_WIDTH;
tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight; tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight;
crouchIconPos.x=SAFEZONE_HALF_WIDTH; crouchIconPos.x=SAFEZONE_HALF_WIDTH;
crouchIconPos.y=SAFEZONE_HALF_HEIGHT; crouchIconPos.y=SAFEZONE_HALF_HEIGHT;
fBackWidth=XUI_BASE_SCENE_WIDTH; fBackWidth=XUI_BASE_SCENE_WIDTH;
@ -1303,7 +1303,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// Only adjust if fullscreen for now, leaving code to move others if required, but it's too far up the screen when on the bottom quadrants // Only adjust if fullscreen for now, leaving code to move others if required, but it's too far up the screen when on the bottom quadrants
if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) && if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) &&
(RenderManager.IsHiDef() || RenderManager.IsWidescreen()) ) (RenderManager.IsHiDef() || RenderManager.IsWidescreen()) )
{ {
D3DXVECTOR3 selectedItemPos; D3DXVECTOR3 selectedItemPos;
@ -1328,17 +1328,17 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// The move applies to the whole scene, so we'll need to move tooltips back in some cases // The move applies to the whole scene, so we'll need to move tooltips back in some cases
selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight; selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight;
selectedItemPos.x = XUI_BASE_SCENE_WIDTH_HALF - (fSelectedItemWidth/2.0f); selectedItemPos.x = XUI_BASE_SCENE_WIDTH_HALF - (fSelectedItemWidth/2.0f);
// Adjust selectedItemPos based on what gui is displayed // Adjust selectedItemPos based on what gui is displayed
// 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival // 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival
float fYOffset=0.0f; float fYOffset=0.0f;
unsigned char ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISize) + 2; unsigned char ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISize) + 2;
if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer()) if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
{ {
// SURVIVAL MODE - Move up further because of hearts, shield and xp // SURVIVAL MODE - Move up further because of hearts, shield and xp
@ -1353,7 +1353,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2 default: // 2
fYOffset = -94.0f; fYOffset = -94.0f;
break; break;
} }
} }
else else
{ {
@ -1368,7 +1368,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2 default: // 2
fYOffset = -58.0f; fYOffset = -58.0f;
break; break;
} }
} }
@ -1425,14 +1425,14 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// 4J-PB - If it's in split screen vertical, adjust the position // 4J-PB - If it's in split screen vertical, adjust the position
// Adjust selectedItemPos based on what gui is displayed // Adjust selectedItemPos based on what gui is displayed
if((m_playerBaseScenePosition[iPad]==e_BaseScene_Left) || (m_playerBaseScenePosition[iPad]==e_BaseScene_Right)) if((m_playerBaseScenePosition[iPad]==e_BaseScene_Left) || (m_playerBaseScenePosition[iPad]==e_BaseScene_Right))
{ {
float scale=0.5f; float scale=0.5f;
selectedItemPos.y -= (scale * 88.0f); selectedItemPos.y -= (scale * 88.0f);
if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer()) if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
{ {
selectedItemPos.y -= (scale * 80.0f); selectedItemPos.y -= (scale * 80.0f);
} }
// 4J-PB - selected the gui scale based on the slider settings // 4J-PB - selected the gui scale based on the slider settings
unsigned char ucGuiScale; unsigned char ucGuiScale;
float fYOffset=0.0f; float fYOffset=0.0f;
@ -1455,7 +1455,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2 default: // 2
fYOffset = 85.0f; fYOffset = 85.0f;
break; break;
} }
selectedItemPos.y+=fYOffset; selectedItemPos.y+=fYOffset;
} }
@ -1606,7 +1606,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
{ {
// The host decides whether these are on or off // The host decides whether these are on or off
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0) if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
{ {
if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL) if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL)
{ {
wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad)); wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad));
@ -1621,7 +1621,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
} }
// The host decides whether these are on or off // The host decides whether these are on or off
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0) if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
{ {
XuiElementSetShow(m_hGamerTagA[iPad],bDisplay); XuiElementSetShow(m_hGamerTagA[iPad],bDisplay);
// set the opacity of the gamertag // set the opacity of the gamertag
@ -1712,11 +1712,11 @@ void CXuiSceneBase::_HideAllGameUIElements()
m_uiSelectedItemOpacityCountDown[i] = 0; m_uiSelectedItemOpacityCountDown[i] = 0;
m_selectedItemA[i].SetShow(FALSE); m_selectedItemA[i].SetShow(FALSE);
m_selectedItemSmallA[i].SetShow(FALSE); m_selectedItemSmallA[i].SetShow(FALSE);
m_BossHealthGroup[i].SetShow(FALSE); m_BossHealthGroup[i].SetShow(FALSE);
m_bossHealthVisible[i] = FALSE; m_bossHealthVisible[i] = FALSE;
XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE); XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
_DisplayGamertag(i,FALSE); _DisplayGamertag(i,FALSE);
} }
@ -1845,12 +1845,12 @@ void CXuiSceneBase::ReLayout( unsigned int iPad )
if( i>0 && lastVisible!=-1 ) if( i>0 && lastVisible!=-1 )
{ {
float width, height; float width, height;
XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height); XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height);
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout // 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
lastPos.x += width + m_iTooltipSpacingGap; lastPos.x += width + m_iTooltipSpacingGap;
XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height); XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height);
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout // 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
lastPosSmall.x += width + m_iTooltipSpacingGapSmall; lastPosSmall.x += width + m_iTooltipSpacingGapSmall;
} }
@ -1948,15 +1948,15 @@ HRESULT CXuiSceneBase::SetTooltips( unsigned int iPad, int iA, int iB, int iX, i
} }
else else
{ {
// does the tooltip need to change? // does the tooltip need to change?
if(CXuiSceneBase::Instance->m_iCurrentTooltipTextID[iPad][i]!=iTooptipsA[i] || forceUpdate) if(CXuiSceneBase::Instance->m_iCurrentTooltipTextID[iPad][i]!=iTooptipsA[i] || forceUpdate)
{ {
CXuiSceneBase::Instance->SetTooltipText(iPad, i, iTooptipsA[i] ); CXuiSceneBase::Instance->SetTooltipText(iPad, i, iTooptipsA[i] );
} }
CXuiSceneBase::Instance->_ShowTooltip(iPad, i, true ); CXuiSceneBase::Instance->_ShowTooltip(iPad, i, true );
} }
} }
} }
return S_OK; return S_OK;
} }
@ -2067,14 +2067,14 @@ HRESULT CXuiSceneBase::SetPlayerBasePositions(EBaseScenePosition pad0, EBaseScen
} }
HRESULT CXuiSceneBase::UpdatePlayerBasePositions() HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
{ {
EBaseScenePosition padPositions[XUSER_MAX_COUNT]; EBaseScenePosition padPositions[XUSER_MAX_COUNT];
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{ {
padPositions[idx] = e_BaseScene_NotSet; padPositions[idx] = e_BaseScene_NotSet;
} }
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
// If the game is not started (or is being held paused for a bit) then display all scenes fullscreen // If the game is not started (or is being held paused for a bit) then display all scenes fullscreen
@ -2134,7 +2134,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
padPositions[idx] = e_BaseScene_Right; padPositions[idx] = e_BaseScene_Right;
break; break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
padPositions[idx] = e_BaseScene_Top_Left; padPositions[idx] = e_BaseScene_Top_Left;
break; break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
padPositions[idx] = e_BaseScene_Top_Right; padPositions[idx] = e_BaseScene_Top_Right;
@ -2168,7 +2168,7 @@ void CXuiSceneBase::UpdateSelectedItemPos(int iPad)
CXuiSceneBase::Instance->_UpdateSelectedItemPos(iPad); CXuiSceneBase::Instance->_UpdateSelectedItemPos(iPad);
} }
HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad) HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad)
{ {
return CXuiSceneBase::Instance->_GetPlayerBaseScene(iPad); return CXuiSceneBase::Instance->_GetPlayerBaseScene(iPad);
} }

View file

@ -485,7 +485,7 @@ typedef uLong FAR uLongf;
# define z_off64_t off64_t # define z_off64_t off64_t
#else #else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64 # define z_off64_t long long
# else # else
# define z_off64_t z_off_t # define z_off64_t z_off_t
# endif # endif

View file

@ -97,14 +97,14 @@ void CreateWorldScreen::buttonClicked(Button *button)
if (done) return; if (done) return;
done = true; done = true;
__int64 seedValue = (new Random())->nextLong(); int64_t seedValue = (new Random())->nextLong();
wstring seedString = seedEdit->getValue(); wstring seedString = seedEdit->getValue();
if (seedString.length() != 0) if (seedString.length() != 0)
{ {
// try to convert it to a long first // try to convert it to a long first
// try { // 4J - removed try/catch // try { // 4J - removed try/catch
__int64 value = _fromString<__int64>(seedString); int64_t value = _fromString<int64_t>(seedString);
if (value != 0) if (value != 0)
{ {
seedValue = value; seedValue = value;

View file

@ -4,7 +4,7 @@
class DemoLevel : public Level class DemoLevel : public Level
{ {
private: private:
static const __int64 DEMO_LEVEL_SEED = 0; // 4J - TODO - was "Don't Look Back".hashCode(); static const int64_t DEMO_LEVEL_SEED = 0; // 4J - TODO - was "Don't Look Back".hashCode();
static const int DEMO_SPAWN_X = 796; static const int DEMO_SPAWN_X = 796;
static const int DEMO_SPAWN_Y = 72; static const int DEMO_SPAWN_Y = 72;
static const int DEMO_SPAWN_Z = -731; static const int DEMO_SPAWN_Z = -731;

View file

@ -13,8 +13,8 @@ void DemoMode::tick()
SurvivalMode::tick(); SurvivalMode::tick();
/* 4J - TODO - seems unlikely we need this demo mode anyway /* 4J - TODO - seems unlikely we need this demo mode anyway
__int64 time = minecraft->level->getTime(); int64_t time = minecraft->level->getTime();
__int64 day = (time / Level::TICKS_PER_DAY) + 1; int64_t day = (time / Level::TICKS_PER_DAY) + 1;
demoHasEnded = (time > (500 + Level::TICKS_PER_DAY * DEMO_DAYS)); demoHasEnded = (time > (500 + Level::TICKS_PER_DAY * DEMO_DAYS));
if (demoHasEnded) if (demoHasEnded)

View file

@ -50,7 +50,7 @@ void CConsoleMinecraftApp::HandleDLCLicenseChange()
// Clear the DLC installed flag so the scenes will pick up the new dlc (could be a full pack install) // Clear the DLC installed flag so the scenes will pick up the new dlc (could be a full pack install)
app.ClearDLCInstalled(); app.ClearDLCInstalled();
app.DebugPrintf(">>> HandleDLCLicenseChange - Updating license for DLC [%ls]\n",xOffer.wszOfferName); app.DebugPrintf(">>> HandleDLCLicenseChange - Updating license for DLC [%ls]\n",xOffer.wszOfferName);
pack->updateLicenseMask(1); pack->updateLicenseMask(1);
} }
else else
{ {
@ -100,7 +100,7 @@ void CConsoleMinecraftApp::ExitGame()
} }
void CConsoleMinecraftApp::FatalLoadError() void CConsoleMinecraftApp::FatalLoadError()
{ {
// 4J-PB - // 4J-PB -
//for(int i=0;i<10;i++) //for(int i=0;i<10;i++)
{ {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
@ -204,7 +204,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(WCHAR *wchName,PBYTE *ppbImageData,D
// load the local file // load the local file
WCHAR wchFilename[64]; WCHAR wchFilename[64];
// 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds
swprintf(wchFilename,L"DLCImages/%s",wchName); swprintf(wchFilename,L"DLCImages/%s",wchName);
HANDLE hFile = CreateFile(wchFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE hFile = CreateFile(wchFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@ -269,7 +269,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
StorageManager.SetSaveTitle(wWorldName.c_str()); StorageManager.SetSaveTitle(wWorldName.c_str());
bool isFlat = false; bool isFlat = false;
__int64 seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements int64_t seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
NetworkGameInitData *param = new NetworkGameInitData(); NetworkGameInitData *param = new NetworkGameInitData();
param->seed = seedValue; param->seed = seedValue;
@ -308,7 +308,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
thread->Run(); thread->Run();
} }
typedef struct typedef struct
{ {
eDLCContentType e_DLC_Type; eDLCContentType e_DLC_Type;
//WCHAR *wchDisplayName; //WCHAR *wchDisplayName;
@ -397,7 +397,7 @@ bool CConsoleMinecraftApp::UpdateProductId(XCONTENT_DATA &Data)
app.DebugPrintf("Couldn't find %ls\n",Data.wszDisplayName); app.DebugPrintf("Couldn't find %ls\n",Data.wszDisplayName);
} }
return false; return false;
} }
void CConsoleMinecraftApp::Shutdown() void CConsoleMinecraftApp::Shutdown()
@ -455,7 +455,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, in
{ {
app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPReadBannedList\n"); app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPReadBannedList\n");
C4JStorage::PTMSPP_FILEDATA pFileData=(C4JStorage::PTMSPP_FILEDATA)lpvData; C4JStorage::PTMSPP_FILEDATA pFileData=(C4JStorage::PTMSPP_FILEDATA)lpvData;
CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam;
if(pFileData) if(pFileData)
@ -471,7 +471,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadBannedList(void *pParam,int iPad, in
// mark the level as not checked against banned levels - it'll be checked once the level starts // mark the level as not checked against banned levels - it'll be checked once the level starts
app.SetBanListCheck(iPad,false); app.SetBanListCheck(iPad,false);
// Xbox One will clear things within the DownloadBlob // Xbox One will clear things within the DownloadBlob
#ifndef _XBOX_ONE #ifndef _XBOX_ONE
delete [] pFileData->pbData; delete [] pFileData->pbData;
delete [] pFileData; delete [] pFileData;
@ -558,11 +558,11 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad,
CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam;
app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList\n"); app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList\n");
if(lpvData!=NULL) if(lpvData!=NULL)
{ {
vector<C4JStorage::PTMSPP_FILE_DETAILS> *pvTmsFileDetails=(vector<C4JStorage::PTMSPP_FILE_DETAILS> *)lpvData; vector<C4JStorage::PTMSPP_FILE_DETAILS> *pvTmsFileDetails=(vector<C4JStorage::PTMSPP_FILE_DETAILS> *)lpvData;
if(pvTmsFileDetails->size()>0) if(pvTmsFileDetails->size()>0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
// dump out the file list // dump out the file list
app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size()); app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size());
@ -707,7 +707,7 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage:
{ {
CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam; CConsoleMinecraftApp* pClass = (CConsoleMinecraftApp*)pParam;
if ( saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota if ( saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota
|| saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfLocalStorage ) || saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfLocalStorage )
{ {
StorageManager.SetSaveDisabled(true); StorageManager.SetSaveDisabled(true);
@ -718,10 +718,10 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage:
else message = IDS_SAVE_INCOMPLETE_EXPLANATION_LOCAL_STORAGE; else message = IDS_SAVE_INCOMPLETE_EXPLANATION_LOCAL_STORAGE;
UINT uiIDA[3] = UINT uiIDA[3] =
{ {
IDS_SAVE_INCOMPLETE_RETRY_SAVING, IDS_SAVE_INCOMPLETE_RETRY_SAVING,
IDS_SAVE_INCOMPLETE_DISABLE_SAVING, IDS_SAVE_INCOMPLETE_DISABLE_SAVING,
IDS_SAVE_INCOMPLETE_DELETE_SAVES IDS_SAVE_INCOMPLETE_DELETE_SAVES
}; };
if ( ui.RequestMessageBox( IDS_SAVE_INCOMPLETE_TITLE, message, uiIDA,3,0,Callback_SaveGameIncompleteMessageBoxReturned,pClass, app.GetStringTable()) == C4JStorage::EMessage_Busy) if ( ui.RequestMessageBox( IDS_SAVE_INCOMPLETE_TITLE, message, uiIDA,3,0,Callback_SaveGameIncompleteMessageBoxReturned,pClass, app.GetStringTable()) == C4JStorage::EMessage_Busy)

View file

@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#ifdef __i386__ #ifdef __i386__
#define __RADX86__ #define __RADX86__
#else #else
#define __RADARM__ #define __RADARM__
#endif #endif
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -132,7 +132,7 @@
#define __RADX86__ #define __RADX86__
#else #else
#error Unknown processor #error Unknown processor
#endif #endif
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -155,7 +155,7 @@
#define __RADNACL__ #define __RADNACL__
#define __RAD32__ #define __RAD32__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define __RADX86__ #define __RADX86__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -196,7 +196,7 @@
#define __RAD64REGS__ #define __RAD64REGS__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
@ -265,7 +265,7 @@
#endif #endif
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__ #define __RADWIIU__
@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */ #undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#endif #endif
@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else #else
// NOTE: / / is a guaranteed parse error in C/C++. // NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif #endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff // WARNING : RAD_TLS should really only be used for debug/tools stuff
@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect : // helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... } // if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@ -1324,7 +1324,7 @@
__pragma(warning(push)) \ __pragma(warning(push)) \
__pragma(warning(disable:4127)) \ __pragma(warning(disable:4127)) \
} while(0) \ } while(0) \
__pragma(warning(pop)) __pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \ __pragma(warning(push)) \
@ -1333,10 +1333,10 @@
__pragma(warning(pop)) __pragma(warning(pop))
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \ #define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 ) } while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 ) } while ( (void)1,1 )
@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
RAD_STATEMENT_END_FALSE RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \ #define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c // Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later #if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x # define RR_UNUSED_VARIABLE(x) (void) x
#else #else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null : // just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr ); // you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@ -1482,7 +1482,7 @@
// Cache / prefetch macros : // Cache / prefetch macros :
// RR_PREFETCH for various platforms : // RR_PREFETCH for various platforms :
// //
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here // platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//----------------------------------------------------------- //-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break // RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK #ifdef RAD_NO_BREAK
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//----------------------------------- //-----------------------------------
#ifdef RR_DO_ASSERTS #ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long mov eax, DWORD PTR _Long
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300) #if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64) #pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) #define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__) #elif defined(__RADCELL__)
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__) #elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. //APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else #else

File diff suppressed because it is too large Load diff

View file

@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#ifdef __i386__ #ifdef __i386__
#define __RADX86__ #define __RADX86__
#else #else
#define __RADARM__ #define __RADARM__
#endif #endif
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -132,7 +132,7 @@
#define __RADX86__ #define __RADX86__
#else #else
#error Unknown processor #error Unknown processor
#endif #endif
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -155,7 +155,7 @@
#define __RADNACL__ #define __RADNACL__
#define __RAD32__ #define __RAD32__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define __RADX86__ #define __RADX86__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -196,7 +196,7 @@
#define __RAD64REGS__ #define __RAD64REGS__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
@ -265,7 +265,7 @@
#endif #endif
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__ #define __RADWIIU__
@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */ #undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#endif #endif
@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else #else
// NOTE: / / is a guaranteed parse error in C/C++. // NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif #endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff // WARNING : RAD_TLS should really only be used for debug/tools stuff
@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect : // helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... } // if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@ -1324,7 +1324,7 @@
__pragma(warning(push)) \ __pragma(warning(push)) \
__pragma(warning(disable:4127)) \ __pragma(warning(disable:4127)) \
} while(0) \ } while(0) \
__pragma(warning(pop)) __pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \ __pragma(warning(push)) \
@ -1333,10 +1333,10 @@
__pragma(warning(pop)) __pragma(warning(pop))
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \ #define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 ) } while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 ) } while ( (void)1,1 )
@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
RAD_STATEMENT_END_FALSE RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \ #define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c // Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later #if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x # define RR_UNUSED_VARIABLE(x) (void) x
#else #else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null : // just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr ); // you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@ -1482,7 +1482,7 @@
// Cache / prefetch macros : // Cache / prefetch macros :
// RR_PREFETCH for various platforms : // RR_PREFETCH for various platforms :
// //
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here // platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//----------------------------------------------------------- //-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break // RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK #ifdef RAD_NO_BREAK
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//----------------------------------- //-----------------------------------
#ifdef RR_DO_ASSERTS #ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long mov eax, DWORD PTR _Long
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300) #if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64) #pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) #define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__) #elif defined(__RADCELL__)
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__) #elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. //APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else #else

View file

@ -43,7 +43,7 @@ DQRNetworkManager::SessionInfo::SessionInfo()
} }
// This maps internal to extern states, and needs to match element-by-element the eSQRNetworkManagerInternalState enumerated type // This maps internal to extern states, and needs to match element-by-element the eSQRNetworkManagerInternalState enumerated type
const DQRNetworkManager::eDQRNetworkManagerState DQRNetworkManager::m_INTtoEXTStateMappings[DQRNetworkManager::DNM_INT_STATE_COUNT] = const DQRNetworkManager::eDQRNetworkManagerState DQRNetworkManager::m_INTtoEXTStateMappings[DQRNetworkManager::DNM_INT_STATE_COUNT] =
{ {
DNM_STATE_INITIALISING, // DNM_INT_STATE_INITIALISING DNM_STATE_INITIALISING, // DNM_INT_STATE_INITIALISING
DNM_STATE_INITIALISE_FAILED, // DNM_INT_STATE_INITIALISE_FAILED DNM_STATE_INITIALISE_FAILED, // DNM_INT_STATE_INITIALISE_FAILED
@ -64,7 +64,7 @@ const DQRNetworkManager::eDQRNetworkManagerState DQRNetworkManager::m_INTtoEXTSt
DNM_STATE_PLAYING, // DNM_INT_STATE_PLAYING DNM_STATE_PLAYING, // DNM_INT_STATE_PLAYING
DNM_STATE_LEAVING, // DNM_INT_STATE_LEAVING DNM_STATE_LEAVING, // DNM_INT_STATE_LEAVING
DNM_STATE_LEAVING, // DNM_INT_STATE_LEAVING_FAILED DNM_STATE_LEAVING, // DNM_INT_STATE_LEAVING_FAILED
DNM_STATE_ENDING, // DNM_INT_STATE_ENDING DNM_STATE_ENDING, // DNM_INT_STATE_ENDING
}; };
DQRNetworkManager::DQRNetworkManager(IDQRNetworkManagerListener *listener) DQRNetworkManager::DQRNetworkManager(IDQRNetworkManagerListener *listener)
@ -146,7 +146,7 @@ void DQRNetworkManager::EnableDebugXBLContext(MXS::XboxLiveContext^ XBLContext)
// Show service calls from Xbox Services on the UI for easy debugging // Show service calls from Xbox Services on the UI for easy debugging
XBLContext->Settings->EnableServiceCallRoutedEvents = true; XBLContext->Settings->EnableServiceCallRoutedEvents = true;
XBLContext->Settings->ServiceCallRouted += ref new Windows::Foundation::EventHandler<Microsoft::Xbox::Services::XboxServiceCallRoutedEventArgs^>( XBLContext->Settings->ServiceCallRouted += ref new Windows::Foundation::EventHandler<Microsoft::Xbox::Services::XboxServiceCallRoutedEventArgs^>(
[=]( Platform::Object^, Microsoft::Xbox::Services::XboxServiceCallRoutedEventArgs^ args ) [=]( Platform::Object^, Microsoft::Xbox::Services::XboxServiceCallRoutedEventArgs^ args )
{ {
//if( args->HttpStatus != 200 ) //if( args->HttpStatus != 200 )
@ -308,14 +308,14 @@ void DQRNetworkManager::JoinSession(int playerMask)
m_isHosting = false; m_isHosting = false;
sockaddr_in6 localSocketAddressStorage; sockaddr_in6 localSocketAddressStorage;
ZeroMemory(&localSocketAddressStorage, sizeof(localSocketAddressStorage)); ZeroMemory(&localSocketAddressStorage, sizeof(localSocketAddressStorage));
localSocketAddressStorage.sin6_family = AF_INET6; localSocketAddressStorage.sin6_family = AF_INET6;
localSocketAddressStorage.sin6_port = htons(m_associationTemplate->AcceptorSocketDescription->BoundPortRangeLower); localSocketAddressStorage.sin6_port = htons(m_associationTemplate->AcceptorSocketDescription->BoundPortRangeLower);
memcpy(&localSocketAddressStorage.sin6_addr, &in6addr_any, sizeof(in6addr_any)); memcpy(&localSocketAddressStorage.sin6_addr, &in6addr_any, sizeof(in6addr_any));
m_localSocketAddress = Platform::ArrayReference<BYTE>(reinterpret_cast<BYTE*>(&localSocketAddressStorage), sizeof(localSocketAddressStorage)); m_localSocketAddress = Platform::ArrayReference<BYTE>(reinterpret_cast<BYTE*>(&localSocketAddressStorage), sizeof(localSocketAddressStorage));
m_joinCreateSessionAttempts = 0; m_joinCreateSessionAttempts = 0;
@ -402,7 +402,7 @@ bool DQRNetworkManager::AddUsersToSession(int playerMask, MXSM::MultiplayerSessi
// We need to get a MultiplayerSession for each player that is joining // We need to get a MultiplayerSession for each player that is joining
MXSM::MultiplayerSession^ session = nullptr; MXSM::MultiplayerSession^ session = nullptr;
WXS::User^ newUser = ProfileManager.GetUser(i); WXS::User^ newUser = ProfileManager.GetUser(i);
if( newUser == nullptr ) if( newUser == nullptr )
{ {
@ -451,12 +451,12 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
// We need to handle this differently for the host and other machines. As the procedure for adding a reserved slot for a local player whilst on the host doesn't seem to work // We need to handle this differently for the host and other machines. As the procedure for adding a reserved slot for a local player whilst on the host doesn't seem to work
// //
// On the host machine, we: // On the host machine, we:
// //
// (1) Get a MPSD for the player that is being added // (1) Get a MPSD for the player that is being added
// (2) Call the join method // (2) Call the join method
// (3) Write the MPSD // (3) Write the MPSD
// (4) Update the player sync data, and broadcast out to all clients // (4) Update the player sync data, and broadcast out to all clients
// On remote machines, we: // On remote machines, we:
// //
// (1) join the party // (1) join the party
@ -473,10 +473,10 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
{ {
return false; return false;
} }
if( !m_isOfflineGame ) if( !m_isOfflineGame )
{ {
// This is going to involve some async processing // This is going to involve some async processing
MXS::XboxLiveContext^ newUserXBLContext = ref new MXS::XboxLiveContext(newUser); MXS::XboxLiveContext^ newUserXBLContext = ref new MXS::XboxLiveContext(newUser);
if( newUserXBLContext == nullptr ) if( newUserXBLContext == nullptr )
@ -558,7 +558,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
SendRoomSyncInfo(); SendRoomSyncInfo();
m_listener->HandlePlayerJoined(pPlayer); // This is for notifying of local players joining in an offline game m_listener->HandlePlayerJoined(pPlayer); // This is for notifying of local players joining in an offline game
} }
else else
{ {
// Can fail (notably if m_roomSyncData contains players who've left) // Can fail (notably if m_roomSyncData contains players who've left)
assert(0); assert(0);
@ -571,7 +571,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
{ {
// Check if there's any available slots before attempting to add the player to the party. We can still fail joining later if // Check if there's any available slots before attempting to add the player to the party. We can still fail joining later if
// the host can't add a reserved slot for us for some reason but better checking on the client side before even attempting. // the host can't add a reserved slot for us for some reason but better checking on the client side before even attempting.
WXS::User^ newUser = ProfileManager.GetUser(userIndex); WXS::User^ newUser = ProfileManager.GetUser(userIndex);
MXS::XboxLiveContext^ newUserXBLContext = ref new MXS::XboxLiveContext(newUser); MXS::XboxLiveContext^ newUserXBLContext = ref new MXS::XboxLiveContext(newUser);
@ -622,16 +622,16 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex)
bool DQRNetworkManager::RemoveLocalPlayerByUserIndex(int userIndex) bool DQRNetworkManager::RemoveLocalPlayerByUserIndex(int userIndex)
{ {
// We need to handle this differently for the host and other machines. // We need to handle this differently for the host and other machines.
// //
// On the host machine, we: // On the host machine, we:
// //
// (1) Get a MPSD for the player that is being removed // (1) Get a MPSD for the player that is being removed
// (2) Call the leave method // (2) Call the leave method
// (3) Write the MPSD // (3) Write the MPSD
// (4) Leave the party // (4) Leave the party
// (5) Update the player sync data, and broadcast out to all clients // (5) Update the player sync data, and broadcast out to all clients
// On remote machines, we: // On remote machines, we:
// //
// (1) Get a MPSD for the player that is being removed // (1) Get a MPSD for the player that is being removed
@ -651,7 +651,7 @@ bool DQRNetworkManager::RemoveLocalPlayerByUserIndex(int userIndex)
{ {
return false; return false;
} }
if( !m_isOfflineGame ) if( !m_isOfflineGame )
{ {
if( m_chat ) if( m_chat )
@ -714,7 +714,7 @@ bool DQRNetworkManager::IsHost()
} }
// Consider as "in session" from the moment that a game is created or joined, until the point where the game itself has been told via state change that we are now idle. The // Consider as "in session" from the moment that a game is created or joined, until the point where the game itself has been told via state change that we are now idle. The
// game code requires IsInSession to return true as soon as it has asked to do one of these things (even if the state system hasn't really caught up with this request yet), and // game code requires IsInSession to return true as soon as it has asked to do one of these things (even if the state system hasn't really caught up with this request yet), and
// it also requires that it is informed of the state changes leading up to not being in the session, before this should report false. // it also requires that it is informed of the state changes leading up to not being in the session, before this should report false.
bool DQRNetworkManager::IsInSession() bool DQRNetworkManager::IsInSession()
{ {
@ -788,7 +788,7 @@ wstring DQRNetworkManager::GetDisplayNameByGamertag(wstring gamertag)
{ {
return m_displayNames[gamertag]; return m_displayNames[gamertag];
} }
else else
{ {
return gamertag; return gamertag;
} }
@ -902,14 +902,14 @@ void DQRNetworkManager::Tick_VoiceChat()
{ {
m_chat->AddLocalUser(user); m_chat->AddLocalUser(user);
} }
} }
} }
m_vecChatPlayersJoined.clear(); m_vecChatPlayersJoined.clear();
LeaveCriticalSection(&m_csVecChatPlayers); LeaveCriticalSection(&m_csVecChatPlayers);
} }
void DQRNetworkManager::Tick_Party() void DQRNetworkManager::Tick_Party()
{ {
// If the primary player has been flagged as having left the party, then we don't respond immediately as it is possible we are just transitioning from one party to another, and it would be much // If the primary player has been flagged as having left the party, then we don't respond immediately as it is possible we are just transitioning from one party to another, and it would be much
// nicer to handle this kind of transition directly. If we do get a new party within this time period, then we'll handle by asking the user if they want to leave the game they are currently in etc. // nicer to handle this kind of transition directly. If we do get a new party within this time period, then we'll handle by asking the user if they want to leave the game they are currently in etc.
if( m_playersLeftParty ) if( m_playersLeftParty )
@ -919,7 +919,7 @@ void DQRNetworkManager::Tick_Party()
// We've waited long enough. User must (hopefully) have just left the party // We've waited long enough. User must (hopefully) have just left the party
// Previously we'd switch to offline but that causes a world of pain with forced sign-outs // Previously we'd switch to offline but that causes a world of pain with forced sign-outs
if( m_playersLeftParty & 1 ) if( m_playersLeftParty & 1 )
{ {
// Before we switch to an offline game, check to see if there is currently a new party. If this is the case and // Before we switch to an offline game, check to see if there is currently a new party. If this is the case and
// we're here, then its because we were added to a party, but didn't receive a gamesessionready event. So if we have // we're here, then its because we were added to a party, but didn't receive a gamesessionready event. So if we have
// a party here that we've joined, and the number of players in the party (including us) is more than MAX_PLAYERS_IN_TEMPLATE, // a party here that we've joined, and the number of players in the party (including us) is more than MAX_PLAYERS_IN_TEMPLATE,
@ -955,7 +955,7 @@ void DQRNetworkManager::Tick_Party()
m_playersLeftParty = 0; m_playersLeftParty = 0;
} }
} }
// Forced sign out // Forced sign out
if (m_handleForcedSignOut) if (m_handleForcedSignOut)
{ {
@ -1064,7 +1064,7 @@ void DQRNetworkManager::Tick_ResolveGamertags()
HostGamertagResolveDetails *details = m_hostGamertagResolveResults.front(); HostGamertagResolveDetails *details = m_hostGamertagResolveResults.front();
details->m_pPlayer->SetName(details->m_name.c_str()); details->m_pPlayer->SetName(details->m_name.c_str());
LogComment("Adding a player"); LogComment("Adding a player");
if( AddRoomSyncPlayer(details->m_pPlayer, details->m_sessionAddress, details->m_channel ) ) if( AddRoomSyncPlayer(details->m_pPlayer, details->m_sessionAddress, details->m_channel ) )
{ {
@ -1154,7 +1154,7 @@ void DQRNetworkManager::Tick_StateMachine()
break; break;
case DNM_INT_STATE_JOINING_SENDING_UNRELIABLE: case DNM_INT_STATE_JOINING_SENDING_UNRELIABLE:
{ {
__int64 timeNow = System::currentTimeMillis(); int64_t timeNow = System::currentTimeMillis();
// m_firstUnreliableSendTime of 0 indicates that we haven't tried sending an unreliable packet yet so need to send one and initialise things // m_firstUnreliableSendTime of 0 indicates that we haven't tried sending an unreliable packet yet so need to send one and initialise things
if( m_firstUnreliableSendTime == 0 ) if( m_firstUnreliableSendTime == 0 )
{ {
@ -1188,7 +1188,7 @@ void DQRNetworkManager::Tick_StateMachine()
{ {
// Timeout if we've been waiting for reserved slots for our joining players for too long. This is most likely because the host doesn't have room for all the slots we wanted, and we weren't able to determine this // Timeout if we've been waiting for reserved slots for our joining players for too long. This is most likely because the host doesn't have room for all the slots we wanted, and we weren't able to determine this
// when we went to join the game (ie someone else was joining at the same time). At this point we need to remove any local players that did already join, from both the session and the party. // when we went to join the game (ie someone else was joining at the same time). At this point we need to remove any local players that did already join, from both the session and the party.
__int64 timeNow = System::currentTimeMillis(); int64_t timeNow = System::currentTimeMillis();
if( ( timeNow - m_startedWaitingForReservationsTime ) > JOIN_RESERVATION_WAIT_TIME ) if( ( timeNow - m_startedWaitingForReservationsTime ) > JOIN_RESERVATION_WAIT_TIME )
{ {
SetState(DNM_INT_STATE_JOINING_FAILED_TIDY_UP); SetState(DNM_INT_STATE_JOINING_FAILED_TIDY_UP);
@ -1332,7 +1332,7 @@ void DQRNetworkManager::HandleSessionChange(MXSM::MultiplayerSession^ multiplaye
{ {
((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr ); ((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr );
} }
m_multiplayerSession = multiplayerSession; m_multiplayerSession = multiplayerSession;
} }
@ -1362,7 +1362,7 @@ MXSM::MultiplayerSession^ DQRNetworkManager::WriteSessionHelper( MXS::XboxLiveCo
}) })
.wait(); .wait();
if( outputMultiplayerSession != nullptr && if( outputMultiplayerSession != nullptr &&
outputMultiplayerSession->SessionReference != nullptr ) outputMultiplayerSession->SessionReference != nullptr )
{ {
app.DebugPrintf( "Session written OK\n" ); app.DebugPrintf( "Session written OK\n" );
@ -1422,7 +1422,7 @@ WXM::MultiplayerSessionReference^ DQRNetworkManager::ConvertToWindowsXboxMultipl
{ {
return ref new WXM::MultiplayerSessionReference( return ref new WXM::MultiplayerSessionReference(
sessionRef->SessionName, sessionRef->SessionName,
sessionRef->ServiceConfigurationId, sessionRef->ServiceConfigurationId,
sessionRef->SessionTemplateName sessionRef->SessionTemplateName
); );
} }
@ -1458,7 +1458,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
// And when we are done, anything left in the temporary vector must be a player that left // And when we are done, anything left in the temporary vector must be a player that left
for( int i = 0; i < pNewSyncData->playerCount; i++ ) for( int i = 0; i < pNewSyncData->playerCount; i++ )
{ {
PlayerSyncData *pNewPlayer = &pNewSyncData->players[i]; PlayerSyncData *pNewPlayer = &pNewSyncData->players[i];
bool bAlreadyExisted = false; bool bAlreadyExisted = false;
for (auto it = tempPlayers.begin(); it != tempPlayers.end(); it++) for (auto it = tempPlayers.begin(); it != tempPlayers.end(); it++)
{ {
@ -1491,7 +1491,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
} }
LogCommentFormat(L"Adding new player, index %d - type %d, small Id %d, name %s, xuid %s\n",i,m_players[i]->m_type,pNewPlayer->m_smallId,pNewPlayer->m_name,pNewPlayer->m_XUID); LogCommentFormat(L"Adding new player, index %d - type %d, small Id %d, name %s, xuid %s\n",i,m_players[i]->m_type,pNewPlayer->m_smallId,pNewPlayer->m_name,pNewPlayer->m_XUID);
m_players[i]->SetSmallId(pNewPlayer->m_smallId); m_players[i]->SetSmallId(pNewPlayer->m_smallId);
m_players[i]->SetName(pNewPlayer->m_name); m_players[i]->SetName(pNewPlayer->m_name);
m_players[i]->SetUID(PlayerUID(pNewPlayer->m_XUID)); m_players[i]->SetUID(PlayerUID(pNewPlayer->m_XUID));
@ -1525,7 +1525,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
bool DQRNetworkManager::AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned int sessionAddress, int channel) bool DQRNetworkManager::AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned int sessionAddress, int channel)
{ {
if( m_roomSyncData.playerCount == MAX_ONLINE_PLAYER_COUNT ) return false; if( m_roomSyncData.playerCount == MAX_ONLINE_PLAYER_COUNT ) return false;
EnterCriticalSection(&m_csRoomSyncData); EnterCriticalSection(&m_csRoomSyncData);
// Find the first entry that isn't us, to decide what to sync before. Don't consider entry #0 as this is reserved to indicate the host. // Find the first entry that isn't us, to decide what to sync before. Don't consider entry #0 as this is reserved to indicate the host.
int insertAtIdx = m_roomSyncData.playerCount; int insertAtIdx = m_roomSyncData.playerCount;
@ -1552,11 +1552,11 @@ bool DQRNetworkManager::AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned in
{ {
m_roomSyncData.players[i] = m_roomSyncData.players[i-1]; m_roomSyncData.players[i] = m_roomSyncData.players[i-1];
m_players[i] = m_players[i - 1]; m_players[i] = m_players[i - 1];
} }
m_roomSyncData.players[insertAtIdx].m_channel = channel; m_roomSyncData.players[insertAtIdx].m_channel = channel;
m_roomSyncData.players[insertAtIdx].m_sessionAddress = sessionAddress; m_roomSyncData.players[insertAtIdx].m_sessionAddress = sessionAddress;
int xuidLength = pPlayer->GetUID().toString().length() + 1; // +1 for terminator int xuidLength = pPlayer->GetUID().toString().length() + 1; // +1 for terminator
m_roomSyncData.players[insertAtIdx].m_XUID = new wchar_t [xuidLength]; m_roomSyncData.players[insertAtIdx].m_XUID = new wchar_t [xuidLength];
wcsncpy(m_roomSyncData.players[insertAtIdx].m_XUID, pPlayer->GetUID().toString().c_str(), xuidLength); wcsncpy(m_roomSyncData.players[insertAtIdx].m_XUID, pPlayer->GetUID().toString().c_str(), xuidLength);
m_roomSyncData.players[insertAtIdx].m_smallId = pPlayer->GetSmallId(); m_roomSyncData.players[insertAtIdx].m_smallId = pPlayer->GetSmallId();
wcscpy_s(m_roomSyncData.players[insertAtIdx].m_name, pPlayer->GetName()); wcscpy_s(m_roomSyncData.players[insertAtIdx].m_name, pPlayer->GetName());
@ -1587,7 +1587,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int ses
{ {
m_roomSyncData.players[iWriteIdx] = m_roomSyncData.players[i]; m_roomSyncData.players[iWriteIdx] = m_roomSyncData.players[i];
m_players[iWriteIdx] = m_players[i]; m_players[iWriteIdx] = m_players[i];
iWriteIdx++; iWriteIdx++;
} }
} }
m_roomSyncData.playerCount = iWriteIdx; m_roomSyncData.playerCount = iWriteIdx;
@ -1618,7 +1618,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer)
{ {
m_roomSyncData.players[iWriteIdx] = m_roomSyncData.players[i]; m_roomSyncData.players[iWriteIdx] = m_roomSyncData.players[i];
m_players[iWriteIdx] = m_players[i]; m_players[iWriteIdx] = m_players[i];
iWriteIdx++; iWriteIdx++;
} }
} }
m_roomSyncData.playerCount = iWriteIdx; m_roomSyncData.playerCount = iWriteIdx;
@ -1659,13 +1659,13 @@ void DQRNetworkManager::SendRoomSyncInfo()
uint32_t sizeHigh = internalBytes >> 8; uint32_t sizeHigh = internalBytes >> 8;
uint32_t sizeLow = internalBytes & 0xff; uint32_t sizeLow = internalBytes & 0xff;
data[0] = 0x80 | sizeHigh; // Header - flag as internal data (0x80), sending data[0] = 0x80 | sizeHigh; // Header - flag as internal data (0x80), sending
data[1] = sizeLow; // Data following has the a single byte to say what it is, followed by the room sync data itself data[1] = sizeLow; // Data following has the a single byte to say what it is, followed by the room sync data itself
data[2] = DQR_INTERNAL_PLAYER_TABLE; data[2] = DQR_INTERNAL_PLAYER_TABLE;
memcpy(data + 3, &xuidBytes, 4); memcpy(data + 3, &xuidBytes, 4);
memcpy(data + 7, &m_roomSyncData, sizeof(RoomSyncData)); memcpy(data + 7, &m_roomSyncData, sizeof(RoomSyncData));
unsigned char *pucCurr = data + 7 + sizeof(RoomSyncData); unsigned char *pucCurr = data + 7 + sizeof(RoomSyncData);
for( int i = 0 ; i < m_roomSyncData.playerCount; i++ ) for( int i = 0 ; i < m_roomSyncData.playerCount; i++ )
{ {
@ -1701,12 +1701,12 @@ void DQRNetworkManager::SendAddPlayerFailed(Platform::String^ xuid)
uint32_t sizeHigh = internalBytes >> 8; uint32_t sizeHigh = internalBytes >> 8;
uint32_t sizeLow = internalBytes & 0xff; uint32_t sizeLow = internalBytes & 0xff;
data[0] = 0x80 | sizeHigh; // Header - flag as internal data (0x80), sending data[0] = 0x80 | sizeHigh; // Header - flag as internal data (0x80), sending
data[1] = sizeLow; // Data following has the a single byte to say what it is, followed by the room sync data itself data[1] = sizeLow; // Data following has the a single byte to say what it is, followed by the room sync data itself
data[2] = DQR_INTERNAL_ADD_PLAYER_FAILED; data[2] = DQR_INTERNAL_ADD_PLAYER_FAILED;
memcpy(data + 3, &xuidBytes, 4); memcpy(data + 3, &xuidBytes, 4);
memcpy(data + 7, xuid->Data(), xuidBytes); memcpy(data + 7, xuid->Data(), xuidBytes);
SendBytesRaw(-1, data, totalBytes, true); SendBytesRaw(-1, data, totalBytes, true);
@ -1927,7 +1927,7 @@ int DQRNetworkManager::HostGameThreadProc()
// Actually create the session (locally), using the primary player's context // Actually create the session (locally), using the primary player's context
try try
{ {
session = ref new MXSM::MultiplayerSession( primaryUserXBLContext, session = ref new MXSM::MultiplayerSession( primaryUserXBLContext,
ref new MXSM::MultiplayerSessionReference( SERVICE_CONFIG_ID, MATCH_SESSION_TEMPLATE_NAME, sessionName ), ref new MXSM::MultiplayerSessionReference( SERVICE_CONFIG_ID, MATCH_SESSION_TEMPLATE_NAME, sessionName ),
0, // this means that it will use the maxMembers specified in the session template. 0, // this means that it will use the maxMembers specified in the session template.
false, false,
@ -1972,7 +1972,7 @@ int DQRNetworkManager::HostGameThreadProc()
session->Join( GetNextSmallIdAsJsonString(), true ); session->Join( GetNextSmallIdAsJsonString(), true );
session->SetCurrentUserStatus( MXSM::MultiplayerSessionMemberStatus::Active ); session->SetCurrentUserStatus( MXSM::MultiplayerSessionMemberStatus::Active );
// Get device ID for current user & set in the session // Get device ID for current user & set in the session
Platform::String^ secureDeviceAddress = WXN::SecureDeviceAddress::GetLocal()->GetBase64String(); Platform::String^ secureDeviceAddress = WXN::SecureDeviceAddress::GetLocal()->GetBase64String();
session->SetCurrentUserSecureDeviceAddressBase64( secureDeviceAddress ); session->SetCurrentUserSecureDeviceAddressBase64( secureDeviceAddress );
@ -1997,7 +1997,7 @@ int DQRNetworkManager::HostGameThreadProc()
return 0; return 0;
} }
m_partyController->SetJoinability(m_listener->IsSessionJoinable()); m_partyController->SetJoinability(m_listener->IsSessionJoinable());
// Add reservations for anyone in the party, who isn't the primary player. Just adding local players for now, but perhaps this should add // Add reservations for anyone in the party, who isn't the primary player. Just adding local players for now, but perhaps this should add
// other party members at this stage? // other party members at this stage?
for ( WXM::PartyMember^ member : partyView->Members ) for ( WXM::PartyMember^ member : partyView->Members )
@ -2029,8 +2029,8 @@ int DQRNetworkManager::HostGameThreadProc()
session->SetHostDeviceToken( hostMember->DeviceToken ); session->SetHostDeviceToken( hostMember->DeviceToken );
m_partyController->RegisterGamePlayersChangedEventHandler(); m_partyController->RegisterGamePlayersChangedEventHandler();
// Update session on the server // Update session on the server
HRESULT hr = S_OK; HRESULT hr = S_OK;
session = WriteSessionHelper( primaryUserXBLContext, session, MXSM::MultiplayerSessionWriteMode::UpdateExisting, hr ); session = WriteSessionHelper( primaryUserXBLContext, session, MXSM::MultiplayerSessionWriteMode::UpdateExisting, hr );
@ -2086,14 +2086,14 @@ int DQRNetworkManager::HostGameThreadProc()
if( m_state == DNM_INT_STATE_HOSTING_FAILED) return 0; if( m_state == DNM_INT_STATE_HOSTING_FAILED) return 0;
sockaddr_in6 localSocketAddressStorage; sockaddr_in6 localSocketAddressStorage;
ZeroMemory(&localSocketAddressStorage, sizeof(localSocketAddressStorage)); ZeroMemory(&localSocketAddressStorage, sizeof(localSocketAddressStorage));
localSocketAddressStorage.sin6_family = AF_INET6; localSocketAddressStorage.sin6_family = AF_INET6;
localSocketAddressStorage.sin6_port = htons(m_associationTemplate->AcceptorSocketDescription->BoundPortRangeLower); localSocketAddressStorage.sin6_port = htons(m_associationTemplate->AcceptorSocketDescription->BoundPortRangeLower);
memcpy(&localSocketAddressStorage.sin6_addr, &in6addr_any, sizeof(in6addr_any)); memcpy(&localSocketAddressStorage.sin6_addr, &in6addr_any, sizeof(in6addr_any));
m_localSocketAddress = Platform::ArrayReference<BYTE>(reinterpret_cast<BYTE*>(&localSocketAddressStorage), sizeof(localSocketAddressStorage)); m_localSocketAddress = Platform::ArrayReference<BYTE>(reinterpret_cast<BYTE*>(&localSocketAddressStorage), sizeof(localSocketAddressStorage));
// This shouldn't ever happen, but seems worth checking that we don't have a pre-existing session in case there's any way to get here with one already running // This shouldn't ever happen, but seems worth checking that we don't have a pre-existing session in case there's any way to get here with one already running
@ -2184,7 +2184,7 @@ int DQRNetworkManager::HostGameThreadProc()
if( m_currentUserMask & ( 1 << i ) && ProfileManager.IsSignedIn(i)) if( m_currentUserMask & ( 1 << i ) && ProfileManager.IsSignedIn(i))
{ {
auto user = ProfileManager.GetUser(i); auto user = ProfileManager.GetUser(i);
wstring displayName = ProfileManager.GetDisplayName(i); wstring displayName = ProfileManager.GetDisplayName(i);
DQRNetworkPlayer* pPlayer = new DQRNetworkPlayer(this, ( ( smallId == m_hostSmallId ) ? DQRNetworkPlayer::DNP_TYPE_HOST : DQRNetworkPlayer::DNP_TYPE_LOCAL ), true, i, localSessionAddress); DQRNetworkPlayer* pPlayer = new DQRNetworkPlayer(this, ( ( smallId == m_hostSmallId ) ? DQRNetworkPlayer::DNP_TYPE_HOST : DQRNetworkPlayer::DNP_TYPE_LOCAL ), true, i, localSessionAddress);
pPlayer->SetSmallId(smallId); pPlayer->SetSmallId(smallId);
@ -2234,7 +2234,7 @@ int DQRNetworkManager::LeaveRoomThreadProc()
// Request RTS to be terminated // Request RTS to be terminated
RTS_Terminate(); RTS_Terminate();
// Now leave the game session. We need to do this for each player in turn, writing each time // Now leave the game session. We need to do this for each player in turn, writing each time
bool bError = false; bool bError = false;
for( int i = 0; i < 4; i++ ) for( int i = 0; i < 4; i++ )
@ -2339,7 +2339,7 @@ int DQRNetworkManager::TidyUpJoinThreadProc()
// We can fail to join at various points, and in at least one case (if it is down to RUDP unreliable packets timing out) then we don't have m_joinSessionUserMask bits set any more, // We can fail to join at various points, and in at least one case (if it is down to RUDP unreliable packets timing out) then we don't have m_joinSessionUserMask bits set any more,
// but we Do have m_currentUserMask set. Any of these should be considered users we should be attempting to remove from the session. // but we Do have m_currentUserMask set. Any of these should be considered users we should be attempting to remove from the session.
int removeSessionMask = m_joinSessionUserMask | m_currentUserMask; int removeSessionMask = m_joinSessionUserMask | m_currentUserMask;
for( int i = 0; i < 4; i++ ) for( int i = 0; i < 4; i++ )
{ {
if( removeSessionMask & ( 1 << i ) ) if( removeSessionMask & ( 1 << i ) )
@ -2428,7 +2428,7 @@ int DQRNetworkManager::UpdateCustomSessionDataThreadProc()
{ {
LogComment(L"Starting thread to update custom data"); LogComment(L"Starting thread to update custom data");
WXS::User^ primaryUser = ProfileManager.GetUser(0); WXS::User^ primaryUser = ProfileManager.GetUser(0);
if( primaryUser == nullptr ) if( primaryUser == nullptr )
{ {
return 0; return 0;
@ -2550,7 +2550,7 @@ void DQRNetworkManager::HandlePlayerRemovedFromParty(int playerMask)
{ {
// As a client, we don't have any messy changing to offline game or saving etc. to do, so we can respond immediately to leaving the party // As a client, we don't have any messy changing to offline game or saving etc. to do, so we can respond immediately to leaving the party
if( playerMask & 1 ) if( playerMask & 1 )
{ {
DQRNetworkManager::LogComment(L"Primary player on this system has left the party - leaving game\n"); DQRNetworkManager::LogComment(L"Primary player on this system has left the party - leaving game\n");
app.SetDisconnectReason(DisconnectPacket::eDisconnect_ExitedGame); app.SetDisconnectReason(DisconnectPacket::eDisconnect_ExitedGame);
LeaveRoom(); LeaveRoom();
@ -2725,7 +2725,7 @@ bool DQRNetworkManager::JoinPartyFromSearchResult(SessionSearchResult *searchRes
m_joinSessionUserMask = playerMask; m_joinSessionUserMask = playerMask;
m_isInSession = true; m_isInSession = true;
m_isOfflineGame = false; m_isOfflineGame = false;
m_startedWaitingForReservationsTime = System::currentTimeMillis(); m_startedWaitingForReservationsTime = System::currentTimeMillis();
SetState(DNM_INT_STATE_JOINING_WAITING_FOR_RESERVATIONS); SetState(DNM_INT_STATE_JOINING_WAITING_FOR_RESERVATIONS);
@ -2742,7 +2742,7 @@ bool DQRNetworkManager::JoinPartyFromSearchResult(SessionSearchResult *searchRes
if( sessionRef != nullptr ) if( sessionRef != nullptr )
{ {
// Allow 2 seconds before we let the player cancel // Allow 2 seconds before we let the player cancel
__int64 allowCancelTime = System::currentTimeMillis() + (1000 * 2); int64_t allowCancelTime = System::currentTimeMillis() + (1000 * 2);
// Now leave the game session. We need to do this for each player in turn, writing each time. Consider that any of the joining // Now leave the game session. We need to do this for each player in turn, writing each time. Consider that any of the joining
// members *may* have a slot (reserved or active) depending on how far progressed the joining got. // members *may* have a slot (reserved or active) depending on how far progressed the joining got.
@ -2814,7 +2814,7 @@ bool DQRNetworkManager::JoinPartyFromSearchResult(SessionSearchResult *searchRes
break; break;
} }
__int64 currentTime = System::currentTimeMillis(); int64_t currentTime = System::currentTimeMillis();
if( currentTime > allowCancelTime) if( currentTime > allowCancelTime)
{ {
shownCancelScreen = true; shownCancelScreen = true;
@ -2893,7 +2893,7 @@ bool DQRNetworkManager::JoinPartyFromSearchResult(SessionSearchResult *searchRes
SetState(DNM_INT_STATE_JOINING_FAILED); SetState(DNM_INT_STATE_JOINING_FAILED);
} }
}); });
while(!ccTask.is_done()) while(!ccTask.is_done())
{ {
@ -3013,7 +3013,7 @@ void DQRNetworkManager::RequestDisplayName(DQRNetworkPlayer *player)
{ {
if (player->IsLocal()) if (player->IsLocal())
{ {
// Player is local so we can just ask profile manager // Player is local so we can just ask profile manager
SetDisplayName(player->GetUID(), ProfileManager.GetDisplayName(player->GetLocalPlayerIndex())); SetDisplayName(player->GetUID(), ProfileManager.GetDisplayName(player->GetLocalPlayerIndex()));
} }
else else

View file

@ -131,7 +131,7 @@ public:
static const int MAX_ONLINE_PLAYER_COUNT = 8; static const int MAX_ONLINE_PLAYER_COUNT = 8;
static const int MAX_ONLINE_PLAYER_NAME_LENGTH = 21; static const int MAX_ONLINE_PLAYER_NAME_LENGTH = 21;
// This class stores everything about a player that must be synchronised between machines. // This class stores everything about a player that must be synchronised between machines.
class PlayerSyncData class PlayerSyncData
{ {
public: public:
@ -210,7 +210,7 @@ public:
DNM_STATE_JOINING, DNM_STATE_JOINING,
DNM_STATE_STARTING, DNM_STATE_STARTING,
DNM_STATE_PLAYING, DNM_STATE_PLAYING,
DNM_STATE_LEAVING, DNM_STATE_LEAVING,
DNM_STATE_ENDING, DNM_STATE_ENDING,
@ -339,9 +339,9 @@ private:
static const eDQRNetworkManagerState m_INTtoEXTStateMappings[DNM_INT_STATE_COUNT]; static const eDQRNetworkManagerState m_INTtoEXTStateMappings[DNM_INT_STATE_COUNT];
eDQRNetworkManagerInternalState m_state; eDQRNetworkManagerInternalState m_state;
eDQRNetworkManagerState m_stateExternal; eDQRNetworkManagerState m_stateExternal;
__int64 m_lastUnreliableSendTime; int64_t m_lastUnreliableSendTime;
__int64 m_firstUnreliableSendTime; int64_t m_firstUnreliableSendTime;
__int64 m_startedWaitingForReservationsTime; int64_t m_startedWaitingForReservationsTime;
unsigned char *m_customSessionData; unsigned char *m_customSessionData;
unsigned int m_customSessionDataSize; unsigned int m_customSessionDataSize;
int m_customDataDirtyUpdateTicks; int m_customDataDirtyUpdateTicks;
@ -361,7 +361,7 @@ private:
CRITICAL_SECTION m_csRoomSyncData; CRITICAL_SECTION m_csRoomSyncData;
RoomSyncData m_roomSyncData; RoomSyncData m_roomSyncData;
DQRNetworkPlayer *m_players[MAX_ONLINE_PLAYER_COUNT]; DQRNetworkPlayer *m_players[MAX_ONLINE_PLAYER_COUNT];
IDQRNetworkManagerListener *m_listener; IDQRNetworkManagerListener *m_listener;
PartyController *m_partyController; PartyController *m_partyController;
@ -389,7 +389,7 @@ private:
int m_joinCreateSessionAttempts; int m_joinCreateSessionAttempts;
C4JThread *m_CreateSessionThread; C4JThread *m_CreateSessionThread;
C4JThread *m_LeaveRoomThread; C4JThread *m_LeaveRoomThread;
C4JThread *m_TidyUpJoinThread; C4JThread *m_TidyUpJoinThread;
C4JThread *m_UpdateCustomSessionDataThread; C4JThread *m_UpdateCustomSessionDataThread;
C4JThread *m_RTS_DoWorkThread; C4JThread *m_RTS_DoWorkThread;
@ -426,7 +426,7 @@ private:
int GetQueueSizeMessages(); int GetQueueSizeMessages();
void SendBytesRaw(int smallId, BYTE *bytes, int byteCount, bool reliableAndSequential); void SendBytesRaw(int smallId, BYTE *bytes, int byteCount, bool reliableAndSequential);
void SendBytesChat(unsigned int address, BYTE *bytes, int byteCount, bool reliable, bool sequential, bool broadcast); void SendBytesChat(unsigned int address, BYTE *bytes, int byteCount, bool reliable, bool sequential, bool broadcast);
bool AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned int sessionAddress, int channel); bool AddRoomSyncPlayer(DQRNetworkPlayer *pPlayer, unsigned int sessionAddress, int channel);
void RemoveRoomSyncPlayersWithSessionAddress(unsigned int sessionAddress); void RemoveRoomSyncPlayersWithSessionAddress(unsigned int sessionAddress);
void RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer); void RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer);
@ -438,7 +438,7 @@ private:
int GetSessionIndexForSmallId(unsigned char smallId); int GetSessionIndexForSmallId(unsigned char smallId);
int GetSessionIndexAndSmallIdForHost(unsigned char *smallId); int GetSessionIndexAndSmallIdForHost(unsigned char *smallId);
static void LogComment( Platform::String^ strText ); static void LogComment( Platform::String^ strText );
static void LogCommentFormat( LPCWSTR strMsg, ... ); static void LogCommentFormat( LPCWSTR strMsg, ... );
static void LogCommentWithError( Platform::String^ strTest, HRESULT hr ); static void LogCommentWithError( Platform::String^ strTest, HRESULT hr );
@ -491,7 +491,7 @@ public:
void SetDisplayName(PlayerUID xuid, wstring displayName); void SetDisplayName(PlayerUID xuid, wstring displayName);
private: private:
__int64 m_playersLeftPartyTime; int64_t m_playersLeftPartyTime;
int m_playersLeftParty; int m_playersLeftParty;
bool GetBestPartyUserIndex(); bool GetBestPartyUserIndex();
@ -502,7 +502,7 @@ private:
bool GetGameSessionData(MXSM::MultiplayerSession^ session, void *gameSessionData); bool GetGameSessionData(MXSM::MultiplayerSession^ session, void *gameSessionData);
public: public:
static Platform::Collections::Vector<Platform::String^>^ GetFriends(); static Platform::Collections::Vector<Platform::String^>^ GetFriends();
private: private:
SessionSearchResult *m_sessionSearchResults; SessionSearchResult *m_sessionSearchResults;
@ -551,7 +551,7 @@ private:
void Process_RTS_MESSAGE_STATUS_TERMINATED(RTS_Message &message); void Process_RTS_MESSAGE_STATUS_TERMINATED(RTS_Message &message);
// Outgoing messages - to be called from the RTS work thread, to process requests from the main thread // Outgoing messages - to be called from the RTS work thread, to process requests from the main thread
void ProcessRTSMessagesOutgoing(); void ProcessRTSMessagesOutgoing();
void Process_RTS_MESSAGE_START_CLIENT(RTS_Message &message); void Process_RTS_MESSAGE_START_CLIENT(RTS_Message &message);
void Process_RTS_MESSAGE_START_HOST(RTS_Message &message); void Process_RTS_MESSAGE_START_HOST(RTS_Message &message);

View file

@ -1,13 +1,13 @@
// 4J-PB - // 4J-PB -
// The ATG Framework is a common set of C++ class libraries that is used by the samples in the XDK, and was developed by the Advanced Technology Group (ATG). // The ATG Framework is a common set of C++ class libraries that is used by the samples in the XDK, and was developed by the Advanced Technology Group (ATG).
// The ATG Framework offers a clean and consistent format for the samples. These classes define functions used by all the samples. // The ATG Framework offers a clean and consistent format for the samples. These classes define functions used by all the samples.
// The ATG Framework together with the samples demonstrates best practices and innovative techniques for Xbox 360. There are many useful sections of code in the samples. // The ATG Framework together with the samples demonstrates best practices and innovative techniques for Xbox 360. There are many useful sections of code in the samples.
// You are encouraged to incorporate this code into your titles. // You are encouraged to incorporate this code into your titles.
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// AtgXmlParser.cpp // AtgXmlParser.cpp
// //
// Simple callback non-validating XML parser implementation. // Simple callback non-validating XML parser implementation.
// //
// Xbox Advanced Technology Group. // Xbox Advanced Technology Group.
@ -35,7 +35,7 @@ XMLParser::XMLParser()
// Name: XMLParser::~XMLParser // Name: XMLParser::~XMLParser
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
XMLParser::~XMLParser() XMLParser::~XMLParser()
{ {
} }
@ -51,11 +51,11 @@ VOID XMLParser::FillBuffer()
if( m_hFile == NULL ) if( m_hFile == NULL )
{ {
if( m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE ) if( m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE )
NChars = XML_READ_BUFFER_SIZE; NChars = XML_READ_BUFFER_SIZE;
else else
NChars = m_uInXMLBufferCharsLeft; NChars = m_uInXMLBufferCharsLeft;
CopyMemory( m_pReadBuf, m_pInXMLBuffer, NChars ); CopyMemory( m_pReadBuf, m_pInXMLBuffer, NChars );
m_uInXMLBufferCharsLeft -= NChars; m_uInXMLBufferCharsLeft -= NChars;
m_pInXMLBuffer += NChars; m_pInXMLBuffer += NChars;
@ -69,7 +69,7 @@ VOID XMLParser::FillBuffer()
} }
m_dwCharsConsumed += NChars; m_dwCharsConsumed += NChars;
__int64 iProgress = m_dwCharsTotal ? (( (__int64)m_dwCharsConsumed * 1000 ) / (__int64)m_dwCharsTotal) : 0; int64_t iProgress = m_dwCharsTotal ? (( (int64_t)m_dwCharsConsumed * 1000 ) / (int64_t)m_dwCharsTotal) : 0;
m_pISAXCallback->SetParseProgress( (DWORD)iProgress ); m_pISAXCallback->SetParseProgress( (DWORD)iProgress );
m_pReadBuf[ NChars ] = '\0'; m_pReadBuf[ NChars ] = '\0';
@ -89,7 +89,7 @@ VOID XMLParser::SkipNextAdvance()
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Name: XMLParser::ConsumeSpace // Name: XMLParser::ConsumeSpace
// Desc: Skips spaces in the current stream // Desc: Skips spaces in the current stream
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
HRESULT XMLParser::ConsumeSpace() HRESULT XMLParser::ConsumeSpace()
{ {
@ -104,29 +104,29 @@ HRESULT XMLParser::ConsumeSpace()
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
} }
SkipNextAdvance(); SkipNextAdvance();
return S_OK; return S_OK;
} }
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Name: XMLParser::ConvertEscape // Name: XMLParser::ConvertEscape
// Desc: Copies and converts an escape sequence into m_pWriteBuf // Desc: Copies and converts an escape sequence into m_pWriteBuf
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
HRESULT XMLParser::ConvertEscape() HRESULT XMLParser::ConvertEscape()
{ {
HRESULT hr; HRESULT hr;
WCHAR wVal = 0; WCHAR wVal = 0;
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
// all escape sequences start with &, so ignore the first character // all escape sequences start with &, so ignore the first character
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if ( m_Ch == '#' ) // character as hex or decimal if ( m_Ch == '#' ) // character as hex or decimal
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
@ -135,9 +135,9 @@ HRESULT XMLParser::ConvertEscape()
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
while ( m_Ch != ';' ) while ( m_Ch != ';' )
{ {
wVal *= 16; wVal *= 16;
if ( ( m_Ch >= '0' ) && ( m_Ch <= '9' ) ) if ( ( m_Ch >= '0' ) && ( m_Ch <= '9' ) )
@ -151,11 +151,11 @@ HRESULT XMLParser::ConvertEscape()
else if ( ( m_Ch >= 'A' ) && ( m_Ch <= 'F' ) ) else if ( ( m_Ch >= 'A' ) && ( m_Ch <= 'F' ) )
{ {
wVal += m_Ch - 'A' + 10; wVal += m_Ch - 'A' + 10;
} }
else else
{ {
Error( E_INVALID_XML_SYNTAX, "Expected hex digit as part of &#x escape sequence" ); Error( E_INVALID_XML_SYNTAX, "Expected hex digit as part of &#x escape sequence" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
@ -165,7 +165,7 @@ HRESULT XMLParser::ConvertEscape()
else // decimal number else // decimal number
{ {
while ( m_Ch != ';' ) while ( m_Ch != ';' )
{ {
wVal *= 10; wVal *= 10;
if ( ( m_Ch >= '0' ) && ( m_Ch <= '9' ) ) if ( ( m_Ch >= '0' ) && ( m_Ch <= '9' ) )
@ -174,7 +174,7 @@ HRESULT XMLParser::ConvertEscape()
} }
else else
{ {
Error( E_INVALID_XML_SYNTAX, "Expected decimal digit as part of &# escape sequence" ); Error( E_INVALID_XML_SYNTAX, "Expected decimal digit as part of &# escape sequence" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
@ -187,7 +187,7 @@ HRESULT XMLParser::ConvertEscape()
m_Ch = wVal; m_Ch = wVal;
return S_OK; return S_OK;
} }
// must be an entity reference // must be an entity reference
@ -197,13 +197,13 @@ HRESULT XMLParser::ConvertEscape()
SkipNextAdvance(); SkipNextAdvance();
if( FAILED( hr = AdvanceName() ) ) if( FAILED( hr = AdvanceName() ) )
return hr; return hr;
EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal );
m_pWritePtr = pEntityRefVal; m_pWritePtr = pEntityRefVal;
if ( EntityRefLen == 0 ) if ( EntityRefLen == 0 )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting entity name after &" ); Error( E_INVALID_XML_SYNTAX, "Expecting entity name after &" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
@ -219,7 +219,7 @@ HRESULT XMLParser::ConvertEscape()
wVal = '"'; wVal = '"';
else else
{ {
Error( E_INVALID_XML_SYNTAX, "Unrecognized entity name after & - (should be lt, gt, amp, apos, or quot)" ); Error( E_INVALID_XML_SYNTAX, "Unrecognized entity name after & - (should be lt, gt, amp, apos, or quot)" );
return E_INVALID_XML_SYNTAX; // return false if unrecognized token sequence return E_INVALID_XML_SYNTAX; // return false if unrecognized token sequence
} }
@ -228,10 +228,10 @@ HRESULT XMLParser::ConvertEscape()
if( m_Ch != ';' ) if( m_Ch != ';' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expected terminating ; for entity reference" ); Error( E_INVALID_XML_SYNTAX, "Expected terminating ; for entity reference" );
return E_INVALID_XML_SYNTAX; // malformed reference - needs terminating ; return E_INVALID_XML_SYNTAX; // malformed reference - needs terminating ;
} }
m_Ch = wVal; m_Ch = wVal;
return S_OK; return S_OK;
} }
@ -250,41 +250,41 @@ HRESULT XMLParser::AdvanceAttrVal()
return hr; return hr;
if( ( m_Ch != '"' ) && ( m_Ch != '\'' ) ) if( ( m_Ch != '"' ) && ( m_Ch != '\'' ) )
{ {
Error( E_INVALID_XML_SYNTAX, "Attribute values must be enclosed in quotes" ); Error( E_INVALID_XML_SYNTAX, "Attribute values must be enclosed in quotes" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
wQuoteChar = m_Ch; wQuoteChar = m_Ch;
for( ;; ) for( ;; )
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
else if( m_Ch == wQuoteChar ) else if( m_Ch == wQuoteChar )
break; break;
else if( m_Ch == '&' ) else if( m_Ch == '&' )
{ {
SkipNextAdvance(); SkipNextAdvance();
if( FAILED( hr = ConvertEscape() ) ) if( FAILED( hr = ConvertEscape() ) )
return hr; return hr;
} }
else if( m_Ch == '<' ) else if( m_Ch == '<' )
{ {
Error( E_INVALID_XML_SYNTAX, "Illegal character '<' in element tag" ); Error( E_INVALID_XML_SYNTAX, "Illegal character '<' in element tag" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
// copy character into the buffer // copy character into the buffer
if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE ) if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE )
{ {
Error( E_INVALID_XML_SYNTAX, "Total element tag size may not be more than %d characters", XML_WRITE_BUFFER_SIZE ); Error( E_INVALID_XML_SYNTAX, "Total element tag size may not be more than %d characters", XML_WRITE_BUFFER_SIZE );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
*m_pWritePtr = m_Ch; *m_pWritePtr = m_Ch;
m_pWritePtr++; m_pWritePtr++;
} }
return S_OK; return S_OK;
} }
@ -296,18 +296,18 @@ HRESULT XMLParser::AdvanceAttrVal()
// Ignores leading whitespace. Currently does not support unicode names // Ignores leading whitespace. Currently does not support unicode names
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
HRESULT XMLParser::AdvanceName() HRESULT XMLParser::AdvanceName()
{ {
HRESULT hr; HRESULT hr;
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( ( ( m_Ch < 'A' ) || ( m_Ch > 'Z' ) ) && if( ( ( m_Ch < 'A' ) || ( m_Ch > 'Z' ) ) &&
( ( m_Ch < 'a' ) || ( m_Ch > 'z' ) ) && ( ( m_Ch < 'a' ) || ( m_Ch > 'z' ) ) &&
( m_Ch != '_' ) && ( m_Ch != ':' ) ) ( m_Ch != '_' ) && ( m_Ch != ':' ) )
{ {
Error( E_INVALID_XML_SYNTAX, "Names must start with an alphabetic character or _ or :" ); Error( E_INVALID_XML_SYNTAX, "Names must start with an alphabetic character or _ or :" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
while( ( ( m_Ch >= 'A' ) && ( m_Ch <= 'Z' ) ) || while( ( ( m_Ch >= 'A' ) && ( m_Ch <= 'Z' ) ) ||
@ -319,17 +319,17 @@ HRESULT XMLParser::AdvanceName()
if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE ) if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE )
{ {
Error( E_INVALID_XML_SYNTAX, "Total element tag size may not be more than %d characters", XML_WRITE_BUFFER_SIZE ); Error( E_INVALID_XML_SYNTAX, "Total element tag size may not be more than %d characters", XML_WRITE_BUFFER_SIZE );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
*m_pWritePtr = m_Ch; *m_pWritePtr = m_Ch;
m_pWritePtr++; m_pWritePtr++;
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
} }
SkipNextAdvance(); SkipNextAdvance();
return S_OK; return S_OK;
} }
@ -343,7 +343,7 @@ HRESULT XMLParser::AdvanceName()
// Returns S_OK if there are more characters, E_ABORT for no characters to read // Returns S_OK if there are more characters, E_ABORT for no characters to read
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail ) HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
{ {
if( m_bSkipNextAdvance ) if( m_bSkipNextAdvance )
{ {
m_bSkipNextAdvance = FALSE; m_bSkipNextAdvance = FALSE;
@ -351,20 +351,20 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
} }
// If we hit EOF in the middle of a character, // If we hit EOF in the middle of a character,
// it's ok-- we'll just have a corrupt last character // it's ok-- we'll just have a corrupt last character
// (the buffer is padded with double NULLs ) // (the buffer is padded with double NULLs )
if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) ) if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) )
{ {
// Read more from the file // Read more from the file
FillBuffer(); FillBuffer();
// We are at EOF if it is still NULL // We are at EOF if it is still NULL
if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) ) if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) )
{ {
if( !bOkToFail ) if( !bOkToFail )
{ {
Error( E_INVALID_XML_SYNTAX, "Unexpected EOF while parsing XML file" ); Error( E_INVALID_XML_SYNTAX, "Unexpected EOF while parsing XML file" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
else else
@ -372,7 +372,7 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
return E_FAIL; return E_FAIL;
} }
} }
} }
if( m_bUnicode == FALSE ) if( m_bUnicode == FALSE )
{ {
@ -382,13 +382,13 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
else // if( m_bUnicode == TRUE ) else // if( m_bUnicode == TRUE )
{ {
m_Ch = *((WCHAR *)m_pReadPtr); m_Ch = *((WCHAR *)m_pReadPtr);
if( m_bReverseBytes ) if( m_bReverseBytes )
{ {
m_Ch = ( m_Ch << 8 ) + ( m_Ch >> 8 ); m_Ch = ( m_Ch << 8 ) + ( m_Ch >> 8 );
} }
m_pReadPtr += 2; m_pReadPtr += 2;
} }
if( m_Ch == '\n' ) if( m_Ch == '\n' )
@ -398,114 +398,114 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail )
} }
else if( m_Ch != '\r' ) else if( m_Ch != '\r' )
m_pISAXCallback->m_LinePos++; m_pISAXCallback->m_LinePos++;
return S_OK; return S_OK;
} }
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Name: XMLParser::AdvanceElement // Name: XMLParser::AdvanceElement
// Desc: Builds <element> data, calls callback // Desc: Builds <element> data, calls callback
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
HRESULT XMLParser::AdvanceElement() HRESULT XMLParser::AdvanceElement()
{ {
HRESULT hr; HRESULT hr;
// write ptr at the beginning of the buffer // write ptr at the beginning of the buffer
m_pWritePtr = m_pWriteBuf; m_pWritePtr = m_pWriteBuf;
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
// if first character wasn't '<', we wouldn't be here // if first character wasn't '<', we wouldn't be here
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch == '!' ) if( m_Ch == '!' )
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if ( m_Ch == '-' ) if ( m_Ch == '-' )
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != '-' ) if( m_Ch != '-' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '-' after '<!-'" ); Error( E_INVALID_XML_SYNTAX, "Expecting '-' after '<!-'" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = AdvanceComment() ) ) if( FAILED( hr = AdvanceComment() ) )
return hr; return hr;
return S_OK; return S_OK;
} }
if( m_Ch != '[' ) if( m_Ch != '[' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" ); Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != 'C' ) if( m_Ch != 'C' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" ); Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != 'D' ) if( m_Ch != 'D' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" ); Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != 'A' ) if( m_Ch != 'A' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" ); Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != 'T' ) if( m_Ch != 'T' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" ); Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != 'A' ) if( m_Ch != 'A' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" ); Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != '[' ) if( m_Ch != '[' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" ); Error( E_INVALID_XML_SYNTAX, "Expecting '<![CDATA['" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = AdvanceCDATA() ) ) if( FAILED( hr = AdvanceCDATA() ) )
return hr; return hr;
} }
else if( m_Ch == '/' ) else if( m_Ch == '/' )
{ {
WCHAR *pEntityRefVal = m_pWritePtr; WCHAR *pEntityRefVal = m_pWritePtr;
if( FAILED( hr = AdvanceName() ) ) if( FAILED( hr = AdvanceName() ) )
return hr; return hr;
if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal, if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal,
(UINT) ( m_pWritePtr - pEntityRefVal ) ) ) ) (UINT) ( m_pWritePtr - pEntityRefVal ) ) ) )
return E_ABORT; return E_ABORT;
if( FAILED( hr = ConsumeSpace() ) ) if( FAILED( hr = ConsumeSpace() ) )
return hr; return hr;
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != '>' ) if( m_Ch != '>' )
{ {
@ -513,42 +513,42 @@ HRESULT XMLParser::AdvanceElement()
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
} }
else if( m_Ch == '?' ) else if( m_Ch == '?' )
{ {
// just skip any xml header tag since not really important after identifying character set // just skip any xml header tag since not really important after identifying character set
for( ;; ) for( ;; )
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if ( m_Ch == '>' ) if ( m_Ch == '>' )
return S_OK; return S_OK;
} }
} }
else else
{ {
XMLAttribute Attributes[ XML_MAX_ATTRIBUTES_PER_ELEMENT ]; XMLAttribute Attributes[ XML_MAX_ATTRIBUTES_PER_ELEMENT ];
UINT NumAttrs; UINT NumAttrs;
WCHAR *pEntityRefVal = m_pWritePtr; WCHAR *pEntityRefVal = m_pWritePtr;
UINT EntityRefLen; UINT EntityRefLen;
NumAttrs = 0; NumAttrs = 0;
SkipNextAdvance(); SkipNextAdvance();
// Entity tag // Entity tag
if( FAILED( hr = AdvanceName() ) ) if( FAILED( hr = AdvanceName() ) )
return hr; return hr;
EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal ); EntityRefLen = (UINT)( m_pWritePtr - pEntityRefVal );
if( FAILED( hr = ConsumeSpace() ) ) if( FAILED( hr = ConsumeSpace() ) )
return hr; return hr;
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
// read attributes // read attributes
while( ( m_Ch != '>' ) && ( m_Ch != '/' ) ) while( ( m_Ch != '>' ) && ( m_Ch != '/' ) )
{ {
@ -556,31 +556,31 @@ HRESULT XMLParser::AdvanceElement()
if ( NumAttrs >= XML_MAX_ATTRIBUTES_PER_ELEMENT ) if ( NumAttrs >= XML_MAX_ATTRIBUTES_PER_ELEMENT )
{ {
Error( E_INVALID_XML_SYNTAX, "Elements may not have more than %d attributes", XML_MAX_ATTRIBUTES_PER_ELEMENT ); Error( E_INVALID_XML_SYNTAX, "Elements may not have more than %d attributes", XML_MAX_ATTRIBUTES_PER_ELEMENT );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
Attributes[ NumAttrs ].strName = m_pWritePtr; Attributes[ NumAttrs ].strName = m_pWritePtr;
// Attribute name // Attribute name
if( FAILED( hr = AdvanceName() ) ) if( FAILED( hr = AdvanceName() ) )
return hr; return hr;
Attributes[ NumAttrs ].NameLen = (UINT)( m_pWritePtr - Attributes[ NumAttrs ].strName ); Attributes[ NumAttrs ].NameLen = (UINT)( m_pWritePtr - Attributes[ NumAttrs ].strName );
if( FAILED( hr = ConsumeSpace() ) ) if( FAILED( hr = ConsumeSpace() ) )
return hr; return hr;
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != '=' ) if( m_Ch != '=' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '=' character after attribute name" ); Error( E_INVALID_XML_SYNTAX, "Expecting '=' character after attribute name" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( hr = ConsumeSpace() ) ) if( FAILED( hr = ConsumeSpace() ) )
return hr; return hr;
Attributes[ NumAttrs ].strValue = m_pWritePtr; Attributes[ NumAttrs ].strValue = m_pWritePtr;
@ -588,29 +588,29 @@ HRESULT XMLParser::AdvanceElement()
if( FAILED( hr = AdvanceAttrVal() ) ) if( FAILED( hr = AdvanceAttrVal() ) )
return hr; return hr;
Attributes[ NumAttrs ].ValueLen = (UINT)( m_pWritePtr - Attributes[ NumAttrs ].ValueLen = (UINT)( m_pWritePtr -
Attributes[ NumAttrs ].strValue ); Attributes[ NumAttrs ].strValue );
++NumAttrs; ++NumAttrs;
if( FAILED( hr = ConsumeSpace() ) ) if( FAILED( hr = ConsumeSpace() ) )
return hr; return hr;
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
} }
if( m_Ch == '/' ) if( m_Ch == '/' )
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if( m_Ch != '>' ) if( m_Ch != '>' )
{ {
Error( E_INVALID_XML_SYNTAX, "Expecting '>' after '/' in element tag" ); Error( E_INVALID_XML_SYNTAX, "Expecting '>' after '/' in element tag" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
if( FAILED( m_pISAXCallback->ElementBegin( pEntityRefVal, EntityRefLen, if( FAILED( m_pISAXCallback->ElementBegin( pEntityRefVal, EntityRefLen,
Attributes, NumAttrs ) ) ) Attributes, NumAttrs ) ) )
return E_ABORT; return E_ABORT;
@ -619,7 +619,7 @@ HRESULT XMLParser::AdvanceElement()
} }
else else
{ {
if( FAILED( m_pISAXCallback->ElementBegin( pEntityRefVal, EntityRefLen, if( FAILED( m_pISAXCallback->ElementBegin( pEntityRefVal, EntityRefLen,
Attributes, NumAttrs ) ) ) Attributes, NumAttrs ) ) )
return E_ABORT; return E_ABORT;
} }
@ -637,7 +637,7 @@ HRESULT XMLParser::AdvanceCDATA()
{ {
HRESULT hr; HRESULT hr;
WORD wStage = 0; WORD wStage = 0;
if( FAILED( m_pISAXCallback->CDATABegin() ) ) if( FAILED( m_pISAXCallback->CDATABegin() ) )
return E_ABORT; return E_ABORT;
@ -645,10 +645,10 @@ HRESULT XMLParser::AdvanceCDATA()
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
*m_pWritePtr = m_Ch; *m_pWritePtr = m_Ch;
m_pWritePtr++; m_pWritePtr++;
if( ( m_Ch == ']' ) && ( wStage == 0 ) ) if( ( m_Ch == ']' ) && ( wStage == 0 ) )
wStage = 1; wStage = 1;
else if( ( m_Ch == ']' ) && ( wStage == 1 ) ) else if( ( m_Ch == ']' ) && ( wStage == 1 ) )
@ -666,9 +666,9 @@ HRESULT XMLParser::AdvanceCDATA()
if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), TRUE ) ) ) if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), TRUE ) ) )
return E_ABORT; return E_ABORT;
m_pWritePtr = m_pWriteBuf; m_pWritePtr = m_pWriteBuf;
} }
} }
if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) if( FAILED( m_pISAXCallback->CDATAData( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) )
return E_ABORT; return E_ABORT;
@ -676,7 +676,7 @@ HRESULT XMLParser::AdvanceCDATA()
if( FAILED( m_pISAXCallback->CDATAEnd() ) ) if( FAILED( m_pISAXCallback->CDATAEnd() ) )
return E_ABORT; return E_ABORT;
return S_OK; return S_OK;
} }
@ -694,24 +694,24 @@ HRESULT XMLParser::AdvanceComment()
{ {
if( FAILED( hr = AdvanceCharacter() ) ) if( FAILED( hr = AdvanceCharacter() ) )
return hr; return hr;
if (( m_Ch == '-' ) && ( wStage == 0 )) if (( m_Ch == '-' ) && ( wStage == 0 ))
wStage = 1; wStage = 1;
else if (( m_Ch == '-' ) && ( wStage == 1 )) else if (( m_Ch == '-' ) && ( wStage == 1 ))
wStage = 2; wStage = 2;
else if (( m_Ch == '>' ) && ( wStage == 2 )) else if (( m_Ch == '>' ) && ( wStage == 2 ))
break; break;
else else
wStage = 0; wStage = 0;
} }
return S_OK; return S_OK;
} }
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Name: XMLParser::RegisterSAXCallbackInterface // Name: XMLParser::RegisterSAXCallbackInterface
// Desc: Registers callback interface // Desc: Registers callback interface
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
VOID XMLParser::RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback ) VOID XMLParser::RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback )
{ {
@ -721,7 +721,7 @@ VOID XMLParser::RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Name: XMLParser::GetSAXCallbackInterface // Name: XMLParser::GetSAXCallbackInterface
// Desc: Returns current callback interface // Desc: Returns current callback interface
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
ISAXCallback* XMLParser::GetSAXCallbackInterface() ISAXCallback* XMLParser::GetSAXCallbackInterface()
{ {
@ -740,7 +740,7 @@ HRESULT XMLParser::MainParseLoop()
if( FAILED( m_pISAXCallback->StartDocument() ) ) if( FAILED( m_pISAXCallback->StartDocument() ) )
return E_ABORT; return E_ABORT;
m_pWritePtr = m_pWriteBuf; m_pWritePtr = m_pWriteBuf;
FillBuffer(); FillBuffer();
@ -751,57 +751,57 @@ HRESULT XMLParser::MainParseLoop()
m_bReverseBytes = FALSE; m_bReverseBytes = FALSE;
m_pReadPtr += 2; m_pReadPtr += 2;
} }
else if ( *((WCHAR *) m_pReadBuf ) == 0xFFFE ) else if ( *((WCHAR *) m_pReadBuf ) == 0xFFFE )
{ {
m_bUnicode = TRUE; m_bUnicode = TRUE;
m_bReverseBytes = TRUE; m_bReverseBytes = TRUE;
m_pReadPtr += 2; m_pReadPtr += 2;
} }
else if ( *((WCHAR *) m_pReadBuf ) == 0x003C ) else if ( *((WCHAR *) m_pReadBuf ) == 0x003C )
{
m_bUnicode = TRUE;
m_bReverseBytes = FALSE;
}
else if ( *((WCHAR *) m_pReadBuf ) == 0x3C00 )
{ {
m_bUnicode = TRUE; m_bUnicode = TRUE;
m_bReverseBytes = TRUE; m_bReverseBytes = FALSE;
}
else if ( *((WCHAR *) m_pReadBuf ) == 0x3C00 )
{
m_bUnicode = TRUE;
m_bReverseBytes = TRUE;
} }
else if ( m_pReadBuf[ 0 ] == 0x3C ) else if ( m_pReadBuf[ 0 ] == 0x3C )
{ {
m_bUnicode = FALSE; m_bUnicode = FALSE;
m_bReverseBytes = FALSE; m_bReverseBytes = FALSE;
} }
else else
{ {
Error( E_INVALID_XML_SYNTAX, "Unrecognized encoding (parser does not support UTF-8 language encodings)" ); Error( E_INVALID_XML_SYNTAX, "Unrecognized encoding (parser does not support UTF-8 language encodings)" );
return E_INVALID_XML_SYNTAX; return E_INVALID_XML_SYNTAX;
} }
for( ;; ) for( ;; )
{ {
if( FAILED( AdvanceCharacter( TRUE ) ) ) if( FAILED( AdvanceCharacter( TRUE ) ) )
{ {
if ( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) if ( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) )
{ {
if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) )
return E_ABORT; return E_ABORT;
bWhiteSpaceOnly = TRUE; bWhiteSpaceOnly = TRUE;
} }
if( FAILED( m_pISAXCallback->EndDocument() ) ) if( FAILED( m_pISAXCallback->EndDocument() ) )
return E_ABORT; return E_ABORT;
return S_OK; return S_OK;
} }
if( m_Ch == '<' ) if( m_Ch == '<' )
{ {
if( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) ) if( ( (UINT) ( m_pWritePtr - m_pWriteBuf ) != 0 ) && ( !bWhiteSpaceOnly ) )
{ {
if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) ) if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, (UINT)( m_pWritePtr - m_pWriteBuf ), FALSE ) ) )
return E_ABORT; return E_ABORT;
bWhiteSpaceOnly = TRUE; bWhiteSpaceOnly = TRUE;
} }
@ -810,45 +810,45 @@ HRESULT XMLParser::MainParseLoop()
m_pWritePtr = m_pWriteBuf; m_pWritePtr = m_pWriteBuf;
if( FAILED( hr = AdvanceElement() ) ) if( FAILED( hr = AdvanceElement() ) )
return hr; return hr;
m_pWritePtr = m_pWriteBuf; m_pWritePtr = m_pWriteBuf;
} }
else else
{ {
if( m_Ch == '&' ) if( m_Ch == '&' )
{ {
SkipNextAdvance(); SkipNextAdvance();
if( FAILED( hr = ConvertEscape() ) ) if( FAILED( hr = ConvertEscape() ) )
return hr; return hr;
} }
if( bWhiteSpaceOnly && ( m_Ch != ' ' ) && ( m_Ch != '\n' ) && ( m_Ch != '\r' ) && if( bWhiteSpaceOnly && ( m_Ch != ' ' ) && ( m_Ch != '\n' ) && ( m_Ch != '\r' ) &&
( m_Ch != '\t' ) ) ( m_Ch != '\t' ) )
{ {
bWhiteSpaceOnly = FALSE; bWhiteSpaceOnly = FALSE;
} }
*m_pWritePtr = m_Ch; *m_pWritePtr = m_Ch;
m_pWritePtr++; m_pWritePtr++;
if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE ) if( m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE )
{ {
if( !bWhiteSpaceOnly ) if( !bWhiteSpaceOnly )
{ {
if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf, if( FAILED( m_pISAXCallback->ElementContent( m_pWriteBuf,
( UINT ) ( m_pWritePtr - m_pWriteBuf ), ( UINT ) ( m_pWritePtr - m_pWriteBuf ),
TRUE ) ) ) TRUE ) ) )
{ {
return E_ABORT; return E_ABORT;
} }
} }
m_pWritePtr = m_pWriteBuf; m_pWritePtr = m_pWriteBuf;
bWhiteSpaceOnly = TRUE; bWhiteSpaceOnly = TRUE;
} }
} }
} }
} }
@ -858,36 +858,36 @@ HRESULT XMLParser::MainParseLoop()
// Desc: Builds element data // Desc: Builds element data
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename )
{ {
HRESULT hr; HRESULT hr;
if( m_pISAXCallback == NULL ) if( m_pISAXCallback == NULL )
return E_NOINTERFACE; return E_NOINTERFACE;
m_pISAXCallback->m_LineNum = 1; m_pISAXCallback->m_LineNum = 1;
m_pISAXCallback->m_LinePos = 0; m_pISAXCallback->m_LinePos = 0;
m_pISAXCallback->m_strFilename = strFilename; // save this off only while we parse the file m_pISAXCallback->m_strFilename = strFilename; // save this off only while we parse the file
m_bSkipNextAdvance = FALSE; m_bSkipNextAdvance = FALSE;
m_pReadPtr = m_pReadBuf; m_pReadPtr = m_pReadBuf;
m_pReadBuf[ 0 ] = '\0'; m_pReadBuf[ 0 ] = '\0';
m_pReadBuf[ 1 ] = '\0'; m_pReadBuf[ 1 ] = '\0';
m_pInXMLBuffer = NULL; m_pInXMLBuffer = NULL;
m_uInXMLBufferCharsLeft = 0; m_uInXMLBufferCharsLeft = 0;
WCHAR wchFilename[ 64 ]; WCHAR wchFilename[ 64 ];
swprintf_s(wchFilename,64,L"%s",strFilename); swprintf_s(wchFilename,64,L"%s",strFilename);
m_hFile = CreateFile( wchFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL ); m_hFile = CreateFile( wchFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL );
if( m_hFile == INVALID_HANDLE_VALUE ) if( m_hFile == INVALID_HANDLE_VALUE )
{ {
Error( E_COULD_NOT_OPEN_FILE, "Error opening file" ); Error( E_COULD_NOT_OPEN_FILE, "Error opening file" );
hr = E_COULD_NOT_OPEN_FILE; hr = E_COULD_NOT_OPEN_FILE;
} }
else else
{ {
@ -897,14 +897,14 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename )
m_dwCharsConsumed = 0; m_dwCharsConsumed = 0;
hr = MainParseLoop(); hr = MainParseLoop();
} }
// Close the file // Close the file
if( m_hFile != INVALID_HANDLE_VALUE ) if( m_hFile != INVALID_HANDLE_VALUE )
CloseHandle( m_hFile ); CloseHandle( m_hFile );
m_hFile = INVALID_HANDLE_VALUE; m_hFile = INVALID_HANDLE_VALUE;
// we no longer own strFilename, so un-set it // we no longer own strFilename, so un-set it
m_pISAXCallback->m_strFilename = NULL; m_pISAXCallback->m_strFilename = NULL;
return hr; return hr;
} }
@ -914,38 +914,38 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename )
// Desc: Builds element data // Desc: Builds element data
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize )
{ {
HRESULT hr; HRESULT hr;
if( m_pISAXCallback == NULL ) if( m_pISAXCallback == NULL )
return E_NOINTERFACE; return E_NOINTERFACE;
m_pISAXCallback->m_LineNum = 1; m_pISAXCallback->m_LineNum = 1;
m_pISAXCallback->m_LinePos = 0; m_pISAXCallback->m_LinePos = 0;
m_pISAXCallback->m_strFilename = ""; // save this off only while we parse the file m_pISAXCallback->m_strFilename = ""; // save this off only while we parse the file
m_bSkipNextAdvance = FALSE; m_bSkipNextAdvance = FALSE;
m_pReadPtr = m_pReadBuf; m_pReadPtr = m_pReadBuf;
m_pReadBuf[ 0 ] = '\0'; m_pReadBuf[ 0 ] = '\0';
m_pReadBuf[ 1 ] = '\0'; m_pReadBuf[ 1 ] = '\0';
m_hFile = NULL; m_hFile = NULL;
m_pInXMLBuffer = strBuffer; m_pInXMLBuffer = strBuffer;
m_uInXMLBufferCharsLeft = uBufferSize; m_uInXMLBufferCharsLeft = uBufferSize;
m_dwCharsTotal = uBufferSize; m_dwCharsTotal = uBufferSize;
m_dwCharsConsumed = 0; m_dwCharsConsumed = 0;
hr = MainParseLoop(); hr = MainParseLoop();
// we no longer own strFilename, so un-set it // we no longer own strFilename, so un-set it
m_pISAXCallback->m_strFilename = NULL; m_pISAXCallback->m_strFilename = NULL;
return hr; return hr;
} }
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// XMLParser::Error() // XMLParser::Error()
// Logs an error through the callback interface // Logs an error through the callback interface
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
#ifdef _Printf_format_string_ // VC++ 2008 and later support this annotation #ifdef _Printf_format_string_ // VC++ 2008 and later support this annotation
@ -960,7 +960,7 @@ VOID XMLParser::Error( HRESULT hErr, CONST CHAR* strFormat, ... )
va_start( pArglist, strFormat ); va_start( pArglist, strFormat );
vsprintf( strBuffer, strFormat, pArglist ); vsprintf( strBuffer, strFormat, pArglist );
m_pISAXCallback->Error( hErr, strBuffer ); m_pISAXCallback->Error( hErr, strBuffer );
va_end( pArglist ); va_end( pArglist );
} }

View file

@ -1350,7 +1350,7 @@ void GameRenderer::DisableUpdateThread()
#endif #endif
} }
void GameRenderer::renderLevel(float a, __int64 until) void GameRenderer::renderLevel(float a, int64_t until)
{ {
// if (updateLightTexture) updateLightTexture(); // 4J - TODO - Java 1.0.1 has this line enabled, should check why - don't want to put it in now in case it breaks split-screen // if (updateLightTexture) updateLightTexture(); // 4J - TODO - Java 1.0.1 has this line enabled, should check why - don't want to put it in now in case it breaks split-screen
@ -1433,7 +1433,7 @@ void GameRenderer::renderLevel(float a, __int64 until)
if (until == 0) break; if (until == 0) break;
__int64 diff = until - System::nanoTime(); int64_t diff = until - System::nanoTime();
if (diff < 0) break; if (diff < 0) break;
if (diff > 1000000000) break; if (diff > 1000000000) break;
} while (true); } while (true);

View file

@ -115,8 +115,8 @@ public:
void setupCamera(float a, int eye); void setupCamera(float a, int eye);
private: private:
void renderItemInHand(float a, int eye); void renderItemInHand(float a, int eye);
__int64 lastActiveTime; int64_t lastActiveTime;
__int64 lastNsTime; int64_t lastNsTime;
// 4J - changes brought forward from 1.8.2 // 4J - changes brought forward from 1.8.2
bool _updateLightTexture; bool _updateLightTexture;
public: public:
@ -133,7 +133,7 @@ private:
public: public:
void render(float a, bool bFirst); // 4J added bFirst void render(float a, bool bFirst); // 4J added bFirst
void renderLevel(float a); void renderLevel(float a);
void renderLevel(float a, __int64 until); void renderLevel(float a, int64_t until);
private: private:
Random *random; Random *random;
int rainSoundTime; int rainSoundTime;

View file

@ -1448,7 +1448,7 @@ void Gui::displayClientMessage(int messageId, int iPad)
} }
// 4J Added // 4J Added
void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataAScale, int dataAWarning, __int64 *dataB, float dataBScale, int dataBWarning) void Gui::renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataAScale, int dataAWarning, int64_t *dataB, float dataBScale, int dataBWarning)
{ {
int height = minecraft->height; int height = minecraft->height;
// This causes us to cover xScale*dataLength pixels in the horizontal // This causes us to cover xScale*dataLength pixels in the horizontal
@ -1487,7 +1487,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc
t->color(0xff000000 + cc * 256); t->color(0xff000000 + cc * 256);
} }
__int64 aVal = dataA[i] / dataAScale; int64_t aVal = dataA[i] / dataAScale;
t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), (float)( 0)); t->vertex((float)(xScale*i + 0.5f), (float)( height - aVal + 0.5f), (float)( 0));
t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), (float)( 0)); t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), (float)( 0));
@ -1504,7 +1504,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc
t->color(0xff808080 + cc/2 * 256); t->color(0xff808080 + cc/2 * 256);
} }
__int64 bVal = dataB[i] / dataBScale; int64_t bVal = dataB[i] / dataBScale;
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height - bVal + 0.5f), (float)( 0)); t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height - bVal + 0.5f), (float)( 0));
t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 0.5f), (float)( 0)); t->vertex((float)(xScale*i + (xScale - 1) + 0.5f), (float)( height + 0.5f), (float)( 0));
@ -1515,7 +1515,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, __int64 (*func)(unsigned int dataPos, unsigned int dataSource) ) void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, int64_t (*func)(unsigned int dataPos, unsigned int dataSource) )
{ {
int height = minecraft->height; int height = minecraft->height;
@ -1532,8 +1532,8 @@ void Gui::renderStackedGraph(int dataPos, int dataLength, int dataSources, __int
Tesselator *t = Tesselator::getInstance(); Tesselator *t = Tesselator::getInstance();
t->begin(GL_LINES); t->begin(GL_LINES);
__int64 thisVal = 0; int64_t thisVal = 0;
__int64 topVal = 0; int64_t topVal = 0;
for (int i = 0; i < dataLength; i++) for (int i = 0; i < dataLength; i++)
{ {
thisVal = 0; thisVal = 0;

View file

@ -67,6 +67,6 @@ public:
float getJukeboxOpacity(int iPad); float getJukeboxOpacity(int iPad);
// 4J Added // 4J Added
void renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataAScale, int dataAWarning, __int64 *dataB, float dataBScale, int dataBWarning); void renderGraph(int dataLength, int dataPos, int64_t *dataA, float dataAScale, int dataAWarning, int64_t *dataB, float dataBScale, int dataBWarning);
void renderStackedGraph(int dataPos, int dataLength, int dataSources, __int64 (*func)(unsigned int dataPos, unsigned int dataSource) ); void renderStackedGraph(int dataPos, int dataLength, int dataSources, int64_t (*func)(unsigned int dataPos, unsigned int dataSource) );
}; };

View file

@ -2076,9 +2076,9 @@ bool LevelRenderer::updateDirtyChunks()
if( bAtomic || (index == 0) ) if( bAtomic || (index == 0) )
{ {
//PIXBeginNamedEvent(0,"Rebuilding near chunk %d %d %d",chunk->x, chunk->y, chunk->z); //PIXBeginNamedEvent(0,"Rebuilding near chunk %d %d %d",chunk->x, chunk->y, chunk->z);
// static __int64 totalTime = 0; // static int64_t totalTime = 0;
// static __int64 countTime = 0; // static int64_t countTime = 0;
// __int64 startTime = System::currentTimeMillis(); // int64_t startTime = System::currentTimeMillis();
//app.DebugPrintf("Rebuilding permaChunk %d\n", index); //app.DebugPrintf("Rebuilding permaChunk %d\n", index);
@ -2087,7 +2087,7 @@ bool LevelRenderer::updateDirtyChunks()
if(index !=0) if(index !=0)
s_rebuildCompleteEvents->Set(index-1); // MGH - this rebuild happening on the main thread instead, mark the thread it should have been running on as complete s_rebuildCompleteEvents->Set(index-1); // MGH - this rebuild happening on the main thread instead, mark the thread it should have been running on as complete
// __int64 endTime = System::currentTimeMillis(); // int64_t endTime = System::currentTimeMillis();
// totalTime += (endTime - startTime); // totalTime += (endTime - startTime);
// countTime++; // countTime++;
// printf("%d : %f\n", countTime, (float)totalTime / (float)countTime); // printf("%d : %f\n", countTime, (float)totalTime / (float)countTime);
@ -2126,11 +2126,11 @@ bool LevelRenderer::updateDirtyChunks()
static Chunk permaChunk; static Chunk permaChunk;
permaChunk.makeCopyForRebuild(chunk); permaChunk.makeCopyForRebuild(chunk);
LeaveCriticalSection(&m_csDirtyChunks); LeaveCriticalSection(&m_csDirtyChunks);
// static __int64 totalTime = 0; // static int64_t totalTime = 0;
// static __int64 countTime = 0; // static int64_t countTime = 0;
// __int64 startTime = System::currentTimeMillis(); // int64_t startTime = System::currentTimeMillis();
permaChunk.rebuild(); permaChunk.rebuild();
// __int64 endTime = System::currentTimeMillis(); // int64_t endTime = System::currentTimeMillis();
// totalTime += (endTime - startTime); // totalTime += (endTime - startTime);
// countTime++; // countTime++;
// printf("%d : %f\n", countTime, (float)totalTime / (float)countTime); // printf("%d : %f\n", countTime, (float)totalTime / (float)countTime);

View file

@ -27,7 +27,7 @@ using namespace std;
// AP - this is a system that works out which chunks actually need to be grouped together via the deferral system when doing chunk::rebuild. Doing this will reduce the number // AP - this is a system that works out which chunks actually need to be grouped together via the deferral system when doing chunk::rebuild. Doing this will reduce the number
// of chunks built in a single group and reduce the chance of seeing through the landscape when digging near the edges/corners of a chunk. // of chunks built in a single group and reduce the chance of seeing through the landscape when digging near the edges/corners of a chunk.
// I've added another chunk flag to mark a chunk critical so it swipes a bit from the reference count value (goes to 3 bits to 2). This works on Vita because it doesn't have // I've added another chunk flag to mark a chunk critical so it swipes a bit from the reference count value (goes to 3 bits to 2). This works on Vita because it doesn't have
// split screen reference counting. // split screen reference counting.
#ifdef __PSVITA__ #ifdef __PSVITA__
#define _CRITICAL_CHUNKS #define _CRITICAL_CHUNKS
@ -61,7 +61,7 @@ public:
#elif defined __PS3__ #elif defined __PS3__
static const int MAX_COMMANDBUFFER_ALLOCATIONS = 110 * 1024 * 1024; // 4J - added static const int MAX_COMMANDBUFFER_ALLOCATIONS = 110 * 1024 * 1024; // 4J - added
#else #else
static const int MAX_COMMANDBUFFER_ALLOCATIONS = 55 * 1024 * 1024; // 4J - added static const int MAX_COMMANDBUFFER_ALLOCATIONS = 55 * 1024 * 1024; // 4J - added
#endif #endif
public: public:
LevelRenderer(Minecraft *mc, Textures *textures); LevelRenderer(Minecraft *mc, Textures *textures);
@ -216,7 +216,7 @@ public:
// 4J - added for new render list handling // 4J - added for new render list handling
// This defines the maximum size of renderable level, must be big enough to cope with actual size of level + view distance at each side // This defines the maximum size of renderable level, must be big enough to cope with actual size of level + view distance at each side
// so that we can render the "infinite" sea at the edges // so that we can render the "infinite" sea at the edges
static const int MAX_LEVEL_RENDER_SIZE[3]; static const int MAX_LEVEL_RENDER_SIZE[3];
static const int DIMENSION_OFFSETS[3]; static const int DIMENSION_OFFSETS[3];
// This is the TOTAL area of columns of chunks to be allocated for render round the players. So for one player, it would be a region of // This is the TOTAL area of columns of chunks to be allocated for render round the players. So for one player, it would be a region of
// sqrt(PLAYER_RENDER_AREA) x sqrt(PLAYER_RENDER_AREA) // sqrt(PLAYER_RENDER_AREA) x sqrt(PLAYER_RENDER_AREA)
@ -271,7 +271,7 @@ public:
XLockFreeStack<int> dirtyChunksLockFreeStack; XLockFreeStack<int> dirtyChunksLockFreeStack;
bool dirtyChunkPresent; bool dirtyChunkPresent;
__int64 lastDirtyChunkFound; int64_t lastDirtyChunkFound;
static const int FORCE_DIRTY_CHUNK_CHECK_PERIOD_MS = 125; // decreased from 250 to 125 - updated by detectiveren static const int FORCE_DIRTY_CHUNK_CHECK_PERIOD_MS = 125; // decreased from 250 to 125 - updated by detectiveren
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS

View file

@ -52,12 +52,12 @@ public:
virtual ~LocalPlayer(); virtual ~LocalPlayer();
int m_iScreenSection; // assuming 4player splitscreen for now, or -1 for single player int m_iScreenSection; // assuming 4player splitscreen for now, or -1 for single player
__uint64 ullButtonsPressed; // Stores the button presses, since the inputmanager can be ticked faster than the minecraft uint64_t ullButtonsPressed; // Stores the button presses, since the inputmanager can be ticked faster than the minecraft
// player tick, and a button press and release combo can be missed in the minecraft::tick // player tick, and a button press and release combo can be missed in the minecraft::tick
__uint64 ullDpad_last; uint64_t ullDpad_last;
__uint64 ullDpad_this; uint64_t ullDpad_this;
__uint64 ullDpad_filtered; uint64_t ullDpad_filtered;
// 4J-PB - moved these in from the minecraft structure, since they are per player things for splitscreen // 4J-PB - moved these in from the minecraft structure, since they are per player things for splitscreen
//int ticks; //int ticks;
@ -105,7 +105,7 @@ public:
virtual void readAdditionalSaveData(CompoundTag *entityTag); virtual void readAdditionalSaveData(CompoundTag *entityTag);
virtual void closeContainer(); virtual void closeContainer();
virtual void openTextEdit(shared_ptr<TileEntity> sign); virtual void openTextEdit(shared_ptr<TileEntity> sign);
virtual bool openContainer(shared_ptr<Container> container); // 4J added bool return virtual bool openContainer(shared_ptr<Container> container); // 4J added bool return
virtual bool openHopper(shared_ptr<HopperTileEntity> container); // 4J added bool return virtual bool openHopper(shared_ptr<HopperTileEntity> container); // 4J added bool return
virtual bool openHopper(shared_ptr<MinecartHopper> container); // 4J added bool return virtual bool openHopper(shared_ptr<MinecartHopper> container); // 4J added bool return
virtual bool openHorseInventory(shared_ptr<EntityHorse> horse, shared_ptr<Container> container); // 4J added bool return virtual bool openHorseInventory(shared_ptr<EntityHorse> horse, shared_ptr<Container> container); // 4J added bool return

View file

@ -23,7 +23,7 @@ void MinecartRenderer::render(shared_ptr<Entity> _cart, double x, double y, doub
bindTexture(cart); bindTexture(cart);
__int64 seed = cart->entityId * 493286711l; int64_t seed = cart->entityId * 493286711l;
seed = seed * seed * 4392167121l + seed * 98761; seed = seed * seed * 4392167121l + seed * 98761;
float xo = ((((seed >> 16) & 0x7) + 0.5f) / 8.0f - 0.5f) * 0.004f; float xo = ((((seed >> 16) & 0x7) + 0.5f) / 8.0f - 0.5f) * 0.004f;

View file

@ -85,10 +85,10 @@
#define DISABLE_LEVELTICK_THREAD #define DISABLE_LEVELTICK_THREAD
Minecraft *Minecraft::m_instance = NULL; Minecraft *Minecraft::m_instance = NULL;
__int64 Minecraft::frameTimes[512]; int64_t Minecraft::frameTimes[512];
__int64 Minecraft::tickTimes[512]; int64_t Minecraft::tickTimes[512];
int Minecraft::frameTimePos = 0; int Minecraft::frameTimePos = 0;
__int64 Minecraft::warezTime = 0; int64_t Minecraft::warezTime = 0;
File Minecraft::workDir = File(L""); File Minecraft::workDir = File(L"");
#ifdef __PSVITA__ #ifdef __PSVITA__
@ -635,7 +635,7 @@ void Minecraft::run()
return; return;
} }
__int64 lastTime = System::currentTimeMillis(); int64_t lastTime = System::currentTimeMillis();
int frames = 0; int frames = 0;
while (running) while (running)
@ -660,7 +660,7 @@ void Minecraft::run()
timer->advanceTime(); timer->advanceTime();
} }
__int64 beforeTickTime = System::nanoTime(); int64_t beforeTickTime = System::nanoTime();
for (int i = 0; i < timer->ticks; i++) for (int i = 0; i < timer->ticks; i++)
{ {
ticks++; ticks++;
@ -672,7 +672,7 @@ void Minecraft::run()
// setScreen(new LevelConflictScreen()); // setScreen(new LevelConflictScreen());
// } // }
} }
__int64 tickDuraction = System::nanoTime() - beforeTickTime; int64_t tickDuraction = System::nanoTime() - beforeTickTime;
checkGlError(L"Pre render"); checkGlError(L"Pre render");
TileRenderer::fancy = options->fancyGraphics; TileRenderer::fancy = options->fancyGraphics;
@ -1240,7 +1240,7 @@ void Minecraft::applyFrameMouseLook()
void Minecraft::run_middle() void Minecraft::run_middle()
{ {
static __int64 lastTime = 0; static int64_t lastTime = 0;
static bool bFirstTimeIntoGame = true; static bool bFirstTimeIntoGame = true;
static bool bAutosaveTimerSet=false; static bool bAutosaveTimerSet=false;
static unsigned int uiAutosaveTimer=0; static unsigned int uiAutosaveTimer=0;
@ -1804,7 +1804,7 @@ void Minecraft::run_middle()
timer->advanceTime(); timer->advanceTime();
} }
//__int64 beforeTickTime = System::nanoTime(); //int64_t beforeTickTime = System::nanoTime();
for (int i = 0; i < timer->ticks; i++) for (int i = 0; i < timer->ticks; i++)
{ {
bool bLastTimerTick = ( i == ( timer->ticks - 1 ) ); bool bLastTimerTick = ( i == ( timer->ticks - 1 ) );
@ -1890,7 +1890,7 @@ void Minecraft::run_middle()
// CompressedTileStorage::tick(); // 4J added // CompressedTileStorage::tick(); // 4J added
// SparseDataStorage::tick(); // 4J added // SparseDataStorage::tick(); // 4J added
} }
//__int64 tickDuraction = System::nanoTime() - beforeTickTime; //int64_t tickDuraction = System::nanoTime() - beforeTickTime;
MemSect(31); MemSect(31);
checkGlError(L"Pre render"); checkGlError(L"Pre render");
MemSect(0); MemSect(0);
@ -2095,14 +2095,14 @@ void Minecraft::emergencySave()
setLevel(NULL); setLevel(NULL);
} }
void Minecraft::renderFpsMeter(__int64 tickTime) void Minecraft::renderFpsMeter(int64_t tickTime)
{ {
int nsPer60Fps = 1000000000l / 60; int nsPer60Fps = 1000000000l / 60;
if (lastTimer == -1) if (lastTimer == -1)
{ {
lastTimer = System::nanoTime(); lastTimer = System::nanoTime();
} }
__int64 now = System::nanoTime(); int64_t now = System::nanoTime();
Minecraft::tickTimes[(Minecraft::frameTimePos) & (Minecraft::frameTimes_length - 1)] = tickTime; Minecraft::tickTimes[(Minecraft::frameTimePos) & (Minecraft::frameTimes_length - 1)] = tickTime;
Minecraft::frameTimes[(Minecraft::frameTimePos++) & (Minecraft::frameTimes_length - 1)] = now - lastTimer; Minecraft::frameTimes[(Minecraft::frameTimePos++) & (Minecraft::frameTimes_length - 1)] = now - lastTimer;
lastTimer = now; lastTimer = now;
@ -2134,7 +2134,7 @@ void Minecraft::renderFpsMeter(__int64 tickTime)
t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1 * 2), (float)( 0)); t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1 * 2), (float)( 0));
t->end(); t->end();
__int64 totalTime = 0; int64_t totalTime = 0;
for (int i = 0; i < Minecraft::frameTimes_length; i++) for (int i = 0; i < Minecraft::frameTimes_length; i++)
{ {
totalTime += Minecraft::frameTimes[i]; totalTime += Minecraft::frameTimes[i];
@ -2164,8 +2164,8 @@ void Minecraft::renderFpsMeter(__int64 tickTime)
t->color(0xff000000 + cc * 256); t->color(0xff000000 + cc * 256);
} }
__int64 time = Minecraft::frameTimes[i] / 200000; int64_t time = Minecraft::frameTimes[i] / 200000;
__int64 time2 = Minecraft::tickTimes[i] / 200000; int64_t time2 = Minecraft::tickTimes[i] / 200000;
t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), (float)( 0)); t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), (float)( 0));
t->vertex((float)(i + 0.5f), (float)( height + 0.5f), (float)( 0)); t->vertex((float)(i + 0.5f), (float)( height + 0.5f), (float)( 0));
@ -3759,7 +3759,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
player->drop(); player->drop();
} }
__uint64 ullButtonsPressed=player->ullButtonsPressed; uint64_t ullButtonsPressed=player->ullButtonsPressed;
bool selected = false; bool selected = false;
#ifdef __PSVITA__ #ifdef __PSVITA__
@ -4314,7 +4314,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
} }
#endif #endif
#ifdef _WINDOWS64 #ifdef _WINDOWS64
// On Windows, the implementation has been changed to use a per-client pseudo XUID based on `uid.dat`. // On Windows, the implementation has been changed to use a per-client pseudo XUID based on `uid.dat`.
// To maintain player data compatibility with existing worlds, the world host (the first player) will use the previous embedded pseudo XUID. // To maintain player data compatibility with existing worlds, the world host (the first player) will use the previous embedded pseudo XUID.
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPrimaryPlayer); INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPrimaryPlayer);
if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost()) if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
@ -4815,7 +4815,7 @@ void Minecraft::delayTextureReload()
reloadTextures = true; reloadTextures = true;
} }
__int64 Minecraft::currentTimeMillis() int64_t Minecraft::currentTimeMillis()
{ {
return System::currentTimeMillis();//(Sys.getTime() * 1000) / Sys.getTimerResolution(); return System::currentTimeMillis();//(Sys.getTime() * 1000) / Sys.getTimerResolution();
} }

View file

@ -75,7 +75,7 @@ private:
bool hasCrashed; bool hasCrashed;
C4JThread::EventQueue* levelTickEventQueue; C4JThread::EventQueue* levelTickEventQueue;
static void levelTickUpdateFunc(void* pParam); static void levelTickUpdateFunc(void* pParam);
static void levelTickThreadInitFunc(); static void levelTickThreadInitFunc();
@ -170,11 +170,11 @@ private:
LevelStorageSource *levelSource; LevelStorageSource *levelSource;
public: public:
static const int frameTimes_length = 512; static const int frameTimes_length = 512;
static __int64 frameTimes[frameTimes_length]; static int64_t frameTimes[frameTimes_length];
static const int tickTimes_length = 512; static const int tickTimes_length = 512;
static __int64 tickTimes[tickTimes_length]; static int64_t tickTimes[tickTimes_length];
static int frameTimePos; static int frameTimePos;
static __int64 warezTime; static int64_t warezTime;
private: private:
int rightClickDelay; int rightClickDelay;
public: public:
@ -230,9 +230,9 @@ private:
// String grabHugeScreenshot(File workDir2, int width, int height, int ssWidth, int ssHeight); // 4J - removed // String grabHugeScreenshot(File workDir2, int width, int height, int ssWidth, int ssHeight); // 4J - removed
// 4J - per player thing? // 4J - per player thing?
__int64 lastTimer; int64_t lastTimer;
void renderFpsMeter(__int64 tickTime); void renderFpsMeter(int64_t tickTime);
public: public:
void stop(); void stop();
// 4J removed // 4J removed
@ -253,7 +253,7 @@ public:
//bool isRaining ; //bool isRaining ;
// 4J - Moved to per player // 4J - Moved to per player
//__int64 lastTickTime; //int64_t lastTickTime;
private: private:
// 4J- per player? // 4J- per player?
@ -300,7 +300,7 @@ public:
static int maxSupportedTextureSize(); static int maxSupportedTextureSize();
void delayTextureReload(); void delayTextureReload();
static __int64 currentTimeMillis(); static int64_t currentTimeMillis();
#ifdef _DURANGO #ifdef _DURANGO
static void inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad); static void inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad);

View file

@ -68,15 +68,15 @@
//4J Added //4J Added
MinecraftServer *MinecraftServer::server = NULL; MinecraftServer *MinecraftServer::server = NULL;
bool MinecraftServer::setTimeAtEndOfTick = false; bool MinecraftServer::setTimeAtEndOfTick = false;
__int64 MinecraftServer::setTime = 0; int64_t MinecraftServer::setTime = 0;
bool MinecraftServer::setTimeOfDayAtEndOfTick = false; bool MinecraftServer::setTimeOfDayAtEndOfTick = false;
__int64 MinecraftServer::setTimeOfDay = 0; int64_t MinecraftServer::setTimeOfDay = 0;
bool MinecraftServer::m_bPrimaryPlayerSignedOut=false; bool MinecraftServer::m_bPrimaryPlayerSignedOut=false;
bool MinecraftServer::s_bServerHalted=false; bool MinecraftServer::s_bServerHalted=false;
bool MinecraftServer::s_bSaveOnExitAnswered=false; bool MinecraftServer::s_bSaveOnExitAnswered=false;
#ifdef _ACK_CHUNK_SEND_THROTTLING #ifdef _ACK_CHUNK_SEND_THROTTLING
bool MinecraftServer::s_hasSentEnoughPackets = false; bool MinecraftServer::s_hasSentEnoughPackets = false;
__int64 MinecraftServer::s_tickStartTime = 0; int64_t MinecraftServer::s_tickStartTime = 0;
vector<INetworkPlayer *> MinecraftServer::s_sentTo; vector<INetworkPlayer *> MinecraftServer::s_sentTo;
#else #else
int MinecraftServer::s_slowQueuePlayerIndex = 0; int MinecraftServer::s_slowQueuePlayerIndex = 0;
@ -581,7 +581,7 @@ MinecraftServer::~MinecraftServer()
DeleteCriticalSection(&m_consoleInputCS); DeleteCriticalSection(&m_consoleInputCS);
} }
bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed) bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed)
{ {
// 4J - removed // 4J - removed
#if 0 #if 0
@ -692,7 +692,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
// TODO: Stop loading, add error message. // TODO: Stop loading, add error message.
} }
__int64 levelNanoTime = System::nanoTime(); int64_t levelNanoTime = System::nanoTime();
wstring levelName = (initData && !initData->levelName.empty()) ? initData->levelName : GetDedicatedServerString(settings, L"level-name", L"world"); wstring levelName = (initData && !initData->levelName.empty()) ? initData->levelName : GetDedicatedServerString(settings, L"level-name", L"world");
wstring levelTypeString; wstring levelTypeString;
@ -736,10 +736,10 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
#if 0 #if 0
wstring levelSeedString = settings->getString(L"level-seed", L""); wstring levelSeedString = settings->getString(L"level-seed", L"");
__int64 levelSeed = (new Random())->nextLong(); int64_t levelSeed = (new Random())->nextLong();
if (levelSeedString.length() > 0) if (levelSeedString.length() > 0)
{ {
long newSeed = _fromString<__int64>(levelSeedString); long newSeed = _fromString<int64_t>(levelSeedString);
if (newSeed != 0) { if (newSeed != 0) {
levelSeed = newSeed; levelSeed = newSeed;
} }
@ -866,7 +866,7 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress)
DeleteCriticalSection(&m_postProcessCS); DeleteCriticalSection(&m_postProcessCS);
} }
bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData) bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring& name, int64_t levelSeed, LevelType *pLevelType, NetworkGameInitData *initData)
{ {
// 4J - TODO - do with new save stuff // 4J - TODO - do with new save stuff
// if (storageSource->requiresConversion(name)) // if (storageSource->requiresConversion(name))
@ -1016,7 +1016,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
m_postUpdateThread->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL); m_postUpdateThread->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL);
m_postUpdateThread->Run(); m_postUpdateThread->Run();
__int64 startTime = System::currentTimeMillis(); int64_t startTime = System::currentTimeMillis();
// 4J Stu - Added this to temporarily make starting games on vita faster // 4J Stu - Added this to temporarily make starting games on vita faster
#ifdef __PSVITA__ #ifdef __PSVITA__
@ -1046,7 +1046,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
csf->closeHandle(fe); csf->closeHandle(fe);
} }
__int64 lastTime = System::currentTimeMillis(); int64_t lastTime = System::currentTimeMillis();
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
if(app.GetGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) if(app.GetGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld())
{ {
@ -1074,7 +1074,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
} }
#if 0 #if 0
__int64 lastStorageTickTime = System::currentTimeMillis(); int64_t lastStorageTickTime = System::currentTimeMillis();
// Test code to enable full creation of levels at start up // Test code to enable full creation of levels at start up
int halfsidelen = ( i == 0 ) ? 27 : 9; int halfsidelen = ( i == 0 ) ? 27 : 9;
@ -1097,7 +1097,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
} }
} }
#else #else
__int64 lastStorageTickTime = System::currentTimeMillis(); int64_t lastStorageTickTime = System::currentTimeMillis();
Pos *spawnPos = level->getSharedSpawnPos(); Pos *spawnPos = level->getSharedSpawnPos();
int twoRPlusOne = r*2 + 1; int twoRPlusOne = r*2 + 1;
@ -1114,7 +1114,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
return false; return false;
} }
// printf(">>>%d %d %d\n",i,x,z); // printf(">>>%d %d %d\n",i,x,z);
// __int64 now = System::currentTimeMillis(); // int64_t now = System::currentTimeMillis();
// if (now < lastTime) lastTime = now; // if (now < lastTime) lastTime = now;
// if (now > lastTime + 1000) // if (now > lastTime + 1000)
{ {
@ -1679,7 +1679,7 @@ bool MinecraftServer::getForceGameType()
return forceGameType; return forceGameType;
} }
__int64 MinecraftServer::getCurrentTimeMillis() int64_t MinecraftServer::getCurrentTimeMillis()
{ {
return System::currentTimeMillis(); return System::currentTimeMillis();
} }
@ -1695,7 +1695,7 @@ void MinecraftServer::setPlayerIdleTimeout(int playerIdleTimeout)
} }
extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b; extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b;
void MinecraftServer::run(__int64 seed, void *lpParameter) void MinecraftServer::run(int64_t seed, void *lpParameter)
{ {
NetworkGameInitData *initData = NULL; NetworkGameInitData *initData = NULL;
DWORD initSettings = 0; DWORD initSettings = 0;
@ -1728,18 +1728,18 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
} }
} }
__int64 lastTime = getCurrentTimeMillis(); int64_t lastTime = getCurrentTimeMillis();
__int64 unprocessedTime = 0; int64_t unprocessedTime = 0;
while (running && !s_bServerHalted) while (running && !s_bServerHalted)
{ {
__int64 now = getCurrentTimeMillis(); int64_t now = getCurrentTimeMillis();
// 4J Stu - When we pause the server, we don't want to count that as time passed // 4J Stu - When we pause the server, we don't want to count that as time passed
// 4J Stu - TU-1 hotifx - Remove this line. We want to make sure that we tick connections at the proper rate when paused // 4J Stu - TU-1 hotifx - Remove this line. We want to make sure that we tick connections at the proper rate when paused
//Fix for #13191 - The host of a game can get a message informing them that the connection to the server has been lost //Fix for #13191 - The host of a game can get a message informing them that the connection to the server has been lost
//if(m_isServerPaused) lastTime = now; //if(m_isServerPaused) lastTime = now;
__int64 passedTime = now - lastTime; int64_t passedTime = now - lastTime;
if (passedTime > MS_PER_TICK * 40) if (passedTime > MS_PER_TICK * 40)
{ {
// logger.warning("Can't keep up! Did the system time change, or is the server overloaded?"); // logger.warning("Can't keep up! Did the system time change, or is the server overloaded?");
@ -1765,19 +1765,19 @@ void MinecraftServer::run(__int64 seed, void *lpParameter)
else else
{ {
// int tickcount = 0; // int tickcount = 0;
// __int64 beforeall = System::currentTimeMillis(); // int64_t beforeall = System::currentTimeMillis();
while (unprocessedTime > MS_PER_TICK) while (unprocessedTime > MS_PER_TICK)
{ {
unprocessedTime -= MS_PER_TICK; unprocessedTime -= MS_PER_TICK;
chunkPacketManagement_PreTick(); chunkPacketManagement_PreTick();
// __int64 before = System::currentTimeMillis(); // int64_t before = System::currentTimeMillis();
tick(); tick();
// __int64 after = System::currentTimeMillis(); // int64_t after = System::currentTimeMillis();
// PIXReportCounter(L"Server time",(float)(after-before)); // PIXReportCounter(L"Server time",(float)(after-before));
chunkPacketManagement_PostTick(); chunkPacketManagement_PostTick();
} }
// __int64 afterall = System::currentTimeMillis(); // int64_t afterall = System::currentTimeMillis();
// PIXReportCounter(L"Server time all",(float)(afterall-beforeall)); // PIXReportCounter(L"Server time all",(float)(afterall-beforeall));
// PIXReportCounter(L"Server ticks",(float)tickcount); // PIXReportCounter(L"Server ticks",(float)tickcount);
} }
@ -2119,15 +2119,15 @@ void MinecraftServer::tick()
players->broadcastAll( shared_ptr<SetTimePacket>( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT) ) ), level->dimension->id); players->broadcastAll( shared_ptr<SetTimePacket>( new SetTimePacket(level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT) ) ), level->dimension->id);
} }
// #ifndef __PS3__ // #ifndef __PS3__
static __int64 stc = 0; static int64_t stc = 0;
__int64 st0 = System::currentTimeMillis(); int64_t st0 = System::currentTimeMillis();
PIXBeginNamedEvent(0,"Level tick %d",i); PIXBeginNamedEvent(0,"Level tick %d",i);
((Level *)level)->tick(); ((Level *)level)->tick();
__int64 st1 = System::currentTimeMillis(); int64_t st1 = System::currentTimeMillis();
PIXEndNamedEvent(); PIXEndNamedEvent();
PIXBeginNamedEvent(0,"Update lights %d",i); PIXBeginNamedEvent(0,"Update lights %d",i);
__int64 st2 = System::currentTimeMillis(); int64_t st2 = System::currentTimeMillis();
PIXEndNamedEvent(); PIXEndNamedEvent();
PIXBeginNamedEvent(0,"Entity tick %d",i); PIXBeginNamedEvent(0,"Entity tick %d",i);
// 4J added to stop ticking entities in levels when players are not in those levels. // 4J added to stop ticking entities in levels when players are not in those levels.
@ -2155,7 +2155,7 @@ void MinecraftServer::tick()
level->getTracker()->tick(); level->getTracker()->tick();
PIXEndNamedEvent(); PIXEndNamedEvent();
__int64 st3 = System::currentTimeMillis(); int64_t st3 = System::currentTimeMillis();
// printf(">>>>>>>>>>>>>>>>>>>>>> Tick %d %d %d : %d\n", st1 - st0, st2 - st1, st3 - st2, st0 - stc ); // printf(">>>>>>>>>>>>>>>>>>>>>> Tick %d %d %d : %d\n", st1 - st0, st2 - st1, st3 - st2, st0 - stc );
stc = st0; stc = st0;
// #endif// __PS3__ // #endif// __PS3__
@ -2206,7 +2206,7 @@ void MinecraftServer::handleConsoleInputs()
} }
} }
void MinecraftServer::main(__int64 seed, void *lpParameter) void MinecraftServer::main(int64_t seed, void *lpParameter)
{ {
#if __PS3__ #if __PS3__
ShutdownManager::HasStarted(ShutdownManager::eServerThread ); ShutdownManager::HasStarted(ShutdownManager::eServerThread );
@ -2286,7 +2286,7 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player)
void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer *player) void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer *player)
{ {
__int64 currentTime = System::currentTimeMillis(); int64_t currentTime = System::currentTimeMillis();
if( ( currentTime - s_tickStartTime ) >= MAX_TICK_TIME_FOR_PACKET_SENDS ) if( ( currentTime - s_tickStartTime ) >= MAX_TICK_TIME_FOR_PACKET_SENDS )
{ {

View file

@ -27,14 +27,14 @@ class CommandDispatcher;
typedef struct _LoadSaveDataThreadParam typedef struct _LoadSaveDataThreadParam
{ {
LPVOID data; LPVOID data;
__int64 fileSize; int64_t fileSize;
const wstring saveName; const wstring saveName;
_LoadSaveDataThreadParam(LPVOID data, __int64 filesize, const wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {} _LoadSaveDataThreadParam(LPVOID data, int64_t filesize, const wstring &saveName) : data( data ), fileSize( filesize ), saveName( saveName ) {}
} LoadSaveDataThreadParam; } LoadSaveDataThreadParam;
typedef struct _NetworkGameInitData typedef struct _NetworkGameInitData
{ {
__int64 seed; int64_t seed;
LoadSaveDataThreadParam *saveData; LoadSaveDataThreadParam *saveData;
DWORD settings; DWORD settings;
LevelGenerationOptions *levelGen; LevelGenerationOptions *levelGen;
@ -133,9 +133,9 @@ public:
~MinecraftServer(); ~MinecraftServer();
private: private:
// 4J Added - LoadSaveDataThreadParam // 4J Added - LoadSaveDataThreadParam
bool initServer(__int64 seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed); bool initServer(int64_t seed, NetworkGameInitData *initData, DWORD initSettings, bool findSeed);
void postProcessTerminate(ProgressRenderer *mcprogress); void postProcessTerminate(ProgressRenderer *mcprogress);
bool loadLevel(LevelStorageSource *storageSource, const wstring& name, __int64 levelSeed, LevelType *pLevelType, NetworkGameInitData *initData); bool loadLevel(LevelStorageSource *storageSource, const wstring& name, int64_t levelSeed, LevelType *pLevelType, NetworkGameInitData *initData);
void setProgress(const wstring& status, int progress); void setProgress(const wstring& status, int progress);
void endProgress(); void endProgress();
void saveAllChunks(); void saveAllChunks();
@ -171,13 +171,13 @@ public:
bool isUnderSpawnProtection(Level *level, int x, int y, int z, shared_ptr<Player> player); bool isUnderSpawnProtection(Level *level, int x, int y, int z, shared_ptr<Player> player);
void setForceGameType(bool forceGameType); void setForceGameType(bool forceGameType);
bool getForceGameType(); bool getForceGameType();
static __int64 getCurrentTimeMillis(); static int64_t getCurrentTimeMillis();
int getPlayerIdleTimeout(); int getPlayerIdleTimeout();
void setPlayerIdleTimeout(int playerIdleTimeout); void setPlayerIdleTimeout(int playerIdleTimeout);
public: public:
void halt(); void halt();
void run(__int64 seed, void *lpParameter); void run(int64_t seed, void *lpParameter);
void broadcastStartSavingPacket(); void broadcastStartSavingPacket();
void broadcastStopSavingPacket(); void broadcastStopSavingPacket();
@ -188,7 +188,7 @@ public:
void handleConsoleInput(const wstring& msg, ConsoleInputSource *source); void handleConsoleInput(const wstring& msg, ConsoleInputSource *source);
void handleConsoleInputs(); void handleConsoleInputs();
// void addTickable(Tickable tickable); // 4J removed // void addTickable(Tickable tickable); // 4J removed
static void main(__int64 seed, void *lpParameter); static void main(int64_t seed, void *lpParameter);
static void HaltServer(bool bPrimaryPlayerSignedOut=false); static void HaltServer(bool bPrimaryPlayerSignedOut=false);
File *getFile(const wstring& name); File *getFile(const wstring& name);
@ -208,9 +208,9 @@ private:
static MinecraftServer *server; static MinecraftServer *server;
static bool setTimeOfDayAtEndOfTick; static bool setTimeOfDayAtEndOfTick;
static __int64 setTimeOfDay; static int64_t setTimeOfDay;
static bool setTimeAtEndOfTick; static bool setTimeAtEndOfTick;
static __int64 setTime; static int64_t setTime;
static bool m_bPrimaryPlayerSignedOut; // 4J-PB added to tell the stopserver not to save the game - another player may have signed in in their place, so ProfileManager.IsSignedIn isn't enough static bool m_bPrimaryPlayerSignedOut; // 4J-PB added to tell the stopserver not to save the game - another player may have signed in in their place, so ProfileManager.IsSignedIn isn't enough
static bool s_bServerHalted; // 4J Stu Added so that we can halt the server even before it's been created properly static bool s_bServerHalted; // 4J Stu Added so that we can halt the server even before it's been created properly
@ -234,9 +234,9 @@ public:
public: public:
static PlayerList *getPlayerList() { if( server != NULL ) return server->players; else return NULL; } static PlayerList *getPlayerList() { if( server != NULL ) return server->players; else return NULL; }
static void SetTimeOfDay(__int64 time) { setTimeOfDayAtEndOfTick = true; setTimeOfDay = time; } static void SetTimeOfDay(int64_t time) { setTimeOfDayAtEndOfTick = true; setTimeOfDay = time; }
static void SetTime(__int64 time) { setTimeAtEndOfTick = true; setTime = time; } static void SetTime(int64_t time) { setTimeAtEndOfTick = true; setTime = time; }
C4JThread::Event* m_serverPausedEvent; C4JThread::Event* m_serverPausedEvent;
private: private:
// 4J Added // 4J Added
@ -245,7 +245,7 @@ private:
// 4J Added - A static that stores the QNet index of the player that is next allowed to send a packet in the slow queue // 4J Added - A static that stores the QNet index of the player that is next allowed to send a packet in the slow queue
#ifdef _ACK_CHUNK_SEND_THROTTLING #ifdef _ACK_CHUNK_SEND_THROTTLING
static bool s_hasSentEnoughPackets; static bool s_hasSentEnoughPackets;
static __int64 s_tickStartTime; static int64_t s_tickStartTime;
static vector<INetworkPlayer *> s_sentTo; static vector<INetworkPlayer *> s_sentTo;
static const int MAX_TICK_TIME_FOR_PACKET_SENDS = 35; static const int MAX_TICK_TIME_FOR_PACKET_SENDS = 35;
#else #else
@ -267,7 +267,7 @@ public:
#ifndef _ACK_CHUNK_SEND_THROTTLING #ifndef _ACK_CHUNK_SEND_THROTTLING
static void cycleSlowQueueIndex(); static void cycleSlowQueueIndex();
#endif #endif
void chunkPacketManagement_PreTick(); void chunkPacketManagement_PreTick();
void chunkPacketManagement_PostTick(); void chunkPacketManagement_PostTick();
@ -275,5 +275,5 @@ public:
void Suspend(); void Suspend();
bool IsSuspending(); bool IsSuspending();
// 4J Stu - A load of functions were all added in 1.0.1 in the ServerInterface, but I don't think we need any of them // 4J Stu - A load of functions were all added in 1.0.1 in the ServerInterface, but I don't think we need any of them
}; };

View file

@ -789,7 +789,7 @@ void MultiPlayerLevel::setScoreboard(Scoreboard *scoreboard)
this->scoreboard = scoreboard; this->scoreboard = scoreboard;
} }
void MultiPlayerLevel::setDayTime(__int64 newTime) void MultiPlayerLevel::setDayTime(int64_t newTime)
{ {
// 4J: We send daylight cycle rule with host options so don't need this // 4J: We send daylight cycle rule with host options so don't need this
/*if (newTime < 0) /*if (newTime < 0)

View file

@ -94,7 +94,7 @@ public:
virtual void createFireworks(double x, double y, double z, double xd, double yd, double zd, CompoundTag *infoTag); virtual void createFireworks(double x, double y, double z, double xd, double yd, double zd, CompoundTag *infoTag);
virtual void setScoreboard(Scoreboard *scoreboard); virtual void setScoreboard(Scoreboard *scoreboard);
virtual void setDayTime(__int64 newTime); virtual void setDayTime(int64_t newTime);
// 4J Stu - Added so we can have multiple local connections // 4J Stu - Added so we can have multiple local connections
void addClientConnection(ClientConnection *c) { connections.push_back( c ); } void addClientConnection(ClientConnection *c) { connections.push_back( c ); }

View file

@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#ifdef __i386__ #ifdef __i386__
#define __RADX86__ #define __RADX86__
#else #else
#define __RADARM__ #define __RADARM__
#endif #endif
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -132,7 +132,7 @@
#define __RADX86__ #define __RADX86__
#else #else
#error Unknown processor #error Unknown processor
#endif #endif
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -155,7 +155,7 @@
#define __RADNACL__ #define __RADNACL__
#define __RAD32__ #define __RAD32__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define __RADX86__ #define __RADX86__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -196,7 +196,7 @@
#define __RAD64REGS__ #define __RAD64REGS__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
@ -265,7 +265,7 @@
#endif #endif
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__ #define __RADWIIU__
@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */ #undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#endif #endif
@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else #else
// NOTE: / / is a guaranteed parse error in C/C++. // NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif #endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff // WARNING : RAD_TLS should really only be used for debug/tools stuff
@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect : // helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... } // if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@ -1324,7 +1324,7 @@
__pragma(warning(push)) \ __pragma(warning(push)) \
__pragma(warning(disable:4127)) \ __pragma(warning(disable:4127)) \
} while(0) \ } while(0) \
__pragma(warning(pop)) __pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \ __pragma(warning(push)) \
@ -1333,10 +1333,10 @@
__pragma(warning(pop)) __pragma(warning(pop))
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \ #define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 ) } while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 ) } while ( (void)1,1 )
@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
RAD_STATEMENT_END_FALSE RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \ #define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c // Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later #if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x # define RR_UNUSED_VARIABLE(x) (void) x
#else #else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null : // just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr ); // you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@ -1482,7 +1482,7 @@
// Cache / prefetch macros : // Cache / prefetch macros :
// RR_PREFETCH for various platforms : // RR_PREFETCH for various platforms :
// //
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here // platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//----------------------------------------------------------- //-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break // RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK #ifdef RAD_NO_BREAK
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//----------------------------------- //-----------------------------------
#ifdef RR_DO_ASSERTS #ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long mov eax, DWORD PTR _Long
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300) #if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64) #pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) #define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__) #elif defined(__RADCELL__)
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__) #elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. //APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else #else

File diff suppressed because it is too large Load diff

View file

@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#ifdef __i386__ #ifdef __i386__
#define __RADX86__ #define __RADX86__
#else #else
#define __RADARM__ #define __RADARM__
#endif #endif
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -132,7 +132,7 @@
#define __RADX86__ #define __RADX86__
#else #else
#error Unknown processor #error Unknown processor
#endif #endif
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -155,7 +155,7 @@
#define __RADNACL__ #define __RADNACL__
#define __RAD32__ #define __RAD32__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define __RADX86__ #define __RADX86__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -196,7 +196,7 @@
#define __RAD64REGS__ #define __RAD64REGS__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
@ -265,7 +265,7 @@
#endif #endif
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__ #define __RADWIIU__
@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */ #undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#endif #endif
@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else #else
// NOTE: / / is a guaranteed parse error in C/C++. // NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif #endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff // WARNING : RAD_TLS should really only be used for debug/tools stuff
@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect : // helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... } // if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@ -1324,7 +1324,7 @@
__pragma(warning(push)) \ __pragma(warning(push)) \
__pragma(warning(disable:4127)) \ __pragma(warning(disable:4127)) \
} while(0) \ } while(0) \
__pragma(warning(pop)) __pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \ __pragma(warning(push)) \
@ -1333,10 +1333,10 @@
__pragma(warning(pop)) __pragma(warning(pop))
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \ #define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 ) } while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 ) } while ( (void)1,1 )
@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
RAD_STATEMENT_END_FALSE RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \ #define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c // Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later #if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x # define RR_UNUSED_VARIABLE(x) (void) x
#else #else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null : // just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr ); // you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@ -1482,7 +1482,7 @@
// Cache / prefetch macros : // Cache / prefetch macros :
// RR_PREFETCH for various platforms : // RR_PREFETCH for various platforms :
// //
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here // platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//----------------------------------------------------------- //-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break // RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK #ifdef RAD_NO_BREAK
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//----------------------------------- //-----------------------------------
#ifdef RR_DO_ASSERTS #ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long mov eax, DWORD PTR _Long
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300) #if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64) #pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) #define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__) #elif defined(__RADCELL__)
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__) #elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. //APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else #else

View file

@ -21,8 +21,8 @@ int (* SQRNetworkManager_Orbis::s_SignInCompleteCallbackFn)(void *pParam, bool b
void * SQRNetworkManager_Orbis::s_SignInCompleteParam = NULL; void * SQRNetworkManager_Orbis::s_SignInCompleteParam = NULL;
sce::Toolkit::NP::PresenceDetails SQRNetworkManager_Orbis::s_lastPresenceInfo; sce::Toolkit::NP::PresenceDetails SQRNetworkManager_Orbis::s_lastPresenceInfo;
__int64 SQRNetworkManager_Orbis::s_lastPresenceTime = 0; int64_t SQRNetworkManager_Orbis::s_lastPresenceTime = 0;
__int64 SQRNetworkManager_Orbis::s_resendPresenceTime = 0; int64_t SQRNetworkManager_Orbis::s_resendPresenceTime = 0;
bool SQRNetworkManager_Orbis::s_presenceStatusDirty = false; bool SQRNetworkManager_Orbis::s_presenceStatusDirty = false;
bool SQRNetworkManager_Orbis::s_presenceDataDirty = false; bool SQRNetworkManager_Orbis::s_presenceDataDirty = false;

View file

@ -29,7 +29,7 @@ class SQRNetworkManager_Orbis : public SQRNetworkManager
public: public:
SQRNetworkManager_Orbis(ISQRNetworkManagerListener *listener); SQRNetworkManager_Orbis(ISQRNetworkManagerListener *listener);
// General // General
void Tick(); void Tick();
void Initialise(); void Initialise();
void Terminate(); void Terminate();
@ -111,7 +111,7 @@ private:
bool m_offlineSQR; bool m_offlineSQR;
int m_resendExternalRoomDataCountdown; int m_resendExternalRoomDataCountdown;
bool m_matching2initialised; bool m_matching2initialised;
PresenceSyncInfo m_inviteReceived[MAX_SIMULTANEOUS_INVITES]; PresenceSyncInfo m_inviteReceived[MAX_SIMULTANEOUS_INVITES];
int m_inviteIndex; int m_inviteIndex;
static PresenceSyncInfo *m_gameBootInvite; static PresenceSyncInfo *m_gameBootInvite;
static PresenceSyncInfo m_gameBootInvite_data; static PresenceSyncInfo m_gameBootInvite_data;
@ -222,9 +222,9 @@ private:
std::vector<FriendSearchResult> m_aFriendSearchResults; std::vector<FriendSearchResult> m_aFriendSearchResults;
// Rudp management and local players // Rudp management and local players
std::unordered_map<int,SQRNetworkPlayer *> m_RudpCtxToPlayerMap; std::unordered_map<int,SQRNetworkPlayer *> m_RudpCtxToPlayerMap;
std::unordered_map<SceNetInAddr_t, SQRVoiceConnection*> m_NetAddrToVoiceConnectionMap; std::unordered_map<SceNetInAddr_t, SQRVoiceConnection*> m_NetAddrToVoiceConnectionMap;
bool CreateRudpConnections(SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId peerMemberId, int playerMask, SceNpMatching2RoomMemberId playersPeerMemberId); bool CreateRudpConnections(SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId peerMemberId, int playerMask, SceNpMatching2RoomMemberId playersPeerMemberId);
bool CreateVoiceRudpConnections(SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId peerMemberId, int playerMask); bool CreateVoiceRudpConnections(SceNpMatching2RoomId roomId, SceNpMatching2RoomMemberId peerMemberId, int playerMask);
@ -325,8 +325,8 @@ private:
static sce::Toolkit::NP::PresenceDetails s_lastPresenceInfo; static sce::Toolkit::NP::PresenceDetails s_lastPresenceInfo;
static const int MIN_PRESENCE_RESEND_TIME = 30 * 1000; // Minimum presence send rate - doesn't seem possible to find out what this actually should be static const int MIN_PRESENCE_RESEND_TIME = 30 * 1000; // Minimum presence send rate - doesn't seem possible to find out what this actually should be
static __int64 s_lastPresenceTime; static int64_t s_lastPresenceTime;
static __int64 s_resendPresenceTime; static int64_t s_resendPresenceTime;
static bool s_presenceStatusDirty; static bool s_presenceStatusDirty;
static bool s_presenceDataDirty; static bool s_presenceDataDirty;
@ -337,7 +337,7 @@ private:
// Debug // Debug
static long long s_roomStartTime; static long long s_roomStartTime;
// Error dialog // Error dialog
static bool s_errorDialogRunning; static bool s_errorDialogRunning;

View file

@ -24,9 +24,9 @@ int32_t hBGMAudio;
//static char sc_loadPath[] = {"/app0/"}; //static char sc_loadPath[] = {"/app0/"};
//const char* getConsoleHomePath() { return sc_loadPath; } //const char* getConsoleHomePath() { return sc_loadPath; }
char* getUsrDirPath() char* getUsrDirPath()
{ {
return usrdirPath; return usrdirPath;
} }
@ -34,7 +34,7 @@ int _wcsicmp( const wchar_t * dst, const wchar_t * src )
{ {
wchar_t f,l; wchar_t f,l;
// validation section // validation section
// _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR); // _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR);
// _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR); // _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR);
@ -61,7 +61,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize)
} }
VOID GetSystemTime( LPSYSTEMTIME lpSystemTime) VOID GetSystemTime( LPSYSTEMTIME lpSystemTime)
{ {
SceRtcDateTime dateTime; SceRtcDateTime dateTime;
int err = sceRtcGetCurrentClock(&dateTime, 0); int err = sceRtcGetCurrentClock(&dateTime, 0);
@ -78,8 +78,8 @@ VOID GetSystemTime( LPSYSTEMTIME lpSystemTime)
} }
BOOL FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) { ORBIS_STUBBED; return false; } BOOL FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) { ORBIS_STUBBED; return false; }
BOOL SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) { ORBIS_STUBBED; return false; } BOOL SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) { ORBIS_STUBBED; return false; }
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
{ {
SceRtcDateTime dateTime; SceRtcDateTime dateTime;
int err = sceRtcGetCurrentClockLocalTime(&dateTime); int err = sceRtcGetCurrentClockLocalTime(&dateTime);
assert(err == SCE_OK ); assert(err == SCE_OK );
@ -95,21 +95,21 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
} }
HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { ORBIS_STUBBED; return NULL; } HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { ORBIS_STUBBED; return NULL; }
VOID Sleep(DWORD dwMilliseconds) VOID Sleep(DWORD dwMilliseconds)
{ {
C4JThread::Sleep(dwMilliseconds); C4JThread::Sleep(dwMilliseconds);
} }
BOOL SetThreadPriority(HANDLE hThread, int nPriority) { ORBIS_STUBBED; return FALSE; } BOOL SetThreadPriority(HANDLE hThread, int nPriority) { ORBIS_STUBBED; return FALSE; }
DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds) { ORBIS_STUBBED; return false; } DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds) { ORBIS_STUBBED; return false; }
LONG InterlockedCompareExchangeRelease(LONG volatile *Destination, LONG Exchange,LONG Comperand ) LONG InterlockedCompareExchangeRelease(LONG volatile *Destination, LONG Exchange,LONG Comperand )
{ {
return sceAtomicCompareAndSwap32((int32_t*)Destination, (int32_t)Comperand, (int32_t)Exchange); return sceAtomicCompareAndSwap32((int32_t*)Destination, (int32_t)Comperand, (int32_t)Exchange);
} }
LONG64 InterlockedCompareExchangeRelease64(LONG64 volatile *Destination, LONG64 Exchange, LONG64 Comperand) LONG64 InterlockedCompareExchangeRelease64(LONG64 volatile *Destination, LONG64 Exchange, LONG64 Comperand)
{ {
return sceAtomicCompareAndSwap64((int64_t*)Destination, (int64_t)Comperand, (int64_t)Exchange); return sceAtomicCompareAndSwap64((int64_t*)Destination, (int64_t)Comperand, (int64_t)Exchange);
} }
@ -135,10 +135,10 @@ VOID OrbisInit()
sceSysmoduleLoadModule(SCE_SYSMODULE_RUDP); sceSysmoduleLoadModule(SCE_SYSMODULE_RUDP);
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_MATCHING2); sceSysmoduleLoadModule(SCE_SYSMODULE_NP_MATCHING2);
sceSysmoduleLoadModule(SCE_SYSMODULE_INVITATION_DIALOG); sceSysmoduleLoadModule(SCE_SYSMODULE_INVITATION_DIALOG);
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_PARTY ); sceSysmoduleLoadModule(SCE_SYSMODULE_NP_PARTY );
sceSysmoduleLoadModule(SCE_SYSMODULE_GAME_CUSTOM_DATA_DIALOG ); sceSysmoduleLoadModule(SCE_SYSMODULE_GAME_CUSTOM_DATA_DIALOG );
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_SCORE_RANKING ); sceSysmoduleLoadModule(SCE_SYSMODULE_NP_SCORE_RANKING );
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_AUTH ); sceSysmoduleLoadModule(SCE_SYSMODULE_NP_AUTH );
sceSysmoduleLoadModule(SCE_SYSMODULE_NP_COMMERCE); sceSysmoduleLoadModule(SCE_SYSMODULE_NP_COMMERCE);
sceSysmoduleLoadModule(SCE_SYSMODULE_REMOTE_PLAY); sceSysmoduleLoadModule(SCE_SYSMODULE_REMOTE_PLAY);
sceSysmoduleLoadModule(SCE_SYSMODULE_ERROR_DIALOG); sceSysmoduleLoadModule(SCE_SYSMODULE_ERROR_DIALOG);
@ -173,7 +173,7 @@ VOID OrbisInit()
hBGMAudio=sceAudioOutOpen( hBGMAudio=sceAudioOutOpen(
SCE_USER_SERVICE_USER_ID_SYSTEM, SCE_USER_SERVICE_USER_ID_SYSTEM,
SCE_AUDIO_OUT_PORT_TYPE_BGM,0, SCE_AUDIO_OUT_PORT_TYPE_BGM,0,
256, 256,
48000, 48000,
2); 2);
@ -195,7 +195,7 @@ int32_t GetAudioBGMHandle()
return hBGMAudio; return hBGMAudio;
} }
VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection) VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection)
{ {
char name[1] = {0}; char name[1] = {0};
@ -209,7 +209,7 @@ VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection)
} }
VOID InitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION CriticalSection, ULONG SpinCount) VOID InitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION CriticalSection, ULONG SpinCount)
{ {
InitializeCriticalSection(CriticalSection); InitializeCriticalSection(CriticalSection);
} }
@ -220,9 +220,9 @@ VOID DeleteCriticalSection(PCRITICAL_SECTION CriticalSection)
assert(err == SCE_OK); assert(err == SCE_OK);
} }
extern CRITICAL_SECTION g_singleThreadCS; extern CRITICAL_SECTION g_singleThreadCS;
VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection) VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection)
{ {
int err = scePthreadMutexLock(&CriticalSection->mutex); int err = scePthreadMutexLock(&CriticalSection->mutex);
assert(err == SCE_OK || err == SCE_KERNEL_ERROR_EDEADLK ); assert(err == SCE_OK || err == SCE_KERNEL_ERROR_EDEADLK );
@ -240,7 +240,7 @@ VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection)
} }
VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection) VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection)
{ {
if(--CriticalSection->m_cLock == 0 ) if(--CriticalSection->m_cLock == 0 )
{ {
@ -255,7 +255,7 @@ VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection)
ULONG TryEnterCriticalSection(PCRITICAL_SECTION CriticalSection) ULONG TryEnterCriticalSection(PCRITICAL_SECTION CriticalSection)
{ {
int err = scePthreadMutexTrylock(&CriticalSection->mutex); int err = scePthreadMutexTrylock(&CriticalSection->mutex);
if((err == SCE_OK || err == SCE_KERNEL_ERROR_EDEADLK )) if((err == SCE_OK || err == SCE_KERNEL_ERROR_EDEADLK ))
{ {
CriticalSection->m_cLock++; CriticalSection->m_cLock++;
@ -266,20 +266,20 @@ ULONG TryEnterCriticalSection(PCRITICAL_SECTION CriticalSection)
DWORD WaitForMultipleObjects(DWORD nCount, CONST HANDLE *lpHandles,BOOL bWaitAll,DWORD dwMilliseconds) { ORBIS_STUBBED; return 0; } DWORD WaitForMultipleObjects(DWORD nCount, CONST HANDLE *lpHandles,BOOL bWaitAll,DWORD dwMilliseconds) { ORBIS_STUBBED; return 0; }
BOOL CloseHandle(HANDLE hObject) BOOL CloseHandle(HANDLE hObject)
{ {
sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)hObject)); sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)hObject));
return true; return true;
// ORBIS_STUBBED; // ORBIS_STUBBED;
// return false; // return false;
} }
BOOL SetEvent(HANDLE hEvent) { ORBIS_STUBBED; return false; } BOOL SetEvent(HANDLE hEvent) { ORBIS_STUBBED; return false; }
HMODULE GetModuleHandle(LPCSTR lpModuleName) { ORBIS_STUBBED; return 0; } HMODULE GetModuleHandle(LPCSTR lpModuleName) { ORBIS_STUBBED; return 0; }
DWORD GetCurrentThreadId(VOID) DWORD GetCurrentThreadId(VOID)
{ {
return 0; // TODO return 0; // TODO
} }
DWORD WaitForMultipleObjectsEx(DWORD nCount,CONST HANDLE *lpHandles,BOOL bWaitAll,DWORD dwMilliseconds,BOOL bAlertable ) { ORBIS_STUBBED; return 0; } DWORD WaitForMultipleObjectsEx(DWORD nCount,CONST HANDLE *lpHandles,BOOL bWaitAll,DWORD dwMilliseconds,BOOL bAlertable ) { ORBIS_STUBBED; return 0; }
@ -302,10 +302,10 @@ public:
void* m_virtualAddr; void* m_virtualAddr;
uint64_t m_size; uint64_t m_size;
PageInfo(off_t physAddr, void* virtualAddr, uint64_t size) PageInfo(off_t physAddr, void* virtualAddr, uint64_t size)
: m_physAddr(physAddr) : m_physAddr(physAddr)
, m_virtualAddr(virtualAddr) , m_virtualAddr(virtualAddr)
, m_size(size) , m_size(size)
{} {}
}; };
void* m_virtualAddr; void* m_virtualAddr;
@ -313,7 +313,7 @@ public:
std::vector<PageInfo> m_pagesAllocated; std::vector<PageInfo> m_pagesAllocated;
uint64_t m_allocatedSize; uint64_t m_allocatedSize;
OrbisVAlloc(void* addr, uint64_t size) OrbisVAlloc(void* addr, uint64_t size)
: m_virtualAddr(addr) : m_virtualAddr(addr)
, m_virtualSize(size) , m_virtualSize(size)
, m_allocatedSize(0) , m_allocatedSize(0)
@ -331,7 +331,7 @@ public:
{ {
uint64_t sizeToAdd = size - m_allocatedSize; // the extra memory size that we have to add on uint64_t sizeToAdd = size - m_allocatedSize; // the extra memory size that we have to add on
assert(sizeToAdd >= 0); assert(sizeToAdd >= 0);
if(sizeToAdd == 0) if(sizeToAdd == 0)
return m_virtualAddr; // nothing to add return m_virtualAddr; // nothing to add
@ -393,8 +393,8 @@ public:
static std::vector<OrbisVAlloc*> s_orbisVAllocs; static std::vector<OrbisVAlloc*> s_orbisVAllocs;
LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
{ {
if(lpAddress == NULL) if(lpAddress == NULL)
{ {
void *pAddr = (void*)SCE_KERNEL_APP_MAP_AREA_START_ADDR; void *pAddr = (void*)SCE_KERNEL_APP_MAP_AREA_START_ADDR;
@ -446,14 +446,14 @@ BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType)
else if(dwFreeType == MEM_RELEASE) else if(dwFreeType == MEM_RELEASE)
{ {
delete s_orbisVAllocs[idx]; delete s_orbisVAllocs[idx];
s_orbisVAllocs.erase(s_orbisVAllocs.begin()+idx); s_orbisVAllocs.erase(s_orbisVAllocs.begin()+idx);
} }
return TRUE; return TRUE;
} }
DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh ) DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh )
{ {
SceFiosSize FileSize; SceFiosSize FileSize;
SceFiosFH fh = (SceFiosFH)((int64_t)hFile); SceFiosFH fh = (SceFiosFH)((int64_t)hFile);
//DWORD FileSizeLow; //DWORD FileSizeLow;
@ -468,15 +468,15 @@ DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh )
return (DWORD)FileSize; return (DWORD)FileSize;
} }
BOOL GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize ) BOOL GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize )
{ {
SceFiosSize FileSize; SceFiosSize FileSize;
SceFiosFH fh = (SceFiosFH)((int64_t)hFile); SceFiosFH fh = (SceFiosFH)((int64_t)hFile);
FileSize=sceFiosFHGetSize(fh); FileSize=sceFiosFHGetSize(fh);
lpFileSize->QuadPart=FileSize; lpFileSize->QuadPart=FileSize;
return true; return true;
} }
BOOL WriteFile( BOOL WriteFile(
HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped ) HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped )
@ -496,7 +496,7 @@ BOOL WriteFile(
} }
} }
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped )
{ {
SceFiosFH fh = (SceFiosFH)((int64_t)hFile); SceFiosFH fh = (SceFiosFH)((int64_t)hFile);
// sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes. // sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes.
@ -537,7 +537,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi
} }
HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{ {
char filePath[256]; char filePath[256];
std::string mountedPath = StorageManager.GetMountedPath(lpFileName); std::string mountedPath = StorageManager.GetMountedPath(lpFileName);
@ -549,7 +549,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
strcpy(filePath, lpFileName ); strcpy(filePath, lpFileName );
else else
sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName );
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
app.DebugPrintf("*** Opening %s\n",filePath); app.DebugPrintf("*** Opening %s\n",filePath);
#endif #endif
@ -557,9 +557,9 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
SceFiosFH fh; SceFiosFH fh;
SceFiosOpenParams openParams; SceFiosOpenParams openParams;
ZeroMemory(&openParams, sizeof(SceFiosOpenParams)); ZeroMemory(&openParams, sizeof(SceFiosOpenParams));
switch(dwDesiredAccess) switch(dwDesiredAccess)
{ {
case GENERIC_READ: case GENERIC_READ:
openParams.openFlags = SCE_FIOS_O_RDONLY; break; openParams.openFlags = SCE_FIOS_O_RDONLY; break;
case GENERIC_WRITE: case GENERIC_WRITE:
@ -588,21 +588,21 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
//assert( err == SCE_FIOS_OK ); //assert( err == SCE_FIOS_OK );
return (void*)fh; return (void*)fh;
} }
BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes){ ORBIS_STUBBED; return false; } BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes){ ORBIS_STUBBED; return false; }
BOOL DeleteFileA(LPCSTR lpFileName) { ORBIS_STUBBED; return false; } BOOL DeleteFileA(LPCSTR lpFileName) { ORBIS_STUBBED; return false; }
// BOOL XCloseHandle(HANDLE a) // BOOL XCloseHandle(HANDLE a)
// { // {
// sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)a)); // sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)a));
// return true; // return true;
// } // }
DWORD GetFileAttributesA(LPCSTR lpFileName) DWORD GetFileAttributesA(LPCSTR lpFileName)
{ {
char filePath[256]; char filePath[256];
std::string mountedPath = StorageManager.GetMountedPath(lpFileName); std::string mountedPath = StorageManager.GetMountedPath(lpFileName);
@ -633,7 +633,7 @@ BOOL MoveFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName) { ORBIS_STUBBED;
DWORD GetLastError(VOID) { ORBIS_STUBBED; return 0; } DWORD GetLastError(VOID) { ORBIS_STUBBED; return 0; }
VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
{ {
SceLibcMallocManagedSize stat; SceLibcMallocManagedSize stat;
int err = malloc_stats(&stat); int err = malloc_stats(&stat);
@ -647,20 +647,20 @@ VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
lpBuffer->dwAvailVirtual = stat.maxSystemSize - stat.currentInuseSize; lpBuffer->dwAvailVirtual = stat.maxSystemSize - stat.currentInuseSize;
} }
DWORD GetTickCount() DWORD GetTickCount()
{ {
// This function returns the current system time at this function is called. // This function returns the current system time at this function is called.
// The system time is represented the time elapsed since the system starts up in microseconds. // The system time is represented the time elapsed since the system starts up in microseconds.
uint64_t sysTime = sceKernelGetProcessTime(); uint64_t sysTime = sceKernelGetProcessTime();
return (DWORD)(sysTime / 1000); return (DWORD)(sysTime / 1000);
} }
// we should really use libperf for this kind of thing, but this will do for now. // we should really use libperf for this kind of thing, but this will do for now.
BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency) BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)
{ {
// microseconds // microseconds
lpFrequency->QuadPart = (1000 * 1000); lpFrequency->QuadPart = (1000 * 1000);
return false; return false;
} }
BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount) BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
{ {
@ -671,24 +671,24 @@ BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
#ifndef _FINAL_BUILD #ifndef _FINAL_BUILD
VOID OutputDebugStringW(LPCWSTR lpOutputString) VOID OutputDebugStringW(LPCWSTR lpOutputString)
{ {
wprintf(lpOutputString); wprintf(lpOutputString);
} }
VOID OutputDebugStringA(LPCSTR lpOutputString) VOID OutputDebugStringA(LPCSTR lpOutputString)
{ {
printf(lpOutputString); printf(lpOutputString);
} }
VOID OutputDebugString(LPCSTR lpOutputString) VOID OutputDebugString(LPCSTR lpOutputString)
{ {
printf(lpOutputString); printf(lpOutputString);
} }
#endif // _CONTENT_PACKAGE #endif // _CONTENT_PACKAGE
BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation) BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation)
{ {
ORBIS_STUBBED; ORBIS_STUBBED;
return false; return false;
} }
@ -696,15 +696,15 @@ HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData) { ORB
BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) { ORBIS_STUBBED; return false;} BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) { ORBIS_STUBBED; return false;}
errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%d",_Value); else if(_Radix==16) sprintf(_DstBuf,"%lx",_Value); else return -1; return 0; } errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%d",_Value); else if(_Radix==16) sprintf(_DstBuf,"%lx",_Value); else return -1; return 0; }
errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; } errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; }
DWORD XGetLanguage() DWORD XGetLanguage()
{ {
unsigned char ucLang = app.GetMinecraftLanguage(0); unsigned char ucLang = app.GetMinecraftLanguage(0);
int iLang; int iLang;
// check if we should override the system language or not // check if we should override the system language or not
if(ucLang==MINECRAFT_LANGUAGE_DEFAULT) if(ucLang==MINECRAFT_LANGUAGE_DEFAULT)
{ {
sceSystemServiceParamGetInt(SCE_SYSTEM_SERVICE_PARAM_ID_LANG,&iLang); sceSystemServiceParamGetInt(SCE_SYSTEM_SERVICE_PARAM_ID_LANG,&iLang);
} }
@ -747,8 +747,8 @@ DWORD XGetLanguage()
} }
} }
DWORD XGetLocale() DWORD XGetLocale()
{ {
int iLang; int iLang;
sceSystemServiceParamGetInt(SCE_SYSTEM_SERVICE_PARAM_ID_LANG,&iLang); sceSystemServiceParamGetInt(SCE_SYSTEM_SERVICE_PARAM_ID_LANG,&iLang);
switch(iLang) switch(iLang)
@ -784,7 +784,7 @@ DWORD XGetLocale()
} }
} }
DWORD XEnableGuestSignin(BOOL fEnable) DWORD XEnableGuestSignin(BOOL fEnable)
{ {
return 0; return 0;
} }

View file

@ -14,7 +14,7 @@ DWORD TlsAlloc(VOID);
LPVOID TlsGetValue(DWORD dwTlsIndex); LPVOID TlsGetValue(DWORD dwTlsIndex);
BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue); BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue);
typedef struct _RECT typedef struct _RECT
{ {
LONG left; LONG left;
LONG top; LONG top;
@ -37,16 +37,16 @@ typedef int errno_t;
// // The following field is used for blocking when there is contention for // // The following field is used for blocking when there is contention for
// // the resource // // the resource
// // // //
// //
// union { // union {
// ULONG_PTR RawEvent[4]; // ULONG_PTR RawEvent[4];
// } Synchronization; // } Synchronization;
// //
// // // //
// // The following three fields control entering and exiting the critical // // The following three fields control entering and exiting the critical
// // section for the resource // // section for the resource
// // // //
// //
// LONG LockCount; // LONG LockCount;
// LONG RecursionCount; // LONG RecursionCount;
// HANDLE OwningThread; // HANDLE OwningThread;
@ -214,7 +214,7 @@ typedef struct _MEMORYSTATUS {
#define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE #define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE
#define WAIT_TIMEOUT 258L #define WAIT_TIMEOUT 258L
#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L) #define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L)
#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0 ) + 0 ) #define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0 ) + 0 )
#define MAXUINT_PTR (~((UINT_PTR)0)) #define MAXUINT_PTR (~((UINT_PTR)0))
@ -256,17 +256,17 @@ typedef struct _MEMORYSTATUS {
#define GENERIC_EXECUTE (0x20000000L) #define GENERIC_EXECUTE (0x20000000L)
#define GENERIC_ALL (0x10000000L) #define GENERIC_ALL (0x10000000L)
#define FILE_SHARE_READ 0x00000001 #define FILE_SHARE_READ 0x00000001
#define FILE_SHARE_WRITE 0x00000002 #define FILE_SHARE_WRITE 0x00000002
#define FILE_SHARE_DELETE 0x00000004 #define FILE_SHARE_DELETE 0x00000004
#define FILE_ATTRIBUTE_READONLY 0x00000001 #define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_DEVICE 0x00000040 #define FILE_ATTRIBUTE_DEVICE 0x00000040
#define FILE_ATTRIBUTE_NORMAL 0x00000080 #define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
#define FILE_FLAG_WRITE_THROUGH 0x80000000 #define FILE_FLAG_WRITE_THROUGH 0x80000000
#define FILE_FLAG_OVERLAPPED 0x40000000 #define FILE_FLAG_OVERLAPPED 0x40000000
@ -286,38 +286,38 @@ typedef struct _MEMORYSTATUS {
#define OPEN_ALWAYS 4 #define OPEN_ALWAYS 4
#define TRUNCATE_EXISTING 5 #define TRUNCATE_EXISTING 5
#define PAGE_NOACCESS 0x01 #define PAGE_NOACCESS 0x01
#define PAGE_READONLY 0x02 #define PAGE_READONLY 0x02
#define PAGE_READWRITE 0x04 #define PAGE_READWRITE 0x04
#define PAGE_WRITECOPY 0x08 #define PAGE_WRITECOPY 0x08
#define PAGE_EXECUTE 0x10 #define PAGE_EXECUTE 0x10
#define PAGE_EXECUTE_READ 0x20 #define PAGE_EXECUTE_READ 0x20
#define PAGE_EXECUTE_READWRITE 0x40 #define PAGE_EXECUTE_READWRITE 0x40
#define PAGE_EXECUTE_WRITECOPY 0x80 #define PAGE_EXECUTE_WRITECOPY 0x80
#define PAGE_GUARD 0x100 #define PAGE_GUARD 0x100
#define PAGE_NOCACHE 0x200 #define PAGE_NOCACHE 0x200
#define PAGE_WRITECOMBINE 0x400 #define PAGE_WRITECOMBINE 0x400
#define PAGE_USER_READONLY 0x1000 #define PAGE_USER_READONLY 0x1000
#define PAGE_USER_READWRITE 0x2000 #define PAGE_USER_READWRITE 0x2000
#define MEM_COMMIT 0x1000 #define MEM_COMMIT 0x1000
#define MEM_RESERVE 0x2000 #define MEM_RESERVE 0x2000
#define MEM_DECOMMIT 0x4000 #define MEM_DECOMMIT 0x4000
#define MEM_RELEASE 0x8000 #define MEM_RELEASE 0x8000
#define MEM_FREE 0x10000 #define MEM_FREE 0x10000
#define MEM_PRIVATE 0x20000 #define MEM_PRIVATE 0x20000
#define MEM_RESET 0x80000 #define MEM_RESET 0x80000
#define MEM_TOP_DOWN 0x100000 #define MEM_TOP_DOWN 0x100000
#define MEM_NOZERO 0x800000 #define MEM_NOZERO 0x800000
#define MEM_LARGE_PAGES 0x20000000 #define MEM_LARGE_PAGES 0x20000000
#define MEM_HEAP 0x40000000 #define MEM_HEAP 0x40000000
#define MEM_16MB_PAGES 0x80000000 #define MEM_16MB_PAGES 0x80000000
#define IGNORE 0 // Ignore signal #define IGNORE 0 // Ignore signal
#define INFINITE 0xFFFFFFFF // Infinite timeout #define INFINITE 0xFFFFFFFF // Infinite timeout
#define WAIT_FAILED ((DWORD)0xFFFFFFFF) #define WAIT_FAILED ((DWORD)0xFFFFFFFF)
#define STATUS_WAIT_0 ((DWORD )0x00000000L) #define STATUS_WAIT_0 ((DWORD )0x00000000L)
#define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 ) #define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 )
#define STATUS_PENDING ((DWORD )0x00000103L) #define STATUS_PENDING ((DWORD )0x00000103L)
#define STILL_ACTIVE STATUS_PENDING #define STILL_ACTIVE STATUS_PENDING
DWORD GetLastError(VOID); DWORD GetLastError(VOID);
@ -356,9 +356,9 @@ VOID OutputDebugString(LPCSTR lpOutputString);
VOID OutputDebugStringA(LPCSTR lpOutputString); VOID OutputDebugStringA(LPCSTR lpOutputString);
errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix); errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix);
errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix); errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix);
#define __declspec(a) #define __declspec(a)
extern "C" int _wcsicmp (const wchar_t * dst, const wchar_t * src); extern "C" int _wcsicmp (const wchar_t * dst, const wchar_t * src);
size_t wcsnlen(const wchar_t *wcs, size_t maxsize); size_t wcsnlen(const wchar_t *wcs, size_t maxsize);

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
//#include "winerror.h" #include <cstdint>
typedef unsigned int DWORD; typedef unsigned int DWORD;
typedef int BOOL; typedef int BOOL;
@ -34,8 +34,6 @@ typedef unsigned int *PUINT;
typedef unsigned char byte; typedef unsigned char byte;
typedef long __int64;
typedef unsigned long __uint64;
typedef unsigned int DWORD; typedef unsigned int DWORD;
typedef int INT; typedef int INT;
typedef unsigned long ULONG_PTR, *PULONG_PTR; typedef unsigned long ULONG_PTR, *PULONG_PTR;

View file

@ -400,7 +400,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
StorageManager.SetSaveTitle(wWorldName.c_str()); StorageManager.SetSaveTitle(wWorldName.c_str());
bool isFlat = false; bool isFlat = false;
__int64 seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements int64_t seedValue = BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
NetworkGameInitData *param = new NetworkGameInitData(); NetworkGameInitData *param = new NetworkGameInitData();
param->seed = seedValue; param->seed = seedValue;

View file

@ -38,7 +38,7 @@ int user_malloc_init(void)
int res; int res;
void *addr; void *addr;
uint64_t dmemSize = SCE_KERNEL_MAIN_DMEM_SIZE; uint64_t dmemSize = SCE_KERNEL_MAIN_DMEM_SIZE;
s_heapLength = ((size_t)4608) * 1024 * 1024; // Initial allocation for the application s_heapLength = ((size_t)4608) * 1024 * 1024; // Initial allocation for the application
s_heapLength -= ((size_t)4) * 1024 * 1024; // Allocated for TLS s_heapLength -= ((size_t)4) * 1024 * 1024; // Allocated for TLS
s_heapLength -= ((size_t)2) * 1024 * 1024; // 64K (sometimes?) allocated for razor - rounding up to 2MB here to match our alignment s_heapLength -= ((size_t)2) * 1024 * 1024; // 64K (sometimes?) allocated for razor - rounding up to 2MB here to match our alignment
@ -106,10 +106,10 @@ void *user_malloc(size_t size)
{ {
#if 0 #if 0
static int throttle = 0; static int throttle = 0;
static __int64 lasttime = 0; static int64_t lasttime = 0;
if( ( throttle % 100 ) == 0 ) if( ( throttle % 100 ) == 0 )
{ {
__int64 nowtime = System::currentTimeMillis(); int64_t nowtime = System::currentTimeMillis();
if( ( nowtime - lasttime ) > 20000 ) if( ( nowtime - lasttime ) > 20000 )
{ {
lasttime = nowtime; lasttime = nowtime;

View file

@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#ifdef __i386__ #ifdef __i386__
#define __RADX86__ #define __RADX86__
#else #else
#define __RADARM__ #define __RADARM__
#endif #endif
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -132,7 +132,7 @@
#define __RADX86__ #define __RADX86__
#else #else
#error Unknown processor #error Unknown processor
#endif #endif
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -155,7 +155,7 @@
#define __RADNACL__ #define __RADNACL__
#define __RAD32__ #define __RAD32__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define __RADX86__ #define __RADX86__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -196,7 +196,7 @@
#define __RAD64REGS__ #define __RAD64REGS__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
@ -265,7 +265,7 @@
#endif #endif
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__ #define __RADWIIU__
@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */ #undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#endif #endif
@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else #else
// NOTE: / / is a guaranteed parse error in C/C++. // NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif #endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff // WARNING : RAD_TLS should really only be used for debug/tools stuff
@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect : // helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... } // if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@ -1324,7 +1324,7 @@
__pragma(warning(push)) \ __pragma(warning(push)) \
__pragma(warning(disable:4127)) \ __pragma(warning(disable:4127)) \
} while(0) \ } while(0) \
__pragma(warning(pop)) __pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \ __pragma(warning(push)) \
@ -1333,10 +1333,10 @@
__pragma(warning(pop)) __pragma(warning(pop))
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \ #define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 ) } while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 ) } while ( (void)1,1 )
@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
RAD_STATEMENT_END_FALSE RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \ #define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c // Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later #if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x # define RR_UNUSED_VARIABLE(x) (void) x
#else #else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null : // just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr ); // you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@ -1482,7 +1482,7 @@
// Cache / prefetch macros : // Cache / prefetch macros :
// RR_PREFETCH for various platforms : // RR_PREFETCH for various platforms :
// //
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here // platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//----------------------------------------------------------- //-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break // RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK #ifdef RAD_NO_BREAK
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//----------------------------------- //-----------------------------------
#ifdef RR_DO_ASSERTS #ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long mov eax, DWORD PTR _Long
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300) #if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64) #pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) #define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__) #elif defined(__RADCELL__)
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__) #elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. //APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else #else

File diff suppressed because it is too large Load diff

View file

@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#ifdef __i386__ #ifdef __i386__
#define __RADX86__ #define __RADX86__
#else #else
#define __RADARM__ #define __RADARM__
#endif #endif
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -132,7 +132,7 @@
#define __RADX86__ #define __RADX86__
#else #else
#error Unknown processor #error Unknown processor
#endif #endif
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -155,7 +155,7 @@
#define __RADNACL__ #define __RADNACL__
#define __RAD32__ #define __RAD32__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define __RADX86__ #define __RADX86__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -196,7 +196,7 @@
#define __RAD64REGS__ #define __RAD64REGS__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
@ -265,7 +265,7 @@
#endif #endif
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__ #define __RADWIIU__
@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */ #undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#endif #endif
@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else #else
// NOTE: / / is a guaranteed parse error in C/C++. // NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif #endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff // WARNING : RAD_TLS should really only be used for debug/tools stuff
@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect : // helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... } // if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@ -1324,7 +1324,7 @@
__pragma(warning(push)) \ __pragma(warning(push)) \
__pragma(warning(disable:4127)) \ __pragma(warning(disable:4127)) \
} while(0) \ } while(0) \
__pragma(warning(pop)) __pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \ __pragma(warning(push)) \
@ -1333,10 +1333,10 @@
__pragma(warning(pop)) __pragma(warning(pop))
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \ #define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 ) } while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 ) } while ( (void)1,1 )
@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
RAD_STATEMENT_END_FALSE RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \ #define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c // Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later #if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x # define RR_UNUSED_VARIABLE(x) (void) x
#else #else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null : // just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr ); // you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@ -1482,7 +1482,7 @@
// Cache / prefetch macros : // Cache / prefetch macros :
// RR_PREFETCH for various platforms : // RR_PREFETCH for various platforms :
// //
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here // platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//----------------------------------------------------------- //-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break // RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK #ifdef RAD_NO_BREAK
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//----------------------------------- //-----------------------------------
#ifdef RR_DO_ASSERTS #ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long mov eax, DWORD PTR _Long
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300) #if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64) #pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) #define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__) #elif defined(__RADCELL__)
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__) #elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. //APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else #else

View file

@ -27,21 +27,21 @@
void SonyRemoteStorage_PS3::npauthhandler(int event, int result, void *arg) void SonyRemoteStorage_PS3::npauthhandler(int event, int result, void *arg)
{ {
#ifdef __PS3__ #ifdef __PS3__
if (event != SCE_NP_MANAGER_EVENT_GOT_TICKET || result <= 0) if (event != SCE_NP_MANAGER_EVENT_GOT_TICKET || result <= 0)
{ {
app.DebugPrintf("Could not retrieve ticket: 0x%x\n", result); app.DebugPrintf("Could not retrieve ticket: 0x%x\n", result);
} }
else else
{ {
psnTicketSize = result; psnTicketSize = result;
psnTicket = malloc(psnTicketSize); psnTicket = malloc(psnTicketSize);
if (psnTicket == NULL) if (psnTicket == NULL)
{ {
app.DebugPrintf("Failed to allocate for ticket\n"); app.DebugPrintf("Failed to allocate for ticket\n");
} }
int ret = sceNpManagerGetTicket(psnTicket, &psnTicketSize); int ret = sceNpManagerGetTicket(psnTicket, &psnTicketSize);
if (ret < 0) if (ret < 0)
{ {
app.DebugPrintf("Could not retrieve ticket: 0x%x\n", ret); app.DebugPrintf("Could not retrieve ticket: 0x%x\n", ret);
free(psnTicket); free(psnTicket);
@ -60,7 +60,7 @@ int SonyRemoteStorage_PS3::initPreconditions()
SceNpId npId; SceNpId npId;
ret = sceNpManagerGetNpId(&npId); ret = sceNpManagerGetNpId(&npId);
if(ret < 0) if(ret < 0)
{ {
return ret; return ret;
} }
@ -68,12 +68,12 @@ int SonyRemoteStorage_PS3::initPreconditions()
ticketVersion.major = 3; ticketVersion.major = 3;
ticketVersion.minor = 0; ticketVersion.minor = 0;
ret = sceNpManagerRequestTicket2(&npId, &ticketVersion, TICKETING_SERVICE_ID, NULL, 0, NULL, 0); ret = sceNpManagerRequestTicket2(&npId, &ticketVersion, TICKETING_SERVICE_ID, NULL, 0, NULL, 0);
if(ret < 0) if(ret < 0)
{ {
return ret; return ret;
} }
m_waitingForTicket = true; m_waitingForTicket = true;
while(m_waitingForTicket) while(m_waitingForTicket)
{ {
cellSysutilCheckCallback(); cellSysutilCheckCallback();
sys_timer_usleep(50000); //50 milliseconds. sys_timer_usleep(50000); //50 milliseconds.
@ -104,12 +104,12 @@ void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event,
break; break;
case GET_DATA_RESULT: case GET_DATA_RESULT:
if(retCode >= 0) if(retCode >= 0)
{ {
app.DebugPrintf("Get Data success \n"); app.DebugPrintf("Get Data success \n");
m_status = e_getDataSucceeded; m_status = e_getDataSucceeded;
} }
else else
{ {
app.DebugPrintf("An error occurred while Get Data was being processed. retCode: 0x%x \n", retCode); app.DebugPrintf("An error occurred while Get Data was being processed. retCode: 0x%x \n", retCode);
m_status = e_error; m_status = e_error;
@ -126,12 +126,12 @@ void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event,
break; break;
case GET_STATUS_RESULT: case GET_STATUS_RESULT:
if(retCode >= 0) if(retCode >= 0)
{ {
app.DebugPrintf("Get Status success \n"); app.DebugPrintf("Get Status success \n");
app.DebugPrintf("Remaining Syncs for this user: %llu\n", outputGetStatus->remainingSyncs); app.DebugPrintf("Remaining Syncs for this user: %llu\n", outputGetStatus->remainingSyncs);
app.DebugPrintf("Number of files on the cloud: %d\n", outputGetStatus->numFiles); app.DebugPrintf("Number of files on the cloud: %d\n", outputGetStatus->numFiles);
for(int i = 0; i < outputGetStatus->numFiles; i++) for(int i = 0; i < outputGetStatus->numFiles; i++)
{ {
app.DebugPrintf("\n*** File %d information: ***\n", (i + 1)); app.DebugPrintf("\n*** File %d information: ***\n", (i + 1));
app.DebugPrintf("File name: %s \n", outputGetStatus->data[i].fileName); app.DebugPrintf("File name: %s \n", outputGetStatus->data[i].fileName);
@ -142,8 +142,8 @@ void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event,
app.DebugPrintf("Visibility: \"%s\" \n", (outputGetStatus->data[i].visibility == 0)?"Private":((outputGetStatus->data[i].visibility == 1)?"Public read only":"Public read and write")); app.DebugPrintf("Visibility: \"%s\" \n", (outputGetStatus->data[i].visibility == 0)?"Private":((outputGetStatus->data[i].visibility == 1)?"Public read only":"Public read and write"));
} }
m_status = e_getStatusSucceeded; m_status = e_getStatusSucceeded;
} }
else else
{ {
app.DebugPrintf("An error occurred while Get Status was being processed. retCode: 0x%x \n", retCode); app.DebugPrintf("An error occurred while Get Status was being processed. retCode: 0x%x \n", retCode);
m_status = e_error; m_status = e_error;
@ -158,12 +158,12 @@ void SonyRemoteStorage_PS3::internalCallback(const SceRemoteStorageEvent event,
break; break;
case SET_DATA_RESULT: case SET_DATA_RESULT:
if(retCode >= 0) if(retCode >= 0)
{ {
app.DebugPrintf("Set Data success \n"); app.DebugPrintf("Set Data success \n");
m_status = e_setDataSucceeded; m_status = e_setDataSucceeded;
} }
else else
{ {
app.DebugPrintf("An error occurred while Set Data was being processed. retCode: 0x%x \n", retCode); app.DebugPrintf("An error occurred while Set Data was being processed. retCode: 0x%x \n", retCode);
m_status = e_error; m_status = e_error;
@ -230,7 +230,7 @@ bool SonyRemoteStorage_PS3::init(CallbackFunc cb, LPVOID lpParam)
params.callback = staticInternalCallback; params.callback = staticInternalCallback;
params.userData = this; params.userData = this;
params.thread.threadAffinity = 0; //Not used in PS3 params.thread.threadAffinity = 0; //Not used in PS3
params.thread.threadPriority = 1000; //Must be between [0-3071], being 0 the highest. params.thread.threadPriority = 1000; //Must be between [0-3071], being 0 the highest.
params.psnTicket = psnTicket; params.psnTicket = psnTicket;
params.psnTicketSize = psnTicketSize; params.psnTicketSize = psnTicketSize;
strcpy(params.clientId, CLIENT_ID); strcpy(params.clientId, CLIENT_ID);
@ -246,20 +246,20 @@ bool SonyRemoteStorage_PS3::init(CallbackFunc cb, LPVOID lpParam)
// SceRemoteStorageAbortReqParams abortParams; // SceRemoteStorageAbortReqParams abortParams;
ret = sceRemoteStorageInit(params); ret = sceRemoteStorageInit(params);
if(ret >= 0 || ret == SCE_REMOTE_STORAGE_ERROR_ALREADY_INITIALISED) if(ret >= 0 || ret == SCE_REMOTE_STORAGE_ERROR_ALREADY_INITIALISED)
{ {
// abortParams.requestId = ret; // abortParams.requestId = ret;
//ret = sceRemoteStorageAbort(abortParams); //ret = sceRemoteStorageAbort(abortParams);
app.DebugPrintf("Session will be created \n"); app.DebugPrintf("Session will be created \n");
//if(ret >= 0) //if(ret >= 0)
//{ //{
// printf("Session aborted \n"); // printf("Session aborted \n");
//} else //} else
//{ //{
// printf("Error aborting session: 0x%x \n", ret); // printf("Error aborting session: 0x%x \n", ret);
//} //}
} }
else else
{ {
app.DebugPrintf("Error creating session: 0x%x \n", ret); app.DebugPrintf("Error creating session: 0x%x \n", ret);
return false; return false;
@ -279,12 +279,12 @@ bool SonyRemoteStorage_PS3::getRemoteFileInfo(SceRemoteStorageStatus* pInfo, Cal
reqId = sceRemoteStorageGetStatus(params, outputGetStatus); reqId = sceRemoteStorageGetStatus(params, outputGetStatus);
m_status = e_getStatusInProgress; m_status = e_getStatusInProgress;
if(reqId >= 0) if(reqId >= 0)
{ {
app.DebugPrintf("Get Status request sent \n"); app.DebugPrintf("Get Status request sent \n");
return true; return true;
} }
else else
{ {
app.DebugPrintf("Error sending Get Status request: 0x%x \n", reqId); app.DebugPrintf("Error sending Get Status request: 0x%x \n", reqId);
return false; return false;
@ -303,11 +303,11 @@ void SonyRemoteStorage_PS3::abort()
params.requestId = reqId; params.requestId = reqId;
int ret = sceRemoteStorageAbort(params); int ret = sceRemoteStorageAbort(params);
if(ret >= 0) if(ret >= 0)
{ {
app.DebugPrintf("Abort request done \n"); app.DebugPrintf("Abort request done \n");
} }
else else
{ {
app.DebugPrintf("Error in Abort request: 0x%x \n", ret); app.DebugPrintf("Error in Abort request: 0x%x \n", ret);
} }
@ -345,7 +345,7 @@ bool SonyRemoteStorage_PS3::setDataInternal()
char seed[22]; char seed[22];
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
__int64 iSeed = strtoll(seed,NULL,10); int64_t iSeed = strtoll(seed,NULL,10);
char seedHex[17]; char seedHex[17];
sprintf(seedHex,"%016llx",iSeed); sprintf(seedHex,"%016llx",iSeed);
memcpy(descData.m_seed,seedHex,16); // Don't copy null memcpy(descData.m_seed,seedHex,16); // Don't copy null
@ -377,14 +377,14 @@ bool SonyRemoteStorage_PS3::setDataInternal()
reqId = sceRemoteStorageSetData(params); reqId = sceRemoteStorageSetData(params);
app.DebugPrintf("\n*******************************\n"); app.DebugPrintf("\n*******************************\n");
if(reqId >= 0) if(reqId >= 0)
{ {
app.DebugPrintf("Set Data request sent \n"); app.DebugPrintf("Set Data request sent \n");
m_bTransferStarted = true; m_bTransferStarted = true;
m_status = e_setDataInProgress; m_status = e_setDataInProgress;
return true; return true;
} }
else else
{ {
app.DebugPrintf("Error sending Set Data request: 0x%x \n", reqId); app.DebugPrintf("Error sending Set Data request: 0x%x \n", reqId);
return false; return false;
@ -406,12 +406,12 @@ bool SonyRemoteStorage_PS3::getData( const char* remotePath, const char* localPa
reqId = sceRemoteStorageGetData(params, &outputGetData); reqId = sceRemoteStorageGetData(params, &outputGetData);
app.DebugPrintf("\n*******************************\n"); app.DebugPrintf("\n*******************************\n");
if(reqId >= 0) if(reqId >= 0)
{ {
app.DebugPrintf("Get Data request sent \n"); app.DebugPrintf("Get Data request sent \n");
m_bTransferStarted = true; m_bTransferStarted = true;
m_status = e_getDataInProgress; m_status = e_getDataInProgress;
} else } else
{ {
app.DebugPrintf("Error sending Get Data request: 0x%x \n", reqId); app.DebugPrintf("Error sending Get Data request: 0x%x \n", reqId);
} }

View file

@ -16,8 +16,8 @@ typedef unsigned int uint32;
typedef unsigned long long uint64; typedef unsigned long long uint64;
typedef long long int64; typedef long long int64;
#else #else
typedef unsigned __int64 uint64; typedef unsigned long long uint64;
typedef __int64 int64; typedef long long int64;
#endif #endif
typedef char int8; typedef char int8;

View file

@ -671,7 +671,7 @@ HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData) { PS3
BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) { PS3_STUBBED; return false;} BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) { PS3_STUBBED; return false;}
errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%d",_Value); else if(_Radix==16) sprintf(_DstBuf,"%lx",_Value); else return -1; return 0; } errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%d",_Value); else if(_Radix==16) sprintf(_DstBuf,"%lx",_Value); else return -1; return 0; }
errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; } errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; }
int _wtoi(const wchar_t *_Str) int _wtoi(const wchar_t *_Str)
{ {

View file

@ -29,7 +29,7 @@ LPVOID TlsGetValue(DWORD dwTlsIndex);
BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue); BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue);
typedef struct _RECT typedef struct _RECT
{ {
LONG left; LONG left;
LONG top; LONG top;
@ -53,16 +53,16 @@ typedef int errno_t;
// // The following field is used for blocking when there is contention for // // The following field is used for blocking when there is contention for
// // the resource // // the resource
// // // //
// //
// union { // union {
// ULONG_PTR RawEvent[4]; // ULONG_PTR RawEvent[4];
// } Synchronization; // } Synchronization;
// //
// // // //
// // The following three fields control entering and exiting the critical // // The following three fields control entering and exiting the critical
// // section for the resource // // section for the resource
// // // //
// //
// LONG LockCount; // LONG LockCount;
// LONG RecursionCount; // LONG RecursionCount;
// HANDLE OwningThread; // HANDLE OwningThread;
@ -219,7 +219,7 @@ typedef struct _MEMORYSTATUS {
#define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE #define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE
#define WAIT_TIMEOUT 258L #define WAIT_TIMEOUT 258L
#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L) #define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L)
#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0 ) + 0 ) #define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0 ) + 0 )
#define MAXUINT_PTR (~((UINT_PTR)0)) #define MAXUINT_PTR (~((UINT_PTR)0))
@ -261,17 +261,17 @@ typedef struct _MEMORYSTATUS {
#define GENERIC_EXECUTE (0x20000000L) #define GENERIC_EXECUTE (0x20000000L)
#define GENERIC_ALL (0x10000000L) #define GENERIC_ALL (0x10000000L)
#define FILE_SHARE_READ 0x00000001 #define FILE_SHARE_READ 0x00000001
#define FILE_SHARE_WRITE 0x00000002 #define FILE_SHARE_WRITE 0x00000002
#define FILE_SHARE_DELETE 0x00000004 #define FILE_SHARE_DELETE 0x00000004
#define FILE_ATTRIBUTE_READONLY 0x00000001 #define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_DEVICE 0x00000040 #define FILE_ATTRIBUTE_DEVICE 0x00000040
#define FILE_ATTRIBUTE_NORMAL 0x00000080 #define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
#define FILE_FLAG_WRITE_THROUGH 0x80000000 #define FILE_FLAG_WRITE_THROUGH 0x80000000
#define FILE_FLAG_OVERLAPPED 0x40000000 #define FILE_FLAG_OVERLAPPED 0x40000000
@ -291,38 +291,38 @@ typedef struct _MEMORYSTATUS {
#define OPEN_ALWAYS 4 #define OPEN_ALWAYS 4
#define TRUNCATE_EXISTING 5 #define TRUNCATE_EXISTING 5
#define PAGE_NOACCESS 0x01 #define PAGE_NOACCESS 0x01
#define PAGE_READONLY 0x02 #define PAGE_READONLY 0x02
#define PAGE_READWRITE 0x04 #define PAGE_READWRITE 0x04
#define PAGE_WRITECOPY 0x08 #define PAGE_WRITECOPY 0x08
#define PAGE_EXECUTE 0x10 #define PAGE_EXECUTE 0x10
#define PAGE_EXECUTE_READ 0x20 #define PAGE_EXECUTE_READ 0x20
#define PAGE_EXECUTE_READWRITE 0x40 #define PAGE_EXECUTE_READWRITE 0x40
#define PAGE_EXECUTE_WRITECOPY 0x80 #define PAGE_EXECUTE_WRITECOPY 0x80
#define PAGE_GUARD 0x100 #define PAGE_GUARD 0x100
#define PAGE_NOCACHE 0x200 #define PAGE_NOCACHE 0x200
#define PAGE_WRITECOMBINE 0x400 #define PAGE_WRITECOMBINE 0x400
#define PAGE_USER_READONLY 0x1000 #define PAGE_USER_READONLY 0x1000
#define PAGE_USER_READWRITE 0x2000 #define PAGE_USER_READWRITE 0x2000
#define MEM_COMMIT 0x1000 #define MEM_COMMIT 0x1000
#define MEM_RESERVE 0x2000 #define MEM_RESERVE 0x2000
#define MEM_DECOMMIT 0x4000 #define MEM_DECOMMIT 0x4000
#define MEM_RELEASE 0x8000 #define MEM_RELEASE 0x8000
#define MEM_FREE 0x10000 #define MEM_FREE 0x10000
#define MEM_PRIVATE 0x20000 #define MEM_PRIVATE 0x20000
#define MEM_RESET 0x80000 #define MEM_RESET 0x80000
#define MEM_TOP_DOWN 0x100000 #define MEM_TOP_DOWN 0x100000
#define MEM_NOZERO 0x800000 #define MEM_NOZERO 0x800000
#define MEM_LARGE_PAGES 0x20000000 #define MEM_LARGE_PAGES 0x20000000
#define MEM_HEAP 0x40000000 #define MEM_HEAP 0x40000000
#define MEM_16MB_PAGES 0x80000000 #define MEM_16MB_PAGES 0x80000000
#define IGNORE 0 // Ignore signal #define IGNORE 0 // Ignore signal
#define INFINITE 0xFFFFFFFF // Infinite timeout #define INFINITE 0xFFFFFFFF // Infinite timeout
#define WAIT_FAILED ((DWORD)0xFFFFFFFF) #define WAIT_FAILED ((DWORD)0xFFFFFFFF)
#define STATUS_WAIT_0 ((DWORD )0x00000000L) #define STATUS_WAIT_0 ((DWORD )0x00000000L)
#define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 ) #define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 )
#define STATUS_PENDING ((DWORD )0x00000103L) #define STATUS_PENDING ((DWORD )0x00000103L)
#define STILL_ACTIVE STATUS_PENDING #define STILL_ACTIVE STATUS_PENDING
DWORD GetLastError(VOID); DWORD GetLastError(VOID);
@ -364,11 +364,11 @@ VOID OutputDebugString(LPCSTR lpOutputString);
VOID OutputDebugStringA(LPCSTR lpOutputString); VOID OutputDebugStringA(LPCSTR lpOutputString);
errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix); errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix);
errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix); errno_t _i64toa_s(int64_t _Val, char * _DstBuf, size_t _Size, int _Radix);
int _wtoi(const wchar_t *_Str); int _wtoi(const wchar_t *_Str);
#define __declspec(a) #define __declspec(a)
extern "C" int _wcsicmp (const wchar_t * dst, const wchar_t * src); extern "C" int _wcsicmp (const wchar_t * dst, const wchar_t * src);
size_t wcsnlen(const wchar_t *wcs, size_t maxsize); size_t wcsnlen(const wchar_t *wcs, size_t maxsize);

View file

@ -7,7 +7,8 @@
#define BOOST_ENABLE_ASSERT_HANDLER #define BOOST_ENABLE_ASSERT_HANDLER
#include <typeinfo> #include <typeinfo>
#include <stddef.h> #include <cstdint>
#include <cstddef>
#include <boost/typeof/typeof.hpp> #include <boost/typeof/typeof.hpp>
#include <boost/tr1/memory.hpp> #include <boost/tr1/memory.hpp>
#include "boost/tr1/unordered_map.hpp" #include "boost/tr1/unordered_map.hpp"
@ -110,21 +111,19 @@ typedef unsigned int *PUINT;
typedef unsigned char byte; typedef unsigned char byte;
typedef long long __int64;
typedef unsigned long long __uint64;
typedef unsigned long DWORD; typedef unsigned long DWORD;
typedef int INT; typedef int INT;
typedef unsigned long ULONG_PTR, *PULONG_PTR; typedef unsigned long ULONG_PTR, *PULONG_PTR;
typedef ULONG_PTR SIZE_T, *PSIZE_T; typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef __int64 LONG64, *PLONG64; typedef long long LONG64, *PLONG64;
#define VOID void #define VOID void
typedef char CHAR; typedef char CHAR;
typedef short SHORT; typedef short SHORT;
typedef long LONG; typedef long LONG;
typedef __int64 LONGLONG; typedef int64_t LONGLONG;
typedef __uint64 ULONGLONG; typedef uint64_t ULONGLONG;
#define CONST const #define CONST const

View file

@ -469,7 +469,7 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType)
LoadSaveDataThreadParam* LoadSaveFromDisk(const wstring& pathName) LoadSaveDataThreadParam* LoadSaveFromDisk(const wstring& pathName)
{ {
File saveFile(pathName); File saveFile(pathName);
__int64 fileSize = saveFile.length(); int64_t fileSize = saveFile.length();
FileInputStream fis(saveFile); FileInputStream fis(saveFile);
byteArray ba(fileSize); byteArray ba(fileSize);
fis.read(ba); fis.read(ba);
@ -507,8 +507,8 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
StorageManager.SetSaveTitle(wWorldName.c_str()); StorageManager.SetSaveTitle(wWorldName.c_str());
bool isFlat = false; bool isFlat = false;
__int64 seedValue = 0;//BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements int64_t seedValue = 0;//BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
// __int64 seedValue = 0xfd97203ebdbf5c6f; // int64_t seedValue = 0xfd97203ebdbf5c6f;
unsigned int seedLow = (unsigned int )(seedValue & 0xffffffff); unsigned int seedLow = (unsigned int )(seedValue & 0xffffffff);
unsigned int seedHigh = (unsigned int )(seedValue>>32); unsigned int seedHigh = (unsigned int )(seedValue>>32);
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE

View file

@ -17,9 +17,9 @@
// To meet these requirements, this class is now implemented using a lock-free system, implemented using a read-copy-update (RCU) type algorithm. Some details... // To meet these requirements, this class is now implemented using a lock-free system, implemented using a read-copy-update (RCU) type algorithm. Some details...
// (1) The storage details for the class are now packed into a single __int64, which contains both a pointer to the data that is required and a count of how many planes worth // (1) The storage details for the class are now packed into a single int64_t, which contains both a pointer to the data that is required and a count of how many planes worth
// of storage are allocated. This allows the full storage to be updated atomically using compare and exchange operations (implemented with InterlockedCompareExchangeRelease64). // of storage are allocated. This allows the full storage to be updated atomically using compare and exchange operations (implemented with InterlockedCompareExchangeRelease64).
// (2) The data pointer referenced in this __int64 points to an area of memory which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere the plane indices, and // (2) The data pointer referenced in this int64_t points to an area of memory which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere the plane indices, and
// the rest of the data is variable in size to accomodate however many planes are required to be stored // the rest of the data is variable in size to accomodate however many planes are required to be stored
// (3) The RCU bit of the algorithm means that any read operations don't need to do any checks or locks at all. When the data needs to be updated, a copy of it is made and updated, // (3) The RCU bit of the algorithm means that any read operations don't need to do any checks or locks at all. When the data needs to be updated, a copy of it is made and updated,
// then an attempt is made to swap the new data in - if this succeeds then the old data pointer is deleted later at some point where we know nothing will be reading from it anymore. // then an attempt is made to swap the new data in - if this succeeds then the old data pointer is deleted later at some point where we know nothing will be reading from it anymore.
@ -33,7 +33,7 @@ class SparseDataStorage_SPU
{ {
private: private:
// unsigned char planeIndices[128]; // unsigned char planeIndices[128];
unsigned char* m_pData; unsigned char* m_pData;
// unsigned char *data; // unsigned char *data;
// unsigned int allocatedPlaneCount; // unsigned int allocatedPlaneCount;

View file

@ -20,9 +20,9 @@
// To meet these requirements, this class is now implemented using a lock-free system, implemented using a read-copy-update (RCU) type algorithm. Some details... // To meet these requirements, this class is now implemented using a lock-free system, implemented using a read-copy-update (RCU) type algorithm. Some details...
// (1) The storage details for the class are now packed into a single __int64, which contains both a pointer to the data that is required and a count of how many planes worth // (1) The storage details for the class are now packed into a single int64_t, which contains both a pointer to the data that is required and a count of how many planes worth
// of storage are allocated. This allows the full storage to be updated atomically using compare and exchange operations (implemented with InterlockedCompareExchangeRelease64). // of storage are allocated. This allows the full storage to be updated atomically using compare and exchange operations (implemented with InterlockedCompareExchangeRelease64).
// (2) The data pointer referenced in this __int64 points to an area of memory which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere the plane indices, and // (2) The data pointer referenced in this int64_t points to an area of memory which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere the plane indices, and
// the rest of the data is variable in size to accomodate however many planes are required to be stored // the rest of the data is variable in size to accomodate however many planes are required to be stored
// (3) The RCU bit of the algorithm means that any read operations don't need to do any checks or locks at all. When the data needs to be updated, a copy of it is made and updated, // (3) The RCU bit of the algorithm means that any read operations don't need to do any checks or locks at all. When the data needs to be updated, a copy of it is made and updated,
// then an attempt is made to swap the new data in - if this succeeds then the old data pointer is deleted later at some point where we know nothing will be reading from it anymore. // then an attempt is made to swap the new data in - if this succeeds then the old data pointer is deleted later at some point where we know nothing will be reading from it anymore.
@ -36,7 +36,7 @@ class SparseLightStorage_SPU
{ {
private: private:
// unsigned char planeIndices[128]; // unsigned char planeIndices[128];
unsigned char* m_pData; unsigned char* m_pData;
// unsigned char *data; // unsigned char *data;
// unsigned int allocatedPlaneCount; // unsigned int allocatedPlaneCount;

View file

@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#ifdef __i386__ #ifdef __i386__
#define __RADX86__ #define __RADX86__
#else #else
#define __RADARM__ #define __RADARM__
#endif #endif
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -132,7 +132,7 @@
#define __RADX86__ #define __RADX86__
#else #else
#error Unknown processor #error Unknown processor
#endif #endif
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -155,7 +155,7 @@
#define __RADNACL__ #define __RADNACL__
#define __RAD32__ #define __RAD32__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define __RADX86__ #define __RADX86__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -196,7 +196,7 @@
#define __RAD64REGS__ #define __RAD64REGS__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
@ -265,7 +265,7 @@
#endif #endif
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__ #define __RADWIIU__
@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */ #undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#endif #endif
@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else #else
// NOTE: / / is a guaranteed parse error in C/C++. // NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif #endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff // WARNING : RAD_TLS should really only be used for debug/tools stuff
@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect : // helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... } // if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@ -1324,7 +1324,7 @@
__pragma(warning(push)) \ __pragma(warning(push)) \
__pragma(warning(disable:4127)) \ __pragma(warning(disable:4127)) \
} while(0) \ } while(0) \
__pragma(warning(pop)) __pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \ __pragma(warning(push)) \
@ -1333,10 +1333,10 @@
__pragma(warning(pop)) __pragma(warning(pop))
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \ #define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 ) } while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 ) } while ( (void)1,1 )
@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
RAD_STATEMENT_END_FALSE RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \ #define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c // Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later #if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x # define RR_UNUSED_VARIABLE(x) (void) x
#else #else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null : // just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr ); // you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@ -1482,7 +1482,7 @@
// Cache / prefetch macros : // Cache / prefetch macros :
// RR_PREFETCH for various platforms : // RR_PREFETCH for various platforms :
// //
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here // platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//----------------------------------------------------------- //-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break // RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK #ifdef RAD_NO_BREAK
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//----------------------------------- //-----------------------------------
#ifdef RR_DO_ASSERTS #ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long mov eax, DWORD PTR _Long
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300) #if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64) #pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) #define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__) #elif defined(__RADCELL__)
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__) #elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. //APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else #else

File diff suppressed because it is too large Load diff

View file

@ -114,8 +114,8 @@
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#ifdef __i386__ #ifdef __i386__
#define __RADX86__ #define __RADX86__
#else #else
#define __RADARM__ #define __RADARM__
#endif #endif
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -132,7 +132,7 @@
#define __RADX86__ #define __RADX86__
#else #else
#error Unknown processor #error Unknown processor
#endif #endif
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -155,7 +155,7 @@
#define __RADNACL__ #define __RADNACL__
#define __RAD32__ #define __RAD32__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define __RADX86__ #define __RADX86__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
@ -196,7 +196,7 @@
#define __RAD64REGS__ #define __RAD64REGS__
#define __RADLITTLEENDIAN__ #define __RADLITTLEENDIAN__
#define RADINLINE inline #define RADINLINE inline
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
@ -265,7 +265,7 @@
#endif #endif
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it
#define __RADWIIU__ #define __RADWIIU__
@ -480,7 +480,7 @@
#undef RADRESTRICT /* could have been defined above... */ #undef RADRESTRICT /* could have been defined above... */
#define RADRESTRICT __restrict #define RADRESTRICT __restrict
#undef RADSTRUCT #undef RADSTRUCT
#define RADSTRUCT struct __attribute__((__packed__)) #define RADSTRUCT struct __attribute__((__packed__))
#endif #endif
@ -885,7 +885,7 @@
#define RAD_ALIGN(type,var,num) type __declspec(align(num)) var #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var
#else #else
// NOTE: / / is a guaranteed parse error in C/C++. // NOTE: / / is a guaranteed parse error in C/C++.
#define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / /
#endif #endif
// WARNING : RAD_TLS should really only be used for debug/tools stuff // WARNING : RAD_TLS should really only be used for debug/tools stuff
@ -917,8 +917,8 @@
#define RAD_S32 signed int #define RAD_S32 signed int
// But pointers are 64 bits. // But pointers are 64 bits.
#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
#define RAD_SINTa __w64 signed __int64 #define RAD_SINTa __w64 signed long long
#define RAD_UINTa __w64 unsigned __int64 #define RAD_UINTa __w64 unsigned long long
#else // non-vc.net compiler or /Wp64 turned off #else // non-vc.net compiler or /Wp64 turned off
#define RAD_UINTa unsigned long long #define RAD_UINTa unsigned long long
#define RAD_SINTa signed long long #define RAD_SINTa signed long long
@ -976,8 +976,8 @@
#define RAD_U64 unsigned long long #define RAD_U64 unsigned long long
#define RAD_S64 signed long long #define RAD_S64 signed long long
#elif defined(__RADX64__) || defined(__RAD32__) #elif defined(__RADX64__) || defined(__RAD32__)
#define RAD_U64 unsigned __int64 #define RAD_U64 unsigned long long
#define RAD_S64 signed __int64 #define RAD_S64 signed long long
#else #else
// 16-bit // 16-bit
typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s
@ -1134,7 +1134,7 @@
// helpers for doing an if ( ) with expect : // helpers for doing an if ( ) with expect :
// if ( RAD_LIKELY(expr) ) { ... } // if ( RAD_LIKELY(expr) ) { ... }
#define RAD_LIKELY(expr) RAD_EXPECT(expr,1) #define RAD_LIKELY(expr) RAD_EXPECT(expr,1)
#define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0)
@ -1324,7 +1324,7 @@
__pragma(warning(push)) \ __pragma(warning(push)) \
__pragma(warning(disable:4127)) \ __pragma(warning(disable:4127)) \
} while(0) \ } while(0) \
__pragma(warning(pop)) __pragma(warning(pop))
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
__pragma(warning(push)) \ __pragma(warning(push)) \
@ -1333,10 +1333,10 @@
__pragma(warning(pop)) __pragma(warning(pop))
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#else #else
#define RAD_USE_STANDARD_LOOP_CONSTRUCT #define RAD_USE_STANDARD_LOOP_CONSTRUCT
#endif #endif
#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT
@ -1345,7 +1345,7 @@
#define RAD_STATEMENT_END_FALSE \ #define RAD_STATEMENT_END_FALSE \
} while ( (void)0,0 ) } while ( (void)0,0 )
#define RAD_STATEMENT_END_TRUE \ #define RAD_STATEMENT_END_TRUE \
} while ( (void)1,1 ) } while ( (void)1,1 )
@ -1355,7 +1355,7 @@
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
RAD_STATEMENT_END_FALSE RAD_STATEMENT_END_FALSE
#define RAD_INFINITE_LOOP( code ) \ #define RAD_INFINITE_LOOP( code ) \
RAD_STATEMENT_START \ RAD_STATEMENT_START \
code \ code \
@ -1363,7 +1363,7 @@
// Must be placed after variable declarations for code compiled as .c // Must be placed after variable declarations for code compiled as .c
#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later #if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later
# define RR_UNUSED_VARIABLE(x) (void) x # define RR_UNUSED_VARIABLE(x) (void) x
#else #else
# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) # define RR_UNUSED_VARIABLE(x) (void)(sizeof(x))
@ -1473,7 +1473,7 @@
// just to make gcc shut up about derefing null : // just to make gcc shut up about derefing null :
#define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) )
#define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) )
// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object
// you should then RR_ASSERT( &(ret->member) == ptr ); // you should then RR_ASSERT( &(ret->member) == ptr );
#define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) )
@ -1482,7 +1482,7 @@
// Cache / prefetch macros : // Cache / prefetch macros :
// RR_PREFETCH for various platforms : // RR_PREFETCH for various platforms :
// //
// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan
// platforms that automatically prefetch sequential (eg. PC) should be a no-op here // platforms that automatically prefetch sequential (eg. PC) should be a no-op here
// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined // RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined
@ -1707,7 +1707,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) #define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 )
//----------------------------------------------------------- //-----------------------------------------------------------
// RAD_NO_BREAK : option if you don't like your assert to break // RAD_NO_BREAK : option if you don't like your assert to break
// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional
#ifdef RAD_NO_BREAK #ifdef RAD_NO_BREAK
@ -1725,7 +1725,7 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion;
#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) #define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } )
//----------------------------------- //-----------------------------------
#ifdef RR_DO_ASSERTS #ifdef RR_DO_ASSERTS
#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) #define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp)
#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp)
@ -1883,7 +1883,7 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
#define RR_BSWAP16 _byteswap_ushort #define RR_BSWAP16 _byteswap_ushort
#define RR_BSWAP32 _byteswap_ulong #define RR_BSWAP32 _byteswap_ulong
unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 val); unsigned long long __cdecl _byteswap_uint64 (unsigned long long val);
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define RR_BSWAP64 _byteswap_uint64 #define RR_BSWAP64 _byteswap_uint64
@ -1909,7 +1909,7 @@ RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long)
return _Long; return _Long;
} }
RADFORCEINLINE unsigned __int64 RR_BSWAP64 (unsigned __int64 _Long) RADFORCEINLINE unsigned long long RR_BSWAP64 (unsigned long long _Long)
{ {
__asm { __asm {
mov eax, DWORD PTR _Long mov eax, DWORD PTR _Long
@ -2250,10 +2250,10 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas
#if ( defined(_MSC_VER) && _MSC_VER >= 1300) #if ( defined(_MSC_VER) && _MSC_VER >= 1300)
unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift); unsigned long long __cdecl _rotl64(unsigned long long _Val, int _Shift);
#pragma intrinsic(_rotl64) #pragma intrinsic(_rotl64)
#define RR_ROTL64(x,k) _rotl64((unsigned __int64)(x),(int)(k)) #define RR_ROTL64(x,k) _rotl64((unsigned long long)(x),(int)(k))
#elif defined(__RADCELL__) #elif defined(__RADCELL__)
@ -2262,7 +2262,7 @@ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val, int _Shift);
#elif defined(__RADLINUX__) || defined(__RADMACAPI__) #elif defined(__RADLINUX__) || defined(__RADMACAPI__)
//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. //APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above.
#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) )
#else #else

View file

@ -26,7 +26,7 @@ DWORD TlsAlloc(VOID);
LPVOID TlsGetValue(DWORD dwTlsIndex); LPVOID TlsGetValue(DWORD dwTlsIndex);
BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue); BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue);
typedef struct _RECT typedef struct _RECT
{ {
LONG left; LONG left;
LONG top; LONG top;
@ -34,13 +34,13 @@ typedef struct _RECT
LONG bottom; LONG bottom;
} RECT, *PRECT; } RECT, *PRECT;
typedef struct _TOUCHSCREENRECT typedef struct _TOUCHSCREENRECT
{ {
SceInt16 left; SceInt16 left;
SceInt16 top; SceInt16 top;
SceInt16 right; SceInt16 right;
SceInt16 bottom; SceInt16 bottom;
} }
TOUCHSCREENRECT, *PTOUCHSCREENRECT; TOUCHSCREENRECT, *PTOUCHSCREENRECT;
typedef void ID3D11Device; typedef void ID3D11Device;
@ -58,16 +58,16 @@ typedef int errno_t;
// // The following field is used for blocking when there is contention for // // The following field is used for blocking when there is contention for
// // the resource // // the resource
// // // //
// //
// union { // union {
// ULONG_PTR RawEvent[4]; // ULONG_PTR RawEvent[4];
// } Synchronization; // } Synchronization;
// //
// // // //
// // The following three fields control entering and exiting the critical // // The following three fields control entering and exiting the critical
// // section for the resource // // section for the resource
// // // //
// //
// LONG LockCount; // LONG LockCount;
// LONG RecursionCount; // LONG RecursionCount;
// HANDLE OwningThread; // HANDLE OwningThread;
@ -261,7 +261,7 @@ typedef struct _MEMORYSTATUS {
#define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE #define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE
#define WAIT_TIMEOUT 258L #define WAIT_TIMEOUT 258L
#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L) #define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L)
#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0 ) + 0 ) #define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0 ) + 0 )
#define MAXUINT_PTR (~((UINT_PTR)0)) #define MAXUINT_PTR (~((UINT_PTR)0))
@ -303,17 +303,17 @@ typedef struct _MEMORYSTATUS {
#define GENERIC_EXECUTE (0x20000000L) #define GENERIC_EXECUTE (0x20000000L)
#define GENERIC_ALL (0x10000000L) #define GENERIC_ALL (0x10000000L)
#define FILE_SHARE_READ 0x00000001 #define FILE_SHARE_READ 0x00000001
#define FILE_SHARE_WRITE 0x00000002 #define FILE_SHARE_WRITE 0x00000002
#define FILE_SHARE_DELETE 0x00000004 #define FILE_SHARE_DELETE 0x00000004
#define FILE_ATTRIBUTE_READONLY 0x00000001 #define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_DEVICE 0x00000040 #define FILE_ATTRIBUTE_DEVICE 0x00000040
#define FILE_ATTRIBUTE_NORMAL 0x00000080 #define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
#define FILE_FLAG_WRITE_THROUGH 0x80000000 #define FILE_FLAG_WRITE_THROUGH 0x80000000
#define FILE_FLAG_OVERLAPPED 0x40000000 #define FILE_FLAG_OVERLAPPED 0x40000000
@ -333,38 +333,38 @@ typedef struct _MEMORYSTATUS {
#define OPEN_ALWAYS 4 #define OPEN_ALWAYS 4
#define TRUNCATE_EXISTING 5 #define TRUNCATE_EXISTING 5
#define PAGE_NOACCESS 0x01 #define PAGE_NOACCESS 0x01
#define PAGE_READONLY 0x02 #define PAGE_READONLY 0x02
#define PAGE_READWRITE 0x04 #define PAGE_READWRITE 0x04
#define PAGE_WRITECOPY 0x08 #define PAGE_WRITECOPY 0x08
#define PAGE_EXECUTE 0x10 #define PAGE_EXECUTE 0x10
#define PAGE_EXECUTE_READ 0x20 #define PAGE_EXECUTE_READ 0x20
#define PAGE_EXECUTE_READWRITE 0x40 #define PAGE_EXECUTE_READWRITE 0x40
#define PAGE_EXECUTE_WRITECOPY 0x80 #define PAGE_EXECUTE_WRITECOPY 0x80
#define PAGE_GUARD 0x100 #define PAGE_GUARD 0x100
#define PAGE_NOCACHE 0x200 #define PAGE_NOCACHE 0x200
#define PAGE_WRITECOMBINE 0x400 #define PAGE_WRITECOMBINE 0x400
#define PAGE_USER_READONLY 0x1000 #define PAGE_USER_READONLY 0x1000
#define PAGE_USER_READWRITE 0x2000 #define PAGE_USER_READWRITE 0x2000
#define MEM_COMMIT 0x1000 #define MEM_COMMIT 0x1000
#define MEM_RESERVE 0x2000 #define MEM_RESERVE 0x2000
#define MEM_DECOMMIT 0x4000 #define MEM_DECOMMIT 0x4000
#define MEM_RELEASE 0x8000 #define MEM_RELEASE 0x8000
#define MEM_FREE 0x10000 #define MEM_FREE 0x10000
#define MEM_PRIVATE 0x20000 #define MEM_PRIVATE 0x20000
#define MEM_RESET 0x80000 #define MEM_RESET 0x80000
#define MEM_TOP_DOWN 0x100000 #define MEM_TOP_DOWN 0x100000
#define MEM_NOZERO 0x800000 #define MEM_NOZERO 0x800000
#define MEM_LARGE_PAGES 0x20000000 #define MEM_LARGE_PAGES 0x20000000
#define MEM_HEAP 0x40000000 #define MEM_HEAP 0x40000000
#define MEM_16MB_PAGES 0x80000000 #define MEM_16MB_PAGES 0x80000000
#define IGNORE 0 // Ignore signal #define IGNORE 0 // Ignore signal
#define INFINITE 0xFFFFFFFF // Infinite timeout #define INFINITE 0xFFFFFFFF // Infinite timeout
#define WAIT_FAILED ((DWORD)0xFFFFFFFF) #define WAIT_FAILED ((DWORD)0xFFFFFFFF)
#define STATUS_WAIT_0 ((DWORD )0x00000000L) #define STATUS_WAIT_0 ((DWORD )0x00000000L)
#define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 ) #define WAIT_OBJECT_0 ((STATUS_WAIT_0 ) + 0 )
#define STATUS_PENDING ((DWORD )0x00000103L) #define STATUS_PENDING ((DWORD )0x00000103L)
#define STILL_ACTIVE STATUS_PENDING #define STILL_ACTIVE STATUS_PENDING
DWORD GetLastError(VOID); DWORD GetLastError(VOID);
@ -403,9 +403,9 @@ VOID OutputDebugString(LPCSTR lpOutputString);
VOID OutputDebugStringA(LPCSTR lpOutputString); VOID OutputDebugStringA(LPCSTR lpOutputString);
errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix); errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix);
errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix); errno_t _i64toa_s(long long _Val, char * _DstBuf, size_t _Size, int _Radix);
#define __declspec(a) #define __declspec(a)
extern "C" int _wcsicmp (const wchar_t * dst, const wchar_t * src); extern "C" int _wcsicmp (const wchar_t * dst, const wchar_t * src);
size_t wcsnlen(const wchar_t *wcs, size_t maxsize); size_t wcsnlen(const wchar_t *wcs, size_t maxsize);

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
//#include "winerror.h" #include <cstdint>
typedef unsigned int DWORD; typedef unsigned int DWORD;
typedef int BOOL; typedef int BOOL;
@ -34,14 +34,12 @@ typedef unsigned int *PUINT;
typedef unsigned char byte; typedef unsigned char byte;
typedef long long __int64;
typedef unsigned long long __uint64;
typedef unsigned int DWORD; typedef unsigned int DWORD;
typedef int INT; typedef int INT;
typedef unsigned long ULONG_PTR, *PULONG_PTR; typedef unsigned long ULONG_PTR, *PULONG_PTR;
typedef ULONG_PTR SIZE_T, *PSIZE_T; typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef __int64 LONG64, *PLONG64; typedef long long LONG64, *PLONG64;
#define VOID void #define VOID void
typedef char CHAR; typedef char CHAR;

View file

@ -56,42 +56,42 @@ void PSVitaInit()
int err = sceFiosInitialize(&params); int err = sceFiosInitialize(&params);
assert(err == SCE_FIOS_OK); assert(err == SCE_FIOS_OK);
} }
char* getConsoleHomePath() char* getConsoleHomePath()
{ {
return contentInfoPath; return contentInfoPath;
} }
char* getUsrDirRoot() char* getUsrDirRoot()
{ {
return driveRoot; return driveRoot;
} }
char* getUsrDirPath() char* getUsrDirPath()
{ {
return usrdirPath; return usrdirPath;
} }
char* getConsoleHomePathBDPatch() char* getConsoleHomePathBDPatch()
{ {
return contentInfoPathBDPatch; return contentInfoPathBDPatch;
} }
char* getUsrDirPathBDPatch() char* getUsrDirPathBDPatch()
{ {
return usrdirPathBDPatch; return usrdirPathBDPatch;
} }
char* getDirName() char* getDirName()
{ {
return dirName; return dirName;
} }
int _wcsicmp( const wchar_t * dst, const wchar_t * src ) int _wcsicmp( const wchar_t * dst, const wchar_t * src )
{ {
wchar_t f,l; wchar_t f,l;
// validation section // validation section
// _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR); // _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR);
// _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR); // _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR);
@ -117,7 +117,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize)
return n; return n;
} }
VOID GetSystemTime( LPSYSTEMTIME lpSystemTime) VOID GetSystemTime( LPSYSTEMTIME lpSystemTime)
{ {
SceDateTime dateTime; SceDateTime dateTime;
int err = sceRtcGetCurrentClock(&dateTime, 0); int err = sceRtcGetCurrentClock(&dateTime, 0);
@ -133,8 +133,8 @@ VOID GetSystemTime( LPSYSTEMTIME lpSystemTime)
lpSystemTime->wMilliseconds = sceRtcGetMicrosecond(&dateTime)/1000; lpSystemTime->wMilliseconds = sceRtcGetMicrosecond(&dateTime)/1000;
} }
BOOL FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) { PSVITA_STUBBED; return false; } BOOL FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) { PSVITA_STUBBED; return false; }
BOOL SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) BOOL SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime)
{ {
SceUInt64 diffHundredNanos; SceUInt64 diffHundredNanos;
SceDateTime dateTime; SceDateTime dateTime;
int err = sceRtcGetCurrentClock(&dateTime, 0); int err = sceRtcGetCurrentClock(&dateTime, 0);
@ -143,11 +143,11 @@ BOOL SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime)
lpFileTime->dwHighDateTime = diffHundredNanos >> 32; lpFileTime->dwHighDateTime = diffHundredNanos >> 32;
lpFileTime->dwLowDateTime = diffHundredNanos & 0xffffffff; lpFileTime->dwLowDateTime = diffHundredNanos & 0xffffffff;
return true; return true;
} }
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
{ {
SceDateTime dateTime; SceDateTime dateTime;
int err = sceRtcGetCurrentClockLocalTime(&dateTime); int err = sceRtcGetCurrentClockLocalTime(&dateTime);
assert(err == SCE_OK); assert(err == SCE_OK);
@ -163,26 +163,26 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
} }
HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PSVITA_STUBBED; return NULL; } HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PSVITA_STUBBED; return NULL; }
VOID Sleep(DWORD dwMilliseconds) VOID Sleep(DWORD dwMilliseconds)
{ {
C4JThread::Sleep(dwMilliseconds); C4JThread::Sleep(dwMilliseconds);
} }
BOOL SetThreadPriority(HANDLE hThread, int nPriority) { PSVITA_STUBBED; return FALSE; } BOOL SetThreadPriority(HANDLE hThread, int nPriority) { PSVITA_STUBBED; return FALSE; }
DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds) { PSVITA_STUBBED; return false; } DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds) { PSVITA_STUBBED; return false; }
LONG InterlockedCompareExchangeRelease(LONG volatile *Destination, LONG Exchange,LONG Comperand ) LONG InterlockedCompareExchangeRelease(LONG volatile *Destination, LONG Exchange,LONG Comperand )
{ {
return sceAtomicCompareAndSwap32((int32_t*)Destination, (int32_t)Comperand, (int32_t)Exchange); return sceAtomicCompareAndSwap32((int32_t*)Destination, (int32_t)Comperand, (int32_t)Exchange);
} }
LONG64 InterlockedCompareExchangeRelease64(LONG64 volatile *Destination, LONG64 Exchange, LONG64 Comperand) LONG64 InterlockedCompareExchangeRelease64(LONG64 volatile *Destination, LONG64 Exchange, LONG64 Comperand)
{ {
return sceAtomicCompareAndSwap64((int64_t*)Destination, (int64_t)Comperand, (int64_t)Exchange); return sceAtomicCompareAndSwap64((int64_t*)Destination, (int64_t)Comperand, (int64_t)Exchange);
} }
VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection) VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection)
{ {
char name[1] = {0}; char name[1] = {0};
@ -191,7 +191,7 @@ VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection)
} }
VOID InitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION CriticalSection, ULONG SpinCount) VOID InitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION CriticalSection, ULONG SpinCount)
{ {
// no spin count on PSVita // no spin count on PSVita
InitializeCriticalSection(CriticalSection); InitializeCriticalSection(CriticalSection);
@ -203,16 +203,16 @@ VOID DeleteCriticalSection(PCRITICAL_SECTION CriticalSection)
PSVITA_ASSERT_SCE_ERROR(err); PSVITA_ASSERT_SCE_ERROR(err);
} }
extern CRITICAL_SECTION g_singleThreadCS; extern CRITICAL_SECTION g_singleThreadCS;
VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection) VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection)
{ {
int err = sceKernelLockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1, NULL); int err = sceKernelLockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1, NULL);
PSVITA_ASSERT_SCE_ERROR(err); PSVITA_ASSERT_SCE_ERROR(err);
} }
VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection) VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection)
{ {
int err = sceKernelUnlockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1); int err = sceKernelUnlockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1);
PSVITA_ASSERT_SCE_ERROR(err); PSVITA_ASSERT_SCE_ERROR(err);
@ -272,8 +272,8 @@ VOID LeaveCriticalRWSection(PCRITICAL_RW_SECTION CriticalSection, bool Write)
BOOL CloseHandle(HANDLE hObject) BOOL CloseHandle(HANDLE hObject)
{ {
sceFiosFHCloseSync(NULL,(SceFiosFH)((int32_t)hObject)); sceFiosFHCloseSync(NULL,(SceFiosFH)((int32_t)hObject));
return true; return true;
} }
@ -292,8 +292,8 @@ BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) { return PSVitaTLSStorage:
static void* VirtualAllocs[1000]; // a list of 1MB allocations static void* VirtualAllocs[1000]; // a list of 1MB allocations
static int VirtualNumAllocs = 0; // how many 1MB chunks have been allocated static int VirtualNumAllocs = 0; // how many 1MB chunks have been allocated
LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
{ {
if( flAllocationType == MEM_COMMIT ) if( flAllocationType == MEM_COMMIT )
{ {
// how many pages do we need // how many pages do we need
@ -319,7 +319,7 @@ LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWO
return (void*) VIRTUAL_OFFSET; return (void*) VIRTUAL_OFFSET;
} }
BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType)
{ {
while( VirtualNumAllocs ) while( VirtualNumAllocs )
{ {
@ -333,7 +333,7 @@ BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType)
// memset a section of the virtual chunks // memset a section of the virtual chunks
VOID VirtualMemset(LPVOID lpDestOffset, int val, SIZE_T dwSize) VOID VirtualMemset(LPVOID lpDestOffset, int val, SIZE_T dwSize)
{ {
int DestOffset = ((int)(lpDestOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset int DestOffset = ((int)(lpDestOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset
int StartPage = DestOffset / VIRTUAL_PAGE_SIZE; // which 1MB page do we start on int StartPage = DestOffset / VIRTUAL_PAGE_SIZE; // which 1MB page do we start on
@ -371,7 +371,7 @@ VOID VirtualMemset(LPVOID lpDestOffset, int val, SIZE_T dwSize)
// copy a block of memory to the virtual chunks // copy a block of memory to the virtual chunks
VOID VirtualCopyTo(LPVOID lpDestOffset, LPVOID lpSrc, SIZE_T dwSize) VOID VirtualCopyTo(LPVOID lpDestOffset, LPVOID lpSrc, SIZE_T dwSize)
{ {
int DestOffset = ((int)(lpDestOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset int DestOffset = ((int)(lpDestOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset
int StartPage = DestOffset / VIRTUAL_PAGE_SIZE; // which 1MB page do we start on int StartPage = DestOffset / VIRTUAL_PAGE_SIZE; // which 1MB page do we start on
@ -410,7 +410,7 @@ VOID VirtualCopyTo(LPVOID lpDestOffset, LPVOID lpSrc, SIZE_T dwSize)
} }
// copy a block of memory from the virtual chunks // copy a block of memory from the virtual chunks
VOID VirtualCopyFrom(LPVOID lpDest, LPVOID lpSrcOffset, SIZE_T dwSize) VOID VirtualCopyFrom(LPVOID lpDest, LPVOID lpSrcOffset, SIZE_T dwSize)
{ {
int SrcOffset = ((int)(lpSrcOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset int SrcOffset = ((int)(lpSrcOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset
int StartPage = SrcOffset / VIRTUAL_PAGE_SIZE; // which 1MB page do we start on int StartPage = SrcOffset / VIRTUAL_PAGE_SIZE; // which 1MB page do we start on
@ -449,7 +449,7 @@ VOID VirtualCopyFrom(LPVOID lpDest, LPVOID lpSrcOffset, SIZE_T dwSize)
} }
// copy a block of memory between the virtual chunks // copy a block of memory between the virtual chunks
VOID VirtualMove(LPVOID lpDestOffset, LPVOID lpSrcOffset, SIZE_T dwSize) VOID VirtualMove(LPVOID lpDestOffset, LPVOID lpSrcOffset, SIZE_T dwSize)
{ {
int DestOffset = ((int)(lpDestOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset int DestOffset = ((int)(lpDestOffset) - VIRTUAL_OFFSET); // convert the pointer back into a virtual offset
int DestChunkOffset = DestOffset % VIRTUAL_PAGE_SIZE; // what is the byte offset within the current 1MB page int DestChunkOffset = DestOffset % VIRTUAL_PAGE_SIZE; // what is the byte offset within the current 1MB page
@ -652,7 +652,7 @@ DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh )
{ {
SceFiosFH fh = (SceFiosFH)(hFile); SceFiosFH fh = (SceFiosFH)(hFile);
// 4J Stu - sceFiosFHGetSize didn't seem to work...so doing this for now // 4J Stu - sceFiosFHGetSize didn't seem to work...so doing this for now
//SceFiosSize FileSize; //SceFiosSize FileSize;
//FileSize=sceFiosFHGetSize(fh); //FileSize=sceFiosFHGetSize(fh);
SceFiosStat statData; SceFiosStat statData;
@ -694,7 +694,7 @@ BOOL WriteFile( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPD
return FALSE; return FALSE;
} }
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped )
{ {
SceFiosFH fh = (SceFiosFH)((int64_t)hFile); SceFiosFH fh = (SceFiosFH)((int64_t)hFile);
// sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes. // sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes.
@ -743,7 +743,7 @@ void replaceBackslashes(char* szFilename)
} }
} }
HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{ {
char filePath[256]; char filePath[256];
std::string mountedPath = StorageManager.GetMountedPath(lpFileName); std::string mountedPath = StorageManager.GetMountedPath(lpFileName);
@ -768,7 +768,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
printf("*** Opening %s\n",filePath); printf("*** Opening %s\n",filePath);
#endif #endif
SceFiosFH fh; SceFiosFH fh;
int err = sceFiosFHOpenSync(NULL, &fh, filePath, NULL); int err = sceFiosFHOpenSync(NULL, &fh, filePath, NULL);
assert( err == SCE_FIOS_OK ); assert( err == SCE_FIOS_OK );
@ -776,8 +776,8 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
return (void*)fh; return (void*)fh;
} }
BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes) BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{ {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
char filePath[256]; char filePath[256];
sprintf(filePath,"%s/%s",usrdirPath, lpPathName ); sprintf(filePath,"%s/%s",usrdirPath, lpPathName );
@ -794,12 +794,12 @@ BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttribu
BOOL DeleteFileA(LPCSTR lpFileName) { PSVITA_STUBBED; return false; } BOOL DeleteFileA(LPCSTR lpFileName) { PSVITA_STUBBED; return false; }
// BOOL XCloseHandle(HANDLE a) // BOOL XCloseHandle(HANDLE a)
// { // {
// cellFsClose(int(a)); // cellFsClose(int(a));
// } // }
DWORD GetFileAttributesA(LPCSTR lpFileName) DWORD GetFileAttributesA(LPCSTR lpFileName)
{ {
char filePath[256]; char filePath[256];
std::string mountedPath = StorageManager.GetMountedPath(lpFileName); std::string mountedPath = StorageManager.GetMountedPath(lpFileName);
@ -835,7 +835,7 @@ VOID DebugBreak(VOID) { SCE_BREAK(); }
DWORD GetLastError(VOID) { PSVITA_STUBBED; return 0; } DWORD GetLastError(VOID) { PSVITA_STUBBED; return 0; }
VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
{ {
PSVITA_STUBBED; PSVITA_STUBBED;
/* malloc_managed_size stat; /* malloc_managed_size stat;
@ -850,9 +850,9 @@ VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
lpBuffer->dwAvailVirtual = stat.max_system_size - stat.current_inuse_size;*/ lpBuffer->dwAvailVirtual = stat.max_system_size - stat.current_inuse_size;*/
} }
DWORD GetTickCount() DWORD GetTickCount()
{ {
// This function returns the current system time at this function is called. // This function returns the current system time at this function is called.
// The system time is represented the time elapsed since the system starts up in microseconds. // The system time is represented the time elapsed since the system starts up in microseconds.
uint64_t sysTime = sceKernelGetProcessTimeWide(); uint64_t sysTime = sceKernelGetProcessTimeWide();
@ -861,11 +861,11 @@ DWORD GetTickCount()
} }
// we should really use libperf for this kind of thing, but this will do for now. // we should really use libperf for this kind of thing, but this will do for now.
BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency) BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)
{ {
// microseconds // microseconds
lpFrequency->QuadPart = (1000 * 1000); lpFrequency->QuadPart = (1000 * 1000);
return false; return false;
} }
BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount) BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
{ {
@ -875,24 +875,24 @@ BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
} }
#ifndef _FINAL_BUILD #ifndef _FINAL_BUILD
VOID OutputDebugStringW(LPCWSTR lpOutputString) VOID OutputDebugStringW(LPCWSTR lpOutputString)
{ {
wprintf(lpOutputString); wprintf(lpOutputString);
} }
VOID OutputDebugString(LPCSTR lpOutputString) VOID OutputDebugString(LPCSTR lpOutputString)
{ {
printf(lpOutputString); printf(lpOutputString);
} }
VOID OutputDebugStringA(LPCSTR lpOutputString) VOID OutputDebugStringA(LPCSTR lpOutputString)
{ {
printf(lpOutputString); printf(lpOutputString);
} }
#endif // _CONTENT_PACKAGE #endif // _CONTENT_PACKAGE
BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation) BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation)
{ {
WIN32_FILE_ATTRIBUTE_DATA *fileInfoBuffer = (WIN32_FILE_ATTRIBUTE_DATA*) lpFileInformation; WIN32_FILE_ATTRIBUTE_DATA *fileInfoBuffer = (WIN32_FILE_ATTRIBUTE_DATA*) lpFileInformation;
char filePath[256]; char filePath[256];
@ -921,27 +921,27 @@ BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,
} }
HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData) HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
{ {
PSVITA_STUBBED; PSVITA_STUBBED;
return 0; return 0;
} }
BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData)
{ {
PSVITA_STUBBED; PSVITA_STUBBED;
return false; return false;
} }
errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%d",_Value); else if(_Radix==16) sprintf(_DstBuf,"%lx",_Value); else return -1; return 0; } errno_t _itoa_s(int _Value, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%d",_Value); else if(_Radix==16) sprintf(_DstBuf,"%lx",_Value); else return -1; return 0; }
errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; } errno_t _i64toa_s(long long _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_Radix==10) sprintf(_DstBuf,"%lld",_Val); else return -1; return 0; }
int _wtoi(const wchar_t *_Str) int _wtoi(const wchar_t *_Str)
{ {
return wcstol(_Str, NULL, 10); return wcstol(_Str, NULL, 10);
} }
DWORD XGetLanguage() DWORD XGetLanguage()
{ {
// check if we should override the system language or not // check if we should override the system language or not
unsigned char ucLang = app.GetMinecraftLanguage(0); unsigned char ucLang = app.GetMinecraftLanguage(0);
if (ucLang != MINECRAFT_LANGUAGE_DEFAULT) return ucLang; if (ucLang != MINECRAFT_LANGUAGE_DEFAULT) return ucLang;
@ -979,8 +979,8 @@ DWORD XGetLanguage()
} }
} }
DWORD XGetLocale() DWORD XGetLocale()
{ {
// check if we should override the system locale or not // check if we should override the system locale or not
unsigned char ucLocale = app.GetMinecraftLocale(0); unsigned char ucLocale = app.GetMinecraftLocale(0);
if (ucLocale != MINECRAFT_LANGUAGE_DEFAULT) return ucLocale; if (ucLocale != MINECRAFT_LANGUAGE_DEFAULT) return ucLocale;
@ -993,7 +993,7 @@ DWORD XGetLocale()
case SCE_SYSTEM_PARAM_LANG_ENGLISH_US : return XC_LOCALE_UNITED_STATES; case SCE_SYSTEM_PARAM_LANG_ENGLISH_US : return XC_LOCALE_UNITED_STATES;
case SCE_SYSTEM_PARAM_LANG_FRENCH : return XC_LOCALE_FRANCE; case SCE_SYSTEM_PARAM_LANG_FRENCH : return XC_LOCALE_FRANCE;
case SCE_SYSTEM_PARAM_LANG_SPANISH : case SCE_SYSTEM_PARAM_LANG_SPANISH :
if(app.IsAmericanSKU()) if(app.IsAmericanSKU())
{ {
return XC_LOCALE_LATIN_AMERICA; return XC_LOCALE_LATIN_AMERICA;
@ -1027,7 +1027,7 @@ DWORD XGetLocale()
} }
} }
DWORD XEnableGuestSignin(BOOL fEnable) DWORD XEnableGuestSignin(BOOL fEnable)
{ {
return 0; return 0;
} }

View file

@ -29,8 +29,8 @@
#if ! LIBDIVIDE_HAS_STDINT_TYPES #if ! LIBDIVIDE_HAS_STDINT_TYPES
typedef __int32 int32_t; typedef __int32 int32_t;
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
typedef __int64 int64_t; typedef long long int64_t;
typedef unsigned __int64 uint64_t; typedef unsigned long long uint64_t;
typedef __int8 int8_t; typedef __int8 int8_t;
typedef unsigned __int8 uint8_t; typedef unsigned __int8 uint8_t;
#endif #endif
@ -83,7 +83,7 @@ u32: [0-4] shift value
[5] ignored [5] ignored
[6] add indicator [6] add indicator
[7] shift path [7] shift path
s32: [0-4] shift value s32: [0-4] shift value
[5] shift path [5] shift path
[6] add indicator [6] add indicator
@ -106,7 +106,7 @@ enum {
LIBDIVIDE_U32_SHIFT_PATH = 0x80, LIBDIVIDE_U32_SHIFT_PATH = 0x80,
LIBDIVIDE_U64_SHIFT_PATH = 0x80, LIBDIVIDE_U64_SHIFT_PATH = 0x80,
LIBDIVIDE_S32_SHIFT_PATH = 0x20, LIBDIVIDE_S32_SHIFT_PATH = 0x20,
LIBDIVIDE_NEGATIVE_DIVISOR = 0x80 LIBDIVIDE_NEGATIVE_DIVISOR = 0x80
}; };
@ -123,7 +123,7 @@ struct libdivide_s32_t {
struct libdivide_u64_t { struct libdivide_u64_t {
uint64_t magic; uint64_t magic;
uint8_t more; uint8_t more;
}; };
struct libdivide_s64_t { struct libdivide_s64_t {
int64_t magic; int64_t magic;
@ -146,7 +146,7 @@ LIBDIVIDE_API struct libdivide_s32_t libdivide_s32_gen(int32_t y);
LIBDIVIDE_API struct libdivide_u32_t libdivide_u32_gen(uint32_t y); LIBDIVIDE_API struct libdivide_u32_t libdivide_u32_gen(uint32_t y);
LIBDIVIDE_API struct libdivide_s64_t libdivide_s64_gen(int64_t y); LIBDIVIDE_API struct libdivide_s64_t libdivide_s64_gen(int64_t y);
LIBDIVIDE_API struct libdivide_u64_t libdivide_u64_gen(uint64_t y); LIBDIVIDE_API struct libdivide_u64_t libdivide_u64_gen(uint64_t y);
LIBDIVIDE_API int32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t *denom);
LIBDIVIDE_API uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom); LIBDIVIDE_API uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom);
LIBDIVIDE_API int64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t *denom); LIBDIVIDE_API int64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t *denom);
@ -156,19 +156,19 @@ LIBDIVIDE_API int libdivide_u32_get_algorithm(const struct libdivide_u32_t *deno
LIBDIVIDE_API uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom); LIBDIVIDE_API uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom);
LIBDIVIDE_API uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom); LIBDIVIDE_API uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom);
LIBDIVIDE_API uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom); LIBDIVIDE_API uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom);
LIBDIVIDE_API int libdivide_u64_get_algorithm(const struct libdivide_u64_t *denom); LIBDIVIDE_API int libdivide_u64_get_algorithm(const struct libdivide_u64_t *denom);
LIBDIVIDE_API uint64_t libdivide_u64_do_alg0(uint64_t numer, const struct libdivide_u64_t *denom); LIBDIVIDE_API uint64_t libdivide_u64_do_alg0(uint64_t numer, const struct libdivide_u64_t *denom);
LIBDIVIDE_API uint64_t libdivide_u64_do_alg1(uint64_t numer, const struct libdivide_u64_t *denom); LIBDIVIDE_API uint64_t libdivide_u64_do_alg1(uint64_t numer, const struct libdivide_u64_t *denom);
LIBDIVIDE_API uint64_t libdivide_u64_do_alg2(uint64_t numer, const struct libdivide_u64_t *denom); LIBDIVIDE_API uint64_t libdivide_u64_do_alg2(uint64_t numer, const struct libdivide_u64_t *denom);
LIBDIVIDE_API int libdivide_s32_get_algorithm(const struct libdivide_s32_t *denom); LIBDIVIDE_API int libdivide_s32_get_algorithm(const struct libdivide_s32_t *denom);
LIBDIVIDE_API int32_t libdivide_s32_do_alg0(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg0(int32_t numer, const struct libdivide_s32_t *denom);
LIBDIVIDE_API int32_t libdivide_s32_do_alg1(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg1(int32_t numer, const struct libdivide_s32_t *denom);
LIBDIVIDE_API int32_t libdivide_s32_do_alg2(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg2(int32_t numer, const struct libdivide_s32_t *denom);
LIBDIVIDE_API int32_t libdivide_s32_do_alg3(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg3(int32_t numer, const struct libdivide_s32_t *denom);
LIBDIVIDE_API int32_t libdivide_s32_do_alg4(int32_t numer, const struct libdivide_s32_t *denom); LIBDIVIDE_API int32_t libdivide_s32_do_alg4(int32_t numer, const struct libdivide_s32_t *denom);
LIBDIVIDE_API int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom); LIBDIVIDE_API int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom);
LIBDIVIDE_API int64_t libdivide_s64_do_alg0(int64_t numer, const struct libdivide_s64_t *denom); LIBDIVIDE_API int64_t libdivide_s64_do_alg0(int64_t numer, const struct libdivide_s64_t *denom);
LIBDIVIDE_API int64_t libdivide_s64_do_alg1(int64_t numer, const struct libdivide_s64_t *denom); LIBDIVIDE_API int64_t libdivide_s64_do_alg1(int64_t numer, const struct libdivide_s64_t *denom);
@ -202,17 +202,17 @@ LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg2(__m128i numers, const struct
LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg3(__m128i numers, const struct libdivide_s64_t * denom); LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg3(__m128i numers, const struct libdivide_s64_t * denom);
LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_t * denom); LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_t * denom);
#endif #endif
//////// Internal Utility Functions //////// Internal Utility Functions
static inline uint32_t libdivide__mullhi_u32(uint32_t x, uint32_t y) { static inline uint32_t libdivide__mullhi_u32(uint32_t x, uint32_t y) {
uint64_t xl = x, yl = y; uint64_t xl = x, yl = y;
uint64_t rl = xl * yl; uint64_t rl = xl * yl;
return (uint32_t)(rl >> 32); return (uint32_t)(rl >> 32);
} }
static uint64_t libdivide__mullhi_u64(uint64_t x, uint64_t y) { static uint64_t libdivide__mullhi_u64(uint64_t x, uint64_t y) {
#if HAS_INT128_T #if HAS_INT128_T
__uint128_t xl = x, yl = y; __uint128_t xl = x, yl = y;
@ -227,18 +227,18 @@ static uint64_t libdivide__mullhi_u64(uint64_t x, uint64_t y) {
const uint64_t x0y1 = x0 * (uint64_t)y1; const uint64_t x0y1 = x0 * (uint64_t)y1;
const uint64_t x1y0 = x1 * (uint64_t)y0; const uint64_t x1y0 = x1 * (uint64_t)y0;
const uint64_t x1y1 = x1 * (uint64_t)y1; const uint64_t x1y1 = x1 * (uint64_t)y1;
uint64_t temp = x1y0 + x0y0_hi; uint64_t temp = x1y0 + x0y0_hi;
uint64_t temp_lo = temp & mask, temp_hi = temp >> 32; uint64_t temp_lo = temp & mask, temp_hi = temp >> 32;
return x1y1 + temp_hi + ((temp_lo + x0y1) >> 32); return x1y1 + temp_hi + ((temp_lo + x0y1) >> 32);
#endif #endif
} }
static inline int64_t libdivide__mullhi_s64(int64_t x, int64_t y) { static inline int64_t libdivide__mullhi_s64(int64_t x, int64_t y) {
#if HAS_INT128_T #if HAS_INT128_T
__int128_t xl = x, yl = y; __int128_t xl = x, yl = y;
__int128_t rl = xl * yl; __int128_t rl = xl * yl;
return (int64_t)(rl >> 64); return (int64_t)(rl >> 64);
#else #else
//full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64) //full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64)
const uint32_t mask = 0xFFFFFFFF; const uint32_t mask = 0xFFFFFFFF;
@ -250,7 +250,7 @@ static inline int64_t libdivide__mullhi_s64(int64_t x, int64_t y) {
return x1*(int64_t)y1 + (t >> 32) + (w1 >> 32); return x1*(int64_t)y1 + (t >> 32) + (w1 >> 32);
#endif #endif
} }
#if LIBDIVIDE_USE_SSE2 #if LIBDIVIDE_USE_SSE2
static inline __m128i libdivide__u64_to_m128(uint64_t x) { static inline __m128i libdivide__u64_to_m128(uint64_t x) {
@ -275,7 +275,7 @@ static inline __m128i libdivide_get_FFFFFFFF00000000(void) {
__m128i result = _mm_set1_epi8(-1); //optimizes to pcmpeqd on OS X __m128i result = _mm_set1_epi8(-1); //optimizes to pcmpeqd on OS X
return _mm_slli_epi64(result, 32); return _mm_slli_epi64(result, 32);
} }
static inline __m128i libdivide_get_00000000FFFFFFFF(void) { static inline __m128i libdivide_get_00000000FFFFFFFF(void) {
//returns the same as _mm_set1_epi64(0x00000000FFFFFFFFULL) without touching memory //returns the same as _mm_set1_epi64(0x00000000FFFFFFFFULL) without touching memory
__m128i result = _mm_set1_epi8(-1); //optimizes to pcmpeqd on OS X __m128i result = _mm_set1_epi8(-1); //optimizes to pcmpeqd on OS X
@ -288,7 +288,7 @@ static inline __m128i libdivide_get_0000FFFF(void) {
__m128i result; //we don't care what its contents are __m128i result; //we don't care what its contents are
result = _mm_cmpeq_epi8(result, result); //all 1s result = _mm_cmpeq_epi8(result, result); //all 1s
result = _mm_srli_epi32(result, 16); result = _mm_srli_epi32(result, 16);
return result; return result;
} }
static inline __m128i libdivide_s64_signbits(__m128i v) { static inline __m128i libdivide_s64_signbits(__m128i v) {
@ -302,7 +302,7 @@ static inline __m128i libdivide_s64_signbits(__m128i v) {
static inline __m128i libdivide_u32_to_m128i(uint32_t amt) { static inline __m128i libdivide_u32_to_m128i(uint32_t amt) {
return _mm_set_epi32(0, 0, 0, amt); return _mm_set_epi32(0, 0, 0, amt);
} }
static inline __m128i libdivide_s64_shift_right_vector(__m128i v, int amt) { static inline __m128i libdivide_s64_shift_right_vector(__m128i v, int amt) {
//implementation of _mm_sra_epi64. Here we have two 64 bit values which are shifted right to logically become (64 - amt) values, and are then sign extended from a (64 - amt) bit number. //implementation of _mm_sra_epi64. Here we have two 64 bit values which are shifted right to logically become (64 - amt) values, and are then sign extended from a (64 - amt) bit number.
const int b = 64 - amt; const int b = 64 - amt;
@ -320,7 +320,7 @@ static inline __m128i libdivide__mullhi_u32_flat_vector(__m128i a, __m128i b) {
return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123 return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123
} }
/* Here, y is assumed to contain one 64 bit value repeated twice. */ /* Here, y is assumed to contain one 64 bit value repeated twice. */
static inline __m128i libdivide_mullhi_u64_flat_vector(__m128i x, __m128i y) { static inline __m128i libdivide_mullhi_u64_flat_vector(__m128i x, __m128i y) {
//full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64) //full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64)
@ -331,12 +331,12 @@ static inline __m128i libdivide_mullhi_u64_flat_vector(__m128i x, __m128i y) {
const __m128i x0y1 = _mm_mul_epu32(x0, y1); const __m128i x0y1 = _mm_mul_epu32(x0, y1);
const __m128i x1y0 = _mm_mul_epu32(x1, y0); const __m128i x1y0 = _mm_mul_epu32(x1, y0);
const __m128i x1y1 = _mm_mul_epu32(x1, y1); const __m128i x1y1 = _mm_mul_epu32(x1, y1);
const __m128i temp = _mm_add_epi64(x1y0, x0y0_hi); const __m128i temp = _mm_add_epi64(x1y0, x0y0_hi);
__m128i temp_lo = _mm_and_si128(temp, mask), temp_hi = _mm_srli_epi64(temp, 32); __m128i temp_lo = _mm_and_si128(temp, mask), temp_hi = _mm_srli_epi64(temp, 32);
temp_lo = _mm_srli_epi64(_mm_add_epi64(temp_lo, x0y1), 32); temp_lo = _mm_srli_epi64(_mm_add_epi64(temp_lo, x0y1), 32);
temp_hi = _mm_add_epi64(x1y1, temp_hi); temp_hi = _mm_add_epi64(x1y1, temp_hi);
return _mm_add_epi64(temp_lo, temp_hi); return _mm_add_epi64(temp_lo, temp_hi);
} }
@ -349,9 +349,9 @@ static inline __m128i libdivide_mullhi_s64_flat_vector(__m128i x, __m128i y) {
p = _mm_sub_epi64(p, t2); p = _mm_sub_epi64(p, t2);
return p; return p;
} }
#ifdef LIBDIVIDE_USE_SSE4_1 #ifdef LIBDIVIDE_USE_SSE4_1
/* b is one 32 bit value repeated four times. */ /* b is one 32 bit value repeated four times. */
static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) { static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) {
__m128i hi_product_0Z2Z = _mm_srli_epi64(_mm_mul_epi32(a, b), 32); __m128i hi_product_0Z2Z = _mm_srli_epi64(_mm_mul_epi32(a, b), 32);
@ -359,7 +359,7 @@ static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) {
__m128i hi_product_Z1Z3 = _mm_and_si128(_mm_mul_epi32(a1X3X, b), libdivide_get_FFFFFFFF00000000()); __m128i hi_product_Z1Z3 = _mm_and_si128(_mm_mul_epi32(a1X3X, b), libdivide_get_FFFFFFFF00000000());
return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123 return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123
} }
#else #else
/* SSE2 does not have a signed multiplication instruction, but we can convert unsigned to signed pretty efficiently. Again, b is just a 32 bit value repeated four times. */ /* SSE2 does not have a signed multiplication instruction, but we can convert unsigned to signed pretty efficiently. Again, b is just a 32 bit value repeated four times. */
@ -373,7 +373,7 @@ static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) {
} }
#endif #endif
#endif #endif
static inline int32_t libdivide__count_trailing_zeros32(uint32_t val) { static inline int32_t libdivide__count_trailing_zeros32(uint32_t val) {
#if __GNUC__ || __has_builtin(__builtin_ctz) #if __GNUC__ || __has_builtin(__builtin_ctz)
/* Fast way to count trailing zeros */ /* Fast way to count trailing zeros */
@ -389,7 +389,7 @@ static inline int32_t libdivide__count_trailing_zeros32(uint32_t val) {
return result; return result;
#endif #endif
} }
static inline int32_t libdivide__count_trailing_zeros64(uint64_t val) { static inline int32_t libdivide__count_trailing_zeros64(uint64_t val) {
#if __LP64__ && (__GNUC__ || __has_builtin(__builtin_ctzll)) #if __LP64__ && (__GNUC__ || __has_builtin(__builtin_ctzll))
/* Fast way to count trailing zeros. Note that we disable this in 32 bit because gcc does something horrible - it calls through to a dynamically bound function. */ /* Fast way to count trailing zeros. Note that we disable this in 32 bit because gcc does something horrible - it calls through to a dynamically bound function. */
@ -401,11 +401,11 @@ static inline int32_t libdivide__count_trailing_zeros64(uint64_t val) {
return 32 + libdivide__count_trailing_zeros32((uint32_t)(val >> 32)); return 32 + libdivide__count_trailing_zeros32((uint32_t)(val >> 32));
#endif #endif
} }
static inline int32_t libdivide__count_leading_zeros32(uint32_t val) { static inline int32_t libdivide__count_leading_zeros32(uint32_t val) {
#if __GNUC__ || __has_builtin(__builtin_clzll) #if __GNUC__ || __has_builtin(__builtin_clzll)
/* Fast way to count leading zeros */ /* Fast way to count leading zeros */
return __builtin_clz(val); return __builtin_clz(val);
#else #else
/* Dorky way to count leading zeros. Note that this hangs for val = 0! */ /* Dorky way to count leading zeros. Note that this hangs for val = 0! */
int32_t result = 0; int32_t result = 0;
@ -413,10 +413,10 @@ static inline int32_t libdivide__count_leading_zeros32(uint32_t val) {
val <<= 1; val <<= 1;
result++; result++;
} }
return result; return result;
#endif #endif
} }
static inline int32_t libdivide__count_leading_zeros64(uint64_t val) { static inline int32_t libdivide__count_leading_zeros64(uint64_t val) {
#if __GNUC__ || __has_builtin(__builtin_clzll) #if __GNUC__ || __has_builtin(__builtin_clzll)
/* Fast way to count leading zeros */ /* Fast way to count leading zeros */
@ -450,7 +450,7 @@ static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v,
return result; return result;
} }
#endif #endif
#if LIBDIVIDE_IS_X86_64 && LIBDIVIDE_GCC_STYLE_ASM #if LIBDIVIDE_IS_X86_64 && LIBDIVIDE_GCC_STYLE_ASM
static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) { static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) {
//u0 -> rax //u0 -> rax
@ -465,10 +465,10 @@ static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v,
} }
#else #else
/* Code taken from Hacker's Delight, http://www.hackersdelight.org/HDcode/divlu.c . License permits inclusion here per http://www.hackersdelight.org/permissions.htm /* Code taken from Hacker's Delight, http://www.hackersdelight.org/HDcode/divlu.c . License permits inclusion here per http://www.hackersdelight.org/permissions.htm
*/ */
static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) { static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) {
const uint64_t b = (1ULL << 32); // Number base (16 bits). const uint64_t b = (1ULL << 32); // Number base (16 bits).
uint64_t un1, un0, // Norm. dividend LSD's. uint64_t un1, un0, // Norm. dividend LSD's.
vn1, vn0, // Norm. divisor digits. vn1, vn0, // Norm. divisor digits.
@ -476,25 +476,25 @@ static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v,
un64, un21, un10,// Dividend digit pairs. un64, un21, un10,// Dividend digit pairs.
rhat; // A remainder. rhat; // A remainder.
int s; // Shift amount for norm. int s; // Shift amount for norm.
if (u1 >= v) { // If overflow, set rem. if (u1 >= v) { // If overflow, set rem.
if (r != NULL) // to an impossible value, if (r != NULL) // to an impossible value,
*r = (uint64_t)(-1); // and return the largest *r = (uint64_t)(-1); // and return the largest
return (uint64_t)(-1);} // possible quotient. return (uint64_t)(-1);} // possible quotient.
/* count leading zeros */ /* count leading zeros */
s = libdivide__count_leading_zeros64(v); // 0 <= s <= 63. s = libdivide__count_leading_zeros64(v); // 0 <= s <= 63.
v = v << s; // Normalize divisor. v = v << s; // Normalize divisor.
vn1 = v >> 32; // Break divisor up into vn1 = v >> 32; // Break divisor up into
vn0 = v & 0xFFFFFFFF; // two 32-bit digits. vn0 = v & 0xFFFFFFFF; // two 32-bit digits.
un64 = (u1 << s) | ((u0 >> (64 - s)) & (-s >> 31)); un64 = (u1 << s) | ((u0 >> (64 - s)) & (-s >> 31));
un10 = u0 << s; // Shift dividend left. un10 = u0 << s; // Shift dividend left.
un1 = un10 >> 32; // Break right half of un1 = un10 >> 32; // Break right half of
un0 = un10 & 0xFFFFFFFF; // dividend into two digits. un0 = un10 & 0xFFFFFFFF; // dividend into two digits.
q1 = un64/vn1; // Compute the first q1 = un64/vn1; // Compute the first
rhat = un64 - q1*vn1; // quotient digit, q1. rhat = un64 - q1*vn1; // quotient digit, q1.
again1: again1:
@ -502,9 +502,9 @@ again1:
q1 = q1 - 1; q1 = q1 - 1;
rhat = rhat + vn1; rhat = rhat + vn1;
if (rhat < b) goto again1;} if (rhat < b) goto again1;}
un21 = un64*b + un1 - q1*v; // Multiply and subtract. un21 = un64*b + un1 - q1*v; // Multiply and subtract.
q0 = un21/vn1; // Compute the second q0 = un21/vn1; // Compute the second
rhat = un21 - q0*vn1; // quotient digit, q0. rhat = un21 - q0*vn1; // quotient digit, q0.
again2: again2:
@ -512,21 +512,21 @@ again2:
q0 = q0 - 1; q0 = q0 - 1;
rhat = rhat + vn1; rhat = rhat + vn1;
if (rhat < b) goto again2;} if (rhat < b) goto again2;}
if (r != NULL) // If remainder is wanted, if (r != NULL) // If remainder is wanted,
*r = (un21*b + un0 - q0*v) >> s; // return it. *r = (un21*b + un0 - q0*v) >> s; // return it.
return q1*b + q0; return q1*b + q0;
} }
#endif #endif
#if LIBDIVIDE_ASSERTIONS_ON #if LIBDIVIDE_ASSERTIONS_ON
#define LIBDIVIDE_ASSERT(x) do { if (! (x)) { fprintf(stderr, "Assertion failure on line %ld: %s\n", (long)__LINE__, #x); exit(-1); } } while (0) #define LIBDIVIDE_ASSERT(x) do { if (! (x)) { fprintf(stderr, "Assertion failure on line %ld: %s\n", (long)__LINE__, #x); exit(-1); } } while (0)
#else #else
#define LIBDIVIDE_ASSERT(x) #define LIBDIVIDE_ASSERT(x)
#endif #endif
#ifndef LIBDIVIDE_HEADER_ONLY #ifndef LIBDIVIDE_HEADER_ONLY
////////// UINT32 ////////// UINT32
struct libdivide_u32_t libdivide_u32_gen(uint32_t d) { struct libdivide_u32_t libdivide_u32_gen(uint32_t d) {
@ -537,14 +537,14 @@ struct libdivide_u32_t libdivide_u32_gen(uint32_t d) {
} }
else { else {
const uint32_t floor_log_2_d = 31 - libdivide__count_leading_zeros32(d); const uint32_t floor_log_2_d = 31 - libdivide__count_leading_zeros32(d);
uint8_t more; uint8_t more;
uint32_t rem, proposed_m; uint32_t rem, proposed_m;
proposed_m = libdivide_64_div_32_to_32(1U << floor_log_2_d, 0, d, &rem); proposed_m = libdivide_64_div_32_to_32(1U << floor_log_2_d, 0, d, &rem);
LIBDIVIDE_ASSERT(rem > 0 && rem < d); LIBDIVIDE_ASSERT(rem > 0 && rem < d);
const uint32_t e = d - rem; const uint32_t e = d - rem;
/* This power works if e < 2**floor_log_2_d. */ /* This power works if e < 2**floor_log_2_d. */
if (e < (1U << floor_log_2_d)) { if (e < (1U << floor_log_2_d)) {
/* This power works */ /* This power works */
@ -560,7 +560,7 @@ struct libdivide_u32_t libdivide_u32_gen(uint32_t d) {
result.magic = 1 + proposed_m; result.magic = 1 + proposed_m;
result.more = more; result.more = more;
//result.more's shift should in general be ceil_log_2_d. But if we used the smaller power, we subtract one from the shift because we're using the smaller power. If we're using the larger power, we subtract one from the shift because it's taken care of by the add indicator. So floor_log_2_d happens to be correct in both cases. //result.more's shift should in general be ceil_log_2_d. But if we used the smaller power, we subtract one from the shift because we're using the smaller power. If we're using the larger power, we subtract one from the shift because it's taken care of by the add indicator. So floor_log_2_d happens to be correct in both cases.
} }
return result; return result;
} }
@ -582,23 +582,23 @@ uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom) {
} }
} }
int libdivide_u32_get_algorithm(const struct libdivide_u32_t *denom) { int libdivide_u32_get_algorithm(const struct libdivide_u32_t *denom) {
uint8_t more = denom->more; uint8_t more = denom->more;
if (more & LIBDIVIDE_U32_SHIFT_PATH) return 0; if (more & LIBDIVIDE_U32_SHIFT_PATH) return 0;
else if (! (more & LIBDIVIDE_ADD_MARKER)) return 1; else if (! (more & LIBDIVIDE_ADD_MARKER)) return 1;
else return 2; else return 2;
} }
uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom) { uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom) {
return numer >> (denom->more & LIBDIVIDE_32_SHIFT_MASK); return numer >> (denom->more & LIBDIVIDE_32_SHIFT_MASK);
} }
uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom) { uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom) {
uint32_t q = libdivide__mullhi_u32(denom->magic, numer); uint32_t q = libdivide__mullhi_u32(denom->magic, numer);
return q >> denom->more; return q >> denom->more;
} }
uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom) { uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom) {
// denom->add != 0 // denom->add != 0
uint32_t q = libdivide__mullhi_u32(denom->magic, numer); uint32_t q = libdivide__mullhi_u32(denom->magic, numer);
@ -608,8 +608,8 @@ uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *den
#if LIBDIVIDE_USE_SSE2 #if LIBDIVIDE_USE_SSE2
__m128i libdivide_u32_do_vector(__m128i numers, const struct libdivide_u32_t *denom) { __m128i libdivide_u32_do_vector(__m128i numers, const struct libdivide_u32_t *denom) {
uint8_t more = denom->more; uint8_t more = denom->more;
if (more & LIBDIVIDE_U32_SHIFT_PATH) { if (more & LIBDIVIDE_U32_SHIFT_PATH) {
@ -622,7 +622,7 @@ __m128i libdivide_u32_do_vector(__m128i numers, const struct libdivide_u32_t *de
//return t >> denom->shift; //return t >> denom->shift;
__m128i t = _mm_add_epi32(_mm_srli_epi32(_mm_sub_epi32(numers, q), 1), q); __m128i t = _mm_add_epi32(_mm_srli_epi32(_mm_sub_epi32(numers, q), 1), q);
return _mm_srl_epi32(t, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); return _mm_srl_epi32(t, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK));
} }
else { else {
//q >> denom->shift //q >> denom->shift
@ -647,7 +647,7 @@ __m128i libdivide_u32_do_vector_alg2(__m128i numers, const struct libdivide_u32_
} }
#endif #endif
/////////// UINT64 /////////// UINT64
struct libdivide_u64_t libdivide_u64_gen(uint64_t d) { struct libdivide_u64_t libdivide_u64_gen(uint64_t d) {
@ -658,14 +658,14 @@ struct libdivide_u64_t libdivide_u64_gen(uint64_t d) {
} }
else { else {
const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(d); const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(d);
uint64_t proposed_m, rem; uint64_t proposed_m, rem;
uint8_t more; uint8_t more;
proposed_m = libdivide_128_div_64_to_64(1ULL << floor_log_2_d, 0, d, &rem); //== (1 << (64 + floor_log_2_d)) / d proposed_m = libdivide_128_div_64_to_64(1ULL << floor_log_2_d, 0, d, &rem); //== (1 << (64 + floor_log_2_d)) / d
LIBDIVIDE_ASSERT(rem > 0 && rem < d); LIBDIVIDE_ASSERT(rem > 0 && rem < d);
const uint64_t e = d - rem; const uint64_t e = d - rem;
/* This power works if e < 2**floor_log_2_d. */ /* This power works if e < 2**floor_log_2_d. */
if (e < (1ULL << floor_log_2_d)) { if (e < (1ULL << floor_log_2_d)) {
/* This power works */ /* This power works */
@ -702,30 +702,30 @@ uint64_t libdivide_u64_do(uint64_t numer, const struct libdivide_u64_t *denom) {
} }
} }
int libdivide_u64_get_algorithm(const struct libdivide_u64_t *denom) { int libdivide_u64_get_algorithm(const struct libdivide_u64_t *denom) {
uint8_t more = denom->more; uint8_t more = denom->more;
if (more & LIBDIVIDE_U64_SHIFT_PATH) return 0; if (more & LIBDIVIDE_U64_SHIFT_PATH) return 0;
else if (! (more & LIBDIVIDE_ADD_MARKER)) return 1; else if (! (more & LIBDIVIDE_ADD_MARKER)) return 1;
else return 2; else return 2;
} }
uint64_t libdivide_u64_do_alg0(uint64_t numer, const struct libdivide_u64_t *denom) { uint64_t libdivide_u64_do_alg0(uint64_t numer, const struct libdivide_u64_t *denom) {
return numer >> (denom->more & LIBDIVIDE_64_SHIFT_MASK); return numer >> (denom->more & LIBDIVIDE_64_SHIFT_MASK);
} }
uint64_t libdivide_u64_do_alg1(uint64_t numer, const struct libdivide_u64_t *denom) { uint64_t libdivide_u64_do_alg1(uint64_t numer, const struct libdivide_u64_t *denom) {
uint64_t q = libdivide__mullhi_u64(denom->magic, numer); uint64_t q = libdivide__mullhi_u64(denom->magic, numer);
return q >> denom->more; return q >> denom->more;
} }
uint64_t libdivide_u64_do_alg2(uint64_t numer, const struct libdivide_u64_t *denom) { uint64_t libdivide_u64_do_alg2(uint64_t numer, const struct libdivide_u64_t *denom) {
uint64_t q = libdivide__mullhi_u64(denom->magic, numer); uint64_t q = libdivide__mullhi_u64(denom->magic, numer);
uint64_t t = ((numer - q) >> 1) + q; uint64_t t = ((numer - q) >> 1) + q;
return t >> (denom->more & LIBDIVIDE_64_SHIFT_MASK); return t >> (denom->more & LIBDIVIDE_64_SHIFT_MASK);
} }
#if LIBDIVIDE_USE_SSE2 #if LIBDIVIDE_USE_SSE2
__m128i libdivide_u64_do_vector(__m128i numers, const struct libdivide_u64_t * denom) { __m128i libdivide_u64_do_vector(__m128i numers, const struct libdivide_u64_t * denom) {
uint8_t more = denom->more; uint8_t more = denom->more;
if (more & LIBDIVIDE_U64_SHIFT_PATH) { if (more & LIBDIVIDE_U64_SHIFT_PATH) {
@ -761,11 +761,11 @@ __m128i libdivide_u64_do_vector_alg2(__m128i numers, const struct libdivide_u64_
return _mm_srl_epi64(t, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_64_SHIFT_MASK)); return _mm_srl_epi64(t, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_64_SHIFT_MASK));
} }
#endif #endif
/////////// SINT32 /////////// SINT32
static inline int32_t libdivide__mullhi_s32(int32_t x, int32_t y) { static inline int32_t libdivide__mullhi_s32(int32_t x, int32_t y) {
int64_t xl = x, yl = y; int64_t xl = x, yl = y;
@ -775,7 +775,7 @@ static inline int32_t libdivide__mullhi_s32(int32_t x, int32_t y) {
struct libdivide_s32_t libdivide_s32_gen(int32_t d) { struct libdivide_s32_t libdivide_s32_gen(int32_t d) {
struct libdivide_s32_t result; struct libdivide_s32_t result;
/* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */ /* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */
uint32_t absD = (uint32_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick uint32_t absD = (uint32_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick
if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero
@ -784,14 +784,14 @@ struct libdivide_s32_t libdivide_s32_gen(int32_t d) {
} }
else { else {
const uint32_t floor_log_2_d = 31 - libdivide__count_leading_zeros32(absD); const uint32_t floor_log_2_d = 31 - libdivide__count_leading_zeros32(absD);
LIBDIVIDE_ASSERT(floor_log_2_d >= 1); LIBDIVIDE_ASSERT(floor_log_2_d >= 1);
uint8_t more; uint8_t more;
//the dividend here is 2**(floor_log_2_d + 31), so the low 32 bit word is 0 and the high word is floor_log_2_d - 1 //the dividend here is 2**(floor_log_2_d + 31), so the low 32 bit word is 0 and the high word is floor_log_2_d - 1
uint32_t rem, proposed_m; uint32_t rem, proposed_m;
proposed_m = libdivide_64_div_32_to_32(1U << (floor_log_2_d - 1), 0, absD, &rem); proposed_m = libdivide_64_div_32_to_32(1U << (floor_log_2_d - 1), 0, absD, &rem);
const uint32_t e = absD - rem; const uint32_t e = absD - rem;
/* We are going to start with a power of floor_log_2_d - 1. This works if works if e < 2**floor_log_2_d. */ /* We are going to start with a power of floor_log_2_d - 1. This works if works if e < 2**floor_log_2_d. */
if (e < (1U << floor_log_2_d)) { if (e < (1U << floor_log_2_d)) {
/* This power works */ /* This power works */
@ -807,7 +807,7 @@ struct libdivide_s32_t libdivide_s32_gen(int32_t d) {
proposed_m += 1; proposed_m += 1;
result.magic = (d < 0 ? -(int32_t)proposed_m : (int32_t)proposed_m); result.magic = (d < 0 ? -(int32_t)proposed_m : (int32_t)proposed_m);
result.more = more; result.more = more;
} }
return result; return result;
} }
@ -832,57 +832,57 @@ int32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t *denom) {
q += (q < 0); q += (q < 0);
return q; return q;
} }
} }
int libdivide_s32_get_algorithm(const struct libdivide_s32_t *denom) { int libdivide_s32_get_algorithm(const struct libdivide_s32_t *denom) {
uint8_t more = denom->more; uint8_t more = denom->more;
int positiveDivisor = ! (more & LIBDIVIDE_NEGATIVE_DIVISOR); int positiveDivisor = ! (more & LIBDIVIDE_NEGATIVE_DIVISOR);
if (more & LIBDIVIDE_S32_SHIFT_PATH) return (positiveDivisor ? 0 : 1); if (more & LIBDIVIDE_S32_SHIFT_PATH) return (positiveDivisor ? 0 : 1);
else if (more & LIBDIVIDE_ADD_MARKER) return (positiveDivisor ? 2 : 3); else if (more & LIBDIVIDE_ADD_MARKER) return (positiveDivisor ? 2 : 3);
else return 4; else return 4;
} }
int32_t libdivide_s32_do_alg0(int32_t numer, const struct libdivide_s32_t *denom) { int32_t libdivide_s32_do_alg0(int32_t numer, const struct libdivide_s32_t *denom) {
uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK; uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK;
int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1)); int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1));
return q >> shifter; return q >> shifter;
} }
int32_t libdivide_s32_do_alg1(int32_t numer, const struct libdivide_s32_t *denom) { int32_t libdivide_s32_do_alg1(int32_t numer, const struct libdivide_s32_t *denom) {
uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK; uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK;
int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1)); int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1));
return - (q >> shifter); return - (q >> shifter);
} }
int32_t libdivide_s32_do_alg2(int32_t numer, const struct libdivide_s32_t *denom) { int32_t libdivide_s32_do_alg2(int32_t numer, const struct libdivide_s32_t *denom) {
int32_t q = libdivide__mullhi_s32(denom->magic, numer); int32_t q = libdivide__mullhi_s32(denom->magic, numer);
q += numer; q += numer;
q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK; q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK;
q += (q < 0); q += (q < 0);
return q; return q;
} }
int32_t libdivide_s32_do_alg3(int32_t numer, const struct libdivide_s32_t *denom) { int32_t libdivide_s32_do_alg3(int32_t numer, const struct libdivide_s32_t *denom) {
int32_t q = libdivide__mullhi_s32(denom->magic, numer); int32_t q = libdivide__mullhi_s32(denom->magic, numer);
q -= numer; q -= numer;
q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK; q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK;
q += (q < 0); q += (q < 0);
return q;
}
int32_t libdivide_s32_do_alg4(int32_t numer, const struct libdivide_s32_t *denom) {
int32_t q = libdivide__mullhi_s32(denom->magic, numer);
q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK;
q += (q < 0);
return q; return q;
} }
#if LIBDIVIDE_USE_SSE2 int32_t libdivide_s32_do_alg4(int32_t numer, const struct libdivide_s32_t *denom) {
int32_t q = libdivide__mullhi_s32(denom->magic, numer);
q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK;
q += (q < 0);
return q;
}
#if LIBDIVIDE_USE_SSE2
__m128i libdivide_s32_do_vector(__m128i numers, const struct libdivide_s32_t * denom) { __m128i libdivide_s32_do_vector(__m128i numers, const struct libdivide_s32_t * denom) {
uint8_t more = denom->more; uint8_t more = denom->more;
if (more & LIBDIVIDE_S32_SHIFT_PATH) { if (more & LIBDIVIDE_S32_SHIFT_PATH) {
uint32_t shifter = more & LIBDIVIDE_32_SHIFT_MASK; uint32_t shifter = more & LIBDIVIDE_32_SHIFT_MASK;
__m128i roundToZeroTweak = _mm_set1_epi32((1 << shifter) - 1); //could use _mm_srli_epi32 with an all -1 register __m128i roundToZeroTweak = _mm_set1_epi32((1 << shifter) - 1); //could use _mm_srli_epi32 with an all -1 register
__m128i q = _mm_add_epi32(numers, _mm_and_si128(_mm_srai_epi32(numers, 31), roundToZeroTweak)); //q = numer + ((numer >> 31) & roundToZeroTweak); __m128i q = _mm_add_epi32(numers, _mm_and_si128(_mm_srai_epi32(numers, 31), roundToZeroTweak)); //q = numer + ((numer >> 31) & roundToZeroTweak);
q = _mm_sra_epi32(q, libdivide_u32_to_m128i(shifter)); // q = q >> shifter q = _mm_sra_epi32(q, libdivide_u32_to_m128i(shifter)); // q = q >> shifter
__m128i shiftMask = _mm_set1_epi32((int32_t)((int8_t)more >> 7)); //set all bits of shift mask = to the sign bit of more __m128i shiftMask = _mm_set1_epi32((int32_t)((int8_t)more >> 7)); //set all bits of shift mask = to the sign bit of more
@ -893,7 +893,7 @@ __m128i libdivide_s32_do_vector(__m128i numers, const struct libdivide_s32_t * d
__m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic));
if (more & LIBDIVIDE_ADD_MARKER) { if (more & LIBDIVIDE_ADD_MARKER) {
__m128i sign = _mm_set1_epi32((int32_t)(int8_t)more >> 7); //must be arithmetic shift __m128i sign = _mm_set1_epi32((int32_t)(int8_t)more >> 7); //must be arithmetic shift
q = _mm_add_epi32(q, _mm_sub_epi32(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign); q = _mm_add_epi32(q, _mm_sub_epi32(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign);
} }
q = _mm_sra_epi32(q, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); //q >>= shift q = _mm_sra_epi32(q, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); //q >>= shift
q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0) q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0)
@ -919,7 +919,7 @@ __m128i libdivide_s32_do_vector_alg2(__m128i numers, const struct libdivide_s32_
__m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic));
q = _mm_add_epi32(q, numers); q = _mm_add_epi32(q, numers);
q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK));
q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); q = _mm_add_epi32(q, _mm_srli_epi32(q, 31));
return q; return q;
} }
@ -927,7 +927,7 @@ __m128i libdivide_s32_do_vector_alg3(__m128i numers, const struct libdivide_s32_
__m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic));
q = _mm_sub_epi32(q, numers); q = _mm_sub_epi32(q, numers);
q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK));
q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); q = _mm_add_epi32(q, _mm_srli_epi32(q, 31));
return q; return q;
} }
@ -935,16 +935,16 @@ __m128i libdivide_s32_do_vector_alg4(__m128i numers, const struct libdivide_s32_
__m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic));
q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more)); //q >>= shift q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more)); //q >>= shift
q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0) q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0)
return q; return q;
} }
#endif #endif
///////////// SINT64 ///////////// SINT64
struct libdivide_s64_t libdivide_s64_gen(int64_t d) { struct libdivide_s64_t libdivide_s64_gen(int64_t d) {
struct libdivide_s64_t result; struct libdivide_s64_t result;
/* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */ /* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */
const uint64_t absD = (uint64_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick const uint64_t absD = (uint64_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick
if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero
@ -952,14 +952,14 @@ struct libdivide_s64_t libdivide_s64_gen(int64_t d) {
result.magic = 0; result.magic = 0;
} }
else { else {
const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(absD); const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(absD);
//the dividend here is 2**(floor_log_2_d + 63), so the low 64 bit word is 0 and the high word is floor_log_2_d - 1 //the dividend here is 2**(floor_log_2_d + 63), so the low 64 bit word is 0 and the high word is floor_log_2_d - 1
uint8_t more; uint8_t more;
uint64_t rem, proposed_m; uint64_t rem, proposed_m;
proposed_m = libdivide_128_div_64_to_64(1ULL << (floor_log_2_d - 1), 0, absD, &rem); proposed_m = libdivide_128_div_64_to_64(1ULL << (floor_log_2_d - 1), 0, absD, &rem);
const uint64_t e = absD - rem; const uint64_t e = absD - rem;
/* We are going to start with a power of floor_log_2_d - 1. This works if works if e < 2**floor_log_2_d. */ /* We are going to start with a power of floor_log_2_d - 1. This works if works if e < 2**floor_log_2_d. */
if (e < (1ULL << floor_log_2_d)) { if (e < (1ULL << floor_log_2_d)) {
/* This power works */ /* This power works */
@ -1000,9 +1000,9 @@ int64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t *denom) {
q += (q < 0); q += (q < 0);
return q; return q;
} }
} }
int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom) { int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom) {
uint8_t more = denom->more; uint8_t more = denom->more;
int positiveDivisor = ! (more & LIBDIVIDE_NEGATIVE_DIVISOR); int positiveDivisor = ! (more & LIBDIVIDE_NEGATIVE_DIVISOR);
@ -1010,20 +1010,20 @@ int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom) {
else if (more & LIBDIVIDE_ADD_MARKER) return (positiveDivisor ? 2 : 3); else if (more & LIBDIVIDE_ADD_MARKER) return (positiveDivisor ? 2 : 3);
else return 4; else return 4;
} }
int64_t libdivide_s64_do_alg0(int64_t numer, const struct libdivide_s64_t *denom) { int64_t libdivide_s64_do_alg0(int64_t numer, const struct libdivide_s64_t *denom) {
uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK; uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK;
int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1)); int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1));
return q >> shifter; return q >> shifter;
} }
int64_t libdivide_s64_do_alg1(int64_t numer, const struct libdivide_s64_t *denom) { int64_t libdivide_s64_do_alg1(int64_t numer, const struct libdivide_s64_t *denom) {
//denom->shifter != -1 && demo->shiftMask != 0 //denom->shifter != -1 && demo->shiftMask != 0
uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK; uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK;
int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1)); int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1));
return - (q >> shifter); return - (q >> shifter);
} }
int64_t libdivide_s64_do_alg2(int64_t numer, const struct libdivide_s64_t *denom) { int64_t libdivide_s64_do_alg2(int64_t numer, const struct libdivide_s64_t *denom) {
int64_t q = libdivide__mullhi_s64(denom->magic, numer); int64_t q = libdivide__mullhi_s64(denom->magic, numer);
q += numer; q += numer;
@ -1031,20 +1031,20 @@ int64_t libdivide_s64_do_alg2(int64_t numer, const struct libdivide_s64_t *denom
q += (q < 0); q += (q < 0);
return q; return q;
} }
int64_t libdivide_s64_do_alg3(int64_t numer, const struct libdivide_s64_t *denom) { int64_t libdivide_s64_do_alg3(int64_t numer, const struct libdivide_s64_t *denom) {
int64_t q = libdivide__mullhi_s64(denom->magic, numer); int64_t q = libdivide__mullhi_s64(denom->magic, numer);
q -= numer; q -= numer;
q >>= denom->more & LIBDIVIDE_64_SHIFT_MASK; q >>= denom->more & LIBDIVIDE_64_SHIFT_MASK;
q += (q < 0); q += (q < 0);
return q; return q;
} }
int64_t libdivide_s64_do_alg4(int64_t numer, const struct libdivide_s64_t *denom) { int64_t libdivide_s64_do_alg4(int64_t numer, const struct libdivide_s64_t *denom) {
int64_t q = libdivide__mullhi_s64(denom->magic, numer); int64_t q = libdivide__mullhi_s64(denom->magic, numer);
q >>= denom->more; q >>= denom->more;
q += (q < 0); q += (q < 0);
return q; return q;
} }
@ -1065,7 +1065,7 @@ __m128i libdivide_s64_do_vector(__m128i numers, const struct libdivide_s64_t * d
__m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(magic)); __m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(magic));
if (more & LIBDIVIDE_ADD_MARKER) { if (more & LIBDIVIDE_ADD_MARKER) {
__m128i sign = _mm_set1_epi32((int32_t)((int8_t)more >> 7)); //must be arithmetic shift __m128i sign = _mm_set1_epi32((int32_t)((int8_t)more >> 7)); //must be arithmetic shift
q = _mm_add_epi64(q, _mm_sub_epi64(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign); q = _mm_add_epi64(q, _mm_sub_epi64(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign);
} }
q = libdivide_s64_shift_right_vector(q, more & LIBDIVIDE_64_SHIFT_MASK); //q >>= denom->mult_path.shift q = libdivide_s64_shift_right_vector(q, more & LIBDIVIDE_64_SHIFT_MASK); //q >>= denom->mult_path.shift
q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0)
@ -1102,20 +1102,20 @@ __m128i libdivide_s64_do_vector_alg3(__m128i numers, const struct libdivide_s64_
q = _mm_sub_epi64(q, numers); q = _mm_sub_epi64(q, numers);
q = libdivide_s64_shift_right_vector(q, denom->more & LIBDIVIDE_64_SHIFT_MASK); q = libdivide_s64_shift_right_vector(q, denom->more & LIBDIVIDE_64_SHIFT_MASK);
q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0)
return q; return q;
} }
__m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_t *denom) { __m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_t *denom) {
__m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(denom->magic)); __m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(denom->magic));
q = libdivide_s64_shift_right_vector(q, denom->more); q = libdivide_s64_shift_right_vector(q, denom->more);
q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); q = _mm_add_epi64(q, _mm_srli_epi64(q, 63));
return q; return q;
} }
#endif #endif
/////////// C++ stuff /////////// C++ stuff
#ifdef __cplusplus #ifdef __cplusplus
/* The C++ template design here is a total mess. This needs to be fixed by someone better at templates than I. The current design is: /* The C++ template design here is a total mess. This needs to be fixed by someone better at templates than I. The current design is:
@ -1131,7 +1131,7 @@ __m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_
*/ */
namespace libdivide_internal { namespace libdivide_internal {
#if LIBDIVIDE_USE_SSE2 #if LIBDIVIDE_USE_SSE2
#define MAYBE_VECTOR(x) x #define MAYBE_VECTOR(x) x
#define MAYBE_VECTOR_PARAM __m128i vector_func(__m128i, const DenomType *) #define MAYBE_VECTOR_PARAM __m128i vector_func(__m128i, const DenomType *)
@ -1149,12 +1149,12 @@ namespace libdivide_internal {
#endif #endif
template<typename IntType, typename DenomType, DenomType gen_func(IntType), int get_algo(const DenomType *), IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> template<typename IntType, typename DenomType, DenomType gen_func(IntType), int get_algo(const DenomType *), IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM>
class divider_base { class divider_base {
public: public:
DenomType denom; DenomType denom;
divider_base(IntType d) : denom(gen_func(d)) { } divider_base(IntType d) : denom(gen_func(d)) { }
divider_base(const DenomType & d) : denom(d) { } divider_base(const DenomType & d) : denom(d) { }
IntType perform_divide(IntType val) const { return do_func(val, &denom); } IntType perform_divide(IntType val) const { return do_func(val, &denom); }
#if LIBDIVIDE_USE_SSE2 #if LIBDIVIDE_USE_SSE2
__m128i perform_divide_vector(__m128i val) const { return vector_func(val, &denom); } __m128i perform_divide_vector(__m128i val) const { return vector_func(val, &denom); }
@ -1162,37 +1162,37 @@ namespace libdivide_internal {
int get_algorithm() const { return get_algo(&denom); } int get_algorithm() const { return get_algo(&denom); }
}; };
template<class T> struct divider_mid { }; template<class T> struct divider_mid { };
template<> struct divider_mid<uint32_t> { template<> struct divider_mid<uint32_t> {
typedef uint32_t IntType; typedef uint32_t IntType;
typedef struct libdivide_u32_t DenomType; typedef struct libdivide_u32_t DenomType;
template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom { template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom {
typedef divider_base<IntType, DenomType, libdivide_u32_gen, libdivide_u32_get_algorithm, do_func, vector_func> divider; typedef divider_base<IntType, DenomType, libdivide_u32_gen, libdivide_u32_get_algorithm, do_func, vector_func> divider;
}; };
template<int ALGO, int J = 0> struct algo { }; template<int ALGO, int J = 0> struct algo { };
template<int J> struct algo<-1, J> { typedef denom<libdivide_u32_do, MAYBE_VECTOR(libdivide_u32_do_vector)>::divider divider; }; template<int J> struct algo<-1, J> { typedef denom<libdivide_u32_do, MAYBE_VECTOR(libdivide_u32_do_vector)>::divider divider; };
template<int J> struct algo<0, J> { typedef denom<libdivide_u32_do_alg0, MAYBE_VECTOR(libdivide_u32_do_vector_alg0)>::divider divider; }; template<int J> struct algo<0, J> { typedef denom<libdivide_u32_do_alg0, MAYBE_VECTOR(libdivide_u32_do_vector_alg0)>::divider divider; };
template<int J> struct algo<1, J> { typedef denom<libdivide_u32_do_alg1, MAYBE_VECTOR(libdivide_u32_do_vector_alg1)>::divider divider; }; template<int J> struct algo<1, J> { typedef denom<libdivide_u32_do_alg1, MAYBE_VECTOR(libdivide_u32_do_vector_alg1)>::divider divider; };
template<int J> struct algo<2, J> { typedef denom<libdivide_u32_do_alg2, MAYBE_VECTOR(libdivide_u32_do_vector_alg2)>::divider divider; }; template<int J> struct algo<2, J> { typedef denom<libdivide_u32_do_alg2, MAYBE_VECTOR(libdivide_u32_do_vector_alg2)>::divider divider; };
/* Define two more bogus ones so that the same (templated, presumably) code can handle both signed and unsigned */ /* Define two more bogus ones so that the same (templated, presumably) code can handle both signed and unsigned */
template<int J> struct algo<3, J> { typedef denom<crash_u32, MAYBE_VECTOR(crash_u32_vector)>::divider divider; }; template<int J> struct algo<3, J> { typedef denom<crash_u32, MAYBE_VECTOR(crash_u32_vector)>::divider divider; };
template<int J> struct algo<4, J> { typedef denom<crash_u32, MAYBE_VECTOR(crash_u32_vector)>::divider divider; }; template<int J> struct algo<4, J> { typedef denom<crash_u32, MAYBE_VECTOR(crash_u32_vector)>::divider divider; };
}; };
template<> struct divider_mid<int32_t> { template<> struct divider_mid<int32_t> {
typedef int32_t IntType; typedef int32_t IntType;
typedef struct libdivide_s32_t DenomType; typedef struct libdivide_s32_t DenomType;
template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom { template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom {
typedef divider_base<IntType, DenomType, libdivide_s32_gen, libdivide_s32_get_algorithm, do_func, vector_func> divider; typedef divider_base<IntType, DenomType, libdivide_s32_gen, libdivide_s32_get_algorithm, do_func, vector_func> divider;
}; };
template<int ALGO, int J = 0> struct algo { }; template<int ALGO, int J = 0> struct algo { };
template<int J> struct algo<-1, J> { typedef denom<libdivide_s32_do, MAYBE_VECTOR(libdivide_s32_do_vector)>::divider divider; }; template<int J> struct algo<-1, J> { typedef denom<libdivide_s32_do, MAYBE_VECTOR(libdivide_s32_do_vector)>::divider divider; };
template<int J> struct algo<0, J> { typedef denom<libdivide_s32_do_alg0, MAYBE_VECTOR(libdivide_s32_do_vector_alg0)>::divider divider; }; template<int J> struct algo<0, J> { typedef denom<libdivide_s32_do_alg0, MAYBE_VECTOR(libdivide_s32_do_vector_alg0)>::divider divider; };
@ -1200,36 +1200,36 @@ namespace libdivide_internal {
template<int J> struct algo<2, J> { typedef denom<libdivide_s32_do_alg2, MAYBE_VECTOR(libdivide_s32_do_vector_alg2)>::divider divider; }; template<int J> struct algo<2, J> { typedef denom<libdivide_s32_do_alg2, MAYBE_VECTOR(libdivide_s32_do_vector_alg2)>::divider divider; };
template<int J> struct algo<3, J> { typedef denom<libdivide_s32_do_alg3, MAYBE_VECTOR(libdivide_s32_do_vector_alg3)>::divider divider; }; template<int J> struct algo<3, J> { typedef denom<libdivide_s32_do_alg3, MAYBE_VECTOR(libdivide_s32_do_vector_alg3)>::divider divider; };
template<int J> struct algo<4, J> { typedef denom<libdivide_s32_do_alg4, MAYBE_VECTOR(libdivide_s32_do_vector_alg4)>::divider divider; }; template<int J> struct algo<4, J> { typedef denom<libdivide_s32_do_alg4, MAYBE_VECTOR(libdivide_s32_do_vector_alg4)>::divider divider; };
}; };
template<> struct divider_mid<uint64_t> { template<> struct divider_mid<uint64_t> {
typedef uint64_t IntType; typedef uint64_t IntType;
typedef struct libdivide_u64_t DenomType; typedef struct libdivide_u64_t DenomType;
template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom { template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom {
typedef divider_base<IntType, DenomType, libdivide_u64_gen, libdivide_u64_get_algorithm, do_func, vector_func> divider; typedef divider_base<IntType, DenomType, libdivide_u64_gen, libdivide_u64_get_algorithm, do_func, vector_func> divider;
}; };
template<int ALGO, int J = 0> struct algo { }; template<int ALGO, int J = 0> struct algo { };
template<int J> struct algo<-1, J> { typedef denom<libdivide_u64_do, MAYBE_VECTOR(libdivide_u64_do_vector)>::divider divider; }; template<int J> struct algo<-1, J> { typedef denom<libdivide_u64_do, MAYBE_VECTOR(libdivide_u64_do_vector)>::divider divider; };
template<int J> struct algo<0, J> { typedef denom<libdivide_u64_do_alg0, MAYBE_VECTOR(libdivide_u64_do_vector_alg0)>::divider divider; }; template<int J> struct algo<0, J> { typedef denom<libdivide_u64_do_alg0, MAYBE_VECTOR(libdivide_u64_do_vector_alg0)>::divider divider; };
template<int J> struct algo<1, J> { typedef denom<libdivide_u64_do_alg1, MAYBE_VECTOR(libdivide_u64_do_vector_alg1)>::divider divider; }; template<int J> struct algo<1, J> { typedef denom<libdivide_u64_do_alg1, MAYBE_VECTOR(libdivide_u64_do_vector_alg1)>::divider divider; };
template<int J> struct algo<2, J> { typedef denom<libdivide_u64_do_alg2, MAYBE_VECTOR(libdivide_u64_do_vector_alg2)>::divider divider; }; template<int J> struct algo<2, J> { typedef denom<libdivide_u64_do_alg2, MAYBE_VECTOR(libdivide_u64_do_vector_alg2)>::divider divider; };
/* Define two more bogus ones so that the same (templated, presumably) code can handle both signed and unsigned */ /* Define two more bogus ones so that the same (templated, presumably) code can handle both signed and unsigned */
template<int J> struct algo<3, J> { typedef denom<crash_u64, MAYBE_VECTOR(crash_u64_vector)>::divider divider; }; template<int J> struct algo<3, J> { typedef denom<crash_u64, MAYBE_VECTOR(crash_u64_vector)>::divider divider; };
template<int J> struct algo<4, J> { typedef denom<crash_u64, MAYBE_VECTOR(crash_u64_vector)>::divider divider; }; template<int J> struct algo<4, J> { typedef denom<crash_u64, MAYBE_VECTOR(crash_u64_vector)>::divider divider; };
}; };
template<> struct divider_mid<int64_t> { template<> struct divider_mid<int64_t> {
typedef int64_t IntType; typedef int64_t IntType;
typedef struct libdivide_s64_t DenomType; typedef struct libdivide_s64_t DenomType;
template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom { template<IntType do_func(IntType, const DenomType *), MAYBE_VECTOR_PARAM> struct denom {
typedef divider_base<IntType, DenomType, libdivide_s64_gen, libdivide_s64_get_algorithm, do_func, vector_func> divider; typedef divider_base<IntType, DenomType, libdivide_s64_gen, libdivide_s64_get_algorithm, do_func, vector_func> divider;
}; };
template<int ALGO, int J = 0> struct algo { }; template<int ALGO, int J = 0> struct algo { };
template<int J> struct algo<-1, J> { typedef denom<libdivide_s64_do, MAYBE_VECTOR(libdivide_s64_do_vector)>::divider divider; }; template<int J> struct algo<-1, J> { typedef denom<libdivide_s64_do, MAYBE_VECTOR(libdivide_s64_do_vector)>::divider divider; };
template<int J> struct algo<0, J> { typedef denom<libdivide_s64_do_alg0, MAYBE_VECTOR(libdivide_s64_do_vector_alg0)>::divider divider; }; template<int J> struct algo<0, J> { typedef denom<libdivide_s64_do_alg0, MAYBE_VECTOR(libdivide_s64_do_vector_alg0)>::divider divider; };
@ -1248,29 +1248,29 @@ class divider
typename libdivide_internal::divider_mid<T>::template algo<ALGO>::divider sub; typename libdivide_internal::divider_mid<T>::template algo<ALGO>::divider sub;
template<int NEW_ALGO, typename S> friend divider<S, NEW_ALGO> unswitch(const divider<S, -1> & d); template<int NEW_ALGO, typename S> friend divider<S, NEW_ALGO> unswitch(const divider<S, -1> & d);
divider(const typename libdivide_internal::divider_mid<T>::DenomType & denom) : sub(denom) { } divider(const typename libdivide_internal::divider_mid<T>::DenomType & denom) : sub(denom) { }
public: public:
/* Ordinary constructor, that takes the divisor as a parameter. */ /* Ordinary constructor, that takes the divisor as a parameter. */
divider(T n) : sub(n) { } divider(T n) : sub(n) { }
/* Default constructor, that divides by 1 */ /* Default constructor, that divides by 1 */
divider() : sub(1) { } divider() : sub(1) { }
/* Divides the parameter by the divisor, returning the quotient */ /* Divides the parameter by the divisor, returning the quotient */
T perform_divide(T val) const { return sub.perform_divide(val); } T perform_divide(T val) const { return sub.perform_divide(val); }
#if LIBDIVIDE_USE_SSE2 #if LIBDIVIDE_USE_SSE2
/* Treats the vector as either two or four packed values (depending on the size), and divides each of them by the divisor, returning the packed quotients. */ /* Treats the vector as either two or four packed values (depending on the size), and divides each of them by the divisor, returning the packed quotients. */
__m128i perform_divide_vector(__m128i val) const { return sub.perform_divide_vector(val); } __m128i perform_divide_vector(__m128i val) const { return sub.perform_divide_vector(val); }
#endif #endif
/* Returns the index of algorithm, for use in the unswitch function */ /* Returns the index of algorithm, for use in the unswitch function */
int get_algorithm() const { return sub.get_algorithm(); } // returns the algorithm for unswitching int get_algorithm() const { return sub.get_algorithm(); } // returns the algorithm for unswitching
/* operator== */ /* operator== */
bool operator==(const divider<T, ALGO> & him) const { return sub.denom.magic == him.sub.denom.magic && sub.denom.more == him.sub.denom.more; } bool operator==(const divider<T, ALGO> & him) const { return sub.denom.magic == him.sub.denom.magic && sub.denom.more == him.sub.denom.more; }
bool operator!=(const divider<T, ALGO> & him) const { return ! (*this == him); } bool operator!=(const divider<T, ALGO> & him) const { return ! (*this == him); }
}; };
@ -1291,10 +1291,10 @@ __m128i operator/(__m128i numer, const divider<int_type, ALGO> & denom) {
return denom.perform_divide_vector(numer); return denom.perform_divide_vector(numer);
} }
#endif #endif
#endif //__cplusplus #endif //__cplusplus
#endif //LIBDIVIDE_HEADER_ONLY #endif //LIBDIVIDE_HEADER_ONLY
#ifdef __cplusplus #ifdef __cplusplus
} //close namespace libdivide } //close namespace libdivide

View file

@ -485,7 +485,7 @@ typedef uLong FAR uLongf;
# define z_off64_t off64_t # define z_off64_t off64_t
#else #else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64 # define z_off64_t long long
# else # else
# define z_off64_t z_off_t # define z_off64_t z_off_t
# endif # endif

View file

@ -318,7 +318,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart()
wstring wWorldName = L"TestWorld"; wstring wWorldName = L"TestWorld";
bool isFlat = false; bool isFlat = false;
__int64 seedValue = 0;//BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements int64_t seedValue = 0;//BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
NetworkGameInitData *param = new NetworkGameInitData(); NetworkGameInitData *param = new NetworkGameInitData();
param->seed = seedValue; param->seed = seedValue;

View file

@ -102,7 +102,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr<ServerPlayer> player)
auto it = find(parent->knownChunks.begin(), parent->knownChunks.end(), this); auto it = find(parent->knownChunks.begin(), parent->knownChunks.end(), this);
if(it != parent->knownChunks.end()) parent->knownChunks.erase(it); if(it != parent->knownChunks.end()) parent->knownChunks.erase(it);
} }
__int64 id = (pos.x + 0x7fffffffLL) | ((pos.z + 0x7fffffffLL) << 32); int64_t id = (pos.x + 0x7fffffffLL) | ((pos.z + 0x7fffffffLL) << 32);
auto it = parent->chunks.find(id); auto it = parent->chunks.find(id);
if( it != parent->chunks.end() ) if( it != parent->chunks.end() )
{ {
@ -421,7 +421,7 @@ ServerLevel *PlayerChunkMap::getLevel()
void PlayerChunkMap::tick() void PlayerChunkMap::tick()
{ {
__int64 time = level->getGameTime(); int64_t time = level->getGameTime();
if (time - lastInhabitedUpdate > Level::TICKS_PER_DAY / 3) if (time - lastInhabitedUpdate > Level::TICKS_PER_DAY / 3)
{ {
@ -474,13 +474,13 @@ void PlayerChunkMap::tick()
bool PlayerChunkMap::hasChunk(int x, int z) bool PlayerChunkMap::hasChunk(int x, int z)
{ {
__int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32);
return chunks.find(id) != chunks.end(); return chunks.find(id) != chunks.end();
} }
PlayerChunkMap::PlayerChunk *PlayerChunkMap::getChunk(int x, int z, bool create) PlayerChunkMap::PlayerChunk *PlayerChunkMap::getChunk(int x, int z, bool create)
{ {
__int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32);
auto it = chunks.find(id); auto it = chunks.find(id);
PlayerChunk *chunk = nullptr; PlayerChunk *chunk = nullptr;
@ -502,7 +502,7 @@ PlayerChunkMap::PlayerChunk *PlayerChunkMap::getChunk(int x, int z, bool create)
// queue a request for it to be created. // queue a request for it to be created.
void PlayerChunkMap::getChunkAndAddPlayer(int x, int z, shared_ptr<ServerPlayer> player) void PlayerChunkMap::getChunkAndAddPlayer(int x, int z, shared_ptr<ServerPlayer> player)
{ {
__int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32);
auto it = chunks.find(id); auto it = chunks.find(id);
if( it != chunks.end() ) if( it != chunks.end() )
@ -529,7 +529,7 @@ void PlayerChunkMap::getChunkAndRemovePlayer(int x, int z, shared_ptr<ServerPlay
return; return;
} }
} }
__int64 id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32);
auto it = chunks.find(id); auto it = chunks.find(id);
if( it != chunks.end() ) if( it != chunks.end() )

View file

@ -45,7 +45,7 @@ public:
int zChangeMin, zChangeMax; int zChangeMin, zChangeMax;
int ticksToNextRegionUpdate; // 4J added int ticksToNextRegionUpdate; // 4J added
bool prioritised; // 4J added bool prioritised; // 4J added
__int64 firstInhabitedTime; int64_t firstInhabitedTime;
public: public:
PlayerChunk(int x, int z, PlayerChunkMap *pcm); PlayerChunk(int x, int z, PlayerChunkMap *pcm);
@ -73,7 +73,7 @@ public:
vector<shared_ptr<ServerPlayer> > players; vector<shared_ptr<ServerPlayer> > players;
void flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFound); // 4J added void flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFound); // 4J added
private: private:
unordered_map<__int64,PlayerChunk *,LongKeyHash,LongKeyEq> chunks; // 4J - was LongHashMap unordered_map<int64_t,PlayerChunk *,LongKeyHash,LongKeyEq> chunks; // 4J - was LongHashMap
vector<PlayerChunk *> changedChunks; vector<PlayerChunk *> changedChunks;
vector<PlayerChunk *> knownChunks; vector<PlayerChunk *> knownChunks;
vector<PlayerChunkAddRequest> addRequests; // 4J added vector<PlayerChunkAddRequest> addRequests; // 4J added
@ -82,7 +82,7 @@ private:
ServerLevel *level; ServerLevel *level;
int radius; int radius;
int dimension; int dimension;
__int64 lastInhabitedUpdate; int64_t lastInhabitedUpdate;
public: public:
PlayerChunkMap(ServerLevel *level, int dimension, int radius); PlayerChunkMap(ServerLevel *level, int dimension, int radius);

View file

@ -30,9 +30,9 @@ private:
bool didTick; bool didTick;
int lastKeepAliveId; int lastKeepAliveId;
__int64 lastKeepAliveTime; int64_t lastKeepAliveTime;
static Random random; static Random random;
__int64 lastKeepAliveTick; int64_t lastKeepAliveTick;
int chatSpamTickCount; int chatSpamTickCount;
int dropSpamTickCount; int dropSpamTickCount;
@ -81,7 +81,7 @@ private:
public: public:
// 4J Stu - Handlers only valid in debug mode // 4J Stu - Handlers only valid in debug mode
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
virtual void handleContainerSetSlot(shared_ptr<ContainerSetSlotPacket> packet); virtual void handleContainerSetSlot(shared_ptr<ContainerSetSlotPacket> packet);
#endif #endif
virtual void handleContainerClick(shared_ptr<ContainerClickPacket> packet); virtual void handleContainerClick(shared_ptr<ContainerClickPacket> packet);
@ -89,14 +89,14 @@ public:
virtual void handleSetCreativeModeSlot(shared_ptr<SetCreativeModeSlotPacket> packet); virtual void handleSetCreativeModeSlot(shared_ptr<SetCreativeModeSlotPacket> packet);
virtual void handleContainerAck(shared_ptr<ContainerAckPacket> packet); virtual void handleContainerAck(shared_ptr<ContainerAckPacket> packet);
virtual void handleSignUpdate(shared_ptr<SignUpdatePacket> packet); virtual void handleSignUpdate(shared_ptr<SignUpdatePacket> packet);
virtual void handleKeepAlive(shared_ptr<KeepAlivePacket> packet); virtual void handleKeepAlive(shared_ptr<KeepAlivePacket> packet);
virtual void handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet); // 4J Added virtual void handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet); // 4J Added
virtual bool isServerPacketListener(); virtual bool isServerPacketListener();
virtual void handlePlayerAbilities(shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket); virtual void handlePlayerAbilities(shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket);
virtual void handleCustomPayload(shared_ptr<CustomPayloadPacket> customPayloadPacket); virtual void handleCustomPayload(shared_ptr<CustomPayloadPacket> customPayloadPacket);
virtual bool isDisconnected(); virtual bool isDisconnected();
// 4J Added // 4J Added
virtual void handleCraftItem(shared_ptr<CraftItemPacket> packet); virtual void handleCraftItem(shared_ptr<CraftItemPacket> packet);
virtual void handleTradeItem(shared_ptr<TradeItemPacket> packet); virtual void handleTradeItem(shared_ptr<TradeItemPacket> packet);
virtual void handleDebugOptions(shared_ptr<DebugOptionsPacket> packet); virtual void handleDebugOptions(shared_ptr<DebugOptionsPacket> packet);

View file

@ -24,7 +24,7 @@ void ProgressRenderer::progressStart(int title)
void ProgressRenderer::progressStartNoAbort(int string) void ProgressRenderer::progressStartNoAbort(int string)
{ {
noAbort = true; noAbort = true;
_progressStart(string); _progressStart(string);
} }
@ -36,7 +36,7 @@ void ProgressRenderer::_progressStart(int title)
if (noAbort) return; if (noAbort) return;
// throw new StopGameException(); // 4J - removed // throw new StopGameException(); // 4J - removed
} }
EnterCriticalSection( &ProgressRenderer::s_progress ); EnterCriticalSection( &ProgressRenderer::s_progress );
lastPercent = 0; lastPercent = 0;
this->title = title; this->title = title;
@ -88,7 +88,7 @@ void ProgressRenderer::progressStagePercentage(int i)
} }
__int64 now = System::currentTimeMillis(); int64_t now = System::currentTimeMillis();
if (now - lastTime < 20) return; if (now - lastTime < 20) return;
lastTime = now; lastTime = now;

View file

@ -25,7 +25,7 @@ private:
int status; int status;
Minecraft *minecraft; Minecraft *minecraft;
int title; int title;
__int64 lastTime; int64_t lastTime;
bool noAbort; bool noAbort;
wstring m_wstrText; wstring m_wstrText;
eProgressStringType m_eType; eProgressStringType m_eType;

View file

@ -28,7 +28,7 @@ private:
float yo; float yo;
int lastSelection; int lastSelection;
__int64 lastSelectionTime ; int64_t lastSelectionTime ;
bool renderSelection; bool renderSelection;
bool _renderHeader; bool _renderHeader;
@ -40,7 +40,7 @@ public:
protected: protected:
void setRenderHeader(bool renderHeader, int headerHeight); void setRenderHeader(bool renderHeader, int headerHeight);
virtual int getNumberOfItems() = 0; virtual int getNumberOfItems() = 0;
virtual void selectItem(int item, bool doubleClick) = 0; virtual void selectItem(int item, bool doubleClick) = 0;
virtual bool isSelectedItem(int item) = 0; virtual bool isSelectedItem(int item) = 0;
virtual int getMaxPosition(); virtual int getMaxPosition();

View file

@ -294,7 +294,7 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, int
swprintf(buffer,20,L"%d/%d/%d %d:%02d",time.wDay, time.wMonth, time.wYear, time.wHour, time.wMinute); // 4J - TODO Localise this swprintf(buffer,20,L"%d/%d/%d %d:%02d",time.wDay, time.wMonth, time.wYear, time.wHour, time.wMinute); // 4J - TODO Localise this
id = id + L" (" + buffer; id = id + L" (" + buffer;
__int64 size = levelSummary->getSizeOnDisk(); int64_t size = levelSummary->getSizeOnDisk();
id = id + L", " + std::to_wstring(static_cast<float>(size / 1024 * 100 / 1024 / 100.0f)) + L" MB)"; id = id + L", " + std::to_wstring(static_cast<float>(size / 1024 * 100 / 1024 / 100.0f)) + L" MB)";
wstring info; wstring info;

View file

@ -207,7 +207,7 @@ void ServerLevel::tick()
if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT))
{ {
// skip time until new day // skip time until new day
__int64 newTime = levelData->getDayTime() + TICKS_PER_DAY; int64_t newTime = levelData->getDayTime() + TICKS_PER_DAY;
// 4J : WESTY : Changed so that time update goes through stats tracking update code. // 4J : WESTY : Changed so that time update goes through stats tracking update code.
//levelData->setTime(newTime - (newTime % TICKS_PER_DAY)); //levelData->setTime(newTime - (newTime % TICKS_PER_DAY));
@ -248,7 +248,7 @@ void ServerLevel::tick()
//4J - temporarily disabling saves as they are causing gameplay to generally stutter quite a lot //4J - temporarily disabling saves as they are causing gameplay to generally stutter quite a lot
__int64 time = levelData->getGameTime() + 1; int64_t time = levelData->getGameTime() + 1;
// 4J Stu - Putting this back in, but I have reduced the number of chunks that save when not forced // 4J Stu - Putting this back in, but I have reduced the number of chunks that save when not forced
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
if (time % (saveInterval) == (dimension->id + 1)) if (time % (saveInterval) == (dimension->id + 1))
@ -1232,9 +1232,9 @@ EntityTracker *ServerLevel::getTracker()
return tracker; return tracker;
} }
void ServerLevel::setTimeAndAdjustTileTicks(__int64 newTime) void ServerLevel::setTimeAndAdjustTileTicks(int64_t newTime)
{ {
__int64 delta = newTime - levelData->getGameTime(); int64_t delta = newTime - levelData->getGameTime();
// 4J - can't directly adjust m_delay in a set as it has a const interator, since changing values in here might change the ordering of the elements in the set. // 4J - can't directly adjust m_delay in a set as it has a const interator, since changing values in here might change the ordering of the elements in the set.
// Instead move to a vector, do the adjustment, put back in the set. // Instead move to a vector, do the adjustment, put back in the set.
vector<TickNextTickData> temp; vector<TickNextTickData> temp;

Some files were not shown because too many files have changed in this diff Show more