mirror of
https://github.com/simple64/simple64.git
synced 2026-11-12 16:48:42 +01:00
update gui
This commit is contained in:
1 parent
3e1e785bd7
commit
35454daff5
3 files changed
-115
No files matched your search
@@ -222,35 +222,8 @@ m64p_error loadROM(QString filename)
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
static void loadPif()
|
||||
{
|
||||
/* Try to load the PIF image into the core */
|
||||
if (!w->getSettings()->value("PIF_ROM").toString().isEmpty()) {
|
||||
QFile pifFile(w->getSettings()->value("PIF_ROM").toString());
|
||||
if (pifFile.open(QIODevice::ReadOnly)) {
|
||||
QDataStream inPif(&pifFile);
|
||||
char *PIF_buffer = (char *) malloc(2048);
|
||||
if (inPif.readRawData(PIF_buffer, 2048) == 2048) {
|
||||
if ((*CoreDoCommand)(M64CMD_PIF_OPEN, 2048, PIF_buffer) != M64ERR_SUCCESS)
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "core failed to open PIF image file.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugMessage(M64MSG_ERROR, "core failed to open PIF image file.");
|
||||
}
|
||||
free(PIF_buffer);
|
||||
pifFile.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m64p_error launchGame(QString netplay_ip, int netplay_port, int netplay_player)
|
||||
{
|
||||
if (!netplay_port)
|
||||
loadPif();
|
||||
|
||||
/* attach plugins to core */
|
||||
(*CoreAttachPlugin)(M64PLUGIN_GFX, w->getGfxPlugin());
|
||||
(*CoreAttachPlugin)(M64PLUGIN_AUDIO, w->getAudioPlugin());
|
||||
|
||||
@@ -70,90 +70,6 @@ void MainWindow::updatePlugins()
|
||||
ui->actionController_Configuration->setEnabled(settings->value("inputPlugin").toString().contains("-qt"));
|
||||
}
|
||||
|
||||
void MainWindow::updatePIF(Ui::MainWindow *ui)
|
||||
{
|
||||
QMenu *PIF = new QMenu(this);
|
||||
PIF->setTitle("PIF ROM");
|
||||
ui->menuFile->insertMenu(ui->actionTake_Screenshot, PIF);
|
||||
ui->menuFile->insertSeparator(ui->actionTake_Screenshot);
|
||||
|
||||
QAction *fileSelect = new QAction(this);
|
||||
QString current = settings->value("PIF_ROM").toString();
|
||||
fileSelect->setText("PIF ROM: " + current);
|
||||
PIF->addAction(fileSelect);
|
||||
connect(fileSelect, &QAction::triggered, [=](){
|
||||
QString filename = QFileDialog::getOpenFileName(this,
|
||||
tr("PIF ROM"), NULL, tr("PIF ROM File (*.bin)"));
|
||||
if (!filename.isNull()) {
|
||||
settings->setValue("PIF_ROM", filename);
|
||||
QString current = filename;
|
||||
fileSelect->setText("PIF ROM: " + current);
|
||||
}
|
||||
});
|
||||
|
||||
QAction *clearSelect = new QAction(this);
|
||||
clearSelect->setText("Clear PIF ROM Selection");
|
||||
PIF->addAction(clearSelect);
|
||||
connect(clearSelect, &QAction::triggered,[=](){
|
||||
settings->remove("PIF_ROM");
|
||||
fileSelect->setText("PIF ROM: ");
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::updateDD(Ui::MainWindow *ui)
|
||||
{
|
||||
QMenu *DD = new QMenu(this);
|
||||
DD->setTitle("64DD");
|
||||
ui->menuFile->insertMenu(ui->actionTake_Screenshot, DD);
|
||||
|
||||
QAction *fileSelect = new QAction(this);
|
||||
QString current = settings->value("DD_ROM").toString();
|
||||
fileSelect->setText("64DD IPL ROM: " + current);
|
||||
DD->addAction(fileSelect);
|
||||
connect(fileSelect, &QAction::triggered, [=](){
|
||||
QString filename = QFileDialog::getOpenFileName(this,
|
||||
tr("64DD IPL ROM"), NULL, tr("64DD ROM File (*.n64)"));
|
||||
if (!filename.isNull()) {
|
||||
settings->setValue("DD_ROM", filename);
|
||||
QString current = filename;
|
||||
fileSelect->setText("64DD IPL ROM: " + current);
|
||||
}
|
||||
});
|
||||
|
||||
QAction *fileSelect2 = new QAction(this);
|
||||
current = settings->value("DD_DISK").toString();
|
||||
fileSelect2->setText("64DD Disk: " + current);
|
||||
DD->addAction(fileSelect2);
|
||||
connect(fileSelect2, &QAction::triggered,[=](){
|
||||
QString filename = QFileDialog::getOpenFileName(this,
|
||||
tr("64DD Disk File"), NULL, tr("64DD Disk File (*.ndd)"));
|
||||
if (!filename.isNull()) {
|
||||
settings->setValue("DD_DISK", filename);
|
||||
QString current = filename;
|
||||
fileSelect2->setText("64DD Disk: " + current);
|
||||
}
|
||||
});
|
||||
|
||||
QAction *clearSelect = new QAction(this);
|
||||
clearSelect->setText("Clear 64DD Selections");
|
||||
DD->addAction(clearSelect);
|
||||
connect(clearSelect, &QAction::triggered,[=](){
|
||||
settings->remove("DD_ROM");
|
||||
settings->remove("DD_DISK");
|
||||
fileSelect->setText("64DD IPL ROM: ");
|
||||
fileSelect2->setText("64DD Disk: ");
|
||||
});
|
||||
|
||||
//DD->addSeparator();
|
||||
|
||||
//QAction *startGame = new QAction(this);
|
||||
//startGame->setText("Start 64DD");
|
||||
//DD->addAction(startGame);
|
||||
//connect(startGame, &QAction::triggered,[=](){
|
||||
// openROM("");
|
||||
//});
|
||||
}
|
||||
|
||||
void MainWindow::updateGB(Ui::MainWindow *ui)
|
||||
{
|
||||
QMenu *GB = new QMenu(this);
|
||||
@@ -367,8 +283,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
updateOpenRecent();
|
||||
updateGB(ui);
|
||||
// updateDD(ui);
|
||||
updatePIF(ui);
|
||||
|
||||
if (!settings->contains("configDirPath"))
|
||||
settings->setValue("configDirPath", "$CONFIG_PATH$");
|
||||
|
||||
@@ -133,8 +133,6 @@ private:
|
||||
void stopGame();
|
||||
void updateOpenRecent();
|
||||
void updateGB(Ui::MainWindow *ui);
|
||||
void updateDD(Ui::MainWindow *ui);
|
||||
void updatePIF(Ui::MainWindow *ui);
|
||||
void loadCoreLib();
|
||||
void loadPlugins();
|
||||
void closeCoreLib();
|
||||
|
||||
Reference in new issue
Block a user