[libbluray-devel] commit: Added HDMV_EVENT_SET_BUTTON_PAGE and correct register handling for SETBUTTONPAGE instruction (hpi1 )

git at videolan.org git at videolan.org
Fri Sep 10 13:50:25 CEST 2010


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Sep  9 14:30:49 2010 +0300| [d239ae79895f8905b77a7d23a0572c1b98a2457c] | committer: hpi1 

Added HDMV_EVENT_SET_BUTTON_PAGE and correct register handling for SETBUTTONPAGE instruction

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=d239ae79895f8905b77a7d23a0572c1b98a2457c
---

 src/libbluray/hdmv/hdmv_vm.c |   39 ++++++++++++++++++++++++++++++---------
 src/libbluray/hdmv/hdmv_vm.h |    1 +
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/src/libbluray/hdmv/hdmv_vm.c b/src/libbluray/hdmv/hdmv_vm.c
index 6d3bb61..12decf3 100644
--- a/src/libbluray/hdmv/hdmv_vm.c
+++ b/src/libbluray/hdmv/hdmv_vm.c
@@ -117,6 +117,16 @@ static uint32_t _read_setstream_regs(HDMV_VM *p, uint32_t val)
     return flags | val0 | (val1 << 16);
 }
 
+static uint32_t _read_setbuttonpage_reg(HDMV_VM *p, uint32_t val)
+{
+    uint32_t flags = val & 0xc0000000;
+    uint32_t reg0  = val & 0x00000fff;
+
+    uint32_t val0  = bd_gpr_read(p->regs, reg0) & 0x3fffffff;
+
+    return flags | val0;
+}
+
 static int _store_result(HDMV_VM *p, MOBJ_CMD *cmd, uint32_t src, uint32_t dst, uint32_t src0, uint32_t dst0)
 {
     int ret = 0;
@@ -141,7 +151,7 @@ static int _store_result(HDMV_VM *p, MOBJ_CMD *cmd, uint32_t src, uint32_t dst,
     return ret;
 }
 
-static uint32_t _fetch_operand(HDMV_VM *p, int setstream, int imm, uint32_t value)
+static uint32_t _fetch_operand(HDMV_VM *p, int setstream, int setbuttonpage, int imm, uint32_t value)
 {
     if (setstream) {
 
@@ -151,6 +161,14 @@ static uint32_t _fetch_operand(HDMV_VM *p, int setstream, int imm, uint32_t valu
             return value;
         }
 
+    } else if (setbuttonpage) {
+
+        if (!imm) {
+            return _read_setbuttonpage_reg(p, value);
+        } else {
+            return value;
+        }
+
     } else {
 
         if (!imm) {
@@ -169,15 +187,18 @@ static void _fetch_operands(HDMV_VM *p, MOBJ_CMD *cmd, uint32_t *dst, uint32_t *
                      insn->sub_grp == SET_SETSYSTEM  &&
                      (  insn->set_opt == INSN_SET_STREAM ||
                         insn->set_opt == INSN_SET_SEC_STREAM));
+    int setbuttonpage = (insn->grp     == INSN_GROUP_SET &&
+                         insn->sub_grp == SET_SETSYSTEM  &&
+                         insn->set_opt == INSN_SET_BUTTON_PAGE);
 
     *dst = *src = 0;
 
     if (insn->op_cnt > 0) {
-      *dst = _fetch_operand(p, setstream, insn->imm_op1, cmd->dst);
+        *dst = _fetch_operand(p, setstream, setbuttonpage, insn->imm_op1, cmd->dst);
     }
 
     if (insn->op_cnt > 1) {
-      *src = _fetch_operand(p, setstream, insn->imm_op2, cmd->src);
+        *src = _fetch_operand(p, setstream, setbuttonpage, insn->imm_op2, cmd->src);
     }
 }
 
@@ -488,13 +509,13 @@ static void _set_sec_stream(HDMV_VM *p, uint32_t dst, uint32_t src)
 static void _set_button_page(HDMV_VM *p, uint32_t dst, uint32_t src)
 {
     if (p->ig_object) {
-        uint32_t current_page = bd_psr_read(p->regs, PSR_MENU_PAGE_ID) & 0xff;
-        if (src & 0x80000000 && (src & 0xff) == current_page) {
-            /* page does not change --> no effect (8.8.4.6.5.3.4) */
-            return;
-        }
+        uint32_t param;
+        param =  (src & 0xc0000000) |        /* page and effects flags */
+                ((dst & 0x80000000) >> 2) |  /* button flag */
+                ((src & 0x000000ff) << 16) | /* page id */
+                 (dst & 0x0000ffff);         /* button id */
 
-        // TODO - need to know valid page/button ids from IG stream
+         _queue_event(p, HDMV_EVENT_SET_BUTTON_PAGE, param);
 
         return;
     }
diff --git a/src/libbluray/hdmv/hdmv_vm.h b/src/libbluray/hdmv/hdmv_vm.h
index 2fcc616..97d5da4 100644
--- a/src/libbluray/hdmv/hdmv_vm.h
+++ b/src/libbluray/hdmv/hdmv_vm.h
@@ -40,6 +40,7 @@ typedef enum {
 
     HDMV_EVENT_STILL,          /* param: boolean */
 
+    HDMV_EVENT_SET_BUTTON_PAGE,
     HDMV_EVENT_ENABLE_BUTTON,
     HDMV_EVENT_DISABLE_BUTTON,
     HDMV_EVENT_POPUP_OFF,



More information about the libbluray-devel mailing list