From bc10fc4217b2e150831e80fb9ac66998f1d075dd Mon Sep 17 00:00:00 2001 From: Jean-Paul Mari Date: Wed, 5 Sep 2018 19:38:51 -0400 Subject: [PATCH] Added a Jaguar model and BIOS configuration tab --- Win-VS2017/jaguarcore/jaguarcore.vcxproj | 2 + .../jaguarcore/jaguarcore.vcxproj.filters | 6 + Win-VS2017/virtualjaguar.vcxproj | 27 +++ Win-VS2017/virtualjaguar.vcxproj.filters | 12 ++ src/debugger/debuggertab.cpp | 1 + src/gui/configdialog.cpp | 20 +- src/gui/configdialog.h | 25 ++- src/gui/generaltab.cpp | 26 ++- src/gui/generaltab.h | 3 +- src/gui/modelsbiostab.cpp | 186 ++++++++++++++++++ src/gui/modelsbiostab.h | 36 ++++ src/modelsBIOS.cpp | 101 ++++++++++ src/modelsBIOS.h | 9 + src/settings.h | 12 +- virtualjaguar.pro | 4 + 15 files changed, 453 insertions(+), 17 deletions(-) create mode 100644 src/gui/modelsbiostab.cpp create mode 100644 src/gui/modelsbiostab.h create mode 100644 src/modelsBIOS.cpp create mode 100644 src/modelsBIOS.h diff --git a/Win-VS2017/jaguarcore/jaguarcore.vcxproj b/Win-VS2017/jaguarcore/jaguarcore.vcxproj index 8673d46..0c42c8d 100644 --- a/Win-VS2017/jaguarcore/jaguarcore.vcxproj +++ b/Win-VS2017/jaguarcore/jaguarcore.vcxproj @@ -175,6 +175,7 @@ + @@ -210,6 +211,7 @@ + diff --git a/Win-VS2017/jaguarcore/jaguarcore.vcxproj.filters b/Win-VS2017/jaguarcore/jaguarcore.vcxproj.filters index 4b2e499..182fffd 100644 --- a/Win-VS2017/jaguarcore/jaguarcore.vcxproj.filters +++ b/Win-VS2017/jaguarcore/jaguarcore.vcxproj.filters @@ -102,6 +102,9 @@ Header Files + + Header Files + @@ -185,5 +188,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/Win-VS2017/virtualjaguar.vcxproj b/Win-VS2017/virtualjaguar.vcxproj index 21361b7..3561824 100644 --- a/Win-VS2017/virtualjaguar.vcxproj +++ b/Win-VS2017/virtualjaguar.vcxproj @@ -285,6 +285,7 @@ + @@ -396,6 +397,10 @@ true true + + true + true + true true @@ -563,6 +568,10 @@ true true + + true + true + true true @@ -669,6 +678,24 @@ $(QTDIR)\bin\moc.exe;%(FullPath) $(QTDIR)\bin\moc.exe;%(FullPath) + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_OPENGL_LIB "-I." "-I.\..\src" "-I.\..\src\gui" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtOpenGL" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtWidgets" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtGui" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtANGLE" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtCore" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\mkspecs\win32-msvc2015" "-IC:\SDK\SDL-1.2.15\include" "-IC:\SDK\mesa-11.2.0-rc4\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-I.\GeneratedFiles\$(ConfigurationName)\." + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_OPENGL_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_UNICODE "-I." "-I.\..\src" "-I.\..\src\gui" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-IC:\SDK\SDL\SDL-1.2.15\include" "-IC:\SDK\DWARF\libdwarf-VS2015\include" "-IC:\SDK\Elf\libelf-0.8.13\include" "-IC:\SDK\zlib\zlib-1.2.8\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-IC:\SDK\OpenGL\include" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_NO_DEBUG -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_OPENGL_LIB "-I." "-I.\..\src" "-I.\..\src\gui" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtOpenGL" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtWidgets" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtGui" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtANGLE" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\include\QtCore" "-I.\..\..\..\Qt\Qt5.5.1\msvc2015_64\mkspecs\win32-msvc2015" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-I.\GeneratedFiles\$(ConfigurationName)\." + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -D__GCCWIN32__ -DQT_NO_DEBUG -DQT_OPENGL_LIB -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_UNICODE "-I." "-I.\..\src" "-I.\..\src\gui" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtOpenGL" "-IC:\SDK\OpenGL\include" "-IC:\SDK\SDL\SDL-1.2.15\include" "-IC:\SDK\DWARF\libdwarf-VS2015\include" "-IC:\SDK\Elf\libelf-0.8.13\include" "-IC:\SDK\zlib\zlib-1.2.11\include" "-I.\GeneratedFiles\$(ConfigurationName)\." + diff --git a/Win-VS2017/virtualjaguar.vcxproj.filters b/Win-VS2017/virtualjaguar.vcxproj.filters index 343ba00..720a840 100644 --- a/Win-VS2017/virtualjaguar.vcxproj.filters +++ b/Win-VS2017/virtualjaguar.vcxproj.filters @@ -391,6 +391,15 @@ Source Files\debugger + + Generated Files + + + Generated Files + + + Source Files\gui\tab + @@ -688,6 +697,9 @@ Header Files\debugger + + Header Files\gui\tab + diff --git a/src/debugger/debuggertab.cpp b/src/debugger/debuggertab.cpp index c5b3a00..07a6629 100644 --- a/src/debugger/debuggertab.cpp +++ b/src/debugger/debuggertab.cpp @@ -9,6 +9,7 @@ // --- ---------- ------------------------------------------------------------ // JPM 06/19/2016 Created this file // JPM 06/19/2016 Soft debugger support +// #include "debuggertab.h" #include "settings.h" diff --git a/src/gui/configdialog.cpp b/src/gui/configdialog.cpp index e4bcbad..cdf58cd 100644 --- a/src/gui/configdialog.cpp +++ b/src/gui/configdialog.cpp @@ -14,7 +14,8 @@ // JLH 10/14/2011 Fixed possibly missing final slash in paths // JPM 06/06/2016 Visual Studio support // JPM 06/19/2016 Soft debugger support -// JPM 09/ /2017 Added the Keybindings tab +// JPM 09/ /2017 Added a Keybindings tab +// JPM 09/03/2018 Added a Models & Bios tab // #include "configdialog.h" @@ -23,6 +24,7 @@ #include "controllertab.h" #include "controllerwidget.h" #include "generaltab.h" +#include "modelsbiostab.h" #include "KeyBindingsTab.h" #include "settings.h" @@ -30,6 +32,9 @@ ConfigDialog::ConfigDialog(QWidget * parent/*= 0*/) : QDialog(parent), tabWidget(new QTabWidget), generalTab(new GeneralTab(this)), +#ifdef NEWMODELSBIOSHANDLER +modelsbiosTab(new ModelsBiosTab), +#endif controllerTab1(new ControllerTab(this)), keybindingsTab(new KeyBindingsTab(this)) { @@ -42,6 +47,9 @@ keybindingsTab(new KeyBindingsTab(this)) // alpineTab = new AlpineTab(this); tabWidget->addTab(generalTab, tr("General")); +#ifdef NEWMODELSBIOSHANDLER + tabWidget->addTab(modelsbiosTab, tr("Models and Bios")); +#endif tabWidget->addTab(controllerTab1, tr("Controllers")); // tabWidget->addTab(controllerTab2, tr("Controller #2")); tabWidget->addTab(keybindingsTab, tr("Keybindings")); @@ -78,12 +86,15 @@ ConfigDialog::~ConfigDialog() } -// Load / Update the tabs dialog from the settings +// Load & Update the tabs dialog from the settings void ConfigDialog::LoadDialogFromSettings(void) { // General & Keybindings tab settings generalTab->GetSettings(); keybindingsTab->GetSettings(); +#ifdef NEWMODELSBIOSHANDLER + modelsbiosTab->GetSettings(); +#endif // Alpine tab settings (also needed by the Debugger) if (vjs.hardwareTypeAlpine || vjs.softTypeDebugger) @@ -114,11 +125,14 @@ void ConfigDialog::LoadDialogFromSettings(void) } -// Save / Update the settings from the tabs dialog +// Save & Update the settings from the tabs dialog void ConfigDialog::UpdateVJSettings(void) { generalTab->SetSettings(); keybindingsTab->SetSettings(); +#ifdef NEWMODELSBIOSHANDLER + modelsbiosTab->SetSettings(); +#endif if (vjs.hardwareTypeAlpine || vjs.softTypeDebugger) { diff --git a/src/gui/configdialog.h b/src/gui/configdialog.h index e8fa1bf..e200b4e 100644 --- a/src/gui/configdialog.h +++ b/src/gui/configdialog.h @@ -9,19 +9,26 @@ // Who When What // --- ---------- ------------------------------------------------------------ // JPM 06/19/2016 Soft debugger support +// JPM 09/03/2018 Added a Models & Bios tab // #ifndef __CONFIGDIALOG_H__ #define __CONFIGDIALOG_H__ +#define NEWMODELSBIOSHANDLER // New Jaguar models and bios usage handler + #include class GeneralTab; +#ifdef NEWMODELSBIOSHANDLER +class ModelsBiosTab; +#endif class ControllerTab; class AlpineTab; class DebuggerTab; class KeyBindingsTab; + class ConfigDialog: public QDialog { Q_OBJECT @@ -33,19 +40,21 @@ class ConfigDialog: public QDialog private: void LoadDialogFromSettings(void); - QString CheckForTrailingSlash(QString); private: - QTabWidget * tabWidget; - QDialogButtonBox * buttonBox; + QTabWidget *tabWidget; + QDialogButtonBox *buttonBox; public: - GeneralTab * generalTab; - ControllerTab * controllerTab1; -// ControllerTab * controllerTab2; + GeneralTab *generalTab; +#ifdef NEWMODELSBIOSHANDLER + ModelsBiosTab *modelsbiosTab; +#endif + ControllerTab *controllerTab1; +// ControllerTab *controllerTab2; KeyBindingsTab *keybindingsTab; - AlpineTab * alpineTab; - DebuggerTab * debuggerTab; + AlpineTab *alpineTab; + DebuggerTab *debuggerTab; }; #endif // __CONFIGDIALOG_H__ diff --git a/src/gui/generaltab.cpp b/src/gui/generaltab.cpp index ff24dc3..817818e 100644 --- a/src/gui/generaltab.cpp +++ b/src/gui/generaltab.cpp @@ -6,15 +6,21 @@ // See the README and GPLv3 files for licensing and warranty information // // JLH = James Hammons +// JPM = Jean-Paul Mari // // WHO WHEN WHAT // --- ---------- ------------------------------------------------------------ // JLH 06/23/2011 Created this file +// JPM 09/03/2018 Added a Models & Bios tab +// JPM 09/03/2018 Depend the platform transform slashes or backslashes +// +#include "configdialog.h" #include "generaltab.h" #include "settings.h" +// GeneralTab::GeneralTab(QWidget * parent/*= 0*/): QWidget(parent) { // I'm thinking we should scan the bios folder for the 5 known BIOSes, and @@ -54,7 +60,9 @@ GeneralTab::GeneralTab(QWidget * parent/*= 0*/): QWidget(parent) layout4->addLayout(layout3); // Checkboxes... +#ifndef NEWMODELSBIOSHANDLER useBIOS = new QCheckBox(tr("Enable Jaguar BIOS")); +#endif useGPU = new QCheckBox(tr("Enable GPU")); useDSP = new QCheckBox(tr("Enable DSP")); useFullScreen = new QCheckBox(tr("Start Virtual Jaguar in full screen")); @@ -62,7 +70,9 @@ GeneralTab::GeneralTab(QWidget * parent/*= 0*/): QWidget(parent) useUnknownSoftware = new QCheckBox(tr("Show all files in file chooser")); useFastBlitter = new QCheckBox(tr("Use fast blitter")); +#ifndef NEWMODELSBIOSHANDLER layout4->addWidget(useBIOS); +#endif layout4->addWidget(useGPU); layout4->addWidget(useDSP); layout4->addWidget(useFullScreen); @@ -74,6 +84,7 @@ GeneralTab::GeneralTab(QWidget * parent/*= 0*/): QWidget(parent) } +// GeneralTab::~GeneralTab() { } @@ -86,7 +97,9 @@ void GeneralTab::GetSettings(void) // generalTab->edit2->setText(vjs.CDBootPath); edit3->setText(vjs.EEPROMPath); edit4->setText(vjs.ROMPath); +#ifndef NEWMODELSBIOSHANDLER useBIOS->setChecked(vjs.useJaguarBIOS); +#endif useGPU->setChecked(vjs.GPUEnabled); useDSP->setChecked(vjs.DSPEnabled); useFullScreen->setChecked(vjs.fullscreen); @@ -95,7 +108,7 @@ void GeneralTab::GetSettings(void) } -// Save / Update the settings from the tabs dialog +// Save & Update the settings from the tabs dialog void GeneralTab::SetSettings(void) { // strcpy(vjs.jagBootPath, generalTab->edit1->text().toAscii().data()); @@ -103,7 +116,9 @@ void GeneralTab::SetSettings(void) strcpy(vjs.EEPROMPath, CheckForTrailingSlash(edit3->text()).toUtf8().data()); strcpy(vjs.ROMPath, CheckForTrailingSlash(edit4->text()).toUtf8().data()); +#ifndef NEWMODELSBIOSHANDLER vjs.useJaguarBIOS = useBIOS->isChecked(); +#endif vjs.GPUEnabled = useGPU->isChecked(); vjs.DSPEnabled = useDSP->isChecked(); vjs.fullscreen = useFullScreen->isChecked(); @@ -113,11 +128,18 @@ void GeneralTab::SetSettings(void) // Append a slash or a backslash at the end of the string +// Depend the platform transform slashes or backslashes QString GeneralTab::CheckForTrailingSlash(QString s) { if (!s.endsWith('/') && !s.endsWith('\\')) + { s.append('/'); - + } +#ifdef _WIN32 + s.replace(QString("/"), QString("\\")); +#else + s.replace(QString("\\"), QString("/")); +#endif return s; } diff --git a/src/gui/generaltab.h b/src/gui/generaltab.h index 491a61c..999523a 100644 --- a/src/gui/generaltab.h +++ b/src/gui/generaltab.h @@ -21,8 +21,9 @@ class GeneralTab: public QWidget QLineEdit *edit2; QLineEdit *edit3; QLineEdit *edit4; - +#ifndef NEWMODELSBIOSHANDLER QCheckBox *useBIOS; +#endif QCheckBox *useGPU; QCheckBox *useDSP; // QCheckBox *useHostAudio; diff --git a/src/gui/modelsbiostab.cpp b/src/gui/modelsbiostab.cpp new file mode 100644 index 0000000..5ec605e --- /dev/null +++ b/src/gui/modelsbiostab.cpp @@ -0,0 +1,186 @@ +// +// modelsbiostab.cpp: Models & Bios tab on the settings dialog +// +// Part of the Virtual Jaguar Project +/// See the README and GPLv3 files for licensing and warranty information +// +// JPM = Jean-Paul Mari +// +// WHO WHEN WHAT +// --- ---------- ------------------------------------------------------------ +// JPM 09/03/2018 Created this file +// + +#include "configdialog.h" +#include "modelsbiostab.h" +#include "settings.h" + + +// +ModelsBiosTab::ModelsBiosTab(QWidget * parent/*= 0*/): QWidget(parent), +listJaguarModel(new QComboBox()), +listRetailBIOS(new QComboBox()), +listDevBIOS(new QComboBox()), +JaguarModel(JAG_NULL_SERIES), +UseRetailBIOS(0), +UseDevBIOS(0), +BIOSValue(BT_NULL) +{ +#ifdef NEWMODELSBIOSHANDLER + // Jaguar model + QLabel *labelModel = new QLabel("Jaguar model"); + QHBoxLayout *layoutModel = new QHBoxLayout; + layoutModel->addWidget(labelModel); + listJaguarModel->addItem("Model K", QVariant(JAG_K_SERIES)); + listJaguarModel->addItem("Model M", QVariant(JAG_M_SERIES)); + layoutModel->addWidget(listJaguarModel); + QVBoxLayout *layout1 = new QVBoxLayout; + layout1->addLayout(layoutModel); + + // Retail BIOS select + QHBoxLayout *layoutRetailBIOS = new QHBoxLayout; + useRetailBIOS = new QCheckBox(tr("Retail BIOS")); + layoutRetailBIOS->addWidget(useRetailBIOS); + QVBoxLayout *layout2 = new QVBoxLayout; + layout2->addLayout(layoutRetailBIOS); + // BIOS selection + layoutRetailBIOS->addWidget(listRetailBIOS); + + // Developer BIOS select + QHBoxLayout *layoutDevBIOS = new QHBoxLayout; + useDevBIOS = new QCheckBox(tr("Developer BIOS")); + layoutDevBIOS->addWidget(useDevBIOS); + QVBoxLayout *layout3 = new QVBoxLayout; + layout3->addLayout(layoutDevBIOS); + // BIOS selection + listDevBIOS->hide(); + listDevBIOS->addItem("Stubulator '93", QVariant(BT_STUBULATOR_1)); + listDevBIOS->addItem("Stubulator '94", QVariant(BT_STUBULATOR_2)); + layoutDevBIOS->addWidget(listDevBIOS); + + // Set layouts + layout1->addLayout(layout2); + layout1->addLayout(layout3); + setLayout(layout1); + + // Connections + connect(useRetailBIOS, SIGNAL(stateChanged(int)), this, SLOT(stateChangedUseRetailBIOS(int))); + connect(useDevBIOS, SIGNAL(stateChanged(int)), this, SLOT(stateChangedUseDevBIOS(int))); + connect(listJaguarModel, SIGNAL(currentIndexChanged(int)), this, SLOT(CurrentIndexJaguarModel(int))); + connect(listDevBIOS, SIGNAL(currentIndexChanged(int)), this, SLOT(CurrentIndexDevBIOS(int))); +#endif +} + + +// +void ModelsBiosTab::stateChangedUseDevBIOS(int usedevbios) +{ +#ifdef NEWMODELSBIOSHANDLER + if ((UseDevBIOS = usedevbios)) + { + stateChangedUseRetailBIOS(0); + BIOSValue = listDevBIOS->itemData(listDevBIOS->currentIndex()).toInt(); + listDevBIOS->show(); + } + else + { + useDevBIOS->setChecked(false); + listDevBIOS->hide(); + } +#endif +} + + +// +void ModelsBiosTab::stateChangedUseRetailBIOS(int useretailbios) +{ +#ifdef NEWMODELSBIOSHANDLER + if ((UseRetailBIOS = useretailbios)) + { + stateChangedUseDevBIOS(0); + + switch (JaguarModel) + { + case JAG_K_SERIES: + listRetailBIOS->clear(); + listRetailBIOS->addItem("Model K", QVariant(BT_K_SERIES)); + BIOSValue = BT_K_SERIES; + break; + + case JAG_M_SERIES: + listRetailBIOS->clear(); + listRetailBIOS->addItem("Model M", QVariant(BT_M_SERIES)); + BIOSValue = BT_M_SERIES; + break; + + default: + break; + } + + listRetailBIOS->show(); + } + else + { + useRetailBIOS->setChecked(false); + listRetailBIOS->hide(); + } +#endif +} + + +// Get the index from the Jaguar models list +void ModelsBiosTab::CurrentIndexJaguarModel(int index) +{ +#ifdef NEWMODELSBIOSHANDLER + JaguarModel = listJaguarModel->itemData(index).toInt(); + stateChangedUseRetailBIOS(UseRetailBIOS); +#endif +} + + +// Get the index from the developer BIOS list +void ModelsBiosTab::CurrentIndexDevBIOS(int index) +{ +#ifdef NEWMODELSBIOSHANDLER + BIOSValue = listDevBIOS->itemData(index).toInt(); +#endif +} + + +// +ModelsBiosTab::~ModelsBiosTab() +{ +#ifdef NEWMODELSBIOSHANDLER +#endif +} + + +// Load & Update the tabs dialog from the settings +void ModelsBiosTab::GetSettings(void) +{ +#ifdef NEWMODELSBIOSHANDLER + listJaguarModel->setCurrentIndex(listJaguarModel->findData((JaguarModel = vjs.jaguarModel))); + listDevBIOS->setCurrentIndex(listDevBIOS->findData((BIOSValue = vjs.biosType))); + useRetailBIOS->setChecked((UseRetailBIOS = vjs.useRetailBIOS)); + useDevBIOS->setChecked((UseDevBIOS = vjs.useDevBIOS)); +#endif +} + + +// Save & Update the settings from the tabs dialog +void ModelsBiosTab::SetSettings(void) +{ +#ifdef NEWMODELSBIOSHANDLER + vjs.jaguarModel = JaguarModel; + if (!(vjs.useJaguarBIOS = (UseRetailBIOS | UseDevBIOS))) + { + vjs.biosType = 0; + } + else + { + vjs.biosType = BIOSValue; + } + vjs.useRetailBIOS = UseRetailBIOS; + vjs.useDevBIOS = UseDevBIOS; +#endif +} diff --git a/src/gui/modelsbiostab.h b/src/gui/modelsbiostab.h new file mode 100644 index 0000000..22d701f --- /dev/null +++ b/src/gui/modelsbiostab.h @@ -0,0 +1,36 @@ +#ifndef __MODELSBIOSTAB_H__ +#define __MODELSBIOSTAB_H__ + +#include + +class ModelsBiosTab: public QWidget +{ + Q_OBJECT + + public: + ModelsBiosTab(QWidget * parent = 0); + ~ModelsBiosTab(); + void GetSettings(void); + void SetSettings(void); + + protected slots: + void CurrentIndexJaguarModel(int index); + void stateChangedUseRetailBIOS(int useretailbios); + void stateChangedUseDevBIOS(int usedevbios); + void CurrentIndexDevBIOS(int index); + + private: + int JaguarModel; + int UseRetailBIOS; + int UseDevBIOS; + int BIOSValue; + QComboBox *listJaguarModel; + QComboBox *listRetailBIOS; + QCheckBox *useRetailBIOS; + QComboBox *listDevBIOS; + QCheckBox *useDevBIOS; + + public: +}; + +#endif // __MODELSBIOSTAB_H__ diff --git a/src/modelsBIOS.cpp b/src/modelsBIOS.cpp new file mode 100644 index 0000000..aa865b8 --- /dev/null +++ b/src/modelsBIOS.cpp @@ -0,0 +1,101 @@ +// +// modelsBIOS.cpp - Models and BIOS handler +// +// by Jean-Paul Mari +// +// JPM = Jean-Paul Mari +// +// Who When What +// --- ---------- ----------------------------------------------------------- +// JPM 09/04/2018 Created this file +// + + +#include "string.h" +#include "settings.h" +#include "jagbios.h" +#include "jagbios2.h" +#include "jagcdbios.h" +#include "jagstub1bios.h" +#include "jagstub2bios.h" +#include "memory.h" + + +typedef struct InfosBIOS +{ + void *ptrBIOS; + size_t sizeBIOS; + size_t intBIOS; +} +S_InfosBIOS; + + +S_InfosBIOS TabInfosBIOS[] = +{ + { NULL, 0, BT_NULL }, + { jaguarBootROM, 0x20000, BT_K_SERIES }, + { jaguarBootROM2, 0x20000, BT_M_SERIES }, + { jaguarDevBootROM1, 0x20000, BT_STUBULATOR_1 }, + { jaguarDevBootROM2, 0x20000, BT_STUBULATOR_2 } +}; + + +// Select a BIOS +// A valid default BIOS will be selected in case of no valid BIOS has been requested +bool SelectBIOS(int indexbios) +{ + int IndexBIOS; + +#if 1 + // Get the BIOS selected in the configuration tab + if (!indexbios) + { + indexbios = vjs.biosType; + } +#else + indexbios = 10; +#endif + + // Check if a default BIOS is required + if (!indexbios) + { + // Get default BIOS based on the Jaguar model + switch (vjs.jaguarModel) + { + case JAG_K_SERIES: + indexbios = BT_K_SERIES; + break; + + case JAG_M_SERIES: + indexbios = BT_M_SERIES; + break; + + default: + break; + } + } + + // look for the requested BIOS + IndexBIOS = (sizeof(TabInfosBIOS) / sizeof(S_InfosBIOS)); + while (TabInfosBIOS[--IndexBIOS].intBIOS && (TabInfosBIOS[IndexBIOS].intBIOS != indexbios)); + + // Put BIOS in memory or return if no BIOS exist (but it should never happen) + if (IndexBIOS) + { + memcpy(jagMemSpace + 0xE00000, TabInfosBIOS[IndexBIOS].ptrBIOS, TabInfosBIOS[IndexBIOS].sizeBIOS); + return true; + } + else + { + return false; + } +} + + +// +bool SetBIOS(void) +{ + memcpy(jaguarMainRAM, jagMemSpace + 0xE00000, 8); + return true; +} + diff --git a/src/modelsBIOS.h b/src/modelsBIOS.h new file mode 100644 index 0000000..37f3442 --- /dev/null +++ b/src/modelsBIOS.h @@ -0,0 +1,9 @@ +#ifndef __MODELSBIOS_H__ +#define __MODELSBIOS_H__ + + +extern bool SetBIOS(void); +extern bool SelectBIOS(int indexbios); + + +#endif // __MODELSBIOS_H__ diff --git a/src/settings.h b/src/settings.h index 8a22165..e3633d1 100644 --- a/src/settings.h +++ b/src/settings.h @@ -58,7 +58,9 @@ struct VJSettings bool useJoystick; int32_t joyport; // Joystick port bool hardwareTypeNTSC; // Set to false for PAL, otherwise it is NTSC - bool useJaguarBIOS; + bool useJaguarBIOS; // Use of any Jaguar BIOS + bool useRetailBIOS; // Use of Retail BIOS + bool useDevBIOS; // Use of Development BIOS bool GPUEnabled; bool DSPEnabled; bool usePipelinedDSP; @@ -72,7 +74,8 @@ struct VJSettings uint32_t renderType; uint32_t refresh; bool allowWritesToROM; - uint32_t biosType; + uint32_t biosType; // Bios type used + uint32_t jaguarModel; // Jaguar model size_t nbrdisasmlines; // Number of lines to show in the M68K tracing window bool disasmopcodes; bool displayHWlabels; @@ -101,8 +104,11 @@ struct VJSettings // Render types enum { RT_NORMAL = 0, RT_TV = 1 }; +// Jaguar models +enum { JAG_NULL_SERIES, JAG_K_SERIES, JAG_M_SERIES }; + // BIOS types -enum { BT_K_SERIES, BT_M_SERIES, BT_STUBULATOR_1, BT_STUBULATOR_2 }; +enum { BT_NULL, BT_K_SERIES, BT_M_SERIES, BT_STUBULATOR_1, BT_STUBULATOR_2 }; // Exported variables extern VJSettings vjs; diff --git a/virtualjaguar.pro b/virtualjaguar.pro index 1229262..60043d3 100644 --- a/virtualjaguar.pro +++ b/virtualjaguar.pro @@ -90,6 +90,7 @@ HEADERS = \ src/gui/filethread.h \ src/gui/gamepad.h \ src/gui/generaltab.h \ + src/gui/modelsbiostab.h \ src/gui/keybindingstab.h \ src/gui/glwidget.h \ src/gui/help.h \ @@ -125,6 +126,7 @@ HEADERS = \ src/unzip.h \ src/crc32.h \ src/settings.h \ + src/modelsBIOS.h \ src/file.h SOURCES = \ @@ -139,6 +141,7 @@ SOURCES = \ src/gui/filethread.cpp \ src/gui/gamepad.cpp \ src/gui/generaltab.cpp \ + src/gui/modelsbiostab.cpp \ src/gui/keybindingstab.cpp \ src/gui/glwidget.cpp \ src/gui/help.cpp \ @@ -174,5 +177,6 @@ SOURCES = \ src/unzip.cpp \ src/crc32.cpp \ src/settings.cpp \ + src/modelsBIOS.cpp \ src/file.cpp \ No newline at end of file -- 2.20.1