summaryrefslogtreecommitdiff
path: root/source/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/keyboard.c')
-rw-r--r--source/keyboard.c87
1 files changed, 61 insertions, 26 deletions
diff --git a/source/keyboard.c b/source/keyboard.c
index 6483b1c..078bc78 100644
--- a/source/keyboard.c
+++ b/source/keyboard.c
@@ -278,6 +278,7 @@ void SK_DisplayKeyboard(void)
{
static sImage img;
static int loaded;
+ int f;
if (!loaded)
{
@@ -286,6 +287,22 @@ void SK_DisplayKeyboard(void)
}
FB_Blit(&img,0,0,PAL_OFFSET);
+
+ /* Update any on-screen indicators
+ */
+ for(f=SK_1; f<SK_CONFIG; f++)
+ {
+ if (key_state[f].state)
+ {
+ int x,y;
+
+ x = 3 + (f % 10) * 25;
+ y = 37 + (f / 10) * 30;
+
+ FB_Box(x, y, 25, 18, key_state[f].new_state ?
+ selection_on : selection_off);
+ }
+ }
}
@@ -412,37 +429,55 @@ const char *SK_KeyName(SoftKey k)
void SK_SaveSnapshot(FILE *fp)
{
- STRPUT(fp, pad_left_key);
- STRPUT(fp, pad_right_key);
- STRPUT(fp, pad_up_key);
- STRPUT(fp, pad_down_key);
- STRPUT(fp, pad_A_key);
- STRPUT(fp, pad_B_key);
- STRPUT(fp, pad_X_key);
- STRPUT(fp, pad_Y_key);
- STRPUT(fp, pad_R_key);
- STRPUT(fp, pad_L_key);
- STRPUT(fp, pad_start_key);
- STRPUT(fp, pad_select_key);
- STRPUT(fp, key_state);
+ int f;
+
+ PUT_Long(fp, pad_left_key);
+ PUT_Long(fp, pad_right_key);
+ PUT_Long(fp, pad_up_key);
+ PUT_Long(fp, pad_down_key);
+ PUT_Long(fp, pad_A_key);
+ PUT_Long(fp, pad_B_key);
+ PUT_Long(fp, pad_X_key);
+ PUT_Long(fp, pad_Y_key);
+ PUT_Long(fp, pad_R_key);
+ PUT_Long(fp, pad_L_key);
+ PUT_Long(fp, pad_start_key);
+ PUT_Long(fp, pad_select_key);
+
+ for(f = 0; f < NUM_SOFT_KEYS; f++)
+ {
+ PUT_Long(fp, key_state[f].state);
+ PUT_Long(fp, key_state[f].new_state);
+ PUT_Long(fp, key_state[f].handled);
+ PUT_Long(fp, key_state[f].is_sticky);
+ }
}
void SK_LoadSnapshot(FILE *fp)
{
- STRGET(fp, pad_left_key);
- STRGET(fp, pad_right_key);
- STRGET(fp, pad_up_key);
- STRGET(fp, pad_down_key);
- STRGET(fp, pad_A_key);
- STRGET(fp, pad_B_key);
- STRGET(fp, pad_X_key);
- STRGET(fp, pad_Y_key);
- STRGET(fp, pad_R_key);
- STRGET(fp, pad_L_key);
- STRGET(fp, pad_start_key);
- STRGET(fp, pad_select_key);
- STRGET(fp, key_state);
+ int f;
+
+ pad_left_key = GET_Long(fp);
+ pad_right_key = GET_Long(fp);
+ pad_up_key = GET_Long(fp);
+ pad_down_key = GET_Long(fp);
+ pad_A_key = GET_Long(fp);
+ pad_B_key = GET_Long(fp);
+ pad_X_key = GET_Long(fp);
+ pad_Y_key = GET_Long(fp);
+ pad_R_key = GET_Long(fp);
+ pad_L_key = GET_Long(fp);
+ pad_start_key = GET_Long(fp);
+ pad_select_key = GET_Long(fp);
+
+ for(f = 0; f < NUM_SOFT_KEYS; f++)
+ {
+ key_state[f].state = GET_Long(fp);
+ key_state[f].new_state = GET_Long(fp);
+ key_state[f].handled = GET_Long(fp);
+ key_state[f].is_sticky = GET_Long(fp);
+ }
}