Beispiel #1
0
// Add a game to Favorites
void AddToFavorites() 
{
	int nIndex = ListView_GetItemCount(hFavListView);						// index of the new favorite listview item

	TCHAR* ItemRomname		= BurnDrvGetText(DRV_NAME);						// Romset Name
#if defined (_UNICODE)
	TCHAR* ItemTitle		= BurnDrvGetText(DRV_FULLNAME);					// Unicode Game Title
#else
	TCHAR* ItemTitle		= BurnDrvGetText(DRV_ASCIIONLY | DRV_FULLNAME);	// ASCII Game Title
#endif
	TCHAR* ItemHardware		= BurnDrvGetText(DRV_SYSTEM);					// Game Hardware / System
	TCHAR* ItemYear			= BurnDrvGetText(DRV_DATE);						// Year
	TCHAR* ItemCompany		= BurnDrvGetText(DRV_MANUFACTURER);				// Manufacturer / Company
	
	TCHAR szItemMaxPlayers[5];
	_stprintf(szItemMaxPlayers, _T("%i"), BurnDrvGetMaxPlayers());			// Max Players
	TCHAR* ItemMaxPlayers	= szItemMaxPlayers;

	TCHAR szPlayCounter[5];
	_stprintf(szPlayCounter,	_T("%i"), 0);								// Play Counter (Zero because there isn't another counter in FBA)
	TCHAR* ItemPlayCounter	= szPlayCounter;

	LVITEM LvItem;
	memset(&LvItem, 0, sizeof(LvItem));
	LvItem.mask = LVIF_TEXT;
	LvItem.cchTextMax = 256;
	LvItem.iItem = nIndex;

	// Add Romname, Title and Hardware of the selected game to the Favorites List
	for (int nColumn = 0; nColumn < LV_MAX_COLS; nColumn++) {
		LvItem.iSubItem = nColumn;
		switch (nColumn) {
			case 1: LvItem.pszText = ItemTitle;			break;
			case 2: LvItem.pszText = ItemHardware;		break;
			case 3: LvItem.pszText = ItemYear;			break;
			case 4: LvItem.pszText = ItemCompany;		break;
			case 5: LvItem.pszText = ItemMaxPlayers;	break;
			case 6: LvItem.pszText = ItemPlayCounter;	break;
		}
		if(nColumn == 0) {
			LvItem.pszText = ItemRomname; 
			SendMessage(hFavListView, LVM_INSERTITEM,0,(LPARAM)&LvItem);
			SendMessage(hFavListView, LVM_SETITEM, 0, (LPARAM)&LvItem);
		} else {
			SendMessage(hFavListView, LVM_SETITEM, 0, (LPARAM)&LvItem);
		}
	}					
	SaveFavListAlt();		// Save the Favorite Games List
	RefreshFavGameList();	// Refresh Favorite Games List	
}
Beispiel #2
0
int DrvInit(int nDrvNum, bool bRestore)
{
	int nStatus;
    bDrvOkay = 0;
	
	DrvExit();						// Make sure exitted
	nBurnDrvActive = nDrvNum;		// Set the driver number

    nMaxPlayers = BurnDrvGetMaxPlayers();
    GameInpInit();					// Init game input
    if (ConfigGameLoad(true)) {
        ConfigGameLoadHardwareDefaults();
    }
    InputMake(true);
    GameInpDefault();

	nStatus = DoLibInit();			// Init the Burn library's driver
	if (nStatus) {
		if (nStatus & 2) {
			BurnDrvExit();			// Exit the driver
		}
		return 1;
	}



	BurnExtLoadRom = DrvLoadRom;

	bDrvOkay = 1;						// Okay to use all BurnDrv functions

	if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
		bVidArcaderes = bVidArcaderesVer;
		nVidWidth	= nVidVerWidth;
		nVidHeight	= nVidVerHeight;
	} else {
		bVidArcaderes = bVidArcaderesHor;
		nVidWidth	= nVidHorWidth;
		nVidHeight	= nVidHorHeight;
	}

	nBurnLayer = 0xFF;				// show all layers
	
	// Reset the speed throttling code, so we don't 'jump' after the load
    //RunReset();
	VidExit();
	return 0;
}
Beispiel #3
0
int DrvInit(int nDrvNum, bool bRestore)
{
	DrvExit();						// Make sure exitted
//	AudSoundInit();						// Init Sound (not critical if it fails)

	nBurnSoundRate = 0;					// Assume no sound
	pBurnSoundOut = NULL;
//	if (bAudOkay) {
//		nBurnSoundRate = nAudSampleRate;
//		nBurnSoundLen = nAudSegLen;
//	}
	nBurnDrvSelect[0] = nDrvNum;		// Set the driver number

	// Define nMaxPlayers early; GameInpInit() needs it (normally defined in DoLibInit()).
	nMaxPlayers = BurnDrvGetMaxPlayers();
//	GameInpInit();					// Init game input

//	ConfigGameLoad(true);
//	InputMake(true);

//	GameInpDefault();
SndInit();

	if (DoLibInit()) {				// Init the Burn library's driver
		char szTemp[512];

		BurnDrvExit();				// Exit the driver

		_stprintf (szTemp, _T("There was an error starting '%s'.\n"), BurnDrvGetText(DRV_FULLNAME));
		return 1;
	}

	BurnExtLoadRom = DrvLoadRom;

	bDrvOkay = 1;					// Okay to use all BurnDrv functions

	bSaveRAM = false;
	nBurnLayer = 0xFF;				// show all layers

	// Reset the speed throttling code, so we don't 'jump' after the load
	RunReset();
	return 0;
}
Beispiel #4
0
// Favorite Game List parsing module
int ParseFavListDat() 
{
	FILE *fp = _tfopen(_T("config\\favorites.dat"), _T("r"));	// not 'rb' anymore, there's no need
	if(!fp) return 1;								// failed to open file

	int x					= 0;
	int nLineNum			= 0;

	TCHAR  szLine[1000];
	TCHAR* pch				= NULL;
	TCHAR* str				= NULL;
	TCHAR* pszDrvName		= NULL;
	TCHAR* pszPlayCounter	= NULL;

	while (1)
	{	
		if (!_fgetts(szLine, 1000, fp)) break;						// If there are no more lines, break loop
		if (!_tcsncmp (_T("[Favorites]"), szLine, 11)) continue;	// Not parsing '[Favorites]' line, so continue with the other lines

		// Split the current line to send each value to the proper string variables
		str = szLine;
		pch = _tcstok(str, _T(";"));

		while(pch != NULL)
		{
			if(x == 0) pszDrvName		= pch;	// Driver name (Ex. mvsc)
			if(x == 1) pszPlayCounter	= pch;	// Play Counter

			pch							= _tcstok(NULL, _T(";"));
			x++;
		}
		x = 0; // reset this to zero for next line

		// Get the favorite game info from FBA itself not from text strings, this is the proper way
		// ---------------------------------------------------------------------------------------------------------
		int nBurnDrvSelectOld = nBurnDrvSelect;

		for (unsigned int nDrvCheck = 0; nDrvCheck < nBurnDrvCount; nDrvCheck++)
		{
			nBurnDrvSelect = nDrvCheck;
			if (!_tcscmp(BurnDrvGetText(DRV_NAME), pszDrvName)) break;
		}

		FavDrvSetContent(FAV_DRV_NAME, nLineNum, BurnDrvGetText(DRV_NAME), -2);
#if defined (_UNICODE)
		FavDrvSetContent(FAV_DRV_TITLE, nLineNum, BurnDrvGetText(DRV_FULLNAME), -2);					// Unicode Game Title
#else
		FavDrvSetContent(FAV_DRV_TITLE, nLineNum, BurnDrvGetText(DRV_ASCIIONLY | DRV_FULLNAME), -2);	// ASCII Game Title
#endif
		FavDrvSetContent(FAV_DRV_HARDWARE, nLineNum, BurnDrvGetText(DRV_SYSTEM), -2);
		FavDrvSetContent(FAV_DRV_YEAR, nLineNum, BurnDrvGetText(DRV_DATE), -2);
		FavDrvSetContent(FAV_DRV_COMPANY, nLineNum, BurnDrvGetText(DRV_MANUFACTURER), -2);
		FavDrvSetContent(FAV_DRV_MAXPLAYERS, nLineNum, NULL, BurnDrvGetMaxPlayers());
		FavDrvSetContent(FAV_DRV_PLAYCOUNTER, nLineNum, pszPlayCounter, -2);
		FavDrvSetContent(FAV_DRV_NUMBER, nLineNum, NULL, nBurnDrvSelect);

		nBurnDrvSelect = nBurnDrvSelectOld;
		// ---------------------------------------------------------------------------------------------------------

		nLineNum++; // next line
	}

	nFavDrvCount = nLineNum;

	fclose(fp);
	
	return 1;
}
Beispiel #5
0
int ProcessCmdLine()
{
	unsigned int i;
	int nOptX = 0, nOptY = 0, nOptD = 0;
	int nOpt1Size;
	TCHAR szOpt2[3] = _T("");
	TCHAR szName[MAX_PATH];

	if (szCmdLine[0] == _T('\"')) {
		int nLen = _tcslen(szCmdLine);
		nOpt1Size = 1;
		while (szCmdLine[nOpt1Size] != _T('\"') && nOpt1Size < nLen) {
			nOpt1Size++;
		}
		if (nOpt1Size == nLen) {
			szName[0] = 0;
		} else {
			nOpt1Size++;
			_tcsncpy(szName, szCmdLine + 1, nOpt1Size - 2);
			szName[nOpt1Size - 2] = 0;
		}
	} else {
		int nLen = _tcslen(szCmdLine);
		nOpt1Size = 0;
		while (szCmdLine[nOpt1Size] != _T(' ') && nOpt1Size < nLen) {
			nOpt1Size++;
		}
		_tcsncpy(szName, szCmdLine, nOpt1Size);
		szName[nOpt1Size] = 0;
	}

	if (_tcslen(szName)) {
		if (_tcscmp(szName, _T("-listinfo")) == 0) {
			write_datfile(0, 0, stdout);
			return 1;
		}
		
		if (_tcscmp(szName, _T("-listinfowithmd")) == 0) {
			write_datfile(0, 1, stdout);
			return 1;
		}
		
		if (_tcscmp(szName, _T("-listinfomdonly")) == 0) {
			write_datfile(0, 2, stdout);
			return 1;
		}
		
		if (_tcscmp(szName, _T("-listextrainfo")) == 0) {
			int nWidth;
			int nHeight;
			int nAspectX;
			int nAspectY;
			for (i = 0; i < nBurnDrvCount; i++) {
				nBurnDrvSelect = i;
				BurnDrvGetVisibleSize(&nWidth, &nHeight);
				BurnDrvGetAspect(&nAspectX, &nAspectY);
				printf("%s\t%ix%i\t%i:%i\t0x%08X\t\"%s\"\t%i\t%i\t%x\t%x\t\"%s\"\n", BurnDrvGetTextA(DRV_NAME), nWidth, nHeight, nAspectX, nAspectY, BurnDrvGetHardwareCode(), BurnDrvGetTextA(DRV_SYSTEM), BurnDrvIsWorking(), BurnDrvGetMaxPlayers(), BurnDrvGetGenreFlags(), BurnDrvGetFamilyFlags(), BurnDrvGetTextA(DRV_COMMENT));
			}			
			return 1;
		}
	}

	_stscanf(&szCmdLine[nOpt1Size], _T("%2s %i x %i x %i"), szOpt2, &nOptX, &nOptY, &nOptD);

	if (_tcslen(szName)) {
		bool bFullscreen = 1;
		bCmdOptUsed = 1;

		if (_tcscmp(szOpt2, _T("-r")) == 0) {
			if (nOptX && nOptY) {
				nVidWidth = nOptX;
				nVidHeight = nOptY;
			}
			if (nOptD) {
				nVidDepth = nOptD;
			}
		} else {
			if (_tcscmp(szOpt2, _T("-a")) == 0) {
				bVidArcaderes = 1;
			} else {
				if (_tcscmp(szOpt2, _T("-w")) == 0) {
					bCmdOptUsed = 0;
					bFullscreen = 0;
				}
			}
		}

		if (bFullscreen) {
			nVidFullscreen = 1;
		}

		if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fs")) == 0) {
			if (BurnStateLoad(szName, 1, &DrvInitCallback)) {
				return 1;
			} else {
//				bRunPause = 1;
			}
		} else {
			if (_tcscmp(&szName[_tcslen(szName) - 3], _T(".fr")) == 0) {
				if (StartReplay(szName)) {
					return 1;
				}
			} else {
				for (i = 0; i < nBurnDrvCount; i++) {
					nBurnDrvSelect = i;
					if (_tcscmp(BurnDrvGetText(DRV_NAME), szName) == 0) {
						MediaInit();
						DrvInit(i, true);
						break;
					}
				}
				if (i == nBurnDrvCount) {
					FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_UI_NOSUPPORT), szName, _T(APP_TITLE));
					FBAPopupDisplay(PUF_TYPE_ERROR);
					return 1;
				}
			}
		}
	}

	POST_INITIALISE_MESSAGE;

	if (!nVidFullscreen) {
		MenuEnableItems();
	}

	return 0;
}
Beispiel #6
0
//#define NEED_MEDIA_REINIT
// no need to reinit media when init a driver, modified by regret
int BurnerDrvInit(int nDrvNum, bool bRestore)
{
	BurnerDrvExit();				// Make sure exitted

#ifdef NEED_MEDIA_REINIT
	mediaExit();
#endif

	nBurnDrvSelect = nDrvNum;		// Set the driver number

#ifdef NEED_MEDIA_REINIT
	mediaInit();
#endif
	//audio.init();
	mediaInit();
	// Define nMaxPlayers early; GameInpInit() needs it (normally defined in DoLibInit()).
	nMaxPlayers = BurnDrvGetMaxPlayers();

	GameInpInit();					// Init game input
	if (ConfigGameLoad(true)) {
		loadDefaultInput();			// load default input mapping
	}
	InputMake(true);
	GameInpDefault();

 
	// set functions
	BurnReinitScrn = scrnReinit;

#ifndef NO_IPS
//	bDoPatch = true; // play with ips
//	loadActivePatches();
//	BurnApplyPatch = applyPatches;
#endif

#ifndef NO_COMBO
	BurnInitCombo = ConstructComboList;
	BurnProcessCombo = ProcessCombo;
#endif

#ifndef NO_AUTOFIRE
//	BurnInitAutofire = initAutofire;
//	BurnDoAutofire = doAutofire;
#endif

	int nStatus = DoLibInit();		// Init the Burn library's driver
	if (nStatus) {
		if (nStatus & 2) {
			BurnDrvExit();			// Exit the driver

			//scrnTitle();
 		}

		return 1;
	}

/*	if (nInputMacroEnabled) {
		GameInpExit();
		GameInpInit();				// ReInit game input
		if (ConfigGameLoad(true)) {
			loadDefaultInput();		// load default input mapping
		}
		InputMake(true);
		GameInpDefault();
	}*/

	// ==> for changing sound track
	//parseTracklist();
	// <==

	BurnExtLoadRom = DrvLoadRom;

	bDrvOkay = 1;					// Okay to use all BurnDrv functions

	bSaveRAM = false;
 		if (bRestore) {
			StatedAuto(0);
			bSaveRAM = true;

			//configCheatLoad();
		}
 

	// Reset the speed throttling code, so we don't 'jump' after the load
	RunReset();
 
	return 0;
}
Beispiel #7
0
int DrvInit(int nDrvNum, bool bRestore)
{
	int nStatus;
	
	DrvExit();						// Make sure exitted
	MediaExit();

	nBurnDrvActive = nDrvNum;		// Set the driver number
	
	if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_MVS) {

		BurnExtCartridgeSetupCallback = DrvCartridgeAccess;

		if (SelMVSDialog()) {
			POST_INITIALISE_MESSAGE;
			return 0;
		}
	}

	if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_NEOCD) {
		if (CDEmuInit()) {
			FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_CDEMU_INI_FAIL));
			FBAPopupDisplay(PUF_TYPE_ERROR);

			POST_INITIALISE_MESSAGE;
			return 0;
		}
	}

	MediaInit();

	// Define nMaxPlayers early; GameInpInit() needs it (normally defined in DoLibInit()).
	nMaxPlayers = BurnDrvGetMaxPlayers();
	GameInpInit();					// Init game input

	if(ConfigGameLoad(true)) {
		ConfigGameLoadHardwareDefaults();
	}	
	InputMake(true);
	GameInpDefault();

	if (kNetGame) {
		nBurnCPUSpeedAdjust = 0x0100;
	}

	nStatus = DoLibInit();			// Init the Burn library's driver
	if (nStatus) {
		if (nStatus & 2) {
			BurnDrvExit();			// Exit the driver

			ScrnTitle();

			FBAPopupAddText(PUF_TEXT_DEFAULT, MAKEINTRESOURCE(IDS_ERR_BURN_INIT), BurnDrvGetText(DRV_FULLNAME));
			FBAPopupDisplay(PUF_TYPE_WARNING);
		}

		POST_INITIALISE_MESSAGE;
		return 1;
	}

	BurnExtLoadRom = DrvLoadRom;

	bDrvOkay = 1;						// Okay to use all BurnDrv functions

	if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
		nScreenSize = nScreenSizeVer;
		bVidArcaderes = bVidArcaderesVer;
		nVidWidth	= nVidVerWidth;
		nVidHeight	= nVidVerHeight;
	} else {
		nScreenSize = nScreenSizeHor;
		bVidArcaderes = bVidArcaderesHor;
		nVidWidth	= nVidHorWidth;
		nVidHeight	= nVidHorHeight;
	}

	bSaveRAM = false;
	if (kNetGame) {
		KailleraInitInput();
		KailleraGetInput();
	} else {
		if (bRestore) {
			StatedAuto(0);
			bSaveRAM = true;

			ConfigCheatLoad();
		}
	}

	nBurnLayer = 0xFF;				// show all layers
	
	// Reset the speed throttling code, so we don't 'jump' after the load
	RunReset();

	VidExit();
	POST_INITIALISE_MESSAGE;

	return 0;
}