Esempio n. 1
0
void MOV_StartMovie(int mode)
{
	Movie.mode = mode;
	Movie.currentFrame = 0;
	Movie.MaxRecFrames = 0;
	Movie.lagCounter = 0;
	Movie.currentCdrom = 1;
	cdOpenCase = 0;
	cheatsEnabled = 0;
	Config.Sio = 0;	
	Config.VSyncWA = 0;
	memset(&MovieControl, 0, sizeof(MovieControl));
	if (Movie.mode == MOVIEMODE_RECORD)
	{
		StartRecord();
		GPUdisplayText("Movie recording started.");
	}
	else if (Movie.mode == MOVIEMODE_PLAY)
	{
		if (!StartReplay())
			MOV_StopMovie();
		else
			GPUdisplayText("Movie playback started.");
	}
}
Esempio n. 2
0
void CReplayManager::StartHighlights()
{
	if (!sv_replays.GetBool() || !sv_highlights.GetBool())
		return;

	StartReplay(true);
}
Esempio n. 3
0
void iwPlayReplay::Msg_ButtonClick(const unsigned int ctrl_id)
{
    switch(ctrl_id)
    {
        default: break;
        case 1:
            StartReplay();
            break;
        case 2:
            WINDOWMANAGER.Show( new iwMsgbox(_("Clear"), _("Are you sure to remove all replays?"), this, MSB_YESNO, MSB_QUESTIONRED, 1) );
            break;
        case 3:
        {
            ctrlTable* table = GetCtrl<ctrlTable>(0);
            if(table->GetSelection() < table->GetRowCount())
                WINDOWMANAGER.Show(new iwMsgbox(_("Delete selected"), _("Are you sure you want to remove the selected replay?"), this, MSB_YESNO, MSB_QUESTIONRED, 2));
            break;
        }
        case 4:
            Close();
            break;
        case 5:
            WINDOWMANAGER.Show(new iwMsgbox(_("Clear"), _("Are you sure to remove all invalid replays?"), this, MSB_YESNO, MSB_QUESTIONRED, 3));
            break;
    }
}
Esempio n. 4
0
void iwPlayReplay::Msg_ButtonClick(const unsigned int ctrl_id)
{
    switch(ctrl_id)
    {
        default: break;
        case 1:
        {
            StartReplay();
        } break;
        case 2:
        {
            // Sicherheitsabfrage, ob der Benutzer auch wirklich alle löschen möchte
            WINDOWMANAGER.Show( new iwMsgbox(_("Clear"), _("Are you sure to remove all replays?"), this, MSB_YESNO, MSB_QUESTIONRED, 1) );

        } break;
    }
}
Esempio n. 5
0
int ProcessCmdLine()
{
	unsigned int i;
	int nOptX = 0, nOptY = 0, nOptD = 0;
	int nOpt1Size;
	TCHAR szOpt2[64] = _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, stdout);
			return 1;
		}
	}

	_stscanf(&szCmdLine[nOpt1Size], _T("%64s %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;
		} else if (_tcsncmp(szOpt2, _T("-e"), 2) == 0) {
		   bCmdOptUsed = 0;
		   bFullscreen = 0;
         bHideLoadProgress = 1;
			nVidEmbeddedWindow = strtol(szOpt2 + 2, NULL, 16); /* Not unicode clean. =( */
         if (!IsWindow((HWND)nVidEmbeddedWindow)) {
            nVidEmbeddedWindow = NULL;
   		   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 if (_tcsncmp(szName, _T("quark:"), 6) == 0) {
            QuarkInit(szName);
			} 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;
}
Esempio n. 6
0
void iwPlayReplay::Msg_TableChooseItem(const unsigned ctrl_id, const unsigned short selection)
{
    StartReplay();
}
Esempio n. 7
0
/**
**  Log commands into file.
**
**  This could later be used to recover, crashed games.
**
**  @param action  Command name (move,attack,...).
**  @param unit    Unit that receive the command.
**  @param flush   Append command or flush old commands.
**  @param x       optional X map position.
**  @param y       optional y map position.
**  @param dest    optional destination unit.
**  @param value   optional command argument (unit-type,...).
**  @param num     optional number argument
*/
void CommandLog(const char *action, const CUnit *unit, int flush,
				int x, int y, const CUnit *dest, const char *value, int num)
{
	if (CommandLogDisabled) { // No log wanted
		return;
	}
	//
	// Create and write header of log file. The player number is added
	// to the save file name, to test more than one player on one computer.
	//
	if (!LogFile) {
		struct stat tmp;
		char buf[16];
		std::string path(Parameters::Instance.GetUserDirectory());
		if (!GameName.empty()) {
			path += "/";
			path += GameName;
		}
		path += "/logs";

		if (stat(path.c_str(), &tmp) < 0) {
			makedir(path.c_str(), 0777);
		}

		snprintf(buf, sizeof(buf), "%d", ThisPlayer->Index);

		path += "/log_of_stratagus_";
		path += buf;
		path += ".log";

		LogFile = new CFile;
		if (LogFile->open(path.c_str(), CL_OPEN_WRITE) == -1) {
			// don't retry for each command
			CommandLogDisabled = false;
			delete LogFile;
			LogFile = NULL;
			return;
		}

		if (CurrentReplay) {
			SaveFullLog(*LogFile);
		}
	}

	if (!CurrentReplay) {
		CurrentReplay = StartReplay();

		SaveFullLog(*LogFile);
	}

	if (!action) {
		return;
	}

	LogEntry *log = new LogEntry;

	//
	// Frame, unit, (type-ident only to be better readable).
	//
	log->GameCycle = GameCycle;
	//Wyrmgus start
	log->GameTimeOfDay = Map.TimeOfDay[0];
	//Wyrmgus end

	log->UnitNumber = (unit ? UnitNumber(*unit) : -1);
	log->UnitIdent = (unit ? unit->Type->Ident.c_str() : "");

	log->Action = action;
	log->Flush = flush;

	//
	// Coordinates given.
	//
	log->PosX = x;
	log->PosY = y;

	//
	// Destination given.
	//
	log->DestUnitNumber = (dest ? UnitNumber(*dest) : -1);

	//
	// Value given.
	//
	log->Value = (value ? value : "");

	//
	// Number given.
	//
	log->Num = num;

	log->SyncRandSeed = SyncRandSeed;

	// Append it to ReplayLog list
	AppendLog(log, *LogFile);
}
Esempio n. 8
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;
}
Esempio n. 9
0
QTPcapReplay::QTPcapReplay(QWidget *parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);

	/* Connects  */
	m_jobReplay = new JobReplay;
	m_jobReplay->SetPcapReplay(this);
	m_jobReplay->SetUI(&ui);

	//BUTTONACT(ui.removeFileButton, removeFile());
	connect(ui.removeFileButton, SIGNAL(pressed()), this, SLOT(removeFile()));
	connect(ui.exitAppButton, SIGNAL(pressed()), this, SLOT(onFileExit()));
	connect(ui.actionFiles, SIGNAL(triggered()), this, SLOT(onFileOpen()));
	connect(ui.actionFrom_Folder, SIGNAL(triggered()), this, SLOT(onFolderOpen()));
	connect(ui.actionClose, SIGNAL(triggered()), this, SLOT(onFileExit()));
	connect(ui.actionNew_Window, SIGNAL(triggered()), this, SLOT(onNewWindow()));
	connect(ui.actionNew_Window_Dynamic, SIGNAL(triggered()), this, SLOT(onNewWindowDynamic()));
	connect(ui.actionScheduler, SIGNAL(triggered()), this, SLOT(onSchedulerDynamic()));
	connect(ui.startReplayButton, SIGNAL(pressed()), m_jobReplay, SLOT(StartReplay()));
	connect(ui.pauseReplayButton, SIGNAL(pressed()), this, SLOT(onPause()));
	connect(ui.stopReplayButton, SIGNAL(pressed()), this, SLOT(StopPlaying()));
	connect(m_jobReplay, SIGNAL(updateProgress(const int&)), this, SLOT(getProgress(int)));
	connect(m_jobReplay, SIGNAL(updateNextPacketNumber(const QString&)), this, SLOT(getNextPacketNumber(QString)));
	connect(m_jobReplay, SIGNAL(updateCurrentPlayingFile(const QString&)), this, SLOT(getCurStatus(QString)));
	connect(m_jobReplay, SIGNAL(updatePlayingStatus(const bool&)), this, SLOT(updatePlayingStatus(bool)));
	connect(&(m_SchedulerTimer.m_timer), SIGNAL(timeout()), this, SLOT(handleTimeout()));
	connect(&(m_NetSpeedMeasure), SIGNAL(UpdateNetSpeed(double)), this, SLOT(updateNetSpeedMeasure(double)));
	connect(&(m_PacketTimeReportor), SIGNAL(UpdateTimeReport(QString)), this, SLOT(PrintTimeReport(QString)));
	connect(m_jobReplay, SIGNAL(sendMessageBox(const QString&)), this, SLOT(showMessageBox(const QString&)));
	connect(ui.regularReplayButton, SIGNAL(pressed()), m_jobReplay, SLOT(startRegularReplay()));
	connect(m_jobReplay, SIGNAL(updateRegularReplayingStatus(const bool&)), this, SLOT(updateRegularReplayingStatus(bool)));
	connect(m_jobReplay, SIGNAL(sendUpdateRegularButtonText(const QString&)), this, SLOT(updateRegularButtonText(const QString&)));
	connect(ui.actionSave_Config, SIGNAL(triggered()), this, SLOT(save_config_setting()));
	connect(ui.actionLoad_Config, SIGNAL(triggered()), this, SLOT(load_config_setting()));

	ui.progressBar->setValue(0);

	if (InitAdapterName() == 1)
		exit(0);

	m_playerTimer = new PlayerTimer;
	m_threadPool = new threadPool(2);
	m_threadPool->submit(m_playerTimer);

	// Modify display
	ui.curPcapPackage->setText(QString(""));
	ui.StatusReportLabel->setText(QString(""));
	ui.schedulerStatus->setText(QString("Scheduler Stop"));
	ui.schedulerStatus->setStyleSheet("QLabel { background-color : red; color : black; }");
	ui.pauseReplayButton->setDisabled(true);
	ui.stopReplayButton->setDisabled(true);
	ui.offSet_lineEdit->setText("0");
	ui.speed_LineEdit->setText("1");
	ui.netSpeedMon->setText("");
	ui.packetTimeLabel->setText("");

	// Status
	m_bPlaying = false;
	m_bBeforePlay = true;

	
	m_openFilePath = QDir::currentPath();

	// net speed measurement

	// icon
	//m_icon.addFile("C:\NGN2\NGN2011\App\QTPcapReplay\QTPcapReplay\test.bmp");
	//this->setWindowIcon(m_icon);
}