Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pfba/deps/libcross2d
2 changes: 1 addition & 1 deletion pfba/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Option;

#define INPUT_DELAY 150

#define STANDARD_LAYOUT
//#define STANDARD_LAYOUT

class Gui {

Expand Down
54 changes: 52 additions & 2 deletions pfba/gui/romlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,41 @@
#include "burner.h"
#include "romlist.h"

RomList::RomList(Io *io, std::vector<Hardware> *hwList, const std::vector<std::string> &paths) {
RomList::RomList(Io *io, std::vector<Hardware> *hwList, const std::vector<std::string> &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<std::string> 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;

Expand Down Expand Up @@ -98,6 +114,17 @@ RomList::RomList(Io *io, std::vector<Hardware> *hwList, const std::vector<std::s
}

list.push_back(rom);

if (hardwareList->at(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
}

/*
Expand All @@ -113,6 +140,15 @@ RomList::RomList(Io *io, std::vector<Hardware> *hwList, const std::vector<std::s
files[i].clear();
}

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();
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);
Expand All @@ -121,3 +157,17 @@ RomList::RomList(Io *io, std::vector<Hardware> *hwList, const std::vector<std::s
RomList::~RomList() {
list.clear();
}

void RomList::DrawSplashScreen(Renderer *rdr, Skin *skin)
{
Rect rcScreen{0, 0, rdr->width, 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

6 changes: 5 additions & 1 deletion pfba/gui/romlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "burner.h"
#define HARDWARE_PREFIX_ALL 0xffffffff

#include "skin.h"

class RomList {

public:
Expand All @@ -32,9 +34,11 @@ class RomList {
};

RomList(Io *io, std::vector<Hardware> *hwList,
const std::vector<std::string> &paths);
const std::vector<std::string> &paths, Renderer *rdr, Skin *skin);
~RomList();

void DrawSplashScreen(Renderer *rdr, Skin *skin);

enum RomState {
NOT_WORKING = 0,
MISSING,
Expand Down
30 changes: 27 additions & 3 deletions pfba/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ unsigned char inputP1P2Switch;

#define MAX_INPUT_inp (17)

/// www.SoftechSoftware.it
#define MAX_GAME_INPUT (6)

struct GameInput {
Expand All @@ -26,13 +27,25 @@ 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;
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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -257,6 +273,7 @@ int InpInit() {
}
}

/// www.SoftechSoftware.it
memset(GameInput, 0, MAX_INPUT_inp * MAX_GAME_INPUT/*4*/ * sizeof(struct GameInput));
DoInputBlank(1);

Expand Down Expand Up @@ -351,22 +368,26 @@ 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++)
if (bdi.nFlags == 0xF0) {
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) {
Expand All @@ -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);
Expand All @@ -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");
}
6 changes: 3 additions & 3 deletions pfba/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions pfba/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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);

Expand Down
14 changes: 14 additions & 0 deletions src/burn/drv/megadrive/megadrive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/burn/drv/msx/d_msx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 6 additions & 4 deletions src/burn/drv/snes/d_snes.cpp
Original file line number Diff line number Diff line change
@@ -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[] =
Expand All @@ -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)
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down