mirror of
https://github.com/simple64/simple64.git
synced 2026-11-11 21:28:44 +01:00
update gui
This commit is contained in:
1 parent
e4dd6e6e00
commit
5b53c4eaf2
3 files changed
+45
No files matched your search
@@ -16,8 +16,10 @@ int main(int argc, char *argv[])
|
||||
parser.addHelpOption();
|
||||
QCommandLineOption verboseOption({"v", "verbose"}, "Verbose mode. Prints out more information to log.");
|
||||
QCommandLineOption noGUIOption("nogui", "Disable GUI elements.");
|
||||
QCommandLineOption testOption("test", "Run debug tests.", "number_of_frames");
|
||||
parser.addOption(verboseOption);
|
||||
parser.addOption(noGUIOption);
|
||||
parser.addOption(testOption);
|
||||
parser.addPositionalArgument("ROM", QCoreApplication::translate("main", "ROM to open."));
|
||||
parser.process(a);
|
||||
const QStringList args = parser.positionalArguments();
|
||||
@@ -29,6 +31,8 @@ int main(int argc, char *argv[])
|
||||
w->setVerbose();
|
||||
if (parser.isSet(noGUIOption))
|
||||
w->setNoGUI();
|
||||
if (parser.isSet(testOption))
|
||||
w->setTest(parser.value(testOption).toInt());
|
||||
if (args.size() > 0)
|
||||
w->openROM(args.at(0), "", 0, 0);
|
||||
else
|
||||
|
||||
@@ -239,6 +239,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
{
|
||||
verbose = 0;
|
||||
nogui = 0;
|
||||
run_test = 0;
|
||||
ui->setupUi(this);
|
||||
this->setWindowTitle("simple64 build: " + QStringLiteral(GUI_VERSION).mid(0,7));
|
||||
|
||||
@@ -485,6 +486,16 @@ int MainWindow::getNoGUI()
|
||||
return nogui;
|
||||
}
|
||||
|
||||
void MainWindow::setTest(int value)
|
||||
{
|
||||
run_test = value;
|
||||
}
|
||||
|
||||
int MainWindow::getTest()
|
||||
{
|
||||
return run_test;
|
||||
}
|
||||
|
||||
int MainWindow::getVerbose()
|
||||
{
|
||||
return verbose;
|
||||
@@ -1104,8 +1115,34 @@ void MainWindow::addFrameCount()
|
||||
++frame_count;
|
||||
}
|
||||
|
||||
void MainWindow::simulateInput()
|
||||
{
|
||||
int keyValue = 225; // Shift/A
|
||||
if (run_test % 2)
|
||||
(*CoreDoCommand)(M64CMD_SEND_SDL_KEYDOWN, keyValue, NULL);
|
||||
else
|
||||
{
|
||||
(*CoreDoCommand)(M64CMD_SEND_SDL_KEYUP, keyValue, NULL);
|
||||
if (keyValue = 225)
|
||||
keyValue = 40; // Enter/Start
|
||||
else
|
||||
keyValue = 225;
|
||||
}
|
||||
printf("%u\n", frame_count);
|
||||
if (run_test == 1)
|
||||
{
|
||||
if (frame_count == 0)
|
||||
abort();
|
||||
else
|
||||
(*CoreDoCommand)(M64CMD_STOP, 0, NULL);
|
||||
}
|
||||
--run_test;
|
||||
}
|
||||
|
||||
void MainWindow::updateFrameCount()
|
||||
{
|
||||
if (run_test)
|
||||
simulateInput();
|
||||
QString FPS = QString("%1 FPS").arg(frame_count);
|
||||
FPSLabel->setText(FPS);
|
||||
frame_count = 0;
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
int getVerbose();
|
||||
void setNoGUI();
|
||||
int getNoGUI();
|
||||
void setTest(int value);
|
||||
int getTest();
|
||||
void updatePlugins();
|
||||
void resetCore();
|
||||
m64p_dynlib_handle getCoreLib();
|
||||
@@ -138,10 +140,12 @@ private:
|
||||
void loadPlugins();
|
||||
void closeCoreLib();
|
||||
void closePlugins();
|
||||
void simulateInput();
|
||||
Ui::MainWindow *ui;
|
||||
QMenu * OpenRecent;
|
||||
int verbose;
|
||||
int nogui;
|
||||
int run_test;
|
||||
uint32_t frame_count;
|
||||
|
||||
QMessageBox *download_message = nullptr;
|
||||
|
||||
Reference in new issue
Block a user