diff --git a/pfba/deps/libcross2d b/pfba/deps/libcross2d index e966ba0..0dc75d6 160000 --- a/pfba/deps/libcross2d +++ b/pfba/deps/libcross2d @@ -1 +1 @@ -Subproject commit e966ba0d2580284d1d62a05eb55f62af2b95d815 +Subproject commit 0dc75d630a460b827459ba8bf6a9629ff10c1026 diff --git a/pfba/gui/gui.h b/pfba/gui/gui.h index 9993ca8..b448d16 100644 --- a/pfba/gui/gui.h +++ b/pfba/gui/gui.h @@ -17,7 +17,7 @@ class Option; #define INPUT_DELAY 150 -#define STANDARD_LAYOUT +//#define STANDARD_LAYOUT class Gui { diff --git a/pfba/gui/romlist.cpp b/pfba/gui/romlist.cpp index fe04d64..4a0f249 100644 --- a/pfba/gui/romlist.cpp +++ b/pfba/gui/romlist.cpp @@ -10,25 +10,41 @@ #include "burner.h" #include "romlist.h" -RomList::RomList(Io *io, std::vector *hwList, const std::vector &paths) { +RomList::RomList(Io *io, std::vector *hwList, const std::vector &paths, Renderer *rdr, Skin *skin) { hardwareList = hwList; printf("RomList: building list...\n"); clock_t begin = clock(); + char szText[512]; + Rect rcText; + + memset(szText, 0, sizeof(szText)); + + rcText.x = 20; + rcText.w = rdr->width - 20 - 10; + rcText.y = rdr->height - 10 - skin->font->size; + rcText.h = skin->font->size; + std::vector files[DIRS_MAX]; for (unsigned int i = 0; i < paths.size(); i++) { if (!paths[i].empty()) { files[i] = io->GetDirList(paths[i].c_str()); printf("RomList: found %i files in `%s`\n", (int) files[i].size(), paths[i].c_str()); + + sprintf(szText, "Found %i files in %s", (int) files[i].size(), paths[i].c_str()); + rdr->Clear(); + DrawSplashScreen(rdr, skin); + skin->font->Draw(rcText, C2D_COL_WHITE, szText); + rdr->Flip(); } } char path[MAX_PATH]; char pathUppercase[MAX_PATH]; // sometimes on FAT32 short files appear as all uppercase // TODO: fix sorting speed so we don't skip first 24 roms - for (UINT32 i = 24; i < nBurnDrvCount; i++) { + for (UINT32 i = 0/*24*/; i < nBurnDrvCount; i++) { nBurnDrvActive = i; @@ -98,6 +114,17 @@ RomList::RomList(Io *io, std::vector *hwList, const std::vectorat(0).supported_count % 250 == 0) + { + sprintf(szText, "Roms: %i/%i | Clones: %i/%i", + hardwareList->at(0).available_count, hardwareList->at(0).supported_count, + hardwareList->at(0).available_clone_count, hardwareList->at(0).clone_count); + rdr->Clear(); + DrawSplashScreen(rdr, skin); + skin->font->Draw(rcText, C2D_COL_WHITE, szText); + rdr->Flip(); + } // if } /* @@ -113,6 +140,15 @@ RomList::RomList(Io *io, std::vector *hwList, const std::vectorat(0).available_count, hardwareList->at(0).supported_count, + hardwareList->at(0).available_clone_count, hardwareList->at(0).clone_count); + rdr->Clear(); + DrawSplashScreen(rdr, skin); + skin->font->Draw(rcText, C2D_COL_WHITE, szText); + rdr->Flip(); + rdr->Delay(2000); + clock_t end = clock(); double time_spent = (double) (end - begin) / CLOCKS_PER_SEC; printf("RomList: list built in %f\n", time_spent); @@ -121,3 +157,17 @@ RomList::RomList(Io *io, std::vector *hwList, const std::vectorwidth, rdr->height}; + + rdr->DrawRect(rcScreen, C2D_COL_GRAY); + rdr->DrawRect(rcScreen, C2D_COL_ORANGE, false); + if (skin->tex_title->available) + { + rcScreen.h -= 32; + skin->tex_title->Draw(rcScreen, true); + } // if +} // End of DrawSplashScreen + diff --git a/pfba/gui/romlist.h b/pfba/gui/romlist.h index 50e5592..078f3d9 100644 --- a/pfba/gui/romlist.h +++ b/pfba/gui/romlist.h @@ -10,6 +10,8 @@ #include "burner.h" #define HARDWARE_PREFIX_ALL 0xffffffff +#include "skin.h" + class RomList { public: @@ -32,9 +34,11 @@ class RomList { }; RomList(Io *io, std::vector *hwList, - const std::vector &paths); + const std::vector &paths, Renderer *rdr, Skin *skin); ~RomList(); + void DrawSplashScreen(Renderer *rdr, Skin *skin); + enum RomState { NOT_WORKING = 0, MISSING, diff --git a/pfba/input.cpp b/pfba/input.cpp index 47f7677..1075b47 100644 --- a/pfba/input.cpp +++ b/pfba/input.cpp @@ -6,6 +6,7 @@ unsigned char inputP1P2Switch; #define MAX_INPUT_inp (17) +/// www.SoftechSoftware.it #define MAX_GAME_INPUT (6) struct GameInput { @@ -26,6 +27,7 @@ struct DIPInfo { struct GameInput *DIPData; } DIPInfo; // Mapping of PC inputs to game inputs +/// www.SoftechSoftware.it struct GameInput GameInput[MAX_GAME_INPUT/*4*/][MAX_INPUT_inp]; unsigned int nGameInpCount = 0; static bool bInputOk = false; @@ -33,6 +35,17 @@ unsigned char *ServiceDip = 0; unsigned char *P1Start = 0; unsigned char *P2Start = 0; +void WriteToLog2(char *lpszText) +{ + FILE *stream = fopen("ux0:/ROMs/a.txt", "at"); + + if(stream != NULL) + { + fprintf(stream, lpszText); + fclose(stream); + } // if +} // End of WriteToLog + int DoInputBlank(int /*bDipSwitch*/) { int iJoyNum = 0; unsigned int i = 0; @@ -52,6 +65,7 @@ int DoInputBlank(int /*bDipSwitch*/) { //if (bDipSwitch==0 && bii.nType==2) continue; // Don't blank the dip switches if (bii.nType == BIT_DIPSWITCH) { +WriteToLog2("BIT_DIPSWITCH\r\n"); if (DIPInfo.nDIP == 0) { DIPInfo.nFirstDIP = i; DIPInfo.nDIP = nGameInpCount - i; @@ -64,10 +78,12 @@ int DoInputBlank(int /*bDipSwitch*/) { DIPInfo.DIPData[i - DIPInfo.nFirstDIP].nBit = 0; } - if ((bii.szInfo[0] == 'p') || (bii.szInfo[0] == 'm')) { + if ((bii.szInfo[0] == 'p') || (bii.szInfo[0] == 'm')) + { if (bii.szInfo[0] == 'm') iJoyNum = 0; else iJoyNum = bii.szInfo[1] - '1'; - ///if (iJoyNum > 3) iJoyNum = 3; // Sperimental fix - } + /// www.SoftechSoftware.it + ///if (iJoyNum > 3) iJoyNum = 3; // Sperimental fix + } else { if (strcmp(bii.szInfo, "diag") == 0 || strcmp(bii.szInfo, "test") == 0) { ServiceDip = bii.pVal; @@ -257,6 +273,7 @@ int InpInit() { } } + /// www.SoftechSoftware.it memset(GameInput, 0, MAX_INPUT_inp * MAX_GAME_INPUT/*4*/ * sizeof(struct GameInput)); DoInputBlank(1); @@ -351,6 +368,7 @@ void InpDIP() { struct GameInput *pgi; int i, j; int nDIPOffset = 0; +WriteToLog2("Step 1.0\r\n"); // get dip switch offset for (i = 0; BurnDrvGetDIPInfo(&bdi, i) == 0; i++) @@ -358,15 +376,18 @@ void InpDIP() { nDIPOffset = bdi.nInput; break; } +WriteToLog2("Step 1.1\r\n"); // set DIP to default i = 0; bool bDifficultyFound = false; while (BurnDrvGetDIPInfo(&bdi, i) == 0) { +WriteToLog2("Step 1.2\r\n"); //printf("%2d. %02x '%s'\n", bdi.nInput, bdi.nFlags, bdi.szText); if (bdi.nFlags == 0xFF) { +WriteToLog2("Step 1.3\r\n"); pgi = DIPInfo.DIPData + (bdi.nInput + nDIPOffset - DIPInfo.nFirstDIP); pgi->nConst = (pgi->nConst & ~bdi.nMask) | (bdi.nSetting & bdi.nMask); } else if (bdi.nFlags == 0xFE) { @@ -379,6 +400,7 @@ void InpDIP() { } else { if (bDifficultyFound) { if (bdi.nFlags == 0x01) { +WriteToLog2("Step 1.4\r\n"); // use GameScreenMode store pgi = DIPInfo.DIPData + (bdi.nInput + nDIPOffset - DIPInfo.nFirstDIP); @@ -394,9 +416,11 @@ void InpDIP() { } i++; } +WriteToLog2("Step 1.5\r\n"); for (i = 0, pgi = DIPInfo.DIPData; i < (int) DIPInfo.nDIP; i++, pgi++) { if (pgi->pVal == NULL) continue; *(pgi->pVal) = pgi->nConst; } +WriteToLog2("Step 1.6\r\n"); } \ No newline at end of file diff --git a/pfba/main.cpp b/pfba/main.cpp index 9a9bb77..edb77c6 100644 --- a/pfba/main.cpp +++ b/pfba/main.cpp @@ -115,13 +115,13 @@ int main(int argc, char **argv) { cfgPath += "pfba.cfg"; config = new Config(cfgPath, renderer); - // build/init roms list - romList = new RomList(io, &config->hardwareList, config->GetRomPaths()); - // skin int size = config->GetGuiValue(Option::Index::SKIN_FONT_SIZE); Skin *skin = new Skin(renderer, szAppSkinPath, size, buttons); + // build/init roms list + romList = new RomList(io, &config->hardwareList, config->GetRomPaths(), renderer, skin); + // run gui gui = new Gui(io, renderer, skin, romList, config, inp); #ifdef __PSP2__ // prevent rom list scrolling lag on psp2 diff --git a/pfba/run.cpp b/pfba/run.cpp index 74a64b0..d51d0b1 100644 --- a/pfba/run.cpp +++ b/pfba/run.cpp @@ -40,6 +40,17 @@ int InpMake(Input::Player *players); struct timeval start; +void WriteToLog(char *lpszText) +{ + FILE *stream = fopen("ux0:/ROMs/a.txt", "at"); + + if(stream != NULL) + { + fprintf(stream, lpszText); + fclose(stream); + } // if +} // End of WriteToLog + void StartTicks(void) { gettimeofday(&start, NULL); } @@ -302,9 +313,12 @@ void RunEmulator(Gui *g, int drvnum) { if (gui->GetConfig()->GetRomValue(Option::Index::ROM_AUDIO)) { nBurnSoundRate = 48000; } +WriteToLog("Step 1\r\n"); InpInit(); +WriteToLog("Step 2\r\n"); InpDIP(); +WriteToLog("Step 3\r\n"); printf("Initialize rom driver\n"); if (DrvInit(drvnum, false) != 0) { @@ -316,6 +330,7 @@ void RunEmulator(Gui *g, int drvnum) { InpExit(); return; } +WriteToLog("Step 4\r\n"); printf("bForce60Hz = %i, nBurnFPS = %d\n", bForce60Hz, nBurnFPS); diff --git a/src/burn/drv/megadrive/megadrive.cpp b/src/burn/drv/megadrive/megadrive.cpp index 33595cf..9247268 100644 --- a/src/burn/drv/megadrive/megadrive.cpp +++ b/src/burn/drv/megadrive/megadrive.cpp @@ -3898,6 +3898,20 @@ static void DrawSpritesFromCache(INT32 *hc, INT32 sh) } } +/* +/// www.SoftechSoftware.it +void WriteToLog(char *lpszText) +{ + FILE *stream = fopen("ux0:/ROMs/a.txt", "at"); + + if(stream != NULL) + { + fprintf(stream, lpszText); + fclose(stream); + } // if +} // End of WriteToLog +*/ + // Index + 0 : ----hhvv -lllllll -------y yyyyyyyy // Index + 4 : -------x xxxxxxxx pccvhnnn nnnnnnnn // v diff --git a/src/burn/drv/msx/d_msx.cpp b/src/burn/drv/msx/d_msx.cpp index 256015c..ebe4847 100644 --- a/src/burn/drv/msx/d_msx.cpp +++ b/src/burn/drv/msx/d_msx.cpp @@ -1342,9 +1342,9 @@ static INT32 MemIndex() RamEnd = Next; - pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); - pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16); + pAY8910Buffer[0] = (INT16*)Next; Next += (nBurnSoundLen+256) * sizeof(INT16); + pAY8910Buffer[1] = (INT16*)Next; Next += (nBurnSoundLen+256) * sizeof(INT16); + pAY8910Buffer[2] = (INT16*)Next; Next += (nBurnSoundLen+256) * sizeof(INT16); MemEnd = Next; diff --git a/src/burn/drv/snes/d_snes.cpp b/src/burn/drv/snes/d_snes.cpp index b3ef41b..54c5d39 100644 --- a/src/burn/drv/snes/d_snes.cpp +++ b/src/burn/drv/snes/d_snes.cpp @@ -1,6 +1,7 @@ #include "snes.h" unsigned char DoSnesReset = 0; +UINT8 DrvDips[1]; unsigned char SnesJoy1[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static struct BurnInputInfo SnesInputList[] = @@ -18,6 +19,7 @@ static struct BurnInputInfo SnesInputList[] = {"P1 Button Z", BIT_DIGITAL, SnesJoy1 + 8, "p1 fire 6" }, {"P1 Mode", BIT_DIGITAL, SnesJoy1 + 11, "p1 select" }, {"Reset" , BIT_DIGITAL , &DoSnesReset , "reset" }, + {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"}, }; STDINPUTINFO(Snes) @@ -38,7 +40,7 @@ static struct BurnRomInfo rSuperMarioWorldEuropeRev1RomDesc[] = { STD_ROM_PICK(rSuperMarioWorldEuropeRev1) STD_ROM_FN(rSuperMarioWorldEuropeRev1) -struct BurnDriverD BurnDrvrSMW = { +struct BurnDriver BurnDrvrSMW = { "smw", NULL, NULL, NULL, "1986", "Super Mario World (Europe) (Rev 1)\0", NULL, "Nintendo", "Miscellaneous", L"Super Mario World (Europe) (Rev 1)", NULL, NULL, NULL, @@ -56,7 +58,7 @@ static struct BurnRomInfo rSuperMarioWorldEuropeRomDesc[] = { STD_ROM_PICK(rSuperMarioWorldEurope) STD_ROM_FN(rSuperMarioWorldEurope) -struct BurnDriverD BurnDrvrSuperMarioWorldEurope = { +struct BurnDriver BurnDrvrSuperMarioWorldEurope = { "smwa", NULL, NULL, NULL, "1986", "Super Mario World (Europe)\0", NULL, "Nintendo", "Miscellaneous", L"Super Mario World (Europe)", NULL, NULL, NULL, @@ -74,7 +76,7 @@ static struct BurnRomInfo rSuperMarioWorldJapanRomDesc[] = { STD_ROM_PICK(rSuperMarioWorldJapan) STD_ROM_FN(rSuperMarioWorldJapan) -struct BurnDriverD BurnDrvrSuperMarioWorldJapan = { +struct BurnDriver BurnDrvrSuperMarioWorldJapan = { "smwj", NULL, NULL, NULL, "1986", "Super Mario World (Japan)\0", NULL, "Nintendo", "Miscellaneous", L"Super Mario World (Japan)", NULL, NULL, NULL, @@ -92,7 +94,7 @@ static struct BurnRomInfo rSuperMarioWorldUSARomDesc[] = { STD_ROM_PICK(rSuperMarioWorldUSA) STD_ROM_FN(rSuperMarioWorldUSA) -struct BurnDriverD BurnDrvrSuperMarioWorldUSA = { +struct BurnDriver BurnDrvrSuperMarioWorldUSA = { "smwu", NULL, NULL, NULL, "1986", "Super Mario World (USA)\0", NULL, "Nintendo", "Miscellaneous", L"Super Mario World (USA)", NULL, NULL, NULL,