More 64-bit portability fixes.

This commit is contained in:
Knightmare66 2020-08-01 22:54:35 -04:00
parent a523e11915
commit 8f43c6bf9f
16 changed files with 84 additions and 81 deletions

View file

@ -108,7 +108,7 @@ LClampDone2:
#endif #endif
#endif #endif
void S_TransferStereo16 (unsigned long *pbuf, int endtime) void S_TransferStereo16 (unsigned int /*long*/ *pbuf, int endtime)
{ {
int lpos; int lpos;
int lpaintedtime; int lpaintedtime;
@ -151,9 +151,9 @@ void S_TransferPaintBuffer(int endtime)
int *p; int *p;
int step; int step;
int val; int val;
unsigned long *pbuf; unsigned int /*long*/ *pbuf;
pbuf = (unsigned long *)dma.buffer; pbuf = (unsigned int /*long*/ *)dma.buffer;
if (s_testsound->value) if (s_testsound->value)
{ {

View file

@ -110,7 +110,7 @@ static int ovc_close (void *datasource)
} }
static long ovc_tell (void *datasource) static int /*long*/ ovc_tell (void *datasource)
{ {
bgTrack_t *track = (bgTrack_t *)datasource; bgTrack_t *track = (bgTrack_t *)datasource;

View file

@ -2147,7 +2147,7 @@ unsigned int Com_HashFileName (const char *fname, int hashSize, qboolean sized)
letter = tolower(fname[i]); letter = tolower(fname[i]);
// if (letter == '.') break; // if (letter == '.') break;
if (letter == '\\') letter = '/'; // fix filepaths if (letter == '\\') letter = '/'; // fix filepaths
hash += (long)(letter)*(i+119); hash += (int)(letter)*(i+119);
i++; i++;
} }
hash = (hash ^ (hash >> 10) ^ (hash >> 20)); hash = (hash ^ (hash >> 10) ^ (hash >> 20));

View file

@ -606,7 +606,7 @@ int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
Window root; Window root;
XVisualInfo *visinfo; XVisualInfo *visinfo;
XSetWindowAttributes attr; XSetWindowAttributes attr;
unsigned long mask; unsigned int /*long*/ mask;
int MajorVersion, MinorVersion; int MajorVersion, MinorVersion;
int actualWidth, actualHeight; int actualWidth, actualHeight;
int i; int i;

View file

@ -313,11 +313,11 @@ void SWimp_AppActivate( qboolean active )
Sys_MakeCodeWriteable Sys_MakeCodeWriteable
================ ================
*/ */
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) void Sys_MakeCodeWriteable (unsigned int startaddr, unsigned int length)
{ {
int r; int r;
unsigned long addr; unsigned int addr;
int psize = getpagesize(); int psize = getpagesize();
addr = (startaddr & ~(psize-1)) - psize; addr = (startaddr & ~(psize-1)) - psize;

View file

@ -93,12 +93,12 @@ int config_notify_width;
int config_notify_height; int config_notify_height;
typedef unsigned short PIXEL16; typedef unsigned short PIXEL16;
typedef unsigned long PIXEL24; typedef unsigned int PIXEL24;
static PIXEL16 st2d_8to16table[256]; static PIXEL16 st2d_8to16table[256];
static PIXEL24 st2d_8to24table[256]; static PIXEL24 st2d_8to24table[256];
static int shiftmask_fl=0; static int shiftmask_fl=0;
static long r_shift,g_shift,b_shift; static int r_shift,g_shift,b_shift;
static unsigned long r_mask,g_mask,b_mask; static unsigned int r_mask,g_mask,b_mask;
void shiftmask_init(void) void shiftmask_init(void)
{ {
@ -588,7 +588,7 @@ void ResetSharedFrameBuffers(void)
(void *) shmat(x_shminfo[frm].shmid, 0, 0); (void *) shmat(x_shminfo[frm].shmid, 0, 0);
ri.Con_Printf(PRINT_DEVELOPER, "MITSHM shared memory (id=%d, addr=0x%lx)\n", ri.Con_Printf(PRINT_DEVELOPER, "MITSHM shared memory (id=%d, addr=0x%lx)\n",
x_shminfo[frm].shmid, (long) x_shminfo[frm].shmaddr); x_shminfo[frm].shmid, (int) x_shminfo[frm].shmaddr);
x_framebuffer[frm]->data = x_shminfo[frm].shmaddr; x_framebuffer[frm]->data = x_shminfo[frm].shmaddr;
@ -1233,11 +1233,11 @@ void SWimp_AppActivate( qboolean active )
Sys_MakeCodeWriteable Sys_MakeCodeWriteable
================ ================
*/ */
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) void Sys_MakeCodeWriteable (unsigned int startaddr, unsigned int length)
{ {
int r; int r;
unsigned long addr; unsigned int addr;
int psize = getpagesize(); int psize = getpagesize();
addr = (startaddr & ~(psize-1)) - psize; addr = (startaddr & ~(psize-1)) - psize;

View file

@ -501,11 +501,11 @@ void Sys_CopyProtect(void)
Sys_MakeCodeWriteable Sys_MakeCodeWriteable
================ ================
*/ */
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) void Sys_MakeCodeWriteable (unsigned int startaddr, unsigned int length)
{ {
int r; int r;
unsigned long addr; unsigned int addr;
int psize = getpagesize(); int psize = getpagesize();
addr = (startaddr & ~(psize-1)) - psize; addr = (startaddr & ~(psize-1)) - psize;

View file

@ -86,7 +86,7 @@ instruct clients to write files over areas they shouldn't.
typedef struct { typedef struct {
char name[MAX_QPATH]; char name[MAX_QPATH];
long hash; // To speed up searching unsigned int hash; // To speed up searching
int size; int size;
int offset; // This is ignored in PK3 files int offset; // This is ignored in PK3 files
qboolean ignore; // Whether this file should be ignored qboolean ignore; // Whether this file should be ignored
@ -500,7 +500,7 @@ Performs a binary search by hashed filename
to find pack items in a sorted pack to find pack items in a sorted pack
================= =================
*/ */
int FS_FindPackItem (fsPack_t *pack, char *itemName, long itemHash) int FS_FindPackItem (fsPack_t *pack, char *itemName, unsigned int itemHash)
{ {
int smax, smin, smidpt; //, counter = 0; int smax, smin, smidpt; //, counter = 0;
int i; //, matchStart, matchEnd; int i; //, matchStart, matchEnd;
@ -628,7 +628,7 @@ int FS_FOpenFileRead (fsHandle_t *handle)
fsSearchPath_t *search; fsSearchPath_t *search;
fsPack_t *pack; fsPack_t *pack;
char path[MAX_OSPATH]; char path[MAX_OSPATH];
long hash; unsigned int hash;
int i; int i;
unsigned int typeFlag; unsigned int typeFlag;
@ -1203,7 +1203,7 @@ int FS_FTell (fileHandle_t f)
handle = FS_GetFileByHandle(f); handle = FS_GetFileByHandle(f);
if (handle->pakFile) { // inside .pak file uses offset/size if (handle->pakFile) { // inside .pak file uses offset/size
long pos = ftell(handle->file); int pos = ftell(handle->file);
if (pos != -1) if (pos != -1)
pos -= handle->pakFile->offset; pos -= handle->pakFile->offset;
return pos; return pos;
@ -1589,7 +1589,7 @@ int FS_Tell (fileHandle_t f)
handle = FS_GetFileByHandle(f); handle = FS_GetFileByHandle(f);
if (handle->pakFile) { // inside .pak file uses offset/size if (handle->pakFile) { // inside .pak file uses offset/size
long pos = ftell(handle->file); int pos = ftell(handle->file);
if (pos != -1) if (pos != -1)
pos -= handle->pakFile->offset; pos -= handle->pakFile->offset;
return pos; return pos;
@ -1867,7 +1867,7 @@ FS_PakFileCompare
Used for sorting pak entries by hash Used for sorting pak entries by hash
================= =================
*/ */
long *nameHashes = NULL; unsigned int *nameHashes = NULL;
int FS_PakFileCompare (const void *f1, const void *f2) int FS_PakFileCompare (const void *f1, const void *f2)
{ {
if (!nameHashes) if (!nameHashes)
@ -1899,7 +1899,7 @@ fsPack_t *FS_LoadPAK (const char *packPath)
unsigned contentFlags = 0; unsigned contentFlags = 0;
#ifdef BINARY_PACK_SEARCH #ifdef BINARY_PACK_SEARCH
int *sortIndices; int *sortIndices;
long *sortHashes; unsigned int *sortHashes;
#endif // BINARY_PACK_SEARCH #endif // BINARY_PACK_SEARCH
handle = fopen(packPath, "rb"); handle = fopen(packPath, "rb");
@ -2030,7 +2030,7 @@ fsPack_t *FS_LoadPK3 (const char *packPath)
#ifdef BINARY_PACK_SEARCH #ifdef BINARY_PACK_SEARCH
fsPackFile_t *tmpFiles; fsPackFile_t *tmpFiles;
int *sortIndices; int *sortIndices;
long *sortHashes; unsigned int *sortHashes;
#endif // BINARY_PACK_SEARCH #endif // BINARY_PACK_SEARCH
handle = unzOpen(packPath); handle = unzOpen(packPath);

View file

@ -12,7 +12,7 @@ typedef unsigned short int UINT2;
#ifdef __alpha__ #ifdef __alpha__
typedef unsigned int UINT4; typedef unsigned int UINT4;
#else #else
typedef unsigned long int UINT4; typedef unsigned /*long*/ int UINT4;
#endif #endif

View file

@ -52,9 +52,9 @@ cinematics_t *cin;
//============================================================= //=============================================================
long GetInteger (byte *data) int GetInteger (byte *data)
{ {
long b0, b1, b2, b3; int b0, b1, b2, b3;
b0 = (data[0] & 0xFF); b0 = (data[0] & 0xFF);
b1 = (data[1] & 0xFF) << 8; b1 = (data[1] & 0xFF) << 8;

View file

@ -1057,9 +1057,9 @@ typedef struct png_handle_s
{ {
char *tmpBuf; char *tmpBuf;
int tmpi; int tmpi;
long fBgColor; // DL Background color Added 30/05/2000 int /*long*/ fBgColor; // DL Background color Added 30/05/2000
int fTransparent; // DL Is this Image Transparent? Added 30/05/2000 int fTransparent; // DL Is this Image Transparent? Added 30/05/2000
long fRowBytes; // DL Added 30/05/2000 int /*long*/ fRowBytes; // DL Added 30/05/2000
double fGamma; // DL Added 07/06/2000 double fGamma; // DL Added 07/06/2000
double fScreenGamma; // DL Added 07/06/2000 double fScreenGamma; // DL Added 07/06/2000
char *fRowPtrs; // DL Changed for consistancy 30/05/2000 char *fRowPtrs; // DL Changed for consistancy 30/05/2000
@ -1082,8 +1082,8 @@ png_handle_t *r_png_handle = 0;
void R_InitializePNGData (void) void R_InitializePNGData (void)
{ {
long* cvaluep; //ub size_t /*long*/ *cvaluep; //ub
long y; int /*long*/ y;
// Initialize Data and RowPtrs // Initialize Data and RowPtrs
if (r_png_handle->data) if (r_png_handle->data)
@ -1101,10 +1101,10 @@ void R_InitializePNGData (void)
if ((r_png_handle->data)&&(r_png_handle->fRowPtrs)) if ((r_png_handle->data)&&(r_png_handle->fRowPtrs))
{ {
cvaluep = (long*)r_png_handle->fRowPtrs; cvaluep = (size_t /*long*/*)r_png_handle->fRowPtrs;
for (y=0; y<r_png_handle->height; y++) for (y=0; y<r_png_handle->height; y++)
{ {
cvaluep[y] = (long)r_png_handle->data + ( y * (long)r_png_handle->fRowBytes ); //DL Added 08/07/2000 cvaluep[y] = (size_t /*long*/)r_png_handle->data + ( y * (size_t /*long*/)r_png_handle->fRowBytes ); //DL Added 08/07/2000
} }
} }
} }
@ -1264,17 +1264,17 @@ By Robert 'Heffo' Heffernan
================================================================= =================================================================
*/ */
void jpg_null(j_decompress_ptr cinfo) void jpg_null (j_decompress_ptr cinfo)
{ {
} }
unsigned char jpg_fill_input_buffer(j_decompress_ptr cinfo) unsigned char jpg_fill_input_buffer (j_decompress_ptr cinfo)
{ {
VID_Printf(PRINT_ALL, "Premature end of JPEG data\n"); VID_Printf(PRINT_ALL, "Premature end of JPEG data\n");
return 1; return 1;
} }
void jpg_skip_input_data(j_decompress_ptr cinfo, long num_bytes) void jpg_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{ {
cinfo->src->next_input_byte += (size_t) num_bytes; cinfo->src->next_input_byte += (size_t) num_bytes;
@ -1285,7 +1285,7 @@ void jpg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
} }
//void jpeg_mem_src(j_decompress_ptr cinfo, byte *mem, int len) //void jpeg_mem_src(j_decompress_ptr cinfo, byte *mem, int len)
void jpeg_mem_src(j_decompress_ptr cinfo, const byte *mem, unsigned long len) void jpeg_mem_src (j_decompress_ptr cinfo, const byte *mem, unsigned long len)
{ {
cinfo->src = (struct jpeg_source_mgr *)(*cinfo->mem->alloc_small)((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(struct jpeg_source_mgr)); cinfo->src = (struct jpeg_source_mgr *)(*cinfo->mem->alloc_small)((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(struct jpeg_source_mgr));
cinfo->src->init_source = jpg_null; cinfo->src->init_source = jpg_null;
@ -2221,7 +2221,7 @@ nonscrap:
// store the names of last images that failed to load // store the names of last images that failed to load
#define NUM_FAIL_IMAGES 1024 #define NUM_FAIL_IMAGES 1024
char lastFailedImage[NUM_FAIL_IMAGES][MAX_OSPATH]; char lastFailedImage[NUM_FAIL_IMAGES][MAX_OSPATH];
long lastFailedImageHash[NUM_FAIL_IMAGES]; unsigned int lastFailedImageHash[NUM_FAIL_IMAGES];
static unsigned failedImgListIndex; static unsigned failedImgListIndex;
/* /*
@ -2248,8 +2248,8 @@ R_CheckImgFailed
*/ */
qboolean R_CheckImgFailed (char *name) qboolean R_CheckImgFailed (char *name)
{ {
int i; int i;
long hash; unsigned int hash;
hash = Com_HashFileName(name, 0, false); hash = Com_HashFileName(name, 0, false);
for (i=0; i<NUM_FAIL_IMAGES; i++) for (i=0; i<NUM_FAIL_IMAGES; i++)

View file

@ -86,7 +86,7 @@ typedef enum
typedef struct image_s typedef struct image_s
{ {
char name[MAX_QPATH]; // game path, including extension char name[MAX_QPATH]; // game path, including extension
long hash; // to speed up searching unsigned int hash; // to speed up searching
imagetype_t type; imagetype_t type;
int width, height; // source image int width, height; // source image
int upload_width, upload_height; // after power of two and picmip int upload_width, upload_height; // after power of two and picmip

View file

@ -485,7 +485,7 @@ void Mod_LoadEdges (lump_t *l)
// store the names of last textures that failed to load // store the names of last textures that failed to load
#define NUM_FAIL_TEXTURES 256 #define NUM_FAIL_TEXTURES 256
char lastFailedTexture[NUM_FAIL_TEXTURES][MAX_OSPATH]; char lastFailedTexture[NUM_FAIL_TEXTURES][MAX_OSPATH];
long lastFailedTextureHash[NUM_FAIL_TEXTURES]; unsigned int lastFailedTextureHash[NUM_FAIL_TEXTURES];
static unsigned failedTexListIndex; static unsigned failedTexListIndex;
/* /*
@ -512,8 +512,8 @@ Mod_CheckTexFailed
*/ */
qboolean Mod_CheckTexFailed (char *name) qboolean Mod_CheckTexFailed (char *name)
{ {
int i; int i;
long hash; unsigned int hash;
hash = Com_HashFileName(name, 0, false); hash = Com_HashFileName(name, 0, false);
for (i=0; i<NUM_FAIL_TEXTURES; i++) for (i=0; i<NUM_FAIL_TEXTURES; i++)
@ -573,10 +573,10 @@ image_t *Mod_FindTexture (char *name, imagetype_t type)
// store the names and sizes of size reference .wal files // store the names and sizes of size reference .wal files
typedef struct walsize_s typedef struct walsize_s
{ {
char name[MAX_OSPATH]; char name[MAX_OSPATH];
long hash; unsigned int hash;
int width; int width;
int height; int height;
} walsize_t; } walsize_t;
#define NUM_WALSIZES 1024 #define NUM_WALSIZES 1024
@ -608,8 +608,8 @@ Mod_CheckWalSizeList
*/ */
qboolean Mod_CheckWalSizeList (const char *name, int *width, int *height) qboolean Mod_CheckWalSizeList (const char *name, int *width, int *height)
{ {
int i; int i;
long hash; unsigned int hash;
hash = Com_HashFileName(name, 0, false); hash = Com_HashFileName(name, 0, false);
for (i=0; i<NUM_WALSIZES; i++) for (i=0; i<NUM_WALSIZES; i++)

View file

@ -503,7 +503,7 @@ int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
Window root; Window root;
XVisualInfo *visinfo; XVisualInfo *visinfo;
XSetWindowAttributes attr; XSetWindowAttributes attr;
unsigned long mask; unsigned int mask;
int MajorVersion, MinorVersion; int MajorVersion, MinorVersion;
int actualWidth, actualHeight; int actualWidth, actualHeight;
XSizeHints *sizehints; XSizeHints *sizehints;
@ -641,7 +641,7 @@ int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
#include "q2icon.xbm" #include "q2icon.xbm"
Pixmap icon_pixmap, icon_mask; Pixmap icon_pixmap, icon_mask;
unsigned long fg, bg; unsigned int fg, bg;
int i; int i;
fg = BlackPixel(dpy, visinfo->screen); fg = BlackPixel(dpy, visinfo->screen);
@ -829,7 +829,7 @@ char *Sys_GetClipboardData()
{ {
Window sowner; Window sowner;
Atom type, property; Atom type, property;
unsigned long len, bytes_left, tmp; unsigned int len, bytes_left, tmp;
unsigned char *data; unsigned char *data;
int format, result; int format, result;
char *ret = NULL; char *ret = NULL;

View file

@ -27,6 +27,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <windows.h> #include <windows.h>
#include <process.h> // Knightmare added #include <process.h> // Knightmare added
// defines for MSVC6
#if (_MSC_VER < 1300)
#ifndef LONG_PTR
#define LONG_PTR LONG
#endif
#endif // _MSC_VER
extern HWND cl_hwnd; extern HWND cl_hwnd;
static qboolean cdValid = false; static qboolean cdValid = false;
@ -55,7 +62,7 @@ static void CDAudio_EjectThread (void)
{ {
DWORD dwReturn; DWORD dwReturn;
if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD)NULL)) if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (LONG_PTR)NULL))
Com_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); Com_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn);
_endthread(); _endthread();
} }
@ -65,7 +72,7 @@ static void CDAudio_Eject (void)
//_beginthread(CDAudio_EjectThread, 0, NULL); //_beginthread(CDAudio_EjectThread, 0, NULL);
DWORD dwReturn; DWORD dwReturn;
if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD)NULL)) if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (LONG_PTR)NULL))
Com_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); Com_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn);
} }
@ -74,7 +81,7 @@ static void CDAudio_CloseDoorThread (void)
{ {
DWORD dwReturn; DWORD dwReturn;
if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD)NULL)) if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (LONG_PTR)NULL))
Com_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); Com_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn);
_endthread(); _endthread();
} }
@ -84,7 +91,7 @@ static void CDAudio_CloseDoor (void)
//_beginthread(CDAudio_CloseDoorThread, 0, NULL); //_beginthread(CDAudio_CloseDoorThread, 0, NULL);
DWORD dwReturn; DWORD dwReturn;
if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD)NULL)) if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (LONG_PTR)NULL))
Com_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); Com_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn);
} }
@ -98,7 +105,7 @@ static int CDAudio_GetAudioDiskInfo (void)
cdValid = false; cdValid = false;
mciStatusParms.dwItem = MCI_STATUS_READY; mciStatusParms.dwItem = MCI_STATUS_READY;
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (LONG_PTR) (LPVOID) &mciStatusParms);
if (dwReturn) if (dwReturn)
{ {
Com_DPrintf("CDAudio: drive ready test - get status failed\n"); Com_DPrintf("CDAudio: drive ready test - get status failed\n");
@ -111,7 +118,7 @@ static int CDAudio_GetAudioDiskInfo (void)
} }
mciStatusParms.dwItem = MCI_STATUS_NUMBER_OF_TRACKS; mciStatusParms.dwItem = MCI_STATUS_NUMBER_OF_TRACKS;
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (LONG_PTR) (LPVOID) &mciStatusParms);
if (dwReturn) if (dwReturn)
{ {
Com_DPrintf("CDAudio: get tracks - status failed\n"); Com_DPrintf("CDAudio: get tracks - status failed\n");
@ -158,7 +165,7 @@ void CDAudio_Play2 (int track, qboolean looping)
// don't try to play a non-audio track // don't try to play a non-audio track
mciStatusParms.dwItem = MCI_CDA_STATUS_TYPE_TRACK; mciStatusParms.dwItem = MCI_CDA_STATUS_TYPE_TRACK;
mciStatusParms.dwTrack = track; mciStatusParms.dwTrack = track;
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (LONG_PTR) (LPVOID) &mciStatusParms);
if (dwReturn) if (dwReturn)
{ {
Com_DPrintf("MCI_STATUS failed (%i)\n", dwReturn); Com_DPrintf("MCI_STATUS failed (%i)\n", dwReturn);
@ -173,7 +180,7 @@ void CDAudio_Play2 (int track, qboolean looping)
// get the length of the track to be played // get the length of the track to be played
mciStatusParms.dwItem = MCI_STATUS_LENGTH; mciStatusParms.dwItem = MCI_STATUS_LENGTH;
mciStatusParms.dwTrack = track; mciStatusParms.dwTrack = track;
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms); dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (LONG_PTR) (LPVOID) &mciStatusParms);
if (dwReturn) if (dwReturn)
{ {
Com_DPrintf("MCI_STATUS failed (%i)\n", dwReturn); Com_DPrintf("MCI_STATUS failed (%i)\n", dwReturn);
@ -189,8 +196,8 @@ void CDAudio_Play2 (int track, qboolean looping)
mciPlayParms.dwFrom = MCI_MAKE_TMSF(track, 0, 0, 0); mciPlayParms.dwFrom = MCI_MAKE_TMSF(track, 0, 0, 0);
mciPlayParms.dwTo = (mciStatusParms.dwReturn << 8) | track; mciPlayParms.dwTo = (mciStatusParms.dwReturn << 8) | track;
mciPlayParms.dwCallback = (DWORD)cl_hwnd; mciPlayParms.dwCallback = (LONG_PTR)cl_hwnd;
dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD)(LPVOID) &mciPlayParms); dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (LONG_PTR)(LPVOID) &mciPlayParms);
if (dwReturn) if (dwReturn)
{ {
Com_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); Com_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
@ -225,7 +232,7 @@ void CDAudio_Stop (void)
if (!playing) if (!playing)
return; return;
if (dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (DWORD)NULL)) if (dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (LONG_PTR)NULL))
Com_DPrintf("MCI_STOP failed (%i)", dwReturn); Com_DPrintf("MCI_STOP failed (%i)", dwReturn);
wasPlaying = false; wasPlaying = false;
@ -244,8 +251,8 @@ void CDAudio_Pause (void)
if (!playing) if (!playing)
return; return;
mciGenericParms.dwCallback = (DWORD)cl_hwnd; mciGenericParms.dwCallback = (LONG_PTR)cl_hwnd;
if (dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (DWORD)(LPVOID) &mciGenericParms)) if (dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (LONG_PTR)(LPVOID) &mciGenericParms))
Com_DPrintf("MCI_PAUSE failed (%i)", dwReturn); Com_DPrintf("MCI_PAUSE failed (%i)", dwReturn);
wasPlaying = playing; wasPlaying = playing;
@ -269,8 +276,8 @@ void CDAudio_Resume (void)
mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0); mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0);
mciPlayParms.dwTo = MCI_MAKE_TMSF(playTrack + 1, 0, 0, 0); mciPlayParms.dwTo = MCI_MAKE_TMSF(playTrack + 1, 0, 0, 0);
mciPlayParms.dwCallback = (DWORD)cl_hwnd; mciPlayParms.dwCallback = (LONG_PTR)cl_hwnd;
dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD)(LPVOID) &mciPlayParms); dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (LONG_PTR)(LPVOID) &mciPlayParms);
if (dwReturn) if (dwReturn)
{ {
Com_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); Com_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
@ -487,7 +494,7 @@ int CDAudio_Init (void)
return -1; return -1;
mciOpenParms.lpstrDeviceType = "cdaudio"; mciOpenParms.lpstrDeviceType = "cdaudio";
if (dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD) (LPVOID) &mciOpenParms)) if (dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (LONG_PTR) (LPVOID) &mciOpenParms))
{ {
Com_Printf("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn); Com_Printf("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn);
return -1; return -1;
@ -496,10 +503,10 @@ int CDAudio_Init (void)
// Set the time format to track/minute/second/frame (TMSF). // Set the time format to track/minute/second/frame (TMSF).
mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF; mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF;
if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD)(LPVOID) &mciSetParms)) if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (LONG_PTR)(LPVOID) &mciSetParms))
{ {
Com_Printf("MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn); Com_Printf("MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn);
mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD)NULL); mciSendCommand(wDeviceID, MCI_CLOSE, 0, (LONG_PTR)NULL);
return -1; return -1;
} }
@ -528,7 +535,7 @@ void CDAudio_Shutdown(void)
if (!initialized) if (!initialized)
return; return;
CDAudio_Stop(); CDAudio_Stop();
if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL)) if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (LONG_PTR)NULL))
Com_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n"); Com_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
} }

