diff options
author | Ian C <ianc@noddybox.co.uk> | 2006-10-30 23:50:04 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2006-10-30 23:50:04 +0000 |
commit | f08256be0fb69083175408e9d87173a5107c9977 (patch) | |
tree | f869da9dca929124ee952f56325e4e8904d70bda /arm9/source/main.c | |
parent | a61e0aa6a31d6028eeb4ff45bb6c71f604641fea (diff) |
Completed FAT loading, custom keypad definitions and fixed keyboard hang bug
Diffstat (limited to 'arm9/source/main.c')
-rw-r--r-- | arm9/source/main.c | 86 |
1 files changed, 72 insertions, 14 deletions
diff --git a/arm9/source/main.c b/arm9/source/main.c index 83bc543..38c28f1 100644 --- a/arm9/source/main.c +++ b/arm9/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; } |