#include "pch.hpp"
//===========================================================================//
// File:	 DebugMenus.cpp													 //
// Project:  GameOS					                                         //
// Contents: Default debugger menus and user added ones						 //
//---------------------------------------------------------------------------//
// Date      Who    Modification                                             //
// 07/10/98  AG     Created													 //
//																			 //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp.						                 //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//
#include "Debugger.hpp"
#include "Windows.hpp"
#include "DXRasterizer.hpp"
#include "Debugger.hpp"
#include "ErrorHandler.hpp"
#include "3DRasterizer.hpp"
#include "Profiler.hpp"
#include "Sound Renderer.hpp"
#include "VideoPlayback.hpp"
#include "Texture Manager.hpp"


extern HGOSHEAP DefaultHeap;
extern RenderModeType OldRenderMode;
extern DWORD PickFound;							// 1=Quad, 2=Triangle, 3=Indexed array, 4=Strip, 5=Fan
extern DWORD EnableDisplayInfo;
extern bool DisablePolling;
extern bool DisableSoundSystem;
extern bool DisableVideoPlayback;
extern char SpewList[];
extern char SpewDefault[];

MenuItem* CurrentMenu;
//
// Game menus
//
MenuItem*	pDebuggerMenu=0;
MenuItem*	pRasterizerMenu=0;
MenuItem*	pLibrariesMenu=0;
MenuItem*	pGameMenu=0;
//
// Pointer to current menu
//
MenuItem**	pCurrentMenu=0;










DWORD	gShowMemoryUseage=0;					// 2=Enable at next frame, 1=show data, 0=Do not show data
DWORD	gShowWSUseage=0;						// 2=Enable at next frame, 1=show data, 0=Do not show data
DWORD	gShowFTOLUseage=0;						// 2=Enable at next frame, 1=show data, 0=Do not show data
DWORD	gFreezeInPause=0;
DWORD	gForceNoClear=0;
DWORD	gEnableLoc=0;
DWORD	gShowALLUseage=0;
DWORD	gTextureOverrun=0;
DWORD	gDisableLinesPoints=0;
DWORD	gDisablePrimitives=0;
DWORD	gDisableText=0;
DWORD   gCaptureDevice = 0; // jcem 0 - main, 1 - radar, 2 - mr, 3/4/5/6/7 - AUX #1-#5
DWORD	gCaptureScreen=0;
DWORD	gPrintScreen=1;
DWORD	gScreenBMP=1;
//
// Bit
//  0  = Force alpha to 255
//  1  = Force colors to 0xffffff
//  2  = Force alpha to 0
//  3  = Force colors to 0
//
DWORD	gForceAlpha=0;
DWORD	gShowVertexData=0;
DWORD	gUseGameSpew=1;
DWORD	gForceMono=0;
DWORD	gForceFlat=0;
DWORD	gForceBlend=0;
DWORD	gForceGouraud=0;
DWORD	gForcePerspective=0;
DWORD	gForceNoPerspective=0;
DWORD	gForceSpecular=0;
DWORD	gForceNoSpecular=0;
DWORD	gForceNoFog=0;
DWORD	gForceNoTextures=0;
DWORD	gForceChessTexture=0;
DWORD	gForceNoFiltering=0;
DWORD	gForceBiLinear=0;
DWORD	gForceTriLinear=0;
int		gForceMipBias=-1;
DWORD	gForceNoDithering=0;
DWORD	gForceDithering=0;
DWORD	gControlsActive=0;					// Allow controls for the game during the debugger
DWORD	gGameLogicActive=1;
DWORD	gForceNoAlphaTest=0;
DWORD	gForceAlphaTest=0;
DWORD	gForceAlphaBlending=0;
DWORD	gStopSystem=0;						// Stop whole system in debugger
DWORD	gStopRendering=0;					// Stop rendering
DWORD	gStopGameRendering=0;
DWORD	gFreezeLogic=0;			// Stop rendering
DWORD	gFrameGraph=0;
DWORD	WantAA=0;
DWORD	Want32=0;
DWORD	Want32T=0;
DWORD	WantRes=640;
DWORD	WantSW=0;
DWORD	WantSW1=0;
DWORD	WantHW=0;
DWORD	WantRVRAM=0;
DWORD	gShowAverage=1;
DWORD	gShowGraphsAsTime=0;
DWORD	gShowGraphBackground=0;
DWORD	gNoGraph=0;
DWORD	gShowLFControls=1;
DWORD	gEnableParallel=1;
DWORD	DoUpdateWindow=0;
DWORD	DoingAdvance=0;
DWORD	OldgStopSystem;
DWORD	OldgGameLogicActive;
DWORD	ShowColorInfo=1;
DWORD	gEnableMulti=1;
DWORD	gEnableRS=0;
DWORD	gDisableLighting=0;
DWORD	gDisableNormalizing=0;
DWORD	gDisableHardwareTandL=0;
DWORD	gDisableVertexBlending=0;
DWORD	gTestAGPLimit = ~0L;
DWORD	gTestVIDLimit = ~0L;

