📄 dvd_prm.c
字号:
{
USHORT i;
for (i = 0; i < NUM_GPRM; i++)
{
gprm[i].mode = GPRM_REG_MODE;
gprm[i].value = 0;
}
}
/**
* Name: sprm_init
*
* Description: initialize system parameter values
*
* Arguments: none
*
* Returns: nothing
*
* Pseudocode: All SPRMs shall be initialized to default values at
* initial access
*
* T.B.D.
* sprm(5), SPRM_VTS_TTN_TT_DOM, is derived from SPRM(4)
* sprm (12), SPRM_CTY_CD, should be hard-coded country code per ISO3166
* sprm(13), SPRM_PTL_LVL, should be derived from NVM setting
* sprm(14), SPRM_P_CFG_VID, should be derived from NVM setting
*/
const USHORT SPRM_INIT_TAB[] =
{
/* index */ /* value */
SPRM_ASTN_TT_DOM, 0x000F, /* no AST or ASTN is not selected */
SPRM_SPSTN_TT_DOM, 0x003E, /* no STPST or SPSTN is not selected */
SPRM_AGLN_TT_DOM, 0x0001, /* angle number 1 */
SPRM_TTN_TT_DOM, 0x0001, /* title number 1 */
SPRM_VTS_TTN_TT_DOM, 0x0000, /* VTS_TTN number 0 */
SPRM_PTTN_ONE_SEQ_PGC, 0x0001, /* PTTN #1 for one sequential PGC title */
SPRM_HL_BTNN, 0x0400, /* hilite button #1 for selection state */
SPRM_NV_TMR, 0x0000, /* navigation timer */
SPRM_P_AMXMD, 0x0000, /* player does not mix ACH2,3,4 to ACH0 */
SPRM_CTY_CD, 0xFFFF, /* country code not specified */
SPRM_PTL_LVL, 0x000F, /* parental level not specified */
SPRM_P_CFG_VID, 0x0000, /* sets up for 4:3 display aspect ratio */
SPRM_P_CFG_AUD, 0x5000, /* AC-3 & MPEG audio capability */
SPRM_INI_LCD_AST, 0xFFFF, /* init lang code for AST not specified */
SPRM_INI_LCD_EXT_AST, 0x0000, /* init lang code ext for AST not spec'd */
SPRM_INI_LCD_SPST, 0xFFFF, /* init lang code for SP not specified */
SPRM_INI_LCD_EXT_SPST, 0x0000, /* INI_LCD ext. for SP not specified */
};
void sprm_init(void)
{
USHORT i, size, value;
UBYTE sprmn;
const USHORT *ptr;
ptr = SPRM_INIT_TAB;
size = sizeof(SPRM_INIT_TAB) / 2;
for (i = 0; i < size; i += 2)
{
sprmn = (UBYTE)(*ptr++);
value = *ptr++;
set_sprm(sprmn, value);
}
sprm_init_from_system_params();
/* update SPRM(5) vts_ttn) */
set_sprm(SPRM_VTS_TTN_TT_DOM, tt_srp[sprm[SPRM_TTN_TT_DOM]-1].vts_ttn);
}
void sprm_init_from_system_params()
{
USHORT temp;
USHORT new_param_value = 0;
/* Menu description language code */
if (16 == dvd_system_params.dvd_menu_language)
{
temp = dvd_system_params.dvd_menu_lang_code;
}
else
{
temp = (((USHORT) lang_string[dvd_system_params.dvd_menu_language][0] << 8) | (USHORT) lang_string[dvd_system_params.dvd_menu_language][1]);
}
set_sprm(SPRM_M_LCD, temp);
if (dvd_system_params.audio)
{
/* Initial language code for AST */
if (16 == dvd_system_params.audio)
{
temp = dvd_system_params.audio_lang_code;
}
else
{
temp = (((USHORT) lang_string[dvd_system_params.audio][0] << 8) | (USHORT) lang_string[dvd_system_params.audio][1]);
}
}
else
{
/* Original audio */
temp = 0x00;
}
set_sprm(SPRM_INI_LCD_AST, temp);
if (dvd_system_params.subtitle)
{
/* Initial language code for SPST */
if (16 == dvd_system_params.subtitle)
{
temp = dvd_system_params.subtitle_lang_code;
}
else
{
temp = (((USHORT) lang_string[dvd_system_params.subtitle][0] << 8) | (USHORT) lang_string[dvd_system_params.subtitle][1]);
}
}
else
{
/* AUDIO FOLLOW - use audio language code for SPST */
if (16 == dvd_system_params.audio)
{
temp = dvd_system_params.audio_lang_code;
}
else
{
temp = (((USHORT) lang_string[dvd_system_params.audio][0] << 8) | (USHORT) lang_string[dvd_system_params.audio][1]);
}
}
set_sprm(SPRM_INI_LCD_SPST, temp);
/* Country code for Parenal Management */
temp = (((USHORT) country_string[dvd_system_params.country][0] << 8) | (USHORT) country_string[dvd_system_params.country][1]);
set_sprm(SPRM_CTY_CD, temp);
/* Don't update parental level if parental level is temporarily turned off */
if (!fParental_Play)
{
/* Parental Level */
temp = (USHORT) dvd_system_params.parental;
set_sprm(SPRM_PTL_LVL, temp);
}
/* video display mode from user setup */
switch (dvd_system_params.video_mode2)
{
case ASPECT_RATIO_4X3_LETTERBOX:
DBGPRINT(DBG_ON(DBG_TRACE), ("sprm_init_from_system_params: ASPECT_RATIO_4X3_LETTERBOX\n"));
new_param_value = 0;
new_param_value |= 0x0200;
break;
case ASPECT_RATIO_4X3_PANSCAN:
DBGPRINT(DBG_ON(DBG_TRACE), ("sprm_init_from_system_params: ASPECT_RATIO_4X3_PANSCAN\n"));
new_param_value = 0;
new_param_value |= 0x0100;
break;
case ASPECT_RATIO_16X9:
case ASPECT_RATIO_16X9_WINDOWBOX:
DBGPRINT(DBG_ON(DBG_TRACE), ("sprm_init_from_system_params: ASPECT_RATIO_16X9\n"));
new_param_value = 0;
new_param_value |= 0x0C00;
break;
default:
break;
}
set_sprm(SPRM_P_CFG_VID, new_param_value);
}
/*
*
*/
USHORT check_region_code()
{
UBYTE region_code_mask;
UBYTE player_region;
/* get the player region */
player_region = (UBYTE)(get_sprm(SPRM_REGION_COD));
DBGPRINT(DBG_ON(DBG_TRACE), ("check_region_code: player_region = 0x%x\n", player_region));
/* 0x80 means this a worldwide player */
if (player_region & 0x80)
{
region_code_mask = 0xff;
/* set the dvd region to match the region of the disc or not all titles
* will be able to play. */
set_sprm(SPRM_REGION_COD, (USHORT)(~vmgi_mat.vmg_cat[1]));
}
else
{
region_code_mask = ~player_region;
}
/* check the player region */
if (( (region_code_mask & vmgi_mat.vmg_cat[1]) == vmgi_mat.vmg_cat[1] ))
{
/*
* player region passed so now check the loader region
*/
/* get the region mask from the loader */
LoaderGetRPC(tLoader, ®ion_code_mask);
/* if the mask is 0xff then the drive region has not been set
* when this happens we will not be able to play encrypted disks */
if (region_code_mask == 0xff)
{
return (0);
}
if (region_code_mask == 0)
{
/* This is a region free drive so we're good to go */
return (1);
}
else if (player_region & 0x80)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("Loader Region and Disk Region do not match!! (but player is region free so try to play anyway\n"));
return (1);
}
else
{
/* Not a region free drive, check for a match */
UBYTE drive_region = ~(region_code_mask);
UBYTE title_region = ~(vmgi_mat.vmg_cat[1]);
DBGPRINT(DBG_ON(DBG_TRACE), ("check_region_code: drive_region = 0x%x\n", drive_region));
DBGPRINT(DBG_ON(DBG_TRACE), ("check_region_code: title_region = 0x%x\n", title_region));
return ( (drive_region & title_region) != 0 );
}
}
/* The region check failed, return 0 to indicate that the title cannot be played
* DO NOT CHANGE THIS... IT WILL BREAK THE REGION CODE FUNCTIONALITY */
return (0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -