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

📄 but_hl.c

📁 这是DVD中伺服部分的核心代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************
******************************************************************************
**                                                                          **
**  Copyright (c) 2002 Videon Central, Inc.                                 **
**  All rights reserved.                                                    **
**                                                                          **
**  The computer program contained herein contains proprietary information  **
**  which is the property of Videon Central, Inc.  The program may be used  **
**  and/or copied only with the written permission of Videon Central, Inc.  **
**  or in accordance with the terms and conditions stipulated in the        **
**  agreement/contract under which the programs have been supplied.         **
**                                                                          **
******************************************************************************
*****************************************************************************/

/**
 * @file
 * but_hl.c
 *
 * Functions for selecting and activating buttons.
 *
 * $Id: but_hl.c,v 1.47 2007/01/04 22:32:42 rbehe Exp $
 */

#include "vdvd_types.h"
#include "osapi.h"
#include "pe_app.h"
#include "nav_task.h"
#include "dvd_pgci.h"   /* includes dvd_cmd.h */
#include "dvdnvpck.h"   /* Navi-pack structure definitions */
#include "pgc_play.h"
#include "dvd_prm.h"
#include "timer.h"
#include "but_hl.h"
#include "dbgprint.h"
#include "usrapi.h"
#include "utility.h"
#ifdef DMALLOC
#include "dmalloc.h"
#endif
#include "qa.h" /* for QA automation */

 
#define DBG_BUT_HL DBG_ERROR
#define DBG_ON(x) (DBG_BUT_HL >= x)

extern PE_HANDLE tPE;
extern USHORT pgc_mode;
extern UBYTE video_mode[2];
extern UBYTE button_cmd_buff[MAX_CEL_CMD_NS][SIZEOF_CMD];
extern USHORT button_cmd_n;
extern UBYTE which_sp;
extern UBYTE zoom_on;
extern USHORT num_of_times, vobu_button_hl;
extern USHORT cell_play_counter;
extern rsm_info_struct rsm_info;
extern UBYTE reset_scr_flag;

UBYTE button_num, button_offset;
ULONG hli_end_ptm;


BOOLEAN select_or_active_button(void)
{
    PE_ISTREAMCTRL_DVD_BUTTON Button;
    USHORT i;
    SHORT but_coln;

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

    QAPrintOutputBtn(button_num+1); /* for qa automation */

    /* 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;
    }

    /* check the Auto action mode
     * if the bit is set the button is transferred to the action state
     * without displaying the selection color */
    if (nvpck[CURRENT].btn_posi[button_num][3] & 0x40)
    {
        /* fill in the activate color information */
        Button.color_info  = MAKE_DWORD(nvpck[CURRENT].btn_colit[but_coln].ac_coli);
    }
    else
    {
        /* 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;
    PEiStreamCtrlSendDVDButtonCmd(tPE, &Button);

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

    /* check the Auto action mode
     * if the bit is set execute the navigation commands */
    if (nvpck[CURRENT].btn_posi[button_num][3] & 0x40)
    {
        /* selection state only */
        if ( TRUE == IsBranchCommand(nvpck[CURRENT].btn_cmd[button_num]))
        {
            abort_drive_reset_channel();

            normalize();
            reset_scr_flag = 0x05;      /* CELL_V1 */
            num_of_times = vobu_button_hl = 0;
            cell_play_counter = 0;

            /* Prevent next play OR select to activate button */
            /* eventhough NEW nv_pck hac not been arrived    */
            nvpck[CURRENT].hl_gi.btn_ns = 0;
            during_search = 1;
        }

        stop_nv_tmr();

        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;
            }
        }

        return (TRUE);
    }

    return (FALSE);
}

void change_button_num(UBYTE button_index)
{
    button_num = button_index - nvpck[CURRENT].hl_gi.btn_ofn + button_offset - 1;
}

void lower_button(void)
{
    button_num = nvpck[CURRENT].ajbtn_posi[button_num].lower_btn + button_offset - 1;
    select_or_active_button();
}

void upper_button(void)
{
    button_num = nvpck[CURRENT].ajbtn_posi[button_num].upper_btn + button_offset - 1;
    select_or_active_button();
}

void left_button(void)
{
    button_num = nvpck[CURRENT].ajbtn_posi[button_num].left_btn + button_offset - 1;
    select_or_active_button();
}

void right_button(void)
{
    button_num = nvpck[CURRENT].ajbtn_posi[button_num].right_btn + button_offset - 1;
    select_or_active_button();
}

void activate_selected_button(void)
{
    PE_ISTREAMCTRL_DVD_BUTTON Button;
    UBYTE i;
    SHORT but_coln;

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

    /* 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);

    /* Invalidate coordinate info...
     * The spu should use the previous info */
    Button.start_x = 0xFFFF;
    Button.end_x   = 0xFFFF;
    Button.start_y = 0xFFFF;
    Button.end_y   = 0xFFFF;

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

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

void enable_spu(void)
{
    PE_ISTREAMCTRL_DVD_BUTTON Button;
    SHORT but_coln;

    if ( (nvpck[CURRENT].hl_gi.btn_ns & 0x3f) && ((pgc_domain == VMGM_PGC) || (pgc_domain == VTSM_PGC)) )
    {
        if (zoom_on != 0)
        {
            ULONG out_msg[4];
            zoom_on = FALSE;
            rsm_from_zoom();
            out_msg[0] = VDVD_STATUS_ZOOM_OFF;
            if (UsrEventHandler(out_msg) != USR_SUCCESS)
            {
                DbgPrint(("\nUsrEventHandler FAILURE, %s, %d\n\n", __FILE__, __LINE__));
            }
        }
    }

⌨️ 快捷键说明

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