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

📄 but_hl.c

📁 这是DVD中伺服部分的核心代码
💻 C
📖 第 1 页 / 共 2 页
字号:
    if (which_sp == 0)
    {
        button_offset = 0;
    }
    else if (which_sp == 1)
    {
        /* 16:9 */
        if ((nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x01) ||
            (nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x03) ||
            (nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x05) ||
            (nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x07))
        {
            button_offset = 0;
        }
        else if ((nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x01) ||
                 (nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x03) ||
                 (nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x05) ||
                 (nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x07))
        {
            if (nvpck[CURRENT].hl_gi.btngr_ns == 2)
            {
                button_offset = 18;
            }
            else
            {
                button_offset = 12;
            }
        }
        else if ((nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x01) ||
                 (nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x03) ||
                 (nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x05) ||
                 (nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x07))
        {
            button_offset = 24;
        }
    }
    else if (which_sp == 2)
    {
        /* letterbox */
        if ((nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x02) ||
            (nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x03) ||
            (nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x06) ||
            (nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x07))
        {
            button_offset = 0;
        }
        else if ((nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x02) ||
                 (nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x03) ||
                 (nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x06) ||
                 (nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x07))
        {
            if (nvpck[CURRENT].hl_gi.btngr_ns == 2)
            {
                button_offset = 18;
            }
            else
            {
                button_offset = 12;
            }
        }
        else if ((nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x02) ||
                 (nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x03) ||
                 (nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x06) ||
                 (nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x07))
        {
            button_offset = 24;
        }
    }
    else if (which_sp == 3)
    {
        /* pan & scan */
        if ((nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x04) ||
            (nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x05) ||
            (nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x06) ||
            (nvpck[CURRENT].hl_gi.btngr1_dsp_ty == 0x07))
        {
            button_offset = 0;
        }
        else if ((nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x04) ||
                 (nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x05) ||
                 (nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x06) ||
                 (nvpck[CURRENT].hl_gi.btngr2_dsp_ty == 0x07))
        {
            if (nvpck[CURRENT].hl_gi.btngr_ns == 2)
            {
                button_offset = 18;
            }
            else
            {
                button_offset = 12;
            }
        }
        else if ((nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x04) ||
                 (nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x05) ||
                 (nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x06) ||
                 (nvpck[CURRENT].hl_gi.btngr3_dsp_ty == 0x07))
        {
            button_offset = 24;
        }
    }

    /*
     * if fosl_btnn is 0, which means that no forcely selected botton, set it to 1
     */

    if ((nvpck[CURRENT].hl_gi.fosl_btnn > 0) && (nvpck[CURRENT].hl_gi.fosl_btnn < 37))
    {
        button_num = button_offset + nvpck[CURRENT].hl_gi.fosl_btnn - 1;
        set_hl_btnn_sprm(nvpck[CURRENT].hl_gi.fosl_btnn);
    }
    else if (nvpck[CURRENT].hl_gi.fosl_btnn == 0)
    {
        if ((UBYTE) (get_sprm(SPRM_HL_BTNN) >> 10) > (UBYTE) nvpck[CURRENT].hl_gi.btn_ns)
        {
            set_hl_btnn_sprm(nvpck[CURRENT].hl_gi.btn_ns);
        }

        button_num = button_offset + (UBYTE) (get_sprm(SPRM_HL_BTNN) >> 10) - 1;
    }

    /* Calculate the button color number based on btn_posi information */
    but_coln = (((nvpck[CURRENT].btn_posi[button_num][0]) >> 6) & 0x03) - 1;
    if ( (but_coln > 2) || (but_coln < 0) )
    {
        /* Invalid button color number. Remap. */
        but_coln = 0;
    }

    /* fill in the selection color information */
    Button.color_info  = MAKE_DWORD(nvpck[CURRENT].btn_colit[but_coln].sl_coli);

    /* fill in the button position information */
    Button.start_x = (((nvpck[CURRENT].btn_posi[button_num][0] & 0x3F) << 4)  |
        ((nvpck[CURRENT].btn_posi[button_num][1] & 0xF0) >> 4));
    Button.end_x   = ( ((nvpck[CURRENT].btn_posi[button_num][1] & 0x03) << 8) |
        (nvpck[CURRENT].btn_posi[button_num][2] & 0xFF) );
    Button.start_y = ( ((nvpck[CURRENT].btn_posi[button_num][3] & 0x3F) << 4) |
        ((nvpck[CURRENT].btn_posi[button_num][4] & 0xF0) >> 4) );
    Button.end_y   = ( ((nvpck[CURRENT].btn_posi[button_num][4] & 0x03) << 8) |
        (nvpck[CURRENT].btn_posi[button_num][5] & 0xFF) );

    /* any invalid values, make them all FFFF's to work with HD-DVD generically */
    if (Button.start_x == 0x3ff)
    {
        Button.start_x = 0xFFFF;
    }
    if (Button.end_x == 0x3ff)
    {
        Button.end_x = 0xFFFF;
    }
    if (Button.start_y == 0x3ff)
    {
        Button.start_y = 0xFFFF;
    }
    if (Button.end_y == 0x3ff)
    {
        Button.end_y = 0xFFFF;
    }

    /* enable the button */
    Button.button_cmd = BTN_ENABLE;

    /* pass info to the PE */
    PEiStreamCtrlSendDVDButtonCmd(tPE, &Button);
}

