mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-11-12 00:58:43 +01:00
Initial 64DD Support
This commit is contained in:
1 parent
c87919930b
commit
f4c8d3ff2d
10 files changed
+139
-5
No files matched your search
@@ -55,6 +55,22 @@ bool Core::Init(m64p_dynlib_handle handle)
|
||||
return false;
|
||||
}
|
||||
|
||||
media_loader = {
|
||||
(void *)this,
|
||||
media_loader_get_gb_cart_rom,
|
||||
media_loader_get_gb_cart_ram,
|
||||
media_loader_get_dd_rom,
|
||||
media_loader_get_dd_disk
|
||||
};
|
||||
|
||||
ret = M64P::Core.DoCommand(M64CMD_SET_MEDIA_LOADER, sizeof(media_loader), &media_loader);
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
this->error_Message = "Core::Init M64P::Core.DoCommand(M64CMD_SET_MEDIA_LOADER) Failed: ";
|
||||
this->error_Message += M64P::Core.ErrorMessage(ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
this->handle = handle;
|
||||
|
||||
return true;
|
||||
@@ -170,6 +186,36 @@ M64P::Wrapper::Plugin *Core::plugin_Get(PluginType type)
|
||||
}
|
||||
}
|
||||
|
||||
char *Core::media_loader_get_gb_cart_rom(void *_this, int)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *Core::media_loader_get_gb_cart_ram(void *_this, int)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *Core::media_loader_get_dd_rom(void *_this)
|
||||
{
|
||||
QString file = g_Settings.GetStringValue(SettingsID::Core_64DD_RomFile);
|
||||
|
||||
if (file.isEmpty())
|
||||
return NULL;
|
||||
|
||||
return strdup(file.toStdString().c_str());;
|
||||
}
|
||||
|
||||
char *Core::media_loader_get_dd_disk(void *_this)
|
||||
{
|
||||
QString file = ((Core*)_this)->rom_Combo_Disk;
|
||||
|
||||
if (file.isEmpty())
|
||||
return NULL;
|
||||
|
||||
return strdup(file.toStdString().c_str());
|
||||
}
|
||||
|
||||
bool Core::plugin_Attach(Plugin *p)
|
||||
{
|
||||
m64p_error ret;
|
||||
@@ -382,6 +428,13 @@ bool Core::LaunchEmulation(QString file)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::LaunchEmulation(QString cartRom, QString diskRom)
|
||||
{
|
||||
this->rom_Combo_Disk = diskRom;
|
||||
|
||||
return this->LaunchEmulation(cartRom);
|
||||
}
|
||||
|
||||
bool Core::StopEmulation(void)
|
||||
{
|
||||
m64p_error ret;
|
||||
@@ -678,7 +731,7 @@ bool Core::rom_ApplyPluginOverlay(void)
|
||||
value = g_Settings.GetStringValue(settingIdArray[i], section);
|
||||
if (!value.isEmpty())
|
||||
{
|
||||
Plugin_t plugin = { .FileName = value };
|
||||
Plugin_t plugin = {.FileName = value};
|
||||
if (!this->SetPlugin(plugin))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ class Core
|
||||
bool GetDefaultRomInfo(RomInfo_t *);
|
||||
|
||||
bool LaunchEmulation(QString);
|
||||
bool LaunchEmulation(QString, QString);
|
||||
bool StopEmulation(void);
|
||||
bool PauseEmulation(void);
|
||||
bool ResumeEmulation(void);
|
||||
@@ -73,6 +74,15 @@ class Core
|
||||
private:
|
||||
QString error_Message;
|
||||
|
||||
m64p_media_loader media_loader;
|
||||
|
||||
QString rom_Combo_Disk;
|
||||
|
||||
static char* media_loader_get_gb_cart_rom(void*, int);
|
||||
static char* media_loader_get_gb_cart_ram(void*, int);
|
||||
static char* media_loader_get_dd_rom(void*);
|
||||
static char* media_loader_get_dd_disk(void*);
|
||||
|
||||
m64p_dynlib_handle handle;
|
||||
|
||||
QList<Plugin_t> plugin_Todo;
|
||||
|
||||
@@ -25,13 +25,18 @@ void EmulationThread::SetRomFile(QString file)
|
||||
this->rom_File = file;
|
||||
}
|
||||
|
||||
void EmulationThread::SetDiskFile(QString file)
|
||||
{
|
||||
this->disk_File = file;
|
||||
}
|
||||
|
||||
void EmulationThread::run(void)
|
||||
{
|
||||
emit this->on_Emulation_Started();
|
||||
|
||||
bool ret;
|
||||
|
||||
ret = g_MupenApi.Core.LaunchEmulation(this->rom_File);
|
||||
ret = g_MupenApi.Core.LaunchEmulation(this->rom_File, this->disk_File);
|
||||
|
||||
if (!ret)
|
||||
this->error_Message = g_MupenApi.Core.GetLastError();
|
||||
|
||||
@@ -27,6 +27,7 @@ class EmulationThread : public QThread
|
||||
~EmulationThread(void);
|
||||
|
||||
void SetRomFile(QString);
|
||||
void SetDiskFile(QString);
|
||||
|
||||
void run(void) override;
|
||||
|
||||
@@ -34,6 +35,7 @@ class EmulationThread : public QThread
|
||||
|
||||
private:
|
||||
QString rom_File;
|
||||
QString disk_File;
|
||||
QString error_Message;
|
||||
|
||||
signals:
|
||||
|
||||
@@ -53,6 +53,9 @@ void RomSearcherThread::rom_Search(QString directory)
|
||||
filter << "*.N64";
|
||||
filter << "*.Z64";
|
||||
filter << "*.V64";
|
||||
filter << "*.ndd";
|
||||
filter << "*.D64";
|
||||
|
||||
|
||||
QFileInfoList fileList = dir.entryInfoList(filter, QDir::Files);
|
||||
QFileInfo fileInfo;
|
||||
|
||||
@@ -22,6 +22,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent, Qt::WindowSyst
|
||||
|
||||
this->treeWidget->topLevelItem(0)->setSelected(true);
|
||||
this->treeWidget->expandAll();
|
||||
this->treeWidget->setItemsExpandable(false);
|
||||
|
||||
this->inGame = g_EmuThread->isRunning();
|
||||
if (inGame)
|
||||
|
||||
@@ -375,7 +375,7 @@ void MainWindow::emulationThread_Connect(void)
|
||||
Qt::BlockingQueuedConnection);
|
||||
}
|
||||
|
||||
void MainWindow::emulationThread_Launch(QString file)
|
||||
void MainWindow::emulationThread_Launch(QString cartRom, QString diskRom)
|
||||
{
|
||||
g_MupenApi.Config.Save();
|
||||
|
||||
@@ -395,10 +395,16 @@ void MainWindow::emulationThread_Launch(QString file)
|
||||
this->ui_Widget_OpenGL->SetAllowResizing(this->ui_AllowManualResizing);
|
||||
this->ui_Widget_OpenGL->SetHideCursor(this->ui_HideCursorInEmulation);
|
||||
|
||||
this->emulationThread->SetRomFile(file);
|
||||
this->emulationThread->SetRomFile(cartRom);
|
||||
this->emulationThread->SetDiskFile(diskRom);
|
||||
this->emulationThread->start();
|
||||
}
|
||||
|
||||
void MainWindow::emulationThread_Launch(QString file)
|
||||
{
|
||||
this->emulationThread_Launch(file, "");
|
||||
}
|
||||
|
||||
void MainWindow::menuBar_Actions_Init(void)
|
||||
{
|
||||
this->action_File_OpenRom = new QAction(this);
|
||||
@@ -654,7 +660,7 @@ void MainWindow::on_Action_File_OpenRom(void)
|
||||
QString dir;
|
||||
|
||||
dialog.setFileMode(QFileDialog::FileMode::ExistingFile);
|
||||
dialog.setNameFilter("N64 Roms (*.n64 *.z64 *.v64)");
|
||||
dialog.setNameFilter("N64 Roms (*.n64 *.z64 *.v64 *.ndd *.d64)");
|
||||
dialog.setWindowIcon(this->ui_Icon);
|
||||
|
||||
ret = dialog.exec();
|
||||
@@ -677,6 +683,52 @@ void MainWindow::on_Action_File_OpenRom(void)
|
||||
|
||||
void MainWindow::on_Action_File_OpenCombo(void)
|
||||
{
|
||||
bool isRunning = g_MupenApi.Core.IsEmulationRunning();
|
||||
bool isPaused = g_MupenApi.Core.isEmulationPaused();
|
||||
|
||||
if (isRunning && !isPaused)
|
||||
{
|
||||
this->on_Action_System_Pause();
|
||||
}
|
||||
|
||||
QFileDialog dialog(this);
|
||||
int ret;
|
||||
QString dir, cartRom, diskRom;
|
||||
|
||||
dialog.setFileMode(QFileDialog::FileMode::ExistingFile);
|
||||
dialog.setNameFilter("N64 ROM (*.n64 *.z64 *.v64)");
|
||||
|
||||
ret = dialog.exec();
|
||||
if (!ret)
|
||||
{
|
||||
if (isRunning && !isPaused)
|
||||
{
|
||||
this->on_Action_System_Pause();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
cartRom = dialog.selectedFiles().first();
|
||||
|
||||
dialog.setNameFilter("64DD ROM (*.ndd *.d64)");
|
||||
ret = dialog.exec();
|
||||
if (!ret)
|
||||
{
|
||||
if (isRunning && !isPaused)
|
||||
{
|
||||
this->on_Action_System_Pause();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
diskRom = dialog.selectedFiles().first();
|
||||
|
||||
if (this->ui_Widgets->currentIndex() != 0)
|
||||
{
|
||||
this->ui_NoSwitchToRomBrowser = true;
|
||||
}
|
||||
|
||||
this->emulationThread_Launch(cartRom, diskRom);
|
||||
}
|
||||
|
||||
void MainWindow::on_Action_File_EndEmulation(void)
|
||||
|
||||
@@ -109,6 +109,7 @@ class MainWindow : public QMainWindow
|
||||
|
||||
void emulationThread_Init(void);
|
||||
void emulationThread_Connect(void);
|
||||
void emulationThread_Launch(QString, QString);
|
||||
void emulationThread_Launch(QString);
|
||||
|
||||
void menuBar_Actions_Init(void);
|
||||
|
||||
@@ -300,6 +300,10 @@ Setting_t Settings::getSetting(SettingsID id)
|
||||
setting = {M64P_SECTION, "SharedDataPath", "Data", "", true};
|
||||
break;
|
||||
|
||||
case SettingsID::Core_64DD_RomFile:
|
||||
setting = {M64P_SECTION, "64DD ROM File", "", "", false};
|
||||
break;
|
||||
|
||||
case SettingsID::Game_DisableExtraMem:
|
||||
setting = {"", "DisableExtraMem", false, "", false};
|
||||
break;
|
||||
|
||||
@@ -49,6 +49,9 @@ enum SettingsID
|
||||
Core_UserDataDirOverride,
|
||||
Core_UserCacheDirOverride,
|
||||
|
||||
// Core 64DD ROM Settings
|
||||
Core_64DD_RomFile,
|
||||
|
||||
// (mupen64plus) Core Settings
|
||||
Core_OverrideGameSpecificSettings,
|
||||
Core_RandomizeInterrupt,
|
||||
|
||||
Reference in new issue
Block a user