summaryrefslogtreecommitdiff
path: root/source/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/main.c')
-rw-r--r--source/main.c86
1 files changed, 72 insertions, 14 deletions
diff --git a/source/main.c b/source/main.c
index 83bc543..38c28f1 100644
--- a/source/main.c
+++ b/source/main.c
@@ -99,53 +99,53 @@ static void Splash(void)
FB_Blit(&img,0,0);
- y=10;
+ y = 10;
for(f=0;text[f];f++)
{
FB_Centre(text[f],y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
}
- y+=8;
+ y += 8;
if (fatInitialise(32,true))
{
ZX81EnableFileSystem(TRUE);
FB_Centre("Found a FAT device.",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
FB_Centre("If you place .P tape files in",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
FB_Centre("the top directory or ZX81TAPE",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
FB_Centre("then you should be able to load",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
FB_Centre("GAME.P with the command",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
FB_Centre("LOAD \"GAME\"",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
}
else
{
ZX81EnableFileSystem(FALSE);
FB_Centre("Sorry, but you don't have a",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
FB_Centre("supported FAT device.",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
FB_Centre("Only the internal tape",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
FB_Centre("files can be used.",y,FB_RGB(31,31,31),-1);
- y+=8;
+ y += 8;
}
while(!(keysDown() & KEY_A))
@@ -155,6 +155,64 @@ static void Splash(void)
}
+/* ---------------------------------------- JOYPAD MAPPING
+*/
+static void MapJoypad(void)
+{
+ SoftKeyEvent ev;
+ SoftKey pad = NUM_SOFT_KEYS;
+ int done = FALSE;
+ char text[256];
+
+ SK_DisplayKeyboard(BG_GFX_SUB);
+
+ ZX81DisplayString("press the joypad button you want\n"
+ "to define and then the ZX81 key\n"
+ "you want to use.\n\n"
+ "press on the config banner to\n"
+ "finish.");
+
+ while(!done)
+ {
+ while(SK_GetBareEvent(&ev))
+ {
+ if (ev.pressed)
+ {
+ if (ev.key==SK_ABOUT || ev.key==SK_CONFIG)
+ {
+ done = true;
+ }
+ }
+ else
+ {
+ if (ev.key>=SK_PAD_UP && ev.key<=SK_PAD_SELECT)
+ {
+ pad = ev.key;
+
+ /* Now, just how dumb was making % the inverse on/off...
+ */
+ sprintf(text,"defining\n %%%s%%",SK_KeyName(pad));
+ ZX81DisplayString(text);
+ }
+
+ if (ev.key<=SK_SPACE && pad!=NUM_SOFT_KEYS)
+ {
+ sprintf(text,"mapped\n %%%s%%\nto\n %%%s%%",
+ SK_KeyName(pad),SK_KeyName(ev.key));
+ ZX81DisplayString(text);
+
+ SK_DefinePad(pad,ev.key);
+
+ pad = NUM_SOFT_KEYS;
+ }
+ }
+ }
+
+ swiWaitForVBlank();
+ }
+}
+
+
/* ---------------------------------------- MAIN
*/
int main(int argc, char *argv[])
@@ -251,7 +309,7 @@ int main(int argc, char *argv[])
break;
case MenuMapJoypad:
- SK_DisplayKeyboard(BG_GFX_SUB);
+ MapJoypad();
break;
}