void forcedly_activate_button(void)
{
    PE_ISTREAMCTRL_DVD_BUTTON Button;
    SHORT  but_coln;
    USHORT i;

    DBGPRINT(DBG_ON(DBG_TRACE), ("forcedly_activate_button: %s, %d\n", __FILE__, __LINE__));

    if ( (nvpck[CURRENT].hl_gi.foac_btnn) && (nvpck[CURRENT].hl_gi.foac_btnn < 63) )
    {
        button_num = button_offset + nvpck[CURRENT].hl_gi.foac_btnn - 1;
    }

    /* get hli_e_ptm */
    hli_end_ptm = nvpck[CURRENT].hl_gi.hli_e_ptm;

    but_coln = (((nvpck[CURRENT].btn_posi[button_num][0]) >> 6) & 0x03) - 1;
    if ( (but_coln > 2) || (but_coln < 0) )
    {
        /* Invalid button color number. Remap. */
        but_coln = 0;
    }

    /* fill in the selection color information */
    Button.color_info  = MAKE_DWORD(nvpck[CURRENT].btn_colit[but_coln].ac_coli);

    /* fill in the button position information */
    Button.start_x = (((nvpck[CURRENT].btn_posi[button_num][0] & 0x3F) << 4)  |
        ((nvpck[CURRENT].btn_posi[button_num][1] & 0xF0) >> 4));
    Button.end_x   = ( ((nvpck[CURRENT].btn_posi[button_num][1] & 0x03) << 8) |
        (nvpck[CURRENT].btn_posi[button_num][2] & 0xFF) );
    Button.start_y = ( ((nvpck[CURRENT].btn_posi[button_num][3] & 0x3F) << 4) |
        ((nvpck[CURRENT].btn_posi[button_num][4] & 0xF0) >> 4) );
    Button.end_y   = ( ((nvpck[CURRENT].btn_posi[button_num][4] & 0x03) << 8) |
        (nvpck[CURRENT].btn_posi[button_num][5] & 0xFF) );

    /* any invalid values, make them all FFFF's to work with HD-DVD generically */
    if (Button.start_x == 0x3ff)
    {
        Button.start_x = 0xFFFF;
    }
    if (Button.end_x == 0x3ff)
    {
        Button.end_x = 0xFFFF;
    }
    if (Button.start_y == 0x3ff)
    {
        Button.start_y = 0xFFFF;
    }
    if (Button.end_y == 0x3ff)
    {
        Button.end_y = 0xFFFF;
    }

    /*
     * Order of button activation needs to be...
     * 1. Highlight button then disable button
     * 2. Do abort_drive_reset_channel().
     * 3. Execute button command
     */

    /* enable the button */
    Button.button_cmd = BTN_ENABLE;
    PEiStreamCtrlSendDVDButtonCmd(tPE, &Button);

    /* Update the hl_btnn button number in system param */
    set_hl_btnn_sprm( (UBYTE)(button_num + 1 - button_offset) );

    /* to make highlight visable */
    OS_TaskDelay(OS_WAIT_1S/4);

    /* disable the button */
    Button.button_cmd = BTN_DISABLE;
    PEiStreamCtrlSendDVDButtonCmd(tPE, &Button);

    if ( TRUE == IsBranchCommand(nvpck[CURRENT].btn_cmd[button_num]))
    {
        abort_drive_reset_channel();
    }

    for (i=0; i<SIZEOF_CMD; i++)
    {
        button_cmd_buff[0][i] = nvpck[CURRENT].btn_cmd[button_num][i];
    }

    if (!(button_cell_cmd(BUTTON_CMD)))
    {
        if (pgc_domain == TT_PGC)
        {
            rsm_info.valid = 0;
        }
    }
}

⌨️ 快捷键说明

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