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

📄 dvd_cmd.c

📁 这是DVD中伺服部分的核心代码
💻 C
📖 第 1 页 / 共 5 页
字号:
#if DBG_ON(DBG_TRACE)
            DbgPrint(("set_system_cmd() - case SET_NVTMR\n"));
#endif

            tt_pgcn = (USHORT) (operand[2] & 0x7F) << 8;
            tt_pgcn |= operand[3];
            set_sprm(SPRM_TT_PGCN_NV_TMR, tt_pgcn);

            if (set_i_flg)
            {
                /* set SPRM(9) = NV_TMR value */
                nv_tmr = (USHORT) operand[0] << 8;
                nv_tmr |= operand[1];
            }
            else
            {
                gprmn = operand[1] & 0x0F;
                nv_tmr = get_gprm(gprmn);
            }

            if (nv_tmr == 0)
            {
                stop_nv_tmr();
            }

            nv_tmr_100 = nv_tmr * 100;
            nv_tmr_set = nv_tmr;
            adjust_nv_tmr = 1;
            set_sprm(SPRM_NV_TMR, nv_tmr);
        }
        break;

    case SET_GPRMMD:
        {
            /*
             * This instruction sets the value to the General Parameter and
             * the operation mode of the same General Parameter to Register
             * mode or Counter mode.
             */
            USHORT initial_value;
            UBYTE mode;
            UBYTE gprmn_mode;
            UBYTE gprmn_init;

#if DBG_ON(DBG_TRACE)
            DbgPrint(("set_system_cmd() - case SET_GPRMMD\n"));
#endif

            mode = operand[3] >> 7;
            gprmn_mode = operand[3] & 0x0F;

            if (set_i_flg)      /* immediate value loaded into GPRMN */
            {
                initial_value = (USHORT) operand[0] << 8;
                initial_value |= operand[1];
                set_gprm(gprmn_mode, mode, initial_value);
            }
            else        /* assign one GPRM to another, and set the mode */
            {
                gprmn_init = operand[1] & 0x0F;
                initial_value = get_gprm(gprmn_init);
                set_gprm(gprmn_mode, mode, initial_value);
            }

            if (mode == GPRM_REG_MODE)
            {
                ;       /* Register mode */
            }
            else
            {
                ;       /* Counter mode */
            }
        }
        break;

    case SET_AMXMD:
        {
            USHORT amxmd;
            UBYTE  gprmn;

#if DBG_ON(DBG_TRACE)
            DbgPrint(("set_system_cmd() - case SET_AMXMD\n"));
#endif

            /*
             * This instruction sets the audio mixing mode for Karaoke audio
             * in SPRM(11), but we will just ignore it.
             */

            if (set_i_flg)
            {
                amxmd = ((USHORT) operand[0]) << 8;
                amxmd |= operand[1];
                set_sprm(SPRM_P_AMXMD, amxmd);
            }
            else
            {
                gprmn = operand[3] & 0x0F;
                amxmd = (get_gprm(gprmn) & 0x1c1c);
                set_sprm(SPRM_P_AMXMD, amxmd);
            }
        }
        break;

    case SET_HL_BTNN:
        {
            UBYTE  hl_btnn;
            USHORT btnn;

#if DBG_ON(DBG_TRACE)
            DbgPrint(("set_system_cmd() - case SET_HL_BTNN\n"));
#endif

            /* This instruction sets the HL_BTNN in SPRM(8). */

            if (set_i_flg)
            {
                /* set SPRM(8)[15..10] to value */
                hl_btnn = operand[2] >> 2;
                set_hl_btnn_sprm(hl_btnn);
            }
            else
            {
                btnn = get_gprm((UBYTE)(operand[3] & 0x0F));

                /* check any invalid highlight button number */
                if ((btnn < 0x0400) || (btnn > 0x9000))
                {
                    btnn = 0x0400;
                }

                set_sprm(SPRM_HL_BTNN, btnn);
            }
        }
        break;

    default:
        DbgPrint(("UNKNOWN set_sys_opt=%d, %s, %d\n", set_sys_opt, __FILE__, __LINE__));
        break;
    }

    return (param_changed);
}

