Skip to content

Commit

Permalink
Merge pull request #233 from jcoby/64bit-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JeodC committed May 4, 2024
2 parents e2b6653 + efb6139 commit 52e66c3
Show file tree
Hide file tree
Showing 39 changed files with 168 additions and 164 deletions.
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
10 changes: 7 additions & 3 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 @@ -857,10 +857,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
}
Expand All @@ -873,10 +875,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) {
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
2 changes: 1 addition & 1 deletion 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
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
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 ddebug/lnxmono.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
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
4 changes: 2 additions & 2 deletions lib/Aencode.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 All @@ -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
4 changes: 2 additions & 2 deletions lib/CZip.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 @@
#define ubyte unsigned char
#define uint unsigned int
#define ushort unsigned short
#define ulong unsigned long
#define ulong unsigned int

typedef struct {
ubyte type;
Expand Down
26 changes: 13 additions & 13 deletions lib/forcefeedback.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -196,23 +196,23 @@ 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 {
int Flags;
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;
Expand Down

0 comments on commit 52e66c3

Please sign in to comment.