diff --git a/Makefile b/Makefile index 333ae07..32107ac 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=1.9a +VERSION=2.0 #--------------------------------------------------------------------------------- .SUFFIXES: diff --git a/XEGS-DS.nds b/XEGS-DS.nds index dac0b2a..ad0cf43 100644 Binary files a/XEGS-DS.nds and b/XEGS-DS.nds differ diff --git a/arm9/gfx/bgBottom.png b/arm9/gfx/bgBottom.png index fe1c69e..eecd869 100644 Binary files a/arm9/gfx/bgBottom.png and b/arm9/gfx/bgBottom.png differ diff --git a/arm9/gfx/pdev_bg0.png b/arm9/gfx/pdev_bg0.png index aa896db..7b74352 100644 Binary files a/arm9/gfx/pdev_bg0.png and b/arm9/gfx/pdev_bg0.png differ diff --git a/arm9/source/8bitutils.c b/arm9/source/8bitutils.c index 7cf60ac..96cc834 100644 --- a/arm9/source/8bitutils.c +++ b/arm9/source/8bitutils.c @@ -117,7 +117,7 @@ char last_filename[300] = {0}; void dsWriteFavs(int xpos) { #if 0 - dsPrintValue(xpos,0,0, (char*)"FAVS SAVE"); + dsPrintValue(xpos,0,0, (char*)"FAV SAVE"); FILE *fp; fp = fopen("/roms/A800-Favs.txt", "a+"); if (fp != NULL) @@ -127,14 +127,13 @@ void dsWriteFavs(int xpos) fclose(fp); } #else - dsPrintValue(xpos,0,0, (char*)"CONFIG SAVE"); + dsPrintValue(xpos,0,0, (char*)"CFG SAVE"); WriteGameSettings(); #endif WAITVBL;WAITVBL;WAITVBL;WAITVBL;WAITVBL; - dsPrintValue(xpos,0,0, (char*)" "); + dsPrintValue(xpos,0,0, (char*)" "); } - void dsClearDiskActivity(void) { char buf[5]; @@ -561,17 +560,41 @@ void dsShowRomInfo(void) sprintf(line2,"%-22s", line1); dsPrintValue(10,3,0, line2); - dsPrintValue(10,6,0, "D1: "); + sprintf(line1, "D1: %s", (disk_readonly[DISK_1] ? "[R]":"[W]")); + dsPrintValue(10,6,0, line1); strncpy(line1, disk_filename[DISK_1], 22); line1[22] = 0; sprintf(line2,"%-22s", line1); dsPrintValue(10,7,0, line2); + if (strlen(disk_filename[DISK_1]) > 26) + { + strncpy(line1, &disk_filename[DISK_1][22], 22); + line1[22] = 0; + sprintf(line2,"%-22s", line1); + } + else + { + sprintf(line2,"%-22s", " "); + } + dsPrintValue(10,8,0, line2); - dsPrintValue(10,11,0, "D2: "); + sprintf(line1, "D2: %s", (disk_readonly[DISK_2] ? "[R]":"[W]")); + dsPrintValue(10,11,0, line1); strncpy(line1, disk_filename[DISK_2], 22); line1[22] = 0; sprintf(line2,"%-22s", line1); dsPrintValue(10,12,0, line2); + if (strlen(disk_filename[DISK_2]) > 26) + { + strncpy(line1, &disk_filename[DISK_2][22], 22); + line1[22] = 0; + sprintf(line2,"%-22s", line1); + } + else + { + sprintf(line2,"%-22s", " "); + } + dsPrintValue(10,13,0, line2); sprintf(line2, "%-5s %-4s %-4s", (bHaveBASIC ? "BASIC":" "), (ram_size == RAM_128K ? "128K":"320K"), (tv_mode == TV_NTSC ? "NTSC":"PAL ")); dsPrintValue(12,0,0, line2); @@ -580,7 +603,7 @@ void dsShowRomInfo(void) #define HASH_FILE_LEN (128*1024) unsigned char tempFileBuf[HASH_FILE_LEN]; -unsigned char last_hash[33]; +unsigned char last_hash[33] = {'1','2','3','4','5','Z',0}; void dsLoadGame(char *filename, int disk_num, bool bRestart, bool bReadOnly) { if (strcmp(filename, last_filename) != 0) @@ -591,14 +614,17 @@ void dsLoadGame(char *filename, int disk_num, bool bRestart, bool bReadOnly) } } - // Get the hash of the file... up to 128k (good enough) - memset(last_hash, 'Z', 33); - FILE *fp = fopen(filename, "rb"); - if (fp) - { - unsigned int file_len = fread(tempFileBuf, 1, HASH_FILE_LEN, fp); - hash_Compute((const byte*)tempFileBuf, file_len, (byte *)last_hash); - fclose(fp); + if (disk_num != DISK_2) // Never save D2 as the boot disk... + { + // Get the hash of the file... up to 128k (good enough) + memset(last_hash, 'Z', 33); + FILE *fp = fopen(filename, "rb"); + if (fp) + { + unsigned int file_len = fread(tempFileBuf, 1, HASH_FILE_LEN, fp); + hash_Compute((const byte*)tempFileBuf, file_len, (byte *)last_hash); + fclose(fp); + } } // Free buffer if needed @@ -787,7 +813,6 @@ void dsChooseOptions(int bOkayToChangePalette) if (Option_Table[idx].label == NULL) break; } - dsPrintValue(2,22, 0, " UP/DOWN TO SELECT OPTION "); dsPrintValue(2,23, 0, "A=TOGGLE, B=EXIT, START=SAVE"); optionHighlighted = 0; while (!bDone) @@ -891,8 +916,11 @@ void dsDisplayLoadOptions(void) dsPrintValue(19,0,0,tmpBuf); sprintf(tmpBuf, "[%c] READ-ONLY", (bLoadReadOnly ? 'X':' ')); dsPrintValue(14,1,0,tmpBuf); - sprintf(tmpBuf, "[%c] BOOT LOAD", (bLoadAndBoot ? 'Y':' ')); - dsPrintValue(14,2,0,tmpBuf); + if (strcmp(file_load_id,"D2")!=0) // For D2: we don't allow boot load + { + sprintf(tmpBuf, "[%c] BOOT LOAD", (bLoadAndBoot ? 'Y':' ')); + dsPrintValue(14,2,0,tmpBuf); + } } void dsDisplayFiles(unsigned int NoDebGame,u32 ucSel) @@ -952,14 +980,23 @@ unsigned int dsWaitForRom(void) nbRomPerPage = (count8bit>=17 ? 17 : count8bit); uNbRSPage = (count8bit>=5 ? 5 : count8bit); - if (ucFicAct>count8bit-nbRomPerPage) { + if (ucFicAct>count8bit) + { + firstRomDisplay=0; + ucFicAct=0; + romSelected=0; + } + if (ucFicAct>count8bit-nbRomPerPage) + { firstRomDisplay=count8bit-nbRomPerPage; romSelected=ucFicAct-count8bit+nbRomPerPage; } - else { + else + { firstRomDisplay=ucFicAct; romSelected=0; } + dsDisplayFiles(firstRomDisplay,romSelected); while (!bDone) { if (keysCurrent() & KEY_UP) { @@ -1115,11 +1152,14 @@ unsigned int dsWaitForRom(void) static int last_y_key = 0; if (keysCurrent() & KEY_Y) { - if (last_y_key != KEY_Y) + if (strcmp(file_load_id,"D2")!=0) // For D2: we don't allow boot load { - bLoadAndBoot = (bLoadAndBoot ? false:true); - dsDisplayLoadOptions(); - last_y_key = KEY_Y; + if (last_y_key != KEY_Y) + { + bLoadAndBoot = (bLoadAndBoot ? false:true); + dsDisplayLoadOptions(); + last_y_key = KEY_Y; + } } } else last_y_key = 0; @@ -1223,6 +1263,12 @@ unsigned int dsWaitOnMenu(unsigned int actState) { dsChooseOptions(FALSE); } + else if ((iTx>230) && (iTx<256) && (iTy>8) && (iTy<30)) // POWER / QUIT + { + soundPlaySample(clickNoQuit_wav, SoundFormat_16Bit, clickNoQuit_wav_size, 22050, 127, 64, false, 0); + bDone=dsWaitOnQuit(); + if (bDone) uState=A8_QUITSTDS; + } else if ((iTx>5) && (iTx<80) && (iTy>12) && (iTy<75)) // cartridge slot (wide range) { bDone=true; @@ -1627,17 +1673,7 @@ ITCM_CODE void dsMainLoop(void) } else { - if ((iTx>240) && (iTx<256) && (iTy>0) && (iTy<18)) // Full Speed Toggle ... upper corner... - { - if (keys_touch == 0) - { - full_speed = 1-full_speed; - if (full_speed) showFps=1; - dsPrintValue(30,0,0," "); - keys_touch = 1; - } - } - else if ((iTx>=0) && (iTx<16) && (iTy>0) && (iTy<18)) // Show FPS + if ((iTx>=0) && (iTx<16) && (iTy>0) && (iTy<18)) // Show FPS { if (keys_touch == 0) { @@ -1677,7 +1713,7 @@ ITCM_CODE void dsMainLoop(void) bShowKeyboard = true; keys_touch = 1; } - else if ((iTx>999) && (iTx<56) && (iTy>89) && (iTy<106)) // POWER TODO:zzz + else if ((iTx>230) && (iTx<256) && (iTy>8) && (iTy<30)) // POWER / QUIT { irqDisable(IRQ_TIMER2); fifoSendValue32(FIFO_USER_01,(1<<16) | (0) | SOUND_SET_VOLUME); soundPlaySample(clickNoQuit_wav, SoundFormat_16Bit, clickNoQuit_wav_size, 22050, 127, 64, false, 0); @@ -1741,7 +1777,7 @@ ITCM_CODE void dsMainLoop(void) { if ((keys_pressed & KEY_R) && (keys_pressed & KEY_L)) { - dsWriteFavs(4); + dsWriteFavs(3); } if ((keys_pressed & KEY_R) && (keys_pressed & KEY_UP)) myGame_offset_y++; if ((keys_pressed & KEY_R) && (keys_pressed & KEY_DOWN)) myGame_offset_y--; @@ -1787,12 +1823,19 @@ int a8Filescmp (const void *c1, const void *c2) { void a8FindFiles(void) { + static bool bFirstTime = true; DIR *pdir; struct dirent *pent; char filenametmp[300]; count8bit = countfiles= 0; + // First time load... get into the root directory for easy navigation... + if (bFirstTime) + { + bFirstTime = false; + //TODO: Not sure on this yet... chdir("/"); + } pdir = opendir("."); if (pdir) { @@ -1829,7 +1872,15 @@ void a8FindFiles(void) closedir(pdir); } if (count8bit) + { qsort (a8romlist, count8bit, sizeof (FICA_A8), a8Filescmp); + } + else // Failsafe... always provide a back directory... + { + a8romlist[count8bit].directory = true; + strcpy(a8romlist[count8bit].filename,".."); + count8bit = 1; + } } #define MAX_GAME_SETTINGS 1870 diff --git a/arm9/source/emu/atari.c b/arm9/source/emu/atari.c index bb64d26..54b7977 100644 --- a/arm9/source/emu/atari.c +++ b/arm9/source/emu/atari.c @@ -61,6 +61,7 @@ int disable_basic = TRUE; int skip_frames = FALSE; char disk_filename[DISK_MAX][256]; +int disk_readonly[DISK_MAX] = {true,true,true}; void Warmstart(void) { @@ -139,6 +140,7 @@ int Atari800_OpenFile(const char *filename, int reboot, int diskno, int readonly case AFILE_ATR: strcpy(disk_filename[DISK_XEX], "EMPTY"); strcpy(disk_filename[diskno], filename); + disk_readonly[diskno] = readonly; if (!SIO_Mount(diskno, filename, readonly)) return AFILE_ERROR; if (reboot) @@ -167,6 +169,11 @@ int Atari800_Initialise(void) strcpy(disk_filename[DISK_XEX], "EMPTY"); strcpy(disk_filename[DISK_1], "EMPTY"); strcpy(disk_filename[DISK_2], "EMPTY"); + + disk_readonly[DISK_XEX] = true; + disk_readonly[DISK_1] = true; + disk_readonly[DISK_2] = true; + INPUT_Initialise(); diff --git a/arm9/source/emu/atari.h b/arm9/source/emu/atari.h index 89e06f0..5356678 100644 --- a/arm9/source/emu/atari.h +++ b/arm9/source/emu/atari.h @@ -24,6 +24,7 @@ extern int os_type; #define DISK_MAX 3 extern char disk_filename[DISK_MAX][256]; +extern int disk_readonly[DISK_MAX]; /* Fundamental declarations ---------------------------------------------- */ diff --git a/readme.txt b/readme.txt index 9d664d8..38718a6 100644 --- a/readme.txt +++ b/readme.txt @@ -77,6 +77,10 @@ With those 4 tips, you should be able to get 99% of all games running. There are -------------------------------------------------------------------------------- History : -------------------------------------------------------------------------------- +V2.0 : 19-Mar-2021 by wavemotion-dave + * Major overhaul of UI. + * Added second disk drive. + V1.9 : 06-Mar-2021 by wavemotion-dave * New options for B button = DOWN and Key Click Off. * Improved handling for key clicks so that press and hold will auto-repeat.