View file

@ -227,7 +227,7 @@ void Sys_ShowConsole (qboolean show)
Sys_ConsoleProc Sys_ConsoleProc
================= =================
*/ */
static LONG WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
switch (uMsg) switch (uMsg)
{ {
@ -269,14 +269,14 @@ static LONG WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
SetBkMode((HDC)wParam, TRANSPARENT); SetBkMode((HDC)wParam, TRANSPARENT);
SetBkColor((HDC)wParam, RGB(39, 115, 102)); SetBkColor((HDC)wParam, RGB(39, 115, 102));
SetTextColor((HDC)wParam, RGB(255, 255, 255)); SetTextColor((HDC)wParam, RGB(255, 255, 255));
return (LONG)sys_console.hBrushOutput; return (LRESULT)sys_console.hBrushOutput;
} }
else if ((HWND)lParam == sys_console.hWndInput) else if ((HWND)lParam == sys_console.hWndInput)
{ {
SetBkMode((HDC)wParam, TRANSPARENT); SetBkMode((HDC)wParam, TRANSPARENT);
SetBkColor((HDC)wParam, RGB(255, 255, 255)); SetBkColor((HDC)wParam, RGB(255, 255, 255));
SetTextColor((HDC)wParam, RGB(0, 0, 0)); SetTextColor((HDC)wParam, RGB(0, 0, 0));
return (LONG)sys_console.hBrushInput; return (LRESULT)sys_console.hBrushInput;
} }
break; break;
@ -291,7 +291,7 @@ static LONG WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
else else
SetTextColor((HDC)wParam, RGB(0, 0, 0)); SetTextColor((HDC)wParam, RGB(0, 0, 0));
return (LONG)sys_console.hBrushMsg; return (LRESULT)sys_console.hBrushMsg;
} }
break; break;
@ -311,7 +311,7 @@ static LONG WINAPI Sys_ConsoleProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
Sys_ConsoleEditProc Sys_ConsoleEditProc
================= =================
*/ */
static LONG WINAPI Sys_ConsoleEditProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI Sys_ConsoleEditProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
switch (uMsg) switch (uMsg)
{ {
@ -379,11 +379,9 @@ void Sys_ShutdownConsole (void)
} }
if (sys_console.defOutputProc) { if (sys_console.defOutputProc) {
// SetWindowLong(sys_console.hWndOutput, GWL_WNDPROC, (LONG)sys_console.defOutputProc);
SetWindowLongPtr(sys_console.hWndOutput, GWLP_WNDPROC, (LONG_PTR)sys_console.defOutputProc); SetWindowLongPtr(sys_console.hWndOutput, GWLP_WNDPROC, (LONG_PTR)sys_console.defOutputProc);
} }
if (sys_console.defInputProc) { if (sys_console.defInputProc) {
// SetWindowLong(sys_console.hWndInput, GWL_WNDPROC, (LONG)sys_console.defInputProc);
SetWindowLongPtr(sys_console.hWndInput, GWLP_WNDPROC, (LONG_PTR)sys_console.defInputProc); SetWindowLongPtr(sys_console.hWndInput, GWLP_WNDPROC, (LONG_PTR)sys_console.defInputProc);
} }
@ -480,8 +478,6 @@ void Sys_InitDedConsole (void)
sys_console.hBrushInput = CreateSolidBrush(RGB(255, 255, 255)); sys_console.hBrushInput = CreateSolidBrush(RGB(255, 255, 255));
// Subclass edit boxes // Subclass edit boxes
// sys_console.defOutputProc = (WNDPROC)SetWindowLong(sys_console.hWndOutput, GWL_WNDPROC, (LONG)Sys_ConsoleEditProc);
// sys_console.defInputProc = (WNDPROC)SetWindowLong(sys_console.hWndInput, GWL_WNDPROC, (LONG)Sys_ConsoleEditProc);
sys_console.defOutputProc = (WNDPROC)SetWindowLongPtr(sys_console.hWndOutput, GWLP_WNDPROC, (LONG_PTR)Sys_ConsoleEditProc); sys_console.defOutputProc = (WNDPROC)SetWindowLongPtr(sys_console.hWndOutput, GWLP_WNDPROC, (LONG_PTR)Sys_ConsoleEditProc);
sys_console.defInputProc = (WNDPROC)SetWindowLongPtr(sys_console.hWndInput, GWLP_WNDPROC, (LONG_PTR)Sys_ConsoleEditProc); sys_console.defInputProc = (WNDPROC)SetWindowLongPtr(sys_console.hWndInput, GWLP_WNDPROC, (LONG_PTR)Sys_ConsoleEditProc);