64-bit fixes

Switch all the (u)long types to (u)int32_t where appropriate.
This commit is contained in:
GravisZro 2024-05-22 11:11:33 -04:00
parent 60cb3a042f
commit dec9de7456
78 changed files with 243 additions and 223 deletions

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdint>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -23,7 +24,7 @@
#include "mono.h"
#include "Aencode.h"
long aenc_ReadSamp(void *data) {
int32_t aenc_ReadSamp(void *data) {
FILE *f = (FILE *)data;
int a, b;
a = getc(f);
@ -33,13 +34,13 @@ long aenc_ReadSamp(void *data) {
b = getc(f);
if (b == EOF)
return ReadSampleEof;
return (short)((b << 8) + a);
return (b << 8) | a;
}
int aenc_Compress(char *input_filename, char *output_filename, int *input_levels, int *input_samples, int *input_rate,
bool aenc_Compress(char *input_filename, char *output_filename, int *input_levels, int *input_samples, int *input_rate,
int *input_channels, float *input_factor, float *input_volscale) {
FILE *in, *out;
long result;
int32_t result;
int levels, samples_per_subband;
unsigned sample_rate, channels;
@ -50,7 +51,7 @@ int aenc_Compress(char *input_filename, char *output_filename, int *input_levels
in = fopen(input_filename, "rb");
if (!in) {
mprintf((0, "AENC: Unable to open %s for input.\n", input_filename));
return 0;
return false;
}
if (input_levels) {
@ -114,7 +115,9 @@ int aenc_Compress(char *input_filename, char *output_filename, int *input_levels
unsigned subbands = (2048 / samples_per_subband) >> 1;
for (levels = 0; subbands; subbands >>= 1, ++levels)
;
{
}
}
if (!sample_rate_set)
@ -129,7 +132,7 @@ int aenc_Compress(char *input_filename, char *output_filename, int *input_levels
out = fopen(output_filename, "wb");
if (!out) {
mprintf((0, "AENC: Unable to open %s for output.\n", output_filename));
return 0;
return false;
}
result = AudioEncode(aenc_ReadSamp, in, channels, sample_rate, volume_scale, out, levels, samples_per_subband,
@ -138,5 +141,5 @@ int aenc_Compress(char *input_filename, char *output_filename, int *input_levels
fclose(out);
fclose(in);
return 1;
return result > 0;
}

View File

@ -931,7 +931,7 @@ int frames_one_second = 0;
int min_one_second = 0x7fffffff;
int max_one_second = 0;
longlong last_timer = 0;
int64_t last_timer = 0;
// contains information for the music system.
tMusicSeqInfo Game_music_info;
@ -2752,7 +2752,7 @@ unsigned int Frames_counted = 0;
// Compute how long last frame took
void CalcFrameTime(void) {
longlong current_timer;
int64_t current_timer;
if (timer_paused)
return;
@ -3108,7 +3108,7 @@ void GameFrame(void) {
// float start_delay = timer_GetTime();
// Slow down the game if the user asked us to
longlong current_timer;
int64_t current_timer;
unsigned int sleeptime;
current_timer = timer_GetMSTime();
if ((current_timer - last_timer) < Min_allowed_frametime) {

View File

@ -883,7 +883,7 @@ void ListenDedicatedSocket(void) {
#endif
if (!Dedicated_allow_remote) {
// Check to see if this came in from the local address
unsigned long localhost = inet_addr("127.0.0.1");
uint32_t localhost = inet_addr("127.0.0.1");
if (memcmp(&localhost, &conn_addr.sin_addr, sizeof(localhost)) != 0) {
mprintf((0, "Rejecting connection from remote host!\n"));
PrintDedicatedMessage(TXT_DS_REJECTREMOTE, inet_ntoa(conn_addr.sin_addr));

View File

@ -1094,7 +1094,7 @@ void SGSObjects(CFILE *fp) {
// data universal to all objects that need to be saved.
gs_WriteShort(fp, (short)op->id);
gs_WriteInt(fp, (long)op->flags);
gs_WriteInt(fp, static_cast<int32_t>(op->flags));
gs_WriteByte(fp, (sbyte)op->control_type);
gs_WriteByte(fp, (sbyte)op->movement_type);
gs_WriteByte(fp, (sbyte)op->render_type);

View File

@ -26,7 +26,7 @@ extern "C" {
#endif
AudioDecoder *Create_AudioDecoder(ReadFunction *reader, void *data, unsigned *pChannels, unsigned *pSampleRate,
long *pSampleCount) {
int32_t *pSampleCount) {
return (AudioDecoder *)mem_malloc(sizeof(AudioDecoder));
}

View File

@ -322,7 +322,7 @@
#define BM_FILETYPE_IFF 3
int Num_of_bitmaps = 0;
bms_bitmap GameBitmaps[MAX_BITMAPS];
ulong Bitmap_memory_used = 0;
uint32_t Bitmap_memory_used = 0;
ubyte Bitmaps_initted = 0;
/* modify these lines to establish data type */
typedef bms_bitmap *bm_T; /* type of item to be stored */

View File

@ -117,7 +117,7 @@ short iff_has_transparency; // 0=no transparency, 1=iff_transparent_color is val
#define MIN(a, b) ((a < b) ? a : b)
#define MAKE_SIG(a, b, c, d) (((long)(a) << 24) + ((long)(b) << 16) + ((c) << 8) + (d))
#define MAKE_SIG(a, b, c, d) (((int32_t)(a) << 24) + ((int32_t)(b) << 16) + ((c) << 8) + (d))
#define IFF_SIG_FORM 1
#define IFF_SIG_ILBM 2
@ -307,7 +307,7 @@ void bm_iff_skip_chunk(CFILE *ifile, uint len) {
int bm_iff_parse_delta(CFILE *ifile, int len, iff_bitmap_header *bmheader) {
unsigned char *p = bmheader->raw_data;
int y;
long chunk_end = cftell(ifile) + len;
int32_t chunk_end = cftell(ifile) + len;
cf_ReadInt(ifile); // longword, seems to be equal to 4. Don't know what it is
@ -555,8 +555,8 @@ int bm_iff_read_animbrush(const char *ifilename, int *bm_list) {
CFILE *ifile;
iff_bitmap_header bm_headers[40];
iff_bitmap_header *temp_bm_head;
long sig, form_len;
long form_type;
int32_t sig, form_len;
int32_t form_type;
int num_bitmaps = 0;
int ret, i;

View File

@ -34,6 +34,7 @@
* $NoKeywords: $
*/
#include <cstdint>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -136,8 +137,8 @@ void CZip::OutputBit(BITFILE *bfile, int bit) {
}
}
void CZip::OutputBits(BITFILE *bfile, ulong code, int count) {
ulong mask;
void CZip::OutputBits(BITFILE *bfile, uint32_t code, int count) {
uint32_t mask;
mask = 1L << (count - 1);
while (mask != 0) {
if (mask & code)
@ -171,9 +172,9 @@ int CZip::InputBit(BITFILE *bfile) {
return (value ? 1 : 0);
}
ulong CZip::InputBits(BITFILE *bfile, int bitcount) {
ulong mask;
ulong return_value;
uint32_t CZip::InputBits(BITFILE *bfile, int bitcount) {
uint32_t mask;
uint32_t return_value;
mask = 1L << (bitcount - 1);
return_value = 0;

View File

@ -142,8 +142,8 @@ void CZip::ha_InitializeTree(tHATree *tree) {
}
void CZip::ha_EncodeSymbol(tHATree *tree, uint c, BITFILE *output) {
ulong code;
ulong current_bit;
uint32_t code;
uint32_t current_bit;
int code_size;
int current_node;
@ -162,7 +162,7 @@ void CZip::ha_EncodeSymbol(tHATree *tree, uint c, BITFILE *output) {
}
OutputBits(output, code, code_size);
if (tree->leaf[c] == -1) {
OutputBits(output, (ulong)c, 8);
OutputBits(output, (uint32_t)c, 8);
ha_add_new_node(tree, c);
}
}

View File

@ -43,14 +43,14 @@
#define END_OF_STREAM 256
int CZip::hb_CompressFile(tVirtualFile *input, BITFILE *output) {
ulong *counts;
uint32_t *counts;
tH0Node *nodes;
tH0Code *codes;
int root_node;
int original_pos = VFtell(output->file);
counts = (ulong *)malloc(256 * sizeof(ulong));
counts = (uint32_t *)malloc(256 * sizeof(uint32_t));
if (!counts)
return -1;
if ((nodes = (tH0Node *)malloc(514 * sizeof(tH0Node))) == NULL) {
@ -63,7 +63,7 @@ int CZip::hb_CompressFile(tVirtualFile *input, BITFILE *output) {
return -1;
}
memset(counts, 0, 256 * sizeof(ulong));
memset(counts, 0, 256 * sizeof(uint32_t));
memset(nodes, 0, 514 * sizeof(tH0Node));
memset(codes, 0, 257 * sizeof(tH0Code));
@ -169,8 +169,8 @@ void CZip::hb_input_counts(BITFILE *input, tH0Node *nodes) {
nodes[END_OF_STREAM].count = 1;
}
void CZip::hb_count_bytes(tVirtualFile *input, ulong *counts) {
long input_marker;
void CZip::hb_count_bytes(tVirtualFile *input, uint32_t *counts) {
int32_t input_marker;
int c;
input_marker = VFtell(input);
@ -179,8 +179,8 @@ void CZip::hb_count_bytes(tVirtualFile *input, ulong *counts) {
VFseek(input, input_marker, SEEK_SET);
}
void CZip::hb_scale_counts(ulong *counts, tH0Node *nodes) {
ulong max_count;
void CZip::hb_scale_counts(uint32_t *counts, tH0Node *nodes) {
uint32_t max_count;
int i;
max_count = 0;
@ -251,8 +251,8 @@ void CZip::hb_convert_tree_to_code(tH0Node *nodes, tH0Code *codes, uint code_so_
void CZip::hb_compress_data(tVirtualFile *input, BITFILE *output, tH0Code *codes) {
int c;
while ((c = VFgetc(input)) != EOF)
OutputBits(output, (ulong)codes[c].code, codes[c].code_bits);
OutputBits(output, (ulong)codes[END_OF_STREAM].code, codes[END_OF_STREAM].code_bits);
OutputBits(output, (uint32_t)codes[c].code, codes[c].code_bits);
OutputBits(output, (uint32_t)codes[END_OF_STREAM].code, codes[END_OF_STREAM].code_bits);
}
void CZip::hb_expand_data(BITFILE *input, tVirtualFile *output, tH0Node *nodes, int root_node) {

View File

@ -102,17 +102,17 @@ static pthread_self_fp dpthread_self = NULL;
#define dpthread_self pthread_self
#endif
static unsigned long long Timer_sys_start_time = 0;
static unsigned long long Timer_accum = 0, Timer_high_mark = 0;
static uint64_t Timer_sys_start_time = 0;
static uint64_t Timer_accum = 0, Timer_high_mark = 0;
static float nw_TCPLoggingTimer(void) {
unsigned int time_ms;
unsigned long long ret;
uint64_t ret;
struct timeval t;
gettimeofday(&t, NULL);
ret = (unsigned long long)t.tv_sec * 1000000.0 + t.tv_usec;
ret = (uint64_t)t.tv_sec * 1000000.0 + t.tv_usec;
if (ret > Timer_high_mark) {
Timer_high_mark = ret;
@ -134,7 +134,7 @@ static bool nw_TCPLoggingTimer_Init(void) {
struct timeval t;
gettimeofday(&t, NULL);
Timer_sys_start_time = (unsigned long long)t.tv_sec * 1000000.0 + t.tv_usec;
Timer_sys_start_time = (uint64_t)t.tv_sec * 1000000.0 + t.tv_usec;
Timer_accum = 0;
Timer_high_mark = 0;
return true;

View File

@ -195,6 +195,7 @@
#include <windows.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdint.h>
///////////////////////////////////////////////////////////////////////////////

View File

@ -62,10 +62,10 @@
static bool Timer_initialized = 0;
// rcg06292000 not used with SDL.
// static unsigned long long Timer_sys_start_time = 0;
// static unsigned long long Timer_accum = 0,Timer_high_mark = 0;
// static uint64_t Timer_sys_start_time = 0;
// static uint64_t Timer_accum = 0,Timer_high_mark = 0;
// void timer_Normalize();
// unsigned long long timer_GetTickCount();
// uint64_t timer_GetTickCount();
// ---------------------------------------------------------------------------
@ -87,10 +87,10 @@ void timer_Close() {
Timer_initialized = 0;
}
float ddio_TickToSeconds(unsigned long ticks) {
float ddio_TickToSeconds(uint32_t ticks) {
// rcg06292000 not used with SDL.
// unsigned long time_ms;
// unsigned long long new_ticks = ticks;
// uint32_t time_ms;
// uint64_t new_ticks = ticks;
// timer_Normalize();
// time_ms = new_ticks;// - Timer_sys_start_time;
@ -102,7 +102,7 @@ float ddio_TickToSeconds(unsigned long ticks) {
float timer_GetTime() {
// rcg06292000 ain't working.
// unsigned long time_ms;
// uint32_t time_ms;
// timer_Normalize();
// time_ms = timer_GetTickCount() - Timer_sys_start_time;
// return (float)((double)time_ms/((double)1000000.0));
@ -111,12 +111,12 @@ float timer_GetTime() {
return ((float)SDL_GetTicks() / 1000.0);
}
longlong timer_GetMSTime() {
int64_t timer_GetMSTime() {
// rcg06292000 not used with SDL.
// unsigned long time_ms;
// uint32_t time_ms;
// timer_Normalize();
// time_ms = timer_GetTickCount() - Timer_sys_start_time;
// return (longlong)((double)time_ms/((double)1000.0));
// return (int64_t)((double)time_ms/((double)1000.0));
return (SDL_GetTicks());
}
@ -129,7 +129,7 @@ longlong timer_GetMSTime() {
/*
void timer_Normalize()
{
unsigned long long new_time;
uint64_t new_time;
new_time = timer_GetTickCount();
if (new_time < Timer_sys_start_time) {
@ -138,9 +138,9 @@ void timer_Normalize()
}
}
unsigned long long timer_GetTickCount(void)
uint64_t timer_GetTickCount(void)
{
unsigned long long ret;
uint64_t ret;
struct timeval t;
gettimeofday(&t,NULL);

View File

@ -71,6 +71,8 @@
#ifndef DDIO_WIN_H
#define DDIO_WIN_H
#include <cstdint>
#include <windows.h>
#include "pstypes.h"
#include "win/DirectX/dinput.h"
@ -88,7 +90,7 @@ extern bool DDIO_init;
extern bool DDIO_preemptive;
bool ddio_JoyHandler();
float ddio_TickToSeconds(unsigned long ticks);
float ddio_TickToSeconds(uint32_t ticks);
#ifdef _DEBUG
void ddio_DebugMessage(unsigned err, char *fmt, ...);

View File

@ -46,7 +46,7 @@ bool timerhi_Init(void);
void timerhi_Close(void);
float ddio_TickToSeconds(LARGE_INTEGER ticks);
float timerhi_GetTime();
longlong timerhi_GetMSTime();
int64_t timerhi_GetMSTime();
void timerhi_Normalize();
LARGE_INTEGER Timer_hi_sys_start_time;
LARGE_INTEGER Timer_hi_resolution;
@ -146,7 +146,7 @@ void timer_Close() {
Timer_initialized = 0;
}
float ddio_TickToSeconds(unsigned long ticks) {
float ddio_TickToSeconds(uint32_t ticks) {
if (Timer_use_highres_timer) {
LARGE_INTEGER t;
t.QuadPart = ticks;
@ -181,7 +181,7 @@ float timer_GetTime() {
return 0;
}
longlong timer_GetMSTime() {
int64_t timer_GetMSTime() {
if (Timer_use_highres_timer) {
return timerhi_GetMSTime();
} else {
@ -292,7 +292,7 @@ float timerhi_GetTime() {
}
// This should return a timer in milliseconds
longlong timerhi_GetMSTime() {
int64_t timerhi_GetMSTime() {
LARGE_INTEGER time_tick;
timerhi_Normalize();

View File

@ -104,9 +104,6 @@
static char THIS_FILE[] = __FILE__;
#endif
typedef LONGLONG longlong;
/////////////////////////////////////////////////////////////////////////////
// CSpeedTab property page
@ -472,7 +469,7 @@ void CSpeedTab::OnBtnSpeedDetect()
array1 = new int[1024*1024];
array2 = new int[1024*1024];
longlong ct1, ct2, freq;
int64_t ct1, ct2, freq;
QueryPerformanceCounter( (LARGE_INTEGER *)&ct1 );
@ -502,7 +499,7 @@ void CSpeedTab::OnBtnSpeedDetect()
delete(array1);
delete(array2);
longlong deltat = (ct2-ct1)/count;
int64_t deltat = (ct2-ct1)/count;
int speed = int(freq/deltat);
@ -537,15 +534,15 @@ void CSpeedTab::OnBtnSpeedDetect()
deltat = ct2-ct1;
//longlong speed = (longlong(300)*freq)/(deltat*longlong(1024));
//int64_t speed = (int64_t(300)*freq)/(deltat*int64_t(1024));
int bpp = GetDeviceCaps(hScreenDC,BITSPIXEL);
int bpp1 = (bpp+7)/8;
longlong vram_speed = freq;
vram_speed /= (longlong)deltat;
vram_speed *= (longlong)(w*h*bpp1);
vram_speed /= (longlong)(1024*1024);
int64_t vram_speed = freq;
vram_speed /= (int64_t)deltat;
vram_speed *= (int64_t)(w*h*bpp1);
vram_speed /= (int64_t)(1024*1024);
speed = int(vram_speed);

View File

@ -48,7 +48,7 @@ typedef enum
// use this structure for get/set all properties...
typedef struct
{
unsigned long environment; // 0 to EAX_ENVIRONMENT_COUNT-1
uint32_t environment; // 0 to EAX_ENVIRONMENT_COUNT-1
float fVolume; // 0 to 1
float fDecayTime_sec; // seconds, 0.1 to 100
float fDamping; // 0 to 1

View File

@ -9352,7 +9352,7 @@ void CDallasMainDlg::ClearCustomScriptStorage(void)
// Scans the file for the custom script block and count how many lines are in it
int CDallasMainDlg::CountCustomScriptLines(CFILE *infile)
{
long int start_pos;
int32_t start_pos;
int line_count;
char linebuf[2048];
bool done;

View File

@ -608,7 +608,7 @@ void CScriptStudio::RemoveAllSelections()
//Replaces the selected word with the passed word
void CScriptStudio::ReplaceSelected(char *replace_word)
{
long start_index,end_index;
int32_t start_index,end_index;
UpdateData(false);

View File

@ -104,7 +104,7 @@ END_MESSAGE_MAP()
// calling CProgress::IncreaseProgress(). If you are going to use CProgress::SetProgressPercentage()
// then you should call the version of InitProgress(CWnd *parent) below.
// Returns true if the progress dialog was created
bool CProgress::InitProgress(fix min,fix max,long int iterations,CWnd *parent)
bool CProgress::InitProgress(fix min,fix max,int32_t iterations,CWnd *parent)
{
int nmin,nmax,Step;
nmin=FixToInt(min);
@ -130,7 +130,7 @@ bool CProgress::InitProgress(fix min,fix max,long int iterations,CWnd *parent)
return true;
}
bool CProgress::InitProgress(int min,int max,long int iterations,CWnd *parent)
bool CProgress::InitProgress(int min,int max,int32_t iterations,CWnd *parent)
{
int Step;
@ -212,4 +212,4 @@ void CProgress::SetProgressPercentage(float percent)
{
ASSERT(m_StatusDlg!=NULL);
m_StatusDlg->SetTo(m_Min+((int)(percent*(m_Max-m_Min))));
}
}

View File

@ -69,8 +69,8 @@ protected:
class CProgress
{
public:
bool InitProgress(fix min,fix max,long int iterations,CWnd *parent=NULL);
bool InitProgress(int min,int max,long int iterations,CWnd *parent);
bool InitProgress(fix min,fix max,int32_t iterations,CWnd *parent=NULL);
bool InitProgress(int min,int max,int32_t iterations,CWnd *parent);
bool InitProgress(CWnd *parent=NULL);
void DestroyProgress();
bool IncreaseProgress();
@ -89,4 +89,4 @@ private:
#endif
#endif

View File

@ -311,7 +311,7 @@ void DrawTerrainPoints (vector *view_pos,matrix *view_orient)
typedef struct seg_edge {
union {
struct {short v0,v1;};
long vv;
int32_t vv;
};
ushort type;
} seg_edge;
@ -332,7 +332,7 @@ int edge_list_size; //set each frame
//finds edge, filling in edge_ptr. if found old edge, returns index, else return -1
int FindEdge(int v0,int v1,seg_edge **edge_ptr)
{
long vv;
int32_t vv;
short hash,oldhash;
int ret;

View File

@ -457,7 +457,7 @@ int CHogEditDoc::AddFile(const char *pathname, hog_library_entry *entry)
char filename[PSFILENAME_LEN+1];
char ext[_MAX_EXT];
unsigned length;
long timestamp;
int32_t timestamp;
POSITION pos;
char path[PSPATHNAME_LEN];
char drive[PSPATHNAME_LEN];

View File

@ -85,7 +85,7 @@ typedef struct hog_library_entry
char path[PSPATHNAME_LEN]; // location of data file (filename not included)
char name[PSFILENAME_LEN+1]; // just the filename
unsigned length; // length of this file
long timestamp; // time and date of file
int32_t timestamp; // time and date of file
int flags; // misc flags
int offset; // file offset in hog (or -1 if in .rib file)
} hog_library_entry;

View File

@ -33,7 +33,7 @@ typedef struct {
char name[LIB_FILENAME_LEN]; //just the filename part
int offset; //offset into library file
int length; //length of this file
long timestamp; //time and date of file
int32_t timestamp; //time and date of file
int flags; //misc flags
} library_entry;
@ -262,7 +262,7 @@ list_files(char *hogname)
printf(" %-12s %7d",hogfile->table[i].name,hogfile->table[i].length);
if (hogfile->table[i].timestamp) {
long t = hogfile->table[i].timestamp;
int32_t t = hogfile->table[i].timestamp;
printf(" %2d/%02d/%02d %2d:%02d:%02d",MONTH(t),DAY(t),YEAR(t),HOUR(t),MINUTE(t),SECOND(t));
}
else

View File

@ -107,8 +107,8 @@ typedef struct vmt_descent3_struct {
unsigned int lateral_thrust;
unsigned int rotational_thrust;
unsigned int sliding_pct; //Percentage of the time you were sliding
unsigned long checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded
unsigned long pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now
uint32_t checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded
uint32_t pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now
} vmt_descent3_struct;
#define DESCENT3_BLOCK_SIZE (sizeof(vmt_descent3_struct)-4)
#ifdef WIN32

View File

@ -3314,7 +3314,7 @@ void AutoLoginAndJoinGame(void)
int passlen = PASSWORD_LEN;
int valret;
unsigned short port;
unsigned long iaddr;
uint32_t iaddr;
*DLLMultiGameStarting = 0;
DLLCreateSplashScreen(TXT_PXO_CONNECTING,0);
@ -3386,7 +3386,7 @@ void AutoLoginAndJoinGame(void)
network_address s_address;
iaddr = inet_addr(DLLAuto_login_addr);
memcpy (&s_address.address,&iaddr,sizeof(unsigned long));
memcpy (&s_address.address,&iaddr,sizeof(uint32_t));
s_address.port=port;
s_address.connection_type = NP_TCP;
*DLLGame_is_master_tracker_game = 1;

View File

@ -155,7 +155,7 @@ typedef struct {
unsigned char game_type; //1==freespace (GT_FREESPACE), 2==D3, 3==tuberacer, etc.
SOCKADDR_IN addr;
int type; //Used to specify what to do ie. Add a new net game (GNT_GAMESTARTED), remove a net game (game over), etc.
unsigned long sig; //Unique identifier for client ACKs (The server always fills this in, the client responds)
uint32_t sig; //Unique identifier for client ACKs (The server always fills this in, the client responds)
char data[MAX_GT_GAME_DATA_SIZE];
}game_packet_header;
@ -209,14 +209,14 @@ typedef struct _active_games{
typedef struct {
unsigned char game_type;
char game_name[MAX_GAME_LISTS_PER_PACKET][MAX_GENERIC_GAME_NAME_LEN];
unsigned long game_server[MAX_GAME_LISTS_PER_PACKET];
uint32_t game_server[MAX_GAME_LISTS_PER_PACKET];
unsigned short game_port[MAX_GAME_LISTS_PER_PACKET];
}game_list;
*/
typedef struct {
unsigned char game_type;
unsigned long game_server[MAX_GAME_LISTS_PER_PACKET*4];
uint32_t game_server[MAX_GAME_LISTS_PER_PACKET*4];
unsigned short game_port[MAX_GAME_LISTS_PER_PACKET*4];
}game_list;

View File

@ -241,10 +241,10 @@ typedef struct {
typedef struct {
unsigned char type; //Type of request
unsigned short len; //Length of total packet, including this header
unsigned long code; //For control messages
uint32_t code; //For control messages
unsigned short xcode; //For control/NAK messages and for sigs.
unsigned long sig; //To identify unique return ACKs
unsigned long security; // Just a random value, we store the last value used in the user record
uint32_t sig; //To identify unique return ACKs
uint32_t security; // Just a random value, we store the last value used in the user record
// So we don't process the same request twice.
unsigned char data[MAX_UDP_DATA_LENGH];
} udp_packet_header;
@ -256,12 +256,12 @@ typedef struct {
typedef struct _net_reg_queue {
char login[LOGIN_LEN]; //Login id
unsigned long time_last_sent; //Time in milliseconds since we last sent this packet
uint32_t time_last_sent; //Time in milliseconds since we last sent this packet
int retries; //Number of times this has been sent
udp_packet_header packet; //Packet containing the actual data to resend, etc.
struct _net_reg_queue *next; //Pointer to next item in the list
SOCKADDR netaddr;
unsigned long sig; //Signature to be used by the client to ACK our response.
uint32_t sig; //Signature to be used by the client to ACK our response.
} net_reg_queue;
#endif
@ -286,8 +286,8 @@ typedef struct vmt_descent3_struct {
unsigned int lateral_thrust;
unsigned int rotational_thrust;
unsigned int sliding_pct; //Percentage of the time you were sliding
unsigned long checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded
unsigned long pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now
uint32_t checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded
uint32_t pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now
} vmt_descent3_struct;
*/
@ -306,7 +306,7 @@ void PollPTrackNet();
void ValidIdle();
//int ValidateUser(validate_id_request *valid_id);
int ValidateUser(validate_id_request *valid_id, char *trackerid);
void xorcode(void *data,unsigned int len,unsigned long hash);
void xorcode(void *data,unsigned int len,uint32_t hash);
extern int MTAVersionCheck(unsigned int oldver, char *URL);
void VersionIdle();
void HandlePilotData(ubyte *data,int len, network_address *from);

View File

@ -150,8 +150,8 @@ typedef struct vmt_descent3_struct {
unsigned int lateral_thrust;
unsigned int rotational_thrust;
unsigned int sliding_pct; //Percentage of the time you were sliding
unsigned long checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded
unsigned long pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now
uint32_t checksum; //This value needs to be equal to whatever the checksum is once the packet is decoded
uint32_t pad; //just to provide room for out 4 byte encryption boundry only needed on the client side for now
} vmt_descent3_struct;
#define DESCENT3_BLOCK_SIZE (sizeof(vmt_descent3_struct)-4)
#ifdef WIN32
@ -733,17 +733,17 @@ void ValidIdle()
}
}
//This code will modify 4 bytes at a time, so make sure to pad it!!!
void xorcode(void *data,unsigned int len,unsigned long hash)
void xorcode(void *data,unsigned int len,uint32_t hash)
{
return;
unsigned int i=0;
unsigned long *src = (unsigned long *)&data;
uint32_t *src = (uint32_t *)&data;
while(i<len)
{
*src = *src ^ hash;
src++;
i += sizeof(unsigned long);
i += sizeof(uint32_t);
}
}

View File

@ -2576,15 +2576,15 @@ void CreateFullScreenWindow(Display *dpy, Window rootwin, Window window, int Dis
if (a) {
struct BzfPropMotifWmInfo {
public:
long flags;
int32_t flags;
Window wmWindow;
};
Atom type;
int format;
unsigned long nitems;
unsigned long bytes_after;
long *mwmInfo;
uint32_t nitems;
uint32_t bytes_after;
int32_t *mwmInfo;
XGetWindowProperty(dpy, rootwin, a, 0, 4, False, a, &type, &format, &nitems, &bytes_after,
(unsigned char **)&mwmInfo);
@ -2609,12 +2609,12 @@ void CreateFullScreenWindow(Display *dpy, Window rootwin, Window window, int Dis
if (isMWMRunning) {
fprintf(stdout, "Motif Window Manager\n");
// it's a Motif based window manager
long hints[4];
int32_t hints[4];
hints[0] = 0;
hints[1] = 0;
hints[2] = 0;
hints[3] = 0;
long *xhints;
int32_t *xhints;
a = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
@ -2622,8 +2622,8 @@ void CreateFullScreenWindow(Display *dpy, Window rootwin, Window window, int Dis
// get current hints
Atom type;
int format;
unsigned long nitems;
unsigned long bytes_after;
uint32_t nitems;
uint32_t bytes_after;
XGetWindowProperty(dpy, window, a, 0, 4, False, a, &type, &format, &nitems, &bytes_after,
(unsigned char **)&xhints);
@ -2654,7 +2654,7 @@ void CreateFullScreenWindow(Display *dpy, Window rootwin, Window window, int Dis
}
// now set position and size
long dummy;
int32_t dummy;
XSizeHints xsh;
XGetWMNormalHints(dpy, window, &xsh, &dummy);
xsh.x = 0;
@ -2712,4 +2712,4 @@ void CreateFullScreenWindow(Display *dpy, Window rootwin, Window window, int Dis
XSync(dpy, False);
}
#endif
#endif

View File

@ -19,14 +19,17 @@
#ifndef AENCODE_H_
#define AENCODE_H_
#include <stdio.h>
#include <cstdint>
#include <cstdio>
#include "pstypes.h"
typedef long ReadSampleFunction(void *data);
typedef int32_t ReadSampleFunction(void *data);
enum AudioError {
ReadSampleEof = 0x80000000,
};
unsigned int AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume,
int32_t AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume,
FILE *out, int levels, int samples_per_subband, float comp_ratio);
#endif

View File

@ -19,6 +19,8 @@
#ifndef __CZIPFILE_H_
#define __CZIPFILE_H_
#include <cstdint>
#define OCF_VERSION 0x01
////////////////////////////////////////
@ -68,7 +70,6 @@
#define ubyte unsigned char
#define uint unsigned int
#define ushort unsigned short
#define ulong unsigned int
typedef struct {
ubyte type;
@ -227,9 +228,9 @@ private:
BITFILE *OpenInputBitFile(char *filename);
BITFILE *OpenOutputBitFile(char *filename);
void OutputBit(BITFILE *bfile, int bit);
void OutputBits(BITFILE *bfile, ulong code, int count);
void OutputBits(BITFILE *bfile, uint32_t code, int count);
int InputBit(BITFILE *bfile);
ulong InputBits(BITFILE *bfile, int bitcount);
uint32_t InputBits(BITFILE *bfile, int bitcount);
void CloseInputBitFile(BITFILE *bfile);
void CloseOutputBitFile(BITFILE *bfile);
void FilePrintBinary(FILE *file, uint code, int bits);
@ -249,8 +250,8 @@ private:
bool hb_ExpandFile(BITFILE *input, tVirtualFile *output);
void hb_compress_data(tVirtualFile *input, BITFILE *output, tH0Code *codes);
void hb_expand_data(BITFILE *input, tVirtualFile *output, tH0Node *nodes, int root_node);
void hb_count_bytes(tVirtualFile *input, ulong *long_counts);
void hb_scale_counts(ulong *long_counts, tH0Node *nodes);
void hb_count_bytes(tVirtualFile *input, uint32_t *long_counts);
void hb_scale_counts(uint32_t *long_counts, tH0Node *nodes);
int hb_build_tree(tH0Node *nodes);
void hb_convert_tree_to_code(tH0Node *nodes, tH0Code *codes, uint code_so_far, int bits, int node);
void hb_output_counts(BITFILE *output, tH0Node *nodes);

View File

@ -116,6 +116,8 @@
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include <cstdint>
#include "pstypes.h"
#include "Macros.h"

View File

@ -83,7 +83,7 @@ public:
virtual bool write(const char *label, int entry) = 0;
// get the current user's name.
virtual void get_user_name(char *buffer, ulong *size) = 0;
virtual void get_user_name(char *buffer, size_t *size) = 0;
};
// JCA: moved these from the Win32Database

View File

@ -110,7 +110,7 @@ public:
Win32 Samir Win32App.h 06/97
*/
#if defined(WIN32)
#include "win\Win32App.h"
#include "win\win32app.h"
#elif defined(__LINUX__)
#include "lnxapp.h"
#endif

View File

@ -40,8 +40,8 @@
// input_channels (default 1)
// input_factor (compression factor) (default 4 for 22K, 8 for 44K)
// input_volscale (Volume scaling) (slightly <= 1.0, default ,97)
int aenc_Compress(char *input_filename, char *output_filename, int *input_levels = NULL, int *input_samples = NULL,
int *input_rate = NULL, int *input_channels = NULL, float *input_factor = NULL,
float *input_volscale = NULL);
bool aenc_Compress(char *input_filename, char *output_filename, int *input_levels = nullptr, int *input_samples = nullptr,
int *input_rate = nullptr, int *input_channels = nullptr, float *input_factor = nullptr,
float *input_volscale = nullptr);
#endif

View File

@ -74,7 +74,7 @@ typedef struct chunked_bitmap {
int *bm_array; // array of bitmap handles.
} chunked_bitmap;
extern bms_bitmap GameBitmaps[MAX_BITMAPS];
extern ulong Bitmap_memory_used;
extern uint32_t Bitmap_memory_used;
// Sets all the bitmaps to unused
void bm_InitBitmaps();

View File

@ -193,6 +193,7 @@
class oeApplication;
#include <stdio.h>
#include <cstdint>
#include "pstypes.h"
#include "ddio_common.h"
@ -238,7 +239,7 @@ void timer_Close();
float timer_GetTime();
// returns time in milliseconds
longlong timer_GetMSTime();
int64_t timer_GetMSTime();
// hook in timer function at certain period. returns a handle to this function
//@@int timer_HookFunction(void (*fncptr)(), int period);

View File

@ -72,6 +72,7 @@
*/
#ifndef __DDIO_FORCEFEEDBACK_H_
#define __DDIO_FORCEFEEDBACK_H_
#include <cstdint>
#include "pstypes.h"
#include "string.h"
#define kMAX_Str 80
@ -162,31 +163,31 @@ typedef enum {
kMaxEffectSubTypes
} tEffType;
typedef struct tEffectConstant {
long Mag; // +- 10,000
int32_t Mag; // +- 10,000
} tEffConstant;
typedef struct tEffectRamp {
long Start; // +- 10,000
long End; // +- 10,000
int32_t Start; // +- 10,000
int32_t End; // +- 10,000
} tEffRamp;
typedef struct tEffectWave {
unsigned int Mag; // 0 to 10,000
long Offset; // +- 10,000
int32_t Offset; // +- 10,000
unsigned int Phase; // 0 to 35,999
unsigned int Period;
} tEffWave;
typedef struct tEffectCondition {
long Offset; // +- 10,000
long PositiveCoefficient; // +- 10,000
long NegativeCoefficient; // +- 10,000
int32_t Offset; // +- 10,000
int32_t PositiveCoefficient; // +- 10,000
int32_t NegativeCoefficient; // +- 10,000
unsigned int PositiveSaturation; // 0 to 10,000
unsigned int NegativeSaturation; // 0 to 10,000
long DeadBand; // 0 to 10,000
int32_t DeadBand; // 0 to 10,000
} tEffCondition;
typedef struct tEffectCustom {
int Channels;
int Period;
int Samples;
long *ForceData;
int32_t *ForceData;
} tEffCustom;
typedef union tEffectInfo {
tEffConstant Constant;
@ -213,7 +214,7 @@ typedef struct tFFB_Effect {
tEffAxis Axis;
tJoyButtons Trigger;
unsigned int TriggerRepeatTime;
long Direction; // 0 to 360 deg.
int32_t Direction; // 0 to 360 deg.
tEffEnvelope Envelope;
} tFFB_Effect;
extern bool ddForce_found; // a Force Feedback device was found

View File

@ -138,7 +138,7 @@ public:
virtual bool write(const char *label, int *entry) = 0;
// get the current user's name from the os
virtual void get_user_name(char *buffer, ulong *size) = 0;
virtual void get_user_name(char *buffer, size_t *size) = 0;
};
// Data structures
typedef struct os_date {

View File

@ -65,6 +65,8 @@
#ifndef JOYSTICK_H
#define JOYSTICK_H
#include <cstdint>
// joystick ids. used to initialize a stick and get its position
#define MAX_JOYSTICKS 8
#define JOYPOV_NUM 4

View File

@ -63,7 +63,7 @@ public:
virtual bool write(const char *label, int entry);
// get the current user's name.
virtual void get_user_name(char *buffer, ulong *size);
virtual void get_user_name(char *buffer, size_t *size);
};
// Handy macro to read an int without having to specify the wordsize

View File

@ -106,7 +106,7 @@ public:
virtual bool write(const char *label, int *entry);
// get the current user's name from the os
virtual void get_user_name(char *buffer, ulong *size);
virtual void get_user_name(char *buffer, size_t *size);
protected:
// Additional Macintosh Functions, return true if successful

View File

@ -59,8 +59,8 @@ void __cdecl MVE_sndInit(LPDIRECTSOUND lpDS);
** thru 10,000 (left -100db, right full volume).
** The default value for volume and pan is zero.
*/
void __cdecl MVE_dsbSetVolume(long lVolume);
void __cdecl MVE_dsbSetPan(long lPan);
void __cdecl MVE_dsbSetVolume(int32_t lVolume);
void __cdecl MVE_dsbSetPan(int32_t lPan);
/* Only call this function to configure software to work with a Super VGA

View File

@ -157,6 +157,7 @@
#define NETWORKING_H
#include "pstypes.h"
#include <cstdint>
#if defined(WIN32)
// Windows includes
@ -324,7 +325,13 @@ static inline void INADDR_GET_SUN_SUNB(struct in_addr *st, unsigned char *s_b1,
#define NF_CHECKSUM 1
#define NF_NOSEQINC 2
typedef enum { NP_NONE, NP_TCP, NP_IPX, NP_DIRECTPLAY } network_protocol;
enum network_protocol : uint32_t
{
NP_NONE,
NP_TCP,
NP_IPX,
NP_DIRECTPLAY
};
typedef struct {
ubyte address[6];
@ -361,7 +368,7 @@ void nw_ConnectToServer(SOCKET *socket, network_address *server_addr);
// Returns internet address format from string address format...ie "204.243.217.14"
// turns into 1414829242
unsigned long nw_GetHostAddressFromNumbers(char *str);
uint32_t nw_GetHostAddressFromNumbers(char *str);
// Fills in the string with the string address from the internet address
void nw_GetNumbersFromHostAddress(network_address *address, char *str);
@ -429,7 +436,7 @@ void nw_psnet_buffer_packet(ubyte *data, int length, network_address *from);
int nw_psnet_buffer_get_next(ubyte *data, int *length, network_address *from);
// get the index of the next packet in order!
int nw_psnet_buffer_get_next_by_dpid(ubyte *data, int *length, unsigned long dpid);
int nw_psnet_buffer_get_next_by_packet_id(ubyte *data, int *length, uint32_t packet_id);
// This is all the reliable UDP stuff...
#define MAXNETBUFFERS \

View File

@ -34,6 +34,7 @@
* $NoKeywords: $
*/
#include <cstdint>
#undef RAND_MAX
#define RAND_MAX 0x7fff

View File

@ -34,7 +34,7 @@
// use INT64 for 64bit integers
#ifdef USE_RTP
#if defined(__LINUX__)
#define INT64 long long
#define INT64 int64_t
#else
#define INT64 signed __int64
#endif

View File

@ -123,9 +123,9 @@ extern void (*Texture_functions[])(g3Point *, int);
// Our shade tables
extern ubyte TexShadeTable8[MAX_TEXTURE_SHADES][256];
extern ulong TexShadeTable16[MAX_TEXTURE_SHADES][256];
extern uint32_t TexShadeTable16[MAX_TEXTURE_SHADES][256];
extern ubyte TexRevShadeTable8[MAX_TEXTURE_SHADES][256];
extern ulong TexRevShadeTable16[MAX_TEXTURE_SHADES][256];
extern uint32_t TexRevShadeTable16[MAX_TEXTURE_SHADES][256];
int tex_Init();

View File

@ -38,6 +38,7 @@
#ifndef __UNZIP_H
#define __UNZIP_H
#include <cstdint>
#include <stdio.h>
#include "pstypes.h"
@ -120,7 +121,7 @@ private:
bool m_open;
char *m_zip; // zip name
FILE *m_fp; // zip handler
long m_length; // length of zip file
int32_t m_length; // length of zip file
char *m_ecd; // end_of_cent_dir data
unsigned m_ecd_length; // end_of_cent_dir length

View File

@ -84,7 +84,7 @@ public:
virtual bool write(const char *label, int entry);
// get the current user's name.
virtual void get_user_name(char *buffer, ulong *size);
virtual void get_user_name(char *buffer, size_t *size);
};
// pass name of dll which contains desired language

View File

@ -290,7 +290,7 @@ private:
} m_ExtCtlStates[CT_MAX_EXTCTLS];
// thread info.
longlong m_frame_timer_ms;
int64_t m_frame_timer_ms;
float m_frame_time;
// note id is id value from controller in control list.

View File

@ -929,7 +929,7 @@ void WriteBands(Encoder &enc) {
for (int i = 0; i < enc.m_numColumns; ++i) {
const uint32 formatId = enc.m_pFormatIdPerColumn[i];
enc.m_bits.WriteBits(formatId, 5);
int currPos = ftell(enc.m_bits.m_outFile);
// int32_t currPos = ftell(enc.m_bits.m_outFile);
WriteBand_tbl[formatId](enc, i, formatId);
}
}
@ -993,7 +993,7 @@ void EncodeFlush(Encoder &enc) {
ProcessBlock(enc);
}
unsigned int AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume,
int32_t AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume,
FILE *out, int levels, int samples_per_subband, float comp_ratio) {
Encoder enc;
memset(&enc, 0, sizeof(enc));
@ -1016,7 +1016,7 @@ unsigned int AudioEncode(ReadSampleFunction *read, void *data, unsigned channels
enc.m_threshold = (sint32)(float(enc.m_samplesPerBlock) * comp_ratio * 16.0f);
int originalPosVAR64 = ftell(out);
int32_t originalPosVAR64 = ftell(out);
// Header
enc.m_bits.WriteBits(0x97, 8);
@ -1073,13 +1073,13 @@ unsigned int AudioEncode(ReadSampleFunction *read, void *data, unsigned channels
/////////////
// Go back and write the Sample Count out proper
int endPos = ftell(out);
fseek(out, originalPosVAR64 + 4, 0);
int32_t endPos = ftell(out);
fseek(out, originalPosVAR64 + 4, SEEK_SET);
putc((enc.m_sampleCount >> 0) & 0xFF, out);
putc((enc.m_sampleCount >> 8) & 0xFF, out);
putc((enc.m_sampleCount >> 16) & 0xFF, out);
putc((enc.m_sampleCount >> 24) & 0xFF, out);
fseek(out, endPos, 0);
fseek(out, endPos, SEEK_SET);
DestroyEncoder(enc);
return endPos;

View File

@ -666,8 +666,8 @@ static unsigned int LinuxSoundMixNormalize(LnxSoundBuffer *dsb, unsigned char *b
int DoMulDiv(int nNumber, int nNumerator, int nDenominator) {
if (!nDenominator)
return -1;
long long ret;
ret = (((long long)nNumber * nNumerator) + (nDenominator / 2)) / nDenominator;
int64_t ret;
ret = (((int64_t)nNumber * nNumerator) + (nDenominator / 2)) / nDenominator;
if ((ret > 0x7FFFFFFF) || (ret < 0xFFFFFFFF))
return -1;

View File

@ -60,10 +60,6 @@ inline unsigned int IntelSwapper(unsigned int a) { return INTEL_INT(a); }
inline int IntelSwapper(int a) { return INTEL_INT(a); }
inline unsigned long IntelSwapper(unsigned long a) { return INTEL_INT(a); }
inline long IntelSwapper(long a) { return INTEL_INT(a); }
typedef struct _mve_hdr {
char FileType[20]; // MVE_FILE_TYPE
unsigned short HdrSize; // sizeof(mve_hdr)
@ -121,7 +117,7 @@ typedef struct _mcmd_hdr {
#define mcmd_syncInit 2
typedef struct _syncInit {
unsigned long period; // period of quanta
uint32_t period; // period of quanta
unsigned short wait_quanta; // # of quanta per frame
void SwapBytes() {
period = IntelSwapper(period);
@ -149,7 +145,7 @@ typedef struct _sndConfigure {
#endif
unsigned short frequency;
// Minor opcode 1 extends buflen to be a long
unsigned long buflen;
uint32_t buflen;
void SwapBytes() {
rate = IntelSwapper(rate);
frequency = IntelSwapper(frequency);
@ -279,13 +275,13 @@ typedef struct _palLoadPalette {
#define mcmd_nfPkInfo 19
#define mcmd_nfHPkInfo 20
typedef struct _nfPkInfo {
unsigned long error; // scaled by 10000
uint32_t error; // scaled by 10000
unsigned short usage[64];
} marg_nfPkInfo;
#define mcmd_idcode 21
typedef struct _idcode {
unsigned long idcode; // Code identifying version mcomp used to create
uint32_t idcode; // Code identifying version mcomp used to create
} marg_idcode;
#if __SC__

View File

@ -142,7 +142,7 @@ static void syncReset(unsigned int wait_quanta) {
static void syncRelease(void) { sync_active = false; }
static bool syncInit(unsigned int period, unsigned wait_quanta) {
int new_wait_quanta = -(long)(period * wait_quanta + (wait_quanta >> 1));
int new_wait_quanta = -(int32_t)(period * wait_quanta + (wait_quanta >> 1));
// If timer is still running and has same timing
// characteristics, assume we are trying to continue smoothly
@ -292,8 +292,8 @@ static int snd_pad = 0;
static unsigned snd_stereo = 0;
static unsigned snd_comp16 = 0;
static unsigned snd_bits16 = 0;
static long snd_volume = 0;
static long snd_pan = 0;
static int32_t snd_volume = 0;
static int32_t snd_pan = 0;
#endif
@ -303,7 +303,7 @@ void MVE_sndInit(ISoundDevice *lpDS) {
#endif
}
void MVE_dsbSetVolume(long lVolume) {
void MVE_dsbSetVolume(int32_t lVolume) {
#if SOUND_SUPPORT
snd_volume = lVolume;
if (snd_buffer) {
@ -312,7 +312,7 @@ void MVE_dsbSetVolume(long lVolume) {
#endif
}
void MVE_dsbSetPan(long lPan) {
void MVE_dsbSetPan(int32_t lPan) {
#if SOUND_SUPPORT
snd_pan = lPan;
if (snd_buffer) {

View File

@ -20,6 +20,8 @@
#ifndef MVELIB_H_INCLUDED
#define MVELIB_H_INCLUDED
#include <cstdint>
#include "SystemInterfaces.h"
#if defined(__LINUX__)
#include "lnxdsound.h"
@ -50,8 +52,8 @@ void MVE_sndInit(ISoundDevice *lpDS);
// Pan ranges from -10,000 (left full volume, right -100db), thru 0 (both full),
// thru 10,000 (left -100db, right full volume).
// The default value for volume and pan is zero.
void MVE_dsbSetVolume(long lVolume);
void MVE_dsbSetPan(long lPan);
void MVE_dsbSetVolume(int32_t lVolume);
void MVE_dsbSetPan(int32_t lPan);
// Only call this function to configure software to work with a Super VGA
// mode if you do not have VESA support.

View File

@ -62,7 +62,7 @@
#define MOUSE_DEADZONE 0.00f
static float WinControllerTimer = 0.0f;
static longlong g_last_frame_timer_ms = -1;
static int64_t g_last_frame_timer_ms = -1;
static float g_accum_frame_time = 0.0f;
lnxgameController::lnxgameController(int num_funcs, ct_function *funcs) : gameController(num_funcs, funcs) {
@ -98,7 +98,7 @@ void lnxgameController::resume() {
// this functions polls the controllers if needed. some systems may not need to implement
// this function.
void lnxgameController::poll() {
longlong cur_frame_timer_ms;
int64_t cur_frame_timer_ms;
if (m_Suspended)
return;

View File

@ -178,7 +178,7 @@ private:
} m_ExtCtlStates[CT_MAX_EXTCTLS];
// thread info.
longlong m_frame_timer_ms;
int64_t m_frame_timer_ms;
float m_frame_time;
// note id is id value from controller in control list.

View File

@ -207,7 +207,7 @@ bool oeLnxAppDatabase::write(const char *label, int entry) {
}
// get the current user's name from the os
void oeLnxAppDatabase::get_user_name(char *buffer, ulong *size) {
void oeLnxAppDatabase::get_user_name(char *buffer, size_t *size) {
struct passwd *pwuid = getpwuid(geteuid());
if ((pwuid != NULL) && (pwuid->pw_name != NULL)) {

View File

@ -650,8 +650,8 @@ static unsigned int LinuxSoundMixNormalize(LnxSoundBuffer *dsb, unsigned char *b
int DoMulDiv(int nNumber, int nNumerator, int nDenominator) {
if (!nDenominator)
return -1;
long long ret;
ret = (((long long)nNumber * nNumerator) + (nDenominator / 2)) / nDenominator;
int64_t ret;
ret = (((int64_t)nNumber * nNumerator) + (nDenominator / 2)) / nDenominator;
if ((ret > 0x7FFFFFFF) || (ret < 0xFFFFFFFF))
return -1;

View File

@ -144,7 +144,7 @@ static void syncReset(unsigned int wait_quanta) {
static void syncRelease(void) { sync_active = FALSE; }
static bool syncInit(unsigned int period, unsigned wait_quanta) {
int new_wait_quanta = -(long)(period * wait_quanta + (wait_quanta >> 1));
int new_wait_quanta = -(int32_t)(period * wait_quanta + (wait_quanta >> 1));
// If timer is still running and has same timing
// characteristics, assume we are trying to continue smoothly
// with another movie and ignore new syncInit() call.
@ -293,8 +293,8 @@ static unsigned snd_stereo;
static unsigned snd_comp16;
static unsigned snd_bits16;
static long snd_volume = 0;
static long snd_pan = 0;
static int32_t snd_volume = 0;
static int32_t snd_pan = 0;
#endif
@ -304,7 +304,7 @@ void MVE_sndInit(LnxSoundDevice *lpDS) {
#endif
}
void MVE_dsbSetVolume(long lVolume) {
void MVE_dsbSetVolume(int32_t lVolume) {
#if SOUND_SUPPORT
snd_volume = lVolume;
if (snd_buffer)
@ -312,7 +312,7 @@ void MVE_dsbSetVolume(long lVolume) {
#endif
}
void MVE_dsbSetPan(long lPan) {
void MVE_dsbSetPan(int32_t lPan) {
#if SOUND_SUPPORT
snd_pan = lPan;
if (snd_buffer)

View File

@ -57,8 +57,8 @@ void MVE_sndInit(LnxSoundDevice *lpDS);
** thru 10,000 (left -100db, right full volume).
** The default value for volume and pan is zero.
*/
void MVE_dsbSetVolume(long lVolume);
void MVE_dsbSetPan(long lPan);
void MVE_dsbSetVolume(int32_t lVolume);
void MVE_dsbSetPan(int32_t lPan);
/* Only call this function to configure software to work with a Super VGA
** mode if you do not have VESA support.

View File

@ -564,7 +564,7 @@ void Read256TextureNames();
// Sets up our table files, get their filenames, etc.
// Returns 1 on success, zero on error
int mng_InitTableFiles() {
ulong size = TABLE_NAME_LEN;
size_t size = TABLE_NAME_LEN;
int answer;
Database->get_user_name(TableUser, &size);
if (FindArg("-filter"))

View File

@ -206,6 +206,7 @@
#include <crtdbg.h>
#else
#endif
#include <cstdint>
#include "init.h"
#include "mem.h"
@ -393,7 +394,7 @@ void mem_Init() {
mprintf((0, "Available virtual memory : %d\n", ms.dwAvailPageFile));
// See if there is enough memory to run
if (((longlong)ms.dwAvailPageFile + ms.dwAvailPhys) < (50 * 1024 * 1024)) {
if (((int64_t)ms.dwAvailPageFile + ms.dwAvailPhys) < (50 * 1024 * 1024)) {
Error("Your system doesn't have enough available memory to continue.\r\n\r\nMemory Statistics:\r\nTotal Physical: "
"%d\r\nAvaliable Physical: %d\r\nAvailable Virtual: %d\r\n\r\nYou may be able to continue by rebooting, or "
"freeing up some disk space.",

View File

@ -36,10 +36,10 @@
#include "psrand.h"
static long ps_holdrand = 1L;
static int32_t ps_holdrand = 1L;
// These are adapted from the C runtime lib. Pretty simple.
void ps_srand(unsigned int seed) { ps_holdrand = (long)seed; }
void ps_srand(unsigned int seed) { ps_holdrand = (int32_t)seed; }
int ps_rand(void) { return (((ps_holdrand = ps_holdrand * 214013L + 2531011L) >> 16) & 0x7fff); }

View File

@ -365,7 +365,7 @@ network_protocol NetworkProtocol = NP_NONE;
int Sockets_initted = 0;
int Network_initted = 0;
unsigned long Net_fixed_ip = INADDR_NONE;
uint32_t Net_fixed_ip = INADDR_NONE;
// sockets for IPX and TCP
SOCKET TCP_socket;
@ -827,7 +827,7 @@ void nw_GetMyAddress(network_address *addr) {
// Returns internet address format from string address format...ie "204.243.217.14"
// turns into 1414829242
unsigned long nw_GetHostAddressFromNumbers(char *str) {
uint32_t nw_GetHostAddressFromNumbers(char *str) {
// ASSERT (NetworkProtocol==NP_TCP);
return inet_addr(str);
@ -975,7 +975,7 @@ int nw_ReceiveReliable(SOCKET socketid, ubyte *buffer, int max_len) {
dp_DirectPlayDispatch();
// try and get a free buffer and return its size
if (nw_psnet_buffer_get_next_by_dpid((ubyte *)buffer, &max_len, socketid)) {
if (nw_psnet_buffer_get_next_by_packet_id((ubyte *)buffer, &max_len, socketid)) {
return max_len;
}
return 0;
@ -1879,7 +1879,7 @@ void nw_psnet_buffer_packet(ubyte *data, int length, network_address *from) {
// MTS: only used in this file
// get the index of the next packet in order!
int nw_psnet_buffer_get_next_by_dpid(ubyte *data, int *length, unsigned long dpid) {
int nw_psnet_buffer_get_next_by_packet_id(ubyte *data, int *length, uint32_t packet_id) {
int idx;
int found_buf = 0;
@ -1890,10 +1890,10 @@ int nw_psnet_buffer_get_next_by_dpid(ubyte *data, int *length, unsigned long dpi
// search until we find the lowest packet index id#
for (idx = 0; idx < MAX_PACKET_BUFFERS; idx++) {
unsigned long *thisid;
thisid = (unsigned long *)&Psnet_buffers[idx].from_addr.address;
uint32_t *thisid;
thisid = (uint32_t *)&Psnet_buffers[idx].from_addr.address;
// if we found the buffer
if ((Psnet_buffers[idx].sequence_number == Psnet_lowest_id) && (dpid == *thisid)) {
if ((Psnet_buffers[idx].sequence_number == Psnet_lowest_id) && (packet_id == *thisid)) {
found_buf = 1;
break;
}
@ -1960,7 +1960,7 @@ unsigned int psnet_ras_status() {
unsigned long size, num_connections, i;
RASCONN rasbuffer[25];
HINSTANCE ras_handle;
unsigned long rasip = 0;
uint32_t rasip = 0;
RASPPPIP projection;
int Ras_connected;

View File

@ -931,7 +931,6 @@ typedef unsigned char ubyte;
typedef signed char sbyte;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned int ddgr_color;
#ifndef NULL

View File

@ -33,7 +33,7 @@ const vector Zero_vector = {0.0f, 0.0f, 0.0f};
typedef unsigned short angle;
// The basic fixed-point type
typedef long fix;
typedef int32_t fix;
#define PI 3.141592654
@ -67,7 +67,7 @@ fix FloatToFixFast(float num);
//??#define FloatToFix(num) Round((num) * FLOAT_SCALER)
#define FloatToFix(num) ((fix)((num) * FLOAT_SCALER))
#define IntToFix(num) ((num) << FIX_SHIFT)
#define ShortToFix(num) (((long)(num)) << FIX_SHIFT)
#define ShortToFix(num) (((int32_t)(num)) << FIX_SHIFT)
#define FixToFloat(num) (((float)(num)) / FLOAT_SCALER)
#define FixToInt(num) ((num) >> FIX_SHIFT)
#define FixToShort(num) ((short)((num) >> FIX_SHIFT))

View File

@ -932,7 +932,6 @@ typedef unsigned char ubyte;
typedef signed char sbyte;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned int ddgr_color;
#ifndef NULL

View File

@ -122,12 +122,12 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil
char format_type[80]; // ASCII name of format type
unsigned short fmttag = 0; // Numerical format type
unsigned long ckid; // Current chunk's ID
unsigned long cksize; // Current chunk's size in bytes
unsigned long filesize; // Size of the sound file
unsigned long nextseek = 0; // Location of the next seek
uint32_t ckid; // Current chunk's ID
uint32_t cksize; // Current chunk's size in bytes
uint32_t filesize; // Size of the sound file
uint32_t nextseek = 0; // Location of the next seek
unsigned long aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples
uint32_t aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples
// Sound format information
int samples_per_second;
@ -135,7 +135,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil
short number_channels;
// Used to read temporary long values
unsigned long temp_long;
uint32_t temp_long;
// Flags for if we previously read data or a format
char f_data, f_fmt = 0;
@ -169,7 +169,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil
paged_in_count += cfilelength(cfptr);
paged_in_num++;
// Make sure that it is a RIFF format
temp_long = (unsigned long)cf_ReadInt(cfptr);
temp_long = (uint32_t)cf_ReadInt(cfptr);
if (temp_long != 0x46464952) {
mprintf((0, "SOUND LOADER: %s is not a RIFF format file\n", filename));
goto error_state;
@ -180,7 +180,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil
filesize += cftell(cfptr);
// Make sure it is a wave file
temp_long = (unsigned long)cf_ReadInt(cfptr);
temp_long = (uint32_t)cf_ReadInt(cfptr);
if (temp_long != 0x45564157) {
mprintf((0, "SOUND LOADER: %s is not a WAVE file\n", filename));
goto error_state;

View File

@ -257,12 +257,12 @@ bool EAX_SetEnvironmentalReverb(float volume, float damping, float decay) {
for (i = 0; i < EAX_ENVIRONMENT_COUNT; i++) {
if (volume == EAX_Environments[i].fVolume && damping == EAX_Environments[i].fDamping &&
decay == EAX_Environments[i].fDecayTime_sec) {
EAX.m_preset.environment = (ulong)i;
EAX.m_preset.environment = (uint32_t)i;
break;
}
}
if (FAILED(EAX.m_lpksps->Set(DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENT, NULL, 0,
&EAX.m_preset.environment, sizeof(ulong)))) {
&EAX.m_preset.environment, sizeof(uint32_t)))) {
return false;
}
} else {

View File

@ -488,8 +488,8 @@ bool AudioStream::ReopenDigitalStream(ubyte fbufidx, int nbufs) {
return false;
}
long bytes_per_buf = (SAMPLES_PER_STREAM_BUF * granularity);
long filelen = (sample_count / channels) * granularity;
int32_t bytes_per_buf = (SAMPLES_PER_STREAM_BUF * granularity);
int32_t filelen = (sample_count / channels) * granularity;
int nbuffers = filelen / bytes_per_buf;
if (nbuffers >= 0 && nbuffers <= 1) {
if (filelen > 0) {

View File

@ -23,7 +23,7 @@
// This code taken from original byteswap.h for testing float conversion
// It cannot convert negative float numbers in 64-bit systems, so testing only non-negative numbers
#define SWAPINT(x) (int)(((x) << 24) | (((unsigned long)(x)) >> 24) | (((x) & 0x0000ff00) << 8) | (((x) & 0x00ff0000) >> 8))
#define SWAPINT(x) (int)(((x) << 24) | (((uint32_t)(x)) >> 24) | (((x) & 0x0000ff00) << 8) | (((x) & 0x00ff0000) >> 8))
// Stupid function to trick the compiler into letting me byteswap a float
inline float SWAPFLOAT(float x) {

View File

@ -502,7 +502,7 @@ int ui_DoFrame(bool input) {
ui_DoWindowFocus(); // determine window with current input focus.
res = ui_ProcessFocusedWindow(); // process focused window
// longlong cur_time = timer_GetMSTime();
// int64_t cur_time = timer_GetMSTime();
while ((timer_GetTime() - UI_input.cur_time) < UI_FRAMETIME) {
};

View File

@ -503,7 +503,7 @@ int ZIP::ReadZipDataToFile(zipentry *ent, FILE *file) {
int ZIP::SeekToCompressedData(zipentry *ent) {
char buf[LFH_NAME];
long offset;
int32_t offset;
if (fseek(m_fp, ent->offset_lcl_hdr_frm_frst_disk, SEEK_SET) != 0) {
return -1;

View File

@ -335,7 +335,7 @@ extern float Mouse_sensitivity;
#define MOUSE_DEADZONE 0.00f
static float WinControllerTimer = 0.0f;
static longlong g_last_frame_timer_ms = -1;
static int64_t g_last_frame_timer_ms = -1;
static float g_accum_frame_time = 0.0f;
// Functions to create and destroy a game controller object.
@ -375,7 +375,7 @@ gameWinController::~gameWinController() {}
#define MOUSE_POLLING_TIME (1.0f / 20.0f)
void gameWinController::poll() {
longlong cur_frame_timer_ms;
int64_t cur_frame_timer_ms;
if (m_Suspended)
return;

View File

@ -257,7 +257,7 @@ bool oeWin32AppDatabase::write(const char *label, int entry) {
}
// get the current user's name from the os
void oeWin32AppDatabase::get_user_name(char *buffer, ulong *size) { GetUserName(buffer, size); }
void oeWin32AppDatabase::get_user_name(char *buffer, size_t *size) { GetUserName(buffer, reinterpret_cast<LPDWORD>(size)); }
/////////////////////////////////////////////////////////////////////////////////
// pass name of dll which contains desired language