mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 10:37:41 -04:00
Convert custom HeadSpin integer types to standard types from stdint.h
This commit is contained in:
@ -231,7 +231,7 @@ plClient::plClient()
|
||||
plAgeLoader::SetInstance(TRACKED_NEW plAgeLoader);
|
||||
|
||||
// Use it to parse the init directory
|
||||
wchar initFolder[MAX_PATH];
|
||||
wchar_t initFolder[MAX_PATH];
|
||||
PathGetInitDirectory(initFolder, arrsize(initFolder));
|
||||
pfConsoleDirSrc dirSrc( fConsoleEngine, initFolder, L"*.ini" );
|
||||
|
||||
@ -469,7 +469,7 @@ void plClient::InitInputs()
|
||||
void plClient::ISetGraphicsDefaults()
|
||||
{
|
||||
// couldn't find display mode set defaults write to ini file
|
||||
wchar graphicsIniFile[MAX_PATH];
|
||||
wchar_t graphicsIniFile[MAX_PATH];
|
||||
PathGetInitDirectory(graphicsIniFile, arrsize(graphicsIniFile));
|
||||
PathAddFilename(graphicsIniFile, graphicsIniFile, L"graphics.ini", arrsize(graphicsIniFile));
|
||||
IWriteDefaultGraphicsSettings(graphicsIniFile);
|
||||
@ -990,7 +990,7 @@ void plClient::IQueueRoomLoad(const std::vector<plLocation>& locs, bool hold)
|
||||
bool allSameAge = true;
|
||||
const char* lastAgeName = nil;
|
||||
|
||||
UInt32 numRooms = 0;
|
||||
uint32_t numRooms = 0;
|
||||
for (int i = 0; i < locs.size(); i++)
|
||||
{
|
||||
const plLocation& loc = locs[i];
|
||||
@ -1109,7 +1109,7 @@ void plClient::IUnloadRooms(const std::vector<plLocation>& locs)
|
||||
}
|
||||
GetKey()->Release(nodeKey); // release notify interest in scene node
|
||||
|
||||
UInt32 recFlags = 0;
|
||||
uint32_t recFlags = 0;
|
||||
if (roomIdx != -1)
|
||||
{
|
||||
recFlags = fRooms[roomIdx].fFlags;
|
||||
@ -1376,11 +1376,11 @@ public:
|
||||
LoginNetClientCommCallback() : plNetClientComm::Callback(), fNumCurrentOps(0)
|
||||
{}
|
||||
|
||||
virtual void OperationStarted( UInt32 context )
|
||||
virtual void OperationStarted( uint32_t context )
|
||||
{
|
||||
fNumCurrentOps++;
|
||||
}
|
||||
virtual void OperationComplete( UInt32 context, int resultCode )
|
||||
virtual void OperationComplete( uint32_t context, int resultCode )
|
||||
{
|
||||
if (context == kAuth)
|
||||
{
|
||||
@ -1393,14 +1393,14 @@ public:
|
||||
{
|
||||
if ( hsSucceeded( resultCode ) )
|
||||
{
|
||||
UInt32 numPlayers = fCbArgs.GetInt(0);
|
||||
UInt32 pId = -1;
|
||||
uint32_t numPlayers = fCbArgs.GetInt(0);
|
||||
uint32_t pId = -1;
|
||||
std::string pName;
|
||||
|
||||
for (UInt32 i = 0; i < numPlayers; i++)
|
||||
for (uint32_t i = 0; i < numPlayers; i++)
|
||||
{
|
||||
pId = fCbArgs.GetInt((UInt16)(i*3+1));
|
||||
pName = fCbArgs.GetString((UInt16)(i*3+2));
|
||||
pId = fCbArgs.GetInt((uint16_t)(i*3+1));
|
||||
pName = fCbArgs.GetString((uint16_t)(i*3+2));
|
||||
|
||||
if (pName == plClient::GetInstance()->fUsername)
|
||||
{
|
||||
@ -2114,7 +2114,7 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
|
||||
/// Read the rest in
|
||||
selMode.Read(&stream);
|
||||
|
||||
UInt16 performance = stream.ReadLE16();
|
||||
uint16_t performance = stream.ReadLE16();
|
||||
|
||||
if( performance < 25 )
|
||||
plBitmap::SetGlobalLevelChopCount( 2 );
|
||||
@ -2148,7 +2148,7 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
|
||||
{
|
||||
dmr.GetDevice()->Write(&stream);
|
||||
dmr.GetMode()->Write(&stream);
|
||||
stream.WriteLE16((UInt16)(0*100));
|
||||
stream.WriteLE16((uint16_t)(0*100));
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
@ -2180,7 +2180,7 @@ void plClient::ResizeDisplayDevice(int Width, int Height, hsBool Windowed)
|
||||
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
|
||||
|
||||
|
||||
UInt32 winStyle, winExStyle;
|
||||
uint32_t winStyle, winExStyle;
|
||||
if( Windowed )
|
||||
{
|
||||
winStyle = WS_OVERLAPPEDWINDOW;
|
||||
@ -2193,8 +2193,8 @@ void plClient::ResizeDisplayDevice(int Width, int Height, hsBool Windowed)
|
||||
SetWindowLong(fWindowHndl, GWL_EXSTYLE, winExStyle);
|
||||
|
||||
|
||||
UInt32 flags = SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED;
|
||||
UInt32 OutsideWidth, OutsideHeight;
|
||||
uint32_t flags = SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED;
|
||||
uint32_t OutsideWidth, OutsideHeight;
|
||||
HWND insertAfter;
|
||||
if( Windowed )
|
||||
{
|
||||
@ -2313,7 +2313,7 @@ void plClient::IDetectAudioVideoSettings()
|
||||
int val = 0;
|
||||
hsStream *stream = nil;
|
||||
hsUNIXStream s;
|
||||
wchar audioIniFile[MAX_PATH], graphicsIniFile[MAX_PATH];
|
||||
wchar_t audioIniFile[MAX_PATH], graphicsIniFile[MAX_PATH];
|
||||
PathGetInitDirectory(audioIniFile, arrsize(audioIniFile));
|
||||
StrCopy(graphicsIniFile, audioIniFile, arrsize(audioIniFile));
|
||||
PathAddFilename(audioIniFile, audioIniFile, L"audio.ini", arrsize(audioIniFile));
|
||||
@ -2372,7 +2372,7 @@ void plClient::IDetectAudioVideoSettings()
|
||||
}
|
||||
}
|
||||
|
||||
void plClient::IWriteDefaultGraphicsSettings(const wchar* destFile)
|
||||
void plClient::IWriteDefaultGraphicsSettings(const wchar_t* destFile)
|
||||
{
|
||||
hsStream *stream = plEncryptedStream::OpenEncryptedFileWrite(destFile);
|
||||
|
||||
@ -2450,7 +2450,7 @@ void plClient::IOnAsyncInitComplete () {
|
||||
|
||||
/// Now parse final init files (*.fni). These are files just like ini files, only to be run
|
||||
/// after all hell has broken loose in the client.
|
||||
wchar initFolder[MAX_PATH];
|
||||
wchar_t initFolder[MAX_PATH];
|
||||
PathGetInitDirectory(initFolder, arrsize(initFolder));
|
||||
pfConsoleDirSrc dirSrc( fConsoleEngine, initFolder, L"net*.fni" ); // connect to net first
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
|
@ -94,10 +94,10 @@ protected:
|
||||
{
|
||||
public:
|
||||
plSceneNode *fNode;
|
||||
UInt32 fFlags;
|
||||
uint32_t fFlags;
|
||||
|
||||
plRoomRec() { fNode = nil; fFlags = 0; }
|
||||
plRoomRec( plSceneNode *n, UInt32 f ) : fNode( n ), fFlags( f ) {}
|
||||
plRoomRec( plSceneNode *n, uint32_t f ) : fNode( n ), fFlags( f ) {}
|
||||
|
||||
enum Flags
|
||||
{
|
||||
@ -293,7 +293,7 @@ public:
|
||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false);
|
||||
void ResizeDisplayDevice(int Width, int Height, hsBool Windowed);
|
||||
void IDetectAudioVideoSettings();
|
||||
void IWriteDefaultGraphicsSettings(const wchar* destFile);
|
||||
void IWriteDefaultGraphicsSettings(const wchar_t* destFile);
|
||||
|
||||
plAnimDebugList *fAnimDebugList;
|
||||
|
||||
|
@ -54,13 +54,13 @@ namespace ClientUpdate
|
||||
//
|
||||
// Format of the update stream
|
||||
//
|
||||
// UInt8 - type (kUpdate, kShutdown)
|
||||
// uint8_t - type (kUpdate, kShutdown)
|
||||
//
|
||||
// If type is kUpdate:
|
||||
// UInt32 - number of deleted keys
|
||||
// uint32_t - number of deleted keys
|
||||
// plUoid - uoid of deleted key (* num)
|
||||
//
|
||||
// UInt32 - number of new creatables
|
||||
// uint32_t - number of new creatables
|
||||
// plCreatable - new creatable (* num)
|
||||
//
|
||||
|
||||
|
@ -133,14 +133,14 @@ static const unsigned AUTH_FAILED_TIMER = 2;
|
||||
//============================================================================
|
||||
#ifdef PLASMA_EXTERNAL_RELEASE
|
||||
|
||||
static wchar s_patcherExeName[] = L"UruLauncher.exe";
|
||||
static wchar_t s_patcherExeName[] = L"UruLauncher.exe";
|
||||
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
|
||||
//============================================================================
|
||||
// PhysX installer
|
||||
//============================================================================
|
||||
static wchar s_physXSetupExeName[] = L"PhysX_Setup.exe";
|
||||
static wchar_t s_physXSetupExeName[] = L"PhysX_Setup.exe";
|
||||
|
||||
//============================================================================
|
||||
// TRANSGAMING detection & dialog replacement
|
||||
@ -178,12 +178,12 @@ struct LoginDialogParam {
|
||||
};
|
||||
|
||||
static bool AuthenticateNetClientComm(ENetError* result, HWND parentWnd);
|
||||
static void GetCryptKey(UInt32* cryptKey, unsigned size);
|
||||
static void GetCryptKey(uint32_t* cryptKey, unsigned size);
|
||||
static void SaveUserPass (LoginDialogParam *pLoginParam, char *password);
|
||||
static void LoadUserPass (LoginDialogParam *pLoginParam);
|
||||
static void AuthFailedStrings (ENetError authError,
|
||||
const char **ppStr1, const char **ppStr2,
|
||||
const wchar **ppWStr);
|
||||
const wchar_t **ppWStr);
|
||||
|
||||
|
||||
// Detect whether we're running under TRANSGAMING Cider
|
||||
@ -290,7 +290,7 @@ static bool TGRunLoginDialog (LoginDialogParam *pLoginParam)
|
||||
if (!cancelled)
|
||||
{
|
||||
const char *pStr1, *pStr2;
|
||||
const wchar *pWStr;
|
||||
const wchar_t *pWStr;
|
||||
unsigned int Len;
|
||||
char *pTmpStr;
|
||||
|
||||
@ -361,7 +361,7 @@ void DebugMsgF(const char* format, ...);
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static bool gDragging = false;
|
||||
static UInt32 keyState=0;
|
||||
static uint32_t keyState=0;
|
||||
|
||||
// Handle messages
|
||||
switch (message) {
|
||||
@ -773,7 +773,7 @@ BOOL WinInit(HINSTANCE hInst, int nCmdShow)
|
||||
/// else, use our normal styles
|
||||
|
||||
char windowName[256];
|
||||
wchar productString[256];
|
||||
wchar_t productString[256];
|
||||
StrCopy(productString, ProductLongName(), arrsize(productString));
|
||||
StrToAnsi(windowName, productString, arrsize(windowName));
|
||||
|
||||
@ -837,7 +837,7 @@ void DebugMsgF(const char* format, ...)
|
||||
|
||||
static void AuthFailedStrings (ENetError authError,
|
||||
const char **ppStr1, const char **ppStr2,
|
||||
const wchar **ppWStr)
|
||||
const wchar_t **ppWStr)
|
||||
{
|
||||
*ppStr1 = NULL;
|
||||
*ppStr2 = NULL;
|
||||
@ -895,7 +895,7 @@ BOOL CALLBACK AuthFailedDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
|
||||
{
|
||||
LoginDialogParam* loginParam = (LoginDialogParam*)lParam;
|
||||
const char *pStr1, *pStr2;
|
||||
const wchar *pWStr;
|
||||
const wchar_t *pWStr;
|
||||
|
||||
AuthFailedStrings (loginParam->authError,
|
||||
&pStr1, &pStr2, &pWStr);
|
||||
@ -970,12 +970,12 @@ BOOL CALLBACK UruTOSDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||
|
||||
static void SaveUserPass (LoginDialogParam *pLoginParam, char *password)
|
||||
{
|
||||
UInt32 cryptKey[4];
|
||||
uint32_t cryptKey[4];
|
||||
ZeroMemory(cryptKey, sizeof(cryptKey));
|
||||
GetCryptKey(cryptKey, arrsize(cryptKey));
|
||||
|
||||
wchar wusername[kMaxAccountNameLength];
|
||||
wchar wpassword[kMaxPasswordLength];
|
||||
wchar_t wusername[kMaxAccountNameLength];
|
||||
wchar_t wpassword[kMaxPasswordLength];
|
||||
|
||||
StrToUnicode(wusername, pLoginParam->username, arrsize(wusername));
|
||||
|
||||
@ -985,7 +985,7 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password)
|
||||
{
|
||||
StrToUnicode(wpassword, password, arrsize(wpassword));
|
||||
|
||||
wchar domain[15];
|
||||
wchar_t domain[15];
|
||||
PathSplitEmail(wusername, nil, 0, domain, arrsize(domain), nil, 0, nil, 0, 0);
|
||||
|
||||
if (StrLen(domain) == 0 || StrCmpI(domain, L"gametap") == 0) {
|
||||
@ -1012,12 +1012,12 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password)
|
||||
else
|
||||
NetCommSetAuthTokenAndOS(nil, L"win");
|
||||
|
||||
wchar fileAndPath[MAX_PATH];
|
||||
wchar_t fileAndPath[MAX_PATH];
|
||||
PathGetInitDirectory(fileAndPath, arrsize(fileAndPath));
|
||||
PathAddFilename(fileAndPath, fileAndPath, L"login.dat", arrsize(fileAndPath));
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
// internal builds can use the local init directory
|
||||
wchar localFileAndPath[MAX_PATH];
|
||||
wchar_t localFileAndPath[MAX_PATH];
|
||||
StrCopy(localFileAndPath, L"init\\login.dat", arrsize(localFileAndPath));
|
||||
if (PathDoesFileExist(localFileAndPath))
|
||||
StrCopy(fileAndPath, localFileAndPath, arrsize(localFileAndPath));
|
||||
@ -1038,7 +1038,7 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password)
|
||||
|
||||
static void LoadUserPass (LoginDialogParam *pLoginParam)
|
||||
{
|
||||
UInt32 cryptKey[4];
|
||||
uint32_t cryptKey[4];
|
||||
ZeroMemory(cryptKey, sizeof(cryptKey));
|
||||
GetCryptKey(cryptKey, arrsize(cryptKey));
|
||||
|
||||
@ -1046,12 +1046,12 @@ static void LoadUserPass (LoginDialogParam *pLoginParam)
|
||||
pLoginParam->remember = false;
|
||||
pLoginParam->username[0] = '\0';
|
||||
|
||||
wchar fileAndPath[MAX_PATH];
|
||||
wchar_t fileAndPath[MAX_PATH];
|
||||
PathGetInitDirectory(fileAndPath, arrsize(fileAndPath));
|
||||
PathAddFilename(fileAndPath, fileAndPath, L"login.dat", arrsize(fileAndPath));
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
// internal builds can use the local init directory
|
||||
wchar localFileAndPath[MAX_PATH];
|
||||
wchar_t localFileAndPath[MAX_PATH];
|
||||
StrCopy(localFileAndPath, L"init\\login.dat", arrsize(localFileAndPath));
|
||||
if (PathDoesFileExist(localFileAndPath))
|
||||
StrCopy(fileAndPath, localFileAndPath, arrsize(localFileAndPath));
|
||||
@ -1059,7 +1059,7 @@ static void LoadUserPass (LoginDialogParam *pLoginParam)
|
||||
hsStream* stream = plEncryptedStream::OpenEncryptedFile(fileAndPath, true, cryptKey);
|
||||
if (stream && !stream->AtEnd())
|
||||
{
|
||||
UInt32 savedKey[4];
|
||||
uint32_t savedKey[4];
|
||||
stream->Read(sizeof(savedKey), savedKey);
|
||||
|
||||
if (memcmp(cryptKey, savedKey, sizeof(savedKey)) == 0)
|
||||
@ -1166,7 +1166,7 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||
}
|
||||
|
||||
char windowName[256];
|
||||
wchar productString[256];
|
||||
wchar_t productString[256];
|
||||
ProductString(productString, arrsize(productString));
|
||||
StrToAnsi(windowName, productString, arrsize(windowName));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_PRODUCTSTRING), WM_SETTEXT, 0, (LPARAM) windowName);
|
||||
@ -1251,7 +1251,7 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||
}
|
||||
else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_URULOGIN_GAMETAPLINK)
|
||||
{
|
||||
const wchar *signupurl = GetServerSignupUrl();
|
||||
const wchar_t *signupurl = GetServerSignupUrl();
|
||||
ShellExecuteW(NULL, L"open", signupurl, NULL, NULL, SW_SHOWNORMAL);
|
||||
|
||||
return TRUE;
|
||||
@ -1380,7 +1380,7 @@ LONG WINAPI plCustomUnhandledExceptionFilter( struct _EXCEPTION_POINTERS *Except
|
||||
}
|
||||
|
||||
char prodName[256];
|
||||
wchar productString[256];
|
||||
wchar_t productString[256];
|
||||
ProductString(productString, arrsize(productString));
|
||||
StrToAnsi(prodName, productString, arrsize(prodName));
|
||||
|
||||
@ -1390,7 +1390,7 @@ LONG WINAPI plCustomUnhandledExceptionFilter( struct _EXCEPTION_POINTERS *Except
|
||||
|
||||
/// Print the info out to a log file as well
|
||||
hsUNIXStream log;
|
||||
wchar fileAndPath[MAX_PATH];
|
||||
wchar_t fileAndPath[MAX_PATH];
|
||||
PathGetLogDirectory(fileAndPath, arrsize(fileAndPath));
|
||||
PathAddFilename(fileAndPath, fileAndPath, L"stackDump.log", arrsize(fileAndPath));
|
||||
if( log.Open( fileAndPath, L"wt" ) )
|
||||
@ -1430,7 +1430,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
||||
gDataServerLocal = true;
|
||||
#endif
|
||||
|
||||
const wchar *serverIni = L"server.ini";
|
||||
const wchar_t *serverIni = L"server.ini";
|
||||
if (cmdParser.IsSpecified(kArgServerIni))
|
||||
serverIni = cmdParser.GetString(kArgServerIni);
|
||||
|
||||
@ -1458,8 +1458,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
||||
ZERO(si);
|
||||
ZERO(pi);
|
||||
si.cb = sizeof(si);
|
||||
wchar cmdLine[MAX_PATH];
|
||||
const wchar ** addrs;
|
||||
wchar_t cmdLine[MAX_PATH];
|
||||
const wchar_t ** addrs;
|
||||
|
||||
if (!eventExists) // if it is missing, assume patcher wasn't launched
|
||||
{
|
||||
@ -1487,7 +1487,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
||||
#endif
|
||||
|
||||
// Load an optional general.ini
|
||||
wchar gipath[MAX_PATH];
|
||||
wchar_t gipath[MAX_PATH];
|
||||
PathGetInitDirectory(gipath, arrsize(gipath));
|
||||
PathAddFilename(gipath, gipath, L"general.ini", arrsize(gipath));
|
||||
FILE *generalini = _wfopen(gipath, L"rb");
|
||||
@ -1553,7 +1553,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
||||
if (!doIntroDialogs && loginParam.remember) {
|
||||
ENetError auth;
|
||||
|
||||
wchar wusername[kMaxAccountNameLength];
|
||||
wchar_t wusername[kMaxAccountNameLength];
|
||||
StrToUnicode(wusername, loginParam.username, arrsize(wusername));
|
||||
NetCommSetAccountUsernamePassword(wusername, loginParam.namePassHash);
|
||||
bool cancelled = AuthenticateNetClientComm(&auth, NULL);
|
||||
@ -1616,7 +1616,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
||||
gDebugFile = NULL;
|
||||
if ( !plStatusLog::fLoggingOff )
|
||||
{
|
||||
wchar fileAndPath[MAX_PATH];
|
||||
wchar_t fileAndPath[MAX_PATH];
|
||||
PathGetLogDirectory(fileAndPath, arrsize(fileAndPath));
|
||||
PathAddFilename(fileAndPath, fileAndPath, L"plasmalog.txt", arrsize(fileAndPath));
|
||||
gDebugFile = _wfopen(fileAndPath, L"wt");
|
||||
@ -1625,7 +1625,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
||||
if (gDebugFile != NULL)
|
||||
{
|
||||
char prdName[256];
|
||||
wchar prdString[256];
|
||||
wchar_t prdString[256];
|
||||
ProductString(prdString, arrsize(prdString));
|
||||
StrToAnsi(prdName, prdString, arrsize(prdName));
|
||||
fprintf(gDebugFile, "%s\n", prdName);
|
||||
@ -1635,10 +1635,10 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
||||
|
||||
// log stackdump.log text if the log exists
|
||||
char stackDumpText[1024];
|
||||
wchar stackDumpTextW[1024];
|
||||
wchar_t stackDumpTextW[1024];
|
||||
memset(stackDumpText, 0, arrsize(stackDumpText));
|
||||
memset(stackDumpTextW, 0, arrsize(stackDumpTextW) * sizeof(wchar));
|
||||
wchar fileAndPath[MAX_PATH];
|
||||
memset(stackDumpTextW, 0, arrsize(stackDumpTextW) * sizeof(wchar_t));
|
||||
wchar_t fileAndPath[MAX_PATH];
|
||||
PathGetLogDirectory(fileAndPath, arrsize(fileAndPath));
|
||||
PathAddFilename(fileAndPath, fileAndPath, L"stackDump.log", arrsize(fileAndPath));
|
||||
FILE *stackDumpLog = _wfopen(fileAndPath, L"r");
|
||||
@ -1758,7 +1758,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
|
||||
return PARABLE_NORMAL_EXIT;
|
||||
}
|
||||
|
||||
static void GetCryptKey(UInt32* cryptKey, unsigned numElements)
|
||||
static void GetCryptKey(uint32_t* cryptKey, unsigned numElements)
|
||||
{
|
||||
char volName[] = "C:\\";
|
||||
int index = 0;
|
||||
|
@ -42,9 +42,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plClientKey.h"
|
||||
#include "hsWindows.h"
|
||||
|
||||
typedef const UInt32* (*GETKEY)();
|
||||
typedef const uint32_t* (*GETKEY)();
|
||||
|
||||
const UInt32* plClientKey::GetKey()
|
||||
const uint32_t* plClientKey::GetKey()
|
||||
{
|
||||
HMODULE hDll = LoadLibrary("sp.dll");
|
||||
if (hDll)
|
||||
@ -52,7 +52,7 @@ const UInt32* plClientKey::GetKey()
|
||||
GETKEY getKey = (GETKEY)GetProcAddress(hDll, "GetKey");
|
||||
if (getKey)
|
||||
{
|
||||
static UInt32 key[4];
|
||||
static uint32_t key[4];
|
||||
memcpy(key, getKey(), sizeof(key));
|
||||
FreeLibrary(hDll);
|
||||
return key;
|
||||
|
@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
//
|
||||
namespace plClientKey
|
||||
{
|
||||
const UInt32* GetKey();
|
||||
const uint32_t* GetKey();
|
||||
}
|
||||
|
||||
#endif // plClientKey_h_inc
|
@ -55,19 +55,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*
|
||||
***/
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
static const wchar s_manifest[] = L"Internal";
|
||||
static const wchar s_macmanifest[] = L"macInternal";
|
||||
static const wchar s_thinmanifest[] = L"ThinInternal";
|
||||
static const wchar_t s_manifest[] = L"Internal";
|
||||
static const wchar_t s_macmanifest[] = L"macInternal";
|
||||
static const wchar_t s_thinmanifest[] = L"ThinInternal";
|
||||
#else
|
||||
static const wchar s_manifest[] = L"External";
|
||||
static const wchar s_macmanifest[] = L"macExternal";
|
||||
static const wchar s_thinmanifest[] = L"ThinExternal";
|
||||
static const wchar_t s_manifest[] = L"External";
|
||||
static const wchar_t s_macmanifest[] = L"macExternal";
|
||||
static const wchar_t s_thinmanifest[] = L"ThinExternal";
|
||||
#endif
|
||||
|
||||
struct ManifestFile
|
||||
{
|
||||
LINK(ManifestFile) link;
|
||||
ManifestFile(const wchar clientName[], const wchar downloadName[], const wchar md5val[], int flags, plLauncherInfo *info)
|
||||
ManifestFile(const wchar_t clientName[], const wchar_t downloadName[], const wchar_t md5val[], int flags, plLauncherInfo *info)
|
||||
{
|
||||
StrCopy(filename, clientName, arrsize(filename));
|
||||
StrCopy(zipName, downloadName, arrsize(zipName));
|
||||
@ -77,9 +77,9 @@ struct ManifestFile
|
||||
md5failed = false;
|
||||
}
|
||||
|
||||
wchar filename[MAX_PATH];
|
||||
wchar zipName[MAX_PATH];
|
||||
wchar md5[MAX_PATH];
|
||||
wchar_t filename[MAX_PATH];
|
||||
wchar_t zipName[MAX_PATH];
|
||||
wchar_t md5[MAX_PATH];
|
||||
int flags;
|
||||
bool md5failed;
|
||||
plLauncherInfo *info;
|
||||
@ -88,13 +88,13 @@ struct ManifestFile
|
||||
|
||||
class ProgressStream : public plZlibStream {
|
||||
public:
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
static plLauncherInfo *info;
|
||||
static long totalBytes;
|
||||
static unsigned progress;
|
||||
|
||||
// for updating bytes per second
|
||||
static dword startTime;
|
||||
static uint32_t startTime;
|
||||
};
|
||||
|
||||
struct ProcessManifestEntryParam {
|
||||
@ -107,7 +107,7 @@ struct ProcessManifestEntryParam {
|
||||
};
|
||||
|
||||
struct ManifestResult {
|
||||
wchar group[MAX_PATH];
|
||||
wchar_t group[MAX_PATH];
|
||||
ARRAY(NetCliFileManifestEntry) manifest;
|
||||
long * indicator;
|
||||
plLauncherInfo * info;
|
||||
@ -120,7 +120,7 @@ struct ManifestResult {
|
||||
static void DownloadCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar filename[],
|
||||
const wchar_t filename[],
|
||||
hsStream * writer
|
||||
);
|
||||
|
||||
@ -165,7 +165,7 @@ static long s_perf[kNumPerf];
|
||||
long ProgressStream::totalBytes;
|
||||
unsigned ProgressStream::progress;
|
||||
plLauncherInfo * ProgressStream::info;
|
||||
dword ProgressStream::startTime = 0;
|
||||
uint32_t ProgressStream::startTime = 0;
|
||||
long ProcessManifestEntryParam::progress = 0;
|
||||
long ProcessManifestEntryParam::totalSize = 0;
|
||||
double ProcessManifestEntryParam::startTime = 0;
|
||||
@ -181,9 +181,9 @@ double ProcessManifestEntryParam::startTime = 0;
|
||||
// leaving clients with older patchers "dead in the water", without
|
||||
// a way to play Uru.
|
||||
#ifdef PLASMA_EXTERNAL_RELEASE
|
||||
const wchar kPatcherExeFilename[] = L"UruLauncher.exe";
|
||||
const wchar_t kPatcherExeFilename[] = L"UruLauncher.exe";
|
||||
#else
|
||||
const wchar kPatcherExeFilename[] = L"plUruLauncher.exe";
|
||||
const wchar_t kPatcherExeFilename[] = L"plUruLauncher.exe";
|
||||
#endif
|
||||
|
||||
|
||||
@ -192,9 +192,9 @@ const wchar kPatcherExeFilename[] = L"plUruLauncher.exe";
|
||||
//============================================================================
|
||||
#ifdef PLASMA_EXTERNAL_RELEASE
|
||||
#ifdef HS_DEBUGGING
|
||||
static wchar s_clientExeName[] = L"plClient_dbg.exe";
|
||||
static wchar_t s_clientExeName[] = L"plClient_dbg.exe";
|
||||
#else
|
||||
static wchar s_clientExeName[] = L"UruExplorer.exe";
|
||||
static wchar_t s_clientExeName[] = L"UruExplorer.exe";
|
||||
#endif // HS_DEBUGGING
|
||||
|
||||
//============================================================================
|
||||
@ -202,9 +202,9 @@ static wchar s_clientExeName[] = L"UruExplorer.exe";
|
||||
//============================================================================
|
||||
#else
|
||||
#ifdef HS_DEBUGGING
|
||||
static wchar s_clientExeName[] = L"plClient_dbg.exe";
|
||||
static wchar_t s_clientExeName[] = L"plClient_dbg.exe";
|
||||
#else
|
||||
static wchar s_clientExeName[] = L"plClient.exe";
|
||||
static wchar_t s_clientExeName[] = L"plClient.exe";
|
||||
#endif // HS_DEBUGGING
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
|
||||
@ -216,14 +216,14 @@ static wchar s_clientExeName[] = L"plClient.exe";
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
static void LogHandler (ELogSeverity severity, const wchar msg[]) {
|
||||
static void LogHandler (ELogSeverity severity, const wchar_t msg[]) {
|
||||
AsyncLogWriteMsg(L"UruPlayer", severity, msg);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void NetErrorHandler (ENetProtocol protocol, ENetError error) {
|
||||
|
||||
const wchar * srv;
|
||||
const wchar_t * srv;
|
||||
switch (protocol) {
|
||||
case kNetProtocolNil: srv = L"Notify"; break;
|
||||
case kNetProtocolCli2File: srv = L"File"; break;
|
||||
@ -287,7 +287,7 @@ static void WaitUruExitProc (void * param) {
|
||||
*/
|
||||
|
||||
//============================================================================
|
||||
static bool MD5Check (const char filename[], const wchar md5[]) {
|
||||
static bool MD5Check (const char filename[], const wchar_t md5[]) {
|
||||
// Do md5 check
|
||||
char md5copy[MAX_PATH];
|
||||
plMD5Checksum existingMD5(filename);
|
||||
@ -315,7 +315,7 @@ static void DecompressOgg (ManifestFile *mf) {
|
||||
break;
|
||||
}
|
||||
|
||||
UInt32 size = reader->GetDataSize();
|
||||
uint32_t size = reader->GetDataSize();
|
||||
delete reader;
|
||||
|
||||
ULARGE_INTEGER freeBytesAvailable, totalNumberOfBytes, neededBytes;
|
||||
@ -355,7 +355,7 @@ static void RequestNextManifestFile () {
|
||||
return;
|
||||
s_manifestQueue.Unlink(nextfile);
|
||||
char path[MAX_PATH];
|
||||
wchar basePath[MAX_PATH];
|
||||
wchar_t basePath[MAX_PATH];
|
||||
StrPrintf(path, arrsize(path), "%s%S", s_workingDir, nextfile->filename);
|
||||
StrToUnicode(basePath, path, arrsize(basePath));
|
||||
PathRemoveFilename(basePath, basePath, arrsize(basePath));
|
||||
@ -384,7 +384,7 @@ static void RequestNextManifestFile () {
|
||||
static void DownloadCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar filename[],
|
||||
const wchar_t filename[],
|
||||
hsStream * writer
|
||||
) {
|
||||
s_numConnectFailures = 0;
|
||||
@ -457,7 +457,7 @@ static void DownloadCallback (
|
||||
|
||||
if(s_running)
|
||||
{
|
||||
wchar ext[MAX_EXT];
|
||||
wchar_t ext[MAX_EXT];
|
||||
PathSplitPath(mf->filename, nil, nil, nil, ext);
|
||||
if(!StrCmpI(L".ogg", ext))
|
||||
{
|
||||
@ -497,7 +497,7 @@ static void ProcessManifestEntry (void * param, ENetError error) {
|
||||
s_workingDir,
|
||||
p->mr->manifest[p->index].clientName
|
||||
);
|
||||
dword start = (dword)(TimeGetTime() / kTimeIntervalsPerMs);
|
||||
uint32_t start = (uint32_t)(TimeGetTime() / kTimeIntervalsPerMs);
|
||||
if(!MD5Check(path, p->mr->manifest[p->index].md5)) {
|
||||
p->mr->critsect.Enter();
|
||||
p->mr->indices.Add(p->index);
|
||||
@ -506,7 +506,7 @@ static void ProcessManifestEntry (void * param, ENetError error) {
|
||||
}
|
||||
|
||||
// if we have a file that was cached the MD5 check will be really fast throwing off our approx time remaining.
|
||||
dword t = (dword)(TimeGetTime() / kTimeIntervalsPerMs - start);
|
||||
uint32_t t = (uint32_t)(TimeGetTime() / kTimeIntervalsPerMs - start);
|
||||
if(t < 25)
|
||||
{
|
||||
// cached file
|
||||
@ -542,7 +542,7 @@ static void ProcessManifestEntry (void * param, ENetError error) {
|
||||
|
||||
//============================================================================
|
||||
static void ProcessManifest (void * param) {
|
||||
wchar basePath[MAX_PATH];
|
||||
wchar_t basePath[MAX_PATH];
|
||||
char path[MAX_PATH];
|
||||
AtomicAdd(&s_perf[kPerfThreadTaskCount], 1);
|
||||
|
||||
@ -662,7 +662,7 @@ static void ProcessManifest (void * param) {
|
||||
static void ManifestCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar group[],
|
||||
const wchar_t group[],
|
||||
const NetCliFileManifestEntry manifest[],
|
||||
unsigned entryCount
|
||||
){
|
||||
@ -725,7 +725,7 @@ static void ManifestCallback (
|
||||
static void ThinManifestCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar group[],
|
||||
const wchar_t group[],
|
||||
const NetCliFileManifestEntry manifest[],
|
||||
unsigned entryCount
|
||||
){
|
||||
@ -788,7 +788,7 @@ static void ThinManifestCallback (
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
UInt32 ProgressStream::Write(UInt32 byteCount, const void* buffer) {
|
||||
uint32_t ProgressStream::Write(uint32_t byteCount, const void* buffer) {
|
||||
if(!s_running || s_patchError)
|
||||
return 0;
|
||||
if(!startTime) {
|
||||
@ -814,7 +814,7 @@ UInt32 ProgressStream::Write(UInt32 byteCount, const void* buffer) {
|
||||
info->SetBytesRemaining(totalBytes - progress);
|
||||
if(TimeGetSecondsSince2001Utc() != startTime)
|
||||
{
|
||||
dword bytesPerSec = (progress ) / (TimeGetSecondsSince2001Utc() - startTime);
|
||||
uint32_t bytesPerSec = (progress ) / (TimeGetSecondsSince2001Utc() - startTime);
|
||||
info->SetTimeRemaining(bytesPerSec ? (totalBytes - progress) / bytesPerSec : 0);
|
||||
}
|
||||
}
|
||||
@ -826,7 +826,7 @@ UInt32 ProgressStream::Write(UInt32 byteCount, const void* buffer) {
|
||||
static void FileSrvIpAddressCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar addr[]
|
||||
const wchar_t addr[]
|
||||
) {
|
||||
NetCliGateKeeperDisconnect();
|
||||
|
||||
@ -866,7 +866,7 @@ void InitAsyncCore () {
|
||||
AsyncCoreInitialize();
|
||||
AsyncLogInitialize(L"Log", false);
|
||||
|
||||
wchar productString[256];
|
||||
wchar_t productString[256];
|
||||
ProductString(productString, arrsize(productString));
|
||||
LogMsg(kLogPerf, L"Patcher: %s", productString);
|
||||
}
|
||||
@ -902,7 +902,7 @@ void UruPrepProc (void * param) {
|
||||
s_patchComplete = false;
|
||||
s_patchError = false;
|
||||
|
||||
const wchar ** addrs;
|
||||
const wchar_t ** addrs;
|
||||
unsigned count;
|
||||
|
||||
count = GetGateKeeperSrvHostnames(&addrs);
|
||||
@ -974,11 +974,11 @@ void UruStartProc (void * param) {
|
||||
|
||||
plLauncherInfo *info = (plLauncherInfo *) param;
|
||||
|
||||
wchar workDir[MAX_PATH];
|
||||
wchar_t workDir[MAX_PATH];
|
||||
StrPrintf(workDir, arrsize(workDir), L"%s", info->path);
|
||||
//fprintf(stderr, "URUPlayer StartProc gamePath is:%ws\n", workDir);
|
||||
|
||||
wchar cmdLine[MAX_PATH];
|
||||
wchar_t cmdLine[MAX_PATH];
|
||||
StrPrintf(cmdLine, arrsize(cmdLine), L"%s%s %s", workDir, s_clientExeName, info->cmdLine);
|
||||
|
||||
// Create the named event so the client won't restart us (Windows will clean it up when we exit)
|
||||
|
@ -64,4 +64,4 @@ void UruStartProc (void * param);
|
||||
void PlayerTerminateProc (void * param);
|
||||
void PlayerStopProc (void * param);
|
||||
|
||||
extern const wchar kPatcherExeFilename[];
|
||||
extern const wchar_t kPatcherExeFilename[];
|
||||
|
@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
void EncryptFiles(const char* dir, const char* ext, bool encrypt);
|
||||
|
||||
void print_version(){
|
||||
wchar productString[256];
|
||||
wchar_t productString[256];
|
||||
ProductString(productString, arrsize(productString));
|
||||
printf("%S\n\n", productString);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include <string>
|
||||
|
||||
void print_version() {
|
||||
wchar productString[256];
|
||||
wchar_t productString[256];
|
||||
ProductString(productString, arrsize(productString));
|
||||
printf("%S\n\n", productString);
|
||||
}
|
||||
@ -75,40 +75,40 @@ void print_help() {
|
||||
|
||||
void GenerateKey(bool useDefault)
|
||||
{
|
||||
UInt32 key[4];
|
||||
uint32_t key[4];
|
||||
if (useDefault)
|
||||
{
|
||||
unsigned memSize = min(arrsize(key), arrsize(plSecureStream::kDefaultKey));
|
||||
memSize *= sizeof(UInt32);
|
||||
memSize *= sizeof(uint32_t);
|
||||
memcpy(key, plSecureStream::kDefaultKey, memSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
srand((unsigned)time(nil));
|
||||
double randNum = (double)rand() / (double)RAND_MAX; // converts to 0..1
|
||||
UInt32 keyNum = (UInt32)(randNum * (double)0xFFFFFFFF); // multiply it by the max unsigned 32-bit int
|
||||
uint32_t keyNum = (uint32_t)(randNum * (double)0xFFFFFFFF); // multiply it by the max unsigned 32-bit int
|
||||
key[0] = keyNum;
|
||||
|
||||
randNum = (double)rand() / (double)RAND_MAX;
|
||||
keyNum = (UInt32)(randNum * (double)0xFFFFFFFF);
|
||||
keyNum = (uint32_t)(randNum * (double)0xFFFFFFFF);
|
||||
key[1] = keyNum;
|
||||
|
||||
randNum = (double)rand() / (double)RAND_MAX;
|
||||
keyNum = (UInt32)(randNum * (double)0xFFFFFFFF);
|
||||
keyNum = (uint32_t)(randNum * (double)0xFFFFFFFF);
|
||||
key[2] = keyNum;
|
||||
|
||||
randNum = (double)rand() / (double)RAND_MAX;
|
||||
keyNum = (UInt32)(randNum * (double)0xFFFFFFFF);
|
||||
keyNum = (uint32_t)(randNum * (double)0xFFFFFFFF);
|
||||
key[3] = keyNum;
|
||||
}
|
||||
|
||||
hsUNIXStream out;
|
||||
out.Open(plFileUtils::kKeyFilename, "wb");
|
||||
out.Write(sizeof(UInt32) * arrsize(key), (void*)key);
|
||||
out.Write(sizeof(uint32_t) * arrsize(key), (void*)key);
|
||||
out.Close();
|
||||
}
|
||||
|
||||
void SecureFiles(std::string dir, std::string ext, UInt32* key)
|
||||
void SecureFiles(std::string dir, std::string ext, uint32_t* key)
|
||||
{
|
||||
char filePath[256];
|
||||
|
||||
@ -203,7 +203,7 @@ int main(int argc, char *argv[])
|
||||
SecureFiles(directory, ext, nil);
|
||||
else
|
||||
{
|
||||
UInt32 key[4];
|
||||
uint32_t key[4];
|
||||
plFileUtils::GetSecureEncryptionKey(plFileUtils::kKeyFilename, key, arrsize(key));
|
||||
SecureFiles(directory, ext, key);
|
||||
}
|
||||
|
@ -62,16 +62,16 @@ void IProcessFile(const char *path)
|
||||
|
||||
if( fpIn != nil && fpOut != nil)
|
||||
{
|
||||
UInt8 line[ 2048 ];
|
||||
uint8_t line[ 2048 ];
|
||||
while( !feof( fpIn ) )
|
||||
{
|
||||
// Read next string
|
||||
long pos = ftell(fpIn);
|
||||
if( pos == -1L )
|
||||
break;
|
||||
UInt8 hint = (UInt8)pos;
|
||||
UInt16 sizeHint = (UInt16)pos;
|
||||
UInt16 size;
|
||||
uint8_t hint = (uint8_t)pos;
|
||||
uint16_t sizeHint = (uint16_t)pos;
|
||||
uint16_t size;
|
||||
|
||||
if( stricmp( path + strlen( path ) - 4, ".log" ) == 0 )
|
||||
{
|
||||
@ -81,14 +81,14 @@ void IProcessFile(const char *path)
|
||||
int c = fgetc( fpIn );
|
||||
if( c == EOF || c == hint )
|
||||
break;
|
||||
line[ i ] = (UInt8)c;
|
||||
line[ i ] = (uint8_t)c;
|
||||
}
|
||||
line[ i ] = 0;
|
||||
size = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
// UInt16 line length is encoded first
|
||||
// uint16_t line length is encoded first
|
||||
int c = fgetc( fpIn );
|
||||
if( c == EOF )
|
||||
break;
|
||||
|
@ -67,7 +67,7 @@ bool DumpSounds();
|
||||
//// PrintVersion ///////////////////////////////////////////////////////////////
|
||||
void PrintVersion()
|
||||
{
|
||||
wchar productString[256];
|
||||
wchar_t productString[256];
|
||||
ProductString(productString, arrsize(productString));
|
||||
printf("%S\n\n", productString);
|
||||
}
|
||||
@ -185,7 +185,7 @@ bool DumpSounds()
|
||||
const char* filename = buffer->GetFileName();
|
||||
if (filename)
|
||||
{
|
||||
UInt32 flags = 0;
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (stricmp(plFileUtils::GetFileExt(filename), "wav") != 0)
|
||||
{
|
||||
|
@ -135,8 +135,8 @@ void plPageOptimizer::Optimize()
|
||||
if (loaded)
|
||||
IRewritePage();
|
||||
|
||||
UInt32 oldSize = plFileUtils::GetFileSize(fPagePath);
|
||||
UInt32 newSize = plFileUtils::GetFileSize(fTempPagePath);
|
||||
uint32_t oldSize = plFileUtils::GetFileSize(fPagePath);
|
||||
uint32_t newSize = plFileUtils::GetFileSize(fTempPagePath);
|
||||
|
||||
if (!loaded)
|
||||
{
|
||||
@ -190,19 +190,19 @@ void plPageOptimizer::IWriteKeyData(hsStream* oldPage, hsStream* newPage, plKey
|
||||
class plUpdateKeyImp : public plKeyImp
|
||||
{
|
||||
public:
|
||||
void SetStartPos(UInt32 startPos) { fStartPos = startPos; }
|
||||
void SetStartPos(uint32_t startPos) { fStartPos = startPos; }
|
||||
};
|
||||
|
||||
plUpdateKeyImp* keyImp = (plUpdateKeyImp*)(plKeyImp*)key;
|
||||
UInt32 startPos = keyImp->GetStartPos();
|
||||
UInt32 len = keyImp->GetDataLen();
|
||||
uint32_t startPos = keyImp->GetStartPos();
|
||||
uint32_t len = keyImp->GetDataLen();
|
||||
|
||||
oldPage->SetPosition(startPos);
|
||||
if (len > fBuf.size())
|
||||
fBuf.resize(len);
|
||||
oldPage->Read(len, &fBuf[0]);
|
||||
|
||||
UInt32 newStartPos = newPage->GetPosition();
|
||||
uint32_t newStartPos = newPage->GetPosition();
|
||||
|
||||
// If we move any buffers, this page wasn't optimized already
|
||||
if (newStartPos != startPos)
|
||||
@ -223,7 +223,7 @@ void plPageOptimizer::IRewritePage()
|
||||
|
||||
const plPageInfo& pageInfo = fPageNode->GetPageInfo();
|
||||
|
||||
UInt32 dataStart = pageInfo.GetDataStart();
|
||||
uint32_t dataStart = pageInfo.GetDataStart();
|
||||
|
||||
fBuf.resize(dataStart);
|
||||
|
||||
@ -243,31 +243,31 @@ void plPageOptimizer::IRewritePage()
|
||||
IWriteKeyData(&oldPage, &newPage, fAllKeys[i]);
|
||||
}
|
||||
|
||||
UInt32 newKeyStart = newPage.GetPosition();
|
||||
UInt32 oldKeyStart = pageInfo.GetIndexStart();
|
||||
uint32_t newKeyStart = newPage.GetPosition();
|
||||
uint32_t oldKeyStart = pageInfo.GetIndexStart();
|
||||
oldPage.SetPosition(oldKeyStart);
|
||||
|
||||
UInt32 numTypes = oldPage.ReadSwap32();
|
||||
uint32_t numTypes = oldPage.ReadSwap32();
|
||||
newPage.WriteSwap32(numTypes);
|
||||
|
||||
for (UInt32 i = 0; i < numTypes; i++)
|
||||
for (uint32_t i = 0; i < numTypes; i++)
|
||||
{
|
||||
UInt16 classType = oldPage.ReadSwap16();
|
||||
UInt32 len = oldPage.ReadSwap32();
|
||||
UInt8 flags = oldPage.ReadByte();
|
||||
UInt32 numKeys = oldPage.ReadSwap32();
|
||||
uint16_t classType = oldPage.ReadSwap16();
|
||||
uint32_t len = oldPage.ReadSwap32();
|
||||
uint8_t flags = oldPage.ReadByte();
|
||||
uint32_t numKeys = oldPage.ReadSwap32();
|
||||
|
||||
newPage.WriteSwap16(classType);
|
||||
newPage.WriteSwap32(len);
|
||||
newPage.WriteByte(flags);
|
||||
newPage.WriteSwap32(numKeys);
|
||||
|
||||
for (UInt32 j = 0; j < numKeys; j++)
|
||||
for (uint32_t j = 0; j < numKeys; j++)
|
||||
{
|
||||
plUoid uoid;
|
||||
uoid.Read(&oldPage);
|
||||
UInt32 startPos = oldPage.ReadSwap32();
|
||||
UInt32 dataLen = oldPage.ReadSwap32();
|
||||
uint32_t startPos = oldPage.ReadSwap32();
|
||||
uint32_t dataLen = oldPage.ReadSwap32();
|
||||
|
||||
// Get the new start pos
|
||||
plKeyImp* key = (plKeyImp*)fResMgr->FindKey(uoid);
|
||||
|
@ -59,7 +59,7 @@ protected:
|
||||
KeyVec fKeyLoadOrder; // The order objects were loaded in
|
||||
KeySet fLoadedKeys; // Keys we've loaded objects for, for quick lookup
|
||||
KeyVec fAllKeys; // All the keys in the page
|
||||
std::vector<UInt8> fBuf;
|
||||
std::vector<uint8_t> fBuf;
|
||||
|
||||
bool fOptimized; // True after optimization if the page was already optimized
|
||||
|
||||
|
@ -126,7 +126,7 @@ bool plNetShareFileGrabber::FileToStream(const char* path, hsStream* stream)
|
||||
if (fileStream.Open(filePath.c_str()))
|
||||
{
|
||||
char* buffer = new char[BUFFER_SIZE];
|
||||
UInt32 streamSize = fileStream.GetSizeLeft();
|
||||
uint32_t streamSize = fileStream.GetSizeLeft();
|
||||
while (streamSize > (BUFFER_SIZE))
|
||||
{
|
||||
fileStream.Read(BUFFER_SIZE, buffer);
|
||||
|
@ -55,9 +55,9 @@ public:
|
||||
char* fFilename;
|
||||
plMD5Checksum fSum;
|
||||
plMD5Checksum fLocalSum;
|
||||
UInt32 fSize;
|
||||
UInt32 fCompressedSize;
|
||||
UInt32 fFlags;
|
||||
uint32_t fSize;
|
||||
uint32_t fCompressedSize;
|
||||
uint32_t fFlags;
|
||||
};
|
||||
|
||||
plManifest::plManifest(LogFunc log) :
|
||||
@ -175,8 +175,8 @@ void plManifest::DownloadUpdates(ProgressFunc progress, plFileGrabber* grabber)
|
||||
if (localStream.Open(file->fFilename, "wb"))
|
||||
{
|
||||
char dataBuf[1024];
|
||||
UInt32 sizeLeft = serverStream.GetSizeLeft();
|
||||
while (UInt32 amtRead = serverStream.Read( (sizeof(dataBuf) > sizeLeft) ? sizeLeft : sizeof(dataBuf), dataBuf))
|
||||
uint32_t sizeLeft = serverStream.GetSizeLeft();
|
||||
while (uint32_t amtRead = serverStream.Read( (sizeof(dataBuf) > sizeLeft) ? sizeLeft : sizeof(dataBuf), dataBuf))
|
||||
{
|
||||
progress(file->fFilename, amtRead);
|
||||
|
||||
@ -228,7 +228,7 @@ void plManifest::IWriteCache()
|
||||
|
||||
bool openedFile = false;
|
||||
|
||||
UInt32 numFiles = 0;
|
||||
uint32_t numFiles = 0;
|
||||
for (int i = 0; i < fFiles.size(); i++)
|
||||
{
|
||||
plManifestFile* file = fFiles[i];
|
||||
@ -278,8 +278,8 @@ void plManifest::IReadCache(ProgressFunc progress)
|
||||
|
||||
if (s)
|
||||
{
|
||||
UInt32 numCached = s->ReadSwap32();
|
||||
UInt32 cacheFileVersion = s->ReadSwap32();
|
||||
uint32_t numCached = s->ReadSwap32();
|
||||
uint32_t cacheFileVersion = s->ReadSwap32();
|
||||
|
||||
if (cacheFileVersion != kCacheFileVersion)
|
||||
{
|
||||
@ -294,7 +294,7 @@ void plManifest::IReadCache(ProgressFunc progress)
|
||||
{
|
||||
char* name = s->ReadSafeString();
|
||||
|
||||
UInt8 checksumBuf[MD5_DIGEST_LENGTH];
|
||||
uint8_t checksumBuf[MD5_DIGEST_LENGTH];
|
||||
s->Read(sizeof(checksumBuf), checksumBuf);
|
||||
plMD5Checksum checksum;
|
||||
checksum.SetValue(checksumBuf);
|
||||
@ -349,7 +349,7 @@ bool plManifest::IDecompressSound(plManifestFile* file)
|
||||
plAudioFileReader* reader = plAudioFileReader::CreateReader(file->fFilename, plAudioCore::kAll, plAudioFileReader::kStreamNative);
|
||||
if (!reader)
|
||||
return false;
|
||||
UInt32 size = reader->GetDataSize();
|
||||
uint32_t size = reader->GetDataSize();
|
||||
delete reader;
|
||||
|
||||
if (hsCheckBits(file->fFlags, kSndFlagCacheSplit))
|
||||
|
@ -61,8 +61,8 @@ protected:
|
||||
typedef std::vector<plManifestFile*> FileVec;
|
||||
FileVec fFiles;
|
||||
|
||||
UInt32 fDownloadFiles;
|
||||
UInt32 fDownloadBytes;
|
||||
uint32_t fDownloadFiles;
|
||||
uint32_t fDownloadBytes;
|
||||
|
||||
bool fDirtySums;
|
||||
|
||||
@ -86,8 +86,8 @@ public:
|
||||
void DownloadUpdates(ProgressFunc progress, plFileGrabber* grabber);
|
||||
|
||||
int NumFiles() { return fFiles.size(); }
|
||||
UInt32 NumDownloadFiles() { return fDownloadFiles; }
|
||||
UInt32 DownloadSize() { return fDownloadBytes; }
|
||||
uint32_t NumDownloadFiles() { return fDownloadFiles; }
|
||||
uint32_t DownloadSize() { return fDownloadBytes; }
|
||||
};
|
||||
|
||||
#endif // plManifest_h_inc
|
@ -360,7 +360,7 @@ void plPlasmaUpdate::IUpdateServer()
|
||||
// Get the manifests
|
||||
//
|
||||
bool gotManifests = IGetManifests(serverRoot, external);
|
||||
UInt32 dlSize = 0;
|
||||
uint32_t dlSize = 0;
|
||||
|
||||
fProgressType = kValidating;
|
||||
|
||||
@ -368,7 +368,7 @@ void plPlasmaUpdate::IUpdateServer()
|
||||
{
|
||||
int i;
|
||||
|
||||
UInt32 numFiles = 0;
|
||||
uint32_t numFiles = 0;
|
||||
for (i = 0; i < fManifests.size(); i++)
|
||||
numFiles += fManifests[i]->NumFiles();
|
||||
|
||||
@ -413,7 +413,7 @@ void plPlasmaUpdate::IDownloadUpdates()
|
||||
|
||||
int i;
|
||||
|
||||
UInt32 dlSize = 0;
|
||||
uint32_t dlSize = 0;
|
||||
for (i = 0; i < fManifests.size(); i++)
|
||||
dlSize += fManifests[i]->DownloadSize();
|
||||
|
||||
|
@ -152,7 +152,7 @@ PyObject* PythonInterface::CompileString(const char *command, const char* filena
|
||||
//
|
||||
// PURPOSE : marshals an object into a char string
|
||||
//
|
||||
hsBool PythonInterface::DumpObject(PyObject* pyobj, char** pickle, Int32* size)
|
||||
hsBool PythonInterface::DumpObject(PyObject* pyobj, char** pickle, int32_t* size)
|
||||
{
|
||||
PyObject *s; // the python string object where the marsalled object wil go
|
||||
// convert object to a marshalled string python object
|
||||
|
@ -52,7 +52,7 @@ namespace PythonInterface
|
||||
void addPythonPath(std::string dir);
|
||||
|
||||
PyObject* CompileString(const char *command, const char* filename);
|
||||
hsBool DumpObject(PyObject* pyobj, char** pickle, Int32* size);
|
||||
hsBool DumpObject(PyObject* pyobj, char** pickle, int32_t* size);
|
||||
int getOutputAndReset(char** line=nil);
|
||||
PyObject* CreateModule(const char* module);
|
||||
hsBool RunPYC(PyObject* code, PyObject* module);
|
||||
|
@ -91,18 +91,18 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
printf("==Packing %s, ",fileName.c_str());
|
||||
|
||||
pyStream.FastFwd();
|
||||
UInt32 pyFileSize = pyStream.GetPosition();
|
||||
uint32_t pyFileSize = pyStream.GetPosition();
|
||||
pyStream.Rewind();
|
||||
|
||||
glueStream.FastFwd();
|
||||
UInt32 glueFileSize = glueStream.GetPosition();
|
||||
uint32_t glueFileSize = glueStream.GetPosition();
|
||||
glueStream.Rewind();
|
||||
|
||||
UInt32 totalSize = pyFileSize + glueFileSize + 2;
|
||||
uint32_t totalSize = pyFileSize + glueFileSize + 2;
|
||||
|
||||
char *code = new char[totalSize];
|
||||
|
||||
UInt32 amountRead = pyStream.Read(pyFileSize, code);
|
||||
uint32_t amountRead = pyStream.Read(pyFileSize, code);
|
||||
hsAssert(amountRead == pyFileSize, "Bad read");
|
||||
|
||||
code[pyFileSize] = '\n';
|
||||
@ -189,7 +189,7 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
|
||||
// make sure that we have code to save
|
||||
if (pythonCode)
|
||||
{
|
||||
Int32 size;
|
||||
int32_t size;
|
||||
char* pycode;
|
||||
PythonInterface::DumpObject(pythonCode,&pycode,&size);
|
||||
|
||||
@ -420,21 +420,21 @@ void PackDirectory(std::string dir, std::string rootPath, std::string pakName, s
|
||||
// set to maximum optimization (includes removing __doc__ strings)
|
||||
Py_OptimizeFlag = 2;
|
||||
|
||||
std::vector<UInt32> filePositions;
|
||||
std::vector<uint32_t> filePositions;
|
||||
filePositions.resize(fileNames.size());
|
||||
|
||||
for (i = 0; i < fileNames.size(); i++)
|
||||
{
|
||||
// strip '.py' from the file name
|
||||
std::string properFileName = fileNames[i].substr(0, fileNames[i].size()-3);
|
||||
UInt32 initialPos = s.GetPosition();
|
||||
uint32_t initialPos = s.GetPosition();
|
||||
WritePythonFile(properFileName, pathNames[i], &s);
|
||||
UInt32 endPos = s.GetPosition();
|
||||
uint32_t endPos = s.GetPosition();
|
||||
|
||||
filePositions[i] = initialPos;
|
||||
}
|
||||
|
||||
s.SetPosition(sizeof(UInt32));
|
||||
s.SetPosition(sizeof(uint32_t));
|
||||
for (i = 0; i < fileNames.size(); i++)
|
||||
{
|
||||
s.WriteSafeString(fileNames[i].c_str());
|
||||
|
@ -151,7 +151,7 @@ static CEvent s_dialogCreateEvent(kEventManualReset);
|
||||
static CCritSect s_critsect;
|
||||
static LISTDECL(WndEvent, link) s_eventQ;
|
||||
static CEvent s_shutdownEvent(kEventManualReset);
|
||||
static wchar s_workingDir[MAX_PATH];
|
||||
static wchar_t s_workingDir[MAX_PATH];
|
||||
static CEvent s_statusEvent(kEventManualReset);
|
||||
static char s_curlError[CURL_ERROR_SIZE];
|
||||
|
||||
@ -202,8 +202,8 @@ static void PostEvent (WndEvent *event) {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void LogV (ELogSev sev, const wchar fmt[], va_list args) {
|
||||
static struct { FILE * file; const wchar * pre; } s_log[] = {
|
||||
static void LogV (ELogSev sev, const wchar_t fmt[], va_list args) {
|
||||
static struct { FILE * file; const wchar_t * pre; } s_log[] = {
|
||||
{ stdout, L"Inf" },
|
||||
{ stderr, L"Err" },
|
||||
};
|
||||
@ -218,7 +218,7 @@ static void LogV (ELogSev sev, const wchar fmt[], va_list args) {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void Log (ELogSev sev, const wchar fmt[], ...) {
|
||||
static void Log (ELogSev sev, const wchar_t fmt[], ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
LogV(sev, fmt, args);
|
||||
@ -227,7 +227,7 @@ static void Log (ELogSev sev, const wchar fmt[], ...) {
|
||||
|
||||
//============================================================================
|
||||
// NOTE: Must use LocalFree() on the return value of this function when finished with the string
|
||||
static wchar *TranslateErrorCode(DWORD errorCode) {
|
||||
static wchar_t *TranslateErrorCode(DWORD errorCode) {
|
||||
LPVOID lpMsgBuf;
|
||||
|
||||
FormatMessageW(
|
||||
@ -236,11 +236,11 @@ static wchar *TranslateErrorCode(DWORD errorCode) {
|
||||
NULL,
|
||||
errorCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(wchar *) &lpMsgBuf,
|
||||
(wchar_t *) &lpMsgBuf,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
return (wchar *)lpMsgBuf;
|
||||
return (wchar_t *)lpMsgBuf;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -531,7 +531,7 @@ static void WindowThreadProc(void *) {
|
||||
SetTimer(s_dialog, kEventTimer, 250, 0);
|
||||
|
||||
char productString[256];
|
||||
wchar productStringW[256];
|
||||
wchar_t productStringW[256];
|
||||
ProductString(productStringW, arrsize(productStringW));
|
||||
StrToAnsi(productString, productStringW, arrsize(productString));
|
||||
SendMessage(GetDlgItem(s_dialog, IDC_PRODUCTSTRING), WM_SETTEXT, 0, (LPARAM) productString);
|
||||
@ -740,8 +740,8 @@ int __stdcall WinMain (
|
||||
){
|
||||
PF_CONSOLE_INITIALIZE(Core)
|
||||
|
||||
wchar token[256];
|
||||
const wchar *appCmdLine = AppGetCommandLine();
|
||||
wchar_t token[256];
|
||||
const wchar_t *appCmdLine = AppGetCommandLine();
|
||||
StrTokenize(&appCmdLine, token, arrsize(token), WHITESPACE);
|
||||
while(!StrStr(token, L".exe") && !StrStr(token, L".tmp"))
|
||||
{
|
||||
@ -750,8 +750,8 @@ int __stdcall WinMain (
|
||||
while (*appCmdLine == L' ')
|
||||
++appCmdLine;
|
||||
|
||||
wchar curPatcherFile[MAX_PATH];
|
||||
wchar newPatcherFile[MAX_PATH];
|
||||
wchar_t curPatcherFile[MAX_PATH];
|
||||
wchar_t newPatcherFile[MAX_PATH];
|
||||
bool isTempPatcher = false;
|
||||
|
||||
PathGetProgramName(curPatcherFile, arrsize(curPatcherFile));
|
||||
@ -780,7 +780,7 @@ int __stdcall WinMain (
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
const wchar *serverIni = L"server.ini";
|
||||
const wchar_t *serverIni = L"server.ini";
|
||||
if(cmdParser.IsSpecified(kArgServerIni))
|
||||
serverIni = cmdParser.GetString(kArgServerIni);
|
||||
|
||||
@ -835,9 +835,9 @@ int __stdcall WinMain (
|
||||
Sleep(1000);
|
||||
|
||||
if (!PathDeleteFile(newPatcherFile)) {
|
||||
wchar error[256];
|
||||
wchar_t error[256];
|
||||
DWORD errorCode = GetLastError();
|
||||
wchar *msg = TranslateErrorCode(errorCode);
|
||||
wchar_t *msg = TranslateErrorCode(errorCode);
|
||||
|
||||
StrPrintf(error, arrsize(error), L"Failed to delete old patcher executable. %s", msg);
|
||||
MessageBoxW(GetTopWindow(nil), error, L"Error", MB_OK);
|
||||
@ -845,9 +845,9 @@ int __stdcall WinMain (
|
||||
break;
|
||||
}
|
||||
if (!PathMoveFile(curPatcherFile, newPatcherFile)) {
|
||||
wchar error[256];
|
||||
wchar_t error[256];
|
||||
DWORD errorCode = GetLastError();
|
||||
wchar *msg = TranslateErrorCode(errorCode);
|
||||
wchar_t *msg = TranslateErrorCode(errorCode);
|
||||
|
||||
StrPrintf(error, arrsize(error), L"Failed to replace old patcher executable. %s", msg);
|
||||
MessageBoxW(GetTopWindow(nil), error, L"Error", MB_OK);
|
||||
@ -864,7 +864,7 @@ int __stdcall WinMain (
|
||||
ZERO(pi);
|
||||
si.cb = sizeof(si);
|
||||
|
||||
wchar cmdline[MAX_PATH];
|
||||
wchar_t cmdline[MAX_PATH];
|
||||
StrPrintf(cmdline, arrsize(cmdline), L"%s %s", newPatcherFile, s_launcherInfo.cmdLine);
|
||||
|
||||
// we have only successfully patched if we actually launch the new version of the patcher
|
||||
@ -891,7 +891,7 @@ int __stdcall WinMain (
|
||||
|
||||
// Clean up old temp files
|
||||
ARRAY(PathFind) paths;
|
||||
wchar fileSpec[MAX_PATH];
|
||||
wchar_t fileSpec[MAX_PATH];
|
||||
PathGetProgramDirectory(fileSpec, arrsize(fileSpec));
|
||||
PathAddFilename(fileSpec, fileSpec, L"*.tmp", arrsize(fileSpec));
|
||||
PathFindFiles(&paths, fileSpec, kPathFlagFile);
|
||||
@ -937,7 +937,7 @@ int __stdcall WinMain (
|
||||
// Self-patch failed
|
||||
SetText("Self-patch failed. Exiting...");
|
||||
if (!s_shutdown) {
|
||||
wchar str[256];
|
||||
wchar_t str[256];
|
||||
StrPrintf(str, arrsize(str), L"Patcher update failed. Error %u, %s", selfPatchResult, NetErrorToString(selfPatchResult));
|
||||
MessageBoxW(GetTopWindow(nil), str, L"Error", MB_OK);
|
||||
}
|
||||
|
@ -56,14 +56,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
***/
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
static const wchar s_manifest[] = L"InternalPatcher";
|
||||
static const wchar_t s_manifest[] = L"InternalPatcher";
|
||||
#else
|
||||
static const wchar s_manifest[] = L"ExternalPatcher";
|
||||
static const wchar_t s_manifest[] = L"ExternalPatcher";
|
||||
#endif
|
||||
|
||||
class SelfPatcherStream : public plZlibStream {
|
||||
public:
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
static plLauncherInfo *info;
|
||||
static unsigned totalBytes;
|
||||
static unsigned progress;
|
||||
@ -76,7 +76,7 @@ static bool s_downloadComplete;
|
||||
static long s_numFiles;
|
||||
static ENetError s_patchResult;
|
||||
static bool s_updated;
|
||||
static wchar s_newPatcherFile[MAX_PATH];
|
||||
static wchar_t s_newPatcherFile[MAX_PATH];
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
@ -105,7 +105,7 @@ static void NetErrorHandler (ENetProtocol protocol, ENetError error) {
|
||||
static void DownloadCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar filename[],
|
||||
const wchar_t filename[],
|
||||
hsStream * writer
|
||||
) {
|
||||
if(IS_NET_ERROR(result)) {
|
||||
@ -135,7 +135,7 @@ static void DownloadCallback (
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static bool MD5Check (const char filename[], const wchar md5[]) {
|
||||
static bool MD5Check (const char filename[], const wchar_t md5[]) {
|
||||
// Do md5 check
|
||||
char md5copy[MAX_PATH];
|
||||
plMD5Checksum existingMD5(filename);
|
||||
@ -150,7 +150,7 @@ static bool MD5Check (const char filename[], const wchar md5[]) {
|
||||
static void ManifestCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar group[],
|
||||
const wchar_t group[],
|
||||
const NetCliFileManifestEntry manifest[],
|
||||
unsigned entryCount
|
||||
) {
|
||||
@ -180,7 +180,7 @@ static void ManifestCallback (
|
||||
|
||||
// MD5 check current patcher against value in manifest
|
||||
ASSERT(entryCount == 1);
|
||||
wchar curPatcherFile[MAX_PATH];
|
||||
wchar_t curPatcherFile[MAX_PATH];
|
||||
PathGetProgramName(curPatcherFile, arrsize(curPatcherFile));
|
||||
StrToAnsi(ansi, curPatcherFile, arrsize(ansi));
|
||||
if (!MD5Check(ansi, manifest[0].md5)) {
|
||||
@ -206,7 +206,7 @@ static void ManifestCallback (
|
||||
static void FileSrvIpAddressCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar addr[]
|
||||
const wchar_t addr[]
|
||||
) {
|
||||
NetCliGateKeeperDisconnect();
|
||||
|
||||
@ -236,7 +236,7 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) {
|
||||
NetClientInitialize();
|
||||
NetClientSetErrorHandler(NetErrorHandler);
|
||||
|
||||
const wchar ** addrs;
|
||||
const wchar_t ** addrs;
|
||||
unsigned count;
|
||||
|
||||
count = GetGateKeeperSrvHostnames(&addrs);
|
||||
@ -267,7 +267,7 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) {
|
||||
ZERO(pi);
|
||||
si.cb = sizeof(si);
|
||||
|
||||
wchar cmdline[MAX_PATH];
|
||||
wchar_t cmdline[MAX_PATH];
|
||||
StrPrintf(cmdline, arrsize(cmdline), L"%s %s", s_newPatcherFile, info->cmdLine);
|
||||
|
||||
// we have only successfully patched if we actually launch the new version of the patcher
|
||||
@ -300,7 +300,7 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) {
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
UInt32 SelfPatcherStream::Write(UInt32 byteCount, const void* buffer) {
|
||||
uint32_t SelfPatcherStream::Write(uint32_t byteCount, const void* buffer) {
|
||||
progress += byteCount;
|
||||
float p = (float)progress / (float)totalBytes * 100; // progress
|
||||
SetProgress( (int)p );
|
||||
|
@ -69,8 +69,8 @@ typedef void (*setTimeRemainingCallback)(unsigned seconds);
|
||||
typedef void (*setBytesRemainingCallback)(unsigned bytes);
|
||||
|
||||
struct plLauncherInfo {
|
||||
wchar path[MAX_PATH];
|
||||
wchar cmdLine[512];
|
||||
wchar_t path[MAX_PATH];
|
||||
wchar_t cmdLine[512];
|
||||
unsigned buildId; // buildId override
|
||||
launcherCallback prepCallback;
|
||||
launcherCallback initCallback;
|
||||
|
@ -51,14 +51,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <class T> class hsExpander {
|
||||
private:
|
||||
Int32 fNumPost;
|
||||
Int32 fNumPostAlloc;
|
||||
int32_t fNumPost;
|
||||
int32_t fNumPostAlloc;
|
||||
T* fArray;
|
||||
|
||||
Int32 fGrowBy; // default = 0, to double
|
||||
Int32 fMinSize; // default = 1, min == 1
|
||||
int32_t fGrowBy; // default = 0, to double
|
||||
int32_t fMinSize; // default = 1, min == 1
|
||||
|
||||
Int32 fCurrent;
|
||||
int32_t fCurrent;
|
||||
|
||||
hsExpander(const hsExpander& x); // make it passed as ref or pointer
|
||||
|
||||
@ -66,29 +66,29 @@ private:
|
||||
public:
|
||||
enum { kMissingIndex = -1 };
|
||||
|
||||
hsExpander(Int32 minSize = 1, Int32 growBy = 0);
|
||||
hsExpander(int32_t minSize = 1, int32_t growBy = 0);
|
||||
virtual ~hsExpander();
|
||||
|
||||
hsExpander<T>& operator=(const hsExpander<T>&orig) { return Copy(orig); }
|
||||
hsExpander<T>& Copy(const hsExpander<T>& orig);
|
||||
|
||||
void SetCount(int cnt) { if( cnt >= fNumPostAlloc )IExpand(cnt); fNumPost = cnt; }
|
||||
Int32 GetCount() const { return fNumPost; }
|
||||
int32_t GetCount() const { return fNumPost; }
|
||||
hsBool Empty() const { return GetCount() == 0; }
|
||||
const T& Get(Int32 index) const;
|
||||
Int32 Get(Int32 index, Int32 count, T data[]) const;
|
||||
Int32 Find(const T&) const; // returns kMissingIndex if not found
|
||||
const T& Get(int32_t index) const;
|
||||
int32_t Get(int32_t index, int32_t count, T data[]) const;
|
||||
int32_t Find(const T&) const; // returns kMissingIndex if not found
|
||||
|
||||
void SetArray(T* a, Int32 cnt);
|
||||
void SetArray(T* a, int32_t cnt);
|
||||
T* GetArray() { return fArray; }
|
||||
T& operator[]( Int32 index );
|
||||
Int32 Append(const T&); // returns t's index
|
||||
T& operator[]( int32_t index );
|
||||
int32_t Append(const T&); // returns t's index
|
||||
T* Append();
|
||||
Int32 Push(const T& t) { return Append(t); }
|
||||
int32_t Push(const T& t) { return Append(t); }
|
||||
T* Push() { return Append(); }
|
||||
T* Top() { return fNumPost ? fArray + fNumPost-1 : nil; }
|
||||
Int32 Pop(T* t); // returns count of remaining
|
||||
Int32 Pop();
|
||||
int32_t Pop(T* t); // returns count of remaining
|
||||
int32_t Pop();
|
||||
void Reset(); // clears out everything
|
||||
|
||||
T& Head() { return fArray[0]; }
|
||||
@ -111,7 +111,7 @@ hsExpander<T>& hsExpander<T>::Copy(const hsExpander<T>& orig)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void hsExpander<T>::SetArray(T* a, Int32 cnt)
|
||||
void hsExpander<T>::SetArray(T* a, int32_t cnt)
|
||||
{
|
||||
delete [] fArray;
|
||||
if( a )
|
||||
@ -122,7 +122,7 @@ void hsExpander<T>::SetArray(T* a, Int32 cnt)
|
||||
template <class T>
|
||||
void hsExpander<T>::IExpand(int newSize)
|
||||
{
|
||||
Int32 newPostAlloc = fNumPostAlloc;
|
||||
int32_t newPostAlloc = fNumPostAlloc;
|
||||
if( !newPostAlloc )
|
||||
newPostAlloc++;
|
||||
while( newPostAlloc <= newSize )
|
||||
@ -137,7 +137,7 @@ void hsExpander<T>::IExpand(int newSize)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
hsExpander<T>::hsExpander(Int32 minSize, Int32 growBy)
|
||||
hsExpander<T>::hsExpander(int32_t minSize, int32_t growBy)
|
||||
{
|
||||
hsThrowIfBadParam(minSize < 0);
|
||||
hsThrowIfBadParam(growBy < 0);
|
||||
@ -170,7 +170,7 @@ void hsExpander<T>::Last()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T& hsExpander<T>::operator[]( Int32 index )
|
||||
T& hsExpander<T>::operator[]( int32_t index )
|
||||
{
|
||||
hsDebugCode(hsThrowIfBadParam((index < 0)||(index >= fNumPost));)
|
||||
|
||||
@ -178,7 +178,7 @@ T& hsExpander<T>::operator[]( Int32 index )
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T& hsExpander<T>::Get( Int32 index ) const
|
||||
const T& hsExpander<T>::Get( int32_t index ) const
|
||||
{
|
||||
hsDebugCode(hsThrowIfBadParam((index < 0)||(index >= fNumPost));)
|
||||
|
||||
@ -186,7 +186,7 @@ const T& hsExpander<T>::Get( Int32 index ) const
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsExpander<T>::Get(Int32 index, Int32 count, T data[]) const
|
||||
int32_t hsExpander<T>::Get(int32_t index, int32_t count, T data[]) const
|
||||
{
|
||||
if( count > 0 )
|
||||
{ hsThrowIfNilParam(data);
|
||||
@ -201,7 +201,7 @@ Int32 hsExpander<T>::Get(Int32 index, Int32 count, T data[]) const
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsExpander<T>::Find(const T& obj) const
|
||||
int32_t hsExpander<T>::Find(const T& obj) const
|
||||
{
|
||||
for (int i = 0; i < fNumPost; i++)
|
||||
if (fArray[i] == obj)
|
||||
@ -210,7 +210,7 @@ Int32 hsExpander<T>::Find(const T& obj) const
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsExpander<T>::Append(const T& obj)
|
||||
int32_t hsExpander<T>::Append(const T& obj)
|
||||
{
|
||||
hsAssert(!(fNumPost >= fNumPostAlloc), "Must be less");
|
||||
if( fNumPost == fNumPostAlloc-1 )
|
||||
@ -229,7 +229,7 @@ T* hsExpander<T>::Append()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsExpander<T>::Pop(T*t)
|
||||
int32_t hsExpander<T>::Pop(T*t)
|
||||
{
|
||||
hsThrowIfBadParam(Empty());
|
||||
--fNumPost;
|
||||
@ -239,7 +239,7 @@ Int32 hsExpander<T>::Pop(T*t)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsExpander<T>::Pop()
|
||||
int32_t hsExpander<T>::Pop()
|
||||
{
|
||||
hsThrowIfBadParam(Empty());
|
||||
--fNumPost;
|
||||
@ -257,16 +257,16 @@ void hsExpander<T>::Reset()
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <class T> class hsBiExpander {
|
||||
private:
|
||||
Int32 fNumPre;
|
||||
Int32 fNumPost;
|
||||
Int32 fNumPreAlloc;
|
||||
Int32 fNumPostAlloc;
|
||||
int32_t fNumPre;
|
||||
int32_t fNumPost;
|
||||
int32_t fNumPreAlloc;
|
||||
int32_t fNumPostAlloc;
|
||||
T* fArray;
|
||||
|
||||
Int32 fGrowBy; // default = 0, to double
|
||||
Int32 fMinSize; // default = 1, min == 1
|
||||
int32_t fGrowBy; // default = 0, to double
|
||||
int32_t fMinSize; // default = 1, min == 1
|
||||
|
||||
Int32 fCurrent;
|
||||
int32_t fCurrent;
|
||||
|
||||
hsBiExpander<T>& operator=(const hsBiExpander<T>&); // don't allow assignment
|
||||
hsBiExpander(const hsBiExpander<T>&); // make it passed as ref or pointer
|
||||
@ -275,26 +275,26 @@ private:
|
||||
public:
|
||||
enum { kMissingIndex = -1 };
|
||||
|
||||
hsBiExpander(Int32 minSize = 1, Int32 growBy = 0);
|
||||
hsBiExpander(int32_t minSize = 1, int32_t growBy = 0);
|
||||
virtual ~hsBiExpander();
|
||||
|
||||
Int32 GetFirst() const { return -fNumPre; }
|
||||
Int32 GetCount() const { return fNumPre + fNumPost; }
|
||||
int32_t GetFirst() const { return -fNumPre; }
|
||||
int32_t GetCount() const { return fNumPre + fNumPost; }
|
||||
hsBool Empty() const { return GetCount() == 0; }
|
||||
const T& Get(Int32 index) const;
|
||||
Int32 Get(Int32 index, Int32 count, T data[]) const;
|
||||
Int32 Find(const T&) const; // returns kMissingIndex if not found
|
||||
const T& Get(int32_t index) const;
|
||||
int32_t Get(int32_t index, int32_t count, T data[]) const;
|
||||
int32_t Find(const T&) const; // returns kMissingIndex if not found
|
||||
|
||||
void SetArray(T* a, Int32 cnt, Int32 numPre=0);
|
||||
void SetArray(T* a, int32_t cnt, int32_t numPre=0);
|
||||
T** GetArray() { return fArray - fNumPre; }
|
||||
T& operator[]( Int32 index );
|
||||
T& operator[]( int32_t index );
|
||||
T* Append(); // returns t's index
|
||||
T* Push(); // returns t's index
|
||||
Int32 Append(const T&); // returns t's index
|
||||
Int32 Push(const T&); // returns t's index
|
||||
Int32 Pop(T*t = nil) { return PopHead(t); } // returns count of remaining
|
||||
Int32 PopHead(T*t = nil); // returns count of remaining
|
||||
Int32 PopTail(T*t = nil); // returns count of remaining
|
||||
int32_t Append(const T&); // returns t's index
|
||||
int32_t Push(const T&); // returns t's index
|
||||
int32_t Pop(T*t = nil) { return PopHead(t); } // returns count of remaining
|
||||
int32_t PopHead(T*t = nil); // returns count of remaining
|
||||
int32_t PopTail(T*t = nil); // returns count of remaining
|
||||
void Reset(); // clears out everything
|
||||
|
||||
T& Head() { return fArray[-fNumPre]; }
|
||||
@ -308,7 +308,7 @@ public:
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void hsBiExpander<T>::SetArray(T* a, Int32 cnt, Int32 numPre)
|
||||
void hsBiExpander<T>::SetArray(T* a, int32_t cnt, int32_t numPre)
|
||||
{
|
||||
if( !numPre )
|
||||
Reset();
|
||||
@ -323,8 +323,8 @@ void hsBiExpander<T>::SetArray(T* a, Int32 cnt, Int32 numPre)
|
||||
template <class T>
|
||||
void hsBiExpander<T>::IExpand(int newSize, hsBool towardEnd)
|
||||
{
|
||||
Int32 newPreAlloc = fNumPreAlloc;
|
||||
Int32 newPostAlloc = fNumPostAlloc;
|
||||
int32_t newPreAlloc = fNumPreAlloc;
|
||||
int32_t newPostAlloc = fNumPostAlloc;
|
||||
if( towardEnd )
|
||||
{
|
||||
if( !newPostAlloc )
|
||||
@ -353,7 +353,7 @@ void hsBiExpander<T>::IExpand(int newSize, hsBool towardEnd)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
hsBiExpander<T>::hsBiExpander(Int32 minSize, Int32 growBy)
|
||||
hsBiExpander<T>::hsBiExpander(int32_t minSize, int32_t growBy)
|
||||
{
|
||||
hsThrowIfBadParam(minSize < 0);
|
||||
hsThrowIfBadParam(growBy < 0);
|
||||
@ -387,7 +387,7 @@ void hsBiExpander<T>::Last()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T& hsBiExpander<T>::operator[]( Int32 index )
|
||||
T& hsBiExpander<T>::operator[]( int32_t index )
|
||||
{
|
||||
hsDebugCode(hsThrowIfBadParam((index < -fNumPre)||(index >= fNumPost));)
|
||||
|
||||
@ -395,7 +395,7 @@ T& hsBiExpander<T>::operator[]( Int32 index )
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T& hsBiExpander<T>::Get( Int32 index ) const
|
||||
const T& hsBiExpander<T>::Get( int32_t index ) const
|
||||
{
|
||||
hsDebugCode(hsThrowIfBadParam((index < -fNumPre)||(index >= fNumPost));)
|
||||
|
||||
@ -403,7 +403,7 @@ const T& hsBiExpander<T>::Get( Int32 index ) const
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsBiExpander<T>::Get(Int32 index, Int32 count, T data[]) const
|
||||
int32_t hsBiExpander<T>::Get(int32_t index, int32_t count, T data[]) const
|
||||
{
|
||||
if( count > 0 )
|
||||
{ hsThrowIfNilParam(data);
|
||||
@ -418,7 +418,7 @@ Int32 hsBiExpander<T>::Get(Int32 index, Int32 count, T data[]) const
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsBiExpander<T>::Find(const T& obj) const
|
||||
int32_t hsBiExpander<T>::Find(const T& obj) const
|
||||
{
|
||||
for (int i = -fNumPre; i < fNumPost; i++)
|
||||
if (fArray[i] == obj)
|
||||
@ -445,7 +445,7 @@ T* hsBiExpander<T>::Push()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsBiExpander<T>::Append(const T& obj)
|
||||
int32_t hsBiExpander<T>::Append(const T& obj)
|
||||
{
|
||||
hsAssert(!(fNumPost >= fNumPostAlloc), "Must be less");
|
||||
if( fNumPost == fNumPostAlloc-1 )
|
||||
@ -455,7 +455,7 @@ Int32 hsBiExpander<T>::Append(const T& obj)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsBiExpander<T>::Push(const T& obj)
|
||||
int32_t hsBiExpander<T>::Push(const T& obj)
|
||||
{
|
||||
hsAssert(!(fNumPre >= fNumPreAlloc), "Must be less");
|
||||
if( ++fNumPre == fNumPreAlloc )
|
||||
@ -465,7 +465,7 @@ Int32 hsBiExpander<T>::Push(const T& obj)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsBiExpander<T>::PopHead(T*t)
|
||||
int32_t hsBiExpander<T>::PopHead(T*t)
|
||||
{
|
||||
hsThrowIfBadParam(Empty());
|
||||
if( t )
|
||||
@ -475,7 +475,7 @@ Int32 hsBiExpander<T>::PopHead(T*t)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsBiExpander<T>::PopTail(T*t)
|
||||
int32_t hsBiExpander<T>::PopTail(T*t)
|
||||
{
|
||||
hsThrowIfBadParam(Empty());
|
||||
--fNumPost;
|
||||
|
@ -62,18 +62,18 @@ hsBitVector::hsBitVector(int b, ...)
|
||||
va_end( vl );
|
||||
}
|
||||
|
||||
hsBitVector::hsBitVector(const hsTArray<Int16>& src)
|
||||
hsBitVector::hsBitVector(const hsTArray<int16_t>& src)
|
||||
: fBitVectors(nil),
|
||||
fNumBitVectors(0)
|
||||
{
|
||||
FromList(src);
|
||||
}
|
||||
|
||||
void hsBitVector::IGrow(UInt32 newNumBitVectors)
|
||||
void hsBitVector::IGrow(uint32_t newNumBitVectors)
|
||||
{
|
||||
hsAssert(newNumBitVectors > fNumBitVectors, "Growing smaller");
|
||||
UInt32 *old = fBitVectors;
|
||||
fBitVectors = TRACKED_NEW UInt32[newNumBitVectors];
|
||||
uint32_t *old = fBitVectors;
|
||||
fBitVectors = TRACKED_NEW uint32_t[newNumBitVectors];
|
||||
int i;
|
||||
for( i = 0; i < fNumBitVectors; i++ )
|
||||
fBitVectors[i] = old[i];
|
||||
@ -95,8 +95,8 @@ hsBitVector& hsBitVector::Compact()
|
||||
for( hiVec = fNumBitVectors-1; (hiVec >= 0)&& !fBitVectors[hiVec]; --hiVec );
|
||||
if( hiVec >= 0 )
|
||||
{
|
||||
UInt32 *old = fBitVectors;
|
||||
fBitVectors = TRACKED_NEW UInt32[++hiVec];
|
||||
uint32_t *old = fBitVectors;
|
||||
fBitVectors = TRACKED_NEW uint32_t[++hiVec];
|
||||
int i;
|
||||
for( i = 0; i < hiVec; i++ )
|
||||
fBitVectors[i] = old[i];
|
||||
@ -119,7 +119,7 @@ void hsBitVector::Read(hsStream* s)
|
||||
if( fNumBitVectors )
|
||||
{
|
||||
delete [] fBitVectors;
|
||||
fBitVectors = TRACKED_NEW UInt32[fNumBitVectors];
|
||||
fBitVectors = TRACKED_NEW uint32_t[fNumBitVectors];
|
||||
int i;
|
||||
for( i = 0; i < fNumBitVectors; i++ )
|
||||
s->LogReadLE(&fBitVectors[i],"BitVector");
|
||||
@ -135,7 +135,7 @@ void hsBitVector::Write(hsStream* s) const
|
||||
s->WriteLE32(fBitVectors[i]);
|
||||
}
|
||||
|
||||
hsTArray<Int16>& hsBitVector::Enumerate(hsTArray<Int16>& dst) const
|
||||
hsTArray<int16_t>& hsBitVector::Enumerate(hsTArray<int16_t>& dst) const
|
||||
{
|
||||
dst.SetCount(0);
|
||||
hsBitIterator iter(*this);
|
||||
@ -148,7 +148,7 @@ hsTArray<Int16>& hsBitVector::Enumerate(hsTArray<Int16>& dst) const
|
||||
return dst;
|
||||
}
|
||||
|
||||
hsBitVector& hsBitVector::FromList(const hsTArray<Int16>& src)
|
||||
hsBitVector& hsBitVector::FromList(const hsTArray<int16_t>& src)
|
||||
{
|
||||
Clear();
|
||||
int i;
|
||||
|
@ -51,17 +51,17 @@ class hsStream;
|
||||
class hsBitVector {
|
||||
|
||||
protected:
|
||||
UInt32* fBitVectors;
|
||||
UInt32 fNumBitVectors;
|
||||
uint32_t* fBitVectors;
|
||||
uint32_t fNumBitVectors;
|
||||
|
||||
void IGrow(UInt32 newNumBitVectors);
|
||||
void IGrow(uint32_t newNumBitVectors);
|
||||
|
||||
friend class hsBitIterator;
|
||||
public:
|
||||
hsBitVector(const hsBitVector& other);
|
||||
hsBitVector(UInt32 which) : fBitVectors(nil), fNumBitVectors(0) { SetBit(which); }
|
||||
hsBitVector(uint32_t which) : fBitVectors(nil), fNumBitVectors(0) { SetBit(which); }
|
||||
hsBitVector(int b, ...); // list of one or more integer bits to set. -1 (or any negative) terminates the list (e.g. hsBitVector(0,1,4,-1);
|
||||
hsBitVector(const hsTArray<Int16>& list); // sets bit for each int in list
|
||||
hsBitVector(const hsTArray<int16_t>& list); // sets bit for each int in list
|
||||
hsBitVector() : fBitVectors(nil), fNumBitVectors(0) {}
|
||||
virtual ~hsBitVector() { Reset(); }
|
||||
|
||||
@ -73,17 +73,17 @@ public:
|
||||
int operator!=(const hsBitVector& other) const { return !(*this == other); }
|
||||
hsBitVector& operator=(const hsBitVector& other); // will wind up identical
|
||||
|
||||
hsBool ClearBit(UInt32 which) { return SetBit(which, 0); } // returns previous state
|
||||
hsBool SetBit(UInt32 which, hsBool on = true); // returns previous state
|
||||
hsBool IsBitSet(UInt32 which) const; // returns current state
|
||||
hsBool ToggleBit(UInt32 which); // returns previous state
|
||||
hsBitVector& RemoveBit(UInt32 which); // removes bit, sliding higher bits down to fill the gap.
|
||||
hsBool ClearBit(uint32_t which) { return SetBit(which, 0); } // returns previous state
|
||||
hsBool SetBit(uint32_t which, hsBool on = true); // returns previous state
|
||||
hsBool IsBitSet(uint32_t which) const; // returns current state
|
||||
hsBool ToggleBit(uint32_t which); // returns previous state
|
||||
hsBitVector& RemoveBit(uint32_t which); // removes bit, sliding higher bits down to fill the gap.
|
||||
|
||||
friend inline int Overlap(const hsBitVector& lhs, const hsBitVector& rhs) { return lhs.Overlap(rhs); }
|
||||
hsBool Overlap(const hsBitVector& other) const;
|
||||
hsBool Empty() const;
|
||||
|
||||
hsBool operator[](UInt32 which) const { return IsBitSet(which); }
|
||||
hsBool operator[](uint32_t which) const { return IsBitSet(which); }
|
||||
|
||||
friend inline hsBitVector operator&(const hsBitVector& lhs, const hsBitVector& rhs); // See Overlap()
|
||||
friend inline hsBitVector operator|(const hsBitVector& lhs, const hsBitVector& rhs);
|
||||
@ -96,19 +96,19 @@ public:
|
||||
hsBitVector& operator-=(const hsBitVector& other); // return me w/ other's bits turned off
|
||||
|
||||
hsBitVector& Compact();
|
||||
hsBitVector& SetSize(UInt32 numBits) { ClearBit(numBits+1); return *this; }
|
||||
UInt32 GetSize() { return fNumBitVectors << 5; }
|
||||
hsBitVector& SetSize(uint32_t numBits) { ClearBit(numBits+1); return *this; }
|
||||
uint32_t GetSize() { return fNumBitVectors << 5; }
|
||||
|
||||
// integer level access
|
||||
UInt32 GetNumBitVectors() const { return fNumBitVectors; }
|
||||
UInt32 GetBitVector(int i) const { return fBitVectors[i]; }
|
||||
void SetNumBitVectors(UInt32 n) { Reset(); fNumBitVectors=n; fBitVectors = TRACKED_NEW UInt32[n]; }
|
||||
void SetBitVector(int i, UInt32 val) { fBitVectors[i]=val; }
|
||||
uint32_t GetNumBitVectors() const { return fNumBitVectors; }
|
||||
uint32_t GetBitVector(int i) const { return fBitVectors[i]; }
|
||||
void SetNumBitVectors(uint32_t n) { Reset(); fNumBitVectors=n; fBitVectors = TRACKED_NEW uint32_t[n]; }
|
||||
void SetBitVector(int i, uint32_t val) { fBitVectors[i]=val; }
|
||||
|
||||
// Do dst.SetCount(0), then add each set bit's index into dst, returning dst.
|
||||
hsTArray<Int16>& Enumerate(hsTArray<Int16>& dst) const;
|
||||
hsTArray<int16_t>& Enumerate(hsTArray<int16_t>& dst) const;
|
||||
// this->Clear(), then set all bits listed in src, returning *this.
|
||||
hsBitVector& FromList(const hsTArray<Int16>& src);
|
||||
hsBitVector& FromList(const hsTArray<int16_t>& src);
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s) const;
|
||||
@ -118,7 +118,7 @@ inline hsBitVector::hsBitVector(const hsBitVector& other)
|
||||
{
|
||||
if( 0 != (fNumBitVectors = other.fNumBitVectors) )
|
||||
{
|
||||
fBitVectors = TRACKED_NEW UInt32[fNumBitVectors];
|
||||
fBitVectors = TRACKED_NEW uint32_t[fNumBitVectors];
|
||||
int i;
|
||||
for( i = 0; i < fNumBitVectors; i++ )
|
||||
fBitVectors[i] = other.fBitVectors[i];
|
||||
@ -160,7 +160,7 @@ inline hsBitVector& hsBitVector::operator=(const hsBitVector& other)
|
||||
{
|
||||
Reset();
|
||||
fNumBitVectors = other.fNumBitVectors;
|
||||
fBitVectors = TRACKED_NEW UInt32[fNumBitVectors];
|
||||
fBitVectors = TRACKED_NEW uint32_t[fNumBitVectors];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -295,12 +295,12 @@ inline hsBitVector& hsBitVector::Set(int upToBit)
|
||||
{
|
||||
if( upToBit >= 0 )
|
||||
{
|
||||
UInt32 major = upToBit >> 5;
|
||||
UInt32 minor = 1 << (upToBit & 0x1f);
|
||||
uint32_t major = upToBit >> 5;
|
||||
uint32_t minor = 1 << (upToBit & 0x1f);
|
||||
if( major >= fNumBitVectors )
|
||||
IGrow(major+1);
|
||||
|
||||
UInt32 i;
|
||||
uint32_t i;
|
||||
for( i = 0; i < major; i++ )
|
||||
fBitVectors[i] = 0xffffffff;
|
||||
for( i = 1; i <= minor && i > 0; i <<= 1 )
|
||||
@ -315,18 +315,18 @@ inline hsBitVector& hsBitVector::Set(int upToBit)
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline hsBool hsBitVector::IsBitSet(UInt32 which) const
|
||||
inline hsBool hsBitVector::IsBitSet(uint32_t which) const
|
||||
{
|
||||
UInt32 major = which >> 5;
|
||||
uint32_t major = which >> 5;
|
||||
return
|
||||
(major < fNumBitVectors)
|
||||
&& (0 != (fBitVectors[major] & 1 << (which & 0x1f)));
|
||||
}
|
||||
|
||||
inline hsBool hsBitVector::SetBit(UInt32 which, hsBool on)
|
||||
inline hsBool hsBitVector::SetBit(uint32_t which, hsBool on)
|
||||
{
|
||||
UInt32 major = which >> 5;
|
||||
UInt32 minor = 1 << (which & 0x1f);
|
||||
uint32_t major = which >> 5;
|
||||
uint32_t minor = 1 << (which & 0x1f);
|
||||
if( major >= fNumBitVectors )
|
||||
IGrow(major+1);
|
||||
hsBool ret = 0 != (fBitVectors[major] & minor);
|
||||
@ -341,10 +341,10 @@ inline hsBool hsBitVector::SetBit(UInt32 which, hsBool on)
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline hsBool hsBitVector::ToggleBit(UInt32 which)
|
||||
inline hsBool hsBitVector::ToggleBit(uint32_t which)
|
||||
{
|
||||
UInt32 major = which >> 5;
|
||||
UInt32 minor = 1 << (which & 0x1f);
|
||||
uint32_t major = which >> 5;
|
||||
uint32_t minor = 1 << (which & 0x1f);
|
||||
if( major >= fNumBitVectors )
|
||||
IGrow(major);
|
||||
hsBool ret = 0 != (fBitVectors[major] & minor);
|
||||
@ -355,14 +355,14 @@ inline hsBool hsBitVector::ToggleBit(UInt32 which)
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline hsBitVector& hsBitVector::RemoveBit(UInt32 which)
|
||||
inline hsBitVector& hsBitVector::RemoveBit(uint32_t which)
|
||||
{
|
||||
UInt32 major = which >> 5;
|
||||
uint32_t major = which >> 5;
|
||||
if( major >= fNumBitVectors )
|
||||
return *this;
|
||||
UInt32 minor = 1 << (which & 0x1f);
|
||||
UInt32 lowMask = minor-1;
|
||||
UInt32 hiMask = ~(lowMask);
|
||||
uint32_t minor = 1 << (which & 0x1f);
|
||||
uint32_t lowMask = minor-1;
|
||||
uint32_t hiMask = ~(lowMask);
|
||||
|
||||
fBitVectors[major] = (fBitVectors[major] & lowMask)
|
||||
| ((fBitVectors[major] >> 1) & hiMask);
|
||||
|
@ -61,7 +61,7 @@ void hsBounds::Read(hsStream *s)
|
||||
|
||||
void hsBounds::Write(hsStream *s)
|
||||
{
|
||||
s->WriteLE32((Int32)fType);
|
||||
s->WriteLE32((int32_t)fType);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -230,9 +230,9 @@ void hsBounds3::InscribeSphere()
|
||||
}
|
||||
|
||||
// neg, pos, zero == disjoint, I contain other, overlap
|
||||
Int32 hsBounds3::TestBound(const hsBounds3& other) const
|
||||
int32_t hsBounds3::TestBound(const hsBounds3& other) const
|
||||
{
|
||||
Int32 retVal = 1;
|
||||
int32_t retVal = 1;
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
@ -348,7 +348,7 @@ void hsBounds3::MakeTriMeshSphere(hsGTriMesh* tMesh, hsPoint3* cornersIn) const
|
||||
//
|
||||
// Allocate and create mesh from bounding box
|
||||
//
|
||||
void hsBounds3::MakeTriMesh(hsGTriMesh* tMesh, UInt32 triFlags, hsPoint3* cornersIn) const
|
||||
void hsBounds3::MakeTriMesh(hsGTriMesh* tMesh, uint32_t triFlags, hsPoint3* cornersIn) const
|
||||
{
|
||||
hsAssert(cornersIn || fType == kBoundsNormal,
|
||||
"Invalid bounds type for hsBounds3::MakeTriMesh ");
|
||||
@ -551,13 +551,13 @@ hsBool hsBoundsOriented::IsInside(const hsPoint3* pos) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void hsBoundsOriented::SetNumberPlanes(UInt32 n)
|
||||
void hsBoundsOriented::SetNumberPlanes(uint32_t n)
|
||||
{
|
||||
delete [] fPlanes;
|
||||
fPlanes = TRACKED_NEW hsPlane3[fNumPlanes = n];
|
||||
}
|
||||
|
||||
void hsBoundsOriented::SetPlane(UInt32 i, hsPlane3 *pln)
|
||||
void hsBoundsOriented::SetPlane(uint32_t i, hsPlane3 *pln)
|
||||
{
|
||||
fType = kBoundsNormal;
|
||||
if( i >= fNumPlanes )
|
||||
@ -1030,7 +1030,7 @@ hsBool hsBounds3Ext::IsInside(const hsPoint3 *p) const
|
||||
}
|
||||
|
||||
// neg, pos, zero == disjoint, I contain other, overlap
|
||||
Int32 hsBounds3Ext::TestBound(const hsBounds3Ext& other) const
|
||||
int32_t hsBounds3Ext::TestBound(const hsBounds3Ext& other) const
|
||||
{
|
||||
if( fExtFlags & kAxisAligned )
|
||||
return hsBounds3::TestBound(other);
|
||||
@ -1038,7 +1038,7 @@ Int32 hsBounds3Ext::TestBound(const hsBounds3Ext& other) const
|
||||
if( !(fExtFlags & kDistsSet) )
|
||||
IMakeDists();
|
||||
|
||||
Int32 retVal = 1;
|
||||
int32_t retVal = 1;
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
@ -1151,11 +1151,11 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint
|
||||
}
|
||||
}
|
||||
|
||||
Int32 hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &ptVel) const
|
||||
int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &ptVel) const
|
||||
{
|
||||
if( fExtFlags & kAxisAligned )
|
||||
{
|
||||
Int32 retVal = -1;
|
||||
int32_t retVal = -1;
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
@ -1167,8 +1167,8 @@ Int32 hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &pt
|
||||
effMin -= ptVel[i];
|
||||
|
||||
int j;
|
||||
const UInt32 low = 0x1, hi = 0x2;
|
||||
UInt32 mask = low | hi;
|
||||
const uint32_t low = 0x1, hi = 0x2;
|
||||
uint32_t mask = low | hi;
|
||||
for( j = 0; j < n; j++ )
|
||||
{
|
||||
if( pList[j][i] > effMin )
|
||||
@ -1185,7 +1185,7 @@ Int32 hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &pt
|
||||
}
|
||||
else // non-axis aligned case
|
||||
{
|
||||
Int32 retVal = -1; // all inside
|
||||
int32_t retVal = -1; // all inside
|
||||
if( !(fExtFlags & kDistsSet) )
|
||||
IMakeDists();
|
||||
int i;
|
||||
@ -1228,7 +1228,7 @@ Int32 hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 &pt
|
||||
}
|
||||
}
|
||||
|
||||
Int32 hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList) const
|
||||
int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList) const
|
||||
{
|
||||
hsBool someIn = false;
|
||||
hsBool someOut = false;
|
||||
@ -1397,7 +1397,7 @@ static hsBool ITestDepth(const hsPoint2& other, const hsPoint2& mine,
|
||||
return true;
|
||||
}
|
||||
|
||||
Int32 hsBounds3Ext::IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel,
|
||||
int32_t hsBounds3Ext::IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel,
|
||||
hsScalar* tClose, hsScalar* tImpact) const
|
||||
{
|
||||
// Should assert both have their spheres set.
|
||||
@ -1704,8 +1704,8 @@ hsBool hsBounds3Ext::ISectTriABB(hsBounds3Tri &tri, const hsVector3 &myVel) cons
|
||||
effMax += myVel[i];
|
||||
|
||||
int j;
|
||||
const UInt32 low = 0x1, hi = 0x2;
|
||||
UInt32 mask = low | hi;
|
||||
const uint32_t low = 0x1, hi = 0x2;
|
||||
uint32_t mask = low | hi;
|
||||
for( j = 0; j < 3; j++ )
|
||||
{
|
||||
if( tri.fVerts[j][i] > effMin )
|
||||
@ -2940,7 +2940,7 @@ hsBounds3Tri::hsBounds3Tri(hsTriangle3* t, const hsMatrix44& x)
|
||||
t, x);
|
||||
}
|
||||
|
||||
void hsBounds3Tri::Set(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, UInt32 triFlags, hsTriangle3 *t)
|
||||
void hsBounds3Tri::Set(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, uint32_t triFlags, hsTriangle3 *t)
|
||||
{
|
||||
fTriFlags = 0;
|
||||
|
||||
@ -2958,7 +2958,7 @@ void hsBounds3Tri::Set(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, U
|
||||
fDist = fNormal.InnerProduct(fVerts[0]);
|
||||
}
|
||||
|
||||
hsBounds3Tri::hsBounds3Tri(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, UInt32 triFlags, hsTriangle3 *t)
|
||||
hsBounds3Tri::hsBounds3Tri(hsPoint3 *v0, hsPoint3 *v1, hsPoint3 *v2, hsVector3 *n, uint32_t triFlags, hsTriangle3 *t)
|
||||
{
|
||||
Set(v0, v1, v2, n, triFlags, t);
|
||||
}
|
||||
@ -2995,9 +2995,9 @@ hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, hsScala
|
||||
hsScalar radiusSq = distASq * (1-cosThetaSq)/cosThetaSq;
|
||||
|
||||
hsScalar minDistSq = 0;
|
||||
Int32 minVert = 0;
|
||||
int32_t minVert = 0;
|
||||
hsBool sect = false;
|
||||
for (Int32 i=0; i<3; i++)
|
||||
for (int32_t i=0; i<3; i++)
|
||||
{
|
||||
hsPoint3 onLine;
|
||||
hsScalar t = hsBounds3::ClosestPointToLine(&fVerts[i], &from, &to, &onLine);
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
kIsSphere = 0x2
|
||||
};
|
||||
protected:
|
||||
mutable UInt32 fBounds3Flags;
|
||||
mutable uint32_t fBounds3Flags;
|
||||
hsPoint3 fMins;
|
||||
hsPoint3 fMaxs;
|
||||
mutable hsPoint3 fCenter;
|
||||
@ -139,7 +139,7 @@ public:
|
||||
|
||||
// Test according to my axes only, doesn't check other's axes
|
||||
// neg, pos, zero == disjoint, I contain other, overlap
|
||||
virtual Int32 TestBound(const hsBounds3& other) const;
|
||||
virtual int32_t TestBound(const hsBounds3& other) const;
|
||||
|
||||
static hsScalar ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, const hsPoint3 *v1, hsPoint3 *out);
|
||||
static hsScalar ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3* v, hsPoint3* out);
|
||||
@ -198,7 +198,7 @@ private:
|
||||
hsBool fCenterValid;
|
||||
hsPoint3 fCenter;
|
||||
hsPlane3 *fPlanes;
|
||||
UInt32 fNumPlanes;
|
||||
uint32_t fNumPlanes;
|
||||
public:
|
||||
hsBoundsOriented() : fPlanes(nil),fNumPlanes(0),fCenterValid(false) {}
|
||||
virtual ~hsBoundsOriented() { if (fPlanes) delete [] fPlanes; }
|
||||
@ -209,7 +209,7 @@ public:
|
||||
void SetCenter(const hsBoundsOriented* b) { fCenter=b->GetCenter(); fCenterValid = true; }
|
||||
hsPoint3 GetCenter() const;
|
||||
|
||||
void SetNumberPlanes(UInt32 n);
|
||||
void SetNumberPlanes(uint32_t n);
|
||||
|
||||
hsPlane3* GetPlane(int i) { return &fPlanes[i]; }
|
||||
int GetNumPlanes() { return fNumPlanes; }
|
||||
@ -218,7 +218,7 @@ public:
|
||||
// These set type to kBounds Normal
|
||||
//
|
||||
virtual void Reset(const hsBounds3*);
|
||||
void SetPlane(UInt32 i, hsPlane3 *p);
|
||||
void SetPlane(uint32_t i, hsPlane3 *p);
|
||||
|
||||
//
|
||||
// Only valid for kBounds Normal
|
||||
@ -241,13 +241,13 @@ protected:
|
||||
kAxisOneZero =(1<<21),
|
||||
kAxisTwoZero =(1<<22)
|
||||
};
|
||||
mutable UInt32 fExtFlags;
|
||||
mutable uint32_t fExtFlags;
|
||||
hsPoint3 fCorner;
|
||||
hsVector3 fAxes[3];
|
||||
mutable hsPoint2 fDists[3];
|
||||
mutable hsScalar fRadius;
|
||||
|
||||
hsBool IAxisIsZero(UInt32 i) const { return (fExtFlags & (1 << (20+i))) != 0; };
|
||||
hsBool IAxisIsZero(uint32_t i) const { return (fExtFlags & (1 << (20+i))) != 0; };
|
||||
void IMakeSphere() const;
|
||||
void IMakeDists() const;
|
||||
void IMakeMinsMaxs();
|
||||
@ -285,21 +285,21 @@ public:
|
||||
virtual hsBool IsInside(const hsPoint3* pos) const; // ok for full/empty
|
||||
|
||||
virtual void TestPlane(const hsVector3 &n, hsPoint2 &depth) const;
|
||||
virtual Int32 TestPoints(int n, const hsPoint3 *pList) const; // pos,neg,zero == allout, allin, cut
|
||||
virtual int32_t TestPoints(int n, const hsPoint3 *pList) const; // pos,neg,zero == allout, allin, cut
|
||||
|
||||
// Test according to my axes only, doesn't check other's axes
|
||||
// neg, pos, zero == disjoint, I contain other, overlap
|
||||
virtual Int32 TestBound(const hsBounds3Ext& other) const;
|
||||
virtual int32_t TestBound(const hsBounds3Ext& other) const;
|
||||
|
||||
virtual void TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint2 &depth) const;
|
||||
virtual void TestPlane(const hsPlane3 *p, const hsVector3 &myVel, hsPoint2 &depth) const;
|
||||
virtual Int32 TestPoints(int n, const hsPoint3 *pList, const hsVector3 &ptVel) const; // pos,neg,zero == allout, allin, cut
|
||||
virtual int32_t TestPoints(int n, const hsPoint3 *pList, const hsVector3 &ptVel) const; // pos,neg,zero == allout, allin, cut
|
||||
virtual hsBool ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel) const;
|
||||
virtual hsBool ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
|
||||
virtual hsBool ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) const;
|
||||
virtual hsBool ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) const;
|
||||
|
||||
virtual Int32 IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel,
|
||||
virtual int32_t IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel,
|
||||
hsScalar* tClose, hsScalar* tImpact) const;
|
||||
virtual hsBool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
|
||||
virtual hsBool ISectBSBox(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const;
|
||||
|
@ -69,8 +69,8 @@ struct hsColorRGBA {
|
||||
friend inline hsColorRGBA operator*(const hsScalar s, const hsColorRGBA& c);
|
||||
hsColorRGBA& operator*=(const hsScalar s);
|
||||
|
||||
hsColorRGBA& FromARGB32(UInt32 c);
|
||||
UInt32 ToARGB32() const;
|
||||
hsColorRGBA& FromARGB32(uint32_t c);
|
||||
uint32_t ToARGB32() const;
|
||||
|
||||
void Read(hsStream *stream);
|
||||
void Write(hsStream *stream) const;
|
||||
@ -91,7 +91,7 @@ inline void hsColorRGBA::Write(hsStream *s) const
|
||||
s->WriteLEScalar(a);
|
||||
}
|
||||
|
||||
inline hsColorRGBA& hsColorRGBA::FromARGB32(UInt32 c)
|
||||
inline hsColorRGBA& hsColorRGBA::FromARGB32(uint32_t c)
|
||||
{
|
||||
const hsScalar oo255 = 1.f / 255.f;
|
||||
a = hsScalar((c >> 24) & 0xff) * oo255;
|
||||
@ -101,12 +101,12 @@ inline hsColorRGBA& hsColorRGBA::FromARGB32(UInt32 c)
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline UInt32 hsColorRGBA::ToARGB32() const
|
||||
inline uint32_t hsColorRGBA::ToARGB32() const
|
||||
{
|
||||
return (UInt32(a * 255.99f) << 24)
|
||||
| (UInt32(r * 255.99f) << 16)
|
||||
| (UInt32(g * 255.99f) << 8)
|
||||
| (UInt32(b * 255.99f) << 0);
|
||||
return (uint32_t(a * 255.99f) << 24)
|
||||
| (uint32_t(r * 255.99f) << 16)
|
||||
| (uint32_t(g * 255.99f) << 8)
|
||||
| (uint32_t(b * 255.99f) << 0);
|
||||
}
|
||||
|
||||
inline hsColorRGBA operator+(const hsColorRGBA& s, const hsColorRGBA& t)
|
||||
|
@ -62,8 +62,8 @@ public:
|
||||
|
||||
static hsExceptionStack& Instance();
|
||||
|
||||
Int32 GetNumEntries() const { return fEntries.Count(); }
|
||||
const char* GetEntry(Int32 i) const { return fEntries[i]; }
|
||||
int32_t GetNumEntries() const { return fEntries.Count(); }
|
||||
const char* GetEntry(int32_t i) const { return fEntries[i]; }
|
||||
|
||||
void Push(const char* str);
|
||||
|
||||
|
@ -96,10 +96,10 @@ hsFixed hsFixedCos(hsFixed s);
|
||||
hsFixed hsFixedASin(hsFixed s);
|
||||
hsFixed hsFixedACos(hsFixed s);
|
||||
|
||||
UInt16 hsSqrt32(UInt32 value);
|
||||
UInt16 hsCubeRoot32(UInt32 value);
|
||||
Int32 hsMulDiv32(Int32 numer1, Int32 numer2, Int32 denom);
|
||||
Int32 hsMagnitude32(Int32 x, Int32 y);
|
||||
uint16_t hsSqrt32(uint32_t value);
|
||||
uint16_t hsCubeRoot32(uint32_t value);
|
||||
int32_t hsMulDiv32(int32_t numer1, int32_t numer2, int32_t denom);
|
||||
int32_t hsMagnitude32(int32_t x, int32_t y);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -112,8 +112,8 @@ Int32 hsMagnitude32(Int32 x, Int32 y);
|
||||
void Set(hsFixed a, hsFixed b, hsFixed c) { fA = a; fB = b; fC = c; }
|
||||
|
||||
hsFixed FixEval(hsFixed x, hsFixed y) const { return hsFixMul(fA, x) + hsFixMul(fB, y) + fC; }
|
||||
Int32 IntEval(Int32 x, Int32 y) const { return fA * x + fB * y + fC; }
|
||||
void ShiftDown(UInt32 i) { fA >>= i; fB >>= i; fC >>= i;}
|
||||
int32_t IntEval(int32_t x, int32_t y) const { return fA * x + fB * y + fC; }
|
||||
void ShiftDown(uint32_t i) { fA >>= i; fB >>= i; fC >>= i;}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -51,7 +51,7 @@ class hsHashTableIterator
|
||||
{
|
||||
public:
|
||||
hsHashTableIterator() : fList(nil), fIndex(-1) { }
|
||||
explicit hsHashTableIterator(hsTArray<T>* list, UInt32 idx) : fList(list), fIndex(idx) { }
|
||||
explicit hsHashTableIterator(hsTArray<T>* list, uint32_t idx) : fList(list), fIndex(idx) { }
|
||||
|
||||
T* operator->() const { return &((*fList)[fIndex]); }
|
||||
T& operator*() const { return (*fList)[fIndex]; }
|
||||
@ -67,7 +67,7 @@ public:
|
||||
|
||||
private:
|
||||
hsTArray<T>* fList;
|
||||
UInt32 fIndex;
|
||||
uint32_t fIndex;
|
||||
};
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ template <class T>
|
||||
class hsHashTable
|
||||
{
|
||||
public:
|
||||
hsHashTable(UInt32 size=150001, UInt32 step=1);
|
||||
hsHashTable(uint32_t size=150001, uint32_t step=1);
|
||||
~hsHashTable();
|
||||
|
||||
typedef hsHashTableIterator<T> iterator;
|
||||
@ -84,25 +84,25 @@ public:
|
||||
iterator end() { return iterator(&fItemList,0); }
|
||||
void clear();
|
||||
|
||||
UInt32 count() { return fItemList.Count()-1; }
|
||||
UInt32 size() { return fSize; }
|
||||
uint32_t count() { return fItemList.Count()-1; }
|
||||
uint32_t size() { return fSize; }
|
||||
|
||||
UInt32 CollisionCount() { return fCollisionCount; }
|
||||
uint32_t CollisionCount() { return fCollisionCount; }
|
||||
|
||||
inline void insert(T& item);
|
||||
inline void erase(T& item);
|
||||
inline iterator find(const T& item);
|
||||
|
||||
iterator GetItem(UInt32 i);
|
||||
iterator GetItem(uint32_t i);
|
||||
|
||||
private:
|
||||
hsTArray<T> fItemList;
|
||||
hsTArray<UInt32> fClearList;
|
||||
hsTArray<uint32_t> fClearList;
|
||||
|
||||
UInt32* fHashTable;
|
||||
UInt32 fSize;
|
||||
UInt32 fCollisionStep;
|
||||
UInt32 fCollisionCount;
|
||||
uint32_t* fHashTable;
|
||||
uint32_t fSize;
|
||||
uint32_t fCollisionStep;
|
||||
uint32_t fCollisionCount;
|
||||
|
||||
// No copy or assignment
|
||||
hsHashTable(const hsHashTable&);
|
||||
@ -110,14 +110,14 @@ private:
|
||||
};
|
||||
|
||||
template <class T>
|
||||
hsHashTable<T>::hsHashTable(UInt32 size, UInt32 step) :
|
||||
hsHashTable<T>::hsHashTable(uint32_t size, uint32_t step) :
|
||||
fSize(size),
|
||||
fCollisionStep(step),
|
||||
fCollisionCount(0)
|
||||
{
|
||||
fItemList.SetCount(1);
|
||||
fHashTable = TRACKED_NEW UInt32[fSize];
|
||||
memset(fHashTable,0,fSize*sizeof(UInt32));
|
||||
fHashTable = TRACKED_NEW uint32_t[fSize];
|
||||
memset(fHashTable,0,fSize*sizeof(uint32_t));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@ -130,7 +130,7 @@ template <class T>
|
||||
void hsHashTable<T>::clear()
|
||||
{
|
||||
fItemList.SetCount(1);
|
||||
for (Int32 i=0; i<fClearList.Count(); i++)
|
||||
for (int32_t i=0; i<fClearList.Count(); i++)
|
||||
fHashTable[ fClearList[i] ] = 0;
|
||||
fClearList.Reset();
|
||||
}
|
||||
@ -139,9 +139,9 @@ template <class T>
|
||||
void hsHashTable<T>::insert(T& item)
|
||||
{
|
||||
hsAssert(fClearList.Count() < fSize,"Hash table overflow! Increase the table size.");
|
||||
UInt32 h = item.GetHash();
|
||||
uint32_t h = item.GetHash();
|
||||
h %= fSize;
|
||||
while (UInt32 it = fHashTable[h])
|
||||
while (uint32_t it = fHashTable[h])
|
||||
{
|
||||
if ( fItemList[it] == item)
|
||||
{
|
||||
@ -160,9 +160,9 @@ void hsHashTable<T>::insert(T& item)
|
||||
template <class T>
|
||||
void hsHashTable<T>::erase(T& item)
|
||||
{
|
||||
UInt32 h = item.GetHash();
|
||||
uint32_t h = item.GetHash();
|
||||
h %= fSize;
|
||||
while (UInt32 it = fHashTable[h])
|
||||
while (uint32_t it = fHashTable[h])
|
||||
{
|
||||
if ( fItemList[it] == item )
|
||||
{
|
||||
@ -175,9 +175,9 @@ void hsHashTable<T>::erase(T& item)
|
||||
template <class T>
|
||||
hsHashTableIterator<T> hsHashTable<T>::find(const T& item)
|
||||
{
|
||||
UInt32 h = item.GetHash();
|
||||
uint32_t h = item.GetHash();
|
||||
h %= fSize;
|
||||
while (UInt32 it = fHashTable[h])
|
||||
while (uint32_t it = fHashTable[h])
|
||||
{
|
||||
if ( fItemList[it] == item )
|
||||
{
|
||||
@ -191,7 +191,7 @@ hsHashTableIterator<T> hsHashTable<T>::find(const T& item)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
hsHashTableIterator<T> hsHashTable<T>::GetItem(UInt32 i)
|
||||
hsHashTableIterator<T> hsHashTable<T>::GetItem(uint32_t i)
|
||||
{
|
||||
return iterator(&fItemList,i+1);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "hsExceptions.h"
|
||||
|
||||
UInt32 hsMMIOStream::Read(UInt32 bytes, void* buffer)
|
||||
uint32_t hsMMIOStream::Read(uint32_t bytes, void* buffer)
|
||||
{
|
||||
fBytesRead += bytes;
|
||||
fPosition += bytes;
|
||||
@ -73,13 +73,13 @@ hsBool hsMMIOStream::AtEnd()
|
||||
return (::mmioSeek(fHmfr,0,SEEK_CUR)==::mmioSeek(fHmfr,0,SEEK_END));
|
||||
}
|
||||
|
||||
UInt32 hsMMIOStream::Write(UInt32 bytes, const void* buffer)
|
||||
uint32_t hsMMIOStream::Write(uint32_t bytes, const void* buffer)
|
||||
{
|
||||
fPosition += bytes;
|
||||
return ::mmioWrite(fHmfr,(const char*)buffer,bytes);
|
||||
}
|
||||
|
||||
void hsMMIOStream::Skip(UInt32 delta)
|
||||
void hsMMIOStream::Skip(uint32_t delta)
|
||||
{
|
||||
fBytesRead += delta;
|
||||
fPosition += delta;
|
||||
|
@ -57,9 +57,9 @@ public:
|
||||
virtual hsBool Close() { hsAssert(0, "hsMMIOStream::Close NotImplemented"); return false; }
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual UInt32 Read(UInt32 byteCount, void* buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
|
@ -60,7 +60,7 @@ struct hsMatrix44 {
|
||||
kView
|
||||
};
|
||||
hsScalar fMap[4][4];
|
||||
UInt32 fFlags;
|
||||
uint32_t fFlags;
|
||||
|
||||
hsMatrix44() : fFlags(0) {}
|
||||
hsMatrix44(const hsScalarTriple &translate, const hsQuat &rotate);
|
||||
|
@ -49,15 +49,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HSMemory::BlockMove(const void* src, void* dst, UInt32 length)
|
||||
void HSMemory::BlockMove(const void* src, void* dst, uint32_t length)
|
||||
{
|
||||
memmove(dst, src, length);
|
||||
}
|
||||
|
||||
hsBool HSMemory::EqualBlocks(const void* block1, const void* block2, UInt32 length)
|
||||
hsBool HSMemory::EqualBlocks(const void* block1, const void* block2, uint32_t length)
|
||||
{
|
||||
const Byte* byte1 = (Byte*)block1;
|
||||
const Byte* byte2 = (Byte*)block2;
|
||||
const uint8_t* byte1 = (uint8_t*)block1;
|
||||
const uint8_t* byte2 = (uint8_t*)block2;
|
||||
|
||||
while (length--)
|
||||
if (*byte1++ != *byte2++)
|
||||
@ -65,17 +65,17 @@ hsBool HSMemory::EqualBlocks(const void* block1, const void* block2, UInt32 leng
|
||||
return true;
|
||||
}
|
||||
|
||||
void* HSMemory::New(UInt32 size)
|
||||
void* HSMemory::New(uint32_t size)
|
||||
{
|
||||
return TRACKED_NEW UInt32[(size + 3) >> 2];
|
||||
return TRACKED_NEW uint32_t[(size + 3) >> 2];
|
||||
}
|
||||
|
||||
void HSMemory::Delete(void* block)
|
||||
{
|
||||
delete[] (UInt32*)block;
|
||||
delete[] (uint32_t*)block;
|
||||
}
|
||||
|
||||
void* HSMemory::Copy(UInt32 length, const void* source)
|
||||
void* HSMemory::Copy(uint32_t length, const void* source)
|
||||
{
|
||||
void* destination = HSMemory::New(length);
|
||||
|
||||
@ -83,22 +83,22 @@ void* HSMemory::Copy(UInt32 length, const void* source)
|
||||
return destination;
|
||||
}
|
||||
|
||||
void HSMemory::Clear(void* m, UInt32 byteLen)
|
||||
void HSMemory::Clear(void* m, uint32_t byteLen)
|
||||
{
|
||||
UInt8* mem = (UInt8*)m;
|
||||
UInt8* memStop = mem + byteLen;
|
||||
uint8_t* mem = (uint8_t*)m;
|
||||
uint8_t* memStop = mem + byteLen;
|
||||
|
||||
if (byteLen > 8)
|
||||
{ while (unsigned_ptr(mem) & 3)
|
||||
{ while (uintptr_t(mem) & 3)
|
||||
*mem++ = 0;
|
||||
|
||||
UInt32* mem32 = (UInt32*)mem;
|
||||
UInt32* mem32Stop = (UInt32*)(unsigned_ptr(memStop) & ~3);
|
||||
uint32_t* mem32 = (uint32_t*)mem;
|
||||
uint32_t* mem32Stop = (uint32_t*)(uintptr_t(memStop) & ~3);
|
||||
do {
|
||||
*mem32++ = 0;
|
||||
} while (mem32 < mem32Stop);
|
||||
|
||||
mem = (UInt8*)mem32;
|
||||
mem = (uint8_t*)mem32;
|
||||
// fall through to finish any remaining bytes (0..3)
|
||||
}
|
||||
while (mem < memStop)
|
||||
@ -133,12 +133,12 @@ inline template <class T> T* hsSoftNew(T*& obj, unsigned count)
|
||||
}
|
||||
#endif
|
||||
|
||||
void* HSMemory::SoftNew(UInt32 size)
|
||||
void* HSMemory::SoftNew(uint32_t size)
|
||||
{
|
||||
UInt32* p;
|
||||
uint32_t* p;
|
||||
|
||||
hsTry {
|
||||
p = TRACKED_NEW UInt32[(size + 3) >> 2];
|
||||
p = TRACKED_NEW uint32_t[(size + 3) >> 2];
|
||||
} hsCatch(...) {
|
||||
p = nil;
|
||||
}
|
||||
@ -150,15 +150,15 @@ void* HSMemory::SoftNew(UInt32 size)
|
||||
struct hsPrivateChunk {
|
||||
hsPrivateChunk* fNext;
|
||||
char* fAvailableAddr;
|
||||
UInt32 fAvailableSize;
|
||||
uint32_t fAvailableSize;
|
||||
|
||||
hsDebugCode(UInt32 fSize;)
|
||||
hsDebugCode(UInt32 fCount;)
|
||||
hsDebugCode(uint32_t fSize;)
|
||||
hsDebugCode(uint32_t fCount;)
|
||||
|
||||
static hsPrivateChunk* NewPrivateChunk(hsPrivateChunk* next, UInt32 chunkSize);
|
||||
static hsPrivateChunk* NewPrivateChunk(hsPrivateChunk* next, uint32_t chunkSize);
|
||||
};
|
||||
|
||||
hsPrivateChunk* hsPrivateChunk::NewPrivateChunk(hsPrivateChunk* next, UInt32 chunkSize)
|
||||
hsPrivateChunk* hsPrivateChunk::NewPrivateChunk(hsPrivateChunk* next, uint32_t chunkSize)
|
||||
{
|
||||
hsPrivateChunk* chunk = (hsPrivateChunk*)HSMemory::New(sizeof(hsPrivateChunk) + chunkSize);
|
||||
|
||||
@ -171,7 +171,7 @@ hsPrivateChunk* hsPrivateChunk::NewPrivateChunk(hsPrivateChunk* next, UInt32 chu
|
||||
return chunk;
|
||||
}
|
||||
|
||||
hsChunkAllocator::hsChunkAllocator(UInt32 chunkSize) : fChunkSize(chunkSize), fChunk(nil)
|
||||
hsChunkAllocator::hsChunkAllocator(uint32_t chunkSize) : fChunkSize(chunkSize), fChunk(nil)
|
||||
{
|
||||
hsDebugCode(fChunkCount = 0;)
|
||||
}
|
||||
@ -194,12 +194,12 @@ void hsChunkAllocator::Reset()
|
||||
hsDebugCode(fChunkCount = 0;)
|
||||
}
|
||||
|
||||
void hsChunkAllocator::SetChunkSize(UInt32 chunkSize)
|
||||
void hsChunkAllocator::SetChunkSize(uint32_t chunkSize)
|
||||
{
|
||||
fChunkSize = chunkSize;
|
||||
}
|
||||
|
||||
void* hsChunkAllocator::Allocate(UInt32 size, const void* data)
|
||||
void* hsChunkAllocator::Allocate(uint32_t size, const void* data)
|
||||
{
|
||||
void* addr;
|
||||
|
||||
@ -221,7 +221,7 @@ void* hsChunkAllocator::Allocate(UInt32 size, const void* data)
|
||||
return addr;
|
||||
}
|
||||
|
||||
void* hsChunkAllocator::SoftAllocate(UInt32 size, const void* data)
|
||||
void* hsChunkAllocator::SoftAllocate(uint32_t size, const void* data)
|
||||
{
|
||||
void* addr;
|
||||
|
||||
@ -248,22 +248,22 @@ struct hsAppenderHead {
|
||||
void* GetStop() const { return fStop; }
|
||||
|
||||
void* GetFirst() const { return fFirst; }
|
||||
void* GetLast(UInt32 elemSize) const { return (char*)fStop - elemSize; }
|
||||
UInt32 GetSize() const { return (char*)fStop - (char*)fFirst; }
|
||||
void* GetLast(uint32_t elemSize) const { return (char*)fStop - elemSize; }
|
||||
uint32_t GetSize() const { return (char*)fStop - (char*)fFirst; }
|
||||
|
||||
hsBool CanPrepend() const { return fFirst != this->GetTop(); }
|
||||
int PrependSize() const { return (char*)fFirst - (char*)this->GetTop(); }
|
||||
hsBool CanAppend() const { return fStop != this->GetBottom(); }
|
||||
int AppendSize() const { return (char*)this->GetBottom() - (char*)fStop; }
|
||||
|
||||
void* Prepend(UInt32 elemSize)
|
||||
void* Prepend(uint32_t elemSize)
|
||||
{
|
||||
hsAssert(this->CanPrepend(), "bad prepend");
|
||||
fFirst = (char*)fFirst - elemSize;
|
||||
hsAssert((char*)fFirst >= (char*)this->GetTop(), "bad elemSize");
|
||||
return fFirst;
|
||||
}
|
||||
void* Append(UInt32 elemSize)
|
||||
void* Append(uint32_t elemSize)
|
||||
{
|
||||
hsAssert(this->CanAppend(), "bad append");
|
||||
void* data = fStop;
|
||||
@ -271,7 +271,7 @@ struct hsAppenderHead {
|
||||
hsAssert((char*)fStop <= (char*)fBottom, "bad elemSize");
|
||||
return data;
|
||||
}
|
||||
hsBool PopHead(UInt32 elemSize, void* data)
|
||||
hsBool PopHead(uint32_t elemSize, void* data)
|
||||
{
|
||||
hsAssert(fFirst != fStop, "Empty");
|
||||
if( data )
|
||||
@ -279,7 +279,7 @@ struct hsAppenderHead {
|
||||
fFirst = (char*)fFirst + elemSize;
|
||||
return fFirst == fStop;
|
||||
}
|
||||
hsBool PopTail(UInt32 elemSize, void* data)
|
||||
hsBool PopTail(uint32_t elemSize, void* data)
|
||||
{
|
||||
hsAssert(fFirst != fStop, "Empty");
|
||||
fStop = (char*)fStop - elemSize;
|
||||
@ -288,9 +288,9 @@ struct hsAppenderHead {
|
||||
return fFirst == fStop;
|
||||
}
|
||||
|
||||
static hsAppenderHead* NewAppend(UInt32 elemSize, UInt32 elemCount, hsAppenderHead* prev)
|
||||
static hsAppenderHead* NewAppend(uint32_t elemSize, uint32_t elemCount, hsAppenderHead* prev)
|
||||
{
|
||||
UInt32 dataSize = elemSize * elemCount;
|
||||
uint32_t dataSize = elemSize * elemCount;
|
||||
hsAppenderHead* head = (hsAppenderHead*)HSMemory::New(sizeof(hsAppenderHead) + dataSize);
|
||||
|
||||
head->fNext = nil;
|
||||
@ -300,9 +300,9 @@ struct hsAppenderHead {
|
||||
head->fBottom = (char*)head->fFirst + dataSize;
|
||||
return head;
|
||||
}
|
||||
static hsAppenderHead* NewPrepend(UInt32 elemSize, UInt32 elemCount, hsAppenderHead* next)
|
||||
static hsAppenderHead* NewPrepend(uint32_t elemSize, uint32_t elemCount, hsAppenderHead* next)
|
||||
{
|
||||
UInt32 dataSize = elemSize * elemCount;
|
||||
uint32_t dataSize = elemSize * elemCount;
|
||||
hsAppenderHead* head = (hsAppenderHead*)HSMemory::New(sizeof(hsAppenderHead) + dataSize);
|
||||
|
||||
head->fNext = next;
|
||||
@ -316,7 +316,7 @@ struct hsAppenderHead {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
hsAppender::hsAppender(UInt32 elemSize, UInt32 elemCount)
|
||||
hsAppender::hsAppender(uint32_t elemSize, uint32_t elemCount)
|
||||
: fFirstBlock(nil), fElemSize(elemSize), fElemCount(elemCount), fCount(0)
|
||||
{
|
||||
}
|
||||
@ -326,14 +326,14 @@ hsAppender::~hsAppender()
|
||||
this->Reset();
|
||||
}
|
||||
|
||||
UInt32 hsAppender::CopyInto(void* data) const
|
||||
uint32_t hsAppender::CopyInto(void* data) const
|
||||
{
|
||||
if (data)
|
||||
{ const hsAppenderHead* head = fFirstBlock;
|
||||
hsDebugCode(UInt32 totalSize = 0;)
|
||||
hsDebugCode(uint32_t totalSize = 0;)
|
||||
|
||||
while (head != nil)
|
||||
{ UInt32 size = head->GetSize();
|
||||
{ uint32_t size = head->GetSize();
|
||||
HSMemory::BlockMove(head->GetFirst(), data, size);
|
||||
|
||||
data = (char*)data + size;
|
||||
@ -721,7 +721,7 @@ void SortNDumpUnfreedMemory(const char *nm, bool full) // file name base, and FU
|
||||
|
||||
|
||||
_CrtMemState heap_state;
|
||||
static UInt32 GrandTotal =0;
|
||||
static uint32_t GrandTotal =0;
|
||||
static _CrtMemBlockHeader *cmbh_last; // Remember this header for next incremental check DANGER this
|
||||
// could break if this is freed...(gives bad report)
|
||||
_CrtMemBlockHeader *cmbh_last_good;
|
||||
@ -821,7 +821,7 @@ static _CrtMemBlockHeader *cmbh_last; // Remember this header for next increme
|
||||
|
||||
for(int x=len; x < 25; x++)
|
||||
fputc(' ',DumpLogFile); // make even columns
|
||||
fprintf(DumpLogFile,"%5ld K\n",(UInt32)( ltb[i].fBytes+500)/1000);//,ltb[i].fAllocs);
|
||||
fprintf(DumpLogFile,"%5ld K\n",(uint32_t)( ltb[i].fBytes+500)/1000);//,ltb[i].fAllocs);
|
||||
|
||||
//allocs += ltb[i].fAllocs;
|
||||
}
|
||||
@ -847,11 +847,11 @@ static _CrtMemBlockHeader *cmbh_last; // Remember this header for next increme
|
||||
if( DumpLogFile)
|
||||
{ fprintf(DumpLogFile,"%s ",nm);
|
||||
int len = strlen(nm);
|
||||
GrandTotal += (UInt32)(normsize+500)/1000;
|
||||
GrandTotal += (uint32_t)(normsize+500)/1000;
|
||||
|
||||
for(int x=len; x < 25; x++)
|
||||
fputc(' ',DumpLogFile); // make even columns
|
||||
fprintf(DumpLogFile,"%5ld K %5ld %s\n",(UInt32)(normsize+500)/1000,GrandTotal,errStr);//, allocs);
|
||||
fprintf(DumpLogFile,"%5ld K %5ld %s\n",(uint32_t)(normsize+500)/1000,GrandTotal,errStr);//, allocs);
|
||||
fclose(DumpLogFile);
|
||||
}
|
||||
}
|
||||
|
@ -48,24 +48,24 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
class HSMemory {
|
||||
public:
|
||||
static void BlockMove(const void* src, void* dst, UInt32 length);
|
||||
static void Clear(void *m, UInt32 byteLen);
|
||||
static void ClearMemory(void *m, UInt32 byteLen) { HSMemory::Clear(m, byteLen); }
|
||||
static void BlockMove(const void* src, void* dst, uint32_t length);
|
||||
static void Clear(void *m, uint32_t byteLen);
|
||||
static void ClearMemory(void *m, uint32_t byteLen) { HSMemory::Clear(m, byteLen); }
|
||||
|
||||
static hsBool EqualBlocks(const void* block1, const void* block2, UInt32 length);
|
||||
static hsBool EqualBlocks(const void* block1, const void* block2, uint32_t length);
|
||||
|
||||
static void* New(UInt32 size);
|
||||
static void* New(uint32_t size);
|
||||
static void Delete(void* block);
|
||||
static void* Copy(UInt32 length, const void* source);
|
||||
static void* Copy(uint32_t length, const void* source);
|
||||
|
||||
static void* SoftNew(UInt32 size); // returns nil if can't allocate
|
||||
static void* SoftNew(uint32_t size); // returns nil if can't allocate
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class hsAllocator {
|
||||
public:
|
||||
virtual void* Alloc(UInt32 size) = 0;
|
||||
virtual void* Alloc(uint32_t size) = 0;
|
||||
virtual void Free(void* addr) = 0;
|
||||
};
|
||||
|
||||
@ -73,9 +73,9 @@ class hsScratchMem {
|
||||
enum {
|
||||
kBufferSize = 32
|
||||
};
|
||||
UInt8* fMem;
|
||||
UInt8 fMemBuffer[kBufferSize];
|
||||
UInt32 fLength;
|
||||
uint8_t* fMem;
|
||||
uint8_t fMemBuffer[kBufferSize];
|
||||
uint32_t fLength;
|
||||
public:
|
||||
hsScratchMem() : fLength(kBufferSize)
|
||||
{
|
||||
@ -86,12 +86,12 @@ public:
|
||||
if (fMem != fMemBuffer)
|
||||
delete[] fMem;
|
||||
}
|
||||
UInt8* GetMem(UInt32 length)
|
||||
uint8_t* GetMem(uint32_t length)
|
||||
{
|
||||
if (length > fLength)
|
||||
{ if (fMem != fMemBuffer)
|
||||
delete[] fMem;
|
||||
fMem = TRACKED_NEW UInt8[length];
|
||||
fMem = TRACKED_NEW uint8_t[length];
|
||||
fLength = length;
|
||||
}
|
||||
return fMem;
|
||||
@ -102,36 +102,36 @@ class hsChunkAllocator {
|
||||
enum {
|
||||
kDefaultChunkSize = 4096
|
||||
};
|
||||
UInt32 fChunkSize;
|
||||
uint32_t fChunkSize;
|
||||
struct hsPrivateChunk* fChunk;
|
||||
hsDebugCode(UInt32 fChunkCount;)
|
||||
hsDebugCode(uint32_t fChunkCount;)
|
||||
public:
|
||||
hsChunkAllocator(UInt32 chunkSize = kDefaultChunkSize);
|
||||
hsChunkAllocator(uint32_t chunkSize = kDefaultChunkSize);
|
||||
~hsChunkAllocator();
|
||||
|
||||
void Reset();
|
||||
void SetChunkSize(UInt32 size);
|
||||
void* Allocate(UInt32 size, const void* data = nil); // throws if fails
|
||||
void* SoftAllocate(UInt32 size, const void* data = nil); // returns nil if fails
|
||||
void SetChunkSize(uint32_t size);
|
||||
void* Allocate(uint32_t size, const void* data = nil); // throws if fails
|
||||
void* SoftAllocate(uint32_t size, const void* data = nil); // returns nil if fails
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class hsAppender {
|
||||
struct hsAppenderHead* fFirstBlock, *fLastBlock;
|
||||
UInt32 fElemSize, fElemCount, fCount;
|
||||
uint32_t fElemSize, fElemCount, fCount;
|
||||
|
||||
friend class hsAppenderIterator;
|
||||
public:
|
||||
hsAppender(UInt32 elemSize, UInt32 minCount = 16);
|
||||
hsAppender(uint32_t elemSize, uint32_t minCount = 16);
|
||||
~hsAppender();
|
||||
|
||||
UInt32 ElemSize() const { return fElemSize; }
|
||||
UInt32 Count() const { return fCount; }
|
||||
uint32_t ElemSize() const { return fElemSize; }
|
||||
uint32_t Count() const { return fCount; }
|
||||
hsBool IsEmpty() const { return fCount == 0; }
|
||||
void Reset();
|
||||
|
||||
UInt32 CopyInto(void* data = nil) const; // return size of data array in bytes
|
||||
uint32_t CopyInto(void* data = nil) const; // return size of data array in bytes
|
||||
|
||||
void* PushHead();
|
||||
void PushHead(const void* data);
|
||||
@ -185,16 +185,16 @@ public:
|
||||
template <class T> class hsTAppender : hsAppender {
|
||||
public:
|
||||
hsTAppender() : hsAppender(sizeof(T)) {}
|
||||
hsTAppender(UInt32 minCount) : hsAppender(sizeof(T), minCount) {}
|
||||
hsTAppender(uint32_t minCount) : hsAppender(sizeof(T), minCount) {}
|
||||
|
||||
hsAppender* GetAppender() { return this; }
|
||||
const hsAppender* GetAppender() const { return this; }
|
||||
|
||||
UInt32 Count() const { return hsAppender::Count(); }
|
||||
uint32_t Count() const { return hsAppender::Count(); }
|
||||
hsBool IsEmpty() const { return hsAppender::IsEmpty(); }
|
||||
void Reset() { hsAppender::Reset(); }
|
||||
|
||||
UInt32 CopyInto(T copy[]) const { return hsAppender::CopyInto(copy); }
|
||||
uint32_t CopyInto(T copy[]) const { return hsAppender::CopyInto(copy); }
|
||||
|
||||
T* PushHead() { return (T*)hsAppender::PushHead(); }
|
||||
void PushHead(const T& item) { *this->PushHead() = item; }
|
||||
|
@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsScalar.h"
|
||||
|
||||
#define HS_POINT2_NAME hsIntPoint2
|
||||
#define HS_POINT2_TYPE Int32
|
||||
#define HS_POINT2_TYPE int32_t
|
||||
#include "HS_POINT2.inc"
|
||||
};
|
||||
|
||||
|
@ -341,7 +341,7 @@ class hsMsgQueue {
|
||||
mqd_t fMQ;
|
||||
#else
|
||||
class hsPrivateMQ* fMQ;
|
||||
UInt32 fAccess;
|
||||
uint32_t fAccess;
|
||||
#endif
|
||||
public:
|
||||
enum {
|
||||
@ -353,8 +353,8 @@ public:
|
||||
hsMsgQueue();
|
||||
virtual ~hsMsgQueue();
|
||||
|
||||
hsBool Create(const char name[], int maxSize, UInt32 access);
|
||||
hsBool Open(const char name[], UInt32 access);
|
||||
hsBool Create(const char name[], int maxSize, uint32_t access);
|
||||
hsBool Open(const char name[], uint32_t access);
|
||||
void Close();
|
||||
|
||||
int GetMaxSize() const { return fMaxSize; }
|
||||
|
@ -45,7 +45,7 @@ hsVectorStream::hsVectorStream() : fEnd(0)
|
||||
{
|
||||
}
|
||||
|
||||
hsVectorStream::hsVectorStream(UInt32 chunkSize)
|
||||
hsVectorStream::hsVectorStream(uint32_t chunkSize)
|
||||
{
|
||||
fVector.reserve(chunkSize);
|
||||
}
|
||||
@ -59,7 +59,7 @@ hsBool hsVectorStream::AtEnd()
|
||||
return (fBytesRead >= fEnd);
|
||||
}
|
||||
|
||||
UInt32 hsVectorStream::Read(UInt32 byteCount, void *buffer)
|
||||
uint32_t hsVectorStream::Read(uint32_t byteCount, void *buffer)
|
||||
{
|
||||
if (fBytesRead + byteCount > fEnd)
|
||||
{
|
||||
@ -75,18 +75,18 @@ UInt32 hsVectorStream::Read(UInt32 byteCount, void *buffer)
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
UInt32 hsVectorStream::Write(UInt32 byteCount, const void* buffer)
|
||||
uint32_t hsVectorStream::Write(uint32_t byteCount, const void* buffer)
|
||||
{
|
||||
// If we are at the end of the vector, we can just do a block insert of the data
|
||||
if (fPosition == fVector.size())
|
||||
fVector.insert(fVector.end(), (Byte*)buffer, (Byte*)buffer+byteCount);
|
||||
fVector.insert(fVector.end(), (uint8_t*)buffer, (uint8_t*)buffer+byteCount);
|
||||
// If we are in the middle, I don't know how to just overwrite a block of the vector.
|
||||
// So, we make sure there is enough space and copy the elements one by one
|
||||
else
|
||||
{
|
||||
fVector.reserve(fPosition+byteCount);
|
||||
for (UInt32 i = 0; i < byteCount; i++)
|
||||
fVector[fPosition+i] = ((Byte*)buffer)[i];
|
||||
for (uint32_t i = 0; i < byteCount; i++)
|
||||
fVector[fPosition+i] = ((uint8_t*)buffer)[i];
|
||||
}
|
||||
|
||||
fPosition += byteCount;
|
||||
@ -97,7 +97,7 @@ UInt32 hsVectorStream::Write(UInt32 byteCount, const void* buffer)
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
void hsVectorStream::Skip(UInt32 deltaByteCount)
|
||||
void hsVectorStream::Skip(uint32_t deltaByteCount)
|
||||
{
|
||||
fBytesRead += deltaByteCount;
|
||||
fPosition += deltaByteCount;
|
||||
@ -120,7 +120,7 @@ void hsVectorStream::Truncate()
|
||||
fEnd = fPosition-1;
|
||||
}
|
||||
|
||||
UInt32 hsVectorStream::GetEOF()
|
||||
uint32_t hsVectorStream::GetEOF()
|
||||
{
|
||||
return fEnd;
|
||||
}
|
||||
@ -130,7 +130,7 @@ void hsVectorStream::CopyToMem(void* mem)
|
||||
memcpy(mem, &fVector[0], fEnd);
|
||||
}
|
||||
|
||||
void hsVectorStream::Erase(UInt32 bytes)
|
||||
void hsVectorStream::Erase(uint32_t bytes)
|
||||
{
|
||||
hsAssert(fPosition+bytes <= fEnd, "Erasing past end of stream");
|
||||
|
||||
@ -158,7 +158,7 @@ const void *hsVectorStream::GetData()
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
|
||||
hsNamedPipeStream::hsNamedPipeStream(UInt8 flags, UInt32 timeout) :
|
||||
hsNamedPipeStream::hsNamedPipeStream(uint8_t flags, uint32_t timeout) :
|
||||
fFlags(flags),
|
||||
fPipe(INVALID_HANDLE_VALUE),
|
||||
fReadMode(false),
|
||||
@ -203,15 +203,15 @@ hsBool hsNamedPipeStream::WaitForClientConnect()
|
||||
|
||||
hsBool hsNamedPipeStream::Open(const char *name, const char *mode)
|
||||
{
|
||||
wchar* wName = hsStringToWString(name);
|
||||
wchar* wMode = hsStringToWString(mode);
|
||||
wchar_t* wName = hsStringToWString(name);
|
||||
wchar_t* wMode = hsStringToWString(mode);
|
||||
hsBool ret = Open(wName, wMode);
|
||||
delete [] wName;
|
||||
delete [] wMode;
|
||||
return ret;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::Open(const wchar *name, const wchar *mode)
|
||||
hsBool hsNamedPipeStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
{
|
||||
if (wcschr(mode, L'w'))
|
||||
{
|
||||
@ -270,7 +270,7 @@ hsBool hsNamedPipeStream::Close()
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, UInt32 &numTransferred)
|
||||
hsBool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, uint32_t &numTransferred)
|
||||
{
|
||||
// Read/Write succeeded, return now
|
||||
if (result)
|
||||
@ -294,7 +294,7 @@ hsBool hsNamedPipeStream::ICheckOverlappedResult(BOOL result, UInt32 &numTransfe
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::IRead(UInt32 byteCount, void *buffer, UInt32 &numRead)
|
||||
hsBool hsNamedPipeStream::IRead(uint32_t byteCount, void *buffer, uint32_t &numRead)
|
||||
{
|
||||
numRead = 0;
|
||||
|
||||
@ -312,7 +312,7 @@ hsBool hsNamedPipeStream::IRead(UInt32 byteCount, void *buffer, UInt32 &numRead)
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsNamedPipeStream::IWrite(UInt32 byteCount, const void *buffer, UInt32 &numWritten)
|
||||
hsBool hsNamedPipeStream::IWrite(uint32_t byteCount, const void *buffer, uint32_t &numWritten)
|
||||
{
|
||||
numWritten = 0;
|
||||
|
||||
@ -330,13 +330,13 @@ hsBool hsNamedPipeStream::IWrite(UInt32 byteCount, const void *buffer, UInt32 &n
|
||||
return false;
|
||||
}
|
||||
|
||||
UInt32 hsNamedPipeStream::Read(UInt32 byteCount, void *buffer)
|
||||
uint32_t hsNamedPipeStream::Read(uint32_t byteCount, void *buffer)
|
||||
{
|
||||
UInt32 totalRead = 0;
|
||||
uint32_t totalRead = 0;
|
||||
|
||||
// Read until we get all our data or an error
|
||||
UInt32 numRead = 0;
|
||||
while (IRead(byteCount-totalRead, (void*)((UInt32)buffer+totalRead), numRead))
|
||||
uint32_t numRead = 0;
|
||||
while (IRead(byteCount-totalRead, (void*)((uint32_t)buffer+totalRead), numRead))
|
||||
{
|
||||
totalRead += numRead;
|
||||
|
||||
@ -347,13 +347,13 @@ UInt32 hsNamedPipeStream::Read(UInt32 byteCount, void *buffer)
|
||||
return totalRead;
|
||||
}
|
||||
|
||||
UInt32 hsNamedPipeStream::Write(UInt32 byteCount, const void *buffer)
|
||||
uint32_t hsNamedPipeStream::Write(uint32_t byteCount, const void *buffer)
|
||||
{
|
||||
UInt32 totalWritten = 0;
|
||||
uint32_t totalWritten = 0;
|
||||
|
||||
// Write until we get all our data or an error
|
||||
UInt32 numWritten = 0;
|
||||
while (IWrite(byteCount-totalWritten, (const void*)((UInt32)buffer+totalWritten), numWritten))
|
||||
uint32_t numWritten = 0;
|
||||
while (IWrite(byteCount-totalWritten, (const void*)((uint32_t)buffer+totalWritten), numWritten))
|
||||
{
|
||||
totalWritten += numWritten;
|
||||
|
||||
@ -368,14 +368,14 @@ UInt32 hsNamedPipeStream::Write(UInt32 byteCount, const void *buffer)
|
||||
using std::min;
|
||||
#endif
|
||||
|
||||
void hsNamedPipeStream::Skip(UInt32 deltaByteCount)
|
||||
void hsNamedPipeStream::Skip(uint32_t deltaByteCount)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
// Read until we get all our data or an error
|
||||
UInt32 totalRead = 0;
|
||||
UInt32 numRead = 0;
|
||||
while (IRead(min((UInt32)256L, deltaByteCount-totalRead), buf, numRead))
|
||||
uint32_t totalRead = 0;
|
||||
uint32_t numRead = 0;
|
||||
while (IRead(min((uint32_t)256L, deltaByteCount-totalRead), buf, numRead))
|
||||
{
|
||||
totalRead += numRead;
|
||||
|
||||
|
@ -49,38 +49,38 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class hsVectorStream : public hsStream
|
||||
{
|
||||
protected:
|
||||
std::vector<Byte> fVector;
|
||||
UInt32 fEnd; // End of file (one past the last byte)
|
||||
std::vector<uint8_t> fVector;
|
||||
uint32_t fEnd; // End of file (one past the last byte)
|
||||
|
||||
public:
|
||||
hsVectorStream();
|
||||
hsVectorStream(UInt32 chunkSize);
|
||||
hsVectorStream(uint32_t chunkSize);
|
||||
virtual ~hsVectorStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsVectorStream::Open Not Implemented"); return false; }
|
||||
virtual hsBool Open(const wchar *, const wchar *) { hsAssert(0, "hsVectorStream::Open Not Implemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsVectorStream::Open Not Implemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsVectorStream::Close Not Implemented"); return false; }
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual UInt32 Read(UInt32 byteCount, void * buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
|
||||
virtual UInt32 GetEOF();
|
||||
virtual uint32_t GetEOF();
|
||||
virtual void CopyToMem(void* mem);
|
||||
|
||||
virtual void Reset(); // clears the buffers
|
||||
|
||||
// Erase number of bytes at the current position
|
||||
virtual void Erase(UInt32 bytes);
|
||||
virtual void Erase(uint32_t bytes);
|
||||
// A pointer to the beginning of the data in the stream. This is only valid
|
||||
// until someone modifies the stream.
|
||||
const void *GetData();
|
||||
// In case you want to try and be efficient with your memory allocations
|
||||
void Reserve(UInt32 bytes) { fVector.reserve(bytes); }
|
||||
void Reserve(uint32_t bytes) { fVector.reserve(bytes); }
|
||||
};
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
@ -93,17 +93,17 @@ protected:
|
||||
HANDLE fPipe;
|
||||
OVERLAPPED fOverlap;
|
||||
hsBool fReadMode; // True for read, false for write
|
||||
UInt8 fFlags;
|
||||
UInt32 fTimeout;
|
||||
uint8_t fFlags;
|
||||
uint32_t fTimeout;
|
||||
|
||||
hsBool ICheckOverlappedResult(BOOL result, UInt32 &numTransferred);
|
||||
hsBool IRead(UInt32 byteCount, void *buffer, UInt32 &numRead);
|
||||
hsBool IWrite(UInt32 byteCount, const void *buffer, UInt32 &numWritten);
|
||||
hsBool ICheckOverlappedResult(BOOL result, uint32_t &numTransferred);
|
||||
hsBool IRead(uint32_t byteCount, void *buffer, uint32_t &numRead);
|
||||
hsBool IWrite(uint32_t byteCount, const void *buffer, uint32_t &numWritten);
|
||||
|
||||
public:
|
||||
enum { kThrowOnError = 1 }; // Throws if a read or write operation fails
|
||||
|
||||
hsNamedPipeStream(UInt8 flags=0, UInt32 timeout=INFINITE);
|
||||
hsNamedPipeStream(uint8_t flags=0, uint32_t timeout=INFINITE);
|
||||
virtual ~hsNamedPipeStream();
|
||||
|
||||
// The server (writer) and client (reader) need to open the same file.
|
||||
@ -111,12 +111,12 @@ public:
|
||||
// computer name to do it over the network. 'pipeName' is whatever you
|
||||
// want.
|
||||
virtual hsBool Open(const char *name, const char *mode);
|
||||
virtual hsBool Open(const wchar *name, const wchar *mode);
|
||||
virtual hsBool Open(const wchar_t *name, const wchar_t *mode);
|
||||
virtual hsBool Close();
|
||||
|
||||
virtual UInt32 Read(UInt32 byteCount, void *buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void *buffer);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void *buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void *buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
|
||||
// - For the server (writer) only -
|
||||
|
@ -133,7 +133,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define hsScalarToFloat(x) float(x)
|
||||
|
||||
#define hsIntToScalar(x) float(x)
|
||||
#define hsScalarToInt(x) Int32(x)
|
||||
#define hsScalarToInt(x) int32_t(x)
|
||||
|
||||
|
||||
#define hsFixedToScalar(x) ((hsScalar)(x) / float(hsFixed1))
|
||||
@ -154,15 +154,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#ifndef HS_DEBUGGING /* mf horse testing defines vs inlines for VC++5.0 performance */
|
||||
|
||||
#define hsScalarRound(x) Int32((x) + ((x) < 0 ? -hsScalarHalf : hsScalarHalf))
|
||||
#define hsScalarRound(x) int32_t((x) + ((x) < 0 ? -hsScalarHalf : hsScalarHalf))
|
||||
|
||||
#else /* HS_DEBUGGING - use inlines for type-checking etc...and all */
|
||||
inline Int32 hsScalarRound(float x)
|
||||
inline int32_t hsScalarRound(float x)
|
||||
{
|
||||
float half = hsScalarHalf;
|
||||
if (x < 0)
|
||||
half = -half;
|
||||
return Int32(x + half);
|
||||
return int32_t(x + half);
|
||||
}
|
||||
#endif /* HS_DEBUGGING - use inlines for type-checking etc...and all */
|
||||
|
||||
|
@ -64,12 +64,12 @@ void hsStream::FastFwd()
|
||||
hsThrow("FastFwd unimplemented by subclass of stream");
|
||||
}
|
||||
|
||||
UInt32 hsStream::GetPosition() const
|
||||
uint32_t hsStream::GetPosition() const
|
||||
{
|
||||
return fPosition;
|
||||
}
|
||||
|
||||
void hsStream::SetPosition(UInt32 position)
|
||||
void hsStream::SetPosition(uint32_t position)
|
||||
{
|
||||
if (position == fPosition)
|
||||
return;
|
||||
@ -82,9 +82,9 @@ void hsStream::Truncate()
|
||||
hsThrow("Truncate unimplemented by subclass of stream");
|
||||
}
|
||||
|
||||
UInt32 hsStream::GetSizeLeft()
|
||||
uint32_t hsStream::GetSizeLeft()
|
||||
{
|
||||
UInt32 ret = 0;
|
||||
uint32_t ret = 0;
|
||||
if (GetPosition() > GetEOF())
|
||||
{
|
||||
hsThrow("Position is beyond EOF");
|
||||
@ -99,7 +99,7 @@ UInt32 hsStream::GetSizeLeft()
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 hsStream::GetEOF()
|
||||
uint32_t hsStream::GetEOF()
|
||||
{
|
||||
hsThrow( "GetEOF() unimplemented by subclass of stream");
|
||||
return 0;
|
||||
@ -116,30 +116,30 @@ hsStream::~hsStream()
|
||||
{
|
||||
}
|
||||
|
||||
UInt32 hsStream::WriteString(const char cstring[])
|
||||
uint32_t hsStream::WriteString(const char cstring[])
|
||||
{
|
||||
return Write(hsStrlen(cstring), cstring);
|
||||
}
|
||||
|
||||
UInt32 hsStream::WriteFmt(const char * fmt, ...)
|
||||
uint32_t hsStream::WriteFmt(const char * fmt, ...)
|
||||
{
|
||||
va_list av;
|
||||
va_start( av, fmt );
|
||||
UInt32 n = WriteFmtV( fmt, av );
|
||||
uint32_t n = WriteFmtV( fmt, av );
|
||||
va_end( av );
|
||||
return n;
|
||||
}
|
||||
|
||||
UInt32 hsStream::WriteFmtV(const char * fmt, va_list av)
|
||||
uint32_t hsStream::WriteFmtV(const char * fmt, va_list av)
|
||||
{
|
||||
std::string buf;
|
||||
xtl::formatv( buf, fmt, av );
|
||||
return Write( buf.length(), buf.data() );
|
||||
}
|
||||
|
||||
UInt32 hsStream::WriteSafeStringLong(const char *string)
|
||||
uint32_t hsStream::WriteSafeStringLong(const char *string)
|
||||
{
|
||||
UInt32 len = hsStrlen(string);
|
||||
uint32_t len = hsStrlen(string);
|
||||
WriteLE32(len);
|
||||
if (len > 0)
|
||||
{
|
||||
@ -150,7 +150,7 @@ UInt32 hsStream::WriteSafeStringLong(const char *string)
|
||||
buff[i] = ~string[i];
|
||||
}
|
||||
buff[len] = '\0';
|
||||
UInt32 result = Write(len, buff);
|
||||
uint32_t result = Write(len, buff);
|
||||
delete [] buff;
|
||||
return result;
|
||||
}
|
||||
@ -158,9 +158,9 @@ UInt32 hsStream::WriteSafeStringLong(const char *string)
|
||||
return 0;
|
||||
}
|
||||
|
||||
UInt32 hsStream::WriteSafeWStringLong(const wchar_t *string)
|
||||
uint32_t hsStream::WriteSafeWStringLong(const wchar_t *string)
|
||||
{
|
||||
UInt32 len = wcslen(string);
|
||||
uint32_t len = wcslen(string);
|
||||
WriteLE32(len);
|
||||
if (len > 0)
|
||||
{
|
||||
@ -168,9 +168,9 @@ UInt32 hsStream::WriteSafeWStringLong(const wchar_t *string)
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
wchar_t buff = ~string[i];
|
||||
WriteLE16((UInt16)buff);
|
||||
WriteLE16((uint16_t)buff);
|
||||
}
|
||||
WriteLE16((UInt16)L'\0');
|
||||
WriteLE16((uint16_t)L'\0');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -178,7 +178,7 @@ UInt32 hsStream::WriteSafeWStringLong(const wchar_t *string)
|
||||
char *hsStream::ReadSafeStringLong()
|
||||
{
|
||||
char *name = nil;
|
||||
UInt32 numChars = ReadLE32();
|
||||
uint32_t numChars = ReadLE32();
|
||||
if (numChars > 0 && numChars <= GetSizeLeft())
|
||||
{
|
||||
name = TRACKED_NEW char[numChars+1];
|
||||
@ -200,7 +200,7 @@ char *hsStream::ReadSafeStringLong()
|
||||
wchar_t *hsStream::ReadSafeWStringLong()
|
||||
{
|
||||
wchar_t *retVal = nil;
|
||||
UInt32 numChars = ReadLE32();
|
||||
uint32_t numChars = ReadLE32();
|
||||
if (numChars > 0 && numChars <= (GetSizeLeft()/2)) // divide by two because each char is two bytes
|
||||
{
|
||||
retVal = TRACKED_NEW wchar_t[numChars+1];
|
||||
@ -220,7 +220,7 @@ wchar_t *hsStream::ReadSafeWStringLong()
|
||||
return retVal;
|
||||
}
|
||||
|
||||
UInt32 hsStream::WriteSafeString(const char *string)
|
||||
uint32_t hsStream::WriteSafeString(const char *string)
|
||||
{
|
||||
int len = hsStrlen(string);
|
||||
hsAssert(len<0xf000, xtl::format("string len of %d is too long for WriteSafeString %s, use WriteSafeStringLong",
|
||||
@ -236,7 +236,7 @@ UInt32 hsStream::WriteSafeString(const char *string)
|
||||
buff[i] = ~string[i];
|
||||
}
|
||||
buff[len] = '\0';
|
||||
UInt32 result = Write(len, buff);
|
||||
uint32_t result = Write(len, buff);
|
||||
delete [] buff;
|
||||
return result;
|
||||
}
|
||||
@ -244,7 +244,7 @@ UInt32 hsStream::WriteSafeString(const char *string)
|
||||
return 0;
|
||||
}
|
||||
|
||||
UInt32 hsStream::WriteSafeWString(const wchar_t *string)
|
||||
uint32_t hsStream::WriteSafeWString(const wchar_t *string)
|
||||
{
|
||||
int len = wcslen(string);
|
||||
hsAssert(len<0xf000, xtl::format("string len of %d is too long for WriteSafeWString, use WriteSafeWStringLong",
|
||||
@ -257,9 +257,9 @@ UInt32 hsStream::WriteSafeWString(const wchar_t *string)
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
wchar_t buff = ~string[i];
|
||||
WriteLE16((UInt16)buff);
|
||||
WriteLE16((uint16_t)buff);
|
||||
}
|
||||
WriteLE16((UInt16)L'\0');
|
||||
WriteLE16((uint16_t)L'\0');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -267,7 +267,7 @@ UInt32 hsStream::WriteSafeWString(const wchar_t *string)
|
||||
char *hsStream::ReadSafeString()
|
||||
{
|
||||
char *name = nil;
|
||||
UInt16 numChars = ReadLE16();
|
||||
uint16_t numChars = ReadLE16();
|
||||
|
||||
#ifndef REMOVE_ME_SOON
|
||||
// Backward compat hack - remove in a week or so (from 6/30/03)
|
||||
@ -299,7 +299,7 @@ char *hsStream::ReadSafeString()
|
||||
wchar_t *hsStream::ReadSafeWString()
|
||||
{
|
||||
wchar_t *retVal = nil;
|
||||
UInt32 numChars = ReadLE16();
|
||||
uint32_t numChars = ReadLE16();
|
||||
|
||||
numChars &= ~0xf000;
|
||||
hsAssert(numChars <= GetSizeLeft()/2, "Bad string");
|
||||
@ -324,7 +324,7 @@ wchar_t *hsStream::ReadSafeWString()
|
||||
|
||||
hsBool hsStream::Read4Bytes(void *pv) // Virtual, faster version in sub classes
|
||||
{
|
||||
int knt = this->Read(sizeof(UInt32), pv);
|
||||
int knt = this->Read(sizeof(uint32_t), pv);
|
||||
if (knt != 4)
|
||||
return false;
|
||||
return true;
|
||||
@ -361,7 +361,7 @@ void hsStream::ReadBool(int count, hsBool values[])
|
||||
this->Read(count, values);
|
||||
|
||||
if (sizeof(hsBool) > 1)
|
||||
{ const UInt8* src = (UInt8*)values;
|
||||
{ const uint8_t* src = (uint8_t*)values;
|
||||
|
||||
// go backwards so we don't overwrite ourselves
|
||||
for (int i = count - 1; i >= 0; --i)
|
||||
@ -369,11 +369,11 @@ void hsStream::ReadBool(int count, hsBool values[])
|
||||
}
|
||||
}
|
||||
|
||||
UInt8 hsStream::ReadByte()
|
||||
uint8_t hsStream::ReadByte()
|
||||
{
|
||||
UInt8 value;
|
||||
uint8_t value;
|
||||
|
||||
this->Read(sizeof(UInt8), &value);
|
||||
this->Read(sizeof(uint8_t), &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -388,7 +388,7 @@ hsBool hsStream::IsTokenSeparator(char c)
|
||||
return (isspace(c) || c==',' || c=='=');
|
||||
}
|
||||
|
||||
hsBool hsStream::GetToken(char *s, UInt32 maxLen, const char beginComment, const char endComment)
|
||||
hsBool hsStream::GetToken(char *s, uint32_t maxLen, const char beginComment, const char endComment)
|
||||
{
|
||||
char c;
|
||||
char endCom;
|
||||
@ -412,7 +412,7 @@ hsBool hsStream::GetToken(char *s, UInt32 maxLen, const char beginComment, const
|
||||
}
|
||||
|
||||
s[0] = c;
|
||||
UInt32 k = 1;
|
||||
uint32_t k = 1;
|
||||
while( !AtEnd() && !IsTokenSeparator(c = ReadByte()) )
|
||||
{
|
||||
if( k < maxLen )
|
||||
@ -438,7 +438,7 @@ hsBool hsStream::GetToken(char *s, UInt32 maxLen, const char beginComment, const
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsStream::ReadLn(char *s, UInt32 maxLen, const char beginComment, const char endComment)
|
||||
hsBool hsStream::ReadLn(char *s, uint32_t maxLen, const char beginComment, const char endComment)
|
||||
{
|
||||
char c;
|
||||
char endCom;
|
||||
@ -462,7 +462,7 @@ hsBool hsStream::ReadLn(char *s, UInt32 maxLen, const char beginComment, const c
|
||||
}
|
||||
|
||||
s[0] = c;
|
||||
UInt32 k = 1;
|
||||
uint32_t k = 1;
|
||||
while( !AtEnd() && !strchr("\r\n",c = ReadByte()) )
|
||||
{
|
||||
if( k < maxLen )
|
||||
@ -488,39 +488,39 @@ hsBool hsStream::ReadLn(char *s, UInt32 maxLen, const char beginComment, const c
|
||||
return true;
|
||||
}
|
||||
|
||||
UInt16 hsStream::ReadLE16()
|
||||
uint16_t hsStream::ReadLE16()
|
||||
{
|
||||
UInt16 value;
|
||||
this->Read(sizeof(UInt16), &value);
|
||||
uint16_t value;
|
||||
this->Read(sizeof(uint16_t), &value);
|
||||
value = hsToLE16(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
void hsStream::ReadLE16(int count, UInt16 values[])
|
||||
void hsStream::ReadLE16(int count, uint16_t values[])
|
||||
{
|
||||
this->Read(count * sizeof(UInt16), values);
|
||||
this->Read(count * sizeof(uint16_t), values);
|
||||
for (int i = 0; i < count; i++)
|
||||
values[i] = hsToLE16(values[i]);
|
||||
}
|
||||
|
||||
UInt32 hsStream::ReadLE32()
|
||||
uint32_t hsStream::ReadLE32()
|
||||
{
|
||||
UInt32 value;
|
||||
uint32_t value;
|
||||
Read4Bytes(&value);
|
||||
value = hsToLE32(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
void hsStream::ReadLE32(int count, UInt32 values[])
|
||||
void hsStream::ReadLE32(int count, uint32_t values[])
|
||||
{
|
||||
this->Read(count * sizeof(UInt32), values);
|
||||
this->Read(count * sizeof(uint32_t), values);
|
||||
for (int i = 0; i < count; i++)
|
||||
values[i] = hsToLE32(values[i]);
|
||||
}
|
||||
|
||||
UInt32 hsStream::ReadBE32()
|
||||
uint32_t hsStream::ReadBE32()
|
||||
{
|
||||
UInt32 value;
|
||||
uint32_t value;
|
||||
Read4Bytes(&value);
|
||||
value = hsToBE32(value);
|
||||
return value;
|
||||
@ -570,23 +570,23 @@ UInt32 hsStream::ReadBE32()
|
||||
|
||||
void hsStream::WriteBool(hsBool value)
|
||||
{
|
||||
UInt8 dst = (value != 0);
|
||||
uint8_t dst = (value != 0);
|
||||
|
||||
this->Write(sizeof(UInt8), &dst);
|
||||
this->Write(sizeof(uint8_t), &dst);
|
||||
}
|
||||
|
||||
void hsStream::Writebool(bool value)
|
||||
{
|
||||
UInt8 dst = (value != 0);
|
||||
uint8_t dst = (value != 0);
|
||||
|
||||
this->Write(sizeof(UInt8), &dst);
|
||||
this->Write(sizeof(uint8_t), &dst);
|
||||
}
|
||||
|
||||
void hsStream::WriteBool(int count, const hsBool values[])
|
||||
{
|
||||
if (sizeof(hsBool) > 1)
|
||||
{ hsTempArray<UInt8> storage(count);
|
||||
UInt8* dst = (UInt8*)values;
|
||||
{ hsTempArray<uint8_t> storage(count);
|
||||
uint8_t* dst = (uint8_t*)values;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
dst[i] = (values[i] != 0);
|
||||
@ -596,39 +596,39 @@ void hsStream::WriteBool(int count, const hsBool values[])
|
||||
this->Write(count, values);
|
||||
}
|
||||
|
||||
void hsStream::WriteByte(UInt8 value)
|
||||
void hsStream::WriteByte(uint8_t value)
|
||||
{
|
||||
this->Write(sizeof(UInt8), &value);
|
||||
this->Write(sizeof(uint8_t), &value);
|
||||
}
|
||||
|
||||
void hsStream::WriteLE16(UInt16 value)
|
||||
void hsStream::WriteLE16(uint16_t value)
|
||||
{
|
||||
value = hsToLE16(value);
|
||||
this->Write(sizeof(Int16), &value);
|
||||
this->Write(sizeof(int16_t), &value);
|
||||
}
|
||||
|
||||
void hsStream::WriteLE16(int count, const UInt16 values[])
|
||||
void hsStream::WriteLE16(int count, const uint16_t values[])
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
this->WriteLE16(values[i]);
|
||||
}
|
||||
|
||||
void hsStream::WriteLE32(UInt32 value)
|
||||
void hsStream::WriteLE32(uint32_t value)
|
||||
{
|
||||
value = hsToLE32(value);
|
||||
this->Write(sizeof(Int32), &value);
|
||||
this->Write(sizeof(int32_t), &value);
|
||||
}
|
||||
|
||||
void hsStream::WriteLE32(int count, const UInt32 values[])
|
||||
void hsStream::WriteLE32(int count, const uint32_t values[])
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
this->WriteLE32(values[i]);
|
||||
}
|
||||
|
||||
void hsStream::WriteBE32(UInt32 value)
|
||||
void hsStream::WriteBE32(uint32_t value)
|
||||
{
|
||||
value = hsToBE32(value);
|
||||
this->Write(sizeof(Int32), &value);
|
||||
this->Write(sizeof(int32_t), &value);
|
||||
}
|
||||
|
||||
#if HS_CAN_USE_FLOAT
|
||||
@ -663,16 +663,16 @@ void hsStream::WriteBE32(UInt32 value)
|
||||
}
|
||||
#endif
|
||||
|
||||
void hsStream::WriteLEAtom(UInt32 tag, UInt32 size)
|
||||
void hsStream::WriteLEAtom(uint32_t tag, uint32_t size)
|
||||
{
|
||||
this->WriteLE32(tag);
|
||||
this->WriteLE32(size);
|
||||
}
|
||||
|
||||
UInt32 hsStream::ReadLEAtom(UInt32* sizePtr)
|
||||
uint32_t hsStream::ReadLEAtom(uint32_t* sizePtr)
|
||||
{
|
||||
UInt32 tag = this->ReadLE32();
|
||||
UInt32 size = this->ReadLE32();
|
||||
uint32_t tag = this->ReadLE32();
|
||||
uint32_t size = this->ReadLE32();
|
||||
|
||||
if (sizePtr)
|
||||
*sizePtr = size;
|
||||
@ -689,7 +689,7 @@ hsBool hsFileStream::Open(const char *name, const char *mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsFileStream::Open(const wchar *name, const wchar *mode)
|
||||
hsBool hsFileStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
{
|
||||
hsAssert(0, "hsFileStream::Open NotImplemented");
|
||||
return false;
|
||||
@ -701,12 +701,12 @@ hsBool hsFileStream::Close ()
|
||||
return false;
|
||||
}
|
||||
|
||||
UInt32 hsFileStream::GetFileRef()
|
||||
uint32_t hsFileStream::GetFileRef()
|
||||
{
|
||||
return fRef;
|
||||
}
|
||||
|
||||
void hsFileStream::SetFileRef(UInt32 ref)
|
||||
void hsFileStream::SetFileRef(uint32_t ref)
|
||||
{
|
||||
hsAssert(ref != kFileStream_Uninitialized, "bad ref");
|
||||
fRef = ref;
|
||||
@ -721,7 +721,7 @@ hsFileStream::~hsFileStream()
|
||||
{
|
||||
}
|
||||
|
||||
UInt32 hsFileStream::Read(UInt32 bytes, void* buffer)
|
||||
uint32_t hsFileStream::Read(uint32_t bytes, void* buffer)
|
||||
{
|
||||
hsAssert(fRef != kFileStream_Uninitialized, "fRef uninitialized");
|
||||
|
||||
@ -729,7 +729,7 @@ UInt32 hsFileStream::Read(UInt32 bytes, void* buffer)
|
||||
fPosition += bytes;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
UInt32 rBytes;
|
||||
uint32_t rBytes;
|
||||
ReadFile((HANDLE)fRef, buffer, bytes, (LPDWORD)&rBytes, nil);
|
||||
if(bytes == rBytes)
|
||||
return bytes;
|
||||
@ -740,7 +740,7 @@ UInt32 hsFileStream::Read(UInt32 bytes, void* buffer)
|
||||
#endif
|
||||
}
|
||||
|
||||
UInt32 hsFileStream::Write(UInt32 bytes, const void* buffer)
|
||||
uint32_t hsFileStream::Write(uint32_t bytes, const void* buffer)
|
||||
{
|
||||
hsAssert(fRef != kFileStream_Uninitialized, "fRef uninitialized");
|
||||
|
||||
@ -748,7 +748,7 @@ UInt32 hsFileStream::Write(UInt32 bytes, const void* buffer)
|
||||
fPosition += bytes;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
UInt32 wBytes;
|
||||
uint32_t wBytes;
|
||||
WriteFile((HANDLE)fRef, buffer, bytes, (LPDWORD)&wBytes, nil);
|
||||
if(bytes == wBytes)
|
||||
return bytes;
|
||||
@ -768,7 +768,7 @@ UInt32 hsFileStream::Write(UInt32 bytes, const void* buffer)
|
||||
hsBool hsFileStream::AtEnd()
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
UInt32 bytes;
|
||||
uint32_t bytes;
|
||||
PeekNamedPipe((void*)fRef, nil, 0, nil, (LPDWORD)&bytes, nil);
|
||||
return bytes>0;
|
||||
#else
|
||||
@ -777,7 +777,7 @@ hsBool hsFileStream::AtEnd()
|
||||
#endif
|
||||
}
|
||||
|
||||
void hsFileStream::Skip(UInt32 delta)
|
||||
void hsFileStream::Skip(uint32_t delta)
|
||||
{
|
||||
fBytesRead += delta;
|
||||
fPosition += delta;
|
||||
@ -817,7 +817,7 @@ hsBool hsUNIXStream::Open(const char *name, const char *mode)
|
||||
return (fRef) ? true : false;
|
||||
}
|
||||
|
||||
hsBool hsUNIXStream::Open(const wchar *name, const wchar *mode)
|
||||
hsBool hsUNIXStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
{
|
||||
fPosition = 0;
|
||||
fRef = hsWFopen(name, mode);
|
||||
@ -836,7 +836,7 @@ hsBool hsUNIXStream::Close()
|
||||
return !rtn;
|
||||
}
|
||||
|
||||
UInt32 hsUNIXStream::Read(UInt32 bytes, void* buffer)
|
||||
uint32_t hsUNIXStream::Read(uint32_t bytes, void* buffer)
|
||||
{
|
||||
if (!fRef || !bytes)
|
||||
return 0;
|
||||
@ -868,7 +868,7 @@ hsBool hsUNIXStream::AtEnd()
|
||||
return rVal;
|
||||
}
|
||||
|
||||
UInt32 hsUNIXStream::Write(UInt32 bytes, const void* buffer)
|
||||
uint32_t hsUNIXStream::Write(uint32_t bytes, const void* buffer)
|
||||
{
|
||||
if (!fRef)
|
||||
return 0;
|
||||
@ -876,7 +876,7 @@ UInt32 hsUNIXStream::Write(UInt32 bytes, const void* buffer)
|
||||
return fwrite(buffer, bytes, 1, fRef);
|
||||
}
|
||||
|
||||
void hsUNIXStream::SetPosition(UInt32 position)
|
||||
void hsUNIXStream::SetPosition(uint32_t position)
|
||||
{
|
||||
if (!fRef || (position == fPosition))
|
||||
return;
|
||||
@ -885,7 +885,7 @@ void hsUNIXStream::SetPosition(UInt32 position)
|
||||
(void)::fseek(fRef, position, SEEK_SET);
|
||||
}
|
||||
|
||||
void hsUNIXStream::Skip(UInt32 delta)
|
||||
void hsUNIXStream::Skip(uint32_t delta)
|
||||
{
|
||||
if (!fRef)
|
||||
return;
|
||||
@ -911,14 +911,14 @@ void hsUNIXStream::FastFwd()
|
||||
fBytesRead = fPosition = ftell(fRef);
|
||||
}
|
||||
|
||||
UInt32 hsUNIXStream::GetEOF()
|
||||
uint32_t hsUNIXStream::GetEOF()
|
||||
{
|
||||
if( !fRef )
|
||||
return 0;
|
||||
|
||||
long oldPos = ftell( fRef );
|
||||
(void)::fseek( fRef, 0, SEEK_END );
|
||||
UInt32 end = (UInt32)ftell( fRef );
|
||||
uint32_t end = (uint32_t)ftell( fRef );
|
||||
(void)::fseek( fRef, oldPos, SEEK_SET );
|
||||
|
||||
return end;
|
||||
@ -950,7 +950,7 @@ plReadOnlySubStream::~plReadOnlySubStream()
|
||||
{
|
||||
}
|
||||
|
||||
void plReadOnlySubStream::Open( hsStream *base, UInt32 offset, UInt32 length )
|
||||
void plReadOnlySubStream::Open( hsStream *base, uint32_t offset, uint32_t length )
|
||||
{
|
||||
fBase = base;
|
||||
fOffset = offset;
|
||||
@ -972,7 +972,7 @@ hsBool plReadOnlySubStream::AtEnd()
|
||||
return false;
|
||||
}
|
||||
|
||||
UInt32 plReadOnlySubStream::Read(UInt32 byteCount, void* buffer)
|
||||
uint32_t plReadOnlySubStream::Read(uint32_t byteCount, void* buffer)
|
||||
{
|
||||
if( byteCount > GetSizeLeft() )
|
||||
{
|
||||
@ -980,18 +980,18 @@ UInt32 plReadOnlySubStream::Read(UInt32 byteCount, void* buffer)
|
||||
byteCount = GetSizeLeft();
|
||||
}
|
||||
|
||||
UInt32 read = fBase->Read( byteCount, buffer );
|
||||
uint32_t read = fBase->Read( byteCount, buffer );
|
||||
IFixPosition();
|
||||
return read;
|
||||
}
|
||||
|
||||
UInt32 plReadOnlySubStream::Write(UInt32 byteCount, const void* buffer)
|
||||
uint32_t plReadOnlySubStream::Write(uint32_t byteCount, const void* buffer)
|
||||
{
|
||||
hsAssert( false, "Write not allowed on an plReadOnlySubStream" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void plReadOnlySubStream::Skip(UInt32 deltaByteCount)
|
||||
void plReadOnlySubStream::Skip(uint32_t deltaByteCount)
|
||||
{
|
||||
fBase->Skip( deltaByteCount );
|
||||
IFixPosition();
|
||||
@ -1014,7 +1014,7 @@ void plReadOnlySubStream::Truncate()
|
||||
hsAssert( false, "Can't truncate a read-only stream" );
|
||||
}
|
||||
|
||||
UInt32 plReadOnlySubStream::GetEOF()
|
||||
uint32_t plReadOnlySubStream::GetEOF()
|
||||
{
|
||||
return fLength;
|
||||
}
|
||||
@ -1028,7 +1028,7 @@ hsRAMStream::hsRAMStream() : fAppender(1, kRAMStreamChunkSize)
|
||||
fIter.ResetToHead(&fAppender);
|
||||
}
|
||||
|
||||
hsRAMStream::hsRAMStream(UInt32 chunkSize) : fAppender(1, chunkSize)
|
||||
hsRAMStream::hsRAMStream(uint32_t chunkSize) : fAppender(1, chunkSize)
|
||||
{
|
||||
fIter.ResetToHead(&fAppender);
|
||||
}
|
||||
@ -1051,7 +1051,7 @@ hsBool hsRAMStream::AtEnd()
|
||||
return (fBytesRead >= fAppender.Count() * fAppender.ElemSize());
|
||||
}
|
||||
|
||||
UInt32 hsRAMStream::Read(UInt32 byteCount, void * buffer)
|
||||
uint32_t hsRAMStream::Read(uint32_t byteCount, void * buffer)
|
||||
{
|
||||
if (fBytesRead + byteCount > fAppender.Count() * fAppender.ElemSize())
|
||||
byteCount = (fAppender.Count() * fAppender.ElemSize()) - fBytesRead;
|
||||
@ -1064,7 +1064,7 @@ UInt32 hsRAMStream::Read(UInt32 byteCount, void * buffer)
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
UInt32 hsRAMStream::Write(UInt32 byteCount, const void* buffer)
|
||||
uint32_t hsRAMStream::Write(uint32_t byteCount, const void* buffer)
|
||||
{
|
||||
fPosition += byteCount;
|
||||
|
||||
@ -1073,7 +1073,7 @@ UInt32 hsRAMStream::Write(UInt32 byteCount, const void* buffer)
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
void hsRAMStream::Skip(UInt32 deltaByteCount)
|
||||
void hsRAMStream::Skip(uint32_t deltaByteCount)
|
||||
{
|
||||
fPosition += deltaByteCount;
|
||||
fIter.Next(deltaByteCount, nil);
|
||||
@ -1091,7 +1091,7 @@ void hsRAMStream::Truncate()
|
||||
Reset();
|
||||
}
|
||||
|
||||
UInt32 hsRAMStream::GetEOF()
|
||||
uint32_t hsRAMStream::GetEOF()
|
||||
{
|
||||
return fAppender.Count() * fAppender.ElemSize();
|
||||
}
|
||||
@ -1103,13 +1103,13 @@ void hsRAMStream::CopyToMem(void* mem)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 hsNullStream::Read(UInt32 byteCount, void * buffer)
|
||||
uint32_t hsNullStream::Read(uint32_t byteCount, void * buffer)
|
||||
{
|
||||
hsThrow("hsNullStream: Can't read from this stream!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
UInt32 hsNullStream::Write(UInt32 byteCount, const void* buffer)
|
||||
uint32_t hsNullStream::Write(uint32_t byteCount, const void* buffer)
|
||||
{
|
||||
fBytesRead += byteCount;
|
||||
fPosition += byteCount;
|
||||
@ -1117,7 +1117,7 @@ UInt32 hsNullStream::Write(UInt32 byteCount, const void* buffer)
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
void hsNullStream::Skip(UInt32 deltaByteCount)
|
||||
void hsNullStream::Skip(uint32_t deltaByteCount)
|
||||
{
|
||||
fBytesRead += deltaByteCount;
|
||||
fPosition += deltaByteCount;
|
||||
@ -1140,7 +1140,7 @@ hsBool hsReadOnlyStream::AtEnd()
|
||||
return fData >= fStop;
|
||||
}
|
||||
|
||||
UInt32 hsReadOnlyStream::Read(UInt32 byteCount, void* buffer)
|
||||
uint32_t hsReadOnlyStream::Read(uint32_t byteCount, void* buffer)
|
||||
{
|
||||
if (fData + byteCount > fStop)
|
||||
{
|
||||
@ -1155,13 +1155,13 @@ UInt32 hsReadOnlyStream::Read(UInt32 byteCount, void* buffer)
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
UInt32 hsReadOnlyStream::Write(UInt32 byteCount, const void* buffer)
|
||||
uint32_t hsReadOnlyStream::Write(uint32_t byteCount, const void* buffer)
|
||||
{
|
||||
hsThrow( "can't write to a readonly stream");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hsReadOnlyStream::Skip(UInt32 deltaByteCount)
|
||||
void hsReadOnlyStream::Skip(uint32_t deltaByteCount)
|
||||
{
|
||||
fBytesRead += deltaByteCount;
|
||||
fPosition += deltaByteCount;
|
||||
@ -1190,13 +1190,13 @@ void hsReadOnlyStream::CopyToMem(void* mem)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
UInt32 hsWriteOnlyStream::Read(UInt32 byteCount, void* buffer)
|
||||
uint32_t hsWriteOnlyStream::Read(uint32_t byteCount, void* buffer)
|
||||
{
|
||||
hsThrow( "can't read to a writeonly stream");
|
||||
return 0;
|
||||
}
|
||||
|
||||
UInt32 hsWriteOnlyStream::Write(UInt32 byteCount, const void* buffer)
|
||||
uint32_t hsWriteOnlyStream::Write(uint32_t byteCount, const void* buffer)
|
||||
{
|
||||
if (fData + byteCount > fStop)
|
||||
hsThrow("Write past end of stream");
|
||||
@ -1210,7 +1210,7 @@ UInt32 hsWriteOnlyStream::Write(UInt32 byteCount, const void* buffer)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
hsQueueStream::hsQueueStream(Int32 size) :
|
||||
hsQueueStream::hsQueueStream(int32_t size) :
|
||||
fSize(size),
|
||||
fReadCursor(0),
|
||||
fWriteCursor(0)
|
||||
@ -1223,12 +1223,12 @@ hsQueueStream::~hsQueueStream()
|
||||
delete [] fQueue;
|
||||
}
|
||||
|
||||
UInt32 hsQueueStream::Read(UInt32 byteCount, void * buffer)
|
||||
uint32_t hsQueueStream::Read(uint32_t byteCount, void * buffer)
|
||||
{
|
||||
hsAssert(fWriteCursor >= 0 && fWriteCursor < fSize,"hsQueueStream: WriteCursor out of range.");
|
||||
hsAssert(fReadCursor >= 0 && fReadCursor < fSize,"hsQueueStream: ReadCursor out of range.");
|
||||
|
||||
Int32 limit, length, total;
|
||||
int32_t limit, length, total;
|
||||
|
||||
limit = fWriteCursor >= fReadCursor ? fWriteCursor : fSize;
|
||||
length = hsMinimum(limit-fReadCursor,byteCount);
|
||||
@ -1249,12 +1249,12 @@ UInt32 hsQueueStream::Read(UInt32 byteCount, void * buffer)
|
||||
return total;
|
||||
}
|
||||
|
||||
UInt32 hsQueueStream::Write(UInt32 byteCount, const void* buffer)
|
||||
uint32_t hsQueueStream::Write(uint32_t byteCount, const void* buffer)
|
||||
{
|
||||
hsAssert(fWriteCursor >= 0 && fWriteCursor < fSize,"hsQueueStream: WriteCursor out of range.");
|
||||
hsAssert(fReadCursor >= 0 && fReadCursor < fSize,"hsQueueStream: ReadCursor out of range.");
|
||||
|
||||
Int32 length;
|
||||
int32_t length;
|
||||
|
||||
length = hsMinimum(fSize-fWriteCursor,byteCount);
|
||||
HSMemory::BlockMove(buffer,fQueue+fWriteCursor,length);
|
||||
@ -1278,9 +1278,9 @@ UInt32 hsQueueStream::Write(UInt32 byteCount, const void* buffer)
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
void hsQueueStream::Skip(UInt32 deltaByteCount)
|
||||
void hsQueueStream::Skip(uint32_t deltaByteCount)
|
||||
{
|
||||
Int32 limit, length;
|
||||
int32_t limit, length;
|
||||
|
||||
limit = fWriteCursor >= fReadCursor ? fWriteCursor : fSize;
|
||||
length = hsMinimum(limit-fReadCursor,deltaByteCount);
|
||||
@ -1318,20 +1318,20 @@ hsBool hsQueueStream::AtEnd()
|
||||
// hsBufferedStream
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline void FastByteCopy(void* dest, const void* src, UInt32 bytes)
|
||||
inline void FastByteCopy(void* dest, const void* src, uint32_t bytes)
|
||||
{
|
||||
// Don't use memcpy if the read is 4 bytes or less, it's faster to just do a
|
||||
// direct copy
|
||||
switch (bytes)
|
||||
{
|
||||
case 4:
|
||||
*((UInt32*)dest) = *((const UInt32*)src);
|
||||
*((uint32_t*)dest) = *((const uint32_t*)src);
|
||||
break;
|
||||
case 2:
|
||||
*((UInt16*)dest) = *((const UInt16*)src);
|
||||
*((uint16_t*)dest) = *((const uint16_t*)src);
|
||||
break;
|
||||
case 1:
|
||||
*((UInt8*)dest) = *((const UInt8*)src);
|
||||
*((uint8_t*)dest) = *((const uint8_t*)src);
|
||||
break;
|
||||
default:
|
||||
memcpy(dest, src, bytes);
|
||||
@ -1385,9 +1385,9 @@ hsBool hsBufferedStream::Open(const char* name, const char* mode)
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool hsBufferedStream::Open(const wchar *name, const wchar *mode)
|
||||
hsBool hsBufferedStream::Open(const wchar_t *name, const wchar_t *mode)
|
||||
{
|
||||
hsAssert(0, "hsFileStream::Open NotImplemented for wchar");
|
||||
hsAssert(0, "hsFileStream::Open NotImplemented for wchar_t");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1444,13 +1444,13 @@ void hsBufferedStream::SetFileRef(FILE* ref)
|
||||
fWriteBufferUsed = false;
|
||||
}
|
||||
|
||||
UInt32 hsBufferedStream::Read(UInt32 bytes, void* buffer)
|
||||
uint32_t hsBufferedStream::Read(uint32_t bytes, void* buffer)
|
||||
{
|
||||
hsAssert(fRef, "fRef uninitialized");
|
||||
if (!fRef || bytes == 0)
|
||||
return 0;
|
||||
|
||||
UInt32 numReadBytes = 0;
|
||||
uint32_t numReadBytes = 0;
|
||||
|
||||
while (bytes > 0 && fPosition < fFileSize)
|
||||
{
|
||||
@ -1458,9 +1458,9 @@ UInt32 hsBufferedStream::Read(UInt32 bytes, void* buffer)
|
||||
if (fBufferLen > 0)
|
||||
{
|
||||
// Figure out how much we can copy out of the buffer
|
||||
UInt32 bufferPos = fPosition % kBufferSize;
|
||||
UInt32 bytesInBuffer = fBufferLen - bufferPos;
|
||||
UInt32 cachedReadSize = bytesInBuffer < bytes ? bytesInBuffer : bytes;
|
||||
uint32_t bufferPos = fPosition % kBufferSize;
|
||||
uint32_t bytesInBuffer = fBufferLen - bufferPos;
|
||||
uint32_t cachedReadSize = bytesInBuffer < bytes ? bytesInBuffer : bytes;
|
||||
|
||||
FastByteCopy(buffer, &fBuffer[bufferPos], cachedReadSize);
|
||||
|
||||
@ -1484,7 +1484,7 @@ UInt32 hsBufferedStream::Read(UInt32 bytes, void* buffer)
|
||||
// If it is, read as many complete blocks as possible directly into the output buffer.
|
||||
if (bytes >= kBufferSize && fPosition % kBufferSize == 0)
|
||||
{
|
||||
UInt32 directReadSize = bytes - (bytes % kBufferSize);
|
||||
uint32_t directReadSize = bytes - (bytes % kBufferSize);
|
||||
hsAssert(ftell(fRef) % kBufferSize == 0 , "read buffer is not in alignment.");
|
||||
int amtRead = ::fread(buffer, 1, directReadSize, fRef);
|
||||
fPosition += amtRead;
|
||||
@ -1519,7 +1519,7 @@ UInt32 hsBufferedStream::Read(UInt32 bytes, void* buffer)
|
||||
return numReadBytes;
|
||||
}
|
||||
|
||||
UInt32 hsBufferedStream::Write(UInt32 bytes, const void* buffer)
|
||||
uint32_t hsBufferedStream::Write(uint32_t bytes, const void* buffer)
|
||||
{
|
||||
hsAssert(fRef, "fRef uninitialized");
|
||||
fWriteBufferUsed = true;
|
||||
@ -1547,7 +1547,7 @@ hsBool hsBufferedStream::AtEnd()
|
||||
}
|
||||
}
|
||||
|
||||
void hsBufferedStream::Skip(UInt32 delta)
|
||||
void hsBufferedStream::Skip(uint32_t delta)
|
||||
{
|
||||
if (fWriteBufferUsed)
|
||||
{
|
||||
@ -1556,15 +1556,15 @@ void hsBufferedStream::Skip(UInt32 delta)
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 blockStart = ((fPosition + delta) / kBufferSize) * kBufferSize;
|
||||
uint32_t blockStart = ((fPosition + delta) / kBufferSize) * kBufferSize;
|
||||
|
||||
// We've got data in the buffer, see if we can just skip in that
|
||||
if (fBufferLen > 0)
|
||||
{
|
||||
Int32 newBufferPos = Int32(fPosition % kBufferSize) + Int32(delta);
|
||||
int32_t newBufferPos = int32_t(fPosition % kBufferSize) + int32_t(delta);
|
||||
|
||||
// If we skipped outside of our buffer, invalidate it
|
||||
if (newBufferPos < 0 || UInt32(newBufferPos) >= fBufferLen)
|
||||
if (newBufferPos < 0 || uint32_t(newBufferPos) >= fBufferLen)
|
||||
{
|
||||
fBufferLen = 0;
|
||||
fseek(fRef, blockStart, SEEK_SET);
|
||||
@ -1591,7 +1591,7 @@ void hsBufferedStream::Rewind()
|
||||
fPosition = 0;
|
||||
}
|
||||
|
||||
UInt32 hsBufferedStream::GetEOF()
|
||||
uint32_t hsBufferedStream::GetEOF()
|
||||
{
|
||||
if (fWriteBufferUsed)
|
||||
{
|
||||
@ -1600,7 +1600,7 @@ UInt32 hsBufferedStream::GetEOF()
|
||||
|
||||
long oldPos = ftell(fRef);
|
||||
fseek(fRef, 0, SEEK_END);
|
||||
UInt32 end = (UInt32)ftell(fRef);
|
||||
uint32_t end = (uint32_t)ftell(fRef);
|
||||
fseek(fRef, oldPos, SEEK_SET);
|
||||
|
||||
return end;
|
||||
|
@ -80,8 +80,8 @@ enum VDB_Type {// Virtual Database type
|
||||
kVDB_Mesh
|
||||
};
|
||||
protected:
|
||||
UInt32 fBytesRead;
|
||||
UInt32 fPosition;
|
||||
uint32_t fBytesRead;
|
||||
uint32_t fPosition;
|
||||
|
||||
hsBool IsTokenSeparator(char c);
|
||||
public:
|
||||
@ -89,25 +89,25 @@ public:
|
||||
virtual ~hsStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char * = "rb")=0;
|
||||
virtual hsBool Open(const wchar *, const wchar * = L"rb")=0;
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t * = L"rb")=0;
|
||||
virtual hsBool Close()=0;
|
||||
virtual hsBool AtEnd();
|
||||
virtual UInt32 Read(UInt32 byteCount, void * buffer) = 0;
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer) = 0;
|
||||
virtual void Skip(UInt32 deltaByteCount) = 0;
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer) = 0;
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer) = 0;
|
||||
virtual void Skip(uint32_t deltaByteCount) = 0;
|
||||
virtual void Rewind() = 0;
|
||||
virtual void FastFwd();
|
||||
virtual UInt32 GetPosition() const;
|
||||
virtual void SetPosition(UInt32 position);
|
||||
virtual uint32_t GetPosition() const;
|
||||
virtual void SetPosition(uint32_t position);
|
||||
virtual void Truncate();
|
||||
virtual void Flush() {}
|
||||
|
||||
#ifdef STREAM_LOGGER
|
||||
// Logging Reads & Skips
|
||||
virtual UInt32 LogRead(UInt32 byteCount, void * buffer, const char* desc) { return Read(byteCount,buffer); }
|
||||
virtual uint32_t LogRead(uint32_t byteCount, void * buffer, const char* desc) { return Read(byteCount,buffer); }
|
||||
virtual char* LogReadSafeString() { return ReadSafeString(); }
|
||||
virtual char* LogReadSafeStringLong() { return ReadSafeStringLong(); }
|
||||
virtual void LogSkip(UInt32 deltaByteCount, const char* desc) { Skip(deltaByteCount); }
|
||||
virtual void LogSkip(uint32_t deltaByteCount, const char* desc) { Skip(deltaByteCount); }
|
||||
|
||||
// Stream Notes for Logging
|
||||
virtual void LogStringString(const char* s) { }
|
||||
@ -118,110 +118,110 @@ public:
|
||||
void LogVoidFunc() { }
|
||||
|
||||
// Optimization for small Reads
|
||||
virtual UInt8 ReadByte();
|
||||
virtual uint8_t ReadByte();
|
||||
virtual hsBool Read4Bytes(void *buffer); // Reads 4 bytes, return true if success
|
||||
virtual hsBool Read8Bytes(void *buffer); // Reads 8 bytes, return true if success
|
||||
virtual hsBool Read12Bytes(void *buffer); // Reads 12 bytes, return true if success
|
||||
|
||||
virtual UInt32 GetEOF();
|
||||
UInt32 GetSizeLeft();
|
||||
virtual void CopyToMem(void* mem);
|
||||
virtual hsBool IsCompressed() { return false; }
|
||||
virtual uint32_t GetEOF();
|
||||
uint32_t GetSizeLeft();
|
||||
virtual void CopyToMem(void* mem);
|
||||
virtual hsBool IsCompressed() { return false; }
|
||||
|
||||
UInt32 WriteString(const char cstring[]);
|
||||
UInt32 WriteFmt(const char * fmt, ...);
|
||||
UInt32 WriteFmtV(const char * fmt, va_list av);
|
||||
uint32_t WriteString(const char cstring[]);
|
||||
uint32_t WriteFmt(const char * fmt, ...);
|
||||
uint32_t WriteFmtV(const char * fmt, va_list av);
|
||||
|
||||
UInt32 WriteSafeStringLong(const char *string); // uses 4 bytes for length
|
||||
UInt32 WriteSafeWStringLong(const wchar_t *string);
|
||||
uint32_t WriteSafeStringLong(const char *string); // uses 4 bytes for length
|
||||
uint32_t WriteSafeWStringLong(const wchar_t *string);
|
||||
char * ReadSafeStringLong();
|
||||
wchar_t * ReadSafeWStringLong();
|
||||
|
||||
UInt32 WriteSafeString(const char *string); // uses 2 bytes for length
|
||||
UInt32 WriteSafeWString(const wchar_t *string);
|
||||
uint32_t WriteSafeString(const char *string); // uses 2 bytes for length
|
||||
uint32_t WriteSafeWString(const wchar_t *string);
|
||||
char * ReadSafeString();
|
||||
wchar_t * ReadSafeWString();
|
||||
|
||||
hsBool GetToken(char *s, UInt32 maxLen=UInt32(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
hsBool ReadLn(char* s, UInt32 maxLen=UInt32(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
hsBool GetToken(char *s, uint32_t maxLen=uint32_t(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
hsBool ReadLn(char* s, uint32_t maxLen=uint32_t(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
|
||||
bool Readbool();
|
||||
hsBool ReadBool();
|
||||
void ReadBool(int count, hsBool values[]);
|
||||
UInt16 ReadLE16();
|
||||
void ReadLE16(int count, UInt16 values[]);
|
||||
UInt32 ReadLE32();
|
||||
void ReadLE32(int count, UInt32 values[]);
|
||||
UInt32 ReadBE32();
|
||||
uint16_t ReadLE16();
|
||||
void ReadLE16(int count, uint16_t values[]);
|
||||
uint32_t ReadLE32();
|
||||
void ReadLE32(int count, uint32_t values[]);
|
||||
uint32_t ReadBE32();
|
||||
|
||||
void Writebool(bool value);
|
||||
void WriteBool(hsBool value);
|
||||
void WriteBool(int count, const hsBool values[]);
|
||||
void WriteByte(UInt8 value);
|
||||
void WriteLE16(UInt16 value);
|
||||
void WriteLE16(int count, const UInt16 values[]);
|
||||
void WriteLE32(UInt32 value);
|
||||
void WriteLE32(int count, const UInt32 values[]);
|
||||
void WriteBE32(UInt32 value);
|
||||
void WriteByte(uint8_t value);
|
||||
void WriteLE16(uint16_t value);
|
||||
void WriteLE16(int count, const uint16_t values[]);
|
||||
void WriteLE32(uint32_t value);
|
||||
void WriteLE32(int count, const uint32_t values[]);
|
||||
void WriteBE32(uint32_t value);
|
||||
|
||||
|
||||
/* Overloaded Begin (8 & 16 & 32 int)*/
|
||||
/* yes, swapping an 8 bit value does nothing, just useful*/
|
||||
void ReadLE(bool* value) { *value = this->ReadByte() ? true : false; }
|
||||
void ReadLE(UInt8* value) { *value = this->ReadByte(); }
|
||||
void ReadLE(int count, UInt8 values[]) { this->Read(count, values); }
|
||||
void ReadLE(UInt16* value) { *value = this->ReadLE16(); }
|
||||
void ReadLE(int count, UInt16 values[]) { this->ReadLE16(count, values); }
|
||||
void ReadLE(UInt32* value) { *value = this->ReadLE32(); }
|
||||
void ReadLE(int count, UInt32 values[]) { this->ReadLE32(count, values); }
|
||||
void ReadLE(uint8_t* value) { *value = this->ReadByte(); }
|
||||
void ReadLE(int count, uint8_t values[]) { this->Read(count, values); }
|
||||
void ReadLE(uint16_t* value) { *value = this->ReadLE16(); }
|
||||
void ReadLE(int count, uint16_t values[]) { this->ReadLE16(count, values); }
|
||||
void ReadLE(uint32_t* value) { *value = this->ReadLE32(); }
|
||||
void ReadLE(int count, uint32_t values[]) { this->ReadLE32(count, values); }
|
||||
#ifdef STREAM_LOGGER
|
||||
// Begin LogReadLEs
|
||||
virtual void LogReadLE(bool* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLE(UInt8* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, UInt8 values[], const char* desc) { this->ReadLE(count, values); }
|
||||
virtual void LogReadLE(UInt16* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, UInt16 values[], const char* desc) { this->ReadLE(count, values); }
|
||||
virtual void LogReadLE(UInt32* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, UInt32 values[], const char* desc) { this->ReadLE(count, values); }
|
||||
virtual void LogReadLE(uint8_t* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, uint8_t values[], const char* desc) { this->ReadLE(count, values); }
|
||||
virtual void LogReadLE(uint16_t* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, uint16_t values[], const char* desc) { this->ReadLE(count, values); }
|
||||
virtual void LogReadLE(uint32_t* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, uint32_t values[], const char* desc) { this->ReadLE(count, values); }
|
||||
// End LogReadLEs
|
||||
#endif
|
||||
void WriteLE(bool value) { this->Write(1,&value); }
|
||||
void WriteLE(UInt8 value) { this->Write(1,&value); }
|
||||
void WriteLE(int count, const UInt8 values[]) { this->Write(count, values); }
|
||||
void WriteLE(UInt16 value) { this->WriteLE16(value); }
|
||||
void WriteLE(int count, const UInt16 values[]) { this->WriteLE16(count, values); }
|
||||
void WriteLE(UInt32 value) { this->WriteLE32(value); }
|
||||
void WriteLE(int count, const UInt32 values[]) { this->WriteLE32(count, values); }
|
||||
void ReadLE(Int8* value) { *value = this->ReadByte(); }
|
||||
void ReadLE(int count, Int8 values[]) { this->Read(count, values); }
|
||||
void WriteLE(uint8_t value) { this->Write(1,&value); }
|
||||
void WriteLE(int count, const uint8_t values[]) { this->Write(count, values); }
|
||||
void WriteLE(uint16_t value) { this->WriteLE16(value); }
|
||||
void WriteLE(int count, const uint16_t values[]) { this->WriteLE16(count, values); }
|
||||
void WriteLE(uint32_t value) { this->WriteLE32(value); }
|
||||
void WriteLE(int count, const uint32_t values[]) { this->WriteLE32(count, values); }
|
||||
void ReadLE(int8_t* value) { *value = this->ReadByte(); }
|
||||
void ReadLE(int count, int8_t values[]) { this->Read(count, values); }
|
||||
void ReadLE(char* value) { *value = (char)this->ReadByte(); }
|
||||
void ReadLE(int count, char values[]) { this->Read(count, values); }
|
||||
void ReadLE(Int16* value) { *value = (Int16)this->ReadLE16(); }
|
||||
void ReadLE(int count, Int16 values[]) { this->ReadLE16(count, (UInt16*)values); }
|
||||
void ReadLE(Int32* value) { *value = (Int32)this->ReadLE32(); }
|
||||
void ReadLE(int count, Int32 values[]) { this->ReadLE32(count, (UInt32*)values); }
|
||||
void ReadLE(int16_t* value) { *value = (int16_t)this->ReadLE16(); }
|
||||
void ReadLE(int count, int16_t values[]) { this->ReadLE16(count, (uint16_t*)values); }
|
||||
void ReadLE(int32_t* value) { *value = (int32_t)this->ReadLE32(); }
|
||||
void ReadLE(int count, int32_t values[]) { this->ReadLE32(count, (uint32_t*)values); }
|
||||
#ifdef STREAM_LOGGER
|
||||
// Begin LogReadLEs
|
||||
virtual void LogReadLE(Int8* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, Int8 values[], const char* desc) { this->ReadLE(count, values); }
|
||||
virtual void LogReadLE(int8_t* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, int8_t values[], const char* desc) { this->ReadLE(count, values); }
|
||||
virtual void LogReadLE(char* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, char values[], const char* desc) { this->ReadLE(count, values); }
|
||||
virtual void LogReadLE(Int16* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, Int16 values[], const char* desc) { this->ReadLE(count, (UInt16*)values); }
|
||||
virtual void LogReadLE(Int32* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, Int32 values[], const char* desc) { this->ReadLE(count, (UInt32*)values); }
|
||||
virtual void LogReadLE(int16_t* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, int16_t values[], const char* desc) { this->ReadLE(count, (uint16_t*)values); }
|
||||
virtual void LogReadLE(int32_t* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, int32_t values[], const char* desc) { this->ReadLE(count, (uint32_t*)values); }
|
||||
virtual void LogReadLE(int* value, const char* desc) { this->ReadLE(value); }
|
||||
virtual void LogReadLEArray(int count, int values[], const char* desc) { this->ReadLE(count, (UInt32*)values); }
|
||||
virtual void LogReadLEArray(int count, int values[], const char* desc) { this->ReadLE(count, (uint32_t*)values); }
|
||||
// End LogReadLEs
|
||||
#endif
|
||||
void WriteLE(Int8 value) { this->Write(1,&value); }
|
||||
void WriteLE(int count, const Int8 values[]) { this->Write(count, values); }
|
||||
void WriteLE(char value) { this->Write(1,(UInt8*)&value); }
|
||||
void WriteLE(int count, const char values[]) { this->Write(count, (UInt8*)values); }
|
||||
void WriteLE(Int16 value) { this->WriteLE16((UInt16)value); }
|
||||
void WriteLE(int count, const Int16 values[]) { this->WriteLE16(count, (UInt16*)values); }
|
||||
void WriteLE(Int32 value) { this->WriteLE32((UInt32)value); }
|
||||
void WriteLE(int count, const Int32 values[]) { this->WriteLE32(count, (UInt32*)values); }
|
||||
void WriteLE(int8_t value) { this->Write(1,&value); }
|
||||
void WriteLE(int count, const int8_t values[]) { this->Write(count, values); }
|
||||
void WriteLE(char value) { this->Write(1,(uint8_t*)&value); }
|
||||
void WriteLE(int count, const char values[]) { this->Write(count, (uint8_t*)values); }
|
||||
void WriteLE(int16_t value) { this->WriteLE16((uint16_t)value); }
|
||||
void WriteLE(int count, const int16_t values[]) { this->WriteLE16(count, (uint16_t*)values); }
|
||||
void WriteLE(int32_t value) { this->WriteLE32((uint32_t)value); }
|
||||
void WriteLE(int count, const int32_t values[]) { this->WriteLE32(count, (uint32_t*)values); }
|
||||
/* Overloaded End */
|
||||
|
||||
|
||||
@ -262,7 +262,7 @@ public:
|
||||
hsFixed ReadLEScalar() { return (hsFixed)this->ReadLE32(); }
|
||||
void ReadLEScalar(int count, hsFixed values[])
|
||||
{
|
||||
this->ReadLE32(count, (UInt32*)values);
|
||||
this->ReadLE32(count, (uint32_t*)values);
|
||||
}
|
||||
hsFixed ReadBEScalar() { return (hsFixed)this->ReadBE32(); }
|
||||
|
||||
@ -270,16 +270,16 @@ public:
|
||||
void WriteLEScalar(hsFixed value) { this->WriteLE32(value); }
|
||||
void WriteLEScalar(int count, const hsFixed values[])
|
||||
{
|
||||
this->WriteLE32(count, (UInt32*)values);
|
||||
this->WriteLE32(count, (uint32_t*)values);
|
||||
}
|
||||
void WriteBEScalar(hsFixed value) { this->WriteBE32(value); }
|
||||
|
||||
|
||||
/* Overloaded Begin (Scalar) */
|
||||
void ReadLE(hsFixed* value) { this->ReadLE((UInt32*)value); }
|
||||
void ReadLE(int count, hsFixed values[]) { this->ReadLE(count, (UInt32*)values); }
|
||||
void WriteLE(hsFixed value) { this->WriteLE((UInt32)value); }
|
||||
void WriteLE(int count, const hsFixed values[]) { this->WriteLE(count, (UInt32*)values); }
|
||||
void ReadLE(hsFixed* value) { this->ReadLE((uint32_t*)value); }
|
||||
void ReadLE(int count, hsFixed values[]) { this->ReadLE(count, (uint32_t*)values); }
|
||||
void WriteLE(hsFixed value) { this->WriteLE((uint32_t)value); }
|
||||
void WriteLE(int count, const hsFixed values[]) { this->WriteLE(count, (uint32_t*)values); }
|
||||
/* Overloaded End */
|
||||
|
||||
#else
|
||||
@ -297,15 +297,15 @@ public:
|
||||
void WriteBEScalar(float value) { this->WriteBEFloat(value); }
|
||||
#endif
|
||||
|
||||
void WriteLEAtom(UInt32 tag, UInt32 size);
|
||||
UInt32 ReadLEAtom(UInt32* size);
|
||||
void WriteLEAtom(uint32_t tag, uint32_t size);
|
||||
uint32_t ReadLEAtom(uint32_t* size);
|
||||
|
||||
|
||||
/* Overloaded Begin (Atom)*/
|
||||
void WriteLE(UInt32* tag, UInt32 size) { WriteLEAtom(*tag, size); }
|
||||
void ReadLE(UInt32* tag, UInt32 *size) { *tag = ReadLEAtom(size); }
|
||||
void WriteLE(uint32_t* tag, uint32_t size) { WriteLEAtom(*tag, size); }
|
||||
void ReadLE(uint32_t* tag, uint32_t *size) { *tag = ReadLEAtom(size); }
|
||||
/* Overloaded End */
|
||||
virtual void VirtualSetPosition(UInt32 pos, VDB_Type ){ SetPosition(pos); };
|
||||
virtual void VirtualSetPosition(uint32_t pos, VDB_Type ){ SetPosition(pos); };
|
||||
virtual hsPackFileSys::FileEntry *GetFileEntry() { return nil; } // Streams from Packfiles can return a FileEntry
|
||||
|
||||
};
|
||||
@ -314,29 +314,29 @@ class hsStreamable {
|
||||
public:
|
||||
virtual void Read(hsStream* stream) = 0;
|
||||
virtual void Write(hsStream* stream) = 0;
|
||||
virtual UInt32 GetStreamSize() = 0;
|
||||
virtual uint32_t GetStreamSize() = 0;
|
||||
};
|
||||
|
||||
class hsFileStream: public hsStream
|
||||
{
|
||||
UInt32 fRef;
|
||||
uint32_t fRef;
|
||||
|
||||
public:
|
||||
hsFileStream();
|
||||
virtual ~hsFileStream();
|
||||
virtual hsBool Open(const char *name, const char *mode = "rb");
|
||||
virtual hsBool Open(const wchar *name, const wchar *mode = L"rb");
|
||||
virtual hsBool Open(const wchar_t *name, const wchar_t *mode = L"rb");
|
||||
virtual hsBool Close();
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual UInt32 Read(UInt32 byteCount, void* buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
|
||||
virtual UInt32 GetFileRef();
|
||||
virtual void SetFileRef(UInt32 refNum);
|
||||
virtual uint32_t GetFileRef();
|
||||
virtual void SetFileRef(uint32_t refNum);
|
||||
};
|
||||
|
||||
class hsUNIXStream: public hsStream
|
||||
@ -348,14 +348,14 @@ public:
|
||||
hsUNIXStream(): fRef(0), fBuff(nil) {}
|
||||
~hsUNIXStream();
|
||||
virtual hsBool Open(const char* name, const char* mode = "rb");
|
||||
virtual hsBool Open(const wchar *name, const wchar *mode = L"rb");
|
||||
virtual hsBool Open(const wchar_t *name, const wchar_t *mode = L"rb");
|
||||
virtual hsBool Close();
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual UInt32 Read(UInt32 byteCount, void* buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual void SetPosition(UInt32 position);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void SetPosition(uint32_t position);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
@ -364,7 +364,7 @@ public:
|
||||
FILE* GetFILE() { return fRef; }
|
||||
void SetFILE(FILE* file) { fRef = file; }
|
||||
|
||||
virtual UInt32 GetEOF();
|
||||
virtual uint32_t GetEOF();
|
||||
};
|
||||
|
||||
// Small substream class: give it a base stream, an offset and a length, and it'll
|
||||
@ -374,7 +374,7 @@ public:
|
||||
class plReadOnlySubStream: public hsStream
|
||||
{
|
||||
hsStream *fBase;
|
||||
UInt32 fOffset, fLength;
|
||||
uint32_t fOffset, fLength;
|
||||
|
||||
void IFixPosition( void );
|
||||
|
||||
@ -383,18 +383,18 @@ public:
|
||||
~plReadOnlySubStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "plReadOnlySubStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar *, const wchar *) { hsAssert(0, "plReadOnlySubStream::Open NotImplemented"); return false; }
|
||||
void Open( hsStream *base, UInt32 offset, UInt32 length );
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "plReadOnlySubStream::Open NotImplemented"); return false; }
|
||||
void Open( hsStream *base, uint32_t offset, uint32_t length );
|
||||
virtual hsBool Close() { fBase = nil; fOffset = 0; fLength = 0; return true; }
|
||||
virtual hsBool AtEnd();
|
||||
virtual UInt32 Read(UInt32 byteCount, void* buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual void Truncate();
|
||||
|
||||
virtual UInt32 GetEOF();
|
||||
virtual uint32_t GetEOF();
|
||||
};
|
||||
|
||||
class hsRAMStream : public hsStream {
|
||||
@ -402,22 +402,22 @@ class hsRAMStream : public hsStream {
|
||||
hsAppenderIterator fIter;
|
||||
public:
|
||||
hsRAMStream();
|
||||
hsRAMStream(UInt32 chunkSize);
|
||||
hsRAMStream(uint32_t chunkSize);
|
||||
virtual ~hsRAMStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsRAMStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar *, const wchar *) { hsAssert(0, "hsRAMStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsRAMStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsRAMStream::Close NotImplemented"); return false; }
|
||||
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual UInt32 Read(UInt32 byteCount, void * buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
|
||||
virtual UInt32 GetEOF();
|
||||
virtual uint32_t GetEOF();
|
||||
virtual void CopyToMem(void* mem);
|
||||
|
||||
void Reset(); // clears the buffers
|
||||
@ -427,16 +427,16 @@ class hsNullStream : public hsStream {
|
||||
public:
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { return true; }
|
||||
virtual hsBool Open(const wchar *, const wchar *) { return true; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { return true; }
|
||||
virtual hsBool Close() { return true; }
|
||||
|
||||
virtual UInt32 Read(UInt32 byteCount, void * buffer); // throw's exception
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer); // throw's exception
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
|
||||
UInt32 GetBytesWritten() const { return fBytesRead; }
|
||||
uint32_t GetBytesWritten() const { return fBytesRead; }
|
||||
void Reset( ) { fBytesRead = 0; }
|
||||
};
|
||||
|
||||
@ -452,16 +452,16 @@ public:
|
||||
|
||||
virtual void Init(int size, const void* data) { fStart=((char*)data); fData=((char*)data); fStop=((char*)data + size); }
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsReadOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar *, const wchar *) { hsAssert(0, "hsReadOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsReadOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsReadOnlyStream::Close NotImplemented"); return false; }
|
||||
virtual hsBool AtEnd();
|
||||
virtual UInt32 Read(UInt32 byteCount, void * buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer); // throws exception
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer); // throws exception
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
virtual UInt32 GetBytesRead() const { return fBytesRead; }
|
||||
virtual UInt32 GetEOF() { return (UInt32)(fStop-fStart); }
|
||||
virtual uint32_t GetBytesRead() const { return fBytesRead; }
|
||||
virtual uint32_t GetEOF() { return (uint32_t)(fStop-fStart); }
|
||||
virtual void CopyToMem(void* mem);
|
||||
};
|
||||
|
||||
@ -472,61 +472,61 @@ public:
|
||||
hsWriteOnlyStream() {}
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsWriteOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar *, const wchar *) { hsAssert(0, "hsWriteOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsWriteOnlyStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsWriteOnlyStream::Close NotImplemented"); return false; }
|
||||
virtual UInt32 Read(UInt32 byteCount, void * buffer); // throws exception
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual UInt32 GetBytesRead() const { return 0; }
|
||||
virtual UInt32 GetBytesWritten() const { return fBytesRead; }
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer); // throws exception
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual uint32_t GetBytesRead() const { return 0; }
|
||||
virtual uint32_t GetBytesWritten() const { return fBytesRead; }
|
||||
};
|
||||
|
||||
// circular queue stream
|
||||
class hsQueueStream : public hsStream {
|
||||
private:
|
||||
char* fQueue;
|
||||
UInt32 fReadCursor;
|
||||
UInt32 fWriteCursor;
|
||||
UInt32 fSize;
|
||||
uint32_t fReadCursor;
|
||||
uint32_t fWriteCursor;
|
||||
uint32_t fSize;
|
||||
|
||||
public:
|
||||
hsQueueStream(Int32 size);
|
||||
hsQueueStream(int32_t size);
|
||||
~hsQueueStream();
|
||||
|
||||
virtual hsBool Open(const char *, const char *) { hsAssert(0, "hsQueueStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar *, const wchar *) { hsAssert(0, "hsQueueStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Open(const wchar_t *, const wchar_t *) { hsAssert(0, "hsQueueStream::Open NotImplemented"); return false; }
|
||||
virtual hsBool Close() { hsAssert(0, "hsQueueStream::Close NotImplemented"); return false; }
|
||||
|
||||
virtual UInt32 Read(UInt32 byteCount, void * buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void * buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void FastFwd();
|
||||
virtual hsBool AtEnd();
|
||||
|
||||
UInt32 GetSize() { return fSize; }
|
||||
uint32_t GetSize() { return fSize; }
|
||||
const char* GetQueue() { return fQueue; }
|
||||
UInt32 GetReadCursor() { return fReadCursor; }
|
||||
UInt32 GetWriteCursor() { return fWriteCursor; }
|
||||
uint32_t GetReadCursor() { return fReadCursor; }
|
||||
uint32_t GetWriteCursor() { return fWriteCursor; }
|
||||
};
|
||||
|
||||
class hsBufferedStream : public hsStream
|
||||
{
|
||||
FILE* fRef;
|
||||
UInt32 fFileSize;
|
||||
uint32_t fFileSize;
|
||||
|
||||
enum { kBufferSize = 2*1024 };
|
||||
char fBuffer[kBufferSize];
|
||||
// If the buffer is empty, this is zero. Otherwise it is the size of the
|
||||
// buffer (if we read a full block), or something less than that if we read
|
||||
// a partial block at the end of the file.
|
||||
UInt32 fBufferLen;
|
||||
uint32_t fBufferLen;
|
||||
|
||||
hsBool fWriteBufferUsed;
|
||||
|
||||
#ifdef HS_DEBUGGING
|
||||
// For doing statistics on how efficient we are
|
||||
int fBufferHits, fBufferMisses;
|
||||
UInt32 fBufferReadIn, fBufferReadOut, fReadDirect, fLastReadPos;
|
||||
uint32_t fBufferReadIn, fBufferReadOut, fReadDirect, fLastReadPos;
|
||||
char* fFilename;
|
||||
const char* fCloseReason;
|
||||
#endif
|
||||
@ -536,16 +536,16 @@ public:
|
||||
virtual ~hsBufferedStream();
|
||||
|
||||
virtual hsBool Open(const char* name, const char* mode = "rb");
|
||||
virtual hsBool Open(const wchar* name, const wchar* mode = L"rb");
|
||||
virtual hsBool Open(const wchar_t* name, const wchar_t* mode = L"rb");
|
||||
virtual hsBool Close();
|
||||
|
||||
virtual hsBool AtEnd();
|
||||
virtual UInt32 Read(UInt32 byteCount, void* buffer);
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual void Skip(UInt32 deltaByteCount);
|
||||
virtual uint32_t Read(uint32_t byteCount, void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
virtual void Skip(uint32_t deltaByteCount);
|
||||
virtual void Rewind();
|
||||
virtual void Truncate();
|
||||
virtual UInt32 GetEOF();
|
||||
virtual uint32_t GetEOF();
|
||||
|
||||
FILE* GetFileRef();
|
||||
void SetFileRef(FILE* file);
|
||||
|
@ -72,7 +72,7 @@ inline hsBool hsStringTokenizer::IsSep(char c)
|
||||
{
|
||||
if ( fCheckAlphaNum || !isalnum(c) )
|
||||
{
|
||||
for (Int32 i=0; i<fNumSeps; i++)
|
||||
for (int32_t i=0; i<fNumSeps; i++)
|
||||
{
|
||||
if (fSeps[i] == c)
|
||||
return true;
|
||||
@ -111,7 +111,7 @@ char *hsStringTokenizer::next()
|
||||
}
|
||||
|
||||
// Slightly more loop-friendly version of next
|
||||
hsBool hsStringTokenizer::Next( char *token, UInt32 maxTokLen )
|
||||
hsBool hsStringTokenizer::Next( char *token, uint32_t maxTokLen )
|
||||
{
|
||||
char *t = next();
|
||||
if( t == nil )
|
||||
@ -142,7 +142,7 @@ void hsStringTokenizer::Reset(const char *string, const char *seps)
|
||||
fSeps = seps ? hsStrcpy(seps) : nil;
|
||||
fNumSeps = fSeps ? strlen(fSeps) : 0;
|
||||
fCheckAlphaNum = false;
|
||||
for (Int32 i=0; i<fNumSeps; i++)
|
||||
for (int32_t i=0; i<fNumSeps; i++)
|
||||
{
|
||||
if (isalnum(fSeps[i]))
|
||||
{
|
||||
@ -169,7 +169,7 @@ void hsStringTokenizer::ParseQuotes(hsBool qAsTok)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// String Tokenizer routines
|
||||
hsWStringTokenizer::hsWStringTokenizer(const wchar *string, const wchar *seps) :
|
||||
hsWStringTokenizer::hsWStringTokenizer(const wchar_t *string, const wchar_t *seps) :
|
||||
fQAsTok(true),
|
||||
fInQuote(false),
|
||||
fString(nil),
|
||||
@ -190,13 +190,13 @@ hsBool hsWStringTokenizer::HasMoreTokens()
|
||||
return (*fTok != L'\0');
|
||||
}
|
||||
|
||||
inline hsBool hsWStringTokenizer::IsSep(wchar c)
|
||||
inline hsBool hsWStringTokenizer::IsSep(wchar_t c)
|
||||
{
|
||||
if (!fQAsTok || !fInQuote)
|
||||
{
|
||||
if ( fCheckAlphaNum || !iswalnum(c) )
|
||||
{
|
||||
for (Int32 i=0; i<fNumSeps; i++)
|
||||
for (int32_t i=0; i<fNumSeps; i++)
|
||||
{
|
||||
if (fSeps[i] == c)
|
||||
return true;
|
||||
@ -211,12 +211,12 @@ inline hsBool hsWStringTokenizer::IsSep(wchar c)
|
||||
return false;
|
||||
}
|
||||
|
||||
wchar *hsWStringTokenizer::next()
|
||||
wchar_t *hsWStringTokenizer::next()
|
||||
{
|
||||
if (*fTok == L'\0')
|
||||
return nil;
|
||||
|
||||
wchar *cur = fTok;
|
||||
wchar_t *cur = fTok;
|
||||
while (*fTok != L'\0' && !IsSep(*fTok))
|
||||
fTok++;
|
||||
|
||||
@ -235,9 +235,9 @@ wchar *hsWStringTokenizer::next()
|
||||
}
|
||||
|
||||
// Slightly more loop-friendly version of next
|
||||
hsBool hsWStringTokenizer::Next( wchar *token, UInt32 maxTokLen )
|
||||
hsBool hsWStringTokenizer::Next( wchar_t *token, uint32_t maxTokLen )
|
||||
{
|
||||
wchar *t = next();
|
||||
wchar_t *t = next();
|
||||
if( t == nil )
|
||||
return false;
|
||||
|
||||
@ -256,14 +256,14 @@ void hsWStringTokenizer::RestoreLastTerminator( void )
|
||||
}
|
||||
}
|
||||
|
||||
void hsWStringTokenizer::Reset(const wchar *string, const wchar *seps)
|
||||
void hsWStringTokenizer::Reset(const wchar_t *string, const wchar_t *seps)
|
||||
{
|
||||
if (fString)
|
||||
delete[] fString;
|
||||
if (string)
|
||||
{
|
||||
int count = wcslen(string);
|
||||
fString = new wchar[count + 1];
|
||||
fString = new wchar_t[count + 1];
|
||||
wcscpy(fString, string);
|
||||
fString[count] = L'\0';
|
||||
}
|
||||
@ -275,7 +275,7 @@ void hsWStringTokenizer::Reset(const wchar *string, const wchar *seps)
|
||||
if (seps)
|
||||
{
|
||||
int count = wcslen(seps);
|
||||
fSeps = new wchar[count + 1];
|
||||
fSeps = new wchar_t[count + 1];
|
||||
wcscpy(fSeps, seps);
|
||||
fSeps[count] = L'\0';
|
||||
}
|
||||
@ -284,7 +284,7 @@ void hsWStringTokenizer::Reset(const wchar *string, const wchar *seps)
|
||||
|
||||
fNumSeps = fSeps ? wcslen(fSeps) : 0;
|
||||
fCheckAlphaNum = false;
|
||||
for (Int32 i=0; i<fNumSeps; i++)
|
||||
for (int32_t i=0; i<fNumSeps; i++)
|
||||
{
|
||||
if (iswalnum(fSeps[i]))
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ private:
|
||||
char *fLastTerminator;
|
||||
char fLastRep;
|
||||
|
||||
Int32 fNumSeps;
|
||||
int32_t fNumSeps;
|
||||
hsBool fQAsTok;
|
||||
hsBool fInQuote;
|
||||
hsBool fCheckAlphaNum;
|
||||
@ -66,7 +66,7 @@ public:
|
||||
hsStringTokenizer(const char *string=nil, const char *seps=nil);
|
||||
~hsStringTokenizer();
|
||||
char *next();
|
||||
hsBool Next( char *token, UInt32 maxTokLen );
|
||||
hsBool Next( char *token, uint32_t maxTokLen );
|
||||
hsBool HasMoreTokens();
|
||||
void Reset(const char *string, const char *seps);
|
||||
void ParseQuotes(hsBool qAsTok);
|
||||
@ -84,32 +84,32 @@ private:
|
||||
class hsWStringTokenizer
|
||||
{
|
||||
private:
|
||||
wchar *fSeps;
|
||||
wchar *fTok;
|
||||
wchar *fLastTerminator;
|
||||
wchar fLastRep;
|
||||
wchar_t *fSeps;
|
||||
wchar_t *fTok;
|
||||
wchar_t *fLastTerminator;
|
||||
wchar_t fLastRep;
|
||||
|
||||
Int32 fNumSeps;
|
||||
int32_t fNumSeps;
|
||||
hsBool fQAsTok;
|
||||
hsBool fInQuote;
|
||||
hsBool fCheckAlphaNum;
|
||||
public:
|
||||
hsWStringTokenizer(const wchar *string=nil, const wchar *seps=nil);
|
||||
hsWStringTokenizer(const wchar_t *string=nil, const wchar_t *seps=nil);
|
||||
~hsWStringTokenizer();
|
||||
wchar *next();
|
||||
hsBool Next( wchar *token, UInt32 maxTokLen );
|
||||
wchar_t *next();
|
||||
hsBool Next( wchar_t *token, uint32_t maxTokLen );
|
||||
hsBool HasMoreTokens();
|
||||
void Reset(const wchar *string, const wchar *seps);
|
||||
void Reset(const wchar_t *string, const wchar_t *seps);
|
||||
void ParseQuotes(hsBool qAsTok);
|
||||
|
||||
wchar *GetRestOfString( void ) const { return fTok; }
|
||||
wchar_t *GetRestOfString( void ) const { return fTok; }
|
||||
|
||||
wchar *fString;
|
||||
wchar_t *fString;
|
||||
|
||||
void RestoreLastTerminator( void );
|
||||
|
||||
private:
|
||||
hsBool IsSep(wchar c);
|
||||
hsBool IsSep(wchar_t c);
|
||||
};
|
||||
|
||||
#endif // _hsStringTokenizer_Included_
|
||||
|
@ -50,14 +50,14 @@ template <class T> class hsTempPointer {
|
||||
private:
|
||||
T** fArray;
|
||||
|
||||
UInt32 fCurrBlock;
|
||||
UInt32 fNumBlockAlloc;
|
||||
uint32_t fCurrBlock;
|
||||
uint32_t fNumBlockAlloc;
|
||||
|
||||
UInt32 fCurrElem;
|
||||
UInt32 fNumElemAlloc;
|
||||
uint32_t fCurrElem;
|
||||
uint32_t fNumElemAlloc;
|
||||
|
||||
UInt32 fGrowBy; // def = 0, to double
|
||||
UInt32 fMinSize; // def = 1
|
||||
uint32_t fGrowBy; // def = 0, to double
|
||||
uint32_t fMinSize; // def = 1
|
||||
|
||||
hsTempPointer<T>& operator=(const hsTempPointer<T>&);
|
||||
|
||||
@ -65,7 +65,7 @@ private:
|
||||
void IGrow();
|
||||
|
||||
public:
|
||||
hsTempPointer(UInt32 minSize = 1, UInt32 growBy = 0);
|
||||
hsTempPointer(uint32_t minSize = 1, uint32_t growBy = 0);
|
||||
~hsTempPointer();
|
||||
|
||||
void Reset();
|
||||
@ -84,7 +84,7 @@ hsTempPointer<T>::~hsTempPointer()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
hsTempPointer<T>::hsTempPointer(UInt32 minSize, UInt32 growBy)
|
||||
hsTempPointer<T>::hsTempPointer(uint32_t minSize, uint32_t growBy)
|
||||
{
|
||||
fGrowBy = growBy;
|
||||
fMinSize = minSize;
|
||||
@ -105,9 +105,9 @@ void hsTempPointer<T>::IConsolidate()
|
||||
{
|
||||
hsAssert(fCurrBlock > 0, "Shouldn't consolidate when nothing to do");
|
||||
|
||||
UInt32 numUsed = fCurrBlock * fNumElemAlloc + fCurrElem;
|
||||
uint32_t numUsed = fCurrBlock * fNumElemAlloc + fCurrElem;
|
||||
|
||||
UInt32 newSize = fNumElemAlloc;
|
||||
uint32_t newSize = fNumElemAlloc;
|
||||
if( !fGrowBy )
|
||||
{
|
||||
while( newSize <= numUsed )
|
||||
@ -155,7 +155,7 @@ template <class T>
|
||||
T* hsTempPointer<T>::Array(int n)
|
||||
{
|
||||
// minSize (on constructor) should be greater than max n
|
||||
hsDebugCode(hsThrowIfBadParam((UInt32)n > (UInt32)fNumElemAlloc);)
|
||||
hsDebugCode(hsThrowIfBadParam((uint32_t)n > (uint32_t)fNumElemAlloc);)
|
||||
if( fCurrElem + n >= fNumElemAlloc )
|
||||
IGrow();
|
||||
int idx = fCurrElem;
|
||||
|
@ -83,8 +83,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
hsDlistNode *hsDlistNode::fpFirst=0;
|
||||
hsDlistNode *hsDlistNode::fpLast=0;
|
||||
UInt32 hsDlistNode::fcreated=0;
|
||||
UInt32 hsDlistNode::fdestroyed=0;
|
||||
uint32_t hsDlistNode::fcreated=0;
|
||||
uint32_t hsDlistNode::fdestroyed=0;
|
||||
static int NodeKnt = 0;
|
||||
|
||||
void RemoveNode(void *pthing)
|
||||
@ -302,7 +302,7 @@ void LargeArrayStats() {}
|
||||
|
||||
|
||||
|
||||
void hsTArrayBase::GrowArraySize(UInt16 newCount)
|
||||
void hsTArrayBase::GrowArraySize(uint16_t newCount)
|
||||
{
|
||||
#if 1
|
||||
if (newCount < 8)
|
||||
@ -321,7 +321,7 @@ void hsTArrayBase::GrowArraySize(UInt16 newCount)
|
||||
#endif
|
||||
}
|
||||
|
||||
void hsLargeArrayBase::GrowArraySize(UInt32 newCount)
|
||||
void hsLargeArrayBase::GrowArraySize(uint32_t newCount)
|
||||
{
|
||||
#if 1
|
||||
if (newCount < 8)
|
||||
|
@ -62,8 +62,8 @@ class hsDlistNode
|
||||
public:
|
||||
static hsDlistNode *fpFirst;
|
||||
static hsDlistNode *fpLast;
|
||||
static UInt32 fcreated;
|
||||
static UInt32 fdestroyed;
|
||||
static uint32_t fcreated;
|
||||
static uint32_t fdestroyed;
|
||||
|
||||
void *fpThing;
|
||||
hsDlistNode *fpPrev;
|
||||
@ -127,7 +127,7 @@ public:
|
||||
// Use this for an array of objects of class T allocated with new[]
|
||||
template <class T> class hsTempArray {
|
||||
T* fArray;
|
||||
UInt32 fCount;
|
||||
uint32_t fCount;
|
||||
hsTempArray<T>& operator=(const hsTempArray<T>&);
|
||||
public:
|
||||
hsTempArray(long count) : fArray(TRACKED_NEW T[count]), fCount(count)
|
||||
@ -151,7 +151,7 @@ public:
|
||||
|
||||
operator T*() const { return fArray; }
|
||||
T* GetArray() const { return fArray; }
|
||||
void Accomodate(UInt32 count)
|
||||
void Accomodate(uint32_t count)
|
||||
{
|
||||
if (count > fCount)
|
||||
{ delete[] fArray;
|
||||
@ -224,29 +224,29 @@ public:
|
||||
|
||||
template <class T> class hsDynamicArray {
|
||||
private:
|
||||
Int32 fCount;
|
||||
int32_t fCount;
|
||||
T* fArray;
|
||||
|
||||
hsDynamicArray<T>& operator=(const hsDynamicArray<T>&); // don't allow assignment
|
||||
public:
|
||||
enum { kMissingIndex = -1 };
|
||||
|
||||
hsDynamicArray(Int32 count = 0);
|
||||
hsDynamicArray(int32_t count = 0);
|
||||
virtual ~hsDynamicArray();
|
||||
|
||||
Int32 GetCount() const { return fCount; }
|
||||
int32_t GetCount() const { return fCount; }
|
||||
hsBool IsEmpty() const { return fCount == 0; }
|
||||
const T& Get(Int32 index) const;
|
||||
Int32 Get(Int32 index, Int32 count, T data[]) const;
|
||||
Int32 Find(const T&) const; // returns kMissingIndex if not found
|
||||
const T& Get(int32_t index) const;
|
||||
int32_t Get(int32_t index, int32_t count, T data[]) const;
|
||||
int32_t Find(const T&) const; // returns kMissingIndex if not found
|
||||
|
||||
void SetCount(Int32 count);
|
||||
T& operator[]( Int32 index );
|
||||
Int32 Append(const T&);
|
||||
Int32 InsertAtIndex(UInt32 index, const T& obj);
|
||||
Int32 Push(const T&);
|
||||
Int32 Pop(T*);
|
||||
void Remove(Int32);
|
||||
void SetCount(int32_t count);
|
||||
T& operator[]( int32_t index );
|
||||
int32_t Append(const T&);
|
||||
int32_t InsertAtIndex(uint32_t index, const T& obj);
|
||||
int32_t Push(const T&);
|
||||
int32_t Pop(T*);
|
||||
void Remove(int32_t);
|
||||
void Reset(); // clears out everything
|
||||
|
||||
T* AcquireArray() { return fArray; }
|
||||
@ -254,9 +254,9 @@ public:
|
||||
void ReleaseArray(T*) {}
|
||||
hsDynamicArray<T>* Copy(hsDynamicArray<T>* dst = nil) const;
|
||||
|
||||
T* ForEach(Boolean (*proc)(T&));
|
||||
T* ForEach(Boolean (*proc)(T&, void* p1), void* p1);
|
||||
T* ForEach(Boolean (*proc)(T&, void* p1, void* p2), void* p1, void* p2);
|
||||
T* ForEach(bool (*proc)(T&));
|
||||
T* ForEach(bool (*proc)(T&, void* p1), void* p1);
|
||||
T* ForEach(bool (*proc)(T&, void* p1, void* p2), void* p1, void* p2);
|
||||
};
|
||||
|
||||
// Use this for block of memory allocated with HSMemory::New()
|
||||
@ -274,7 +274,7 @@ public:
|
||||
|
||||
|
||||
template <class T>
|
||||
hsDynamicArray<T>::hsDynamicArray(Int32 count)
|
||||
hsDynamicArray<T>::hsDynamicArray(int32_t count)
|
||||
{
|
||||
fCount = count;
|
||||
fArray = nil;
|
||||
@ -289,7 +289,7 @@ hsDynamicArray<T>::~hsDynamicArray()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void hsDynamicArray<T>::SetCount(Int32 count)
|
||||
void hsDynamicArray<T>::SetCount(int32_t count)
|
||||
{
|
||||
if (fCount != count)
|
||||
{ if (count == 0)
|
||||
@ -310,26 +310,26 @@ void hsDynamicArray<T>::SetCount(Int32 count)
|
||||
}
|
||||
}
|
||||
|
||||
template <class T> T& hsDynamicArray<T>::operator[]( Int32 index )
|
||||
template <class T> T& hsDynamicArray<T>::operator[]( int32_t index )
|
||||
{
|
||||
hsDebugCode(hsThrowIfBadParam((UInt32)index >= (UInt32)fCount);)
|
||||
hsDebugCode(hsThrowIfBadParam((uint32_t)index >= (uint32_t)fCount);)
|
||||
|
||||
return fArray[index];
|
||||
}
|
||||
|
||||
template <class T> const T& hsDynamicArray<T>::Get( Int32 index ) const
|
||||
template <class T> const T& hsDynamicArray<T>::Get( int32_t index ) const
|
||||
{
|
||||
hsDebugCode(hsThrowIfBadParam((UInt32)index >= (UInt32)fCount);)
|
||||
hsDebugCode(hsThrowIfBadParam((uint32_t)index >= (uint32_t)fCount);)
|
||||
|
||||
return fArray[index];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsDynamicArray<T>::Get(Int32 index, Int32 count, T data[]) const
|
||||
int32_t hsDynamicArray<T>::Get(int32_t index, int32_t count, T data[]) const
|
||||
{
|
||||
if (count > 0)
|
||||
{ hsThrowIfNilParam(data);
|
||||
hsThrowIfBadParam((UInt32)index >= fCount);
|
||||
hsThrowIfBadParam((uint32_t)index >= fCount);
|
||||
|
||||
if (index + count > fCount)
|
||||
count = fCount - index;
|
||||
@ -340,7 +340,7 @@ Int32 hsDynamicArray<T>::Get(Int32 index, Int32 count, T data[]) const
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsDynamicArray<T>::Find(const T& obj) const
|
||||
int32_t hsDynamicArray<T>::Find(const T& obj) const
|
||||
{
|
||||
for (int i = 0; i < fCount; i++)
|
||||
if (fArray[i] == obj)
|
||||
@ -349,9 +349,9 @@ Int32 hsDynamicArray<T>::Find(const T& obj) const
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void hsDynamicArray<T>::Remove(Int32 index)
|
||||
void hsDynamicArray<T>::Remove(int32_t index)
|
||||
{
|
||||
hsThrowIfBadParam((UInt32)index >= (UInt32)fCount);
|
||||
hsThrowIfBadParam((uint32_t)index >= (uint32_t)fCount);
|
||||
|
||||
T rVal = fArray[index];
|
||||
|
||||
@ -373,7 +373,7 @@ void hsDynamicArray<T>::Remove(Int32 index)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsDynamicArray<T>::Pop(T *obj)
|
||||
int32_t hsDynamicArray<T>::Pop(T *obj)
|
||||
{
|
||||
hsThrowIfBadParam(this->IsEmpty());
|
||||
|
||||
@ -384,7 +384,7 @@ Int32 hsDynamicArray<T>::Pop(T *obj)
|
||||
|
||||
|
||||
template <class T>
|
||||
Int32 hsDynamicArray<T>::Push(const T& obj)
|
||||
int32_t hsDynamicArray<T>::Push(const T& obj)
|
||||
{
|
||||
if (fArray)
|
||||
{
|
||||
@ -404,7 +404,7 @@ Int32 hsDynamicArray<T>::Push(const T& obj)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Int32 hsDynamicArray<T>::Append(const T& obj)
|
||||
int32_t hsDynamicArray<T>::Append(const T& obj)
|
||||
{
|
||||
if (fArray)
|
||||
{ T* newList = TRACKED_NEW T[fCount + 1];
|
||||
@ -425,17 +425,17 @@ Int32 hsDynamicArray<T>::Append(const T& obj)
|
||||
|
||||
|
||||
template <class T>
|
||||
Int32 hsDynamicArray<T>::InsertAtIndex(UInt32 index, const T& obj)
|
||||
int32_t hsDynamicArray<T>::InsertAtIndex(uint32_t index, const T& obj)
|
||||
{
|
||||
if (fArray)
|
||||
{
|
||||
hsAssert(UInt32(fCount) >= index, "Index too large for array");
|
||||
hsAssert(uint32_t(fCount) >= index, "Index too large for array");
|
||||
T* newList = TRACKED_NEW T[fCount + 1];
|
||||
unsigned i;
|
||||
for ( i = 0; i < index; i++)
|
||||
newList[i] = fArray[i];
|
||||
newList[index] = obj;
|
||||
for ( i = index; i < UInt32(fCount); i++)
|
||||
for ( i = index; i < uint32_t(fCount); i++)
|
||||
newList[i+1] = fArray[i];
|
||||
|
||||
delete [] fArray;
|
||||
@ -475,7 +475,7 @@ hsDynamicArray<T>* hsDynamicArray<T>::Copy(hsDynamicArray<T>* dst) const
|
||||
return dst;
|
||||
}
|
||||
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(Boolean (*proc)(T&))
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(bool (*proc)(T&))
|
||||
{
|
||||
for (int i = 0; i < fCount; i++)
|
||||
if (proc(fArray[i]))
|
||||
@ -483,7 +483,7 @@ template <class T> T* hsDynamicArray<T>::ForEach(Boolean (*proc)(T&))
|
||||
return nil;
|
||||
}
|
||||
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(Boolean (*proc)(T&, void* p1), void * p1)
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(bool (*proc)(T&, void* p1), void * p1)
|
||||
{
|
||||
for (int i = 0; i < fCount; i++)
|
||||
if (proc(fArray[i], p1))
|
||||
@ -491,7 +491,7 @@ template <class T> T* hsDynamicArray<T>::ForEach(Boolean (*proc)(T&, void* p1),
|
||||
return nil;
|
||||
}
|
||||
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(Boolean (*proc)(T&, void* p1, void* p2), void *p1, void *p2)
|
||||
template <class T> T* hsDynamicArray<T>::ForEach(bool (*proc)(T&, void* p1, void* p2), void *p1, void *p2)
|
||||
{
|
||||
for (int i = 0; i < fCount; i++)
|
||||
if (proc(fArray[i], p1, p2))
|
||||
@ -504,10 +504,10 @@ template <class T> T* hsDynamicArray<T>::ForEach(Boolean (*proc)(T&, void* p1, v
|
||||
class hsTArrayBase
|
||||
{
|
||||
protected:
|
||||
UInt16 fUseCount;
|
||||
UInt16 fTotalCount;
|
||||
uint16_t fUseCount;
|
||||
uint16_t fTotalCount;
|
||||
|
||||
void GrowArraySize(UInt16 nSize);
|
||||
void GrowArraySize(uint16_t nSize);
|
||||
|
||||
#ifdef HS_DEBUGTARRAY
|
||||
hsTArrayBase();
|
||||
@ -521,7 +521,7 @@ protected:
|
||||
#endif
|
||||
|
||||
public:
|
||||
UInt16 GetNumAlloc() const { return fTotalCount; }
|
||||
uint16_t GetNumAlloc() const { return fTotalCount; }
|
||||
};
|
||||
|
||||
template <class T> void hsTArray_CopyForward(const T src[], T dst[], int count);
|
||||
@ -708,7 +708,7 @@ bool hsTArray<T>::operator==(const hsTArray<T>& src) const
|
||||
|
||||
template <class T> void hsTArray<T>::Swap( hsTArray<T>& src )
|
||||
{
|
||||
UInt16 use, tot;
|
||||
uint16_t use, tot;
|
||||
T *array;
|
||||
|
||||
|
||||
@ -903,10 +903,10 @@ template <class T> T* hsTArray<T>::ForEach(hsBool (*proc)(T&, void* p1, void* p2
|
||||
class hsLargeArrayBase
|
||||
{
|
||||
protected:
|
||||
UInt32 fUseCount;
|
||||
UInt32 fTotalCount;
|
||||
uint32_t fUseCount;
|
||||
uint32_t fTotalCount;
|
||||
|
||||
void GrowArraySize(UInt32 nSize);
|
||||
void GrowArraySize(uint32_t nSize);
|
||||
|
||||
#ifdef HS_DEBUGTARRAY
|
||||
hsLargeArrayBase();
|
||||
@ -920,7 +920,7 @@ protected:
|
||||
#endif
|
||||
|
||||
public:
|
||||
UInt32 GetNumAlloc() const { return fTotalCount; }
|
||||
uint32_t GetNumAlloc() const { return fTotalCount; }
|
||||
};
|
||||
|
||||
|
||||
@ -1081,7 +1081,7 @@ template <class T> hsLargeArray<T>& hsLargeArray<T>::operator=(const hsLargeArra
|
||||
|
||||
template <class T> void hsLargeArray<T>::Swap( hsLargeArray<T>& src )
|
||||
{
|
||||
UInt32 use, tot;
|
||||
uint32_t use, tot;
|
||||
T *array;
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "hsTypes.h"
|
||||
|
||||
typedef UInt32 hsMilliseconds;
|
||||
typedef uint32_t hsMilliseconds;
|
||||
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
@ -71,7 +71,7 @@ public:
|
||||
#endif
|
||||
private:
|
||||
hsBool fQuit;
|
||||
UInt32 fStackSize;
|
||||
uint32_t fStackSize;
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
ThreadId fThreadId;
|
||||
HANDLE fThreadH;
|
||||
@ -85,7 +85,7 @@ protected:
|
||||
hsBool GetQuit() const { return hsBool(fQuit); }
|
||||
void SetQuit(hsBool value) { fQuit = value; }
|
||||
public:
|
||||
hsThread(UInt32 stackSize = 0);
|
||||
hsThread(uint32_t stackSize = 0);
|
||||
virtual ~hsThread(); // calls Stop()
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
ThreadId GetThreadId() { return fThreadId; }
|
||||
@ -155,7 +155,7 @@ class hsSemaphore {
|
||||
#else
|
||||
pthread_mutex_t fPMutex;
|
||||
pthread_cond_t fPCond;
|
||||
Int32 fCounter;
|
||||
int32_t fCounter;
|
||||
#endif
|
||||
#endif
|
||||
public:
|
||||
@ -200,10 +200,10 @@ class hsSleep
|
||||
{
|
||||
public:
|
||||
#if HS_BUILD_FOR_UNIX
|
||||
static void Sleep(UInt32 millis);
|
||||
static void Sleep(uint32_t millis);
|
||||
|
||||
#elif HS_BUILD_FOR_WIN32
|
||||
static void Sleep(UInt32 millis) { ::Sleep(millis); }
|
||||
static void Sleep(uint32_t millis) { ::Sleep(millis); }
|
||||
|
||||
#endif
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
hsThread::hsThread(UInt32 stackSize) : fTaskId(0), fStackSize(stackSize), fQuit(false)
|
||||
hsThread::hsThread(uint32_t stackSize) : fTaskId(0), fStackSize(stackSize), fQuit(false)
|
||||
{
|
||||
if (MPLibraryIsLoaded() == false)
|
||||
throw "MPLibraryIsLoaded() returned false";
|
||||
|
@ -79,9 +79,9 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
#define kInvalidStackSize UInt32(~0)
|
||||
#define kInvalidStackSize uint32_t(~0)
|
||||
|
||||
hsThread::hsThread(UInt32 stackSize) : fStackSize(stackSize), fQuit(false)
|
||||
hsThread::hsThread(uint32_t stackSize) : fStackSize(stackSize), fQuit(false)
|
||||
{
|
||||
fIsValid = false;
|
||||
pthread_mutex_init(&fMutex,nil);
|
||||
@ -541,9 +541,9 @@ void hsEvent::Signal()
|
||||
|
||||
#endif
|
||||
|
||||
void hsSleep::Sleep(UInt32 millis)
|
||||
void hsSleep::Sleep(uint32_t millis)
|
||||
{
|
||||
UInt32 secs = millis / 1000;
|
||||
uint32_t secs = millis / 1000;
|
||||
if (secs > 0)
|
||||
{
|
||||
millis %= 1000;
|
||||
|
@ -58,7 +58,7 @@ static unsigned int __stdcall gEntryPointBT(void* param)
|
||||
return ((hsThread*)param)->WinRun();
|
||||
}
|
||||
|
||||
hsThread::hsThread(UInt32 stackSize) : fStackSize(stackSize), fQuit(false), fThreadH(nil), fQuitSemaH(nil)
|
||||
hsThread::hsThread(uint32_t stackSize) : fStackSize(stackSize), fQuit(false), fThreadH(nil), fQuitSemaH(nil)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -64,61 +64,28 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
/************************** Basic Types *****************************/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int int16_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef uint8_t byte;
|
||||
typedef uint16_t word;
|
||||
typedef uint32_t dword;
|
||||
typedef uint64_t qword;
|
||||
|
||||
typedef uintptr_t unsigned_ptr;
|
||||
|
||||
typedef wchar_t wchar;
|
||||
|
||||
#define kPosInfinity16 (32767)
|
||||
#define kNegInfinity16 (-32768)
|
||||
|
||||
#define kPosInfinity32 (0x7fffffff)
|
||||
#define kNegInfinity32 (0x80000000)
|
||||
|
||||
typedef int8_t Int8;
|
||||
typedef int16_t Int16;
|
||||
typedef int32_t Int32;
|
||||
typedef int64_t Int64;
|
||||
|
||||
typedef uint8_t UInt8;
|
||||
typedef uint16_t UInt16;
|
||||
typedef uint32_t UInt32;
|
||||
typedef uint64_t UInt64;
|
||||
|
||||
#ifndef Byte
|
||||
typedef uint8_t Byte;
|
||||
#endif
|
||||
|
||||
#ifndef false
|
||||
#define false 0
|
||||
#endif
|
||||
#ifndef true
|
||||
#define true 1
|
||||
#endif
|
||||
#ifndef Boolean
|
||||
typedef uint8_t Boolean;
|
||||
#endif
|
||||
|
||||
|
||||
typedef Int32 hsFixed;
|
||||
typedef Int32 hsFract;
|
||||
typedef int32_t hsFixed;
|
||||
typedef int32_t hsFract;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -136,8 +103,8 @@ typedef int hsBool;
|
||||
#define nil (0)
|
||||
#endif
|
||||
|
||||
typedef Int32 hsError;
|
||||
typedef UInt32 hsGSeedValue;
|
||||
typedef int32_t hsError;
|
||||
typedef uint32_t hsGSeedValue;
|
||||
|
||||
#define hsOK 0
|
||||
#define hsFail -1
|
||||
@ -153,24 +120,24 @@ typedef UInt32 hsGSeedValue;
|
||||
|
||||
#define hsBitTst2Bool(value, mask) (((value) & (mask)) != 0)
|
||||
|
||||
#define hsFourByteTag(a, b, c, d) (((UInt32)(a) << 24) | ((UInt32)(b) << 16) | ((UInt32)(c) << 8) | (d))
|
||||
#define hsFourByteTag(a, b, c, d) (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | (d))
|
||||
|
||||
|
||||
/************************** Swap Macros *****************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
inline UInt16 hsSwapEndian16(UInt16 value)
|
||||
inline uint16_t hsSwapEndian16(uint16_t value)
|
||||
{
|
||||
return (value >> 8) | (value << 8);
|
||||
}
|
||||
inline UInt32 hsSwapEndian32(UInt32 value)
|
||||
inline uint32_t hsSwapEndian32(uint32_t value)
|
||||
{
|
||||
return ((value) << 24) |
|
||||
((value & 0x0000ff00) << 8) |
|
||||
((value & 0x00ff0000) >> 8) |
|
||||
((value) >> 24);
|
||||
}
|
||||
inline UInt64 hsSwapEndian64(UInt64 value)
|
||||
inline uint64_t hsSwapEndian64(uint64_t value)
|
||||
{
|
||||
return ((value) << 56) |
|
||||
((value & 0x000000000000ff00) << 40) |
|
||||
@ -184,13 +151,13 @@ typedef UInt32 hsGSeedValue;
|
||||
#if HS_CAN_USE_FLOAT
|
||||
inline float hsSwapEndianFloat(float fvalue)
|
||||
{
|
||||
UInt32 value = *(UInt32*)&fvalue;
|
||||
uint32_t value = *(uint32_t*)&fvalue;
|
||||
value = hsSwapEndian32(value);
|
||||
return *(float*)&value;
|
||||
}
|
||||
inline double hsSwapEndianDouble(double dvalue)
|
||||
{
|
||||
UInt64 value = *(UInt64*)&dvalue;
|
||||
uint64_t value = *(uint64_t*)&dvalue;
|
||||
value = hsSwapEndian64(value);
|
||||
return *(double*)&value;
|
||||
}
|
||||
@ -220,16 +187,16 @@ typedef UInt32 hsGSeedValue;
|
||||
#define hsToLEDouble(n) hsSwapEndianDouble(n)
|
||||
#endif
|
||||
|
||||
inline void hsSwap(Int32& a, Int32& b)
|
||||
inline void hsSwap(int32_t& a, int32_t& b)
|
||||
{
|
||||
Int32 c = a;
|
||||
int32_t c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
inline void hsSwap(UInt32& a, UInt32& b)
|
||||
inline void hsSwap(uint32_t& a, uint32_t& b)
|
||||
{
|
||||
UInt32 c = a;
|
||||
uint32_t c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
@ -248,20 +215,20 @@ typedef UInt32 hsGSeedValue;
|
||||
|
||||
struct hsColor32 {
|
||||
|
||||
UInt8 b, g, r, a;
|
||||
uint8_t b, g, r, a;
|
||||
|
||||
#ifdef __cplusplus
|
||||
void SetARGB(UInt8 aa, UInt8 rr, UInt8 gg, UInt8 bb)
|
||||
void SetARGB(uint8_t aa, uint8_t rr, uint8_t gg, uint8_t bb)
|
||||
{
|
||||
this->a = aa; this->r = rr; this->g = gg; this->b = bb;
|
||||
}
|
||||
|
||||
// Compatibility inlines, should be depricated
|
||||
void Set(UInt8 rr, UInt8 gg, UInt8 bb)
|
||||
void Set(uint8_t rr, uint8_t gg, uint8_t bb)
|
||||
{
|
||||
this->r = rr; this->g = gg; this->b = bb;
|
||||
}
|
||||
void Set(UInt8 aa, UInt8 rr, UInt8 gg, UInt8 bb)
|
||||
void Set(uint8_t aa, uint8_t rr, uint8_t gg, uint8_t bb)
|
||||
{
|
||||
this->SetARGB(aa, rr, gg, bb);
|
||||
}
|
||||
@ -269,13 +236,13 @@ struct hsColor32 {
|
||||
#if 0
|
||||
friend int operator==(const hsColor32& a, const hsColor32& b)
|
||||
{
|
||||
return *(UInt32*)&a == *(UInt32*)&b;
|
||||
return *(uint32_t*)&a == *(uint32_t*)&b;
|
||||
}
|
||||
friend int operator!=(const hsColor32& a, const hsColor32& b) { return !(a == b); }
|
||||
#else
|
||||
int operator==(const hsColor32& aa) const
|
||||
{
|
||||
return *(UInt32*)&aa == *(UInt32*)this;
|
||||
return *(uint32_t*)&aa == *(uint32_t*)this;
|
||||
}
|
||||
int operator!=(const hsColor32& aa) { return !(aa == *this); }
|
||||
#endif
|
||||
@ -436,7 +403,7 @@ void SWAP (T & a, T & b) {
|
||||
*
|
||||
***/
|
||||
|
||||
#define CONTAINING_STRUCT(a, t, f) ((t *) ((byte *)(a) - (unsigned_ptr)(&((t *)0)->f)))
|
||||
#define CONTAINING_STRUCT(a, t, f) ((t *) ((uint8_t *)(a) - (uintptr_t)(&((t *)0)->f)))
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
@ -469,7 +436,7 @@ void SWAP (T & a, T & b) {
|
||||
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
||||
#endif // ifndef offsetof
|
||||
|
||||
#define moffsetof(v,f) (((byte *) &((v)->f)) - ((byte *) v))
|
||||
#define moffsetof(v,f) (((uint8_t *) &((v)->f)) - ((uint8_t *) v))
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -83,7 +83,7 @@ char *hsScalarToStr(hsScalar s)
|
||||
#if HS_CAN_USE_FLOAT
|
||||
sprintf(hsStrBuf, "%f", hsScalarToFloat(s));
|
||||
#else
|
||||
sprintf(hsStrBuf, "%d:%lu", hsFixedToInt(s), (UInt16)s);
|
||||
sprintf(hsStrBuf, "%d:%lu", hsFixedToInt(s), (uint16_t)s);
|
||||
#endif
|
||||
return hsStrBuf;
|
||||
}
|
||||
@ -96,7 +96,7 @@ int hsMessageBoxWithOwner(void * owner, const char message[], const char caption
|
||||
return hsMBoxOk;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
UInt32 flags = 0;
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (kind == hsMessageBoxNormal)
|
||||
flags |= MB_OK;
|
||||
@ -150,7 +150,7 @@ int hsMessageBoxWithOwner(void * owner, const wchar_t message[], const wchar_t c
|
||||
return hsMBoxOk;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
UInt32 flags = 0;
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (kind == hsMessageBoxNormal)
|
||||
flags |= MB_OK;
|
||||
@ -256,7 +256,7 @@ char* hsStrcpy(char dst[], const char src[])
|
||||
return dst;
|
||||
}
|
||||
|
||||
Int32 i;
|
||||
int32_t i;
|
||||
for (i = 0; src[i] != 0; i++)
|
||||
dst[i] = src[i];
|
||||
dst[i] = 0;
|
||||
@ -312,10 +312,10 @@ void hsStrLower(char *s)
|
||||
}
|
||||
}
|
||||
|
||||
char* hsP2CString(const UInt8 pstring[], char cstring[])
|
||||
char* hsP2CString(const uint8_t pstring[], char cstring[])
|
||||
{
|
||||
char* cstr = cstring;
|
||||
const UInt8* stop = &pstring[1] + pstring[0];
|
||||
const uint8_t* stop = &pstring[1] + pstring[0];
|
||||
|
||||
pstring += 1; // skip length byte
|
||||
while (pstring < stop)
|
||||
@ -324,7 +324,7 @@ char* hsP2CString(const UInt8 pstring[], char cstring[])
|
||||
return cstring;
|
||||
}
|
||||
|
||||
UInt8* hsC2PString(const char cstring[], UInt8 pstring[])
|
||||
uint8_t* hsC2PString(const char cstring[], uint8_t pstring[])
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -394,7 +394,7 @@ void hsCPathToMacPath(char* dst, char* fname)
|
||||
else if(strstr(fname, "\\\\"))
|
||||
{
|
||||
prefix = 0;
|
||||
offset = 2; // copy fname from 2-bytes in. This removes
|
||||
offset = 2; // copy fname from 2-Bytes in. This removes
|
||||
// the first two chars...
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ int hsRemove(const char * fname)
|
||||
|
||||
}
|
||||
|
||||
UInt32 hsPhysicalMemory()
|
||||
uint32_t hsPhysicalMemory()
|
||||
{
|
||||
#define HS_ONE_MEGABYTE 1048576 // 1024 * 1024
|
||||
|
||||
@ -436,7 +436,7 @@ UInt32 hsPhysicalMemory()
|
||||
|
||||
MemSpec hsMemorySpec()
|
||||
{
|
||||
UInt32 mem = hsPhysicalMemory();
|
||||
uint32_t mem = hsPhysicalMemory();
|
||||
|
||||
// Currently adding a little margin of error here
|
||||
// due to the fact that Windows doesn't seem to
|
||||
|
@ -76,9 +76,9 @@ char * hsFormatStrV(const char * fmt, va_list args); // You are responsible f
|
||||
#endif
|
||||
|
||||
|
||||
// A pstring has a length byte at the beginning, and no trailing 0
|
||||
char* hsP2CString(const UInt8 pstring[], char cstring[]);
|
||||
UInt8* hsC2PString(const char cstring[], UInt8 pstring[]);
|
||||
// A pstring has a length uint8_t at the beginning, and no trailing 0
|
||||
char* hsP2CString(const uint8_t pstring[], char cstring[]);
|
||||
uint8_t* hsC2PString(const char cstring[], uint8_t pstring[]);
|
||||
|
||||
inline char* hsStrcpy(const char src[])
|
||||
{
|
||||
@ -178,7 +178,7 @@ enum MemSpec
|
||||
kOptimal // 256 or greater
|
||||
};
|
||||
|
||||
UInt32 hsPhysicalMemory();
|
||||
uint32_t hsPhysicalMemory();
|
||||
MemSpec hsMemorySpec();
|
||||
|
||||
inline int hsRandMax() { return 32767; }
|
||||
|
@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline hsBool OverflowAdd(UInt32* sum, UInt32 a, UInt32 b)
|
||||
inline hsBool OverflowAdd(uint32_t* sum, uint32_t a, uint32_t b)
|
||||
{
|
||||
*sum = a + b;
|
||||
|
||||
@ -55,19 +55,19 @@ inline hsBool OverflowAdd(UInt32* sum, UInt32 a, UInt32 b)
|
||||
|
||||
wide = (high << 32) + (middle << 16) + low
|
||||
*/
|
||||
inline hsBool SetWide3(hsWide* target, Int32 high, UInt32 middle, UInt32 low)
|
||||
inline hsBool SetWide3(hsWide* target, int32_t high, uint32_t middle, uint32_t low)
|
||||
{
|
||||
hsAssert(high >= 0, "high is neg");
|
||||
|
||||
target->fLo = low + (middle << 16);
|
||||
target->fHi = high + (middle >> 16) + (((low >> 16) + (UInt16)middle) >> 16);
|
||||
target->fHi = high + (middle >> 16) + (((low >> 16) + (uint16_t)middle) >> 16);
|
||||
|
||||
return target->fHi < 0; // true if overflow
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
hsWide* hsWide::Mul(Int32 src1, Int32 src2)
|
||||
hsWide* hsWide::Mul(int32_t src1, int32_t src2)
|
||||
{
|
||||
int neg = 0;
|
||||
|
||||
@ -80,10 +80,10 @@ hsWide* hsWide::Mul(Int32 src1, Int32 src2)
|
||||
neg = ~neg;
|
||||
}
|
||||
|
||||
UInt32 a = src1 >> 16;
|
||||
UInt32 b = (UInt16)src1;
|
||||
UInt32 c = src2 >> 16;
|
||||
UInt32 d = (UInt16)src2;
|
||||
uint32_t a = src1 >> 16;
|
||||
uint32_t b = (uint16_t)src1;
|
||||
uint32_t c = src2 >> 16;
|
||||
uint32_t d = (uint16_t)src2;
|
||||
|
||||
(void)SetWide3(this, a * c, a * d + c * b, b * d);
|
||||
|
||||
@ -92,13 +92,13 @@ hsWide* hsWide::Mul(Int32 src1, Int32 src2)
|
||||
return this;
|
||||
}
|
||||
|
||||
hsWide* hsWide::Mul(Int32 A)
|
||||
hsWide* hsWide::Mul(int32_t A)
|
||||
{
|
||||
int neg = 0;
|
||||
UInt32 B = fLo;
|
||||
Int32 C = fHi;
|
||||
Int32 tmp;
|
||||
UInt32 clo,blo,bhi,alo;
|
||||
uint32_t B = fLo;
|
||||
int32_t C = fHi;
|
||||
int32_t tmp;
|
||||
uint32_t clo,blo,bhi,alo;
|
||||
|
||||
if (A < 0)
|
||||
{ A = -A;
|
||||
@ -109,37 +109,37 @@ hsWide* hsWide::Mul(Int32 A)
|
||||
neg = ~neg;
|
||||
}
|
||||
|
||||
UInt32 ahi = A >> 16;
|
||||
UInt32 chi = C >> 16;
|
||||
uint32_t ahi = A >> 16;
|
||||
uint32_t chi = C >> 16;
|
||||
if (ahi != 0 && chi != 0)
|
||||
goto OVER_FLOW;
|
||||
|
||||
alo = (UInt16)A;
|
||||
alo = (uint16_t)A;
|
||||
bhi = B >> 16;
|
||||
blo = (UInt16)B;
|
||||
clo = (UInt16)C;
|
||||
blo = (uint16_t)B;
|
||||
clo = (uint16_t)C;
|
||||
|
||||
tmp = alo * clo;
|
||||
if (tmp < 0 || SetWide3(this, tmp, alo * bhi, alo * blo))
|
||||
goto OVER_FLOW;
|
||||
|
||||
if (chi != 0)
|
||||
{ UInt32 Vh = alo * chi;
|
||||
{ uint32_t Vh = alo * chi;
|
||||
if (Vh >> 15)
|
||||
goto OVER_FLOW;
|
||||
if (((this->fHi >> 16) + (UInt16)Vh) >> 15)
|
||||
if (((this->fHi >> 16) + (uint16_t)Vh) >> 15)
|
||||
goto OVER_FLOW;
|
||||
this->fHi += Vh << 16;
|
||||
}
|
||||
else // ahi != 0 && chi == 0
|
||||
{ hsWide w;
|
||||
UInt32 Vh = ahi * clo;
|
||||
uint32_t Vh = ahi * clo;
|
||||
if (Vh >> 16)
|
||||
goto OVER_FLOW;
|
||||
tmp = ahi * bhi;
|
||||
if (tmp < 0 || SetWide3(&w, tmp, ahi * blo, 0))
|
||||
goto OVER_FLOW;
|
||||
if (((w.fHi >> 16) + (UInt16)Vh) >> 15)
|
||||
if (((w.fHi >> 16) + (uint16_t)Vh) >> 15)
|
||||
goto OVER_FLOW;
|
||||
w.fHi += Vh << 16;
|
||||
this->Add(&w);
|
||||
@ -154,7 +154,7 @@ OVER_FLOW:
|
||||
return this;
|
||||
}
|
||||
|
||||
hsWide* hsWide::Div(Int32 denom)
|
||||
hsWide* hsWide::Div(int32_t denom)
|
||||
{
|
||||
if (denom == 0)
|
||||
{ if (this->IsNeg())
|
||||
@ -169,10 +169,10 @@ hsWide* hsWide::Div(Int32 denom)
|
||||
}
|
||||
|
||||
int neg = 0;
|
||||
Int32 resultH = 0;
|
||||
UInt32 resultL = 0;
|
||||
Int32 numerH = this->fHi;
|
||||
UInt32 numerL = this->fLo;
|
||||
int32_t resultH = 0;
|
||||
uint32_t resultL = 0;
|
||||
int32_t numerH = this->fHi;
|
||||
uint32_t numerL = this->fLo;
|
||||
|
||||
if (denom < 0)
|
||||
{ denom = -denom;
|
||||
@ -185,18 +185,18 @@ hsWide* hsWide::Div(Int32 denom)
|
||||
|
||||
WIDE_ADDPOS(numerH, numerL, denom >> 1); // add denom/2 to get a round result
|
||||
|
||||
UInt32 curr = (UInt32)numerH >> 31;
|
||||
uint32_t curr = (uint32_t)numerH >> 31;
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
WIDE_SHIFTLEFT(resultH, resultL, resultH, resultL, 1);
|
||||
if (UInt32(denom) <= curr)
|
||||
if (uint32_t(denom) <= curr)
|
||||
{
|
||||
resultL |= 1;
|
||||
curr -= denom;
|
||||
}
|
||||
WIDE_SHIFTLEFT(numerH, numerL, numerH, numerL, 1);
|
||||
curr = (curr << 1) | ((UInt32)numerH >> 31);
|
||||
curr = (curr << 1) | ((uint32_t)numerH >> 31);
|
||||
}
|
||||
|
||||
if (neg)
|
||||
@ -223,7 +223,7 @@ hsWide* hsWide::Div(const hsWide* denom)
|
||||
|
||||
inline int MaxLeftShift(const hsWide* w)
|
||||
{
|
||||
Int32 hi = w->fHi;
|
||||
int32_t hi = w->fHi;
|
||||
|
||||
if (hi == 0)
|
||||
return 31;
|
||||
@ -274,15 +274,15 @@ hsFract hsWide::FracDiv(const hsWide* denom) const
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Int32 hsWide::Sqrt() const
|
||||
int32_t hsWide::Sqrt() const
|
||||
{
|
||||
int bits = 32;
|
||||
UInt32 root = 0;
|
||||
UInt32 valueH = (UInt32)fHi;
|
||||
UInt32 valueL = fLo;
|
||||
UInt32 currH = 0;
|
||||
UInt32 currL = 0;
|
||||
UInt32 guessH, guessL;
|
||||
uint32_t root = 0;
|
||||
uint32_t valueH = (uint32_t)fHi;
|
||||
uint32_t valueL = fLo;
|
||||
uint32_t currH = 0;
|
||||
uint32_t currL = 0;
|
||||
uint32_t guessH, guessL;
|
||||
|
||||
do {
|
||||
WIDE_SHIFTLEFT(currH, currL, currH, currL, 2);
|
||||
@ -298,20 +298,20 @@ Int32 hsWide::Sqrt() const
|
||||
} while (--bits);
|
||||
|
||||
#if HS_PIN_MATH_OVERFLOW
|
||||
if ((Int32)root < 0)
|
||||
if ((int32_t)root < 0)
|
||||
return kPosInfinity32;
|
||||
#endif
|
||||
return (Int32)root;
|
||||
return (int32_t)root;
|
||||
}
|
||||
|
||||
Int32 hsWide::CubeRoot() const
|
||||
int32_t hsWide::CubeRoot() const
|
||||
{
|
||||
int bits = 21;
|
||||
UInt32 root = 0;
|
||||
UInt32 valueH = (UInt32)fHi;
|
||||
UInt32 valueL = fLo;
|
||||
UInt32 currH, currL;
|
||||
UInt32 guessH, guessL;
|
||||
uint32_t root = 0;
|
||||
uint32_t valueH = (uint32_t)fHi;
|
||||
uint32_t valueL = fLo;
|
||||
uint32_t currH, currL;
|
||||
uint32_t guessH, guessL;
|
||||
hsBool neg = false;
|
||||
|
||||
if (WIDE_ISNEG(valueH, valueL))
|
||||
@ -336,7 +336,7 @@ Int32 hsWide::CubeRoot() const
|
||||
hsWide w2 = w;
|
||||
w.ShiftLeft(1)->Add(&w2);
|
||||
#endif
|
||||
guessH = (UInt32)w.fHi;
|
||||
guessH = (uint32_t)w.fHi;
|
||||
guessL = w.fLo;
|
||||
|
||||
if (WIDE_LESSTHAN(guessH, guessL, currH, currL))
|
||||
@ -347,7 +347,7 @@ Int32 hsWide::CubeRoot() const
|
||||
} while (--bits);
|
||||
|
||||
if (neg)
|
||||
root = -Int32(root);
|
||||
return (Int32)root;
|
||||
root = -int32_t(root);
|
||||
return (int32_t)root;
|
||||
}
|
||||
|
||||
|
@ -45,11 +45,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsTypes.h"
|
||||
|
||||
struct hsWide {
|
||||
Int32 fHi;
|
||||
UInt32 fLo;
|
||||
int32_t fHi;
|
||||
uint32_t fLo;
|
||||
|
||||
hsWide* Set(Int32 lo) { fLo = lo; if (lo < 0) fHi = -1L; else fHi = 0; return this; }
|
||||
hsWide* Set(Int32 hi, UInt32 lo) { fHi = hi; fLo = lo; return this; }
|
||||
hsWide* Set(int32_t lo) { fLo = lo; if (lo < 0) fHi = -1L; else fHi = 0; return this; }
|
||||
hsWide* Set(int32_t hi, uint32_t lo) { fHi = hi; fLo = lo; return this; }
|
||||
|
||||
inline hsBool IsNeg() const { return fHi < 0; }
|
||||
inline hsBool IsPos() const { return fHi > 0 || (fHi == 0 && fLo != 0); }
|
||||
@ -65,34 +65,34 @@ struct hsWide {
|
||||
hsBool operator>=(const hsWide& b) const { return !(*this < b); }
|
||||
|
||||
inline hsWide* Negate();
|
||||
inline hsWide* Add(Int32 scaler);
|
||||
inline hsWide* Add(int32_t scaler);
|
||||
inline hsWide* Add(const hsWide* a);
|
||||
inline hsWide* Sub(const hsWide* a);
|
||||
inline hsWide* ShiftLeft(unsigned shift);
|
||||
inline hsWide* ShiftRight(unsigned shift);
|
||||
inline hsWide* RoundRight(unsigned shift);
|
||||
|
||||
inline Int32 AsLong() const; // return bits 31-0, checking for over/under flow
|
||||
inline int32_t AsLong() const; // return bits 31-0, checking for over/under flow
|
||||
inline hsFixed AsFixed() const; // return bits 47-16, checking for over/under flow
|
||||
inline hsFract AsFract() const; // return bits 61-30, checking for over/under flow
|
||||
|
||||
hsWide* Mul(Int32 a); // this updates the wide
|
||||
hsWide* Mul(Int32 a, Int32 b); // this sets the wide
|
||||
hsWide* Div(Int32 denom); // this updates the wide
|
||||
hsWide* Mul(int32_t a); // this updates the wide
|
||||
hsWide* Mul(int32_t a, int32_t b); // this sets the wide
|
||||
hsWide* Div(int32_t denom); // this updates the wide
|
||||
hsWide* Div(const hsWide* denom); // this updates the wide
|
||||
|
||||
hsFixed FixDiv(const hsWide* denom) const;
|
||||
hsFract FracDiv(const hsWide* denom) const;
|
||||
|
||||
Int32 Sqrt() const;
|
||||
Int32 CubeRoot() const;
|
||||
int32_t Sqrt() const;
|
||||
int32_t CubeRoot() const;
|
||||
|
||||
#if HS_CAN_USE_FLOAT
|
||||
double AsDouble() const { return fHi * double(65536) * double(65536) + fLo; }
|
||||
hsWide* Set(double d)
|
||||
{
|
||||
Int32 hi = Int32(d / double(65536) / double(65536));
|
||||
Int32 lo = Int32(d - double(hi));
|
||||
int32_t hi = int32_t(d / double(65536) / double(65536));
|
||||
int32_t lo = int32_t(d - double(hi));
|
||||
return Set(hi, lo);
|
||||
}
|
||||
#endif
|
||||
@ -104,8 +104,8 @@ const hsWide kNegInfinity64 = { kNegInfinity32, 0 };
|
||||
|
||||
/////////////////////// Inline implementations ///////////////////////
|
||||
|
||||
#define TOP2BITS(n) (UInt32(n) >> 30)
|
||||
#define TOP3BITS(n) (UInt32(n) >> 29)
|
||||
#define TOP2BITS(n) (uint32_t(n) >> 30)
|
||||
#define TOP3BITS(n) (uint32_t(n) >> 29)
|
||||
|
||||
#if HS_PIN_MATH_OVERFLOW && HS_DEBUG_MATH_OVERFLOW
|
||||
#define hsSignalMathOverflow() hsDebugMessage("Math overflow", 0)
|
||||
@ -115,11 +115,11 @@ const hsWide kNegInfinity64 = { kNegInfinity32, 0 };
|
||||
#define hsSignalMathUnderflow()
|
||||
#endif
|
||||
|
||||
#define WIDE_ISNEG(hi, lo) (Int32(hi) < 0)
|
||||
#define WIDE_ISNEG(hi, lo) (int32_t(hi) < 0)
|
||||
#define WIDE_LESSTHAN(hi, lo, hi2, lo2) ((hi) < (hi2) || (hi) == (hi2) && (lo) < (lo2))
|
||||
#define WIDE_SHIFTLEFT(outH, outL, inH, inL, shift) do { (outH) = ((inH) << (shift)) | ((inL) >> (32 - (shift))); (outL) = (inL) << (shift); } while (0)
|
||||
#define WIDE_NEGATE(hi, lo) do { (hi) = ~(hi); if (((lo) = -Int32(lo)) == 0) (hi) += 1; } while (0)
|
||||
#define WIDE_ADDPOS(hi, lo, scaler) do { UInt32 tmp = (lo) + (scaler); if (tmp < (lo)) (hi) += 1; (lo) = tmp; } while (0)
|
||||
#define WIDE_NEGATE(hi, lo) do { (hi) = ~(hi); if (((lo) = -int32_t(lo)) == 0) (hi) += 1; } while (0)
|
||||
#define WIDE_ADDPOS(hi, lo, scaler) do { uint32_t tmp = (lo) + (scaler); if (tmp < (lo)) (hi) += 1; (lo) = tmp; } while (0)
|
||||
#define WIDE_SUBWIDE(hi, lo, subhi, sublo) do { (hi) -= (subhi); if ((lo) < (sublo)) (hi) -= 1; (lo) -= (sublo); } while (0)
|
||||
|
||||
/////////////////////// Inline implementations ///////////////////////
|
||||
@ -131,13 +131,13 @@ inline hsWide* hsWide::Negate()
|
||||
return this;
|
||||
}
|
||||
|
||||
inline hsWide* hsWide::Add(Int32 scaler)
|
||||
inline hsWide* hsWide::Add(int32_t scaler)
|
||||
{
|
||||
if (scaler >= 0)
|
||||
WIDE_ADDPOS(fHi, fLo, scaler);
|
||||
else
|
||||
{ scaler = -scaler;
|
||||
if (fLo < UInt32(scaler))
|
||||
if (fLo < uint32_t(scaler))
|
||||
fHi--;
|
||||
fLo -= scaler;
|
||||
}
|
||||
@ -147,7 +147,7 @@ inline hsWide* hsWide::Add(Int32 scaler)
|
||||
|
||||
inline hsWide* hsWide::Add(const hsWide* a)
|
||||
{
|
||||
UInt32 newLo = fLo + a->fLo;
|
||||
uint32_t newLo = fLo + a->fLo;
|
||||
|
||||
fHi += a->fHi;
|
||||
if (newLo < (fLo | a->fLo))
|
||||
@ -184,24 +184,24 @@ inline hsWide* hsWide::RoundRight(unsigned shift)
|
||||
return this->Add(1L << (shift - 1))->ShiftRight(shift);
|
||||
}
|
||||
|
||||
inline Int32 hsWide::AsLong() const
|
||||
inline int32_t hsWide::AsLong() const
|
||||
{
|
||||
#if HS_PIN_MATH_OVERFLOW
|
||||
if (fHi > 0 || (fHi == 0 && (Int32)fLo < 0))
|
||||
if (fHi > 0 || (fHi == 0 && (int32_t)fLo < 0))
|
||||
{ hsSignalMathOverflow();
|
||||
return kPosInfinity32;
|
||||
}
|
||||
if (fHi < -1L || (fHi == -1L && (Int32)fLo >= 0))
|
||||
if (fHi < -1L || (fHi == -1L && (int32_t)fLo >= 0))
|
||||
{ hsSignalMathOverflow();
|
||||
return kNegInfinity32;
|
||||
}
|
||||
#endif
|
||||
return (Int32)fLo;
|
||||
return (int32_t)fLo;
|
||||
}
|
||||
|
||||
inline hsBool hsWide::IsWide() const
|
||||
{
|
||||
return (fHi > 0 || (fHi == 0 && (Int32)fLo < 0)) || (fHi < -1L || (fHi == -1L && (Int32)fLo >= 0));
|
||||
return (fHi > 0 || (fHi == 0 && (int32_t)fLo < 0)) || (fHi < -1L || (fHi == -1L && (int32_t)fLo >= 0));
|
||||
}
|
||||
|
||||
inline hsFixed hsWide::AsFixed() const
|
||||
|
@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*==LICENSE==*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pcSmallRect - A tiny Int16-based 2D rectangle class //
|
||||
// pcSmallRect - A tiny int16_t-based 2D rectangle class //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*==LICENSE==*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pcSmallRect - A tiny Int16-based 2D rectangle class //
|
||||
// pcSmallRect - A tiny int16_t-based 2D rectangle class //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -59,21 +59,21 @@ class hsStream;
|
||||
class pcSmallRect
|
||||
{
|
||||
public:
|
||||
Int16 fX, fY, fWidth, fHeight;
|
||||
int16_t fX, fY, fWidth, fHeight;
|
||||
|
||||
pcSmallRect() { Empty(); }
|
||||
pcSmallRect( Int16 x, Int16 y, Int16 w, Int16 h ) { Set( x, y, w, h ); }
|
||||
pcSmallRect( int16_t x, int16_t y, int16_t w, int16_t h ) { Set( x, y, w, h ); }
|
||||
|
||||
void Set( Int16 x, Int16 y, Int16 w, Int16 h ) { fX = x; fY = y; fWidth = w; fHeight = h; }
|
||||
void Set( int16_t x, int16_t y, int16_t w, int16_t h ) { fX = x; fY = y; fWidth = w; fHeight = h; }
|
||||
void Empty( void ) { fX = fY = fWidth = fHeight = 0; }
|
||||
|
||||
Int16 GetRight( void ) const { return fX + fWidth; }
|
||||
Int16 GetBottom( void ) const { return fY + fHeight; }
|
||||
int16_t GetRight( void ) const { return fX + fWidth; }
|
||||
int16_t GetBottom( void ) const { return fY + fHeight; }
|
||||
|
||||
void Read( hsStream *s );
|
||||
void Write( hsStream *s );
|
||||
|
||||
hsBool Contains( Int16 x, Int16 y ) { if( x >= fX && x <= fX + fWidth && y >= fY && y <= fY + fHeight ) return true; return false; }
|
||||
hsBool Contains( int16_t x, int16_t y ) { if( x >= fX && x <= fX + fWidth && y >= fY && y <= fY + fHeight ) return true; return false; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -141,7 +141,7 @@ plGeneric& plGeneric::operator=(const std::wstring& val)
|
||||
|
||||
int plGeneric::Write(hsStream* stream)
|
||||
{
|
||||
stream->WriteByte((UInt8)fType);
|
||||
stream->WriteByte((uint8_t)fType);
|
||||
|
||||
switch (fType)
|
||||
{
|
||||
|
@ -75,13 +75,13 @@ void plQuality::SetCapability(int c)
|
||||
|
||||
const plLoadMask plLoadMask::kAlways;
|
||||
|
||||
UInt8 plLoadMask::fGlobalQuality = UInt8(1);
|
||||
UInt8 plLoadMask::fGlobalCapability = UInt8(0);
|
||||
uint8_t plLoadMask::fGlobalQuality = uint8_t(1);
|
||||
uint8_t plLoadMask::fGlobalCapability = uint8_t(0);
|
||||
|
||||
void plLoadMask::Read(hsStream* s)
|
||||
{
|
||||
// read as packed byte
|
||||
UInt8 qc;
|
||||
uint8_t qc;
|
||||
s->LogReadLE(&qc,"Quality|Capabilty");
|
||||
|
||||
fQuality[0] = (qc & 0xf0) >> 4;
|
||||
@ -95,13 +95,13 @@ void plLoadMask::Read(hsStream* s)
|
||||
void plLoadMask::Write(hsStream* s) const
|
||||
{
|
||||
// write packed into 1 byte
|
||||
UInt8 qc = (fQuality[0]<<4) | (fQuality[1] & 0xf);
|
||||
uint8_t qc = (fQuality[0]<<4) | (fQuality[1] & 0xf);
|
||||
s->WriteLE(qc);
|
||||
}
|
||||
|
||||
UInt32 plLoadMask::ValidateReps(int num, const int quals[], const int caps[])
|
||||
uint32_t plLoadMask::ValidateReps(int num, const int quals[], const int caps[])
|
||||
{
|
||||
UInt32 retVal = 0;
|
||||
uint32_t retVal = 0;
|
||||
int i;
|
||||
for( i = 1; i < num; i++ )
|
||||
{
|
||||
@ -118,9 +118,9 @@ UInt32 plLoadMask::ValidateReps(int num, const int quals[], const int caps[])
|
||||
return retVal;
|
||||
}
|
||||
|
||||
UInt32 plLoadMask::ValidateMasks(int num, plLoadMask masks[])
|
||||
uint32_t plLoadMask::ValidateMasks(int num, plLoadMask masks[])
|
||||
{
|
||||
UInt32 retVal = 0;
|
||||
uint32_t retVal = 0;
|
||||
int i;
|
||||
for( i = 0; i < num; i++ )
|
||||
{
|
||||
@ -160,12 +160,12 @@ hsBool plLoadMask::ComputeRepMasks(
|
||||
{
|
||||
// Q starts off the bits higher than or equal to 1 << qual.
|
||||
// I.e. we just turned off all lower quality bits.
|
||||
UInt8 q = ~( (1 << quals[i]) - 1 );
|
||||
uint8_t q = ~( (1 << quals[i]) - 1 );
|
||||
|
||||
// For this cap level, if we require higher caps,
|
||||
// turn off our quality (i.e. we won't load at this
|
||||
// cap for any quality setting.
|
||||
UInt8 c = caps[i] > kMaxCap ? kMaxCap : caps[i];
|
||||
uint8_t c = caps[i] > kMaxCap ? kMaxCap : caps[i];
|
||||
if( c > k )
|
||||
q = 0;
|
||||
|
||||
|
@ -55,30 +55,30 @@ public:
|
||||
kMaxCap = 1
|
||||
};
|
||||
protected:
|
||||
static UInt8 fGlobalQuality;
|
||||
static UInt8 fGlobalCapability;
|
||||
static uint8_t fGlobalQuality;
|
||||
static uint8_t fGlobalCapability;
|
||||
union {
|
||||
UInt8 fQuality[kMaxCap+1];
|
||||
UInt16 fMask;
|
||||
uint8_t fQuality[kMaxCap+1];
|
||||
uint16_t fMask;
|
||||
};
|
||||
|
||||
static void SetGlobalQuality(int q) { fGlobalQuality = IBitToMask(q); }
|
||||
static void SetGlobalCapability(int c) { if( c > kMaxCap ) c = kMaxCap; else if( c < 0 ) c = 0; fGlobalCapability = c; }
|
||||
|
||||
static UInt8 IBitToMask(int b) { hsAssert(b<8, "LoadMask: bit too large for byte"); return (1 << b); }
|
||||
static uint8_t IBitToMask(int b) { hsAssert(b<8, "LoadMask: bit too large for uint8_t"); return (1 << b); }
|
||||
|
||||
friend class plQuality;
|
||||
public:
|
||||
// Change this to a for loop on kMaxCap+1 if we ever get more caps.
|
||||
plLoadMask() { fQuality[0] = fQuality[1] = 0xff; }
|
||||
plLoadMask(UInt8 qLo, UInt8 qHi) { fQuality[0] = qLo; fQuality[1] = qHi; }
|
||||
plLoadMask(uint8_t qLo, uint8_t qHi) { fQuality[0] = qLo; fQuality[1] = qHi; }
|
||||
~plLoadMask() {}
|
||||
|
||||
hsBool DontLoad() const { return !(fQuality[fGlobalCapability] & fGlobalQuality); }
|
||||
|
||||
hsBool NeverLoads() const { return !(fQuality[0] && fQuality[1]); }
|
||||
|
||||
hsBool IsUsed() const { return (fQuality[0] != UInt8(-1)) || (fQuality[1] != UInt8(-1)); }
|
||||
hsBool IsUsed() const { return (fQuality[0] != uint8_t(-1)) || (fQuality[1] != uint8_t(-1)); }
|
||||
|
||||
hsBool MatchesQuality(int q) const { return (IBitToMask(q) & (fQuality[0] | fQuality[1])) != 0; }
|
||||
hsBool MatchesCapability(int c) const { return fQuality[c] != 0; }
|
||||
@ -88,11 +88,11 @@ public:
|
||||
hsBool MatchesCurrentCapability() const { return MatchesCapability(fGlobalCapability); }
|
||||
hsBool MatchesCurrent() const { return !DontLoad(); }
|
||||
|
||||
UInt8 GetQualityMask(int cap) const { return fQuality[cap]; }
|
||||
uint8_t GetQualityMask(int cap) const { return fQuality[cap]; }
|
||||
|
||||
plLoadMask& SetMask(UInt8 lo, UInt8 hi) { fQuality[0] = lo; fQuality[1] = hi; return *this; }
|
||||
plLoadMask& SetMask(uint8_t lo, uint8_t hi) { fQuality[0] = lo; fQuality[1] = hi; return *this; }
|
||||
plLoadMask& SetNever() { return SetMask(0,0); }
|
||||
plLoadMask& SetAlways() { return SetMask(UInt8(-1), UInt8(-1)); }
|
||||
plLoadMask& SetAlways() { return SetMask(uint8_t(-1), uint8_t(-1)); }
|
||||
|
||||
plLoadMask& operator|=(const plLoadMask& m) { fMask |= m.fMask; return *this; }
|
||||
plLoadMask& operator&=(const plLoadMask& m) { fMask &= m.fMask; return *this; }
|
||||
@ -128,8 +128,8 @@ public:
|
||||
// items in the list had problems, so return of zero means A-OK.
|
||||
//
|
||||
static hsBool ComputeRepMasks(int num, const int quals[], const int caps[], plLoadMask masks[]);
|
||||
static UInt32 ValidateReps(int num, const int quals[], const int caps[]);
|
||||
static UInt32 ValidateMasks(int num, plLoadMask masks[]);
|
||||
static uint32_t ValidateReps(int num, const int quals[], const int caps[]);
|
||||
static uint32_t ValidateMasks(int num, plLoadMask masks[]);
|
||||
};
|
||||
|
||||
#endif // plLoadMask_inc
|
||||
|
@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// plRef count addes refcount abilities to any plCreatable
|
||||
|
||||
class plRefCnt
|
||||
{ UInt32 fRefCnt;
|
||||
{ uint32_t fRefCnt;
|
||||
public:
|
||||
plRefCnt() : fRefCnt(1){}
|
||||
~plRefCnt(){}
|
||||
@ -63,12 +63,12 @@ public:
|
||||
/*
|
||||
class hsRefCnt {
|
||||
private:
|
||||
Int32 fRefCnt;
|
||||
int32_t fRefCnt;
|
||||
public:
|
||||
hsRefCnt() : fRefCnt(1) {}
|
||||
virtual ~hsRefCnt();
|
||||
|
||||
Int32 RefCnt() const { return fRefCnt; }
|
||||
int32_t RefCnt() const { return fRefCnt; }
|
||||
virtual void UnRef();
|
||||
virtual void Ref();
|
||||
};
|
||||
|
@ -79,8 +79,8 @@ public:
|
||||
};
|
||||
public:
|
||||
plRenderLevel() { Set(kDefRendMajorLevel, kDefRendMinorLevel); }
|
||||
plRenderLevel(UInt32 l) : fLevel(l) {}
|
||||
plRenderLevel(UInt32 major, UInt32 minor) { Set(major, minor); }
|
||||
plRenderLevel(uint32_t l) : fLevel(l) {}
|
||||
plRenderLevel(uint32_t major, uint32_t minor) { Set(major, minor); }
|
||||
|
||||
int operator==(const plRenderLevel& l) const { return fLevel == l.fLevel; }
|
||||
int operator!=(const plRenderLevel& l) const { return fLevel != l.fLevel; }
|
||||
@ -89,15 +89,15 @@ public:
|
||||
int operator>=(const plRenderLevel& l) const { return fLevel >= l.fLevel; }
|
||||
int operator<=(const plRenderLevel& l) const { return fLevel <= l.fLevel; }
|
||||
|
||||
UInt32 Level() const { return fLevel; }
|
||||
uint32_t Level() const { return fLevel; }
|
||||
|
||||
UInt32 Minor() const { return UInt32(fLevel & kMinorLevelMask); }
|
||||
UInt32 Major() const { return UInt32(fLevel >> kMajorShift); }
|
||||
uint32_t Minor() const { return uint32_t(fLevel & kMinorLevelMask); }
|
||||
uint32_t Major() const { return uint32_t(fLevel >> kMajorShift); }
|
||||
|
||||
plRenderLevel& Set(UInt32 l) { fLevel = l; return *this; }
|
||||
plRenderLevel& Set(UInt32 major, UInt32 minor) { fLevel = (UInt32(major) << kMajorShift) | UInt32(minor); return *this; }
|
||||
plRenderLevel& Set(uint32_t l) { fLevel = l; return *this; }
|
||||
plRenderLevel& Set(uint32_t major, uint32_t minor) { fLevel = (uint32_t(major) << kMajorShift) | uint32_t(minor); return *this; }
|
||||
|
||||
UInt32 fLevel;
|
||||
uint32_t fLevel;
|
||||
|
||||
static plRenderLevel OpaqueRenderLevel() { return plRenderLevel(kOpaqueMajorLevel, kOpaqueMinorLevel); }
|
||||
};
|
||||
|
@ -110,8 +110,8 @@ public:
|
||||
hsVector3 GetUp() const { return *((hsVector3*)&GetWorldToCamera().fMap[1]); }
|
||||
hsVector3 GetAcross() const { return *((hsVector3*)&GetWorldToCamera().fMap[0]); }
|
||||
|
||||
UInt16 GetScreenWidth() const { return fWidth; }
|
||||
UInt16 GetScreenHeight() const { return fHeight; }
|
||||
uint16_t GetScreenWidth() const { return fWidth; }
|
||||
uint16_t GetScreenHeight() const { return fHeight; }
|
||||
|
||||
void GetViewPort(hsPoint2& mins, hsPoint2& maxs) const;
|
||||
void GetViewPort(int& loX, int& loY, int& hiX, int& hiY) const;
|
||||
@ -149,16 +149,16 @@ public:
|
||||
void SetPerspective(hsBool on) { SetOrthogonal(!on); }
|
||||
|
||||
// Next, setting the scree/window/rendertarget size
|
||||
void SetWidth(UInt16 w) { fWidth = w; }
|
||||
void SetHeight(UInt16 h) { fHeight = h; }
|
||||
void SetScreenSize(UInt16 w, UInt16 h) { SetWidth(w); SetHeight(h); }
|
||||
void SetWidth(uint16_t w) { fWidth = w; }
|
||||
void SetHeight(uint16_t h) { fHeight = h; }
|
||||
void SetScreenSize(uint16_t w, uint16_t h) { SetWidth(w); SetHeight(h); }
|
||||
|
||||
// Next, setting the viewport. You only need to do this if you want to use the screen functions above.
|
||||
// If you're passing in and getting out normalized device coordinates, skip this. If you don't set viewport,
|
||||
// Defaults to 0,0,width,height (i.e. the whole screen).
|
||||
void SetViewPort(const hsPoint2& mins, const hsPoint2& maxs, hsBool relative=true);
|
||||
void SetViewPort(float loX, float loY, float hiX, float hiY, hsBool relative=true) { SetViewPort(hsPoint2().Set(loX, loY), hsPoint2().Set(hiX, hiY), relative); }
|
||||
void SetViewPort(UInt16 left, UInt16 top, UInt16 right, UInt16 bottom) { SetViewPort(hsScalar(left), hsScalar(top), hsScalar(right), hsScalar(bottom), false); }
|
||||
void SetViewPort(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) { SetViewPort(hsScalar(left), hsScalar(top), hsScalar(right), hsScalar(bottom), false); }
|
||||
|
||||
void SetMapping(const hsPoint3& mins, const hsPoint3& maxs) { SetMapMin(mins); SetMapMax(maxs); }
|
||||
void SetMapMin(const hsPoint3& mins) { fMapMin = mins; }
|
||||
@ -292,7 +292,7 @@ protected:
|
||||
kViewPortRelative = 0x10
|
||||
};
|
||||
|
||||
mutable UInt32 fFlags;
|
||||
mutable uint32_t fFlags;
|
||||
|
||||
hsMatrix44 fCameraToWorld;
|
||||
hsMatrix44 fWorldToCamera;
|
||||
@ -301,8 +301,8 @@ protected:
|
||||
hsPoint3 fMax; // maxTanX/X, maxTanY/Y, yon
|
||||
|
||||
// Screen (or rendertarget) dimensions in pixels.
|
||||
UInt16 fWidth;
|
||||
UInt16 fHeight;
|
||||
uint16_t fWidth;
|
||||
uint16_t fHeight;
|
||||
|
||||
// Viewport can be stored as fraction of screen size, so the view transform's viewport
|
||||
// can be set up independent of the size of the window it's applied to.
|
||||
@ -334,8 +334,8 @@ protected:
|
||||
void InvalidateTransforms() { ISetFlag(kCameraToNDCSet|kWorldToNDCSet, false); }
|
||||
|
||||
// Flags - generic
|
||||
hsBool IHasFlag(UInt32 f) const { return 0 != (fFlags & f); }
|
||||
void ISetFlag(UInt32 f, hsBool on=true) const { if(on) fFlags |= f; else fFlags &= ~f; }
|
||||
hsBool IHasFlag(uint32_t f) const { return 0 != (fFlags & f); }
|
||||
void ISetFlag(uint32_t f, hsBool on=true) const { if(on) fFlags |= f; else fFlags &= ~f; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -75,7 +75,7 @@ static bool s_options[kNumErrorOptions];
|
||||
AUTO_INIT_FUNC(hsExeErrorInit) {
|
||||
// The critical section has to be initialized
|
||||
// before program startup and never freed
|
||||
static byte rawMemory[sizeof(CCritSect)];
|
||||
static uint8_t rawMemory[sizeof(CCritSect)];
|
||||
s_critsect = new(rawMemory) CCritSect;
|
||||
}
|
||||
#endif
|
||||
|
@ -368,7 +368,7 @@ static int __cdecl CrtAllocHook (
|
||||
AUTO_INIT_FUNC(hsExeMallocInit) {
|
||||
// The critical section has to be initialized
|
||||
// before program startup and never freed
|
||||
static byte rawMemory[sizeof CCritSect];
|
||||
static uint8_t rawMemory[sizeof CCritSect];
|
||||
s_critsect = new(rawMemory) CCritSect;
|
||||
SET_CRT_DEBUG_FIELD(_CRTDBG_LEAK_CHECK_DF);
|
||||
_CrtSetAllocHook(CrtAllocHook);
|
||||
@ -487,7 +487,7 @@ void * MemAlloc (unsigned bytes, unsigned flags, const char file[], int line) {
|
||||
// In debug mode ensure that memory is initialized to some freaky value
|
||||
#ifdef HS_DEBUGGING
|
||||
if (! (flags & kMemZero))
|
||||
MemSet(ptr, (byte) ((unsigned_ptr)ptr >> 4), bytes);
|
||||
MemSet(ptr, (uint8_t) ((uintptr_t)ptr >> 4), bytes);
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -575,14 +575,14 @@ void * MemRealloc (void * ptr, unsigned bytes, unsigned flags, const char file[]
|
||||
* the memory block may be initialized with garbage instead of zeroes, and the
|
||||
* realloc call actually copied that memory.
|
||||
if ((bytes > oldBytes) && (flags & kMemZero))
|
||||
MemZero((byte *)newPtr + oldBytes, bytes - oldBytes);
|
||||
MemZero((uint8_t *)newPtr + oldBytes, bytes - oldBytes);
|
||||
*/
|
||||
ASSERT(!(flags & kMemZero));
|
||||
|
||||
// In debug mode ensure that memory is initialized to some freaky value
|
||||
#ifdef HS_DEBUGGING
|
||||
if ((bytes > oldBytes) && !(flags & kMemZero))
|
||||
MemSet((byte *)newPtr + oldBytes, (byte) ((unsigned_ptr) newPtr >> 4), bytes - oldBytes);
|
||||
MemSet((uint8_t *)newPtr + oldBytes, (uint8_t) ((uintptr_t) newPtr >> 4), bytes - oldBytes);
|
||||
#endif
|
||||
|
||||
return newPtr;
|
||||
|
@ -924,7 +924,7 @@ pfObjectFlocker::~pfObjectFlocker()
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey());
|
||||
}
|
||||
|
||||
void pfObjectFlocker::SetNumBoids(UInt8 val)
|
||||
void pfObjectFlocker::SetNumBoids(uint8_t val)
|
||||
{
|
||||
fNumBoids = val;
|
||||
}
|
||||
@ -979,7 +979,7 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg)
|
||||
return plSingleModifier::MsgReceive(msg);
|
||||
}
|
||||
|
||||
hsBool pfObjectFlocker::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
hsBool pfObjectFlocker::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
{
|
||||
fFlock.Update(fTarget, del);
|
||||
|
||||
|
@ -408,7 +408,7 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
void SetNumBoids(UInt8 val);
|
||||
void SetNumBoids(uint8_t val);
|
||||
void SetBoidKey(plKey key) { fBoidKey = key; }
|
||||
|
||||
float GoalWeight() const {return fFlock.GoalWeight();}
|
||||
@ -448,7 +448,7 @@ protected:
|
||||
hsBool fUseTargetRotation;
|
||||
hsBool fRandomizeAnimationStart;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -145,7 +145,7 @@ void plBlower::IBlow(double secs, hsScalar delSecs)
|
||||
fCurrDel = del;
|
||||
}
|
||||
|
||||
hsBool plBlower::IEval(double secs, hsScalar delSecs, UInt32 dirty)
|
||||
hsBool plBlower::IEval(double secs, hsScalar delSecs, uint32_t dirty)
|
||||
{
|
||||
const hsScalar kMaxDelSecs = 0.1f;
|
||||
if( delSecs > kMaxDelSecs )
|
||||
|
@ -86,7 +86,7 @@ protected:
|
||||
void ISetTargetTransform();
|
||||
void IBlow(double secs, hsScalar delSecs);
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
public:
|
||||
~plBlower();
|
||||
plBlower();
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
kNoNothing = kNoRotation | kNoMove
|
||||
};
|
||||
protected:
|
||||
UInt32 fFilterMask;
|
||||
uint32_t fFilterMask;
|
||||
hsMatrix44 fRefParentLocalToWorld;
|
||||
|
||||
virtual void IRecalcTransforms();
|
||||
@ -73,8 +73,8 @@ public:
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
|
||||
void SetFilterMask(UInt32 f) { fFilterMask = f; }
|
||||
UInt32 GetFilterMask() const { return fFilterMask; }
|
||||
void SetFilterMask(uint32_t f) { fFilterMask = f; }
|
||||
uint32_t GetFilterMask() const { return fFilterMask; }
|
||||
|
||||
void SetRefLocalToWorld(const hsMatrix44& m) { fRefParentLocalToWorld = m; }
|
||||
const hsMatrix44& GetRefLocalToWorld() const { return fRefParentLocalToWorld; }
|
||||
|
@ -218,7 +218,7 @@ void plFollowMod::IMoveTarget()
|
||||
GetTarget()->SetTransform(l2w, w2l);
|
||||
}
|
||||
|
||||
hsBool plFollowMod::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
hsBool plFollowMod::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
{
|
||||
if( ICheckLeader() )
|
||||
IMoveTarget();
|
||||
|
@ -76,8 +76,8 @@ public:
|
||||
};
|
||||
protected:
|
||||
FollowLeaderType fLeaderType;
|
||||
UInt8 fMode;
|
||||
UInt8 fLeaderSet;
|
||||
uint8_t fMode;
|
||||
uint8_t fLeaderSet;
|
||||
|
||||
plSceneObject* fLeader; // may be nil if Leader isn't a sceneobject
|
||||
|
||||
@ -87,7 +87,7 @@ protected:
|
||||
hsBool ICheckLeader();
|
||||
void IMoveTarget();
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
|
||||
public:
|
||||
plFollowMod();
|
||||
@ -106,8 +106,8 @@ public:
|
||||
void SetType(FollowLeaderType t) { fLeaderType = t; }
|
||||
FollowLeaderType GetType() const { return fLeaderType; }
|
||||
|
||||
void SetMode(UInt8 m) { fMode = m; }
|
||||
UInt8 GetMode() const { return fMode; }
|
||||
void SetMode(uint8_t m) { fMode = m; }
|
||||
uint8_t GetMode() const { return fMode; }
|
||||
|
||||
void Activate();
|
||||
void Deactivate();
|
||||
|
@ -165,10 +165,10 @@ void plLineFollowMod::Read(hsStream* stream, hsResMgr* mgr)
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefStereizer), plRefFlags::kPassiveRef);
|
||||
}
|
||||
|
||||
UInt32 f = stream->ReadLE32();
|
||||
uint32_t f = stream->ReadLE32();
|
||||
SetFollowMode(FollowMode(f & 0xffff));
|
||||
|
||||
fFollowFlags = (UInt16)((f >> 16) & 0xffff);
|
||||
fFollowFlags = (uint16_t)((f >> 16) & 0xffff);
|
||||
|
||||
if( fFollowFlags & kOffset )
|
||||
{
|
||||
@ -203,7 +203,7 @@ void plLineFollowMod::Write(hsStream* stream, hsResMgr* mgr)
|
||||
for( i = 0; i < fStereizers.GetCount(); i++ )
|
||||
mgr->WriteKey(stream, fStereizers[i]->GetKey());
|
||||
|
||||
UInt32 f = UInt32(fFollowMode) | (UInt32(fFollowFlags) << 16);
|
||||
uint32_t f = uint32_t(fFollowMode) | (uint32_t(fFollowFlags) << 16);
|
||||
stream->WriteLE32(f);
|
||||
|
||||
if( fFollowFlags & kOffset )
|
||||
@ -337,7 +337,7 @@ void plLineFollowMod::IRegister()
|
||||
}
|
||||
}
|
||||
|
||||
hsBool plLineFollowMod::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
hsBool plLineFollowMod::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
{
|
||||
if( !fPath )
|
||||
return false;
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
};
|
||||
protected:
|
||||
FollowMode fFollowMode;
|
||||
UInt16 fFollowFlags;
|
||||
uint16_t fFollowFlags;
|
||||
|
||||
plAnimPath* fPath;
|
||||
plSceneObject* fPathParent;
|
||||
@ -97,7 +97,7 @@ protected:
|
||||
hsScalar fOffsetClamp;
|
||||
hsScalar fSpeedClamp;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
|
||||
virtual hsBool IGetSearchPos();
|
||||
virtual void ISetTargetTransform(int iTarg, const hsMatrix44& tgtXfm);
|
||||
|
@ -66,11 +66,11 @@ protected:
|
||||
|
||||
// These are only lightly synched, the only synched state is whether
|
||||
// they are currently active.
|
||||
UInt8 fState;
|
||||
uint8_t fState;
|
||||
|
||||
hsBitVector fExcluded;
|
||||
Int8 fCurrent;
|
||||
UInt8 fMode; // static, if it becomes dynamic, move to SynchedValue
|
||||
int8_t fCurrent;
|
||||
uint8_t fMode; // static, if it becomes dynamic, move to SynchedValue
|
||||
hsTArray<double> fEndTimes;
|
||||
|
||||
hsScalar fMinDelay;
|
||||
@ -94,7 +94,7 @@ protected:
|
||||
virtual void IPlayNext() = 0;
|
||||
|
||||
// We only act in response to messages.
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; }
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; }
|
||||
|
||||
public:
|
||||
plRandomCommandMod();
|
||||
@ -109,11 +109,11 @@ public:
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
// Export only
|
||||
void SetMode(UInt8 m) { fMode = m; }
|
||||
UInt8 GetMode() const { return fMode; }
|
||||
void SetMode(uint8_t m) { fMode = m; }
|
||||
uint8_t GetMode() const { return fMode; }
|
||||
|
||||
void SetState(UInt8 s) { fState = s; }
|
||||
UInt8 GetState() const { return fState; }
|
||||
void SetState(uint8_t s) { fState = s; }
|
||||
uint8_t GetState() const { return fState; }
|
||||
|
||||
void SetMinDelay(hsScalar f) { fMinDelay = f; }
|
||||
hsScalar GetMinDelay() const { return fMinDelay; }
|
||||
|
@ -119,7 +119,7 @@ hsBool plStereizer::MsgReceive(plMessage* msg)
|
||||
return plSingleModifier::MsgReceive(msg);
|
||||
}
|
||||
|
||||
hsBool plStereizer::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
hsBool plStereizer::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ protected:
|
||||
hsVector3 fListDirection;
|
||||
hsVector3 fListUp;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
|
||||
hsPoint3 IGetLocalizedPos(const hsVector3& posToList, hsScalar distToList) const;
|
||||
hsPoint3 IGetAmbientPos() const;
|
||||
|
@ -129,7 +129,7 @@ void plViewFaceModifier::SetTarget(plSceneObject* so)
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plArmatureUpdateMsg::Index(), GetKey());
|
||||
}
|
||||
|
||||
hsBool plViewFaceModifier::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
hsBool plViewFaceModifier::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ protected:
|
||||
hsBounds3Ext fMaxBounds;
|
||||
|
||||
virtual hsBool IFacePoint(plPipeline* pipe, const hsPoint3& at);
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
|
||||
enum RefType
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
hsBool plListener::fPrintDbgInfo = false;
|
||||
|
||||
hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
hsBool plListener::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
{
|
||||
// if (!plgAudioSys::Active())
|
||||
// return true;
|
||||
@ -69,7 +69,7 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
|
||||
int y = 16 + 12, x = 400;
|
||||
if( fPrintDbgInfo )
|
||||
plDebugText::Instance().DrawString( x, 16, "Listener:", (UInt32)0xffffffff, plDebugText::kStyleBold );
|
||||
plDebugText::Instance().DrawString( x, 16, "Listener:", (uint32_t)0xffffffff, plDebugText::kStyleBold );
|
||||
|
||||
// Get the avatar's SceneObject
|
||||
plKey key = plNetClientMgr::GetInstance()->GetLocalPlayerKey();
|
||||
@ -80,7 +80,7 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
{
|
||||
// We don't have a position to init by, so do NOT eval yet!!!
|
||||
if( fPrintDbgInfo )
|
||||
plDebugText::Instance().DrawString( x, y, "Not eval-ing yet", (UInt32)0xffffffff );
|
||||
plDebugText::Instance().DrawString( x, y, "Not eval-ing yet", (uint32_t)0xffffffff );
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
if( facingType == kInvalid || posType == kInvalid || velType == kInvalid )
|
||||
{
|
||||
if( fPrintDbgInfo )
|
||||
plDebugText::Instance().DrawString( x, y, "Not eval-ing: missing one or more parameter bases", (UInt32)0xff0000ff );
|
||||
plDebugText::Instance().DrawString( x, y, "Not eval-ing: missing one or more parameter bases", (uint32_t)0xff0000ff );
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -184,19 +184,19 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
{
|
||||
char str[ 256 ];
|
||||
sprintf( str, "Direction: (%3.2f,%3.2f,%3.2f) from %s", dir.fX, dir.fY, dir.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName() : "VCam" );
|
||||
plDebugText::Instance().DrawString( x, y, str, (UInt32)0xffffffff );
|
||||
plDebugText::Instance().DrawString( x, y, str, (uint32_t)0xffffffff );
|
||||
y += 12;
|
||||
|
||||
sprintf( str, "Up: (%3.2f,%3.2f,%3.2f) from %s", up.fX, up.fY, up.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName() : "VCam" );
|
||||
plDebugText::Instance().DrawString( x, y, str, (UInt32)0xffffffff );
|
||||
plDebugText::Instance().DrawString( x, y, str, (uint32_t)0xffffffff );
|
||||
y += 12;
|
||||
|
||||
sprintf( str, "Position: (%3.2f,%3.2f,%3.2f) from %s", position.fX, position.fY, position.fZ, ( posType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName() : "VCam" );
|
||||
plDebugText::Instance().DrawString( x, y, str, (UInt32)0xffffffff );
|
||||
plDebugText::Instance().DrawString( x, y, str, (uint32_t)0xffffffff );
|
||||
y += 12;
|
||||
|
||||
sprintf( str, "Velocity: (%3.2f,%3.2f,%3.2f) from %s", velocity.fX, velocity.fY, velocity.fZ, ( velType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName() : "VCam" );
|
||||
plDebugText::Instance().DrawString( x, y, str, (UInt32)0xffffffff );
|
||||
plDebugText::Instance().DrawString( x, y, str, (uint32_t)0xffffffff );
|
||||
y += 12;
|
||||
}
|
||||
plgDispatch::MsgSend( msg );
|
||||
|
@ -63,9 +63,9 @@ public:
|
||||
static void ShowDebugInfo( hsBool s ) { fPrintDbgInfo = s; }
|
||||
|
||||
// Get info for which object these things are attached to - camera or refObject
|
||||
UInt8 GetAttachedPosType() { return (UInt8)fPosRatio; }
|
||||
UInt8 GetAttachedFacingType() { return (UInt8)fFacingRatio; }
|
||||
UInt8 GetAttachedVelType() { return (UInt8)fVelRatio; }
|
||||
uint8_t GetAttachedPosType() { return (uint8_t)fPosRatio; }
|
||||
uint8_t GetAttachedFacingType() { return (uint8_t)fFacingRatio; }
|
||||
uint8_t GetAttachedVelType() { return (uint8_t)fVelRatio; }
|
||||
|
||||
enum
|
||||
{
|
||||
@ -88,7 +88,7 @@ protected:
|
||||
|
||||
static hsBool fPrintDbgInfo;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
void ISetRef( const plKey &ref, hsBool binding, int type );
|
||||
void ICheckAudio( void ) const;
|
||||
|
||||
|
@ -66,7 +66,7 @@ void plRandomSoundModGroup::Read(hsStream *s)
|
||||
{
|
||||
fNumSounds = s->ReadLE16();
|
||||
fGroupedIdx = s->ReadLE16();
|
||||
fIndices = TRACKED_NEW UInt16[fNumSounds];
|
||||
fIndices = TRACKED_NEW uint16_t[fNumSounds];
|
||||
|
||||
int i;
|
||||
for (i = 0; i < fNumSounds; i++)
|
||||
@ -127,7 +127,7 @@ void plRandomSoundMod::IStop()
|
||||
else
|
||||
{
|
||||
if(fCurrent == -1) return;
|
||||
UInt16 currentSndIdx = ( fGroups != nil ) ? fGroups[fCurrentGroup].fIndices[fCurrent] : fActiveList[fCurrent];
|
||||
uint16_t currentSndIdx = ( fGroups != nil ) ? fGroups[fCurrentGroup].fIndices[fCurrent] : fActiveList[fCurrent];
|
||||
plSoundMsg* snd = TRACKED_NEW plSoundMsg(GetKey(), GetTarget()->GetKey(), nil);
|
||||
snd->SetCmd(plSoundMsg::kStop);
|
||||
snd->fIndex = currentSndIdx;
|
||||
@ -151,7 +151,7 @@ void plRandomSoundMod::IPlayNext()
|
||||
}
|
||||
|
||||
int i;
|
||||
UInt16 currentSndIdx;
|
||||
uint16_t currentSndIdx;
|
||||
int nSounds = (fGroups == nil ? ai->GetNumSounds() : fGroups[fCurrentGroup].fNumSounds);
|
||||
fEndTimes.ExpandAndZero(nSounds);
|
||||
plSound *pSound = nil;
|
||||
@ -276,7 +276,7 @@ void plRandomSoundMod::IPlayNext()
|
||||
}
|
||||
}
|
||||
|
||||
void plRandomSoundMod::SetCurrentGroup(UInt16 group)
|
||||
void plRandomSoundMod::SetCurrentGroup(uint16_t group)
|
||||
{
|
||||
hsAssert(group < fNumGroups, "Setting an invalid group on a random sound modifier");
|
||||
|
||||
@ -319,7 +319,7 @@ void plRandomSoundMod::Write(hsStream *s, hsResMgr *mgr)
|
||||
|
||||
void plRandomSoundMod::ForceSoundLoadState( hsBool loaded )
|
||||
{
|
||||
UInt16 i, j;
|
||||
uint16_t i, j;
|
||||
|
||||
plAudioInterface* ai = IGetTargetAudioInterface(0);
|
||||
if( ai == nil )
|
||||
|
@ -51,10 +51,10 @@ class plRandomSoundModGroup
|
||||
{
|
||||
public:
|
||||
hsBitVector fExcluded;
|
||||
Int8 fCurrent;
|
||||
UInt16 fNumSounds;
|
||||
UInt16 *fIndices;
|
||||
Int16 fGroupedIdx; // Only used if we point to a groupedSound, in which case fIndices are indices into
|
||||
int8_t fCurrent;
|
||||
uint16_t fNumSounds;
|
||||
uint16_t *fIndices;
|
||||
int16_t fGroupedIdx; // Only used if we point to a groupedSound, in which case fIndices are indices into
|
||||
// that sound. -1 if unused.
|
||||
|
||||
plRandomSoundModGroup();
|
||||
@ -67,10 +67,10 @@ public:
|
||||
class plRandomSoundMod : public plRandomCommandMod
|
||||
{
|
||||
protected:
|
||||
UInt16 fCurrentGroup;
|
||||
UInt16 fNumGroups;
|
||||
uint16_t fCurrentGroup;
|
||||
uint16_t fNumGroups;
|
||||
plRandomSoundModGroup *fGroups;
|
||||
std::vector<UInt16> fActiveList; // list of sounds we're allowed to choose
|
||||
std::vector<uint16_t> fActiveList; // list of sounds we're allowed to choose
|
||||
int fOldPriority; // old sound priority
|
||||
hsBool fFirstTimePlay;
|
||||
|
||||
@ -91,14 +91,14 @@ public:
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
void SetCurrentGroup(UInt16 group);
|
||||
void SetCurrentGroup(uint16_t group);
|
||||
|
||||
void ForceSoundLoadState( hsBool loaded );
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
float GetVolume();
|
||||
|
||||
// EXPORT ONLY
|
||||
void SetGroupInfo(UInt16 numGroups, plRandomSoundModGroup *groups) { fNumGroups = numGroups; fGroups = groups; }
|
||||
void SetGroupInfo(uint16_t numGroups, plRandomSoundModGroup *groups) { fNumGroups = numGroups; fGroups = groups; }
|
||||
};
|
||||
|
||||
#endif // plRandomSoundMod_inc
|
||||
|
@ -74,7 +74,7 @@ plKey plCameraProxy::IGetNode() const
|
||||
return nil;
|
||||
}
|
||||
|
||||
plDrawableSpans* plCameraProxy::ICreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo)
|
||||
plDrawableSpans* plCameraProxy::ICreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo)
|
||||
{
|
||||
if( fOwner )
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ protected:
|
||||
plVirtualCam1* fOwner;
|
||||
|
||||
|
||||
virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo=nil);
|
||||
virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo=nil);
|
||||
virtual plKey IGetNode() const;
|
||||
public:
|
||||
plCameraProxy();
|
||||
|
@ -362,7 +362,7 @@ public:
|
||||
kCircleLocalAvatar = 0x40,
|
||||
};
|
||||
protected:
|
||||
UInt32 fCircleFlags;
|
||||
uint32_t fCircleFlags;
|
||||
hsPoint3 fCenter;
|
||||
plSceneObject* fCenterObject; // optional, use instead of fCenter
|
||||
hsScalar fRadius;
|
||||
@ -386,14 +386,14 @@ public:
|
||||
virtual void Update(hsBool forced = false);
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
UInt32 GetCircleFlags() { return fCircleFlags; }
|
||||
uint32_t GetCircleFlags() { return fCircleFlags; }
|
||||
hsPoint3* GetCenter() { return &fCenter; } // use GetCenterPoint
|
||||
hsPoint3 GetCenterPoint();
|
||||
hsScalar GetRadius() { return fRadius; }
|
||||
plSceneObject* GetCenterObject() { return fCenterObject; }
|
||||
|
||||
void SetCircumferencePerSec(hsScalar h) { fCirPerSec = h; }
|
||||
void SetCircleFlags(UInt32 f) { fCircleFlags|=f; }
|
||||
void SetCircleFlags(uint32_t f) { fCircleFlags|=f; }
|
||||
void SetCenter(hsPoint3* ctr) { fCenter = *ctr; } // Circle lies in the plane z = ctr->z
|
||||
void SetRadius(hsScalar radius) { fRadius = radius; }
|
||||
void SetFarCircleCam(hsBool farType) { if (farType) fCircleFlags |= kFarthest; else fCircleFlags &= ~kFarthest; }
|
||||
|
@ -96,7 +96,7 @@ class plCameraModifier1 : public plSingleModifier
|
||||
protected:
|
||||
|
||||
void Output();
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; }
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; }
|
||||
|
||||
public:
|
||||
|
||||
|
@ -56,7 +56,7 @@ hsScalar plInterestingModifier::fInterestRadius = 100.0f;
|
||||
hsScalar plInterestingModifier::fInterestWeight = 1.0f;
|
||||
|
||||
|
||||
hsBool plInterestingModifier::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
hsBool plInterestingModifier::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
{
|
||||
for (int i=0; i < GetNumTargets(); i++)
|
||||
{
|
||||
|
@ -61,13 +61,13 @@ protected:
|
||||
kTypeLookAtMod,
|
||||
};
|
||||
|
||||
UInt8 fType;
|
||||
uint8_t fType;
|
||||
hsScalar fView;
|
||||
|
||||
static hsScalar fInterestRadius;
|
||||
static hsScalar fInterestWeight;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
|
||||
public:
|
||||
plInterestingModifier(){ fType = kTypeInteresting;}
|
||||
@ -86,8 +86,8 @@ public:
|
||||
|
||||
virtual void AddTarget(plSceneObject* so);
|
||||
|
||||
void SetType(UInt8 type) { fType = type; }
|
||||
UInt8 GetType() { return fType; }
|
||||
void SetType(uint8_t type) { fType = type; }
|
||||
uint8_t GetType() { return fType; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -186,7 +186,7 @@ plVirtualCam1::plVirtualCam1()
|
||||
// only open log file if logging is on
|
||||
if ( !plStatusLog::fLoggingOff )
|
||||
{
|
||||
wchar fileAndPath[MAX_PATH];
|
||||
wchar_t fileAndPath[MAX_PATH];
|
||||
PathGetLogDirectory(fileAndPath, arrsize(fileAndPath));
|
||||
PathAddFilename(fileAndPath, fileAndPath, L"camLog.txt", arrsize(fileAndPath));
|
||||
foutLog = _wfopen( fileAndPath, L"wt" );
|
||||
@ -490,7 +490,7 @@ void plVirtualCam1::ICreatePlate()
|
||||
plMipmap *ourMip = fEffectPlate->CreateMaterial( 16, 16, true );
|
||||
for( y = 0; y < ourMip->GetHeight(); y++ )
|
||||
{
|
||||
UInt32 *pixels = ourMip->GetAddr32( 0, y );
|
||||
uint32_t *pixels = ourMip->GetAddr32( 0, y );
|
||||
for( x = 0; x < ourMip->GetWidth(); x++ )
|
||||
pixels[ x ] = 0xff000000;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pfMarkerMgr* pfMarkerMgr::fInstance = nil;
|
||||
const UInt32 pfMarkerMgr::kNoMarkerSelected = (UInt32)(-1);
|
||||
const uint32_t pfMarkerMgr::kNoMarkerSelected = (uint32_t)(-1);
|
||||
|
||||
pfMarkerMgr* pfMarkerMgr::Instance()
|
||||
{
|
||||
@ -99,7 +99,7 @@ void pfMarkerMgr::IInit()
|
||||
|
||||
void pfMarkerMgr::IShutdown()
|
||||
{
|
||||
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
std::map<uint32_t, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
while (curMarker != fMarkers.end())
|
||||
{
|
||||
curMarker->second->Remove();
|
||||
@ -112,9 +112,9 @@ void pfMarkerMgr::IShutdown()
|
||||
UnRegisterAs(kMarkerMgr_KEY);
|
||||
}
|
||||
|
||||
pfMarkerInfo* pfMarkerMgr::IFindMarker(plKey markerKey, UInt32& id)
|
||||
pfMarkerInfo* pfMarkerMgr::IFindMarker(plKey markerKey, uint32_t& id)
|
||||
{
|
||||
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
std::map<uint32_t, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
while (curMarker != fMarkers.end())
|
||||
{
|
||||
if (curMarker->second->GetKey() == markerKey)
|
||||
@ -131,7 +131,7 @@ pfMarkerInfo* pfMarkerMgr::IFindMarker(plKey markerKey, UInt32& id)
|
||||
void pfMarkerMgr::IUpdate()
|
||||
{
|
||||
// Update all markers
|
||||
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
std::map<uint32_t, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
while (curMarker != fMarkers.end())
|
||||
{
|
||||
curMarker->second->Update(hsTimer::GetSeconds());
|
||||
@ -145,7 +145,7 @@ void pfMarkerMgr::IMarkerHit(plKey markerKey, plKey playerKey)
|
||||
return; // not the local player, abort
|
||||
|
||||
// make sure the marker isn't frozen
|
||||
UInt32 id;
|
||||
uint32_t id;
|
||||
pfMarkerInfo* hitMarker = IFindMarker(markerKey, id);
|
||||
if (!hitMarker)
|
||||
return; // abort, something weird is going on
|
||||
@ -159,7 +159,7 @@ void pfMarkerMgr::IMarkerHit(plKey markerKey, plKey playerKey)
|
||||
msg->Send();
|
||||
}
|
||||
|
||||
void pfMarkerMgr::AddMarker(double x, double y, double z, UInt32 id, bool justCreated)
|
||||
void pfMarkerMgr::AddMarker(double x, double y, double z, uint32_t id, bool justCreated)
|
||||
{
|
||||
if (fMarkers.find(id) != fMarkers.end())
|
||||
{
|
||||
@ -173,7 +173,7 @@ void pfMarkerMgr::AddMarker(double x, double y, double z, UInt32 id, bool justCr
|
||||
fMarkers[id]->Spawn(pfMarkerInfo::kMarkerOpen);
|
||||
}
|
||||
|
||||
void pfMarkerMgr::RemoveMarker(UInt32 id)
|
||||
void pfMarkerMgr::RemoveMarker(uint32_t id)
|
||||
{
|
||||
if (fMarkers.find(id) == fMarkers.end())
|
||||
return;
|
||||
@ -184,7 +184,7 @@ void pfMarkerMgr::RemoveMarker(UInt32 id)
|
||||
|
||||
void pfMarkerMgr::RemoveAllMarkers()
|
||||
{
|
||||
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
std::map<uint32_t, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
while (curMarker != fMarkers.end())
|
||||
{
|
||||
curMarker->second->Remove();
|
||||
@ -204,7 +204,7 @@ void pfMarkerMgr::ClearSelectedMarker()
|
||||
}
|
||||
}
|
||||
|
||||
void pfMarkerMgr::SetSelectedMarker(UInt32 id)
|
||||
void pfMarkerMgr::SetSelectedMarker(uint32_t id)
|
||||
{
|
||||
ClearSelectedMarker();
|
||||
|
||||
@ -218,13 +218,13 @@ void pfMarkerMgr::SetSelectedMarker(UInt32 id)
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 pfMarkerMgr::GetSelectedMarker()
|
||||
uint32_t pfMarkerMgr::GetSelectedMarker()
|
||||
{
|
||||
return fSelectedMarker;
|
||||
}
|
||||
|
||||
// for QUEST games (no teams)
|
||||
void pfMarkerMgr::CaptureMarker(UInt32 id, bool captured)
|
||||
void pfMarkerMgr::CaptureMarker(uint32_t id, bool captured)
|
||||
{
|
||||
if (fMarkers.find(id) == fMarkers.end())
|
||||
return;
|
||||
@ -239,7 +239,7 @@ void pfMarkerMgr::CaptureMarker(UInt32 id, bool captured)
|
||||
}
|
||||
|
||||
// for TEAM games (0 = not captured)
|
||||
void pfMarkerMgr::CaptureMarker(UInt32 id, int team)
|
||||
void pfMarkerMgr::CaptureMarker(uint32_t id, int team)
|
||||
{
|
||||
if (fMarkers.find(id) == fMarkers.end())
|
||||
return;
|
||||
@ -263,13 +263,13 @@ void pfMarkerMgr::LocalShowMarkers(bool show)
|
||||
fShowingLocalMarkers = show;
|
||||
if (show)
|
||||
{
|
||||
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
std::map<uint32_t, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
while (curMarker != fMarkers.end())
|
||||
curMarker->second->Show(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
std::map<uint32_t, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
|
||||
while (curMarker != fMarkers.end())
|
||||
curMarker->second->Show(false);
|
||||
}
|
||||
@ -317,7 +317,7 @@ hsBool pfMarkerMgr::MsgReceive(plMessage* msg)
|
||||
plKey cloneKey = cloneMsg->GetCloneKey();
|
||||
if (cloneMsg->GetIsLoading() && cloneKey)
|
||||
{
|
||||
UInt32 id;
|
||||
uint32_t id;
|
||||
pfMarkerInfo* marker = IFindMarker(cloneKey, id);
|
||||
marker->InitSpawned(cloneKey);
|
||||
}
|
||||
|
@ -68,14 +68,14 @@ protected:
|
||||
|
||||
bool fShowingLocalMarkers;
|
||||
bool fMarkersRespawn;
|
||||
UInt32 fSelectedMarker;
|
||||
static const UInt32 kNoMarkerSelected;
|
||||
std::map<UInt32, pfMarkerInfo*> fMarkers; // key is marker id number
|
||||
uint32_t fSelectedMarker;
|
||||
static const uint32_t kNoMarkerSelected;
|
||||
std::map<uint32_t, pfMarkerInfo*> fMarkers; // key is marker id number
|
||||
|
||||
void IInit();
|
||||
void IShutdown();
|
||||
|
||||
pfMarkerInfo* IFindMarker(plKey markerKey, UInt32& id);
|
||||
pfMarkerInfo* IFindMarker(plKey markerKey, uint32_t& id);
|
||||
void IUpdate();
|
||||
void IMarkerHit(plKey markerKey, plKey playerKey);
|
||||
|
||||
@ -91,19 +91,19 @@ public:
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void AddMarker(double x, double y, double z, UInt32 id, bool justCreated);
|
||||
void RemoveMarker(UInt32 id);
|
||||
void AddMarker(double x, double y, double z, uint32_t id, bool justCreated);
|
||||
void RemoveMarker(uint32_t id);
|
||||
void RemoveAllMarkers();
|
||||
|
||||
void ClearSelectedMarker();
|
||||
void SetSelectedMarker(UInt32 id);
|
||||
UInt32 GetSelectedMarker();
|
||||
void SetSelectedMarker(uint32_t id);
|
||||
uint32_t GetSelectedMarker();
|
||||
|
||||
void SetMarkersRespawn(bool respawn) {fMarkersRespawn = respawn;}
|
||||
bool GetMarkersRespawn() {return fMarkersRespawn;}
|
||||
|
||||
void CaptureMarker(UInt32 id, bool captured); // for QUEST games (no teams)
|
||||
void CaptureMarker(UInt32 id, int team); // for TEAM games (0 = not captured)
|
||||
void CaptureMarker(uint32_t id, bool captured); // for QUEST games (no teams)
|
||||
void CaptureMarker(uint32_t id, int team); // for TEAM games (0 = not captured)
|
||||
|
||||
// Shows your markers locally, so you can see where they are
|
||||
void LocalShowMarkers(bool show = true);
|
||||
|
@ -277,7 +277,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
//hsPoint3 forceRight(-200,0,0);
|
||||
//hsPoint3 forceUp(0,0,15);
|
||||
//
|
||||
//hsBool plPlayerModifier::IEval(double secs, hsScalar del, UInt32 dirty)
|
||||
//hsBool plPlayerModifier::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
//{
|
||||
// // setup for local player if necessary
|
||||
// if (HasFlag(kNeedsLocalSetup))
|
||||
|
@ -129,7 +129,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// virtual void RemoveTarget(plSceneObject* so);
|
||||
//
|
||||
// hsBool HandleControlInput(plControlEventMsg* pMsg);
|
||||
// virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
|
||||
// virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
//
|
||||
// void SetMoving(hsBool b);
|
||||
// hsBool IsMoving() { return bMoving; }
|
||||
|
@ -78,7 +78,7 @@ void plControlEventConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
void plControlEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
stream->WriteLE32((UInt32)fControlEvent);
|
||||
stream->WriteLE32((uint32_t)fControlEvent);
|
||||
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ void plKeyPressConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
void plKeyPressConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
stream->WriteLE32((UInt32)fKeyEvent);
|
||||
stream->WriteLE32((uint32_t)fKeyEvent);
|
||||
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user