/* ds48 - Nintendo DS ZX Spectrum emulator. Copyright (C) 2007 Ian Cowburn This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. $Id$ */ #include #include #include "tapes.h" #include "framebuffer.h" #include "keyboard.h" #include "ant_tape_bin.h" /* ---------------------------------------- STATIC DATA */ typedef struct { const u8 *tape; const u32 *tape_len; SoftKey *keys; const char **text; } Tape; #define NO_TAPES 1 static SoftKey ant_keys[]= { SK_PAD_UP, SK_V, SK_PAD_LEFT, SK_M, SK_PAD_RIGHT, SK_SYMBOL_SHIFT, SK_PAD_Y, SK_S, SK_PAD_X, SK_D, SK_PAD_A, SK_F, SK_PAD_DOWN, SK_G, SK_PAD_B, SK_C, SK_PAD_L, SK_O, SK_PAD_R, SK_P, SK_PAD_START, SK_ENTER, SK_PAD_SELECT, SK_SPACE, NUM_SOFT_KEYS }; static const char *ant_text[]= { /* 01234567890123456789012345678901 */ "ANT ATTACK", " ", "(c) 1983", "Sandy White & Angela Sutherland", " ", "Brave the city of Antescher.", " ", "Use left and right to turn, up", "to go forwards and B to jump.", " ", "Y, X and A throw grenades near,", "then further away. Down throws", "as hard as you can.", " ", "Use the shoulder buttons, start", "and select to alter the view.", NULL }; static Tape tapes[NO_TAPES]= { { ant_tape_bin, &ant_tape_bin_size, ant_keys, ant_text } }; static int current=0; /* ---------------------------------------- PRIVATE INTERFACES */ static void DisplayTape(Tape *t) { int f; FB_Clear(); for(f=0;t->text[f];f++) { FB_Centre(t->text[f],f*8,COL_WHITE,COL_TRANSPARENT); } FB_Centre("Press A to select this tape.",180,COL_YELLOW,COL_TRANSPARENT); } /* ---------------------------------------- PUBLIC INTERFACES */ void SelectTape(void) { int done=FALSE; while(!done) { uint32 key=0; DisplayTape(tapes+current); do { swiWaitForVBlank(); } while(!(key=keysDownRepeat())); if (key & KEY_LEFT) { if (--current<0) { current=NO_TAPES-1; } } else if (key & KEY_RIGHT) { current=(current+1)%NO_TAPES; } else if (key & KEY_A) { int f; done=TRUE; SPECSetTape(tapes[current].tape,*tapes[current].tape_len); for(f=0;tapes[current].keys[f]!=NUM_SOFT_KEYS;f+=2) { SK_DefinePad(tapes[current].keys[f], tapes[current].keys[f+1]); } } else if (key & KEY_B) { done=TRUE; } } }