mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
Merge branch '64bit-fixes' of github.com:jcoby/Descent3 into jcoby-64bit-fixes
This commit is contained in:
commit
b64f17fb17
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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;
|
cfptr = NULL;
|
||||||
char format_type[80]; // ASCII name of format type
|
char format_type[80]; // ASCII name of format type
|
||||||
unsigned short fmttag = 0; // Numerical format type
|
unsigned short fmttag = 0; // Numerical format type
|
||||||
unsigned long ckid; // Current chunk's ID
|
unsigned int ckid; // Current chunk's ID
|
||||||
unsigned long cksize; // Current chunk's size in bytes
|
unsigned int cksize; // Current chunk's size in bytes
|
||||||
unsigned long filesize; // Size of the sound file
|
unsigned int filesize; // Size of the sound file
|
||||||
unsigned long nextseek = 0; // Location of the next seek
|
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
|
// Sound format information
|
||||||
int samples_per_second;
|
int samples_per_second;
|
||||||
@ -514,7 +514,7 @@ char taunt_LoadWaveFile(char *filename, tWaveFile *wave) {
|
|||||||
char error_code = 0;
|
char error_code = 0;
|
||||||
|
|
||||||
// Used to read temporary long values
|
// Used to read temporary long values
|
||||||
unsigned long temp_long;
|
unsigned int temp_long;
|
||||||
|
|
||||||
// Flags for if we previously read data or a format
|
// Flags for if we previously read data or a format
|
||||||
char f_data, f_fmt = 0;
|
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
|
// 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) {
|
if (temp_long != 0x46464952) {
|
||||||
error_code = 2;
|
error_code = 2;
|
||||||
mprintf((0, "TAUNT: Wav Load: %s is not a RIFF format file\n", filename));
|
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);
|
filesize += cftell(cfptr);
|
||||||
|
|
||||||
// Make sure it is a wave file
|
// 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) {
|
if (temp_long != 0x45564157) {
|
||||||
error_code = 3;
|
error_code = 3;
|
||||||
mprintf((0, "TAUNT: Wav Load: %s is not a WAVE file\n", filename));
|
mprintf((0, "TAUNT: Wav Load: %s is not a WAVE file\n", filename));
|
||||||
@ -789,4 +789,4 @@ error_state:
|
|||||||
cfclose(cfptr);
|
cfclose(cfptr);
|
||||||
|
|
||||||
return error_code;
|
return error_code;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -95,15 +95,15 @@
|
|||||||
|
|
||||||
static char name_copy[DESC_ID_LEN];
|
static char name_copy[DESC_ID_LEN];
|
||||||
|
|
||||||
unsigned long d3_serialnum = 100000;
|
unsigned int d3_serialnum = 100000;
|
||||||
|
|
||||||
// checks the exectuable (serialization)
|
// checks the exectuable (serialization)
|
||||||
int SerialCheck(void) {
|
int SerialCheck(void) {
|
||||||
char name2[] = DESC_ID_TAG "0000000000000000000000000000000000000000";
|
char name2[] = DESC_ID_TAG "0000000000000000000000000000000000000000";
|
||||||
char time_str[] = DESC_DEAD_TIME_TAG "00000000";
|
char time_str[] = DESC_DEAD_TIME_TAG "00000000";
|
||||||
int i, found;
|
int i, found;
|
||||||
unsigned long *checksum, test_checksum;
|
unsigned int *checksum, test_checksum;
|
||||||
unsigned long *serialnum;
|
unsigned int *serialnum;
|
||||||
time_t current_time, saved_time;
|
time_t current_time, saved_time;
|
||||||
|
|
||||||
#ifdef DEMO
|
#ifdef DEMO
|
||||||
@ -179,7 +179,7 @@ int SerialCheck(void) {
|
|||||||
char *checksum_ptr = desc_id_checksum_str + DESC_CHKSUM_TAG_LEN;
|
char *checksum_ptr = desc_id_checksum_str + DESC_CHKSUM_TAG_LEN;
|
||||||
|
|
||||||
// compare generated checksum with that in the executable
|
// compare generated checksum with that in the executable
|
||||||
checksum = (unsigned long *)&(checksum_ptr[0]);
|
checksum = (unsigned int *)&(checksum_ptr[0]);
|
||||||
if (test_checksum != *checksum) {
|
if (test_checksum != *checksum) {
|
||||||
return SERIAL_BAD_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
|
static char desc_id_serialnum_str[] = DESC_SERIALNUM_TAG "0000"; // 4-byte serialnum
|
||||||
char *serialnum_ptr = desc_id_serialnum_str + DESC_SERIALNUM_TAG_LEN;
|
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;
|
d3_serialnum = *serialnum;
|
||||||
|
|
||||||
// this guy is ok, we can exit clean now
|
// 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; }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -68,7 +68,7 @@ int SerialCheck(void);
|
|||||||
void SerialError(int error);
|
void SerialError(int error);
|
||||||
|
|
||||||
// returns the serialnumber of the user
|
// returns the serialnumber of the user
|
||||||
unsigned long SerialGetSerialNum(void);
|
unsigned int SerialGetSerialNum(void);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// These are the functions used for serialization
|
// These are the functions used for serialization
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -857,10 +857,12 @@ void InitDedicatedSocket(ushort port) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Make the socket non-blocking
|
// Make the socket non-blocking
|
||||||
unsigned long argp = 1;
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
u_long argp = 1;
|
||||||
ioctlsocket(dedicated_listen_socket, FIONBIO, &argp);
|
ioctlsocket(dedicated_listen_socket, FIONBIO, &argp);
|
||||||
#elif defined(__LINUX__)
|
#elif defined(__LINUX__)
|
||||||
|
int argp = 1;
|
||||||
ioctl(dedicated_listen_socket, FIONBIO, &argp);
|
ioctl(dedicated_listen_socket, FIONBIO, &argp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -873,10 +875,12 @@ void ListenDedicatedSocket(void) {
|
|||||||
incoming_socket = accept(dedicated_listen_socket, (SOCKADDR *)&conn_addr, &addrlen);
|
incoming_socket = accept(dedicated_listen_socket, (SOCKADDR *)&conn_addr, &addrlen);
|
||||||
if (INVALID_SOCKET != incoming_socket) {
|
if (INVALID_SOCKET != incoming_socket) {
|
||||||
// Make the socket non-blocking
|
// Make the socket non-blocking
|
||||||
unsigned long argp = 1;
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
u_long argp = 1;
|
||||||
ioctlsocket(incoming_socket, FIONBIO, &argp);
|
ioctlsocket(incoming_socket, FIONBIO, &argp);
|
||||||
#elif defined(__LINUX__)
|
#elif defined(__LINUX__)
|
||||||
|
int argp = 1;
|
||||||
ioctl(incoming_socket, FIONBIO, &argp);
|
ioctl(incoming_socket, FIONBIO, &argp);
|
||||||
#endif
|
#endif
|
||||||
if (!Dedicated_allow_remote) {
|
if (!Dedicated_allow_remote) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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 lateral_thrust;
|
||||||
unsigned int rotational_thrust;
|
unsigned int rotational_thrust;
|
||||||
unsigned int sliding_pct; // Percentage of the time you were sliding
|
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 int 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 pad; // just to provide room for out 4 byte encryption boundry only needed on the client side for now
|
||||||
} vmt_descent3_struct;
|
} vmt_descent3_struct;
|
||||||
#define DESCENT3_BLOCK_SIZE (sizeof(vmt_descent3_struct) - 4)
|
#define DESCENT3_BLOCK_SIZE (sizeof(vmt_descent3_struct) - 4)
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -57,7 +57,7 @@
|
|||||||
typedef struct LNXSTREAMTAG {
|
typedef struct LNXSTREAMTAG {
|
||||||
// pthread_t thread_id;
|
// pthread_t thread_id;
|
||||||
SDL_Thread *thread_id;
|
SDL_Thread *thread_id;
|
||||||
unsigned long thread_handle;
|
unsigned int thread_handle;
|
||||||
volatile bool thread_request_kill;
|
volatile bool thread_request_kill;
|
||||||
volatile bool thread_alive;
|
volatile bool thread_alive;
|
||||||
volatile bool thread_waiting_for_death;
|
volatile bool thread_waiting_for_death;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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...
|
// use this structure for get/set all properties...
|
||||||
typedef struct {
|
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 fVolume; // 0 to 1
|
||||||
float fDecayTime_sec; // seconds, 0.1 to 100
|
float fDecayTime_sec; // seconds, 0.1 to 100
|
||||||
float fDamping; // 0 to 1
|
float fDamping; // 0 to 1
|
||||||
|
@ -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 unsigned long long Timer_accum = 0, Timer_high_mark = 0;
|
||||||
|
|
||||||
static float nw_TCPLoggingTimer(void) {
|
static float nw_TCPLoggingTimer(void) {
|
||||||
unsigned long time_ms;
|
unsigned int time_ms;
|
||||||
unsigned long long ret;
|
unsigned long long ret;
|
||||||
|
|
||||||
struct timeval t;
|
struct timeval t;
|
||||||
@ -208,7 +208,7 @@ bool nw_InitTCPLogging(char *ip, unsigned short port) {
|
|||||||
dpthread_self = (pthread_self_fp)dlsym(lib, "pthread_self");
|
dpthread_self = (pthread_self_fp)dlsym(lib, "pthread_self");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned long argp = 1;
|
unsigned int argp = 1;
|
||||||
int addrlen = sizeof(SOCKADDR_IN);
|
int addrlen = sizeof(SOCKADDR_IN);
|
||||||
tcp_log_sock = socket(AF_INET, SOCK_STREAM, 0);
|
tcp_log_sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (INVALID_SOCKET == tcp_log_sock) {
|
if (INVALID_SOCKET == tcp_log_sock) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -58,7 +58,7 @@ extern bool DDIO_preemptive;
|
|||||||
|
|
||||||
bool ddio_JoyHandler();
|
bool ddio_JoyHandler();
|
||||||
void ddio_DebugMessage(unsigned err, char *fmt, ...);
|
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_KeyHandler(MSG *msg);
|
||||||
void ddio_MouseHandler(MSG *msg);
|
void ddio_MouseHandler(MSG *msg);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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.
|
/* don't do this.
|
||||||
// Not mounted? Do it ourselves.
|
// Not mounted? Do it ourselves.
|
||||||
// so we now have our directory, try to mount
|
// 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);
|
int ret = mount(name,m_MountedDir,"iso9660",rwflag,NULL);
|
||||||
if(ret!=0)
|
if(ret!=0)
|
||||||
{
|
{
|
||||||
@ -757,8 +757,8 @@ void system_cdroms::QueryDefaultDevice(void) {
|
|||||||
sptr++;
|
sptr++;
|
||||||
}
|
}
|
||||||
*dptr = '0';dptr++;
|
*dptr = '0';dptr++;
|
||||||
*dptr = '\0';
|
*dptr = '\0';
|
||||||
|
|
||||||
dptr = mountpoint + strlen(mountpoint) - 1;
|
dptr = mountpoint + strlen(mountpoint) - 1;
|
||||||
|
|
||||||
// now keep attempting to make the directory until we do or can't even try
|
// now keep attempting to make the directory until we do or can't even try
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
#else
|
||||||
char devName[50];
|
char devName[50];
|
||||||
struct termios newtio;
|
struct termios newtio;
|
||||||
unsigned long _baud;
|
unsigned int _baud;
|
||||||
|
|
||||||
mprintf((0, "DDIO: ddio_SerialOpenPort(%d) called.", port_number));
|
mprintf((0, "DDIO: ddio_SerialOpenPort(%d) called.", port_number));
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -26,7 +26,7 @@ enum AudioError {
|
|||||||
ReadSampleEof = 0x80000000,
|
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);
|
FILE *out, int levels, int samples_per_subband, float comp_ratio);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -68,7 +68,7 @@
|
|||||||
#define ubyte unsigned char
|
#define ubyte unsigned char
|
||||||
#define uint unsigned int
|
#define uint unsigned int
|
||||||
#define ushort unsigned short
|
#define ushort unsigned short
|
||||||
#define ulong unsigned long
|
#define ulong unsigned int
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ubyte type;
|
ubyte type;
|
||||||
|
@ -169,17 +169,17 @@ typedef struct tEffectRamp {
|
|||||||
long End; // +- 10,000
|
long End; // +- 10,000
|
||||||
} tEffRamp;
|
} tEffRamp;
|
||||||
typedef struct tEffectWave {
|
typedef struct tEffectWave {
|
||||||
unsigned long Mag; // 0 to 10,000
|
unsigned int Mag; // 0 to 10,000
|
||||||
long Offset; // +- 10,000
|
long Offset; // +- 10,000
|
||||||
unsigned long Phase; // 0 to 35,999
|
unsigned int Phase; // 0 to 35,999
|
||||||
unsigned long Period;
|
unsigned int Period;
|
||||||
} tEffWave;
|
} tEffWave;
|
||||||
typedef struct tEffectCondition {
|
typedef struct tEffectCondition {
|
||||||
long Offset; // +- 10,000
|
long Offset; // +- 10,000
|
||||||
long PositiveCoefficient; // +- 10,000
|
long PositiveCoefficient; // +- 10,000
|
||||||
long NegativeCoefficient; // +- 10,000
|
long NegativeCoefficient; // +- 10,000
|
||||||
unsigned long PositiveSaturation; // 0 to 10,000
|
unsigned int PositiveSaturation; // 0 to 10,000
|
||||||
unsigned long NegativeSaturation; // 0 to 10,000
|
unsigned int NegativeSaturation; // 0 to 10,000
|
||||||
long DeadBand; // 0 to 10,000
|
long DeadBand; // 0 to 10,000
|
||||||
} tEffCondition;
|
} tEffCondition;
|
||||||
typedef struct tEffectCustom {
|
typedef struct tEffectCustom {
|
||||||
@ -196,10 +196,10 @@ typedef union tEffectInfo {
|
|||||||
tEffCustom Custom;
|
tEffCustom Custom;
|
||||||
} tEffInfo;
|
} tEffInfo;
|
||||||
typedef struct tEffectEnvelope {
|
typedef struct tEffectEnvelope {
|
||||||
unsigned long AttackLevel;
|
unsigned int AttackLevel;
|
||||||
unsigned long AttackTime;
|
unsigned int AttackTime;
|
||||||
unsigned long FadeLevel;
|
unsigned int FadeLevel;
|
||||||
unsigned long FadeTime;
|
unsigned int FadeTime;
|
||||||
} tEffEnvelope;
|
} tEffEnvelope;
|
||||||
typedef enum { kXAxisOnly, kYAxisOnly, kBothAxes } tEffAxis;
|
typedef enum { kXAxisOnly, kYAxisOnly, kBothAxes } tEffAxis;
|
||||||
typedef struct tFFB_Effect {
|
typedef struct tFFB_Effect {
|
||||||
@ -207,12 +207,12 @@ typedef struct tFFB_Effect {
|
|||||||
tEffType Type;
|
tEffType Type;
|
||||||
// tEffInfo TypeInfo[2];
|
// tEffInfo TypeInfo[2];
|
||||||
tEffInfo TypeInfo;
|
tEffInfo TypeInfo;
|
||||||
unsigned long Duration;
|
unsigned int Duration;
|
||||||
unsigned long Gain; // 0-10000 -- scales all magnitudes and envelope
|
unsigned int Gain; // 0-10000 -- scales all magnitudes and envelope
|
||||||
unsigned long Period;
|
unsigned int Period;
|
||||||
tEffAxis Axis;
|
tEffAxis Axis;
|
||||||
tJoyButtons Trigger;
|
tJoyButtons Trigger;
|
||||||
unsigned long TriggerRepeatTime;
|
unsigned int TriggerRepeatTime;
|
||||||
long Direction; // 0 to 360 deg.
|
long Direction; // 0 to 360 deg.
|
||||||
tEffEnvelope Envelope;
|
tEffEnvelope Envelope;
|
||||||
} tFFB_Effect;
|
} tFFB_Effect;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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 short FxI16;
|
||||||
|
|
||||||
typedef signed long FxI32;
|
typedef signed int FxI32;
|
||||||
|
|
||||||
typedef unsigned long FxU32;
|
typedef unsigned int FxU32;
|
||||||
|
|
||||||
typedef int FxBool;
|
typedef int FxBool;
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ typedef double FxDouble;
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef unsigned long FxColor_t;
|
typedef unsigned int FxColor_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float r, g, b, a;
|
float r, g, b, a;
|
||||||
|
@ -95,7 +95,7 @@ void __cdecl MVE_dsbSetPan(long lPan);
|
|||||||
void __cdecl
|
void __cdecl
|
||||||
MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth,
|
MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth,
|
||||||
unsigned WriteWin, unsigned char *WriteWinPtr,
|
unsigned WriteWin, unsigned char *WriteWinPtr,
|
||||||
unsigned long WinSize, unsigned WinGran,
|
unsigned int WinSize, unsigned WinGran,
|
||||||
void *SetBank, unsigned hicolor);
|
void *SetBank, unsigned hicolor);
|
||||||
|
|
||||||
/* This function alters the display from 640x480 or 640x400 to 640x350 resolution.
|
/* 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
|
** with the standard player interface, except that this interface requires
|
||||||
** polling each frame instead, and must be passed pointers to the variables where
|
** polling each frame instead, and must be passed pointers to the variables where
|
||||||
** the values will be returned.
|
** the values will be returned.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void __cdecl MVE_frPal(MVE_frStream frs,
|
void __cdecl MVE_frPal(MVE_frStream frs,
|
||||||
unsigned char **pPaltbl, unsigned *pStart, unsigned *pCount);
|
unsigned char **pPaltbl, unsigned *pStart, unsigned *pCount);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -993,7 +993,7 @@ void EncodeFlush(Encoder &enc) {
|
|||||||
ProcessBlock(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) {
|
FILE *out, int levels, int samples_per_subband, float comp_ratio) {
|
||||||
Encoder enc;
|
Encoder enc;
|
||||||
memset(&enc, 0, sizeof(enc));
|
memset(&enc, 0, sizeof(enc));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -87,7 +87,7 @@ public:
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set volume
|
// -1 : Cannot set volume
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
virtual int SetVolume(signed long vol) = 0;
|
virtual int SetVolume(signed int vol) = 0;
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// SetPan
|
// SetPan
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set pan
|
// -1 : Cannot set pan
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
virtual int SetPan(signed long pan) = 0;
|
virtual int SetPan(signed int pan) = 0;
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Stop
|
// Stop
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -236,7 +236,7 @@ int LnxSoundBuffer_Release(LnxSoundBuffer *buff) {
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set volume
|
// -1 : Cannot set volume
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) {
|
int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed int vol) {
|
||||||
if (!buff)
|
if (!buff)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -260,9 +260,9 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) {
|
|||||||
|
|
||||||
double vt;
|
double vt;
|
||||||
vt = (double)(buff->volume - (buff->pan > 0 ? buff->pan : 0));
|
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));
|
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();
|
exit_critical();
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) {
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set pan
|
// -1 : Cannot set pan
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan) {
|
int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed int pan) {
|
||||||
if (!buff)
|
if (!buff)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -295,9 +295,9 @@ int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan) {
|
|||||||
|
|
||||||
double pt;
|
double pt;
|
||||||
pt = (double)(buff->volume - (buff->pan > 0 ? buff->pan : 0));
|
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));
|
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();
|
exit_critical();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -43,12 +43,12 @@ typedef struct {
|
|||||||
unsigned int play_cursor;
|
unsigned int play_cursor;
|
||||||
unsigned int write_cursor;
|
unsigned int write_cursor;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
unsigned long left_vol, right_vol;
|
unsigned int left_vol, right_vol;
|
||||||
|
|
||||||
unsigned char *buffer;
|
unsigned char *buffer;
|
||||||
|
|
||||||
signed long volume;
|
signed int volume;
|
||||||
signed long pan;
|
signed int pan;
|
||||||
|
|
||||||
WAVEFORMATEX wfx;
|
WAVEFORMATEX wfx;
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ int LnxSoundBuffer_Release(LnxSoundBuffer *buff);
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set volume
|
// -1 : Cannot set volume
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol);
|
int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed int vol);
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// LnxSoundBuffer_SetPan
|
// LnxSoundBuffer_SetPan
|
||||||
@ -101,7 +101,7 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol);
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set pan
|
// -1 : Cannot set pan
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan);
|
int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed int pan);
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// LnxSoundBuffer_Stop
|
// LnxSoundBuffer_Stop
|
||||||
|
@ -128,20 +128,20 @@ static int sync_wait_quanta = 0;
|
|||||||
static bool sync_late = false;
|
static bool sync_late = false;
|
||||||
static bool sync_FrameDropped = 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 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 bool syncWait(void);
|
||||||
static void syncSync(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_time = wait_quanta - platform_timeGetTime() * 1000;
|
||||||
sync_active = true;
|
sync_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void syncRelease(void) { sync_active = false; }
|
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));
|
int new_wait_quanta = -(long)(period * wait_quanta + (wait_quanta >> 1));
|
||||||
|
|
||||||
// If timer is still running and has same timing
|
// If timer is still running and has same timing
|
||||||
@ -489,8 +489,8 @@ static unsigned sndAddHelper(unsigned char *dst, const unsigned char **pSrc, uns
|
|||||||
src += len >> 1;
|
src += len >> 1;
|
||||||
} else {
|
} else {
|
||||||
if (init) {
|
if (init) {
|
||||||
state = IntelSwapper(*(unsigned long *)src);
|
state = IntelSwapper(*(unsigned int *)src);
|
||||||
*(unsigned long *)dst = state;
|
*(unsigned int *)dst = state;
|
||||||
src += 4;
|
src += 4;
|
||||||
dst += 4;
|
dst += 4;
|
||||||
len -= 4;
|
len -= 4;
|
||||||
@ -830,7 +830,7 @@ static unsigned sf_hicolor = 0; // Hicolor mode (0:none,1:normal,2:swapped)
|
|||||||
// Banked screen parameters, Private, see mveliba.asm
|
// Banked screen parameters, Private, see mveliba.asm
|
||||||
void *sf_SetBank = NULL;
|
void *sf_SetBank = NULL;
|
||||||
unsigned sf_WinGran = 0;
|
unsigned sf_WinGran = 0;
|
||||||
unsigned long sf_WinSize = 0;
|
unsigned int sf_WinSize = 0;
|
||||||
unsigned sf_WinGranPerSize = 0;
|
unsigned sf_WinGranPerSize = 0;
|
||||||
//{sf_WriteWinPtr and sf_WriteWinLimit replace sf_WriteWinSeg, see mveliba.asm}
|
//{sf_WriteWinPtr and sf_WriteWinLimit replace sf_WriteWinSeg, see mveliba.asm}
|
||||||
unsigned char *sf_WriteWinPtr = NULL;
|
unsigned char *sf_WriteWinPtr = NULL;
|
||||||
@ -863,7 +863,7 @@ void mve_ShowFrameFieldHi(unsigned char *buf, unsigned bufw, unsigned bufh, unsi
|
|||||||
// dx: Window position in video memory in units of WinGran.
|
// dx: Window position in video memory in units of WinGran.
|
||||||
// on return, registers AX and DX are destroyed.
|
// on return, registers AX and DX are destroyed.
|
||||||
void MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth, unsigned WriteWin, unsigned char *WriteWinPtr,
|
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_ScreenWidth = w;
|
||||||
sf_ScreenHeight = h;
|
sf_ScreenHeight = h;
|
||||||
sf_ResolutionWidth = w;
|
sf_ResolutionWidth = w;
|
||||||
|
@ -80,7 +80,7 @@ void MVE_dsbSetPan(long lPan);
|
|||||||
// is just used for window centering and for determining
|
// is just used for window centering and for determining
|
||||||
// how and when to do palette callbacks.
|
// how and when to do palette callbacks.
|
||||||
void MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth, unsigned WriteWin, unsigned char *WriteWinPtr,
|
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.
|
// This function alters the display from 640x480 or 640x400 to 640x350 resolution.
|
||||||
void MVE_ForceVres350(void);
|
void MVE_ForceVres350(void);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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->lpXvisual = wnd->viVisualInfo.visual;
|
||||||
wnd->cmColorMap = DefaultColormapOfScreen(DefaultScreenOfDisplay(lpDisplay));
|
wnd->cmColorMap = DefaultColormapOfScreen(DefaultScreenOfDisplay(lpDisplay));
|
||||||
|
|
||||||
unsigned long attrib_mask;
|
unsigned int attrib_mask;
|
||||||
XSetWindowAttributes attrib;
|
XSetWindowAttributes attrib;
|
||||||
|
|
||||||
// setup some attribute and hints for actual window creation
|
// 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);
|
SDL_UpdateRect(wnd->surface, 0, 0, wnd->dwWidth, wnd->dwHeight);
|
||||||
|
|
||||||
#ifdef __DUMP_MVE_TO_DISK
|
#ifdef __DUMP_MVE_TO_DISK
|
||||||
static unsigned long framenum = 0;
|
static unsigned int framenum = 0;
|
||||||
char filename[100];
|
char filename[100];
|
||||||
snprintf(filename, sizeof(filename), "./mve/frame%lu.bmp", framenum);
|
snprintf(filename, sizeof(filename), "./mve/frame%lu.bmp", framenum);
|
||||||
SDL_SaveBMP(wnd->surface, filename);
|
SDL_SaveBMP(wnd->surface, filename);
|
||||||
@ -738,7 +738,7 @@ inline void BltBuffer32ToPixMap24(unsigned char *pixmap, unsigned char *buffer,
|
|||||||
b = (c & 0x000000ff);
|
b = (c & 0x000000ff);
|
||||||
|
|
||||||
if (a)
|
if (a)
|
||||||
*(unsigned long *)data = ((r << 16) + (g << 8) + b);
|
*(unsigned int *)data = ((r << 16) + (g << 8) + b);
|
||||||
data += 4;
|
data += 4;
|
||||||
buffer += 4;
|
buffer += 4;
|
||||||
}
|
}
|
||||||
@ -759,7 +759,7 @@ inline void BltBuffer16ToPixMap24(unsigned char *pixmap, unsigned char *buffer,
|
|||||||
b = (c & 0x001F);
|
b = (c & 0x001F);
|
||||||
|
|
||||||
if (a)
|
if (a)
|
||||||
*(unsigned long *)data = ((r << 19) + (g << 11) + (b << 3));
|
*(unsigned int *)data = ((r << 19) + (g << 11) + (b << 3));
|
||||||
data += 4;
|
data += 4;
|
||||||
buffer += 2;
|
buffer += 2;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -236,7 +236,7 @@ int LnxSoundBuffer_Release(LnxSoundBuffer *buff) {
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set volume
|
// -1 : Cannot set volume
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) {
|
int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed int vol) {
|
||||||
if (!buff)
|
if (!buff)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -260,9 +260,9 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) {
|
|||||||
|
|
||||||
double vt;
|
double vt;
|
||||||
vt = (double)(buff->volume - (buff->pan > 0 ? buff->pan : 0));
|
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));
|
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();
|
exit_critical();
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol) {
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set pan
|
// -1 : Cannot set pan
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan) {
|
int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed int pan) {
|
||||||
if (!buff)
|
if (!buff)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -295,9 +295,9 @@ int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan) {
|
|||||||
|
|
||||||
double pt;
|
double pt;
|
||||||
pt = (double)(buff->volume - (buff->pan > 0 ? buff->pan : 0));
|
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));
|
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();
|
exit_critical();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -78,12 +78,12 @@ typedef struct {
|
|||||||
unsigned int play_cursor;
|
unsigned int play_cursor;
|
||||||
unsigned int write_cursor;
|
unsigned int write_cursor;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
unsigned long left_vol, right_vol;
|
unsigned int left_vol, right_vol;
|
||||||
|
|
||||||
unsigned char *buffer;
|
unsigned char *buffer;
|
||||||
|
|
||||||
signed long volume;
|
signed int volume;
|
||||||
signed long pan;
|
signed int pan;
|
||||||
|
|
||||||
WAVEFORMATEX wfx;
|
WAVEFORMATEX wfx;
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ int LnxSoundBuffer_Release(LnxSoundBuffer *buff);
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set volume
|
// -1 : Cannot set volume
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol);
|
int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed int vol);
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// LnxSoundBuffer_SetPan
|
// LnxSoundBuffer_SetPan
|
||||||
@ -136,7 +136,7 @@ int LnxSoundBuffer_SetVolume(LnxSoundBuffer *buff, signed long vol);
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set pan
|
// -1 : Cannot set pan
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed long pan);
|
int LnxSoundBuffer_SetPan(LnxSoundBuffer *buff, signed int pan);
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// LnxSoundBuffer_Stop
|
// LnxSoundBuffer_Stop
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -116,7 +116,7 @@ typedef struct _mcmd_hdr {
|
|||||||
|
|
||||||
#define mcmd_syncInit 2
|
#define mcmd_syncInit 2
|
||||||
typedef struct _syncInit {
|
typedef struct _syncInit {
|
||||||
unsigned long period; // period of quanta
|
unsigned int period; // period of quanta
|
||||||
unsigned short wait_quanta; // # of quanta per frame
|
unsigned short wait_quanta; // # of quanta per frame
|
||||||
} marg_syncInit;
|
} marg_syncInit;
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ typedef struct _sndConfigure {
|
|||||||
unsigned char dummy1;
|
unsigned char dummy1;
|
||||||
unsigned short frequency;
|
unsigned short frequency;
|
||||||
// Minor opcode 1 extends buflen to be a long
|
// Minor opcode 1 extends buflen to be a long
|
||||||
unsigned long buflen;
|
unsigned int buflen;
|
||||||
} marg_sndConfigure;
|
} marg_sndConfigure;
|
||||||
|
|
||||||
#define mcmd_sndSync 4
|
#define mcmd_sndSync 4
|
||||||
@ -227,13 +227,13 @@ typedef struct _palLoadPalette {
|
|||||||
#define mcmd_nfPkInfo 19
|
#define mcmd_nfPkInfo 19
|
||||||
#define mcmd_nfHPkInfo 20
|
#define mcmd_nfHPkInfo 20
|
||||||
typedef struct _nfPkInfo {
|
typedef struct _nfPkInfo {
|
||||||
unsigned long error; // scaled by 10000
|
unsigned int error; // scaled by 10000
|
||||||
unsigned short usage[64];
|
unsigned short usage[64];
|
||||||
} marg_nfPkInfo;
|
} marg_nfPkInfo;
|
||||||
|
|
||||||
#define mcmd_idcode 21
|
#define mcmd_idcode 21
|
||||||
typedef struct _idcode {
|
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;
|
} marg_idcode;
|
||||||
|
|
||||||
#if __SC__
|
#if __SC__
|
||||||
|
@ -130,20 +130,20 @@ static int sync_wait_quanta;
|
|||||||
static bool sync_late = FALSE;
|
static bool sync_late = FALSE;
|
||||||
static bool sync_FrameDropped = 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 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 bool syncWait(void);
|
||||||
static void syncSync(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_time = wait_quanta - timeGetTime() * 1000;
|
||||||
sync_active = TRUE;
|
sync_active = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void syncRelease(void) { sync_active = FALSE; }
|
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));
|
int new_wait_quanta = -(long)(period * wait_quanta + (wait_quanta >> 1));
|
||||||
// If timer is still running and has same timing
|
// If timer is still running and has same timing
|
||||||
// characteristics, assume we are trying to continue smoothly
|
// 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;
|
src += len >> 1;
|
||||||
} else {
|
} else {
|
||||||
if (init) {
|
if (init) {
|
||||||
state = *(unsigned long *)src;
|
state = *(unsigned int *)src;
|
||||||
state = INTEL_INT(state);
|
state = INTEL_INT(state);
|
||||||
*(unsigned long *)dst = state;
|
*(unsigned int *)dst = state;
|
||||||
src += 4;
|
src += 4;
|
||||||
dst += 4;
|
dst += 4;
|
||||||
len -= 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
|
// Banked screen parameters, Private, see mveliba.asm
|
||||||
void *sf_SetBank;
|
void *sf_SetBank;
|
||||||
unsigned sf_WinGran;
|
unsigned sf_WinGran;
|
||||||
unsigned long sf_WinSize;
|
unsigned int sf_WinSize;
|
||||||
unsigned sf_WinGranPerSize;
|
unsigned sf_WinGranPerSize;
|
||||||
//{sf_WriteWinPtr and sf_WriteWinLimit replace sf_WriteWinSeg, see mveliba.asm}
|
//{sf_WriteWinPtr and sf_WriteWinLimit replace sf_WriteWinSeg, see mveliba.asm}
|
||||||
unsigned char *sf_WriteWinPtr;
|
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.
|
// dx: Window position in video memory in units of WinGran.
|
||||||
// on return, registers AX and DX are destroyed.
|
// on return, registers AX and DX are destroyed.
|
||||||
void MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth, unsigned WriteWin, unsigned char *WriteWinPtr,
|
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_ScreenWidth = w;
|
||||||
sf_ScreenHeight = h;
|
sf_ScreenHeight = h;
|
||||||
sf_ResolutionWidth = w;
|
sf_ResolutionWidth = w;
|
||||||
|
@ -90,7 +90,7 @@ void MVE_dsbSetPan(long lPan);
|
|||||||
** how and when to do palette callbacks.
|
** how and when to do palette callbacks.
|
||||||
*/
|
*/
|
||||||
void MVE_sfSVGA(unsigned w, unsigned h, unsigned LineWidth, unsigned WriteWin, unsigned char *WriteWinPtr,
|
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.
|
/* This function alters the display from 640x480 or 640x400 to 640x350 resolution.
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set volume
|
// -1 : Cannot set volume
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int SetVolume(signed long vol) { return m_pBuffer->SetVolume(vol); }
|
int SetVolume(signed int vol) { return m_pBuffer->SetVolume(vol); }
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// SetPan
|
// SetPan
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set pan
|
// -1 : Cannot set pan
|
||||||
// -2 : Invalid parameters
|
// -2 : Invalid parameters
|
||||||
int SetPan(signed long pan) { return m_pBuffer->SetPan(pan); }
|
int SetPan(signed int pan) { return m_pBuffer->SetPan(pan); }
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Stop
|
// Stop
|
||||||
@ -289,7 +289,7 @@ public:
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set volume
|
// -1 : Cannot set volume
|
||||||
// -2 : Invalid parameters
|
// -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
|
// SetPan
|
||||||
@ -300,7 +300,7 @@ public:
|
|||||||
// 0 : no error
|
// 0 : no error
|
||||||
// -1 : Cannot set pan
|
// -1 : Cannot set pan
|
||||||
// -2 : Invalid parameters
|
// -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
|
// Stop
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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);
|
typedef int (*dp_InitDirectPlay_fp)(char *conn_name, void *parms, int num_elements);
|
||||||
dp_InitDirectPlay_fp DLLdp_InitDirectPlay;
|
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;
|
dp_GetModemChoices_fp DLLdp_GetModemChoices;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -739,8 +739,8 @@ typedef struct vmt_descent3_struct {
|
|||||||
unsigned int lateral_thrust;
|
unsigned int lateral_thrust;
|
||||||
unsigned int rotational_thrust;
|
unsigned int rotational_thrust;
|
||||||
unsigned int sliding_pct; // Percentage of the time you were sliding
|
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 int 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 pad; // just to provide room for out 4 byte encryption boundry only needed on the client side for now
|
||||||
} vmt_descent3_struct;
|
} vmt_descent3_struct;
|
||||||
#define DESCENT3_BLOCK_SIZE (sizeof(vmt_descent3_struct) - 4)
|
#define DESCENT3_BLOCK_SIZE (sizeof(vmt_descent3_struct) - 4)
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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;
|
m_State = HTTP_STATE_SOCKET_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsigned long arg;
|
unsigned int arg;
|
||||||
|
|
||||||
arg = true;
|
arg = true;
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -696,7 +696,7 @@ int MainMultiplayerMenu() {
|
|||||||
|
|
||||||
void AutoLoginAndJoinGame(void) {
|
void AutoLoginAndJoinGame(void) {
|
||||||
unsigned short port;
|
unsigned short port;
|
||||||
unsigned long iaddr;
|
unsigned int iaddr;
|
||||||
|
|
||||||
*DLLMultiGameStarting = 0;
|
*DLLMultiGameStarting = 0;
|
||||||
|
|
||||||
@ -714,7 +714,7 @@ void AutoLoginAndJoinGame(void) {
|
|||||||
|
|
||||||
network_address s_address;
|
network_address s_address;
|
||||||
iaddr = inet_addr(DLLAuto_login_addr);
|
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.port = port;
|
||||||
s_address.connection_type = NP_TCP;
|
s_address.connection_type = NP_TCP;
|
||||||
*DLLGame_is_master_tracker_game = 0;
|
*DLLGame_is_master_tracker_game = 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long address;
|
unsigned int address;
|
||||||
tHostsNode *curr;
|
tHostsNode *curr;
|
||||||
|
|
||||||
memcpy(&address, &addr->address, 4);
|
memcpy(&address, &addr->address, 4);
|
||||||
@ -4279,8 +4279,8 @@ void ParseHostsFile(char *filename, tHostsNode **root) {
|
|||||||
char save_buffer[256];
|
char save_buffer[256];
|
||||||
|
|
||||||
char s_ip[16], s_mask[16];
|
char s_ip[16], s_mask[16];
|
||||||
unsigned long ip_address;
|
unsigned int ip_address;
|
||||||
unsigned long mask;
|
unsigned int mask;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
while (!DLLcfeof(file)) {
|
while (!DLLcfeof(file)) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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 *(*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 void (*DLLCheckBoxSetCheck)(void *cb, bool state);
|
||||||
DMFCFUNCTION bool (*DLLCheckBoxIsChecked)(void *cb);
|
DMFCFUNCTION bool (*DLLCheckBoxIsChecked)(void *cb);
|
||||||
DMFCFUNCTION unsigned long (*DLLnw_GetHostAddressFromNumbers)(char *str);
|
DMFCFUNCTION unsigned int (*DLLnw_GetHostAddressFromNumbers)(char *str);
|
||||||
DMFCFUNCTION void (*TableFilesClear)(void);
|
DMFCFUNCTION void (*TableFilesClear)(void);
|
||||||
DMFCFUNCTION bool (*TableFileAdd)(char *filename);
|
DMFCFUNCTION bool (*TableFileAdd)(char *filename);
|
||||||
DMFCFUNCTION void (*DLLDebugBreak_callback_stop)(void);
|
DMFCFUNCTION void (*DLLDebugBreak_callback_stop)(void);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -39,11 +39,11 @@
|
|||||||
|
|
||||||
class IceSubkey {
|
class IceSubkey {
|
||||||
public:
|
public:
|
||||||
unsigned long val[3];
|
unsigned int val[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
// the S-boxes
|
// the S-boxes
|
||||||
static unsigned long ice_sbox[4][1024];
|
static unsigned int ice_sbox[4][1024];
|
||||||
static int ice_sboxes_initialised = 0;
|
static int ice_sboxes_initialised = 0;
|
||||||
|
|
||||||
// modulo values for the S-boxes
|
// 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}};
|
{0x83, 0x85, 0x9b, 0xcd}, {0xcc, 0xa7, 0xad, 0x41}, {0x4b, 0x2e, 0xd4, 0x33}, {0xea, 0xcb, 0x2e, 0x04}};
|
||||||
|
|
||||||
// Permutation values for the P-box
|
// 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,
|
0x00000001, 0x00000080, 0x00000400, 0x00002000, 0x00080000, 0x00200000, 0x01000000, 0x40000000,
|
||||||
0x00000008, 0x00000020, 0x00000100, 0x00004000, 0x00010000, 0x00800000, 0x04000000, 0x20000000,
|
0x00000008, 0x00000020, 0x00000100, 0x00004000, 0x00010000, 0x00800000, 0x04000000, 0x20000000,
|
||||||
0x00000004, 0x00000010, 0x00000200, 0x00008000, 0x00020000, 0x00400000, 0x08000000, 0x10000000,
|
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.
|
// Galois Field exponentiation.
|
||||||
// Raise the base to the power of 7, modulo m.
|
// 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;
|
uint x;
|
||||||
|
|
||||||
if (b == 0)
|
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.
|
// Carry out the ICE 32-bit P-box permutation.
|
||||||
//
|
//
|
||||||
static unsigned long ice_perm32(unsigned long x) {
|
static unsigned int ice_perm32(unsigned int x) {
|
||||||
unsigned long res = 0;
|
unsigned int res = 0;
|
||||||
const unsigned long *pbox = ice_pbox;
|
const unsigned int *pbox = ice_pbox;
|
||||||
|
|
||||||
while (x) {
|
while (x) {
|
||||||
if (x & 1)
|
if (x & 1)
|
||||||
@ -130,7 +130,7 @@ static void ice_sboxes_init(void) {
|
|||||||
for (i = 0; i < 1024; i++) {
|
for (i = 0; i < 1024; i++) {
|
||||||
int col = (i >> 1) & 0xff;
|
int col = (i >> 1) & 0xff;
|
||||||
int row = (i & 0x1) | ((i & 0x200) >> 8);
|
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;
|
x = gf_exp7(col ^ ice_sxor[0][row], ice_smod[0][row]) << 24;
|
||||||
ice_sbox[0][i] = ice_perm32(x);
|
ice_sbox[0][i] = ice_perm32(x);
|
||||||
@ -186,9 +186,9 @@ IceKey::~IceKey() {
|
|||||||
//
|
//
|
||||||
// The single round ICE f function.
|
// The single round ICE f function.
|
||||||
//
|
//
|
||||||
static unsigned long ice_f(unsigned long p, const IceSubkey *sk) {
|
static unsigned int ice_f(unsigned int p, const IceSubkey *sk) {
|
||||||
unsigned long tl, tr; /* Expanded 40-bit values */
|
unsigned int tl, tr; /* Expanded 40-bit values */
|
||||||
unsigned long al, ar; /* Salted expanded 40-bit values */
|
unsigned int al, ar; /* Salted expanded 40-bit values */
|
||||||
|
|
||||||
// Left half expansion
|
// Left half expansion
|
||||||
tl = ((p >> 16) & 0x3ff) | (((p >> 14) | (p << 18)) & 0xffc00);
|
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 {
|
void IceKey::encrypt(const ubyte *ptext, ubyte *ctext) const {
|
||||||
int i;
|
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];
|
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];
|
ptext[7];
|
||||||
|
|
||||||
for (i = 0; i < _rounds; i += 2) {
|
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 {
|
void IceKey::decrypt(const ubyte *ctext, ubyte *ptext) const {
|
||||||
int i;
|
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];
|
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];
|
ctext[7];
|
||||||
|
|
||||||
for (i = _rounds - 1; i > 0; i -= 2) {
|
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++) {
|
for (j = 0; j < 15; j++) {
|
||||||
int k;
|
int k;
|
||||||
unsigned long *curr_sk = &isk->val[j % 3];
|
unsigned int *curr_sk = &isk->val[j % 3];
|
||||||
|
|
||||||
for (k = 0; k < 4; k++) {
|
for (k = 0; k < 4; k++) {
|
||||||
ushort *curr_kb = &kb[(kr + k) & 3];
|
ushort *curr_kb = &kb[(kr + k) & 3];
|
||||||
|
@ -924,7 +924,7 @@ DMFCDLLOUT(InitPlayerNewShip_fp DLLInitPlayerNewShip;)
|
|||||||
|
|
||||||
// Returns internet address format from string address format...ie "204.243.217.14"
|
// Returns internet address format from string address format...ie "204.243.217.14"
|
||||||
// turns into 1414829242
|
// 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;)
|
DMFCDLLOUT(nw_GetHostAddressFromNumbers_fp DLLnw_GetHostAddressFromNumbers;)
|
||||||
|
|
||||||
// Removes all addon table files from D3 (really shouldn't be called, automatically done)
|
// Removes all addon table files from D3 (really shouldn't be called, automatically done)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Descent 3
|
* Descent 3
|
||||||
* Copyright (C) 2024 Parallax Software
|
* Copyright (C) 2024 Parallax Software
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
Loading…
Reference in New Issue
Block a user