#include #include #include #include #include #include #define MAX_ROMS 4000 #define ROMS_PER_COLUMN 22 #define NUM_COLS 6 //---------------------------------------------------------------------------- void redrawScreen(char romnames[MAX_ROMS][9], int romcount, int romdisplayindex, int romselectionindex) { int row,col,temp; int barstart,barend; int i; //--------- //rom names //--------- for (col=0 ; col=romcount) cprintf(" "); else cprintf("%s%s",romnames[temp],&" \0"[strlen(romnames[temp])]); } } //--------- //scrollbar //--------- textattr(0x3f); gotoxy(64,23); cprintf("%c",0x1A); gotoxy(1,23); cprintf("%c",0x1B); barstart = 62*min(romdisplayindex*ROMS_PER_COLUMN,romcount)/romcount; barend = 62*min((romdisplayindex+NUM_COLS)*ROMS_PER_COLUMN,romcount)/romcount; textattr(0x30); for (i=0 ; i0) { strcpy(temp,romnames[j-1]); strcpy(romnames[j-1],romnames[j]); strcpy(romnames[j],temp); } } } } //------------------------------------------------------------------------------------------- // Main entry point. There's no commandline args used int main(int argc, char *argv[]) { //The resultant commandline char *cmdline; //The names and number of all available roms char romnames[MAX_ROMS][9]; int romcount=0; //Stuff for the ui int romdisplayindex=0; int romselectionindex=0; char selectedrom[9]={0,0,0,0,0,0,0,0,0}; //Temp vars struct find_t find_t; FILE *f; int i,j; initialise_joysticks(); //Read in the current rom name... f=fopen("bootmame.cfg","r"); if (f!=NULL) { fread(selectedrom, 1, 8, f); fclose(f); } read_joystick(); //Launch the set up if joy buttons A&B are being held down if (strlen(selectedrom)==0 || (joyA.B1 && joyA.B2)) { //Get the rom names... for (i=_dos_findfirst("roms\\*.zip", _A_NORMAL, &find_t) ; !i && romcount0) { for (i=0 ; iromselectionindex) romdisplayindex--; while ((romdisplayindex+NUM_COLS)*ROMS_PER_COLUMN %s\n",cmdline); system(cmdline); }