/**
 *  Name:           link_sins_cmd
 *
 *  Description:    act on the Link Sub-Instruction Command (Type 1)
 *
 *  Arguments:      operand - pointer to a two byte operand buffer
 *
 *  Returns:        nothing
 *
 *  Functionality:
 *    These Instructions may not be used in Commands in the Pre- and Post-
 *    Command Areas of PGCIs, except RSM Instruction.
 *    This is the Instruction to start the presentation from a position
 *    specified by the Sub-Instruction and optionally to assign the HL_BTNN
 *    to SPRM(8).  The position which is specified by the Link Sub-Instruction
 *    shall be within the same Domain (except RSM Instruction).
 */
USHORT link_sins_cmd(UBYTE * operand)
{
    UBYTE  done = 0;
    USHORT retval;
    ULONG  tt;
    ULONG  ptt;

#if DBG_ON(DBG_TRACE)
    DbgPrint(("link_sins_cmd: ENTER\n"));
#endif

    switch (operand[5])
    {
    case SINS_LINK_NO_LINK:
        /*
         * No Link is the instruction to set the HL_BTTN to SPRM(8)
         * without a new position.
         */

        retval = NAV_CONTINUE; /*NAV_CELL_PLAY;*/
        break;

    case SINS_LINK_TOP_C:
        /*
         * Skip to the top of the current Cell is the instruction to
         * restart the presentation of the current Cell and to set
         * HL_BTNN to SPRM(8).
         */

        retval = NAV_CELL_PLAY;
        break;

    case SINS_LINK_NEXT_C:
        /*
         * Skip to the next Cell is the instruction to start the presentation
         * of the next Cell (or Cell Block) relative to the current Cell (or
         * Cell Block), and optionally to assign the HL_BTNN to SPRM(8).
         */

        /*
         * increment cell number by one, if this is the last cell of the
         * program, ignore this command, otherwise, go to head of the next
         * cell according to cell playback information table
         */

        if (next_pgn == (pgc_gi.pgc_cnt[2] & 0x7f))
        {
            if (next_cell++ == pgc_gi.pgc_cnt[3])
            {
                next_cell--;
            }
        }
        else
        {
            if (next_cell++ == pgc_pgmap[next_pgn])
            {
                next_cell--;
            }
        }

        retval = NAV_CELL_PLAY;
        break;

    case SINS_LINK_PREV_C:
        /*
         * Skip to the previous Cell is the instruction to start the
         * presentation of the previous Cell (or Cell Block) relative to
         * the current Cell (or Cell Block), and optionally to assign the
         * HL_BTNN to SPRM(8).
         */

        /*
         * decrement cell number by one, if this is the first cell of the
         * program, ignore this command, otherwise, go to head of the
         * previous cellaccording to cell playback information table
         */

        if (next_pgn == (pgc_gi.pgc_cnt[2] & 0x7f))
        {
            if (--next_cell == 0)
            {
                next_cell++;
            }
        }
        else
        {
            if (next_pgn != 1)
            {
                if (--next_cell == pgc_pgmap[next_pgn - 2])
                {
                    next_cell++;
                }
            }
            else
            {
                next_cell--;
            }
        }

        retval = NAV_CELL_PLAY;
        break;

    case SINS_LINK_TOP_PG:
        /*
         * Skip to the top of the current Program is the instruction to
         * restart the presentation of the current Program, and
         * optionally to assign the HL_BTNN to SPRM(8).
         */

        retval = link_top_pg();
        break;

    case SINS_LINK_NEXT_PG:
          /*
           * Skip to the next Program is the instruction to start the
           * presentation of the next Program of the current PGC and
           * optionally to assign the HL_BTNN to SPRM(8).
           */

          retval = link_next_pg();
          break;

    case SINS_LINK_PREV_PG:
          /*
           * Skip to the previous Program is the instruction to start the
           * presentation of the previous Program of the current PGC and
           * optionally to assign the HL_BTNN to SPRM(8). When this
           * instruction is executed in the first Program of the PGC or the
           * Program of the PGC whose PG Playback mode is set to Random or
           * Shuffle playback, this instruction shall be interpreted as
           * LinkPrevPGC (SINS_LINK_PREV_PGC) Instruction.
           */

          retval = link_prev_pg();
          break;

    case SINS_LINK_TOP_PGC:
        /*
         * Link to the current PGC is the instruction to restart the
         * presentation of the current PGC (or PGC Block) and optionally
         * to assign the HL_BTNN to SPRM(8).
         */

        next_pgn = 1;       /* presents from the 1st program in PGC */
        next_cell = pgc_pgmap[0];

        retval = NAV_PRE_CMD;       /* goto pre_cmd phase */
        break;

    case SINS_LINK_NEXT_PGC:
        /*
         * Link to the next PGC is the instruction to start the
         * presentation of the next PGC (or PGC Block) relative to the
         * current PGC and optionally to assign the HL_BTNN to SPRM(8).
         */

        retval = NAV_PRE_CMD;       /* goto pre_cmd phase */

        if (pgc_gi.pgc_nv_ctl.next_pgcn & 0x7fff)
        {
            next_pgcn = pgc_gi.pgc_nv_ctl.next_pgcn & 0x7fff;

            if (parse_pgci(&next_pgcn))
            {
                retval = NAV_STOP;  /* goto stop phase */
            }
            else
            {
                next_pgn = 1;       /* presents from the 1st program in PGC */

                if (pgc_domain == TT_PGC)
                {
                    set_sprm(SPRM_TT_PGCN_TT_DOM, (USHORT) next_pgcn);

                    done = 0;
                    for (tt = 0; (tt < ptt_srpti.vts_ttu_n) && !done; tt++)
                    {
                        for (ptt = 0; (ptt < ttu_srp_num[tt]) && !done; ptt++)
                        {
                            if ((ptt_srp[tt][ptt].pgcn == next_pgcn) &&
                                (ptt_srp[tt][ptt].pgn == next_pgn))
                            {
                                set_sprm(SPRM_PTTN_ONE_SEQ_PGC, (USHORT) (ptt + 1));
                                /* time_info->chapter_valid = TRUE;*/
                                done = 1;
                            }
                        }
                    }

#if CHAP_DISP_MODE == CHAP_DISP_1
                    if ((tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40) && /* One_Random_PGC_Title or Multi_PGC_Title */
                        (tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x02))   /* ptt search is prohibited */
#else
                    if (tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40)     /* One_Random_PGC_Title or Multi_PGC_Title */
#endif
                    {
                        time_info->chapter_valid = FALSE;
                    }
                    else
                    {
                        time_info->chapter_valid = TRUE;
                    }
                    if (!done)
                    {
                        time_info->chapter_valid = FALSE;
                    }
                }

                next_cell = pgc_pgmap[0];
            }
        }
        else
        {
            /* go to stop state */
            retval = NAV_STOP;
        }
        break;

    case SINS_LINK_PREV_PGC:
        /*
         * Link to the previous PGC is the instruction to start the
         * presentation of the previous PGC (or PGC Block) relative to
         * the current PGC and optionally to assign the HL_BTNN to
         * SPRM(8).
         */

        retval = NAV_PRE_CMD;       /* goto pre_cmd phase */

        if (pgc_gi.pgc_nv_ctl.previous_pgcn & 0x7fff)
        {
            next_pgcn = pgc_gi.pgc_nv_ctl.previous_pgcn & 0x7fff;

            if (parse_pgci(&next_pgcn))
            {
                retval = NAV_STOP;  /* goto stop phase */
            }
            else
            {
                next_pgn = 1;       /* presents from the 1st program in PGC */

                if (pgc_domain == TT_PGC)
                {
                    set_sprm(SPRM_TT_PGCN_TT_DOM, next_pgcn);

                    done = 0;
                    for (tt = 0; (tt < ptt_srpti.vts_ttu_n) && !done; tt++)
                    {
                        for (ptt = 0; (ptt < ttu_srp_num[tt]) && !done; ptt++)
                        {
                            if ((ptt_srp[tt][ptt].pgcn == next_pgcn) &&
                                (ptt_srp[tt][ptt].pgn == next_pgn))
                            {
                                set_sprm(SPRM_PTTN_ONE_SEQ_PGC, (USHORT) (ptt + 1));
                                done = 1;
                            }
                        }
                    }

#if CHAP_DISP_MODE == CHAP_DISP_1
                    if ((tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40) && /*

⌨️ 快捷键说明

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