xworld: support diagonal buttons on Zen X-Fi
Change-Id: Ia738ecd2a39c0c0772d6f939d549dd5d0eda055e
This commit is contained in:
parent
bb55fceb70
commit
23e7d0ef19
4 changed files with 19 additions and 6 deletions
|
@ -68,12 +68,23 @@
|
||||||
#define BTN_RIGHT BUTTON_RIGHT
|
#define BTN_RIGHT BUTTON_RIGHT
|
||||||
|
|
||||||
#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
|
#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
|
||||||
|
#define BTN_HAVE_DIAGONAL
|
||||||
#define BTN_UP_LEFT BUTTON_BACK
|
#define BTN_UP_LEFT BUTTON_BACK
|
||||||
#define BTN_UP_RIGHT BUTTON_PLAYPAUSE
|
#define BTN_UP_RIGHT BUTTON_PLAYPAUSE
|
||||||
#define BTN_DOWN_LEFT BUTTON_BOTTOMLEFT
|
#define BTN_DOWN_LEFT BUTTON_BOTTOMLEFT
|
||||||
#define BTN_DOWN_RIGHT BUTTON_BOTTOMRIGHT
|
#define BTN_DOWN_RIGHT BUTTON_BOTTOMRIGHT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* X-Fi doesn't have a separate *_PAD macro */
|
||||||
|
#ifdef CREATIVE_ZENXFI
|
||||||
|
#define BTN_HAVE_DIAGONAL
|
||||||
|
#define BTN_DOWN_LEFT BUTTON_BOTTOMLEFT
|
||||||
|
#define BTN_DOWN_RIGHT BUTTON_BOTTOMRIGHT
|
||||||
|
#define BTN_UP_LEFT BUTTON_TOPLEFT
|
||||||
|
#define BTN_UP_RIGHT BUTTON_TOPRIGHT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (CONFIG_KEYPAD == HM60X_PAD)
|
#if (CONFIG_KEYPAD == HM60X_PAD)
|
||||||
#define BTN_FIRE BUTTON_POWER
|
#define BTN_FIRE BUTTON_POWER
|
||||||
#define BTN_PAUSE BUTTON_SELECT
|
#define BTN_PAUSE BUTTON_SELECT
|
||||||
|
|
|
@ -371,7 +371,7 @@ void res_allocMemBlock(struct Resource* res) {
|
||||||
res->sys->membuf = res->_memPtrStart + ( MEM_BLOCK_SIZE + (4 * VID_PAGE_SIZE) + 320 * 200 * sizeof(fb_data));
|
res->sys->membuf = res->_memPtrStart + ( MEM_BLOCK_SIZE + (4 * VID_PAGE_SIZE) + 320 * 200 * sizeof(fb_data));
|
||||||
res->sys->bytes_left = sz - (MEM_BLOCK_SIZE + (4 * VID_PAGE_SIZE) + 320 * 200 * sizeof(fb_data));
|
res->sys->bytes_left = sz - (MEM_BLOCK_SIZE + (4 * VID_PAGE_SIZE) + 320 * 200 * sizeof(fb_data));
|
||||||
|
|
||||||
debug(DBG_RES, "audiobuf is %d bytes in size", sz);
|
debug(DBG_RES, "audiobuf is %d bytes in size (%d bytes left)", sz, res->sys->bytes_left);
|
||||||
|
|
||||||
res->_scriptBakPtr = res->_scriptCurPtr = res->_memPtrStart;
|
res->_scriptBakPtr = res->_scriptCurPtr = res->_memPtrStart;
|
||||||
res->_vidBakPtr = res->_vidCurPtr = res->_memPtrStart + MEM_BLOCK_SIZE - 0x800 * 16; //0x800 = 2048, so we have 32KB free for vidBack and vidCur
|
res->_vidBakPtr = res->_vidCurPtr = res->_memPtrStart + MEM_BLOCK_SIZE - 0x800 * 16; //0x800 = 2048, so we have 32KB free for vidBack and vidCur
|
||||||
|
|
|
@ -63,7 +63,7 @@ static void sys_rotate_keymap(struct System* sys)
|
||||||
sys->keymap.down = BTN_DOWN;
|
sys->keymap.down = BTN_DOWN;
|
||||||
sys->keymap.left = BTN_LEFT;
|
sys->keymap.left = BTN_LEFT;
|
||||||
sys->keymap.right = BTN_RIGHT;
|
sys->keymap.right = BTN_RIGHT;
|
||||||
#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
|
#ifdef BTN_HAVE_DIAGONAL
|
||||||
sys->keymap.upleft = BTN_UP_LEFT;
|
sys->keymap.upleft = BTN_UP_LEFT;
|
||||||
sys->keymap.upright = BTN_UP_RIGHT;
|
sys->keymap.upright = BTN_UP_RIGHT;
|
||||||
sys->keymap.downleft = BTN_DOWN_RIGHT;
|
sys->keymap.downleft = BTN_DOWN_RIGHT;
|
||||||
|
@ -75,7 +75,7 @@ static void sys_rotate_keymap(struct System* sys)
|
||||||
sys->keymap.down = BTN_LEFT;
|
sys->keymap.down = BTN_LEFT;
|
||||||
sys->keymap.left = BTN_UP;
|
sys->keymap.left = BTN_UP;
|
||||||
sys->keymap.right = BTN_DOWN;
|
sys->keymap.right = BTN_DOWN;
|
||||||
#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
|
#ifdef BTN_HAVE_DIAGONAL
|
||||||
sys->keymap.upleft = BTN_UP_RIGHT;
|
sys->keymap.upleft = BTN_UP_RIGHT;
|
||||||
sys->keymap.upright = BTN_DOWN_RIGHT;
|
sys->keymap.upright = BTN_DOWN_RIGHT;
|
||||||
sys->keymap.downleft = BTN_UP_LEFT;
|
sys->keymap.downleft = BTN_UP_LEFT;
|
||||||
|
@ -87,7 +87,7 @@ static void sys_rotate_keymap(struct System* sys)
|
||||||
sys->keymap.down = BTN_RIGHT;
|
sys->keymap.down = BTN_RIGHT;
|
||||||
sys->keymap.left = BTN_DOWN;
|
sys->keymap.left = BTN_DOWN;
|
||||||
sys->keymap.right = BTN_UP;
|
sys->keymap.right = BTN_UP;
|
||||||
#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
|
#ifdef BTN_HAVE_DIAGONAL
|
||||||
sys->keymap.upleft = BTN_DOWN_LEFT;
|
sys->keymap.upleft = BTN_DOWN_LEFT;
|
||||||
sys->keymap.upright = BTN_UP_LEFT;
|
sys->keymap.upright = BTN_UP_LEFT;
|
||||||
sys->keymap.downleft = BTN_DOWN_RIGHT;
|
sys->keymap.downleft = BTN_DOWN_RIGHT;
|
||||||
|
|
|
@ -64,12 +64,14 @@ struct keymapping_t {
|
||||||
int down;
|
int down;
|
||||||
int left;
|
int left;
|
||||||
int right;
|
int right;
|
||||||
#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
|
|
||||||
|
/* These aren't conditional, even if they aren't used (this is to
|
||||||
|
* prevent headers and source from having varying defintions of
|
||||||
|
* this structure, leading to memory corruption */
|
||||||
int upleft;
|
int upleft;
|
||||||
int upright;
|
int upright;
|
||||||
int downleft;
|
int downleft;
|
||||||
int downright;
|
int downright;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*AudioCallback)(void *param, uint8_t *stream, int len);
|
typedef void (*AudioCallback)(void *param, uint8_t *stream, int len);
|
||||||
|
|
Loading…
Reference in a new issue