//
//
// Routines associated with the debugger menus
//
//
bool CheckDevice()
{
	char* Current=CurrentMenu->Name;
	for( int t0=0; t0<gos_GetMachineInformation(gos_Info_NumberDevices); t0++ )
	{
		char Buffer[128];
		sprintf( Buffer,"Use %s",(char*)gos_GetMachineInformation(gos_Info_GetDeviceName,Environment.FullScreenDevice) );
		if( 0==strcmp(Buffer,Current) )
			return 1;
	}
	return 0;
}
void SelectDevice()
{
	char* Current=MenuHighlight->Name;
	for( int t0=0; t0<gos_GetMachineInformation(gos_Info_NumberDevices); t0++ )
	{
		char Buffer[128];
		sprintf( Buffer,"Use %s",(char*)gos_GetMachineInformation(gos_Info_GetDeviceName,t0) );
		if( 0==strcmp(Buffer,Current) )
		{
			Environment.FullScreenDevice=t0;
			DoUpdateWindow=1;
		}
	}
}
void EnableParallel()
{
	gEnableParallel=!gEnableParallel;
}
void EnableNoAlphaTesting()
{
	gForceNoAlphaTest=!gForceNoAlphaTest;
	if( gForceNoAlphaTest )
		gForceAlphaTest=0;
}
void EnableAlphaTesting()
{
	gForceAlphaTest=!gForceAlphaTest;
	if( gForceAlphaTest )
		gForceNoAlphaTest=0;
}
void EnablePerspective()
{
	gForcePerspective=!gForcePerspective;
	if( gForcePerspective )
		gForceNoPerspective=0;
}
void EnableNoPerspective()
{
	gForceNoPerspective=!gForceNoPerspective;
	if( gForceNoPerspective )
		gForcePerspective=0;
}
void EnableSpecular()
{
	gForceSpecular=!gForceSpecular;
	if( gForceSpecular )
		gForceNoSpecular=0;
}
void EnableNoSpecular()
{
	gForceNoSpecular=!gForceNoSpecular;
	if( gForceNoSpecular )
		gForceSpecular=0;
}
void EnableAlphaBlending()
{
	gForceAlphaBlending=!gForceAlphaBlending;
}
void EnableAverage()
{
	gShowAverage=!gShowAverage;
}
void EnablePercent()
{
	gShowGraphsAsTime=!gShowGraphsAsTime;
}
void EnableReset()
{
	Stat* pStat=pStatistics;
	while( pStat )
	{
		if( 0==(pStat->Flags&Stat_Format) )
		{
			pStat->Count=0;
			pStat->Minimum=0;
			pStat->Maximum=0;
			pStat->MaxPercentage=0;
			pStat->MinPercentage=0;
			pStat->TotalPercentage=0;
			pStat->Total=0;
			for( int t0=0; t0<512; t0++ )
			{
				SetHistory(pStat,t0,0);
			}
		}
		pStat=pStat->pNext;
	}
}
void EnableMono()
{
	gForceMono=!gForceMono;
}
void EnableFlat()
{
	gForceFlat=!gForceFlat;
	if( gForceFlat )
		gForceGouraud=0;
}
void EnableDecal()
{
	if( gForceBlend==(int)gos_BlendDecal )
		gForceBlend=0;
	else
		gForceBlend=(int)gos_BlendDecal;
}
void EnableModulate()
{
	if( gForceBlend==(int)gos_BlendModulate )
		gForceBlend=0;
	else
		gForceBlend=(int)gos_BlendModulate;
}
void EnableModulateAlpha()
{
	if( gForceBlend==(int)gos_BlendModulateAlpha )
		gForceBlend=0;
	else
		gForceBlend=(int)gos_BlendModulateAlpha;
}
bool CheckDecal()
{
	return gForceBlend==gos_BlendDecal;
}
bool CheckModulate()
{
	return gForceBlend==gos_BlendModulate;
}
bool CheckModulateAlpha()
{
	return gForceBlend==gos_BlendModulateAlpha;
}
void EnableGouraud()
{
	gForceGouraud=!gForceGouraud;
	if( gForceGouraud )
		gForceFlat=0;
}
void EnableGraphBackground()
{
	gShowGraphBackground=!gShowGraphBackground;
}
void EnableNoGraph()
{
	gNoGraph=!gNoGraph;
}
void EnableNoFlip()
{
	gForceNoFlip=!gForceNoFlip;
}
void EnableGOSStats()
{
	NoDebuggerStats=!NoDebuggerStats;
}
void EnableVertexData()
{
	gShowVertexData=!gShowVertexData;
}
void EnableVertexAlpha0()
{
	gForceAlpha^=1;
	if( gForceAlpha&1 )
		gForceAlpha&=~4;
}
void EnableVertexAlpha1()
{
	gForceAlpha^=2;
	if( gForceAlpha&2 )
		gForceAlpha&=~8;
}
void EnableVertexAlpha2()
{
	gForceAlpha^=4;
	if( gForceAlpha&4 )
		gForceAlpha&=~1;
}
void EnableVertexAlpha3()
{
	gForceAlpha^=8;
	if( gForceAlpha&8 )
		gForceAlpha&=~2;
}
void EnableNoTextures()
{
	gForceNoTextures=!gForceNoTextures;
	if( gForceNoTextures )
		gForceChessTexture=0;
}
void EnableChessTexture()
{
	gForceChessTexture=!gForceChessTexture;
	if( gForceChessTexture )
		gForceNoTextures=0;
}
void EnableNoFiltering()
{
	gForceNoFiltering=!gForceNoFiltering;
	if( gForceNoFiltering )
	{
		gForceBiLinear=0;
		gForceTriLinear=0;
	}
}
void EnableNoFog()
{
	gForceNoFog=!gForceNoFog;
}
void EnableBiLinear()
{
	gForceBiLinear=!gForceBiLinear;
	if( gForceBiLinear )
	{
		gForceNoFiltering=0;
		gForceTriLinear=0;
	}
}
void EnableTriLinear()
{
	gForceTriLinear=!gForceTriLinear;
	if( gForceTriLinear )
	{
		gForceBiLinear=0;
		gForceNoFiltering=0;
	}
}
void EnableMipBias0()
{
	if( 0==gForceMipBias )
		gForceMipBias=-1;
	else
		gForceMipBias=0;
}
void EnableMipBias1()
{
	if( 1==gForceMipBias )
		gForceMipBias=-1;
	else
		gForceMipBias=1;
}
void EnableMipBias2()
{
	if( 2==gForceMipBias )
		gForceMipBias=-1;
	else
		gForceMipBias=2;
}
void EnableNoDithering()
{
	gForceNoDithering=!gForceNoDithering;
	if( gForceNoDithering )
		gForceDithering=0;
}
void EnableDithering()
{
	gForceDithering=!gForceDithering;
	if( gForceDithering )
		gForceNoDithering=0;
}
void EnterExamineScene()
{
	OldRenderMode=ExamineScene;
	OldStop=gStopSystem;
	PickFound=0;
}
void EnterExamineArea()
{
	OldStop=gStopSystem;
	OldRenderMode=ExamineArea;
}
void EnterExamineColor()
{
	OldStop=gStopSystem;
	OldRenderMode=ExamineColor;
	PickFound=0;
}
void EnterExamineDrawing()
{
	OldRenderMode=ExamineDrawing;
	OldStop=gStopSystem;
	gStopSystem=1;
	DrawingPolys=0;
	DrawingMax=999999;
}
void EnableTriangleColors()
{
	if( OldRenderMode==ShowTriangleColors )
		OldRenderMode=Normal;
	else
		OldRenderMode=ShowTriangleColors;
}
void EnableWireframe()
{
	if( OldRenderMode==WireframeGlobalColor )
		OldRenderMode=Normal;
	else
		OldRenderMode=WireframeGlobalColor;
}
void EnableWireframe1()
{
	if( OldRenderMode==WireframeGlobalTexture )
		OldRenderMode=Normal;
	else
		OldRenderMode=WireframeGlobalTexture;
}
void EnableTriangleArea()
{
	if( OldRenderMode==ExamineTriangleSize )
		OldRenderMode=Normal;
	else
		OldRenderMode=ExamineTriangleSize;
}
void EnableTriangleArea1()
{
	if( OldRenderMode==ExamineTriangleSize1 )
		OldRenderMode=Normal;
	else
		OldRenderMode=ExamineTriangleSize1;
}
void EnableGameSpew()
{
	gUseGameSpew=!gUseGameSpew;
}
void EnableControls()
{
	gControlsActive=!gControlsActive;
}
void EnableGameLogic()
{
	gGameLogicActive=!gGameLogicActive;
}
void EnableFreezeInPause()
{
	gFreezeInPause=!gFreezeInPause;
}
void EnableProcessMemory()
{
	ProcessMemorySize=!ProcessMemorySize;
}
void EnableStop()
{
	gStopSystem=!gStopSystem;
}
void EnableStop1()
{
	gFreezeLogic=!gFreezeLogic;
}
void EnableStop2()
{
	gStopRendering=!gStopRendering;
}
void EnableStop3()
{
	gStopGameRendering=!gStopGameRendering;
}
void  EnableLFControl()
{
	gShowLFControls=!gShowLFControls;
}
void EnableLoc()
{
	if( 1==gEnableLoc )
		gEnableLoc=0;
	else
		gEnableLoc=1;
}
void EnableLoc1()
{
	if( 2==gEnableLoc )
		gEnableLoc=0;
	else
		gEnableLoc=2;
}
void AdvanceOneFrame()
{
	DoingAdvance=1;
	OldgStopSystem=gStopSystem;
	OldgGameLogicActive=gGameLogicActive;
	gStopSystem=0;
	gGameLogicActive=1;
	MenuActive=1;
	SubMenuActive=1;
	DebounceMenu=1;
}
void EnableStatDisp()
{
	DebugDisplay=DbgS_Stat;
}
void EnableTextureDisp()
{
	DebugDisplay=DbgS_Texture;
}
void EnableCPUStats()
{
	DebugDisplay=DbgS_CPUStats;
}
void EnableSpewDisp()
{
	DebugDisplay=DbgS_Spew;
}
void EnableNetworkDisp()
{
	DebugDisplay=DbgS_Network;
}
void EnableNetworkDispx()
{
	DebugDisplay=DbgS_NetworkX;
}
void EnableSpewMemory()
{
	gShowMemoryUseage=2;
}
void EnableSpewWS()
{
	gShowWSUseage=2;
}
void EnableSpewFTOL()
{
	gShowFTOLUseage=2;
}
void EnableSpewALL()
{
	gShowALLUseage=2;
}
void EnableMemoryDisp()
{
	DebugDisplay=DbgS_Memory;
}
void EnableFileDisp()
{
	DebugDisplay=DbgS_File;
}
void EnableSoundDisp()
{
	DebugDisplay=DbgS_Sound;
}
void EnablePlayHistoryDisp()
{
	DebugDisplay=DbgS_PlayHistory;
}
void EnableSoundResourceDisp()
{
	DebugDisplay=DbgS_SoundResource;
}

void EnableSoundSpatialDisp()
{
	DebugDisplay=DbgS_SoundSpatial;
}

void EnableControlDisp()
{
	DebugDisplay=DbgS_Control;
}
void EnableTextureMemoryDisp()
{
	DebugDisplay=DbgS_UsedTextures;
}
void EnableTextureMemoryDisp1()
{
	DebugDisplay=DbgS_UnusedTextures;
}
void EnableTextureMemoryDisp2()
{
	DebugDisplay=DbgS_LoadedTextures;
}
void EnableTextureMemoryDisp3()
{
	DebugDisplay=DbgS_AllTextures;
}
void EnableTextureMemoryDisp4()
{
	DebugDisplay=DbgS_UsedTextureDetail;
}
void EnableTextureMemoryDisp5()
{
	DebugDisplay=DbgS_UnusedTextureDetail;
}
void EnableTextureMemoryDisp6()
{
	DebugDisplay=DbgS_LoadedTextureDetail;
}
void EnableTextureMemoryDisp7()
{
	DebugDisplay=DbgS_AllTextureDetail;
}
void EnableTextureMemoryDispB()
{
	DebugDisplay=DbgS_AllTextureNoUpload;
}
void EnableTextureLogDisp()
{
	DebugDisplay=DbgS_TextureLog;
}
void EnableTextureLogging()
{
	CTexInfo::LogEnable( !CTexInfo::LogEnable() );
}
void EnableFrameGraph()
{
	gFrameGraph ^= 1;
}
void EnableAA()
{
	WantAA=!WantAA;
	DoUpdateWindow=1;
}
void Enable32()
{
	Want32=!Want32;
	if( !Want32 )			// Force off 32 bit textures in 16 bit modes
		Want32T=0;
	DoUpdateWindow=1;
}
void EnableSW()
{
	WantSW=!WantSW;
	if( WantSW )
	{
		WantHW=0;
		WantSW1=0;
	}
	DoUpdateWindow=1;
}
void EnableSW1()
{
	WantSW1=!WantSW1;
	if( WantSW1 )
	{
		WantHW=0;
		WantSW=0;
	}
	DoUpdateWindow=1;
}
void EnableHW()
{
	WantHW=!WantHW;
	if( WantHW )
	{
		WantSW=0;
		WantSW1=0;
	}
	DoUpdateWindow=1;
}
void EnableRVRAM()
{
	WantRVRAM=!WantRVRAM;
	DoUpdateWindow=1;
}
void Enable32T()
{
	Want32T=!Want32T;
	if( Want32T )			// Force on 32 bit rendering for 32 bit textures
		Want32=1;
	gos_RecreateTextureHeaps();
	DoUpdateWindow=1;
}
void EnableHZ()
{
	Environment.MaxRefreshRate=!Environment.MaxRefreshRate;
	if( Environment.fullScreen )
		DoUpdateWindow=1;
}
void EnableTB()
{
	Environment.TripleBuffer=!Environment.TripleBuffer;
	if( Environment.fullScreen )
		DoUpdateWindow=1;
}
void Enable512()
{
	if( WantRes==512 )
		WantRes=0;
	else
		WantRes=512;
	DoUpdateWindow=1;
}
void Enable640()
{
	if( WantRes==640 )
		WantRes=0;
	else
		WantRes=640;
	DoUpdateWindow=1;
}
void Enable800()
{
	if( WantRes==800 )
		WantRes=0;
	else
		WantRes=800;
	DoUpdateWindow=1;
}
void Enable1024()
{
	if( WantRes==1024 )
		WantRes=0;
	else
		WantRes=1024;
	DoUpdateWindow=1;
}
void Enable1280()
{
	if( WantRes==1280 )
		WantRes=0;
	else
		WantRes=1280;
	DoUpdateWindow=1;
}
void Enable1600()
{
	if( WantRes==1600 )
		WantRes=0;
	else
		WantRes=1600;
	DoUpdateWindow=1;
}
void EnableAGP0()
{
	gTestAGPLimit = 0<<20;
	CTexInfo::NewAGPLimit();
}
void EnableAGP8()
{
	gTestAGPLimit = 8<<20;
	CTexInfo::NewAGPLimit();
}
void EnableAGP16()
{
	gTestAGPLimit = 16<<20;
	CTexInfo::NewAGPLimit();
}
void EnableAGP32()
{
	gTestAGPLimit = 32<<20;
	CTexInfo::NewAGPLimit();
}
void EnableAGPAll()
{
	gTestAGPLimit = ~0L;
	CTexInfo::NewAGPLimit();
}
void EnableVID0()
{
	gTestVIDLimit = 0<<20;
	CTexInfo::NewLocalLimit();
}
void EnableVID4()
{
	gTestVIDLimit = 4<<20;
	CTexInfo::NewLocalLimit();
}
void EnableVID8()
{
	gTestVIDLimit = 8<<20;
	CTexInfo::NewLocalLimit();
}
void EnableVID16()
{
	gTestVIDLimit = 16<<20;
	CTexInfo::NewLocalLimit();
}
void EnableVID32()
{
	gTestVIDLimit = 32<<20;
	CTexInfo::NewLocalLimit();
}
void EnableVID64()
{
	gTestVIDLimit = 64<<20;
	CTexInfo::NewLocalLimit();
}
void EnableVIDAll()
{
	gTestVIDLimit = ~0L;
	CTexInfo::NewLocalLimit();
}
bool CheckAA()
{
	return WantAA!=0;
}
bool Check32()
{
	return Want32!=0;
}
bool CheckTB()
{
	return Environment.fullScreen && Environment.TripleBuffer;
}
bool CheckHZ()
{
	return Environment.fullScreen && Environment.MaxRefreshRate;
}
bool Check32T()
{
	return Want32T!=0;
}
bool CheckSW()
{
	return WantSW!=0;
}
bool CheckSW1()
{
	return WantSW1!=0;
}
bool CheckHW()
{
	return WantHW!=0;
}
bool CheckRVRAM()
{
	return WantRVRAM!=0;
}
bool Check512()
{
	return WantRes==512;
}
bool Check640()
{
	return WantRes==640;
}
bool Check800()
{
	return WantRes==800;
}
bool Check1024()
{
	return WantRes==1024;
}
bool Check1280()
{
	return WantRes==1280;
}
bool Check1600()
{
	return WantRes==1600;
}
bool CheckAGP0()
{
	return gTestAGPLimit==0;
}
bool CheckAGP8()
{
	return gTestAGPLimit==(8<<20);
}
bool CheckAGP16()
{
	return gTestAGPLimit==(16<<20);
}
bool CheckAGP32()
{
	return gTestAGPLimit==(32<<20);
}
bool CheckAGPAll()
{
	return gTestAGPLimit==~0L;
}
bool CheckVID0()
{
	return gTestVIDLimit==0;
}
bool CheckVID4()
{
	return gTestVIDLimit==(4<<20);
}
bool CheckVID8()
{
	return gTestVIDLimit==(8<<20);
}
bool CheckVID16()
{
	return gTestVIDLimit==(16<<20);
}
bool CheckVID32()
{
	return gTestVIDLimit==(32<<20);
}
bool CheckVID64()
{
	return gTestVIDLimit==(64<<20);
}
bool CheckVIDAll()
{
	return gTestVIDLimit==~0L;
}
bool CheckDebug0()
{
	return DebugDisplay==DbgS_Stat;
}
bool CheckDebug1()
{
	return DebugDisplay==DbgS_Texture;
}
bool CheckDebug1a()
{
	return DebugDisplay==DbgS_Sound;
}
bool CheckDebug1a1()
{
	return DebugDisplay==DbgS_PlayHistory;
}
bool CheckDebug1a2()
{
	return DebugDisplay==DbgS_SoundResource;
}
bool CheckDebug1a3()
{
	return DebugDisplay==DbgS_SoundSpatial;
}
bool CheckDebug1b()
{
	return DebugDisplay==DbgS_Control;
}
bool CheckDebug2()
{
	return DebugDisplay==DbgS_Spew;
}
bool CheckTextureMemoryDisp()
{
	return DebugDisplay==DbgS_UsedTextures;
}
bool CheckTextureMemoryDisp1()
{
	return DebugDisplay==DbgS_UnusedTextures;
}
bool CheckTextureMemoryDisp2()
{
	return DebugDisplay==DbgS_LoadedTextures;
}
bool CheckTextureMemoryDisp3()
{
	return DebugDisplay==DbgS_AllTextures;
}
bool CheckTextureMemoryDisp4()
{
	return DebugDisplay==DbgS_UsedTextureDetail;
}
bool CheckTextureMemoryDisp5()
{
	return DebugDisplay==DbgS_UnusedTextureDetail;
}
bool CheckTextureMemoryDisp6()
{
	return DebugDisplay==DbgS_LoadedTextureDetail;
}
bool CheckTextureMemoryDisp7()
{
	return DebugDisplay==DbgS_AllTextureDetail;
}
bool CheckTextureMemoryDispB()
{
	return DebugDisplay==DbgS_AllTextureNoUpload;
}
bool CheckTextureLogDisp()
{
	return DebugDisplay==DbgS_TextureLog;
}
bool CheckTextureLogging()
{
	return CTexInfo::LogEnable();
}
bool CheckLoc()
{
	return gEnableLoc==1;
}
bool CheckCpuStats()
{
	return DebugDisplay==DbgS_CPUStats;
}
bool CheckLoc1()
{
	return gEnableLoc==2;
}
bool CheckDebug2a()
{
	return DebugDisplay==DbgS_Network;
}
bool CheckDebug2ax()
{
	return DebugDisplay==DbgS_NetworkX;
}
bool CheckDebug13()
{
	return DebugDisplay==DbgS_File;
}
bool CheckDebug2b()
{
	return DebugDisplay==DbgS_Memory;
}
bool CheckDebug3()
{
	return gFrameGraph!=0;
}
bool CheckVertexAlpha0()
{
	return 0!=(gForceAlpha&1);
}
bool CheckVertexAlpha1()
{
	return 0!=(gForceAlpha&2);
}
bool CheckVertexAlpha2()
{
	return 0!=(gForceAlpha&4);
}
bool CheckVertexAlpha3()
{
	return 0!=(gForceAlpha&8);
}
bool CheckDebug5b()
{
	return gForceNoTextures!=0;
}
bool CheckDebug5d()
{
	return gForceChessTexture!=0;
}
bool CheckDebug5c()
{
	return gForceNoFiltering!=0;
}
bool CheckTriLinear()
{
	return gForceTriLinear!=0;
}
bool CheckBiLinear()
{
	return gForceBiLinear!=0;
}
bool CheckMipBias0()
{
	return gForceMipBias==0;
}
bool CheckMipBias1()
{
	return gForceMipBias==1;
}
bool CheckMipBias2()
{
	return gForceMipBias==2;
}
bool CheckPerspective()
{
	return gForcePerspective!=0;
}
bool CheckNoPerspective()
{
	return gForceNoPerspective!=0;
}
bool CheckMono()
{
	return gForceMono!=0;
}
bool CheckFlat()
{
	return gForceFlat!=0;
}
bool CheckGouraud()
{
	return gForceGouraud!=0;
}
bool CheckSpecular()
{
	return gForceSpecular!=0;
}
bool CheckNoSpecular()
{
	return gForceNoSpecular!=0;
}
bool CheckDebug5c1()
{
	return gForceNoDithering!=0;
}
bool CheckDebug5c2()
{
	return gForceDithering!=0;
}
bool CheckDebug5cFog()
{
	return gForceNoFog!=0;
}
bool CheckDebug6()
{
	return gShowVertexData!=0;
}
bool CheckDebug7()
{
	return gUseGameSpew!=0;
}
bool CheckControl()
{
	return gControlsActive==0;
}
bool CheckFreezeInPause()
{
	return gFreezeInPause!=0;
}
bool CheckGameLogic()
{
	return gGameLogicActive==0;
}
bool CheckMem()
{
	return ProcessMemorySize!=0;
}
bool CheckParallel()
{
	return gEnableParallel!=0;
}
bool CheckDebug8()
{
	return gForceNoAlphaTest!=0;
}
bool CheckDebug81()
{
	return gForceAlphaTest!=0;
}
bool CheckDebug82()
{
	return gForceAlphaBlending!=0;
}
bool CheckNoFlip()
{
	return gForceNoFlip!=0;
}
bool CheckNoClear()
{
	return gForceNoClear==0;
}
void EnableNoClear()
{
	gForceNoClear=!gForceNoClear;
}
bool CheckStop()
{
	return gStopSystem!=0;
}
bool CheckStop1()
{
	return gFreezeLogic!=0;
}
void EnablePolling()
{
	DisablePolling=!DisablePolling;
}
bool CheckPolling()
{
	return DisablePolling;
}
void EnableSoundSystem()
{
	DisableSoundSystem=!DisableSoundSystem;
	if (DisableSoundSystem)
		SoundRendererPause();
	else
		SoundRendererContinue();
		
}
bool CheckSoundSystem()
{
	return DisableSoundSystem;
}
void EnableVideoPlayback()
{
	DisableVideoPlayback=!DisableVideoPlayback;
	if (DisableVideoPlayback)
		VideoManagerPause();
	else
		VideoManagerContinue();
		
}
bool CheckVideoPlayback()
{
	return DisableVideoPlayback;
}
bool CheckStop2()
{
	return gStopRendering!=0;
}
bool CheckStop3()
{
	return gStopGameRendering!=0;
}
bool CheckGOSStats()
{
	return NoDebuggerStats==0;
}
bool CheckPercent()
{
	return gShowGraphsAsTime==1;
}
bool CheckAverage()
{
	return gShowAverage==1;
}
bool CheckGraphBackground()
{
	return gShowGraphBackground!=0;
}
bool CheckNoGraph()
{
	return gNoGraph!=0;
}
bool CheckDebug5()
{
	return OldRenderMode==WireframeGlobalColor;
}
bool CheckDebug5zz()
{
	return OldRenderMode==ShowTriangleColors;
}
bool CheckDebug5a()
{
	return OldRenderMode==WireframeGlobalTexture;
}
bool CheckTriangleArea()
{
	return OldRenderMode==ExamineTriangleSize;
}
bool CheckTriangleArea1()
{
	return OldRenderMode==ExamineTriangleSize1;
}
bool CheckLFControl()
{
	return gShowLFControls!=0;
}
void EnableShowMipmap()
{
	OldStop=gStopSystem;
	if( OldRenderMode==ExamineMipmaps )
		OldRenderMode=Normal;
	else
	{
		OldRenderMode=ExamineMipmaps;
		strcpy( DisplayInfoText, "Mipmap Levels (hit space)" );
		EnableDisplayInfo=1;
		WhichImage=0;
	}
}
void EnableShowMipmap2()
{
	OldStop=gStopSystem;
	if( OldRenderMode==ExamineMipmaps2 )
		OldRenderMode=Normal;
	else
	{
		OldRenderMode=ExamineMipmaps2;
		strcpy( DisplayInfoText, "Mipmap Levels[2] (hit space)" );
		EnableDisplayInfo=1;
		WhichImage=0;
	}
}
void EnableReferenceRasterizer()
{
	OldStop=gStopSystem;
	gStopSystem=1;

	RenderWithReferenceRasterizer(0);

	OldRendering=gStopRendering;
	gStopRendering=1;
	WhichImage=0;
	OldRenderMode=ExamineRenderer;

	strcpy( DisplayInfoText, "Reference Rasterizer (hit space)" );
	EnableDisplayInfo=1;
	WhichImage=0;
}
void EnableDepthComplexity()
{
	OldStop=gStopSystem;
	gStopSystem=1;

	RenderWithReferenceRasterizer(1);

	OldRendering=gStopRendering;
	gStopRendering=1;
	WhichImage=0;
	OldRenderMode=ExamineDepth;

	strcpy( DisplayInfoText, "Depth Complexity (hit space)" );
	EnableDisplayInfo=1;
	WhichImage=0;
}
bool CheckArmorBuild()
{
	#ifdef _ARMOR
	return 0;
	#else
	return 1;
	#endif
}
bool CheckSpewFile()
{
	return Environment.debugLog && *Environment.debugLog!=0;
}
void EnableSpewFile()
{
	if( Environment.debugLog && *Environment.debugLog!=0 )
	{
		DisableSpewToFile();
		Environment.debugLog=0;
	}
	else
	{
		Environment.debugLog="Debug.txt";
		EnableSpewToFile();
	}
}
bool CheckDebugBuild()
{
	#ifdef _DEBUG
	return 0;
	#else
	return 1;
	#endif
}
bool CheckWindowsNT()
{
	return !WindowsNT;
}
bool CheckHasDither()
{
	return !HasDither;
}
bool CheckHasSpecular()
{
	return !HasSpecular;
}
bool CheckHasMipMap()
{
	return !HasMipMap;
}
bool CheckHasAlphaTest()
{
	return !HasAlphaTest;
}
bool CheckHasWireframe()
{
	return Environment.Renderer==3;
}
bool CheckHasBiLinear()
{
	return !HasBiLinear;
}
bool CheckHasTriLinear()
{
	return !HasTriLinear;
}
bool CheckHasFog()
{
	return !HasFog;
}
bool CheckPlatformGame()
{
	return Platform!=Platform_Game;
}
bool CheckAdvanceFrame()
{
	return (gGameLogicActive && !gStopSystem);
}
bool CheckFullScreen()
{
	return 0==Environment.fullScreen;
}
bool CheckWindowed()
{
	return 0!=Environment.fullScreen;
}
bool CheckGamma08()
{
	return GammaSetting==0.8f;
}
void EnableGamma08()
{
	gos_SetGammaValue( 0.8f );
}
bool CheckGamma10()
{
	return GammaSetting==1.0f;
}
void EnableGamma10()
{
	gos_SetGammaValue( 1.0f );
}
bool CheckGamma14()
{
	return GammaSetting==1.4f;
}
void EnableGamma14()
{
	gos_SetGammaValue( 1.4f );
}
bool CheckGamma18()
{
	return GammaSetting==1.8f;
}
void EnableGamma18()
{
	gos_SetGammaValue( 1.8f );
}
bool CheckGamma25()
{
	return GammaSetting==2.5f;
}
void EnableGamma25()
{
	gos_SetGammaValue( 2.5f );
}
bool CheckTexelOffset()
{
	return 0!=(Compatibility3D&TextureOffset);
}
void EnableTexelOffset()
{
	if( Compatibility3D&TextureOffset )
		Compatibility3D&=~TextureOffset;
	else
		Compatibility3D|=TextureOffset;
}

bool CheckGraphChart()
{
	return GraphMode==Graph_Chart;
}
bool CheckGraph30()
{
	return GraphMode==Graph_30;
}
bool CheckPie30()
{
	return GraphMode==Graph_Pie30;
}
bool CheckGraph60()
{
	return GraphMode==Graph_60;
}
bool CheckPie60()
{
	return GraphMode==Graph_Pie60;
}
bool CheckColorInfo()
{
	return ShowColorInfo!=0;
}
void EnableGraphChart()
{
	GraphMode=Graph_Chart;
}
void EnableGraph30()
{
	GraphMode=Graph_30;
}
void EnablePie30()
{
	GraphMode=Graph_Pie30;
}
void EnableGraph60()
{
	GraphMode=Graph_60;
}
void EnablePie60()
{
	GraphMode=Graph_Pie60;
}
void EnableColorInfo()
{
	ShowColorInfo=!ShowColorInfo;
}
bool CheckUsingGraphs()
{
	return GraphMode!=Graph_Chart;
}
bool CheckNotUsingGraphs()
{
	return GraphMode==Graph_Chart;
}
bool CheckNoMulti()
{
	return !gEnableMulti;
}
void EnableNoMulti()
{
	gEnableMulti=!gEnableMulti;
}
bool CheckHasMulti()
{
	DWORD OldMulti=gEnableMulti;
	gEnableMulti=1;
	bool Ok= (0==gos_GetMachineInformation(gos_Info_CanMultitextureLightMap) && 
			  0==gos_GetMachineInformation(gos_Info_CanMultitextureSpecularMap) &&
			  0==gos_GetMachineInformation(gos_Info_CanMultitextureDetail) );
	gEnableMulti=OldMulti;
	return Ok;
}
bool Support512()
{
	return 0==gos_GetMachineInformation( gos_Info_ValidMode, Environment.FullScreenDevice, 512, 384 );
}
bool Support640()
{
	return 0==gos_GetMachineInformation( gos_Info_ValidMode, Environment.FullScreenDevice, 640, 480 );
}
bool Support800()
{
	return 0==gos_GetMachineInformation( gos_Info_ValidMode, Environment.FullScreenDevice, 800, 600 );
}
bool Support1024()
{
	return 0==gos_GetMachineInformation( gos_Info_ValidMode, Environment.FullScreenDevice, 1024, 768 );
}
bool Support1280()
{
	return 0==gos_GetMachineInformation( gos_Info_ValidMode, Environment.FullScreenDevice, 1280, 1024 );
}
bool Support1600()
{
	return 0==gos_GetMachineInformation( gos_Info_ValidMode, Environment.FullScreenDevice, 1600, 1200 );
}
bool SupportAGP()
{
	return !HasAGP;
}
bool SupportVID4()
{
	DDSCAPS2 ddscaps;
	DWORD TotalLocalMemory, Junk;
	memset( &ddscaps, 0, sizeof(ddscaps) );
	ddscaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_TEXTURE;
	wGetAvailableVidMem( DDobject, &ddscaps, &TotalLocalMemory, &Junk );
	return TotalLocalMemory < (4<<20);
}
bool SupportVID8()
{
	DDSCAPS2 ddscaps;
	DWORD TotalLocalMemory, Junk;
	memset( &ddscaps, 0, sizeof(ddscaps) );
	ddscaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_TEXTURE;
	wGetAvailableVidMem( DDobject, &ddscaps, &TotalLocalMemory, &Junk );
	return TotalLocalMemory < (8<<20);
}
bool SupportVID16()
{
	DDSCAPS2 ddscaps;
	DWORD TotalLocalMemory, Junk;
	memset( &ddscaps, 0, sizeof(ddscaps) );
	ddscaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_TEXTURE;
	wGetAvailableVidMem( DDobject, &ddscaps, &TotalLocalMemory, &Junk );
	return TotalLocalMemory < (16<<20);
}
bool SupportVID32()
{
	DDSCAPS2 ddscaps;
	DWORD TotalLocalMemory, Junk;
	memset( &ddscaps, 0, sizeof(ddscaps) );
	ddscaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_TEXTURE;
	wGetAvailableVidMem( DDobject, &ddscaps, &TotalLocalMemory, &Junk );
	return TotalLocalMemory < (32<<20);
}
bool SupportVID64()
{
	DDSCAPS2 ddscaps;
	DWORD TotalLocalMemory, Junk;
	memset( &ddscaps, 0, sizeof(ddscaps) );
	ddscaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_TEXTURE;
	wGetAvailableVidMem( DDobject, &ddscaps, &TotalLocalMemory, &Junk );
	return TotalLocalMemory < (64<<20);
}



bool CheckDisableRS()
{
	return 0!=gEnableRS;
}
void EnableRS()
{
	gEnableRS=!gEnableRS;
}

DWORD SpewMenu( char* Name, DWORD Function )
{
	switch( Function )
	{
		case gosMenu_Name:
		static char Buffer[64];
		if( Environment.debugLog && *Environment.debugLog!=0 )
		{
			sprintf( Buffer, "Spew to %s", Environment.debugLog );
			return (DWORD)&Buffer;
		}		
		else
			return (DWORD)"Spew to \"Debug.txt\"";
		case gosMenu_CheckMark:
			return CheckSpewFile();
		case gosMenu_Greyed:
			return 0;										// Always active
		case gosMenu_Activated:
			EnableSpewFile();
			return 0;
		default:
			return 0;
	}
}
bool CheckSpewAll()
{
	return 0==strcmp(SpewList, "*");
}
void EnableSpewAll()
{
	if( 0==strcmp(SpewList, "*") )
	{
		char UserName[32+1];
		strncpy( UserName, gosGetUserName(), 31 );
		strcpy( SpewList, UserName );
		strcat( SpewList, " " );
		strcat( SpewList, SpewDefault );
		strcat( SpewList, " " );
		if( Environment.spew )
			strcat( SpewList, Environment.spew);
	}
	else
	{
		strcpy(SpewList, "*");
	}	
}
bool CheckTimeStamp()
{
	return Environment.TimeStampSpew;
}
void EnableTimeStamp()
{
	Environment.TimeStampSpew=!Environment.TimeStampSpew;
}
bool CheckOverrun()
{
	return 0!=gTextureOverrun;
}
void EnableOverrun()
{
	gTextureOverrun=!gTextureOverrun;
}
bool CheckDisableLinePoint()
{
	return 0!=gDisableLinesPoints;
}
void EnableLinePoint()
{
	gDisableLinesPoints=!gDisableLinesPoints;
}
bool CheckDisablePrimitives()
{
	return 0!=gDisablePrimitives;
}
void EnablePrimitives()
{
	gDisablePrimitives=~gDisablePrimitives;
}
bool CheckDisableText()
{
	return 0!=gDisableText;
}
void EnableText()
{
	gDisableText=~gDisableText;
}
bool CheckHasTandL()
{
	return 0==(CapsDirect3D.dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT);
}
bool CheckTandL()
{
	return 0==(CapsDirect3D.dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) || gDisableHardwareTandL;
}
void EnableTandL()
{
	gDisableHardwareTandL=!gDisableHardwareTandL;
	DoUpdateWindow=1;
}
bool CheckLighting()
{
	return 0!=gDisableLighting;
}
void EnableLighting()
{
	gDisableLighting=!gDisableLighting;
}
bool CheckNormalizing()
{
	return 0!=gDisableNormalizing;
}
void EnableNormalizing()
{
	gDisableNormalizing=!gDisableNormalizing;
}
bool CheckVertexBlending()
{
	return 0!=gDisableVertexBlending;
}
void EnableVertexBlending()
{
	gDisableVertexBlending=!gDisableVertexBlending;
}
void EnableScreenDump()
{
	gCaptureScreen=1;
}
void EnablePrintScreen()
{
	gPrintScreen=1-gPrintScreen;
}
bool CheckPrintScreen()
{
	return 0!=gPrintScreen;
}
void EnableScreenBMP()
{
	gScreenBMP=1-gScreenBMP;
}
bool CheckScreenBMP()
{
	return 0!=gScreenBMP;
}



void InitDebuggerMenus()
{
	#ifdef LAB_ONLY
//
//
//
	SPEW(( GROUP_GAMEOS, "InitDebuggerMenus()" ));
	pCurrentMenu=&pDebuggerMenu;
	AddDebuggerMenuItem( "Show statistics"									, CheckDebug0,				EnableStatDisp,				0 );
	AddDebuggerMenuItem( "Show renderer info"								, CheckDebug1,				EnableTextureDisp,			0 );
	AddDebuggerMenuItem( "Show sound info\\Channels & mixer"				, CheckDebug1a,				EnableSoundDisp,			0 );
	AddDebuggerMenuItem( "Show sound info\\Play history"					, CheckDebug1a1,	   		EnablePlayHistoryDisp,		0 );
	AddDebuggerMenuItem( "Show sound info\\Sound resources"					, CheckDebug1a2,	   		EnableSoundResourceDisp,	0 );
	AddDebuggerMenuItem( "Show sound info\\Spatialization graph"			, CheckDebug1a3,	   		EnableSoundSpatialDisp,		0 );
	AddDebuggerMenuItem( "Show network info\\Network info"					, CheckDebug2a,				EnableNetworkDisp,			0 );
	AddDebuggerMenuItem( "Show network info\\Packet history"				, CheckDebug2ax,			EnableNetworkDispx,			0 );
	AddDebuggerMenuItem( "Show texture info\\Used textures"					, CheckTextureMemoryDisp,	EnableTextureMemoryDisp,	0 );
	AddDebuggerMenuItem( "Show texture info\\Unused textures"				, CheckTextureMemoryDisp1,	EnableTextureMemoryDisp1,	0 );
	AddDebuggerMenuItem( "Show texture info\\Loaded textures"				, CheckTextureMemoryDisp2,	EnableTextureMemoryDisp2,	0 );
	AddDebuggerMenuItem( "Show texture info\\All textures"					, CheckTextureMemoryDisp3,	EnableTextureMemoryDisp3,	0 );
	AddDebuggerMenuItem( "Show texture info\\Used texture detail"			, CheckTextureMemoryDisp4,	EnableTextureMemoryDisp4,	0 );
	AddDebuggerMenuItem( "Show texture info\\Unused texture detail"			, CheckTextureMemoryDisp5,	EnableTextureMemoryDisp5,	0 );
	AddDebuggerMenuItem( "Show texture info\\Loaded texture detail"			, CheckTextureMemoryDisp6,	EnableTextureMemoryDisp6,	0 );
	AddDebuggerMenuItem( "Show texture info\\All texture detail"			, CheckTextureMemoryDisp7,	EnableTextureMemoryDisp7,	0 );
	AddDebuggerMenuItem( "Show texture info\\All texture detail (No Upload)", CheckTextureMemoryDispB,	EnableTextureMemoryDispB,	0 );
	AddDebuggerMenuItem( "Show texture info\\Enable Texture Manager Logging", CheckTextureLogging,		EnableTextureLogging,		0 );
	AddDebuggerMenuItem( "Show texture info\\Show Texture Manager Log"		, CheckTextureLogDisp,		EnableTextureLogDisp,		0 );
	AddDebuggerMenuItem( "Show spew info\\Show spew output"					, CheckDebug2,				EnableSpewDisp,				CheckArmorBuild );
	AddDebuggerMenuItem( "Show spew info\\Time stamp each spew"				, CheckTimeStamp,			EnableTimeStamp,			CheckArmorBuild );
	AddDebuggerMenuItem( "Show spew info\\Spew everything"					, CheckSpewAll,				EnableSpewAll,				CheckArmorBuild );
	AddDebuggerMenuItem( "Show spew info\\ "								, 0,						0,							0 );
	AddDebuggerMenuItem( "Show spew info\\Spew working set for one frame"	, 0,						EnableSpewWS,				CheckWindowsNT );
	AddDebuggerMenuItem( "Show spew info\\Spew memory usage for one frame"	, 0,						EnableSpewMemory,			CheckDebugBuild );
	AddDebuggerMenuItem( "Show spew info\\Spew _ftol usage for one frame"	, 0,						EnableSpewFTOL,				CheckDebugBuild );
	AddDebuggerMenuItem( "Show spew info\\Spew everything for one frame"	, 0,						EnableSpewALL,				CheckDebugBuild );
	AddDebuggerMenuItem( "Show spew info\\ "								, 0,						0,							0 );
	AddDebuggerMenuItem( "Show spew info\\Spew to debug.txt"				, 0, 0, 0, SpewMenu );
	AddDebuggerMenuItem( "Show processor info"								, CheckCpuStats,			EnableCPUStats,				0 );
	AddDebuggerMenuItem( "Show memory info"									, CheckDebug2b,				EnableMemoryDisp,			0 );
	AddDebuggerMenuItem( "Show input info"									, CheckDebug1b,				EnableControlDisp,			0 );
	AddDebuggerMenuItem( "Show file info"									, CheckDebug13,				EnableFileDisp,				0 );
	AddDebuggerMenuItem( " "												, 0,						0,							0 );
	AddDebuggerMenuItem( "Frame graphs\\Enable graph display"				, CheckDebug3,				EnableFrameGraph,			0 );
	AddDebuggerMenuItem( "Frame graphs\\Background behind graphs"			, CheckGraphBackground,		EnableGraphBackground,		CheckUsingGraphs );
	AddDebuggerMenuItem( "Frame graphs\\Only current value"					, CheckNoGraph,				EnableNoGraph,				CheckUsingGraphs );
	AddDebuggerMenuItem( "Frame graphs\\ "									, 0,						0,							0 );
	AddDebuggerMenuItem( "Frame graphs\\Display as framegraphs"				, CheckGraphChart,			EnableGraphChart,			0 );
	AddDebuggerMenuItem( "Frame graphs\\Display as 30Hz bar graph"			, CheckGraph30,				EnableGraph30,				0 );
	AddDebuggerMenuItem( "Frame graphs\\Display as 60Hz bar graph"			, CheckGraph60,				EnableGraph60,				0 );
	AddDebuggerMenuItem( "Frame graphs\\Display as 30Hz pie chart"			, CheckPie30,				EnablePie30,				0 );
	AddDebuggerMenuItem( "Frame graphs\\Display as 60Hz pie graph"			, CheckPie60,				EnablePie60,				0 );
	AddDebuggerMenuItem( "Frame graphs\\Display info about colors"			, CheckColorInfo,			EnableColorInfo,			CheckNotUsingGraphs );
	AddDebuggerMenuItem( "Options\\Disable controls in debugger"			, CheckControl,				EnableControls,				0 );
	AddDebuggerMenuItem( "Options\\Freeze gamelogic in debugger"			, CheckGameLogic,			EnableGameLogic,			0 );
	AddDebuggerMenuItem( "Options\\Freeze everything in debugger"			, CheckStop,				EnableStop,					0 );
	AddDebuggerMenuItem( "Options\\Advance one frame"						, 0,						AdvanceOneFrame,			CheckAdvanceFrame );
	AddDebuggerMenuItem( "Options\\ "										, 0,						0,							0 );

	AddDebuggerMenuItem( "Options\\Show moving average as current"			, CheckAverage,				EnableAverage,				0 );
	AddDebuggerMenuItem( "Options\\Show percentages as milliseconds"		, CheckPercent,				EnablePercent,				0 );
	AddDebuggerMenuItem( "Options\\Reset minimum and maximum values"		, 0,						EnableReset,				0 );
	AddDebuggerMenuItem( "Options\\Include debugger in statistics"			, CheckGOSStats,			EnableGOSStats,				0 );
	AddDebuggerMenuItem( "Options\\ "										, 0,						0,							0 );
	AddDebuggerMenuItem( "Options\\Show process memory on exceptions"		, CheckMem,					EnableProcessMemory,		CheckArmorBuild );
	AddDebuggerMenuItem( "Options\\Show vertex data"						, CheckDebug6,				EnableVertexData,			CheckArmorBuild );
	AddDebuggerMenuItem( "Options\\Check texture lock\\unlock overruns"		, CheckOverrun,				EnableOverrun,				0 );
	AddDebuggerMenuItem( "Options\\ "										, 0,						0,							0 );
	AddDebuggerMenuItem( "Options\\Disable joystick polling"				, CheckPolling,				EnablePolling,				0 );
	AddDebuggerMenuItem( "Options\\Disable sound system"					, CheckSoundSystem,			EnableSoundSystem,			0 );
	AddDebuggerMenuItem( "Options\\Disable video playback"					, CheckVideoPlayback,		EnableVideoPlayback,		0 );
	AddDebuggerMenuItem( "Options\\ "										, 0,						0,							0 );
	AddDebuggerMenuItem( "Options\\Disable gamelogic"						, CheckStop1,				EnableStop1,				0 );
	AddDebuggerMenuItem( "Options\\Disable update renderers"				, CheckStop2,				EnableStop2,				0 );
	AddDebuggerMenuItem( "Options\\Disable game renderers"					, CheckStop3,				EnableStop3,				0 );
	AddDebuggerMenuItem( "Logging\\Restart game (log playback)"				, 0,						RestartGameOS,				CheckPlatformGame );
	AddDebuggerMenuItem( "Logging\\Load log file"							, 0,						LoadLogFile,				CheckPlatformGame );
	AddDebuggerMenuItem( "Logging\\ "										, 0,						0,							0 );
	AddDebuggerMenuItem( "Logging\\Freeze statistics in pause"				, CheckFreezeInPause,		EnableFreezeInPause,		CheckPlatformGame );
	AddDebuggerMenuItem( "Logging\\Enable log file controls"				, CheckLFControl,			EnableLFControl,			CheckPlatformGame );
	AddDebuggerMenuItem( "Localization\\Show localized strings"				, CheckLoc,					EnableLoc,					0 );
	AddDebuggerMenuItem( "Localization\\Flash localized strings"			, CheckLoc1,				EnableLoc1,					0 );

	pCurrentMenu=&pRasterizerMenu;
	AddDebuggerMenuItem( "Analyze scene modes\\Show triangle information"	, 0,						EnterExamineScene,			0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show triangles in an area"	, 0,						EnterExamineArea,			0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show mipmap levels"			, 0,						EnableShowMipmap,			0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show mipmap levels2"			, 0,						EnableShowMipmap2,			0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show reference rasterizer"	, 0,						EnableReferenceRasterizer,	0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show depth complexity"		, 0,						EnableDepthComplexity,		0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show scene drawing"			, 0,						EnterExamineDrawing,		0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show color information"		, 0,						EnterExamineColor,			0 );
	AddDebuggerMenuItem( "Analyze scene modes\\ "							, 0,						0,							0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show wireframe"				, CheckDebug5,				EnableWireframe,			CheckHasWireframe );
	AddDebuggerMenuItem( "Analyze scene modes\\Show wireframe and texture"	, CheckDebug5a,				EnableWireframe1,			CheckHasWireframe );
	AddDebuggerMenuItem( "Analyze scene modes\\Show triangles as colors"	, CheckDebug5zz,			EnableTriangleColors,		0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show triangle sizes"			, CheckTriangleArea,		EnableTriangleArea,			0 );
	AddDebuggerMenuItem( "Analyze scene modes\\Show only small triangles"	, CheckTriangleArea1,		EnableTriangleArea1,		0 );
	AddDebuggerMenuItem( "Force renderstates\\Disable ALL renderstates"		, CheckDisableRS,			EnableRS,					0 );
	AddDebuggerMenuItem( "Force renderstates\\Disable line and points"		, CheckDisableLinePoint,	EnableLinePoint,			0 );
	AddDebuggerMenuItem( "Force renderstates\\Disable other primitives"		, CheckDisablePrimitives,	EnablePrimitives,			0 );
	AddDebuggerMenuItem( "Force renderstates\\Disable Font3D Text"			, CheckDisableText,			EnableText,					0 );
	AddDebuggerMenuItem( "Force renderstates\\  "							, 0,						0,							0 );
	AddDebuggerMenuItem( "Force renderstates\\Checker texture"				, CheckDebug5d,				EnableChessTexture,			0 );
	AddDebuggerMenuItem( "Force renderstates\\No textures"					, CheckDebug5b,				EnableNoTextures,			0 );
	AddDebuggerMenuItem( "Force renderstates\\No fog"						, CheckDebug5cFog,			EnableNoFog,				CheckHasFog );
	AddDebuggerMenuItem( "Force renderstates\\No multitexture"				, CheckNoMulti,				EnableNoMulti,				CheckHasMulti );
	AddDebuggerMenuItem( "Force renderstates\\No filtering"					, CheckDebug5c,				EnableNoFiltering,			0 );
	AddDebuggerMenuItem( "Force renderstates\\Bilinear filtering"			, CheckBiLinear,			EnableBiLinear,				CheckHasBiLinear );
	AddDebuggerMenuItem( "Force renderstates\\Trilinear filtering"			, CheckTriLinear,			EnableTriLinear,			CheckHasTriLinear );
	AddDebuggerMenuItem( "Force renderstates\\Perspective"					, CheckPerspective,			EnablePerspective,			0 );
	AddDebuggerMenuItem( "Force renderstates\\No perspective"				, CheckNoPerspective,		EnableNoPerspective,		0 );
	AddDebuggerMenuItem( "Force renderstates\\Specular"						, CheckSpecular,			EnableSpecular,				CheckHasSpecular );
	AddDebuggerMenuItem( "Force renderstates\\No specular"					, CheckNoSpecular,			EnableNoSpecular,			CheckHasSpecular );
	AddDebuggerMenuItem( "Force renderstates\\Dithering"					, CheckDebug5c2,			EnableDithering,			CheckHasDither );
	AddDebuggerMenuItem( "Force renderstates\\No dithering"					, CheckDebug5c1,			EnableNoDithering,			0 );
	AddDebuggerMenuItem( "Force renderstates\\Alpha testing"				, CheckDebug81,				EnableAlphaTesting,			CheckHasAlphaTest );
	AddDebuggerMenuItem( "Force renderstates\\No alpha testing"				, CheckDebug8,				EnableNoAlphaTesting,		0 );
	AddDebuggerMenuItem( "Force renderstates\\No alpha blending"			, CheckDebug82,				EnableAlphaBlending,		0 );
	AddDebuggerMenuItem( "Force renderstates\\Flat shading"					, CheckFlat,				EnableFlat,					0 );
	AddDebuggerMenuItem( "Force renderstates\\Gouraud shading"				, CheckGouraud,				EnableGouraud,				0 );
	AddDebuggerMenuItem( "Force renderstates\\Mono shading"					, CheckMono,				EnableMono,					0 );
	AddDebuggerMenuItem( "Force renderstates\\Force decal"					, CheckDecal,				EnableDecal,				0 );
	AddDebuggerMenuItem( "Force renderstates\\Force modulate"				, CheckModulate,			EnableModulate,				0 );
	AddDebuggerMenuItem( "Force renderstates\\Force modulatealpha"			, CheckModulateAlpha,		EnableModulateAlpha,		0 );
	AddDebuggerMenuItem( "Force renderstates\\No MipMapBias"				, CheckMipBias0,			EnableMipBias0,				0 );
	AddDebuggerMenuItem( "Force renderstates\\MipMapBias 1"					, CheckMipBias1,			EnableMipBias1,				CheckHasMipMap );
	AddDebuggerMenuItem( "Force renderstates\\MipMapBias 2"					, CheckMipBias2,			EnableMipBias2,				CheckHasMipMap );
	AddDebuggerMenuItem( "Force render window\\Anti-alias"					, CheckAA,					EnableAA,					0 );
	AddDebuggerMenuItem( "Force render window\\32 bit rendering"			, Check32,					Enable32,					0 );
	AddDebuggerMenuItem( "Force render window\\32 bit textures"				, Check32T,					Enable32T,					0 );
	AddDebuggerMenuItem( "Force render window\\Triple buffering"			, CheckTB,					EnableTB,					0 );
	AddDebuggerMenuItem( "Force render window\\Maximum refresh rate"		, CheckHZ,					EnableHZ,					0 );
	AddDebuggerMenuItem( "Force render window\\Hardware rasterizer"			, CheckHW,					EnableHW,					0 );
	AddDebuggerMenuItem( "Force render window\\Blade rasterizer"			, CheckSW,					EnableSW,					0 );
	AddDebuggerMenuItem( "Force render window\\Blade renders in VRAM"		, CheckRVRAM,				EnableRVRAM,				0 );
	AddDebuggerMenuItem( "Force render window\\DirectX RGB rasterizer"		, CheckSW1,					EnableSW1,					0 );
	AddDebuggerMenuItem( "Force render window\\ "							, 0,						0,							0 );
	AddDebuggerMenuItem( "Force render window\\Force 512x384"				, Check512,					Enable512,					Support512 );
	AddDebuggerMenuItem( "Force render window\\Force 640x480"				, Check640,					Enable640,					Support640 );
	AddDebuggerMenuItem( "Force render window\\Force 800x600"				, Check800,					Enable800,					Support800 );
	AddDebuggerMenuItem( "Force render window\\Force 1024x768"				, Check1024,				Enable1024,					Support1024 );
	AddDebuggerMenuItem( "Force render window\\Force 1280x1024"				, Check1280,				Enable1280,					Support1280 );
	AddDebuggerMenuItem( "Force render window\\Force 1600x1200"				, Check1600,				Enable1600,					Support1600 );
	AddDebuggerMenuItem( "Force vertex\\Alpha to 0xff"						, CheckVertexAlpha0,		EnableVertexAlpha0,			CheckArmorBuild );
	AddDebuggerMenuItem( "Force vertex\\Alpha to 0"							, CheckVertexAlpha2,		EnableVertexAlpha2,			CheckArmorBuild );
	AddDebuggerMenuItem( "Force vertex\\Colors to 0xffffff"					, CheckVertexAlpha1,		EnableVertexAlpha1,			CheckArmorBuild );
	AddDebuggerMenuItem( "Force vertex\\Colors to 0"						, CheckVertexAlpha3,		EnableVertexAlpha3,			CheckArmorBuild );
	AddDebuggerMenuItem( "Force video memory\\Simulate 0MB AGP"				, CheckAGP0,				EnableAGP0,					SupportAGP );
	AddDebuggerMenuItem( "Force video memory\\Simulate <= 8MB AGP"			, CheckAGP8,				EnableAGP8,					SupportAGP );
	AddDebuggerMenuItem( "Force video memory\\Simulate <= 16MB AGP"			, CheckAGP16,				EnableAGP16,				SupportAGP );
	AddDebuggerMenuItem( "Force video memory\\Simulate <= 32MB AGP"			, CheckAGP32,				EnableAGP32,				SupportAGP );
	AddDebuggerMenuItem( "Force video memory\\No AGP limit simulated"		, CheckAGPAll,				EnableAGPAll,				0 );
	AddDebuggerMenuItem( "Force video memory\\Simulate 0MB VidMem"			, CheckVID0,				EnableVID0,					0 );
	AddDebuggerMenuItem( "Force video memory\\Simulate 4MB VidMem"			, CheckVID4,				EnableVID4,					SupportVID4 );
	AddDebuggerMenuItem( "Force video memory\\Simulate 8MB VidMem"			, CheckVID8,				EnableVID8,					SupportVID8 );
	AddDebuggerMenuItem( "Force video memory\\Simulate 16MB VidMem"			, CheckVID16,				EnableVID16,				SupportVID16 );
	AddDebuggerMenuItem( "Force video memory\\Simulate 32MB VidMem"			, CheckVID32,				EnableVID32,				SupportVID32 );
	AddDebuggerMenuItem( "Force video memory\\Simulate 64MB VidMem"			, CheckVID64,				EnableVID64,				SupportVID64 );
	AddDebuggerMenuItem( "Force video memory\\No VidMem limit simulated"	, CheckVIDAll,				EnableVIDAll,				0 );
	AddDebuggerMenuItem( "Transform & Lighting\\Disable hardware T&L"		, CheckTandL,				EnableTandL,				CheckHasTandL );
	AddDebuggerMenuItem( "Transform & Lighting\\Disable lighting"			, CheckLighting,			EnableLighting,				0 );
	AddDebuggerMenuItem( "Transform & Lighting\\Disable normalizing"		, CheckNormalizing,			EnableNormalizing,			0 );
	AddDebuggerMenuItem( "Transform & Lighting\\Disable vertex blending"	, CheckVertexBlending,		EnableVertexBlending,		0 );
	AddDebuggerMenuItem( "Gamma correction\\0.8"							, CheckGamma08,				EnableGamma08,				0 );
	AddDebuggerMenuItem( "Gamma correction\\Disabled - 1.0"					, CheckGamma10,				EnableGamma10,				0 );
	AddDebuggerMenuItem( "Gamma correction\\1.4"							, CheckGamma14,				EnableGamma14,				0 );
	AddDebuggerMenuItem( "Gamma correction\\1.8"							, CheckGamma18,				EnableGamma18,				0 );
	AddDebuggerMenuItem( "Gamma correction\\2.5"							, CheckGamma25,				EnableGamma25,				0 );
	AddDebuggerMenuItem( " "												, 0,						0,							0 );
	AddDebuggerMenuItem( "Enable renderer parallelism"						, CheckParallel,			EnableParallel,				0 );
	AddDebuggerMenuItem( "Enable 'blit instead of flip'"					, CheckNoFlip,				EnableNoFlip,				CheckFullScreen );
	AddDebuggerMenuItem( "Enable viewport clears"							, CheckNoClear,				EnableNoClear,				0 );
	AddDebuggerMenuItem( "Enable TexelOffset"								, CheckTexelOffset,			EnableTexelOffset,			0 );
	AddDebuggerMenuItem( " "												, 0,						0,							0 );
	AddDebuggerMenuItem( "Save screen shot"									, 0,						EnableScreenDump,			0 );
	AddDebuggerMenuItem( "Save screen shot as .bmp"							, CheckScreenBMP,			EnableScreenBMP,			0 );
 	AddDebuggerMenuItem( "GameOS PrintScreen key"							, CheckPrintScreen,			EnablePrintScreen,			0 );
//
// Add the display names to the end of the Mode menu if more than one device exists
//
	pCurrentMenu=&pRasterizerMenu;
	AddDebuggerMenuItem( "Force render window\\ ", 0,	0,0 );
//
// Add all the device names
//
	for( int t0=0; t0<gos_GetMachineInformation(gos_Info_NumberDevices); t0++ )
	{
		char Buffer[128];
		sprintf( Buffer,"Force render window\\Use %s",(char*)gos_GetMachineInformation(gos_Info_GetDeviceName,t0) );
		AddDebuggerMenuItem( Buffer,CheckDevice,SelectDevice,0 );
	}
	pCurrentMenu=&pGameMenu;

	SPEW(( GROUP_GAMEOS, "InitDebuggerMenus() - Finished" ));
	#endif
}
