Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

64 Bit-Safe Updates #233

Merged
merged 16 commits into from
May 4, 2024
20 changes: 10 additions & 10 deletions Descent3/audiotaunts.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -789,4 +789,4 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) {
cfclose(cfptr);

return error_code;
}
}
14 changes: 7 additions & 7 deletions Descent3/d3serial.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -179,15 +179,15 @@ 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;
}

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
Expand Down Expand Up @@ -224,4 +224,4 @@ void SerialError(int error) {
}
}

unsigned long SerialGetSerialNum(void) { return d3_serialnum; }
unsigned int SerialGetSerialNum(void) { return d3_serialnum; }
4 changes: 2 additions & 2 deletions Descent3/d3serial.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Descent3/dedicated_server.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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__)
Expand All @@ -870,15 +870,15 @@ 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__)
ioctl(incoming_socket, FIONBIO, &argp);
#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));
Expand Down
6 changes: 3 additions & 3 deletions Descent3/multi.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Descent3/multi_external.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Descent3/pilot.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions dd_lnxsound/ddlnxsound.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions dd_sndlib/Ds3dlib.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions dd_sndlib/ddsoundload.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -127,20 +127,20 @@ 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;
short bits_per_sample;
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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions dd_sndlib/ds3dlib_internal.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions dd_sndlib/eax.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ddio_lnx/ddio_lnx.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions ddio_lnx/lnxcdrom.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ddio_lnx/lnxio.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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));

Expand Down