Page 1 of 1

Bug: /maxfps fg 0 = freeze/ctd

Posted: Tue Nov 11, 2003 11:13 am
by eq_freak
Using a just downloaded IRC-latest.zip.

Posted: Tue Nov 11, 2003 11:40 am
by Curious
lol - not really sure its a bug. 0 fps = freeze.

Posted: Tue Nov 11, 2003 11:42 am
by Lax
No, it's a bug. 0 is intended to work and be faster than if you tried /maxfps fg 200 ;)

It's a divide by zero error, uploading new zip soon but here's the fix:

EQLib_Commands.cpp

Code: Select all

// ***************************************************************************
// Function:      MaxFPS
// Description:   Our /MaxFPS command. Sets or displays the max fps setting for
//                foreground or background
// 2003-11-01     Lax
// ***************************************************************************
VOID MaxFPS(PSPAWNINFO pChar, PCHAR szLine)
{
   bRunNextCommand = TRUE;
   CHAR szCmd[MAX_STRING] = {0};
	CHAR Arg1[MAX_STRING] = {0};
	CHAR Arg2[MAX_STRING] = {0};
	GetArg(Arg1,szLine,1);
	GetArg(Arg2,szLine,2);


   if (Arg1[0]==0 || Arg2[0]==0) {
[color=red]	   sprintf(szCmd,"\aw\ayMaxFPS\ax\a-u:\ax \a-u[\ax\at%d\ax Foreground\a-u]\ax \a-u[\ax\at%d\ax Background\a-u]\ax",gFG_SLEEP?1000/gFG_SLEEP:0,gBG_SLEEP?1000/gBG_SLEEP:0);[/color]
		WriteChatBuffer(szCmd,USERCOLOR_DEFAULT);
		WriteChatBuffer("Usage: /maxfps <fg|bg> [#]",USERCOLOR_DEFAULT);
		return;
   }
   DWORD NewMax=atoi(Arg2);
   if (NewMax>200)
   {
	   WriteChatBuffer("MaxFPS: Please use a number between 0 and 200",USERCOLOR_DEFAULT);
	   return;
   }

   if (!stricmp(Arg1,"fg"))
   {
	 SetForegroundMaxFPS(NewMax);
	   WritePrivateProfileString("MacroQuest","ForegroundMaxFPS",Arg2,gszINIFilename);
   }
   else if (!stricmp(Arg1,"bg"))
   {
	   SetBackgroundMaxFPS(NewMax);
	   WritePrivateProfileString("MacroQuest","BackgroundMaxFPS",Arg2,gszINIFilename);
   }
[color=red]	   sprintf(szCmd,"\aw\ayMaxFPS\ax\a-u:\ax \a-u[\ax\at%d\ax Foreground\a-u]\ax \a-u[\ax\at%d\ax Background\a-u]\ax",gFG_SLEEP?1000/gFG_SLEEP:0,gBG_SLEEP?1000/gBG_SLEEP:0);[/color]
    WriteChatBuffer(szCmd,USERCOLOR_DEFAULT);
}

Posted: Tue Nov 11, 2003 11:47 am
by Curious
Sweet! That's good news for me, thanks Lax :)

Posted: Tue Nov 11, 2003 12:08 pm
by eq_freak
Thanks :)

Posted: Tue Nov 11, 2003 12:37 pm
by Lax
Zip updated with this fixed.

Also, if you are having a problem with the FPS limiter please debug it for me. Turn on debug spew the usual way (EQLib_Utilities.cpp, macroquest.ini) and also uncomment the DBG_FPS line in EQLib.h. Then make sure if you're running EQW that in the debug spew, it says "EQW Detected". Also make sure that it says both "Foreground" and "Background" at some point in the log, and make sure when you are checking it in another window that it is in fact background ;)