Forum

DEBUGGING without DEBUG

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Re: DEBUGGING without DEBUG

Postby r00k » Tue Mar 27, 2012 2:44 am

So i need to float my boat to (codeblocks with mingw64) land and drink a bottle of debug for breakfast ;)
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Re: DEBUGGING without DEBUG

Postby revelator » Tue Mar 27, 2012 9:14 am

what can i say :P with the work i put in it im pretty happy with my compiler hehe.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: DEBUGGING without DEBUG

Postby Knightmare » Tue Mar 27, 2012 7:25 pm

It was the byte order functions, or more specifically the function pointers that are bound on startup after detecting byte order. I did a build that bypassed them, hardcoding function calls, and it worked perfectly. After referring to the RtCW source, I found that the pointers needed to be static to work right with newer Visual Studio versions.

Here's the fixed code in q_shared.c:
Code: Select all
// can't just use function pointers, or dll linkage can
// mess up when qcommon is included in multiple places
// Knightmare- made these static
static short   (*_BigShort) (short l);
static short   (*_LittleShort) (short l);
static int      (*_BigLong) (int l);
static int      (*_LittleLong) (int l);
static qint64   (*_BigLong64) (qint64 l);
static qint64   (*_LittleLong64) (qint64 l);
static float   (*_BigFloat) (float l);
static float   (*_LittleFloat) (float l);

short   BigShort(short l){return _BigShort(l);}
short   LittleShort(short l) {return _LittleShort(l);}
int      BigLong (int l) {return _BigLong(l);}
int      LittleLong (int l) {return _LittleLong(l);}
qint64   BigLong64 (qint64 l) {return _BigLong64(l);}
qint64   LittleLong64 (qint64 l) {return _LittleLong64(l);}
float   BigFloat (float l) {return _BigFloat(l);}
float   LittleFloat (float l) {return _LittleFloat(l);}
Knightmare
 
Posts: 63
Joined: Thu Feb 09, 2012 1:55 am

Re: DEBUGGING without DEBUG

Postby revelator » Tue Mar 27, 2012 8:16 pm

nice catch :) this should also apply to quake 1
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: DEBUGGING without DEBUG

Postby r00k » Tue Mar 27, 2012 8:31 pm

Thanks Knightmare!
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Re: DEBUGGING without DEBUG

Postby revelator » Tue Mar 27, 2012 8:41 pm

noticed for gcc you need to call the static function pointers instead of the prototype or it will fail to build with invalid lvalue.

so in quake1's common.c call them like this _BigShort = ShortSwap etc.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Previous

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest