⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adjust.c

📁 GM5621原代码
💻 C
📖 第 1 页 / 共 4 页
字号:
	 if ( UserPrefBrightness > UserPrefFactoryBrightnessMaxSetting )
	{
		UserPrefBrightness = UserPrefFactoryBrightnessMaxSetting;
	}

	if ( UserPrefFactorysRGBBrightnessValue < UserPrefFactoryBrightnessMinSetting )
	{
		UserPrefFactorysRGBBrightnessValue = UserPrefFactoryBrightnessMinSetting;
	} 
    if ( UserPrefFactorysRGBBrightnessValue > UserPrefFactoryBrightnessMaxSetting )
	{
		UserPrefFactorysRGBBrightnessValue = UserPrefFactoryBrightnessMaxSetting;
	}
}
#endif

//******************************************************************
// DESCRIPTION 	:	Following functions are for AccAcmSetting in WB
// PARAMETERS	:
// RETURN	:	none
//******************************************************************
#ifdef Action_EnableVideoWindow_WB_Used
void EnableVideoWindow()
{
	UserPrefW_OsdAccAcmFlag |= WindowEnableBit;
	//to letter box as default
	SetColorWindowLetterBox();
}
#endif

#ifdef Action_DisableVideoWindow_WB_Used
void DisableVideoWindow()
{
	UserPrefW_OsdAccAcmFlag = (UserPrefW_OsdAccAcmFlag & (~WindowEnableBit));
	AdjustACCACM();
}
#endif

#ifdef Action_SetAccBin1_WB_Used
void SetAccBin1()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~AccBinRangeMask) | AccBin1);
	AdjustACCACM();
}
#endif

#ifdef Action_SetAccBin2_WB_Used
void SetAccBin2()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~AccBinRangeMask) | AccBin2);
	AdjustACCACM();
}
#endif

#ifdef Action_SetYCLinkOff_WB_Used
void SetYCLinkOff()
{
	UserPrefW_OsdAccAcmFlag = (UserPrefW_OsdAccAcmFlag & ~YCLinkEnableBit);
	AdjustACCACM();
}
#endif

#ifdef Action_SetYCLinkOn_WB_Used
void SetYCLinkOn()
{
	UserPrefW_OsdAccAcmFlag = (UserPrefW_OsdAccAcmFlag | YCLinkEnableBit);
	AdjustACCACM();
}
#endif

#ifdef Action_SetACMModeFleshTone_WB_Used
void SetACMModeFleshTone()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~ACMModeMask) | ACMModeFleshTone);
	AdjustACCACM();
}
#endif

#ifdef Action_SetACMModeColorEnhance_WB_Used
void SetACMModeColorEnhance()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~ACMModeMask) | ACMModeColorEnhance);
	AdjustACCACM();
}
#endif

#ifdef Action_SetACMModeGreenEnhance_WB_Used
void SetACMModeGreenEnhance()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~ACMModeMask) | ACMModeGreenEnhance);
	AdjustACCACM();
}
#endif

#ifdef Action_SetColorWindowLetterBox_WB_Used
void SetColorWindowLetterBox()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~WindowMask) | WindowLetterBox);
	AdjustACCACM();
}
#endif

#ifdef Action_SetColorWindowLetterBox2_WB_Used
void SetColorWindowLetterBox2()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~WindowMask) | WindowLetterBox2);
	AdjustACCACM();
}
#endif

#ifdef Action_SetColorWindowLeftLetterBox_WB_Used
void SetColorWindowLeftLetterBox()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~WindowMask) | WindowLeftLetterBox);
	AdjustACCACM();
}
#endif

#ifdef Action_SetColorWindowFullScreen_WB_Used
void SetColorWindowFullScreen()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~WindowMask) | WindowFullScreen);
	AdjustACCACM();
}
#endif

#ifdef Action_SetColorWindowDDCCI_WB_Used
void SetColorWindowDDCCI()
{
	UserPrefW_OsdAccAcmFlag = ((UserPrefW_OsdAccAcmFlag & ~WindowMask) | WindowDDCCISetting);
	AdjustACCACM();
}
#endif

BOOL IsAccCurrentelyEnabled(void)
{
	return InputPortArray[gmvb_CurrentPortMain].ACC_En;
}

BOOL IsAcmCurrentelyEnabled(void)
{
	return InputPortArray[gmvb_CurrentPortMain].ACM_En;
}


//******************************************************************
// DESCRIPTION 	:	Following functions are for AccAcmSetting
// PARAMETERS	:
// RETURN	:	none
//******************************************************************
#ifdef Action_ACC_Enable_WB_Used
void ACC_Enable(void)
{
	UserPrefW_OsdAccAcmFlag |= AccEnableBit;     //to update osd flag
	AdjustACCACM();
}
#endif

#ifdef Action_ACC_Disable_WB_Used
void ACC_Disable(void)
{
	UserPrefW_OsdAccAcmFlag = (UserPrefW_OsdAccAcmFlag & (~AccEnableBit));
	AdjustACCACM();
}
#endif

#ifdef Action_ACM_Enable_WB_Used
void ACM_Enable(void)
{
	UserPrefW_OsdAccAcmFlag |= AcmEnableBit;
	AdjustACCACM();
}
#endif

#ifdef Action_ACM_Disable_WB_Used
void ACM_Disable(void)
{
	UserPrefW_OsdAccAcmFlag = (UserPrefW_OsdAccAcmFlag & (~AcmEnableBit));
	AdjustACCACM();
}
#endif


//For port switching
void ChangeToVGAPort()
{
	ChangeToPort(0);
}
void ChangeToDVIPort()
{
	ChangeToPort(1);
}
void ChangeToSVideoPort()
{
	ChangeToPort(2);
}
void ChangeToCompositeVideoPort()
{
	ChangeToPort(3);
}
void ChangeToComponentVideoPort()
{
	ChangeToPort(4);
}
BOOL IsVGAInput()
{
	return (InputPortArray[gmvb_CurrentPortMain].Port == IP_RGB);
}
BOOL IsDVIInput()
{
	return (InputPortArray[gmvb_CurrentPortMain].Port == IP_DVI);
}
BOOL IsSVideoInput()
{
	return ((InputPortArray[gmvb_CurrentPortMain].Port == IP_VIDEO) && (InputPortArray[gmvb_CurrentPortMain].VideoInput==VDD_INTYP_SVIDEO));
}
BOOL IsCompositeInput()
{
	return ((InputPortArray[gmvb_CurrentPortMain].Port == IP_VIDEO) && (InputPortArray[gmvb_CurrentPortMain].VideoInput==VDD_INTYP_COMPOSITE));
}
BOOL IsComponentInput()
{
	return ((InputPortArray[gmvb_CurrentPortMain].Port == IP_VIDEO) && (InputPortArray[gmvb_CurrentPortMain].VideoInput==VDD_INTYP_COMPONENT));
}

BOOL IsYUVFormatInVGAPort()
{
	return (InputPortArray[gmvb_CurrentPortMain].Port == IP_VIDEO_ON_RGB);
}
BOOL IsYUVFormatInDVIPort()
{
	return (InputPortArray[gmvb_CurrentPortMain].Port == IP_VIDEO_ON_DVI);
}

BOOL IsVGAInputLastActive()
{
	return (InputPortArray[B_SyncStatePort].PowerDev == gmd_PCD_RGB);
}
BOOL IsDVIInputLastActive()
{
	return (InputPortArray[B_SyncStatePort].PowerDev == gmd_PCD_DVI);
}
BOOL IsSVideoInputLastActive()
{
	return ((InputPortArray[B_SyncStatePort].Port == IP_VIDEO) && (InputPortArray[B_SyncStatePort].VideoInput==VDD_INTYP_SVIDEO));
}
BOOL IsCompositeInputLastActive()
{
	return ((InputPortArray[B_SyncStatePort].Port == IP_VIDEO) && (InputPortArray[B_SyncStatePort].VideoInput==VDD_INTYP_COMPOSITE));
}
BOOL IsComponentInputLastActive()
{
	return ((InputPortArray[B_SyncStatePort].Port == IP_VIDEO) && (InputPortArray[B_SyncStatePort].VideoInput==VDD_INTYP_COMPONENT));
}
BOOL IsYUVFormatInVGAPortLastActive()
{
	return (InputPortArray[B_SyncStatePort].Port == IP_VIDEO_ON_RGB);
}
BOOL IsYUVFormatInDVIPortLastActive()
{
	return (InputPortArray[B_SyncStatePort].Port == IP_VIDEO_ON_DVI);
}


void SetYUVFormat()
{
	msgx("SetYUVFormat", 0);
	ChangeToPort(5);
}

void SetYUVFormatInDVIPort()
{
	msgx("SetYUVFormat", 0);
	ChangeToPort(6);
}

//to select overlapped mode
void SetOverlappedMode(void)
{
	// pdr#5836.
	if (gmvw_InputFlagsMain & gmd_OVERLAPPED_MASK)
	{
		// swap 640 and 720 mode.
		if (gmvw_InputWidthMain == 640)
			UserPrefOverlappedMode = DOS;
		else
			UserPrefOverlappedMode = Graphics;

		#if NVRAM_DIRTY_BITS_CHECK
		SetAdjustedBitFlags(OverlappedMode_offset, 1);
		#endif // NVRAM_DIRTY_BITS_CHECK

		// HideOsd() to remove OSD quickly, this fixes OSD
		// garbage that may display when mode changes while OSD is up.
		HideOsd();
		gm_ForceModeSwitching();
	}

}

//factory
#ifdef Action_AdjustFactoryADCGain_WB_Used
   void far AdjustFactoryADCGain(void)
   {
		UserPrefAdcRedGain = UserPrefFactoryGainRed ;
		UserPrefAdcGreenGain = UserPrefFactoryGainGreen ;
		UserPrefAdcBlueGain = UserPrefFactoryGainBlue ;

		gm_SetAdcGainMain(UserPrefAdcRedGain,UserPrefAdcGreenGain,UserPrefAdcBlueGain);
   }
#endif

#ifdef Action_AdjustFactoryBlendValue_WB_Used

	//this function is called everytime the factory Osd menu is displayed.
   void far AdjustFactoryBlendValueFromOsdDisplay(void)
   {
			AdjustFactoryBlendValue();
   }

   void far AdjustFactoryBlendValue(void)
   {
		BYTE i;

		msgx("Val =%d ", UserPrefFactoryBlendValue);

		for (i = 0; i < 4; i++)
		{
			gm_WriteRegByte( OSD_BLEND_TABLE0 + i,
				(UserPrefFactoryBlendValue << 4) | UserPrefFactoryBlendValue);
		}
		gm_WriteRegByte(HOST_CONTROL, DPSYNC_UPDATE);
   }
#endif

	void far AdjustFactoryBrightness(void)
	{
#ifdef Action_AdjustFactoryBrightness_WB_Used
		UserPrefBrightness = UserPrefFactorysRGBBrightnessValue ;
		AdjustBrightness();
#endif
	}

	void far AdjustFactorysRGBContrast(void)
	{
#ifdef Action_AdjustFactorysRGBContrast_WB_Used
		UserPrefContrast = UserPrefFactorysRGBContrastValue;

		// adjust color based on contrast and user color setting
		AdjustColor();
#endif
	}

	void far AdjustFactoryUserColor(void)
   {
#ifdef Action_AdjustFactoryUserColor_WB_Used
		UserPrefRedColor = UserPrefFactoryColorTempAdjRed ;
      UserPrefGreenColor= UserPrefFactoryColorTempAdjGreen ;
      UserPrefBlueColor = UserPrefFactoryColorTempAdjBlue ;

		// adjust color based on contrast and user color setting
//      #ifdef Action_AdjustColor_WB_Used
      AdjustColor();
//      #endif

#endif
   }

  
	void far SetFactoryBlendValue(void){;}

  	void far FactoryMenuGmRead(void)
   {
		#ifdef UserPrefFactoryGmRegAddress
		UserPrefFactoryGmRegValue = gm_ReadRegByte((0x8000+UserPrefFactoryGmRegAddress));
      msgx("UserPrefFactoryGmRegValue = %d ", UserPrefFactoryGmRegValue);
      #endif
   }

	void far FactoryMenuGmWrite(void)
   {
		#ifdef UserPrefFactoryGmRegAddress
		gm_WriteRegByte((0x8000+UserPrefFactoryGmRegAddress), UserPrefFactoryGmRegValue);
		msgx("UserPrefFactoryGmRegValue = %d ", UserPrefFactoryGmRegValue);
      #endif
   }

	void far ResetFactoryDependentSettings(void)
	{
		#ifdef Action_AdjustFactoryBrightness_WB_Used
//		UserPrefAdcRedGain = UserPrefFactoryGainRed;
//		UserPrefAdcGreenGain = UserPrefFactoryGainGreen;
//		UserPrefAdcBlueGain = UserPrefFactoryGainBlue;

		LoadFactoryColorTempSettings();

		UserPrefBrightness = UserPrefFactorysRGBBrightnessValue ;
		UserPrefContrast = UserPrefFactorysRGBContrastValue;
		SaveFactorySettings();
      #endif
	}

	void far LoadFactoryColorTempSettings(void)
	{
		#ifdef Action_AdjustFactoryColorTemp_WB_Used
		ColorTempType S_ColorTemp;
		//get the rgb values from nvram
		LoadColorTemp(UserPrefColor, (BYTE *) &S_ColorTemp);

		UserPrefFactoryColorTempAdjRed = S_ColorTemp.R;
		UserPrefFactoryColorTempAdjGreen = S_ColorTemp.G;
		UserPrefFactoryColorTempAdjBlue = S_ColorTemp.B;
		#endif
	}

	void far SaveFactoryColorTempSettings (void)
	{
		#ifdef Action_AdjustFactoryColorTemp_WB_Used
		ColorTempType S_ColorTemp;

		S_ColorTemp.R = UserPrefFactoryColorTempAdjRed;
		S_ColorTemp.G = UserPrefFactoryColorTempAdjGreen;
		S_ColorTemp.B = UserPrefFactoryColorTempAdjBlue;

		SaveColorTemp (UserPrefColor, (BYTE *) &S_ColorTemp);
		#endif
	}

	void far RefreshFactoryGlobals(BYTE value)
   {
	#ifdef Action_AdjustFactoryBrightness_WB_Used
		if(value == 0)
			AdjustFactoryBrightness();
		else if(value == 1)
			AdjustFactorysRGBContrast();
		else if(value == 2)
			AdjustFactoryUserColor();
	#else
			value = value;
	#endif
   }

   void far DoAutoColor(void)
	{
		#ifdef Action_AdjustFactoryColorTemp_WB_Used
		gm_AutoColorBalanceMain();
      #endif
	}


//******************************************************************
// FUNCTION       :  InitFactoryDependentSettings
// DESCRIPTION 	:	Sets UserPrefFactory settings from FactoryDefaultsInROM
//******************************************************************
void far InitFactoryDependentSettings(void)
{
	#ifdef Action_AdjustFactoryBrightness_WB_Used
	UserPrefFactoryGainRed = 	FactoryDefaultInROM.AdcRedGain;
	UserPrefFactoryGainGreen = 	FactoryDefaultInROM.AdcGreenGain;
	UserPrefFactoryGainBlue = 	FactoryDefaultInROM.AdcBlueGain;

	UserPrefFactorysRGBBrightnessValue = FactoryDefaultInROM.Brightness;
	UserPrefFactorysRGBContrastValue = FactoryDefaultInROM.Contrast;

	UserPrefFactoryBrightnessMaxSetting = 255;
	UserPrefFactoryContrastMaxSetting = 255;
	UserPrefFactoryBrightnessMinSetting = 1;
	UserPrefFactoryContrastMinSetting  = 1;
	UserPrefFactoryBlendValue = 0;
	UserPrefMonitorOnTime = 0 ;
	UserPrefBacklightOnTime = 0;
	UserPrefFactoryBurnInMode = 0;
	UserPrefPowerOnTimes = 0;


	InitColorTempSettings(gmd_FALSE);
	LoadFactoryColorTempSettings();
	#endif
}


	void far SaveFactorySettings(void)
	{
		#ifdef Action_FactoryReset_WB_Used
			SaveFactoryDependentSettings();
      #endif
   }

///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
void OnTimeKeeper(void)
{
#ifdef UserPrefMonitorOnTime
	 //Take timeStamp

	DWORD CurrentOnTime = gm_ReadSystemTime();
   BYTE decTimer ;

	decTimer = (BYTE)((DWORD)(CurrentOnTime - prevOnTime)/(DWORD)(3600000L)); //??Checking for 1 hrs

	if(decTimer)
	{
		prevOnTime = CurrentOnTime ;
	 	//SystemOnTime
		if (UserPrefMonitorOnTime <= 0xFFFE)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -