summaryrefslogtreecommitdiff
path: root/apps/plugins/xworld
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-09-30 20:50:33 -0400
committerFranklin Wei <git@fwei.tk>2017-09-30 20:50:33 -0400
commit23e7d0ef19dc82e39f249a4cd65ec797a6c06aba (patch)
tree73d7b786e6255ae703786f98c3d3df0c5341a5dd /apps/plugins/xworld
parentbb55fceb7020e3235d4b5c33976d9b9d10dc091a (diff)
xworld: support diagonal buttons on Zen X-Fi
Change-Id: Ia738ecd2a39c0c0772d6f939d549dd5d0eda055e
Diffstat (limited to 'apps/plugins/xworld')
-rw-r--r--apps/plugins/xworld/resource.c2
-rw-r--r--apps/plugins/xworld/sys.c6
-rw-r--r--apps/plugins/xworld/sys.h6
3 files changed, 8 insertions, 6 deletions
diff --git a/apps/plugins/xworld/resource.c b/apps/plugins/xworld/resource.c
index 4bd93f0616..29b875f9af 100644
--- a/apps/plugins/xworld/resource.c
+++ b/apps/plugins/xworld/resource.c
@@ -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->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->_vidBakPtr = res->_vidCurPtr = res->_memPtrStart + MEM_BLOCK_SIZE - 0x800 * 16; //0x800 = 2048, so we have 32KB free for vidBack and vidCur
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c
index 1a3d47d307..a240c75924 100644
--- a/apps/plugins/xworld/sys.c
+++ b/apps/plugins/xworld/sys.c
@@ -63,7 +63,7 @@ static void sys_rotate_keymap(struct System* sys)
sys->keymap.down = BTN_DOWN;
sys->keymap.left = BTN_LEFT;
sys->keymap.right = BTN_RIGHT;
-#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
+#ifdef BTN_HAVE_DIAGONAL
sys->keymap.upleft = BTN_UP_LEFT;
sys->keymap.upright = BTN_UP_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.left = BTN_UP;
sys->keymap.right = BTN_DOWN;
-#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
+#ifdef BTN_HAVE_DIAGONAL
sys->keymap.upleft = BTN_UP_RIGHT;
sys->keymap.upright = BTN_DOWN_RIGHT;
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.left = BTN_DOWN;
sys->keymap.right = BTN_UP;
-#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
+#ifdef BTN_HAVE_DIAGONAL
sys->keymap.upleft = BTN_DOWN_LEFT;
sys->keymap.upright = BTN_UP_LEFT;
sys->keymap.downleft = BTN_DOWN_RIGHT;
diff --git a/apps/plugins/xworld/sys.h b/apps/plugins/xworld/sys.h
index ced1fd98cd..4b1ec9b13a 100644
--- a/apps/plugins/xworld/sys.h
+++ b/apps/plugins/xworld/sys.h
@@ -64,12 +64,14 @@ struct keymapping_t {
int down;
int left;
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 upright;
int downleft;
int downright;
-#endif
};
typedef void (*AudioCallback)(void *param, uint8_t *stream, int len);