mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-27 21:29:42 +00:00
Fix broken menus on x86 Android
- Make it explicit that we are dealing with uint8_t values and not ambiguous signed int values
This commit is contained in:
parent
ad5a6e8061
commit
a41dc46eee
@ -55,7 +55,7 @@ static float minAlphaWhenOwnsScreen = 1/4.f;
|
|||||||
static float minAlpha = 0.f;
|
static float minAlpha = 0.f;
|
||||||
static float maxAlpha = 1.f;
|
static float maxAlpha = 1.f;
|
||||||
|
|
||||||
static char kbdTemplateUCase[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
static uint8_t kbdTemplateUCase[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
||||||
"@ @ @ @ @ ",
|
"@ @ @ @ @ ",
|
||||||
"1234567890",
|
"1234567890",
|
||||||
"QWERTYUIOP",
|
"QWERTYUIOP",
|
||||||
@ -64,7 +64,7 @@ static char kbdTemplateUCase[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
|||||||
"@@ spa. @@",
|
"@@ spa. @@",
|
||||||
};
|
};
|
||||||
|
|
||||||
static char kbdTemplateLCase[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
static uint8_t kbdTemplateLCase[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
||||||
"@ @ @ @ @ ",
|
"@ @ @ @ @ ",
|
||||||
"1234567890",
|
"1234567890",
|
||||||
"qwertyuiop",
|
"qwertyuiop",
|
||||||
@ -73,7 +73,7 @@ static char kbdTemplateLCase[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
|||||||
"@@ SPA. @@",
|
"@@ SPA. @@",
|
||||||
};
|
};
|
||||||
|
|
||||||
static char kbdTemplateAlt[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
static uint8_t kbdTemplateAlt[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
||||||
"@ @ @ @ @ ",
|
"@ @ @ @ @ ",
|
||||||
"1234567890",
|
"1234567890",
|
||||||
"@#%&*/-+()",
|
"@#%&*/-+()",
|
||||||
@ -82,7 +82,7 @@ static char kbdTemplateAlt[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
|||||||
"$|\\XXX.^XX",
|
"$|\\XXX.^XX",
|
||||||
};
|
};
|
||||||
|
|
||||||
static char kbdTemplateArrow[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
static uint8_t kbdTemplateArrow[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
||||||
"@ @ @ @ @ ",
|
"@ @ @ @ @ ",
|
||||||
" ",
|
" ",
|
||||||
" @ ",
|
" @ ",
|
||||||
@ -181,7 +181,7 @@ static inline void _rerender_selected(int col, int row) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _switch_keyboard(GLModel *parent, char *template) {
|
static inline void _switch_keyboard(GLModel *parent, uint8_t *template) {
|
||||||
GLModelHUDKeyboard *hudKeyboard = (GLModelHUDKeyboard *)parent->custom;
|
GLModelHUDKeyboard *hudKeyboard = (GLModelHUDKeyboard *)parent->custom;
|
||||||
memcpy(hudKeyboard->tpl, template, sizeof(kbdTemplateUCase/* assuming all the same size */));
|
memcpy(hudKeyboard->tpl, template, sizeof(kbdTemplateUCase/* assuming all the same size */));
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ static inline void _switch_keyboard(GLModel *parent, char *template) {
|
|||||||
|
|
||||||
static inline void _toggle_arrows(void) {
|
static inline void _toggle_arrows(void) {
|
||||||
GLModelHUDKeyboard *hudKeyboard = (GLModelHUDKeyboard *)kbd.model->custom;
|
GLModelHUDKeyboard *hudKeyboard = (GLModelHUDKeyboard *)kbd.model->custom;
|
||||||
char c = hudKeyboard->tpl[_ROWOFF*(KBD_TEMPLATE_COLS+1)];
|
uint8_t c = hudKeyboard->tpl[_ROWOFF*(KBD_TEMPLATE_COLS+1)];
|
||||||
if (c == ICONTEXT_NONACTIONABLE) {
|
if (c == ICONTEXT_NONACTIONABLE) {
|
||||||
_switch_keyboard(kbd.model, kbdTemplateUCase[0]);
|
_switch_keyboard(kbd.model, kbdTemplateUCase[0]);
|
||||||
} else {
|
} else {
|
||||||
@ -278,8 +278,8 @@ static inline int64_t _tap_key_at_point(float x, float y) {
|
|||||||
_screen_to_keyboard(x, y, &col, &row);
|
_screen_to_keyboard(x, y, &col, &row);
|
||||||
const unsigned int indexRow = (hudKeyboard->tplWidth+1) * row;
|
const unsigned int indexRow = (hudKeyboard->tplWidth+1) * row;
|
||||||
|
|
||||||
int key = (hudKeyboard->tpl+indexRow)[col];
|
uint8_t key = (hudKeyboard->tpl+indexRow)[col];
|
||||||
int scancode = -1;
|
uint8_t scancode = 0;
|
||||||
|
|
||||||
// handle key
|
// handle key
|
||||||
|
|
||||||
@ -288,17 +288,17 @@ static inline int64_t _tap_key_at_point(float x, float y) {
|
|||||||
bool isCTRL = false;
|
bool isCTRL = false;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case ICONTEXT_LOWERCASE:
|
case ICONTEXT_LOWERCASE:
|
||||||
key = -1;
|
key = 0;
|
||||||
_switch_keyboard(kbd.model, kbdTemplateLCase[0]);
|
_switch_keyboard(kbd.model, kbdTemplateLCase[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICONTEXT_UPPERCASE:
|
case ICONTEXT_UPPERCASE:
|
||||||
key = -1;
|
key = 0;
|
||||||
_switch_keyboard(kbd.model, kbdTemplateUCase[0]);
|
_switch_keyboard(kbd.model, kbdTemplateUCase[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICONTEXT_SHOWALT1:
|
case ICONTEXT_SHOWALT1:
|
||||||
key = -1;
|
key = 0;
|
||||||
if (allowLowercase && !isCalibrating) {
|
if (allowLowercase && !isCalibrating) {
|
||||||
kbdTemplateAlt[0][0] = ICONTEXT_LOWERCASE;
|
kbdTemplateAlt[0][0] = ICONTEXT_LOWERCASE;
|
||||||
} else {
|
} else {
|
||||||
@ -360,7 +360,7 @@ static inline int64_t _tap_key_at_point(float x, float y) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ICONTEXT_MENU_SPROUT:
|
case ICONTEXT_MENU_SPROUT:
|
||||||
key = -1;
|
key = 0;
|
||||||
_toggle_arrows();
|
_toggle_arrows();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ static inline int64_t _tap_key_at_point(float x, float y) {
|
|||||||
isASCII = true;
|
isASCII = true;
|
||||||
if (key >= 0x80) {
|
if (key >= 0x80) {
|
||||||
RELEASE_LOG("unhandled key code...");
|
RELEASE_LOG("unhandled key code...");
|
||||||
key = -1;
|
key = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -414,12 +414,6 @@ static inline int64_t _tap_key_at_point(float x, float y) {
|
|||||||
|
|
||||||
// return the key+scancode+handled
|
// return the key+scancode+handled
|
||||||
int64_t flags = (handled ? 0x1LL : 0x0LL);
|
int64_t flags = (handled ? 0x1LL : 0x0LL);
|
||||||
if (key < 0 ) {
|
|
||||||
key = 0;
|
|
||||||
}
|
|
||||||
if (scancode < 0) {
|
|
||||||
scancode = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
key = key & 0xff;
|
key = key & 0xff;
|
||||||
scancode = scancode & 0xff;
|
scancode = scancode & 0xff;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#define MENU_OBJ_H 0.5 // NOTE : intent is to complement touch keyboard height
|
#define MENU_OBJ_H 0.5 // NOTE : intent is to complement touch keyboard height
|
||||||
|
|
||||||
HUD_CLASS(GLModelHUDMenu,
|
HUD_CLASS(GLModelHUDMenu,
|
||||||
char *pixelsAlt; // alternate color pixels
|
uint8_t *pixelsAlt; // alternate color pixels
|
||||||
);
|
);
|
||||||
|
|
||||||
static bool isAvailable = false; // Were there any OpenGL/memory errors on initialization?
|
static bool isAvailable = false; // Were there any OpenGL/memory errors on initialization?
|
||||||
@ -38,7 +38,7 @@ static bool isEnabled = true; // Does player want this enabled?
|
|||||||
static float minAlpha = 1/4.f; // Minimum alpha value of components (at zero, will not render)
|
static float minAlpha = 1/4.f; // Minimum alpha value of components (at zero, will not render)
|
||||||
|
|
||||||
// NOTE : intent is to match touch keyboard width
|
// NOTE : intent is to match touch keyboard width
|
||||||
static char topMenuTemplate[MENU_TEMPLATE_ROWS][MENU_TEMPLATE_COLS+1] = {
|
static uint8_t topMenuTemplate[MENU_TEMPLATE_ROWS][MENU_TEMPLATE_COLS+1] = {
|
||||||
"++ ++",
|
"++ ++",
|
||||||
"++ ++",
|
"++ ++",
|
||||||
};
|
};
|
||||||
@ -258,7 +258,7 @@ static inline int64_t _tap_menu_item(float x, float y) {
|
|||||||
|
|
||||||
_screen_to_menu(x, y, &col, &row);
|
_screen_to_menu(x, y, &col, &row);
|
||||||
|
|
||||||
int selectedItem = topMenuTemplate[row][col];
|
uint8_t selectedItem = topMenuTemplate[row][col];
|
||||||
|
|
||||||
int64_t flags = TOUCH_FLAGS_KEY_TAP;
|
int64_t flags = TOUCH_FLAGS_KEY_TAP;
|
||||||
switch (selectedItem) {
|
switch (selectedItem) {
|
||||||
|
Loading…
Reference in New Issue
Block a user