# HG changeset patch # User jcdutton # Date 1031139712 0 # Node ID df9712507b30109095203964f48e70544d9b1a78 # Parent eeabf5a51b2b95389973887313f7857a67c6149c Add a new API function, to allow for more flexible menu button control. The current menu button control code relies on wrong NAV PCI packet information which is out of sync with what is actually being displayed. diff -r eeabf5a51b2b -r df9712507b30 dvd_types.h --- a/dvd_types.h Tue Sep 03 07:50:45 2002 +0000 +++ b/dvd_types.h Wed Sep 04 11:41:52 2002 +0000 @@ -296,5 +296,4 @@ uint32_t buttonN; /*!< Button number for the SPU decoder. */ } dvdnav_highlight_area_t; - #endif /* DVD_H_INCLUDED */ diff -r eeabf5a51b2b -r df9712507b30 dvdnav.h --- a/dvdnav.h Tue Sep 03 07:50:45 2002 +0000 +++ b/dvdnav.h Wed Sep 04 11:41:52 2002 +0000 @@ -41,6 +41,7 @@ #include "dvd_types.h" #include +#include /* For vm_cmd_t */ /** * Opaque data-type can be viewed as a 'DVD handle'. You should get @@ -575,6 +576,14 @@ dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, int button); /** + * Activate (press) a button and execute specified command. + * + * \param self Pointer to dvdnav_t associated with this operation. + * \param cmd DVD Command to execute. + */ +dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *self, int32_t button, vm_cmd_t *cmd); + +/** * Select button at specified (image) co-ordinates. * * \param self Pointer to dvdnav_t associated with this operation. diff -r eeabf5a51b2b -r df9712507b30 highlight.c --- a/highlight.c Tue Sep 03 07:50:45 2002 +0000 +++ b/highlight.c Wed Sep 04 11:41:52 2002 +0000 @@ -410,6 +410,31 @@ return S_OK; } +dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *this, int32_t button, vm_cmd_t *cmd) +{ + if(!this || !this->vm) + return S_ERR; + pthread_mutex_lock(&this->vm_lock); + /* make the VM execute the appropriate code and + * schedule a jump */ +#ifdef BUTTON_TESTING + fprintf(MSG_OUT, "libdvdnav:dvdnav_button_activate_cmd: Evaluating Button Activation commands.\n"); +#endif + if(button > 0) { + printerrf("Select button number %i\n ", + button); + this->vm->state.HL_BTNN_REG = (button << 10); + if( (vm_eval_cmd(this->vm, cmd)) == 1) { + /* Command caused a jump */ + this->vm->hop_channel++; + } + } + /* Always remove still, because some still menus have no buttons. */ + this->position_current.still = 0; + pthread_mutex_unlock(&this->vm_lock); + return S_OK; +} + dvdnav_status_t dvdnav_button_select(dvdnav_t *this, int button) { if(!this) {