From a6a6869a7e4d596e01f819981c15ca058f568fd2 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 14:10:09 -0400 Subject: [PATCH 01/14] 64 Bit-Safe Updates Imported Icculus' 64-bit changes. Changes `[un]signed long` data types to `[un]signed int`. --- Descent3/audiotaunts.cpp | 20 ++++++++-------- Descent3/d3serial.cpp | 14 +++++------ Descent3/d3serial.h | 4 ++-- Descent3/dedicated_server.cpp | 8 +++---- Descent3/multi.h | 6 ++--- Descent3/multi_external.h | 4 ++-- Descent3/pilot.cpp | 4 ++-- dd_lnxsound/ddlnxsound.h | 4 ++-- dd_sndlib/Ds3dlib.cpp | 6 ++--- dd_sndlib/ddsoundload.cpp | 18 +++++++------- dd_sndlib/ds3dlib_internal.h | 4 ++-- dd_sndlib/eax.h | 4 ++-- ddio_lnx/ddio_lnx.h | 4 ++-- ddio_lnx/lnxcdrom.cpp | 8 +++---- ddio_lnx/lnxio.cpp | 4 ++-- ddio_win/ddio_win.h | 4 ++-- ddio_win/winfile.cpp | 10 ++++---- ddio_win/winkey.cpp | 8 +++---- ddio_win/wintimer.cpp | 4 ++-- lib/Aencode.h | 4 ++-- lib/CZip.h | 4 ++-- lib/directplay.h | 6 ++--- lib/forcefeedback.h | 26 ++++++++++---------- lib/linux/dyna_glide.h | 8 +++---- lib/linux/dyna_xwin.h | 12 +++++----- lib/mvelibw.h | 4 ++-- lib/networking.h | 6 ++--- lib/pstypes.h | 4 ++-- libacm/aencode.cpp | 4 ++-- libmve/SystemInterfaces.h | 6 ++--- libmve/lnxdsound.cpp | 14 +++++------ libmve/lnxdsound.h | 12 +++++----- libmve/mvelibl.cpp | 16 ++++++------- libmve/mvelibl.h | 2 +- linux/lnxmono.cpp | 4 ++-- lnxmvelib/dyna_xwin.h | 12 +++++----- lnxmvelib/lnxdraw.cpp | 10 ++++---- lnxmvelib/lnxdsound.cpp | 14 +++++------ lnxmvelib/lnxdsound.h | 12 +++++----- lnxmvelib/mvelibi.h | 10 ++++---- lnxmvelib/mvelibl.cpp | 16 ++++++------- lnxmvelib/mvelibl.h | 2 +- movie/d3movie.cpp | 10 ++++---- netcon/includes/con_dll.h | 8 +++---- netcon/inetfile/Chttpget.cpp | 4 ++-- netcon/lanclient/lanclient.cpp | 6 ++--- netgames/dmfc/dmfcbase.cpp | 8 +++---- netgames/dmfc/dmfcfunctions.cpp | 4 ++-- netgames/dmfc/encryption.cpp | 38 +++++++++++++++--------------- netgames/includes/gamedll_header.h | 2 +- networking/directplay.cpp | 14 +++++------ networking/networking.cpp | 18 +++++++------- renderer/SoftwareOpenGL.cpp | 10 ++++---- scripts/lnx/osiris_common.h | 4 ++-- scripts/osiris_common.h | 4 ++-- win32/windebug.cpp | 14 +++++------ win32/winmono.cpp | 4 ++-- 57 files changed, 247 insertions(+), 247 deletions(-) diff --git a/Descent3/audiotaunts.cpp b/Descent3/audiotaunts.cpp index 75fd80b6..9f786595 100644 --- a/Descent3/audiotaunts.cpp +++ b/Descent3/audiotaunts.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -501,11 +501,11 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) { cfptr = NULL; 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 - unsigned long aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples + unsigned int ckid; // Current chunk's ID + unsigned int cksize; // Current chunk's size in bytes + unsigned int filesize; // Size of the sound file + unsigned int nextseek = 0; // Location of the next seek + unsigned int aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples // Sound format information int samples_per_second; @@ -514,7 +514,7 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) { char error_code = 0; // Used to read temporary long values - unsigned long temp_long; + unsigned int temp_long; // Flags for if we previously read data or a format char f_data, f_fmt = 0; @@ -530,7 +530,7 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) { } // Make sure that it is a RIFF format - temp_long = (unsigned long)cf_ReadInt(cfptr); + temp_long = (unsigned int)cf_ReadInt(cfptr); if (temp_long != 0x46464952) { error_code = 2; mprintf((0, "TAUNT: Wav Load: %s is not a RIFF format file\n", filename)); @@ -542,7 +542,7 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) { filesize += cftell(cfptr); // Make sure it is a wave file - temp_long = (unsigned long)cf_ReadInt(cfptr); + temp_long = (unsigned int)cf_ReadInt(cfptr); if (temp_long != 0x45564157) { error_code = 3; mprintf((0, "TAUNT: Wav Load: %s is not a WAVE file\n", filename)); @@ -789,4 +789,4 @@ error_state: cfclose(cfptr); return error_code; -} \ No newline at end of file +} diff --git a/Descent3/d3serial.cpp b/Descent3/d3serial.cpp index bd114403..2b7559f5 100644 --- a/Descent3/d3serial.cpp +++ b/Descent3/d3serial.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -95,15 +95,15 @@ static char name_copy[DESC_ID_LEN]; -unsigned long d3_serialnum = 100000; +unsigned int d3_serialnum = 100000; // checks the exectuable (serialization) int SerialCheck(void) { char name2[] = DESC_ID_TAG "0000000000000000000000000000000000000000"; char time_str[] = DESC_DEAD_TIME_TAG "00000000"; int i, found; - unsigned long *checksum, test_checksum; - unsigned long *serialnum; + unsigned int *checksum, test_checksum; + unsigned int *serialnum; time_t current_time, saved_time; #ifdef DEMO @@ -179,7 +179,7 @@ int SerialCheck(void) { char *checksum_ptr = desc_id_checksum_str + DESC_CHKSUM_TAG_LEN; // compare generated checksum with that in the executable - checksum = (unsigned long *)&(checksum_ptr[0]); + checksum = (unsigned int *)&(checksum_ptr[0]); if (test_checksum != *checksum) { return SERIAL_BAD_CHECKSUM; } @@ -187,7 +187,7 @@ int SerialCheck(void) { static char desc_id_serialnum_str[] = DESC_SERIALNUM_TAG "0000"; // 4-byte serialnum char *serialnum_ptr = desc_id_serialnum_str + DESC_SERIALNUM_TAG_LEN; - serialnum = (unsigned long *)&(serialnum_ptr[0]); + serialnum = (unsigned int *)&(serialnum_ptr[0]); d3_serialnum = *serialnum; // this guy is ok, we can exit clean now @@ -224,4 +224,4 @@ void SerialError(int error) { } } -unsigned long SerialGetSerialNum(void) { return d3_serialnum; } +unsigned int SerialGetSerialNum(void) { return d3_serialnum; } diff --git a/Descent3/d3serial.h b/Descent3/d3serial.h index 2a0ef4d5..878182ab 100644 --- a/Descent3/d3serial.h +++ b/Descent3/d3serial.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -68,7 +68,7 @@ int SerialCheck(void); void SerialError(int error); // returns the serialnumber of the user -unsigned long SerialGetSerialNum(void); +unsigned int SerialGetSerialNum(void); ///////////////////////////////////////////////////////////////////////////// // These are the functions used for serialization diff --git a/Descent3/dedicated_server.cpp b/Descent3/dedicated_server.cpp index b537e703..143dabae 100644 --- a/Descent3/dedicated_server.cpp +++ b/Descent3/dedicated_server.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -854,7 +854,7 @@ void InitDedicatedSocket(ushort port) { return; } // Make the socket non-blocking - unsigned long argp = 1; + unsigned int argp = 1; #if defined(WIN32) ioctlsocket(dedicated_listen_socket, FIONBIO, &argp); #elif defined(__LINUX__) @@ -870,7 +870,7 @@ void ListenDedicatedSocket(void) { incoming_socket = accept(dedicated_listen_socket, (SOCKADDR *)&conn_addr, &addrlen); if (INVALID_SOCKET != incoming_socket) { // Make the socket non-blocking - unsigned long argp = 1; + unsigned int argp = 1; #if defined(WIN32) ioctlsocket(incoming_socket, FIONBIO, &argp); #elif defined(__LINUX__) @@ -878,7 +878,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"); + unsigned int 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)); diff --git a/Descent3/multi.h b/Descent3/multi.h index c29f4bac..3f169c39 100644 --- a/Descent3/multi.h +++ b/Descent3/multi.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -814,8 +814,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 + unsigned int checksum; // This value needs to be equal to whatever the checksum is once the packet is decoded + unsigned int 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) #if defined(WIN32) diff --git a/Descent3/multi_external.h b/Descent3/multi_external.h index 50ca833f..cd66dcf6 100644 --- a/Descent3/multi_external.h +++ b/Descent3/multi_external.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -192,7 +192,7 @@ typedef struct { ubyte sequence; // where we are in the sequence chain ubyte pps; HANDLE hPlayerEvent; // player event to use for directplay - unsigned long dpidPlayer; // directplay ID of player created + unsigned int dpidPlayer; // directplay ID of player created float ping_time; float last_ping_time; ushort pilot_pic_id; diff --git a/Descent3/pilot.cpp b/Descent3/pilot.cpp index bee09b6e..27086a57 100644 --- a/Descent3/pilot.cpp +++ b/Descent3/pilot.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -2929,7 +2929,7 @@ bool PltSelectShip(pilot *Pilot) { if ((error == ERROR_SUCCESS)) { lType = REG_EXPAND_SZ; - unsigned long len = BUFLEN; + unsigned int len = BUFLEN; error = RegQueryValueEx(key, "UninstallString", NULL, &lType, (unsigned char *)dir, &len); if (error == ERROR_SUCCESS) { diff --git a/dd_lnxsound/ddlnxsound.h b/dd_lnxsound/ddlnxsound.h index 2db4930b..058816aa 100644 --- a/dd_lnxsound/ddlnxsound.h +++ b/dd_lnxsound/ddlnxsound.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -57,7 +57,7 @@ typedef struct LNXSTREAMTAG { // pthread_t thread_id; SDL_Thread *thread_id; - unsigned long thread_handle; + unsigned int thread_handle; volatile bool thread_request_kill; volatile bool thread_alive; volatile bool thread_waiting_for_death; diff --git a/dd_sndlib/Ds3dlib.cpp b/dd_sndlib/Ds3dlib.cpp index 8e0e22b6..699c8504 100644 --- a/dd_sndlib/Ds3dlib.cpp +++ b/dd_sndlib/Ds3dlib.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -471,7 +471,7 @@ inline int sb_get_status(sound_buffer_info *sb) { #endif if (sb->m_mixer_type != SOUND_MIXER_SOFTWARE_16) { LPDIRECTSOUNDBUFFER sound_ptr = sb->m_sound_buffer; - unsigned long status; + unsigned int status; if (sound_ptr) { sound_ptr->GetStatus(&status); @@ -2243,7 +2243,7 @@ int win_llsSystem::PlaySound2d(play_information *play_info, int sound_index, flo void win_llsSystem::LoopStartStreaming(sound_buffer_info *sb, int buffer_type, float volume, float pan, pos_state *cur_pos) { - // unsigned long thread_handle; + // unsigned int thread_handle; int sound_length, buffer_size; int determined_method; bool f_sample_16bit; diff --git a/dd_sndlib/ddsoundload.cpp b/dd_sndlib/ddsoundload.cpp index 40c14245..6dfb11c3 100644 --- a/dd_sndlib/ddsoundload.cpp +++ b/dd_sndlib/ddsoundload.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -127,12 +127,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 + unsigned int ckid; // Current chunk's ID + unsigned int cksize; // Current chunk's size in bytes + unsigned int filesize; // Size of the sound file + unsigned int nextseek = 0; // Location of the next seek - unsigned long aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples + unsigned int aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples // Sound format information int samples_per_second; @@ -140,7 +140,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; + unsigned int temp_long; // Flags for if we previously read data or a format char f_data, f_fmt = 0; @@ -174,7 +174,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 = (unsigned int)cf_ReadInt(cfptr); if (temp_long != 0x46464952) { mprintf((0, "SOUND LOADER: %s is not a RIFF format file\n", filename)); goto error_state; @@ -185,7 +185,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 = (unsigned int)cf_ReadInt(cfptr); if (temp_long != 0x45564157) { mprintf((0, "SOUND LOADER: %s is not a WAVE file\n", filename)); goto error_state; diff --git a/dd_sndlib/ds3dlib_internal.h b/dd_sndlib/ds3dlib_internal.h index dc42bb1d..8b529b14 100644 --- a/dd_sndlib/ds3dlib_internal.h +++ b/dd_sndlib/ds3dlib_internal.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -142,7 +142,7 @@ typedef struct DSSTREAMTAG { int MaxWriteSamples; int MaxWriteBytes; - unsigned long thread_handle; + unsigned int thread_handle; // unsigned thread_id; volatile bool thread_request_kill; volatile bool thread_alive; diff --git a/dd_sndlib/eax.h b/dd_sndlib/eax.h index 9a685124..d7fe450e 100644 --- a/dd_sndlib/eax.h +++ b/dd_sndlib/eax.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -42,7 +42,7 @@ typedef enum { // use this structure for get/set all properties... typedef struct { - unsigned long environment; // 0 to EAX_ENVIRONMENT_COUNT-1 + unsigned int 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 diff --git a/ddio_lnx/ddio_lnx.h b/ddio_lnx/ddio_lnx.h index b2cb4207..8bfea601 100644 --- a/ddio_lnx/ddio_lnx.h +++ b/ddio_lnx/ddio_lnx.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -58,7 +58,7 @@ extern bool DDIO_preemptive; bool ddio_JoyHandler(); void ddio_DebugMessage(unsigned err, char *fmt, ...); -float ddio_TickToSeconds(unsigned long ticks); +float ddio_TickToSeconds(unsigned int ticks); void ddio_KeyHandler(MSG *msg); void ddio_MouseHandler(MSG *msg); diff --git a/ddio_lnx/lnxcdrom.cpp b/ddio_lnx/lnxcdrom.cpp index 28b4755c..16f02273 100644 --- a/ddio_lnx/lnxcdrom.cpp +++ b/ddio_lnx/lnxcdrom.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -522,7 +522,7 @@ bool system_cdroms::Mount(void) { /* don't do this. // Not mounted? Do it ourselves. // so we now have our directory, try to mount - unsigned long int rwflag = MS_MGC_VAL|MS_RDONLY; + unsigned int int rwflag = MS_MGC_VAL|MS_RDONLY; int ret = mount(name,m_MountedDir,"iso9660",rwflag,NULL); if(ret!=0) { @@ -757,8 +757,8 @@ void system_cdroms::QueryDefaultDevice(void) { sptr++; } *dptr = '0';dptr++; - *dptr = '\0'; - + *dptr = '\0'; + dptr = mountpoint + strlen(mountpoint) - 1; // now keep attempting to make the directory until we do or can't even try diff --git a/ddio_lnx/lnxio.cpp b/ddio_lnx/lnxio.cpp index 1c6cbd30..96332b43 100644 --- a/ddio_lnx/lnxio.cpp +++ b/ddio_lnx/lnxio.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -122,7 +122,7 @@ tSerialPort ddio_SerialOpenPort(int port_number, int baud) { #else char devName[50]; struct termios newtio; - unsigned long _baud; + unsigned int _baud; mprintf((0, "DDIO: ddio_SerialOpenPort(%d) called.", port_number)); diff --git a/ddio_win/ddio_win.h b/ddio_win/ddio_win.h index e3ccf1ad..d2c6a325 100644 --- a/ddio_win/ddio_win.h +++ b/ddio_win/ddio_win.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -88,7 +88,7 @@ extern bool DDIO_init; extern bool DDIO_preemptive; bool ddio_JoyHandler(); -float ddio_TickToSeconds(unsigned long ticks); +float ddio_TickToSeconds(unsigned int ticks); #ifdef _DEBUG void ddio_DebugMessage(unsigned err, char *fmt, ...); diff --git a/ddio_win/winfile.cpp b/ddio_win/winfile.cpp index ff51c770..34342dfc 100644 --- a/ddio_win/winfile.cpp +++ b/ddio_win/winfile.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -626,12 +626,12 @@ const char *ddio_GetCDDrive(const char *vol) { #define MAX_FSTYPE_LEN 30 static char drivepath[10]; - unsigned long volflags; + unsigned int volflags; int i; char volume[_MAX_PATH]; char fsname[MAX_FSTYPE_LEN] = ""; - unsigned long serial; - unsigned long component; + unsigned int serial; + unsigned int component; strcpy(drivepath, "c:\\"); @@ -869,4 +869,4 @@ int ddio_DeleteLockFile(const char *dir) { ddio_SetWorkingDir(old_directory); return 1; -} \ No newline at end of file +} diff --git a/ddio_win/winkey.cpp b/ddio_win/winkey.cpp index 05d48d9f..581679ce 100644 --- a/ddio_win/winkey.cpp +++ b/ddio_win/winkey.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -196,7 +196,7 @@ static struct tWinKeyData { LPDIRECTINPUTDEVICE lpdikey; // key device HANDLE evtnotify; // notify event HHOOK winhook; // windows hook - unsigned long thread; // thread id + unsigned int thread; // thread id // osMutex keyframe_mutex; // mutex between // internal key frame and key thread. bool nextframe; // used for mutexing between keyframe and thread. @@ -290,7 +290,7 @@ retry_key_init: bool acquired = dikey_Acquire(lpdikey, true); if (acquired) { // create keyboard thread - unsigned long thrid; + unsigned int thrid; WKD.thread_active = true; WKD.lpdikey = lpdikey; WKD.thread = 0; @@ -300,7 +300,7 @@ retry_key_init: WKD.suspended = false; WKD.nextframe = false; thrid = _beginthread(dikey_Thread, 0, NULL); - if (thrid == (unsigned long)(-1)) { + if (thrid == (unsigned int)(-1)) { mprintf((0, "DDIO: DI_Keyboard thread failed to initialize.\n")); WKD.thread_active = false; WKD.lpdikey = NULL; diff --git a/ddio_win/wintimer.cpp b/ddio_win/wintimer.cpp index 480dd2b4..5001b920 100644 --- a/ddio_win/wintimer.cpp +++ b/ddio_win/wintimer.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -143,7 +143,7 @@ void timer_Close() { Timer_initialized = 0; } -float ddio_TickToSeconds(unsigned long ticks) { +float ddio_TickToSeconds(unsigned int ticks) { if (Timer_use_highres_timer) { LARGE_INTEGER t; t.QuadPart = ticks; diff --git a/lib/Aencode.h b/lib/Aencode.h index b97c79e9..d678ac42 100644 --- a/lib/Aencode.h +++ b/lib/Aencode.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -26,7 +26,7 @@ enum AudioError { ReadSampleEof = 0x80000000, }; -unsigned long AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume, +unsigned int AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume, FILE *out, int levels, int samples_per_subband, float comp_ratio); #endif diff --git a/lib/CZip.h b/lib/CZip.h index 010d4045..d2e2720a 100644 --- a/lib/CZip.h +++ b/lib/CZip.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -68,7 +68,7 @@ #define ubyte unsigned char #define uint unsigned int #define ushort unsigned short -#define ulong unsigned long +#define ulong unsigned int typedef struct { ubyte type; diff --git a/lib/directplay.h b/lib/directplay.h index 7328b4c8..6d9343ea 100644 --- a/lib/directplay.h +++ b/lib/directplay.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -62,7 +62,7 @@ extern bool Directplay_lobby_launched_game; extern DPSESSIONDESC2 Directplay_sessions[MAX_DP_GAMES]; extern int Num_directplay_games; -extern unsigned long Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS]; +extern unsigned int Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS]; // This is called when a game is started, so Directplay will be happy int dp_StartGame(char *gamename); @@ -95,7 +95,7 @@ int dp_DirectPlayJoinGame(LPDPSESSIONDESC2 session); // the amount of buffer space you need // Otherwise, it will fill in the buffer with a bunch of null delimited // strings, with a double null at the end. -int dp_GetModemChoices(char *buffer, unsigned long *size); +int dp_GetModemChoices(char *buffer, unsigned int *size); // Register a DirectPlay lobby aware application // Use this so a directplay lobby provider such as zone.com can launch the game diff --git a/lib/forcefeedback.h b/lib/forcefeedback.h index 44605361..4e1f487c 100644 --- a/lib/forcefeedback.h +++ b/lib/forcefeedback.h @@ -169,17 +169,17 @@ typedef struct tEffectRamp { long End; // +- 10,000 } tEffRamp; typedef struct tEffectWave { - unsigned long Mag; // 0 to 10,000 + unsigned int Mag; // 0 to 10,000 long Offset; // +- 10,000 - unsigned long Phase; // 0 to 35,999 - unsigned long Period; + 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 - unsigned long PositiveSaturation; // 0 to 10,000 - unsigned long NegativeSaturation; // 0 to 10,000 + unsigned int PositiveSaturation; // 0 to 10,000 + unsigned int NegativeSaturation; // 0 to 10,000 long DeadBand; // 0 to 10,000 } tEffCondition; typedef struct tEffectCustom { @@ -196,10 +196,10 @@ typedef union tEffectInfo { tEffCustom Custom; } tEffInfo; typedef struct tEffectEnvelope { - unsigned long AttackLevel; - unsigned long AttackTime; - unsigned long FadeLevel; - unsigned long FadeTime; + unsigned int AttackLevel; + unsigned int AttackTime; + unsigned int FadeLevel; + unsigned int FadeTime; } tEffEnvelope; typedef enum { kXAxisOnly, kYAxisOnly, kBothAxes } tEffAxis; typedef struct tFFB_Effect { @@ -207,12 +207,12 @@ typedef struct tFFB_Effect { tEffType Type; // tEffInfo TypeInfo[2]; tEffInfo TypeInfo; - unsigned long Duration; - unsigned long Gain; // 0-10000 -- scales all magnitudes and envelope - unsigned long Period; + unsigned int Duration; + unsigned int Gain; // 0-10000 -- scales all magnitudes and envelope + unsigned int Period; tEffAxis Axis; tJoyButtons Trigger; - unsigned long TriggerRepeatTime; + unsigned int TriggerRepeatTime; long Direction; // 0 to 360 deg. tEffEnvelope Envelope; } tFFB_Effect; diff --git a/lib/linux/dyna_glide.h b/lib/linux/dyna_glide.h index 7db759ca..8175ccf7 100644 --- a/lib/linux/dyna_glide.h +++ b/lib/linux/dyna_glide.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -173,9 +173,9 @@ typedef unsigned short FxU16; typedef signed short FxI16; -typedef signed long FxI32; +typedef signed int FxI32; -typedef unsigned long FxU32; +typedef unsigned int FxU32; typedef int FxBool; @@ -189,7 +189,7 @@ typedef double FxDouble; */ -typedef unsigned long FxColor_t; +typedef unsigned int FxColor_t; typedef struct { float r, g, b, a; diff --git a/lib/linux/dyna_xwin.h b/lib/linux/dyna_xwin.h index f2453235..5228bddd 100644 --- a/lib/linux/dyna_xwin.h +++ b/lib/linux/dyna_xwin.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -83,7 +83,7 @@ FEXTERN XAllocWMHints_fp soXAllocWMHints; typedef int (*XCloseDisplay_fp)(Display *); FEXTERN XCloseDisplay_fp soXCloseDisplay; -typedef GC (*XCreateGC_fp)(Display *, Drawable, unsigned long, XGCValues *); +typedef GC (*XCreateGC_fp)(Display *, Drawable, unsigned int, XGCValues *); FEXTERN XCreateGC_fp soXCreateGC; typedef XImage *(*XCreateImage_fp)(Display *, Visual *, unsigned int, int, int, char *, unsigned int, unsigned int, int, @@ -97,7 +97,7 @@ typedef Cursor (*XCreatePixmapCursor_fp)(Display *, Pixmap, Pixmap, XColor *, XC FEXTERN XCreatePixmapCursor_fp soXCreatePixmapCursor; typedef Window (*XCreateWindow_fp)(Display *, Window, int, int, unsigned int, unsigned int, unsigned int, int, - unsigned int, Visual *, unsigned long, XSetWindowAttributes *); + unsigned int, Visual *, unsigned int, XSetWindowAttributes *); FEXTERN XCreateWindow_fp soXCreateWindow; typedef int (*XDefineCursor_fp)(Display *, Window, Cursor); @@ -160,8 +160,8 @@ FEXTERN XAutoRepeatOn_fp soXAutoRepeatOn; typedef int (*XAutoRepeatOff_fp)(Display *); FEXTERN XAutoRepeatOff_fp soXAutoRepeatOff; -typedef int (*XGetWindowProperty_fp)(Display *, Window, Atom, long, long, Bool, Atom, Atom *, int *, unsigned long *, - unsigned long *, unsigned char **); +typedef int (*XGetWindowProperty_fp)(Display *, Window, Atom, long, long, Bool, Atom, Atom *, int *, unsigned int *, + unsigned int *, unsigned char **); FEXTERN XGetWindowProperty_fp soXGetWindowProperty; typedef Status (*XQueryTree_fp)(Display *, Window, Window *, Window *, Window **, unsigned int *); @@ -179,7 +179,7 @@ FEXTERN XRaiseWindow_fp soXRaiseWindow; typedef int (*XChangeProperty_fp)(Display *, Window, Atom, Atom, int, int, _Xconst unsigned char *, int); FEXTERN XChangeProperty_fp soXChangeProperty; -typedef int (*XChangeWindowAttributes_fp)(Display *, Window, unsigned long, XSetWindowAttributes *); +typedef int (*XChangeWindowAttributes_fp)(Display *, Window, unsigned int, XSetWindowAttributes *); FEXTERN XChangeWindowAttributes_fp soXChangeWindowAttributes; typedef int (*XMoveResizeWindow_fp)(Display *, Window, int, int, unsigned int, unsigned int); diff --git a/lib/mvelibw.h b/lib/mvelibw.h index 1795df40..9a52cf03 100644 --- a/lib/mvelibw.h +++ b/lib/mvelibw.h @@ -95,7 +95,7 @@ void __cdecl MVE_dsbSetPan(long lPan); void __cdecl MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth, unsigned WriteWin, unsigned char *WriteWinPtr, - unsigned long WinSize, unsigned WinGran, + unsigned int WinSize, unsigned WinGran, void *SetBank, unsigned hicolor); /* This function alters the display from 640x480 or 640x400 to 640x350 resolution. @@ -293,7 +293,7 @@ int __cdecl MVE_frGet(MVE_frStream frs, ** with the standard player interface, except that this interface requires ** polling each frame instead, and must be passed pointers to the variables where ** the values will be returned. -** +** */ void __cdecl MVE_frPal(MVE_frStream frs, unsigned char **pPaltbl, unsigned *pStart, unsigned *pCount); diff --git a/lib/networking.h b/lib/networking.h index a1819621..892620d7 100644 --- a/lib/networking.h +++ b/lib/networking.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -370,7 +370,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); +unsigned int nw_GetHostAddressFromNumbers(char *str); // Fills in the string with the string address from the internet address void nw_GetNumbersFromHostAddress(network_address *address, char *str); @@ -438,7 +438,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_dpid(ubyte *data, int *length, unsigned int dpid); // This is all the reliable UDP stuff... #define MAXNETBUFFERS \ diff --git a/lib/pstypes.h b/lib/pstypes.h index 97bf0211..df6c9764 100644 --- a/lib/pstypes.h +++ b/lib/pstypes.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -26,7 +26,7 @@ typedef unsigned char ubyte; typedef signed char sbyte; typedef unsigned short ushort; typedef unsigned int uint; -typedef unsigned long ulong; +typedef unsigned int ulong; #ifdef _MSC_VER // only Visual C++ has __int64 typedef __int64 longlong; diff --git a/libacm/aencode.cpp b/libacm/aencode.cpp index e8b55623..e76096c5 100644 --- a/libacm/aencode.cpp +++ b/libacm/aencode.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -993,7 +993,7 @@ void EncodeFlush(Encoder &enc) { ProcessBlock(enc); } -unsigned long AudioEncode(ReadSampleFunction *read, void *data, unsigned channels, unsigned sample_rate, float volume, +unsigned int 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)); diff --git a/libmve/SystemInterfaces.h b/libmve/SystemInterfaces.h index 493610d0..a97e981d 100644 --- a/libmve/SystemInterfaces.h +++ b/libmve/SystemInterfaces.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -87,7 +87,7 @@ public: // 0 : no error // -1 : Cannot set volume // -2 : Invalid parameters - virtual int SetVolume(signed long vol) = 0; + virtual int SetVolume(signed int vol) = 0; /////////////////////////// // SetPan @@ -98,7 +98,7 @@ public: // 0 : no error // -1 : Cannot set pan // -2 : Invalid parameters - virtual int SetPan(signed long pan) = 0; + virtual int SetPan(signed int pan) = 0; ///////////////////////// // Stop diff --git a/libmve/lnxdsound.cpp b/libmve/lnxdsound.cpp index 5787e35f..ba324780 100644 --- a/libmve/lnxdsound.cpp +++ b/libmve/lnxdsound.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -236,7 +236,7 @@ int LnxSoundBuffer_Release(LnxSoundBuffer *buff) { // 0 : no error // -1 : Cannot set volume // -2 : Invalid parameters -int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) { +int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed int vol) { if (!buff) return -1; @@ -260,9 +260,9 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) { double vt; vt = (double)(buff->volume - (buff->pan > 0 ? buff->pan : 0)); - buff->left_vol = (unsigned long)(pow(2.0, vt / 600.0) * 32768.0); + buff->left_vol = (unsigned int)(pow(2.0, vt / 600.0) * 32768.0); vt = (double)(buff->volume + (buff->pan < 0 ? buff->pan : 0)); - buff->right_vol = (unsigned long)(pow(2.0, vt / 600.0) * 32768.0); + buff->right_vol = (unsigned int)(pow(2.0, vt / 600.0) * 32768.0); exit_critical(); @@ -278,7 +278,7 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) { // 0 : no error // -1 : Cannot set pan // -2 : Invalid parameters -int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan) { +int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed int pan) { if (!buff) return -1; @@ -295,9 +295,9 @@ int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan) { double pt; pt = (double)(buff->volume - (buff->pan > 0 ? buff->pan : 0)); - buff->left_vol = (unsigned long)(pow(2.0, pt / 600.0) * 32768.0); + buff->left_vol = (unsigned int)(pow(2.0, pt / 600.0) * 32768.0); pt = (double)(buff->volume + (buff->pan < 0 ? buff->pan : 0)); - buff->right_vol = (unsigned long)(pow(2.0, pt / 600.0) * 32768.0); + buff->right_vol = (unsigned int)(pow(2.0, pt / 600.0) * 32768.0); exit_critical(); diff --git a/libmve/lnxdsound.h b/libmve/lnxdsound.h index 4c881cd1..7adc5bc8 100644 --- a/libmve/lnxdsound.h +++ b/libmve/lnxdsound.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -43,12 +43,12 @@ typedef struct { unsigned int play_cursor; unsigned int write_cursor; unsigned int flags; - unsigned long left_vol, right_vol; + unsigned int left_vol, right_vol; unsigned char *buffer; - signed long volume; - signed long pan; + signed int volume; + signed int pan; WAVEFORMATEX wfx; @@ -90,7 +90,7 @@ int LnxSoundBuffer_Release(LnxSoundBuffer *buff); // 0 : no error // -1 : Cannot set volume // -2 : Invalid parameters -int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol); +int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed int vol); /////////////////////////// // LnxSoundBuffer_SetPan @@ -101,7 +101,7 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol); // 0 : no error // -1 : Cannot set pan // -2 : Invalid parameters -int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan); +int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed int pan); ///////////////////////// // LnxSoundBuffer_Stop diff --git a/libmve/mvelibl.cpp b/libmve/mvelibl.cpp index a02c02b2..a151b756 100644 --- a/libmve/mvelibl.cpp +++ b/libmve/mvelibl.cpp @@ -133,20 +133,20 @@ static int sync_wait_quanta = 0; static bool sync_late = false; static bool sync_FrameDropped = false; -static void syncReset(unsigned long wait_quanta); +static void syncReset(unsigned int wait_quanta); static void syncRelease(void); -static bool syncInit(unsigned long period, unsigned wait_quanta); +static bool syncInit(unsigned int period, unsigned wait_quanta); static bool syncWait(void); static void syncSync(void); -static void syncReset(unsigned long wait_quanta) { +static void syncReset(unsigned int wait_quanta) { sync_time = wait_quanta - platform_timeGetTime() * 1000; sync_active = true; } static void syncRelease(void) { sync_active = false; } -static bool syncInit(unsigned long period, unsigned wait_quanta) { +static bool syncInit(unsigned int period, unsigned wait_quanta) { int new_wait_quanta = -(long)(period * wait_quanta + (wait_quanta >> 1)); // If timer is still running and has same timing @@ -494,8 +494,8 @@ static unsigned sndAddHelper(unsigned char *dst, const unsigned char **pSrc, uns src += len >> 1; } else { if (init) { - state = IntelSwapper(*(unsigned long *)src); - *(unsigned long *)dst = state; + state = IntelSwapper(*(unsigned int *)src); + *(unsigned int *)dst = state; src += 4; dst += 4; len -= 4; @@ -835,7 +835,7 @@ static unsigned sf_hicolor = 0; // Hicolor mode (0:none,1:normal,2:swapped) // Banked screen parameters, Private, see mveliba.asm void *sf_SetBank = NULL; unsigned sf_WinGran = 0; -unsigned long sf_WinSize = 0; +unsigned int sf_WinSize = 0; unsigned sf_WinGranPerSize = 0; //{sf_WriteWinPtr and sf_WriteWinLimit replace sf_WriteWinSeg, see mveliba.asm} unsigned char *sf_WriteWinPtr = NULL; @@ -868,7 +868,7 @@ void mve_ShowFrameFieldHi(unsigned char *buf, unsigned bufw, unsigned bufh, unsi // dx: Window position in video memory in units of WinGran. // on return, registers AX and DX are destroyed. void MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth, unsigned WriteWin, unsigned char *WriteWinPtr, - unsigned long WinSize, unsigned WinGran, void *SetBank, unsigned hicolor) { + unsigned int WinSize, unsigned WinGran, void *SetBank, unsigned hicolor) { sf_ScreenWidth = w; sf_ScreenHeight = h; sf_ResolutionWidth = w; diff --git a/libmve/mvelibl.h b/libmve/mvelibl.h index 837e1607..f417db17 100644 --- a/libmve/mvelibl.h +++ b/libmve/mvelibl.h @@ -80,7 +80,7 @@ void MVE_dsbSetPan(long lPan); // is just used for window centering and for determining // how and when to do palette callbacks. void MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth, unsigned WriteWin, unsigned char *WriteWinPtr, - unsigned long WinSize, unsigned WinGran, void *SetBank, unsigned hicolor); + unsigned int WinSize, unsigned WinGran, void *SetBank, unsigned hicolor); // This function alters the display from 640x480 or 640x400 to 640x350 resolution. void MVE_ForceVres350(void); diff --git a/linux/lnxmono.cpp b/linux/lnxmono.cpp index 1b7c6499..0a0b4063 100644 --- a/linux/lnxmono.cpp +++ b/linux/lnxmono.cpp @@ -107,7 +107,7 @@ static unsigned long long Timer_sys_start_time = 0; static unsigned long long Timer_accum = 0, Timer_high_mark = 0; static float nw_TCPLoggingTimer(void) { - unsigned long time_ms; + unsigned int time_ms; unsigned long long ret; struct timeval t; @@ -208,7 +208,7 @@ bool nw_InitTCPLogging(char *ip, unsigned short port) { dpthread_self = (pthread_self_fp)dlsym(lib, "pthread_self"); #endif - unsigned long argp = 1; + unsigned int argp = 1; int addrlen = sizeof(SOCKADDR_IN); tcp_log_sock = socket(AF_INET, SOCK_STREAM, 0); if (INVALID_SOCKET == tcp_log_sock) { diff --git a/lnxmvelib/dyna_xwin.h b/lnxmvelib/dyna_xwin.h index f2453235..5228bddd 100644 --- a/lnxmvelib/dyna_xwin.h +++ b/lnxmvelib/dyna_xwin.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -83,7 +83,7 @@ FEXTERN XAllocWMHints_fp soXAllocWMHints; typedef int (*XCloseDisplay_fp)(Display *); FEXTERN XCloseDisplay_fp soXCloseDisplay; -typedef GC (*XCreateGC_fp)(Display *, Drawable, unsigned long, XGCValues *); +typedef GC (*XCreateGC_fp)(Display *, Drawable, unsigned int, XGCValues *); FEXTERN XCreateGC_fp soXCreateGC; typedef XImage *(*XCreateImage_fp)(Display *, Visual *, unsigned int, int, int, char *, unsigned int, unsigned int, int, @@ -97,7 +97,7 @@ typedef Cursor (*XCreatePixmapCursor_fp)(Display *, Pixmap, Pixmap, XColor *, XC FEXTERN XCreatePixmapCursor_fp soXCreatePixmapCursor; typedef Window (*XCreateWindow_fp)(Display *, Window, int, int, unsigned int, unsigned int, unsigned int, int, - unsigned int, Visual *, unsigned long, XSetWindowAttributes *); + unsigned int, Visual *, unsigned int, XSetWindowAttributes *); FEXTERN XCreateWindow_fp soXCreateWindow; typedef int (*XDefineCursor_fp)(Display *, Window, Cursor); @@ -160,8 +160,8 @@ FEXTERN XAutoRepeatOn_fp soXAutoRepeatOn; typedef int (*XAutoRepeatOff_fp)(Display *); FEXTERN XAutoRepeatOff_fp soXAutoRepeatOff; -typedef int (*XGetWindowProperty_fp)(Display *, Window, Atom, long, long, Bool, Atom, Atom *, int *, unsigned long *, - unsigned long *, unsigned char **); +typedef int (*XGetWindowProperty_fp)(Display *, Window, Atom, long, long, Bool, Atom, Atom *, int *, unsigned int *, + unsigned int *, unsigned char **); FEXTERN XGetWindowProperty_fp soXGetWindowProperty; typedef Status (*XQueryTree_fp)(Display *, Window, Window *, Window *, Window **, unsigned int *); @@ -179,7 +179,7 @@ FEXTERN XRaiseWindow_fp soXRaiseWindow; typedef int (*XChangeProperty_fp)(Display *, Window, Atom, Atom, int, int, _Xconst unsigned char *, int); FEXTERN XChangeProperty_fp soXChangeProperty; -typedef int (*XChangeWindowAttributes_fp)(Display *, Window, unsigned long, XSetWindowAttributes *); +typedef int (*XChangeWindowAttributes_fp)(Display *, Window, unsigned int, XSetWindowAttributes *); FEXTERN XChangeWindowAttributes_fp soXChangeWindowAttributes; typedef int (*XMoveResizeWindow_fp)(Display *, Window, int, int, unsigned int, unsigned int); diff --git a/lnxmvelib/lnxdraw.cpp b/lnxmvelib/lnxdraw.cpp index 59702c57..e94fa5a6 100644 --- a/lnxmvelib/lnxdraw.cpp +++ b/lnxmvelib/lnxdraw.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -212,7 +212,7 @@ int LnxDraw_CreateWindow(LnxWindowDesc *ldesc, LnxWindow **lphandle) { wnd->lpXvisual = wnd->viVisualInfo.visual; wnd->cmColorMap = DefaultColormapOfScreen(DefaultScreenOfDisplay(lpDisplay)); - unsigned long attrib_mask; + unsigned int attrib_mask; XSetWindowAttributes attrib; // setup some attribute and hints for actual window creation @@ -508,7 +508,7 @@ void LnxDraw_UnlockSurface(LnxWindow *wnd, unsigned char *ptr) { SDL_UpdateRect(wnd->surface, 0, 0, wnd->dwWidth, wnd->dwHeight); #ifdef __DUMP_MVE_TO_DISK - static unsigned long framenum = 0; + static unsigned int framenum = 0; char filename[100]; snprintf(filename, sizeof(filename), "./mve/frame%lu.bmp", framenum); SDL_SaveBMP(wnd->surface, filename); @@ -738,7 +738,7 @@ inline void BltBuffer32ToPixMap24(unsigned char *pixmap, unsigned char *buffer, b = (c & 0x000000ff); if (a) - *(unsigned long *)data = ((r << 16) + (g << 8) + b); + *(unsigned int *)data = ((r << 16) + (g << 8) + b); data += 4; buffer += 4; } @@ -759,7 +759,7 @@ inline void BltBuffer16ToPixMap24(unsigned char *pixmap, unsigned char *buffer, b = (c & 0x001F); if (a) - *(unsigned long *)data = ((r << 19) + (g << 11) + (b << 3)); + *(unsigned int *)data = ((r << 19) + (g << 11) + (b << 3)); data += 4; buffer += 2; } diff --git a/lnxmvelib/lnxdsound.cpp b/lnxmvelib/lnxdsound.cpp index ffd144e0..975e1842 100644 --- a/lnxmvelib/lnxdsound.cpp +++ b/lnxmvelib/lnxdsound.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -236,7 +236,7 @@ int LnxSoundBuffer_Release(LnxSoundBuffer *buff) { // 0 : no error // -1 : Cannot set volume // -2 : Invalid parameters -int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) { +int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed int vol) { if (!buff) return -1; @@ -260,9 +260,9 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) { double vt; vt = (double)(buff->volume - (buff->pan > 0 ? buff->pan : 0)); - buff->left_vol = (unsigned long)(pow(2.0, vt / 600.0) * 32768.0); + buff->left_vol = (unsigned int)(pow(2.0, vt / 600.0) * 32768.0); vt = (double)(buff->volume + (buff->pan < 0 ? buff->pan : 0)); - buff->right_vol = (unsigned long)(pow(2.0, vt / 600.0) * 32768.0); + buff->right_vol = (unsigned int)(pow(2.0, vt / 600.0) * 32768.0); exit_critical(); @@ -278,7 +278,7 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) { // 0 : no error // -1 : Cannot set pan // -2 : Invalid parameters -int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan) { +int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed int pan) { if (!buff) return -1; @@ -295,9 +295,9 @@ int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan) { double pt; pt = (double)(buff->volume - (buff->pan > 0 ? buff->pan : 0)); - buff->left_vol = (unsigned long)(pow(2.0, pt / 600.0) * 32768.0); + buff->left_vol = (unsigned int)(pow(2.0, pt / 600.0) * 32768.0); pt = (double)(buff->volume + (buff->pan < 0 ? buff->pan : 0)); - buff->right_vol = (unsigned long)(pow(2.0, pt / 600.0) * 32768.0); + buff->right_vol = (unsigned int)(pow(2.0, pt / 600.0) * 32768.0); exit_critical(); diff --git a/lnxmvelib/lnxdsound.h b/lnxmvelib/lnxdsound.h index 858bfa6b..c5612066 100644 --- a/lnxmvelib/lnxdsound.h +++ b/lnxmvelib/lnxdsound.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -78,12 +78,12 @@ typedef struct { unsigned int play_cursor; unsigned int write_cursor; unsigned int flags; - unsigned long left_vol, right_vol; + unsigned int left_vol, right_vol; unsigned char *buffer; - signed long volume; - signed long pan; + signed int volume; + signed int pan; WAVEFORMATEX wfx; @@ -125,7 +125,7 @@ int LnxSoundBuffer_Release(LnxSoundBuffer *buff); // 0 : no error // -1 : Cannot set volume // -2 : Invalid parameters -int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol); +int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed int vol); /////////////////////////// // LnxSoundBuffer_SetPan @@ -136,7 +136,7 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol); // 0 : no error // -1 : Cannot set pan // -2 : Invalid parameters -int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan); +int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed int pan); ///////////////////////// // LnxSoundBuffer_Stop diff --git a/lnxmvelib/mvelibi.h b/lnxmvelib/mvelibi.h index ecf7304e..75256829 100644 --- a/lnxmvelib/mvelibi.h +++ b/lnxmvelib/mvelibi.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -116,7 +116,7 @@ typedef struct _mcmd_hdr { #define mcmd_syncInit 2 typedef struct _syncInit { - unsigned long period; // period of quanta + unsigned int period; // period of quanta unsigned short wait_quanta; // # of quanta per frame } marg_syncInit; @@ -138,7 +138,7 @@ typedef struct _sndConfigure { unsigned char dummy1; unsigned short frequency; // Minor opcode 1 extends buflen to be a long - unsigned long buflen; + unsigned int buflen; } marg_sndConfigure; #define mcmd_sndSync 4 @@ -227,13 +227,13 @@ typedef struct _palLoadPalette { #define mcmd_nfPkInfo 19 #define mcmd_nfHPkInfo 20 typedef struct _nfPkInfo { - unsigned long error; // scaled by 10000 + unsigned int 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 + unsigned int idcode; // Code identifying version mcomp used to create } marg_idcode; #if __SC__ diff --git a/lnxmvelib/mvelibl.cpp b/lnxmvelib/mvelibl.cpp index 313e1cbc..85343942 100644 --- a/lnxmvelib/mvelibl.cpp +++ b/lnxmvelib/mvelibl.cpp @@ -130,20 +130,20 @@ static int sync_wait_quanta; static bool sync_late = FALSE; static bool sync_FrameDropped = FALSE; -static void syncReset(unsigned long wait_quanta); +static void syncReset(unsigned int wait_quanta); static void syncRelease(void); -static bool syncInit(unsigned long period, unsigned wait_quanta); +static bool syncInit(unsigned int period, unsigned wait_quanta); static bool syncWait(void); static void syncSync(void); -static void syncReset(unsigned long wait_quanta) { +static void syncReset(unsigned int wait_quanta) { sync_time = wait_quanta - timeGetTime() * 1000; sync_active = TRUE; } static void syncRelease(void) { sync_active = FALSE; } -static bool syncInit(unsigned long period, unsigned wait_quanta) { +static bool syncInit(unsigned int period, unsigned wait_quanta) { int new_wait_quanta = -(long)(period * wait_quanta + (wait_quanta >> 1)); // If timer is still running and has same timing // characteristics, assume we are trying to continue smoothly @@ -496,9 +496,9 @@ static unsigned sndAddHelper(unsigned char *dst, unsigned char **pSrc, unsigned src += len >> 1; } else { if (init) { - state = *(unsigned long *)src; + state = *(unsigned int *)src; state = INTEL_INT(state); - *(unsigned long *)dst = state; + *(unsigned int *)dst = state; src += 4; dst += 4; len -= 4; @@ -876,7 +876,7 @@ unsigned sf_hicolor; // Hicolor mode (0:none,1:normal,2:swapped) // Banked screen parameters, Private, see mveliba.asm void *sf_SetBank; unsigned sf_WinGran; -unsigned long sf_WinSize; +unsigned int sf_WinSize; unsigned sf_WinGranPerSize; //{sf_WriteWinPtr and sf_WriteWinLimit replace sf_WriteWinSeg, see mveliba.asm} unsigned char *sf_WriteWinPtr; @@ -909,7 +909,7 @@ void mve_ShowFrameFieldHi(unsigned char *buf, unsigned bufw, unsigned bufh, unsi // dx: Window position in video memory in units of WinGran. // on return, registers AX and DX are destroyed. void MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth, unsigned WriteWin, unsigned char *WriteWinPtr, - unsigned long WinSize, unsigned WinGran, void *SetBank, unsigned hicolor) { + unsigned int WinSize, unsigned WinGran, void *SetBank, unsigned hicolor) { sf_ScreenWidth = w; sf_ScreenHeight = h; sf_ResolutionWidth = w; diff --git a/lnxmvelib/mvelibl.h b/lnxmvelib/mvelibl.h index 8433fba3..964fc374 100644 --- a/lnxmvelib/mvelibl.h +++ b/lnxmvelib/mvelibl.h @@ -90,7 +90,7 @@ void MVE_dsbSetPan(long lPan); ** how and when to do palette callbacks. */ void MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth, unsigned WriteWin, unsigned char *WriteWinPtr, - unsigned long WinSize, unsigned WinGran, void *SetBank, unsigned hicolor); + unsigned int WinSize, unsigned WinGran, void *SetBank, unsigned hicolor); /* This function alters the display from 640x480 or 640x400 to 640x350 resolution. */ diff --git a/movie/d3movie.cpp b/movie/d3movie.cpp index 417f8aeb..1c844217 100644 --- a/movie/d3movie.cpp +++ b/movie/d3movie.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -94,7 +94,7 @@ public: // 0 : no error // -1 : Cannot set volume // -2 : Invalid parameters - int SetVolume(signed long vol) { return m_pBuffer->SetVolume(vol); } + int SetVolume(signed int vol) { return m_pBuffer->SetVolume(vol); } /////////////////////////// // SetPan @@ -105,7 +105,7 @@ public: // 0 : no error // -1 : Cannot set pan // -2 : Invalid parameters - int SetPan(signed long pan) { return m_pBuffer->SetPan(pan); } + int SetPan(signed int pan) { return m_pBuffer->SetPan(pan); } ///////////////////////// // Stop @@ -289,7 +289,7 @@ public: // 0 : no error // -1 : Cannot set volume // -2 : Invalid parameters - int SetVolume(signed long vol) { return LnxSoundBuffer_SetVolume(m_pBuffer, vol); } + int SetVolume(signed int vol) { return LnxSoundBuffer_SetVolume(m_pBuffer, vol); } /////////////////////////// // SetPan @@ -300,7 +300,7 @@ public: // 0 : no error // -1 : Cannot set pan // -2 : Invalid parameters - int SetPan(signed long pan) { return LnxSoundBuffer_SetPan(m_pBuffer, pan); } + int SetPan(signed int pan) { return LnxSoundBuffer_SetPan(m_pBuffer, pan); } ///////////////////////// // Stop diff --git a/netcon/includes/con_dll.h b/netcon/includes/con_dll.h index f660a79e..5a09a2f4 100644 --- a/netcon/includes/con_dll.h +++ b/netcon/includes/con_dll.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -579,7 +579,7 @@ dp_ListDirectPlayGames_fp DLLdp_ListDirectPlayGames; typedef int (*dp_InitDirectPlay_fp)(char *conn_name, void *parms, int num_elements); dp_InitDirectPlay_fp DLLdp_InitDirectPlay; -typedef int (*dp_GetModemChoices_fp)(char *buffer, unsigned long *size); +typedef int (*dp_GetModemChoices_fp)(char *buffer, unsigned int *size); dp_GetModemChoices_fp DLLdp_GetModemChoices; #endif @@ -739,8 +739,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 + unsigned int checksum; // This value needs to be equal to whatever the checksum is once the packet is decoded + unsigned int 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 diff --git a/netcon/inetfile/Chttpget.cpp b/netcon/inetfile/Chttpget.cpp index 71d0af39..cfa8aad6 100644 --- a/netcon/inetfile/Chttpget.cpp +++ b/netcon/inetfile/Chttpget.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -208,7 +208,7 @@ void ChttpGet::PrepSocket(char *URL) { m_State = HTTP_STATE_SOCKET_ERROR; return; } - unsigned long arg; + unsigned int arg; arg = true; #if defined(WIN32) diff --git a/netcon/lanclient/lanclient.cpp b/netcon/lanclient/lanclient.cpp index f80515aa..e181108c 100644 --- a/netcon/lanclient/lanclient.cpp +++ b/netcon/lanclient/lanclient.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -696,7 +696,7 @@ int MainMultiplayerMenu() { void AutoLoginAndJoinGame(void) { unsigned short port; - unsigned long iaddr; + unsigned int iaddr; *DLLMultiGameStarting = 0; @@ -714,7 +714,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(unsigned int)); s_address.port = port; s_address.connection_type = NP_TCP; *DLLGame_is_master_tracker_game = 0; diff --git a/netgames/dmfc/dmfcbase.cpp b/netgames/dmfc/dmfcbase.cpp index b6a46c20..55bcdb10 100644 --- a/netgames/dmfc/dmfcbase.cpp +++ b/netgames/dmfc/dmfcbase.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -2828,7 +2828,7 @@ bool DMFCBase::IsAddressBanned(network_address *addr, const char *tracker_id) { return false; } - unsigned long address; + unsigned int address; tHostsNode *curr; memcpy(&address, &addr->address, 4); @@ -4279,8 +4279,8 @@ void ParseHostsFile(char *filename, tHostsNode **root) { char save_buffer[256]; char s_ip[16], s_mask[16]; - unsigned long ip_address; - unsigned long mask; + unsigned int ip_address; + unsigned int mask; char *ptr; while (!DLLcfeof(file)) { diff --git a/netgames/dmfc/dmfcfunctions.cpp b/netgames/dmfc/dmfcfunctions.cpp index 7898acc3..28bf5c26 100644 --- a/netgames/dmfc/dmfcfunctions.cpp +++ b/netgames/dmfc/dmfcfunctions.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -329,7 +329,7 @@ DMFCFUNCTION void (*DLLInitPlayerNewShip)(int slot, int inven_reset); DMFCFUNCTION void *(*DLLCheckBoxCreate)(void *parent, int id, void *title, int x, int y, int w, int h, int flags); DMFCFUNCTION void (*DLLCheckBoxSetCheck)(void *cb, bool state); DMFCFUNCTION bool (*DLLCheckBoxIsChecked)(void *cb); -DMFCFUNCTION unsigned long (*DLLnw_GetHostAddressFromNumbers)(char *str); +DMFCFUNCTION unsigned int (*DLLnw_GetHostAddressFromNumbers)(char *str); DMFCFUNCTION void (*TableFilesClear)(void); DMFCFUNCTION bool (*TableFileAdd)(char *filename); DMFCFUNCTION void (*DLLDebugBreak_callback_stop)(void); diff --git a/netgames/dmfc/encryption.cpp b/netgames/dmfc/encryption.cpp index b4a7c452..0fa8f38f 100644 --- a/netgames/dmfc/encryption.cpp +++ b/netgames/dmfc/encryption.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -39,11 +39,11 @@ class IceSubkey { public: - unsigned long val[3]; + unsigned int val[3]; }; // the S-boxes -static unsigned long ice_sbox[4][1024]; +static unsigned int ice_sbox[4][1024]; static int ice_sboxes_initialised = 0; // modulo values for the S-boxes @@ -55,7 +55,7 @@ static const int ice_sxor[4][4] = { {0x83, 0x85, 0x9b, 0xcd}, {0xcc, 0xa7, 0xad, 0x41}, {0x4b, 0x2e, 0xd4, 0x33}, {0xea, 0xcb, 0x2e, 0x04}}; // Permutation values for the P-box -static const unsigned long ice_pbox[32] = { +static const unsigned int ice_pbox[32] = { 0x00000001, 0x00000080, 0x00000400, 0x00002000, 0x00080000, 0x00200000, 0x01000000, 0x40000000, 0x00000008, 0x00000020, 0x00000100, 0x00004000, 0x00010000, 0x00800000, 0x04000000, 0x20000000, 0x00000004, 0x00000010, 0x00000200, 0x00008000, 0x00020000, 0x00400000, 0x08000000, 0x10000000, @@ -90,7 +90,7 @@ static uint gf_mult(uint a, uint b, uint m) { // Galois Field exponentiation. // Raise the base to the power of 7, modulo m. // -static unsigned long gf_exp7(uint b, uint m) { +static unsigned int gf_exp7(uint b, uint m) { uint x; if (b == 0) @@ -106,9 +106,9 @@ static unsigned long gf_exp7(uint b, uint m) { // // Carry out the ICE 32-bit P-box permutation. // -static unsigned long ice_perm32(unsigned long x) { - unsigned long res = 0; - const unsigned long *pbox = ice_pbox; +static unsigned int ice_perm32(unsigned int x) { + unsigned int res = 0; + const unsigned int *pbox = ice_pbox; while (x) { if (x & 1) @@ -130,7 +130,7 @@ static void ice_sboxes_init(void) { for (i = 0; i < 1024; i++) { int col = (i >> 1) & 0xff; int row = (i & 0x1) | ((i & 0x200) >> 8); - unsigned long x; + unsigned int x; x = gf_exp7(col ^ ice_sxor[0][row], ice_smod[0][row]) << 24; ice_sbox[0][i] = ice_perm32(x); @@ -186,9 +186,9 @@ IceKey::~IceKey() { // // The single round ICE f function. // -static unsigned long ice_f(unsigned long p, const IceSubkey *sk) { - unsigned long tl, tr; /* Expanded 40-bit values */ - unsigned long al, ar; /* Salted expanded 40-bit values */ +static unsigned int ice_f(unsigned int p, const IceSubkey *sk) { + unsigned int tl, tr; /* Expanded 40-bit values */ + unsigned int al, ar; /* Salted expanded 40-bit values */ // Left half expansion tl = ((p >> 16) & 0x3ff) | (((p >> 14) | (p << 18)) & 0xffc00); @@ -213,12 +213,12 @@ static unsigned long ice_f(unsigned long p, const IceSubkey *sk) { // void IceKey::encrypt(const ubyte *ptext, ubyte *ctext) const { int i; - unsigned long l, r; + unsigned int l, r; - l = (((unsigned long)ptext[0]) << 24) | (((unsigned long)ptext[1]) << 16) | (((unsigned long)ptext[2]) << 8) | + l = (((unsigned int)ptext[0]) << 24) | (((unsigned int)ptext[1]) << 16) | (((unsigned int)ptext[2]) << 8) | ptext[3]; - r = (((unsigned long)ptext[4]) << 24) | (((unsigned long)ptext[5]) << 16) | (((unsigned long)ptext[6]) << 8) | + r = (((unsigned int)ptext[4]) << 24) | (((unsigned int)ptext[5]) << 16) | (((unsigned int)ptext[6]) << 8) | ptext[7]; for (i = 0; i < _rounds; i += 2) { @@ -240,11 +240,11 @@ void IceKey::encrypt(const ubyte *ptext, ubyte *ctext) const { // void IceKey::decrypt(const ubyte *ctext, ubyte *ptext) const { int i; - unsigned long l, r; + unsigned int l, r; - l = (((unsigned long)ctext[0]) << 24) | (((unsigned long)ctext[1]) << 16) | (((unsigned long)ctext[2]) << 8) | + l = (((unsigned int)ctext[0]) << 24) | (((unsigned int)ctext[1]) << 16) | (((unsigned int)ctext[2]) << 8) | ctext[3]; - r = (((unsigned long)ctext[4]) << 24) | (((unsigned long)ctext[5]) << 16) | (((unsigned long)ctext[6]) << 8) | + r = (((unsigned int)ctext[4]) << 24) | (((unsigned int)ctext[5]) << 16) | (((unsigned int)ctext[6]) << 8) | ctext[7]; for (i = _rounds - 1; i > 0; i -= 2) { @@ -277,7 +277,7 @@ void IceKey::scheduleBuild(unsigned short *kb, int n, const int *keyrot) { for (j = 0; j < 15; j++) { int k; - unsigned long *curr_sk = &isk->val[j % 3]; + unsigned int *curr_sk = &isk->val[j % 3]; for (k = 0; k < 4; k++) { ushort *curr_kb = &kb[(kr + k) & 3]; diff --git a/netgames/includes/gamedll_header.h b/netgames/includes/gamedll_header.h index 0db3c27f..5862e68b 100644 --- a/netgames/includes/gamedll_header.h +++ b/netgames/includes/gamedll_header.h @@ -924,7 +924,7 @@ DMFCDLLOUT(InitPlayerNewShip_fp DLLInitPlayerNewShip;) // Returns internet address format from string address format...ie "204.243.217.14" // turns into 1414829242 -typedef unsigned long (*nw_GetHostAddressFromNumbers_fp)(char *str); +typedef unsigned int (*nw_GetHostAddressFromNumbers_fp)(char *str); DMFCDLLOUT(nw_GetHostAddressFromNumbers_fp DLLnw_GetHostAddressFromNumbers;) // Removes all addon table files from D3 (really shouldn't be called, automatically done) diff --git a/networking/directplay.cpp b/networking/directplay.cpp index a1624c8c..fdc3e9dd 100644 --- a/networking/directplay.cpp +++ b/networking/directplay.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -109,7 +109,7 @@ LPDPLCONNECTION lpdplconnection = NULL; // {915CE160-3125-11d2-BB3D-00104B27BFF0} static const GUID DPD3_GUID = {0x915ce160, 0x3125, 0x11d2, {0xbb, 0x3d, 0x0, 0x10, 0x4b, 0x27, 0xbf, 0xf0}}; -unsigned long Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS]; +unsigned int Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS]; typedef struct _dpconnections { char name[100]; @@ -216,7 +216,7 @@ int dp_SelectDirectPlayConnection(char *name) { } int dp_InitDirectPlay(char *conn_name, void *parms, int num_elements) { - unsigned long dwAddressSize; + unsigned int dwAddressSize; HRESULT hr; char *conn = conn_name; for (int i = 0; i < MAX_PENDING_NEW_CONNECTIONS; i++) @@ -498,7 +498,7 @@ int dp_ListDirectPlayGames() { void dp_DirectPlayDispatch() { HRESULT hr; ubyte packet_data[32000]; // MAX_PACKET_SIZE+1]; - unsigned long dwMsgBufferSize = 32000; // MAX_PACKET_SIZE; + unsigned int dwMsgBufferSize = 32000; // MAX_PACKET_SIZE; DPID idFrom = 0; DPID idTo = 0; network_address from_addr; @@ -588,7 +588,7 @@ void dp_DirectPlayDispatch() { int dp_DirectPlaySend(network_address *who_to, ubyte *data, int len, bool reliable) { DPID idTo; HRESULT hr; - unsigned long send_flags; + unsigned int send_flags; if ((!DP_active) || (!lpDirectPlay4A)) { mprintf((0, "Can't send DirectPlay message because DirectPlay isn't active!\n")); return 0; @@ -838,7 +838,7 @@ BOOL FAR PASCAL EnumModemAddress(REFGUID lpguidDataType, DWORD dwDataSize, LPCVO // the amount of buffer space you need // Otherwise, it will fill in the buffer with a bunch of null delimited // strings, with a double null at the end. -int dp_GetModemChoices(char *buffer, unsigned long *size) { +int dp_GetModemChoices(char *buffer, unsigned int *size) { LPDIRECTPLAY4A lpTempDP4; HRESULT hr; void *connection = NULL; @@ -975,7 +975,7 @@ void dp_RegisterLobbyApplication(char *appname, char *exefile, char *exepath, ch // Returns TRUE if the game was launched from a lobby bool dp_DidLobbyLaunchGame() { HRESULT hr; - unsigned long buffersize = sizeof(DPLCONNECTION); + unsigned int buffersize = sizeof(DPLCONNECTION); Directplay_lobby_launched_game = false; if (lpDirectPlayLobby3A) { diff --git a/networking/networking.cpp b/networking/networking.cpp index 4170958f..d88086b8 100644 --- a/networking/networking.cpp +++ b/networking/networking.cpp @@ -369,7 +369,7 @@ network_protocol NetworkProtocol = NP_NONE; int Sockets_initted = 0; int Network_initted = 0; -unsigned long Net_fixed_ip = INADDR_NONE; +unsigned int Net_fixed_ip = INADDR_NONE; // sockets for IPX and TCP SOCKET IPX_socket; @@ -687,7 +687,7 @@ void nw_SetSocketOptions(SOCKET sock) { setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (LPSTR)&broadcast, sizeof(broadcast)); int error; - unsigned long arg; + unsigned int arg; arg = TRUE; #ifdef WIN32 @@ -917,7 +917,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) { +unsigned int nw_GetHostAddressFromNumbers(char *str) { // ASSERT (NetworkProtocol==NP_TCP); return inet_addr(str); @@ -2094,7 +2094,7 @@ void nw_psnet_buffer_packet(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_dpid(ubyte *data, int *length, unsigned int dpid) { int idx; int found_buf = 0; @@ -2105,8 +2105,8 @@ 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; + unsigned int *thisid; + thisid = (unsigned int *)&Psnet_buffers[idx].from_addr.address; // if we found the buffer if ((Psnet_buffers[idx].sequence_number == Psnet_lowest_id) && (dpid == *thisid)) { found_buf = 1; @@ -2170,10 +2170,10 @@ int nw_psnet_buffer_get_next(ubyte *data, int *length, network_address *from) { // functions to get the status of a RAS connection unsigned int psnet_ras_status() { int rval; - unsigned long size, num_connections, i; + unsigned int size, num_connections, i; RASCONN rasbuffer[25]; HINSTANCE ras_handle; - unsigned long rasip = 0; + unsigned int rasip = 0; RASPPPIP projection; int Ras_connected; @@ -2225,7 +2225,7 @@ unsigned int psnet_ras_status() { for (i = 0; i < num_connections; i++) { RASCONNSTATUS status; - unsigned long size; + unsigned int size; mprintf((0, "Connection %d:\n", i)); mprintf((0, "Entry Name: %s\n", rasbuffer[i].szEntryName)); diff --git a/renderer/SoftwareOpenGL.cpp b/renderer/SoftwareOpenGL.cpp index 3657c6d2..a660887b 100644 --- a/renderer/SoftwareOpenGL.cpp +++ b/renderer/SoftwareOpenGL.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -1801,8 +1801,8 @@ void CreateFullScreenWindow(Display *dpy, Window rootwin, Window window, int Dis Atom type; int format; - unsigned long nitems; - unsigned long bytes_after; + unsigned int nitems; + unsigned int bytes_after; long *mwmInfo; XGetWindowProperty(dpy, rootwin, a, 0, 4, False, a, &type, &format, &nitems, &bytes_after, @@ -1841,8 +1841,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; + unsigned int nitems; + unsigned int bytes_after; XGetWindowProperty(dpy, window, a, 0, 4, False, a, &type, &format, &nitems, &bytes_after, (unsigned char **)&xhints); diff --git a/scripts/lnx/osiris_common.h b/scripts/lnx/osiris_common.h index 6ef548b4..f10be4db 100644 --- a/scripts/lnx/osiris_common.h +++ b/scripts/lnx/osiris_common.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -931,7 +931,7 @@ typedef unsigned char ubyte; typedef signed char sbyte; typedef unsigned short ushort; typedef unsigned int uint; -typedef unsigned long ulong; +typedef unsigned int ulong; typedef unsigned int ddgr_color; #ifndef NULL diff --git a/scripts/osiris_common.h b/scripts/osiris_common.h index 831ebe06..441da349 100644 --- a/scripts/osiris_common.h +++ b/scripts/osiris_common.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -932,7 +932,7 @@ typedef unsigned char ubyte; typedef signed char sbyte; typedef unsigned short ushort; typedef unsigned int uint; -typedef unsigned long ulong; +typedef unsigned int ulong; typedef unsigned int ddgr_color; #ifndef NULL diff --git a/win32/windebug.cpp b/win32/windebug.cpp index cf06b90d..ac35b901 100644 --- a/win32/windebug.cpp +++ b/win32/windebug.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -1057,7 +1057,7 @@ static void PrintFileTime(char *sztime, FILETIME ftime) { static void ShowModuleInfo(HANDLE LogFile, HINSTANCE ModuleHandle) { char FmtString[2000]; - unsigned long bytesout; + unsigned int bytesout; char ModName[MAX_PATH]; __try { if (GetModuleFileName(ModuleHandle, ModName, sizeof(ModName)) > 0) { @@ -1102,7 +1102,7 @@ static void ShowModuleInfo(HANDLE LogFile, HINSTANCE ModuleHandle) { static void RecordModuleList(HANDLE LogFile) { char FmtString[2000]; - unsigned long bytesout; + unsigned int bytesout; wsprintf(FmtString, "\r\n" "Modules:\r\n"); WriteFile(LogFile, FmtString, lstrlen(FmtString), &bytesout, 0); @@ -1139,7 +1139,7 @@ static void RecordModuleList(HANDLE LogFile) { static void RecordSystemInformation(HANDLE LogFile) { char FmtString[2000]; - unsigned long bytesout; + unsigned int bytesout; FILETIME CurrentTime; GetSystemTimeAsFileTime(&CurrentTime); char TimeBuffer[100]; @@ -1220,16 +1220,16 @@ int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message) { char *p = Debug_DumpInfo(); lstrcpy(callstack, p); - unsigned long NumBytes; + unsigned int NumBytes; SetFilePointer(LogFile, 0, 0, FILE_END); WriteFile(LogFile, topmsg, lstrlen(topmsg), &NumBytes, 0); WriteFile(LogFile, FORMATCRLF, lstrlen(FORMATCRLF), &NumBytes, 0); char Username[100]; - unsigned long unamelen = 99; + unsigned int unamelen = 99; char Machinename[200]; - unsigned long cnamelen = 199; + unsigned int cnamelen = 199; GetUserName(Username, &unamelen); GetComputerName(Machinename, &cnamelen); wsprintf(callstack, "Username: %s\r\nMachineName: %s\r\n", Username, Machinename); diff --git a/win32/winmono.cpp b/win32/winmono.cpp index 807e97ee..e799c48f 100644 --- a/win32/winmono.cpp +++ b/win32/winmono.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -129,7 +129,7 @@ SOCKADDR_IN tcp_log_addr; char tcp_log_buffer[MAX_TCPLOG_LEN]; void nw_InitTCPLogging(char *ip, unsigned short port) { - unsigned long argp = 1; + unsigned int argp = 1; int addrlen = sizeof(SOCKADDR_IN); tcp_log_sock = socket(AF_INET, SOCK_STREAM, 0); if (INVALID_SOCKET == tcp_log_sock) { From 2210afe02b853258c6fe8a5b863217c4ab3f3875 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 14:46:14 -0400 Subject: [PATCH 02/14] Revert win long -> int changes --- win32/windebug.cpp | 14 +++++++------- win32/winmono.cpp | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/win32/windebug.cpp b/win32/windebug.cpp index ac35b901..cf06b90d 100644 --- a/win32/windebug.cpp +++ b/win32/windebug.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -1057,7 +1057,7 @@ static void PrintFileTime(char *sztime, FILETIME ftime) { static void ShowModuleInfo(HANDLE LogFile, HINSTANCE ModuleHandle) { char FmtString[2000]; - unsigned int bytesout; + unsigned long bytesout; char ModName[MAX_PATH]; __try { if (GetModuleFileName(ModuleHandle, ModName, sizeof(ModName)) > 0) { @@ -1102,7 +1102,7 @@ static void ShowModuleInfo(HANDLE LogFile, HINSTANCE ModuleHandle) { static void RecordModuleList(HANDLE LogFile) { char FmtString[2000]; - unsigned int bytesout; + unsigned long bytesout; wsprintf(FmtString, "\r\n" "Modules:\r\n"); WriteFile(LogFile, FmtString, lstrlen(FmtString), &bytesout, 0); @@ -1139,7 +1139,7 @@ static void RecordModuleList(HANDLE LogFile) { static void RecordSystemInformation(HANDLE LogFile) { char FmtString[2000]; - unsigned int bytesout; + unsigned long bytesout; FILETIME CurrentTime; GetSystemTimeAsFileTime(&CurrentTime); char TimeBuffer[100]; @@ -1220,16 +1220,16 @@ int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message) { char *p = Debug_DumpInfo(); lstrcpy(callstack, p); - unsigned int NumBytes; + unsigned long NumBytes; SetFilePointer(LogFile, 0, 0, FILE_END); WriteFile(LogFile, topmsg, lstrlen(topmsg), &NumBytes, 0); WriteFile(LogFile, FORMATCRLF, lstrlen(FORMATCRLF), &NumBytes, 0); char Username[100]; - unsigned int unamelen = 99; + unsigned long unamelen = 99; char Machinename[200]; - unsigned int cnamelen = 199; + unsigned long cnamelen = 199; GetUserName(Username, &unamelen); GetComputerName(Machinename, &cnamelen); wsprintf(callstack, "Username: %s\r\nMachineName: %s\r\n", Username, Machinename); diff --git a/win32/winmono.cpp b/win32/winmono.cpp index e799c48f..807e97ee 100644 --- a/win32/winmono.cpp +++ b/win32/winmono.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -129,7 +129,7 @@ SOCKADDR_IN tcp_log_addr; char tcp_log_buffer[MAX_TCPLOG_LEN]; void nw_InitTCPLogging(char *ip, unsigned short port) { - unsigned int argp = 1; + unsigned long argp = 1; int addrlen = sizeof(SOCKADDR_IN); tcp_log_sock = socket(AF_INET, SOCK_STREAM, 0); if (INVALID_SOCKET == tcp_log_sock) { From fbb2fcb76959bbe725dd93ea5b99b6a03a46139d Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 14:56:58 -0400 Subject: [PATCH 03/14] Revert pstypes.h --- lib/pstypes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pstypes.h b/lib/pstypes.h index df6c9764..97bf0211 100644 --- a/lib/pstypes.h +++ b/lib/pstypes.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -26,7 +26,7 @@ typedef unsigned char ubyte; typedef signed char sbyte; typedef unsigned short ushort; typedef unsigned int uint; -typedef unsigned int ulong; +typedef unsigned long ulong; #ifdef _MSC_VER // only Visual C++ has __int64 typedef __int64 longlong; From b374d59634ab558dd7e46df41fb1a21e8aa67118 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 16:27:33 -0400 Subject: [PATCH 04/14] Back out more ulong typedefs --- scripts/lnx/osiris_common.h | 2 +- scripts/osiris_common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lnx/osiris_common.h b/scripts/lnx/osiris_common.h index f10be4db..49250e03 100644 --- a/scripts/lnx/osiris_common.h +++ b/scripts/lnx/osiris_common.h @@ -931,7 +931,7 @@ typedef unsigned char ubyte; typedef signed char sbyte; typedef unsigned short ushort; typedef unsigned int uint; -typedef unsigned int ulong; +typedef unsigned long ulong; typedef unsigned int ddgr_color; #ifndef NULL diff --git a/scripts/osiris_common.h b/scripts/osiris_common.h index 441da349..f951693d 100644 --- a/scripts/osiris_common.h +++ b/scripts/osiris_common.h @@ -932,7 +932,7 @@ typedef unsigned char ubyte; typedef signed char sbyte; typedef unsigned short ushort; typedef unsigned int uint; -typedef unsigned int ulong; +typedef unsigned long ulong; typedef unsigned int ddgr_color; #ifndef NULL From 27d1ce78569169de983b234fccc5c216eba04224 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 16:32:35 -0400 Subject: [PATCH 05/14] Back out directplay.cpp --- networking/directplay.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/networking/directplay.cpp b/networking/directplay.cpp index fdc3e9dd..a1624c8c 100644 --- a/networking/directplay.cpp +++ b/networking/directplay.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -109,7 +109,7 @@ LPDPLCONNECTION lpdplconnection = NULL; // {915CE160-3125-11d2-BB3D-00104B27BFF0} static const GUID DPD3_GUID = {0x915ce160, 0x3125, 0x11d2, {0xbb, 0x3d, 0x0, 0x10, 0x4b, 0x27, 0xbf, 0xf0}}; -unsigned int Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS]; +unsigned long Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS]; typedef struct _dpconnections { char name[100]; @@ -216,7 +216,7 @@ int dp_SelectDirectPlayConnection(char *name) { } int dp_InitDirectPlay(char *conn_name, void *parms, int num_elements) { - unsigned int dwAddressSize; + unsigned long dwAddressSize; HRESULT hr; char *conn = conn_name; for (int i = 0; i < MAX_PENDING_NEW_CONNECTIONS; i++) @@ -498,7 +498,7 @@ int dp_ListDirectPlayGames() { void dp_DirectPlayDispatch() { HRESULT hr; ubyte packet_data[32000]; // MAX_PACKET_SIZE+1]; - unsigned int dwMsgBufferSize = 32000; // MAX_PACKET_SIZE; + unsigned long dwMsgBufferSize = 32000; // MAX_PACKET_SIZE; DPID idFrom = 0; DPID idTo = 0; network_address from_addr; @@ -588,7 +588,7 @@ void dp_DirectPlayDispatch() { int dp_DirectPlaySend(network_address *who_to, ubyte *data, int len, bool reliable) { DPID idTo; HRESULT hr; - unsigned int send_flags; + unsigned long send_flags; if ((!DP_active) || (!lpDirectPlay4A)) { mprintf((0, "Can't send DirectPlay message because DirectPlay isn't active!\n")); return 0; @@ -838,7 +838,7 @@ BOOL FAR PASCAL EnumModemAddress(REFGUID lpguidDataType, DWORD dwDataSize, LPCVO // the amount of buffer space you need // Otherwise, it will fill in the buffer with a bunch of null delimited // strings, with a double null at the end. -int dp_GetModemChoices(char *buffer, unsigned int *size) { +int dp_GetModemChoices(char *buffer, unsigned long *size) { LPDIRECTPLAY4A lpTempDP4; HRESULT hr; void *connection = NULL; @@ -975,7 +975,7 @@ void dp_RegisterLobbyApplication(char *appname, char *exefile, char *exepath, ch // Returns TRUE if the game was launched from a lobby bool dp_DidLobbyLaunchGame() { HRESULT hr; - unsigned int buffersize = sizeof(DPLCONNECTION); + unsigned long buffersize = sizeof(DPLCONNECTION); Directplay_lobby_launched_game = false; if (lpDirectPlayLobby3A) { From 551c87720617290f0a96e96360e6c4f0f19f3cd9 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 16:37:49 -0400 Subject: [PATCH 06/14] Back out networking/networking.cpp --- networking/networking.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/networking/networking.cpp b/networking/networking.cpp index d88086b8..4170958f 100644 --- a/networking/networking.cpp +++ b/networking/networking.cpp @@ -369,7 +369,7 @@ network_protocol NetworkProtocol = NP_NONE; int Sockets_initted = 0; int Network_initted = 0; -unsigned int Net_fixed_ip = INADDR_NONE; +unsigned long Net_fixed_ip = INADDR_NONE; // sockets for IPX and TCP SOCKET IPX_socket; @@ -687,7 +687,7 @@ void nw_SetSocketOptions(SOCKET sock) { setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (LPSTR)&broadcast, sizeof(broadcast)); int error; - unsigned int arg; + unsigned long arg; arg = TRUE; #ifdef WIN32 @@ -917,7 +917,7 @@ void nw_GetMyAddress(network_address *addr) { // Returns internet address format from string address format...ie "204.243.217.14" // turns into 1414829242 -unsigned int nw_GetHostAddressFromNumbers(char *str) { +unsigned long nw_GetHostAddressFromNumbers(char *str) { // ASSERT (NetworkProtocol==NP_TCP); return inet_addr(str); @@ -2094,7 +2094,7 @@ void nw_psnet_buffer_packet(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 int dpid) { +int nw_psnet_buffer_get_next_by_dpid(ubyte *data, int *length, unsigned long dpid) { int idx; int found_buf = 0; @@ -2105,8 +2105,8 @@ int nw_psnet_buffer_get_next_by_dpid(ubyte *data, int *length, unsigned int dpid // search until we find the lowest packet index id# for (idx = 0; idx < MAX_PACKET_BUFFERS; idx++) { - unsigned int *thisid; - thisid = (unsigned int *)&Psnet_buffers[idx].from_addr.address; + unsigned long *thisid; + thisid = (unsigned long *)&Psnet_buffers[idx].from_addr.address; // if we found the buffer if ((Psnet_buffers[idx].sequence_number == Psnet_lowest_id) && (dpid == *thisid)) { found_buf = 1; @@ -2170,10 +2170,10 @@ int nw_psnet_buffer_get_next(ubyte *data, int *length, network_address *from) { // functions to get the status of a RAS connection unsigned int psnet_ras_status() { int rval; - unsigned int size, num_connections, i; + unsigned long size, num_connections, i; RASCONN rasbuffer[25]; HINSTANCE ras_handle; - unsigned int rasip = 0; + unsigned long rasip = 0; RASPPPIP projection; int Ras_connected; @@ -2225,7 +2225,7 @@ unsigned int psnet_ras_status() { for (i = 0; i < num_connections; i++) { RASCONNSTATUS status; - unsigned int size; + unsigned long size; mprintf((0, "Connection %d:\n", i)); mprintf((0, "Entry Name: %s\n", rasbuffer[i].szEntryName)); From 497ac00a61afe8c5edd34496a704004b1aa487c7 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 16:43:35 -0400 Subject: [PATCH 07/14] Back out networking.h --- lib/networking.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/networking.h b/lib/networking.h index 892620d7..a1819621 100644 --- a/lib/networking.h +++ b/lib/networking.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -370,7 +370,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 int nw_GetHostAddressFromNumbers(char *str); +unsigned long nw_GetHostAddressFromNumbers(char *str); // Fills in the string with the string address from the internet address void nw_GetNumbersFromHostAddress(network_address *address, char *str); @@ -438,7 +438,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 int dpid); +int nw_psnet_buffer_get_next_by_dpid(ubyte *data, int *length, unsigned long dpid); // This is all the reliable UDP stuff... #define MAXNETBUFFERS \ From bd806e34b9c0d101109a54572be9c2a59c6f9a14 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 16:50:19 -0400 Subject: [PATCH 08/14] Back out ddio_win --- ddio_win/ddio_win.h | 4 ++-- ddio_win/winfile.cpp | 10 +++++----- ddio_win/winkey.cpp | 8 ++++---- ddio_win/wintimer.cpp | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ddio_win/ddio_win.h b/ddio_win/ddio_win.h index d2c6a325..e3ccf1ad 100644 --- a/ddio_win/ddio_win.h +++ b/ddio_win/ddio_win.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -88,7 +88,7 @@ extern bool DDIO_init; extern bool DDIO_preemptive; bool ddio_JoyHandler(); -float ddio_TickToSeconds(unsigned int ticks); +float ddio_TickToSeconds(unsigned long ticks); #ifdef _DEBUG void ddio_DebugMessage(unsigned err, char *fmt, ...); diff --git a/ddio_win/winfile.cpp b/ddio_win/winfile.cpp index 34342dfc..ff51c770 100644 --- a/ddio_win/winfile.cpp +++ b/ddio_win/winfile.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -626,12 +626,12 @@ const char *ddio_GetCDDrive(const char *vol) { #define MAX_FSTYPE_LEN 30 static char drivepath[10]; - unsigned int volflags; + unsigned long volflags; int i; char volume[_MAX_PATH]; char fsname[MAX_FSTYPE_LEN] = ""; - unsigned int serial; - unsigned int component; + unsigned long serial; + unsigned long component; strcpy(drivepath, "c:\\"); @@ -869,4 +869,4 @@ int ddio_DeleteLockFile(const char *dir) { ddio_SetWorkingDir(old_directory); return 1; -} +} \ No newline at end of file diff --git a/ddio_win/winkey.cpp b/ddio_win/winkey.cpp index 581679ce..05d48d9f 100644 --- a/ddio_win/winkey.cpp +++ b/ddio_win/winkey.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -196,7 +196,7 @@ static struct tWinKeyData { LPDIRECTINPUTDEVICE lpdikey; // key device HANDLE evtnotify; // notify event HHOOK winhook; // windows hook - unsigned int thread; // thread id + unsigned long thread; // thread id // osMutex keyframe_mutex; // mutex between // internal key frame and key thread. bool nextframe; // used for mutexing between keyframe and thread. @@ -290,7 +290,7 @@ retry_key_init: bool acquired = dikey_Acquire(lpdikey, true); if (acquired) { // create keyboard thread - unsigned int thrid; + unsigned long thrid; WKD.thread_active = true; WKD.lpdikey = lpdikey; WKD.thread = 0; @@ -300,7 +300,7 @@ retry_key_init: WKD.suspended = false; WKD.nextframe = false; thrid = _beginthread(dikey_Thread, 0, NULL); - if (thrid == (unsigned int)(-1)) { + if (thrid == (unsigned long)(-1)) { mprintf((0, "DDIO: DI_Keyboard thread failed to initialize.\n")); WKD.thread_active = false; WKD.lpdikey = NULL; diff --git a/ddio_win/wintimer.cpp b/ddio_win/wintimer.cpp index 5001b920..480dd2b4 100644 --- a/ddio_win/wintimer.cpp +++ b/ddio_win/wintimer.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -143,7 +143,7 @@ void timer_Close() { Timer_initialized = 0; } -float ddio_TickToSeconds(unsigned int ticks) { +float ddio_TickToSeconds(unsigned long ticks) { if (Timer_use_highres_timer) { LARGE_INTEGER t; t.QuadPart = ticks; From 2deaeab22837fed9f822039a23c498f001ca8815 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 16:56:13 -0400 Subject: [PATCH 09/14] Back out dd_sndlib --- dd_sndlib/Ds3dlib.cpp | 6 +++--- dd_sndlib/ddsoundload.cpp | 18 +++++++++--------- dd_sndlib/ds3dlib_internal.h | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dd_sndlib/Ds3dlib.cpp b/dd_sndlib/Ds3dlib.cpp index 699c8504..8e0e22b6 100644 --- a/dd_sndlib/Ds3dlib.cpp +++ b/dd_sndlib/Ds3dlib.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -471,7 +471,7 @@ inline int sb_get_status(sound_buffer_info *sb) { #endif if (sb->m_mixer_type != SOUND_MIXER_SOFTWARE_16) { LPDIRECTSOUNDBUFFER sound_ptr = sb->m_sound_buffer; - unsigned int status; + unsigned long status; if (sound_ptr) { sound_ptr->GetStatus(&status); @@ -2243,7 +2243,7 @@ int win_llsSystem::PlaySound2d(play_information *play_info, int sound_index, flo void win_llsSystem::LoopStartStreaming(sound_buffer_info *sb, int buffer_type, float volume, float pan, pos_state *cur_pos) { - // unsigned int thread_handle; + // unsigned long thread_handle; int sound_length, buffer_size; int determined_method; bool f_sample_16bit; diff --git a/dd_sndlib/ddsoundload.cpp b/dd_sndlib/ddsoundload.cpp index 6dfb11c3..40c14245 100644 --- a/dd_sndlib/ddsoundload.cpp +++ b/dd_sndlib/ddsoundload.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -127,12 +127,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 int ckid; // Current chunk's ID - unsigned int cksize; // Current chunk's size in bytes - unsigned int filesize; // Size of the sound file - unsigned int nextseek = 0; // Location of the next seek + 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 - unsigned int aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples + unsigned long aligned_size; // Sound files are aligned to SOUND_FILE_SAMPLE_ALIGNMENT samples // Sound format information int samples_per_second; @@ -140,7 +140,7 @@ char SoundLoadWaveFile(const char *filename, float percent_volume, int sound_fil short number_channels; // Used to read temporary long values - unsigned int temp_long; + unsigned long temp_long; // Flags for if we previously read data or a format char f_data, f_fmt = 0; @@ -174,7 +174,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 int)cf_ReadInt(cfptr); + temp_long = (unsigned long)cf_ReadInt(cfptr); if (temp_long != 0x46464952) { mprintf((0, "SOUND LOADER: %s is not a RIFF format file\n", filename)); goto error_state; @@ -185,7 +185,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 int)cf_ReadInt(cfptr); + temp_long = (unsigned long)cf_ReadInt(cfptr); if (temp_long != 0x45564157) { mprintf((0, "SOUND LOADER: %s is not a WAVE file\n", filename)); goto error_state; diff --git a/dd_sndlib/ds3dlib_internal.h b/dd_sndlib/ds3dlib_internal.h index 8b529b14..dc42bb1d 100644 --- a/dd_sndlib/ds3dlib_internal.h +++ b/dd_sndlib/ds3dlib_internal.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -142,7 +142,7 @@ typedef struct DSSTREAMTAG { int MaxWriteSamples; int MaxWriteBytes; - unsigned int thread_handle; + unsigned long thread_handle; // unsigned thread_id; volatile bool thread_request_kill; volatile bool thread_alive; From 5775abf19808755efc4c9a4a90a1365c2f3c7017 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 17:04:48 -0400 Subject: [PATCH 10/14] Back out lib/directplay.h --- lib/directplay.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/directplay.h b/lib/directplay.h index 6d9343ea..7328b4c8 100644 --- a/lib/directplay.h +++ b/lib/directplay.h @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -62,7 +62,7 @@ extern bool Directplay_lobby_launched_game; extern DPSESSIONDESC2 Directplay_sessions[MAX_DP_GAMES]; extern int Num_directplay_games; -extern unsigned int Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS]; +extern unsigned long Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS]; // This is called when a game is started, so Directplay will be happy int dp_StartGame(char *gamename); @@ -95,7 +95,7 @@ int dp_DirectPlayJoinGame(LPDPSESSIONDESC2 session); // the amount of buffer space you need // Otherwise, it will fill in the buffer with a bunch of null delimited // strings, with a double null at the end. -int dp_GetModemChoices(char *buffer, unsigned int *size); +int dp_GetModemChoices(char *buffer, unsigned long *size); // Register a DirectPlay lobby aware application // Use this so a directplay lobby provider such as zone.com can launch the game From 7dcfe312eac8473be3d5a7129954aba52cf2ce8b Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 17:12:44 -0400 Subject: [PATCH 11/14] Back out Descent3/multi_external.h --- Descent3/multi_external.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Descent3/multi_external.h b/Descent3/multi_external.h index cd66dcf6..e28abcb3 100644 --- a/Descent3/multi_external.h +++ b/Descent3/multi_external.h @@ -192,7 +192,7 @@ typedef struct { ubyte sequence; // where we are in the sequence chain ubyte pps; HANDLE hPlayerEvent; // player event to use for directplay - unsigned int dpidPlayer; // directplay ID of player created + unsigned long dpidPlayer; // directplay ID of player created float ping_time; float last_ping_time; ushort pilot_pic_id; From 17bc3656c7cf6a1d9eb8fd76b053d23257219f8f Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 17:18:42 -0400 Subject: [PATCH 12/14] Back out dedicated_server.cpp --- Descent3/dedicated_server.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Descent3/dedicated_server.cpp b/Descent3/dedicated_server.cpp index 143dabae..b537e703 100644 --- a/Descent3/dedicated_server.cpp +++ b/Descent3/dedicated_server.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -854,7 +854,7 @@ void InitDedicatedSocket(ushort port) { return; } // Make the socket non-blocking - unsigned int argp = 1; + unsigned long argp = 1; #if defined(WIN32) ioctlsocket(dedicated_listen_socket, FIONBIO, &argp); #elif defined(__LINUX__) @@ -870,7 +870,7 @@ void ListenDedicatedSocket(void) { incoming_socket = accept(dedicated_listen_socket, (SOCKADDR *)&conn_addr, &addrlen); if (INVALID_SOCKET != incoming_socket) { // Make the socket non-blocking - unsigned int argp = 1; + unsigned long argp = 1; #if defined(WIN32) ioctlsocket(incoming_socket, FIONBIO, &argp); #elif defined(__LINUX__) @@ -878,7 +878,7 @@ void ListenDedicatedSocket(void) { #endif if (!Dedicated_allow_remote) { // Check to see if this came in from the local address - unsigned int localhost = inet_addr("127.0.0.1"); + unsigned long 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)); From 7d79d0afc9a78da4c55c563e419326487ecbb2f2 Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 17:24:08 -0400 Subject: [PATCH 13/14] Back out pilot.cpp --- Descent3/pilot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Descent3/pilot.cpp b/Descent3/pilot.cpp index 27086a57..bee09b6e 100644 --- a/Descent3/pilot.cpp +++ b/Descent3/pilot.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -2929,7 +2929,7 @@ bool PltSelectShip(pilot *Pilot) { if ((error == ERROR_SUCCESS)) { lType = REG_EXPAND_SZ; - unsigned int len = BUFLEN; + unsigned long len = BUFLEN; error = RegQueryValueEx(key, "UninstallString", NULL, &lType, (unsigned char *)dir, &len); if (error == ERROR_SUCCESS) { From 1a1e19934e94019a8feea54c2e9741011f43373e Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Mon, 29 Apr 2024 17:24:24 -0400 Subject: [PATCH 14/14] Update dedicated_server to use platform data types for ioctl --- Descent3/dedicated_server.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Descent3/dedicated_server.cpp b/Descent3/dedicated_server.cpp index b537e703..0e69ce12 100644 --- a/Descent3/dedicated_server.cpp +++ b/Descent3/dedicated_server.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -854,10 +854,12 @@ void InitDedicatedSocket(ushort port) { return; } // Make the socket non-blocking - unsigned long argp = 1; + #if defined(WIN32) + u_long argp = 1; ioctlsocket(dedicated_listen_socket, FIONBIO, &argp); #elif defined(__LINUX__) + int argp = 1; ioctl(dedicated_listen_socket, FIONBIO, &argp); #endif } @@ -870,10 +872,12 @@ void ListenDedicatedSocket(void) { incoming_socket = accept(dedicated_listen_socket, (SOCKADDR *)&conn_addr, &addrlen); if (INVALID_SOCKET != incoming_socket) { // Make the socket non-blocking - unsigned long argp = 1; + #if defined(WIN32) + u_long argp = 1; ioctlsocket(incoming_socket, FIONBIO, &argp); #elif defined(__LINUX__) + int argp = 1; ioctl(incoming_socket, FIONBIO, &argp); #endif if (!Dedicated_allow_remote) {