コード例 #1
0
ファイル: geom.cpp プロジェクト: alicata/r3d-2001
int Tetrahedron::AllocFace(int i)
{
	face[i] = new Face3;
	if (!face[i])
	{
		AppError(APPERR_FACE_ALLOC);
		return 0;
	}

	return 1;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: tmaul/finalburnalpha_2001
int ProcessCmdLine()
{
	unsigned int i;
	int nOptX = 0, nOptY = 0, nOptD = 0;
	char szGameName[32] = "", szOpt[2] = "";

	sscanf(szCmdLine, "%31s %1s %i x %i x %i", szGameName, szOpt, &nOptX, &nOptY, &nOptD);

	if (strlen(szGameName))
	{
		bool bFullscreen = 1;
		for (i = 0; i < nBurnDrvCount; i++)
		{
			nBurnDrvSelect = i;
			if (strcmp(BurnDrvText(0), szGameName) == 0)
			{
				bCmdOptUsed = 1;

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

				DrvInit(i);
				if (bDrvOkay && bFullscreen)
				{
					nVidFullscreen = 1;
				}
				PostMessage(NULL, WM_APP + 0, 0, 0);
				break;
			}
		}
		if (i == nBurnDrvCount)
		{
			char szErrorString[128];
			sprintf(szErrorString, "%s is not supported by Final Burn Alpha.", szGameName);
			AppError(szErrorString, 0);
			return 1;
		}
	}
	return 0;
}
コード例 #3
0
ファイル: bzip.cpp プロジェクト: meesokim/fba
static int __cdecl BzipBurnLoadRom(unsigned char* Dest, int* pnWrote, int i)
{
#if defined (BUILD_WIN32)
	MSG Msg;
#endif

	struct BurnRomInfo ri;
	int nWantZip = 0;
	TCHAR szText[128];
	char* pszRomName = NULL;
	int nRet = 0;

	if (i < 0 || i >= nRomCount) {
		return 1;
	}

	ri.nLen = 0;
	BurnDrvGetRomInfo(&ri, i);								// Get info

	// show what we're doing
	BurnDrvGetRomName(&pszRomName, i, 0);
	if (pszRomName == NULL) {
		pszRomName = "unknown";
	}
	_stprintf(szText, _T("Loading"));
	if (ri.nType & (BRF_PRG | BRF_GRA | BRF_SND | BRF_BIOS)) {
		if (ri.nType & BRF_BIOS) {
			_stprintf (szText + _tcslen(szText), _T(" %s"), _T("BIOS "));
		}
		if (ri.nType & BRF_PRG) {
			_stprintf (szText + _tcslen(szText), _T(" %s"), _T("program "));
		}
		if (ri.nType & BRF_GRA) {
			_stprintf (szText + _tcslen(szText), _T(" %s"), _T("graphics "));
		}
		if (ri.nType & BRF_SND) {
			_stprintf (szText + _tcslen(szText), _T(" %s"), _T("sound "));
		}
		_stprintf(szText + _tcslen(szText), _T("(%hs)..."), pszRomName);
	} else {
		_stprintf(szText + _tcslen(szText), _T(" %hs..."), pszRomName);
	}
	ProgressUpdateBurner(ri.nLen ? 1.0 / ((double)nTotalSize / ri.nLen) : 0, szText, 0);

#if defined (BUILD_WIN32)
	// Check for messages:
	while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
		DispatchMessage(&Msg);
	}
#endif

	if (RomFind[i].nState == 0) {							// Rom not found in zip at all
		TCHAR szTemp[128] = _T("");
		_stprintf(szTemp, "%s (not found)\n",szText);
		fprintf(stderr, szTemp);
		AppError(szTemp, 1);
		return 1;
	}

	nWantZip = RomFind[i].nZip;								// Which zip file it is in
	if (nCurrentZip != nWantZip) {							// If we haven't got the right zip file currently open
		ZipClose();
		nCurrentZip = -1;
		if (ZipOpen(TCHARToANSI(szBzipName[nWantZip], NULL, 0))) {
			return 1;
		}
		nCurrentZip = nWantZip;
	}

	// Read in file and return how many bytes we read
	if (ZipLoadFile(Dest, ri.nLen, pnWrote, RomFind[i].nPos)) {
		// Error loading from the zip file
		TCHAR szTemp[128] = _T("");
		_stprintf(szTemp, _T("%s reading %.30hs from %.30s"), nRet == 2 ? _T("CRC error") : _T("Error"), pszRomName, GetFilenameW(szBzipName[nCurrentZip]));
		fprintf(stderr, szTemp);
		AppError(szTemp, 1);
		return 1;
	}

	fprintf(stderr, "%s (OK)\n", szText);
	return 0;
}
コード例 #4
0
ファイル: run.cpp プロジェクト: tmaul/finalburnalpha_2001
// The main message loop
int RunMessageLoop()
{
	int bRestartVideo=0;

RunAgain:

	if (nVidFullscreen)
	{
		while (ShowCursor(0)>=0)
			;    // hide cursor in fullscreen
	}

	// Size the window for current game
	ScrnSize();

	RunInit();

	bRestartVideo = 0;

	for (;;)
	{
		MSG Msg;
		int nRet=0;
		nRet=PeekMessage(&Msg,NULL,0,0,PM_REMOVE);
		if (nRet!=0)
		{
			// A message is waiting to be processed
			if (Msg.message == WM_QUIT)
			{
				break;    // Quit program
			}
			if (Msg.message == WM_APP + 0)
			{
				bRestartVideo = 1;
				break;
			}

			if (Msg.message == WM_KEYDOWN)
			{

				// Escape key
				if (Msg.wParam == VK_ESCAPE)
				{
					if (bCmdOptUsed)
					{
						PostQuitMessage(0);
					}
					else
					{
						if (nVidFullscreen)
						{
							nVidFullscreen = 0;
							PostMessage(NULL, WM_APP + 0, 0, 0);
						}

					}
				}

				// Hotkeys for savestates
				if (Msg.wParam >= VK_F1 && Msg.wParam <= VK_F9)
				{
					if (GetAsyncKeyState(VK_CONTROL) & 0x80000000)
					{
						int nSlot = Msg.wParam + 1 - VK_F1;
						if (GetAsyncKeyState(VK_SHIFT) & 0x80000000)
							// Save state
						{
							StatedSave(nSlot);
						}
						else
							// Load state
						{
							StatedLoad(nSlot);
						}
					}
				}

			}


#ifdef _DEBUG
			// For the "counter"variable
			if ((Msg.message==WM_SYSKEYDOWN || Msg.message==WM_KEYDOWN))
			{
				switch (Msg.wParam)
				{
				case 'N':
					counter--;
					break;
				case 'M':
					counter++;
					break;
				}
			}
#endif

			if ((Msg.message==WM_SYSKEYDOWN || Msg.message==WM_KEYDOWN)&&(Msg.lParam&0x20000000))
			{
				// An Alt/AltGr-key was pressed
				switch (Msg.wParam)
				{
				case 'I':
					bAppFastForward=!bAppFastForward;
					break;
				case 'O':
					bAppStep=1;
					break;
				case 'P':
					bRunPause=!bRunPause;
					bAltPause=!bAltPause;
					MenuUpdate();
					break;
				case 13 :
				{
					nVidFullscreen=!nVidFullscreen;
					PostMessage(NULL,WM_APP+0,0,0);
					break;
				}
				case 0xBB:
				{
					if(nDSoundVol < 0L)
					{
						nDSoundVol+=100L;
					}

					break;
				}
				case 0xBD:
				{
					if(nDSoundVol > -4000L)
					{
						nDSoundVol-=100L;
					}

					break;
				}
				}
			}

			// Check for messages for dialogs etc.
			nRet=AppMessage(&Msg);
			if (nRet!=0)
			{
				if(TranslateAccelerator(hScrnWnd, hAccel, &Msg)==0)
				{
					DispatchMessage(&Msg);
				}
			}
		}
		else
		{
			HWND hActive=GetActiveWindow();

			bAppDoFast=bAppFastForward;

			if (APP_TAKE_INPUT(hActive))
			{
				if (KEY_DOWN(VK_F7))
				{
					bAppDoFast=1;
				}
			}
			// No messages are waiting
			RunIdle();
		}
	}

	if (nVidFullscreen==0)
	{
		while (ShowCursor(1)< 0);    // show cursor in windowed
	}

	RunExit();

	if (bRestartVideo)
	{
		int nRet=0;
		VidExit();
		MediaExit();

		MediaInit();

		// Reinit the video plugin
		nRet=VidInit();
		if (nRet!=0)
		{
			AppError("VidInit Failed",0);
		}
		if (bDrvOkay && bRunPause)
		{
			VidRedraw();
		}
		goto RunAgain;
	}

	return 0;
}