Initial underlying code support for more than 2 video cards

This commit is contained in:
Jasmine Iwanek
2024-06-29 19:43:42 -04:00
parent dfe83ac32a
commit 322adf1c2b
8 changed files with 54 additions and 33 deletions

View File

@@ -179,7 +179,7 @@ int postcard_enabled = 0; /* (C) enable
int unittester_enabled = 0; /* (C) enable unit tester device */ int unittester_enabled = 0; /* (C) enable unit tester device */
int isamem_type[ISAMEM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA mem cards */ int isamem_type[ISAMEM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA mem cards */
int isartc_type = 0; /* (C) enable ISA RTC card */ int isartc_type = 0; /* (C) enable ISA RTC card */
int gfxcard[2] = { 0, 0 }; /* (C) graphics/video card */ int gfxcard[GFXCARD_MAX] = { 0, 0 }; /* (C) graphics/video card */
int show_second_monitors = 1; /* (C) show non-primary monitors */ int show_second_monitors = 1; /* (C) show non-primary monitors */
int sound_is_float = 1; /* (C) sound uses FP values */ int sound_is_float = 1; /* (C) sound uses FP values */
int voodoo_enabled = 0; /* (C) video option */ int voodoo_enabled = 0; /* (C) video option */
@@ -1004,12 +1004,15 @@ pc_init_modules(void)
} }
} }
if (!video_card_available(gfxcard[1])) { // TODO
char tempc[512] = { 0 }; for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
device_get_name(video_card_getdevice(gfxcard[1]), 0, tempc); if (!video_card_available(gfxcard[i])) {
swprintf(temp, sizeof_w(temp), plat_get_string(STRING_HW_NOT_AVAILABLE_VIDEO2), tempc); char tempc[512] = { 0 };
ui_msgbox_header(MBX_INFO, plat_get_string(STRING_HW_NOT_AVAILABLE_TITLE), temp); device_get_name(video_card_getdevice(gfxcard[i]), 0, tempc);
gfxcard[1] = 0; swprintf(temp, sizeof_w(temp), plat_get_string(STRING_HW_NOT_AVAILABLE_VIDEO2), tempc);
ui_msgbox_header(MBX_INFO, plat_get_string(STRING_HW_NOT_AVAILABLE_TITLE), temp);
gfxcard[i] = 0;
}
} }
atfullspeed = 0; atfullspeed = 0;

View File

@@ -459,10 +459,13 @@ load_video(void)
show_second_monitors = !!ini_section_get_int(cat, "show_second_monitors", 1); show_second_monitors = !!ini_section_get_int(cat, "show_second_monitors", 1);
video_fullscreen_scale_maximized = !!ini_section_get_int(cat, "video_fullscreen_scale_maximized", 0); video_fullscreen_scale_maximized = !!ini_section_get_int(cat, "video_fullscreen_scale_maximized", 0);
p = ini_section_get_string(cat, "gfxcard_2", NULL); // TODO
if (!p) for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
p = "none"; p = ini_section_get_string(cat, "gfxcard_2", NULL);
gfxcard[1] = video_get_video_from_internal_name(p); if (!p)
p = "none";
gfxcard[i] = video_get_video_from_internal_name(p);
}
} }
/* Load "Input Devices" section. */ /* Load "Input Devices" section. */
@@ -2010,10 +2013,13 @@ save_video(void)
else else
ini_section_set_int(cat, "xga", xga_standalone_enabled); ini_section_set_int(cat, "xga", xga_standalone_enabled);
if (gfxcard[1] == 0) // TODO
ini_section_delete_var(cat, "gfxcard_2"); for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
else if (gfxcard[i] == 0)
ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard[1])); ini_section_delete_var(cat, "gfxcard_2");
else
ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard[i]));
}
if (show_second_monitors == 1) if (show_second_monitors == 1)
ini_section_delete_var(cat, "show_second_monitors"); ini_section_delete_var(cat, "show_second_monitors");

View File

@@ -21,6 +21,7 @@
#define EMU_86BOX_H #define EMU_86BOX_H
/* Configuration values. */ /* Configuration values. */
#define GFXCARD_MAX 2
#define SERIAL_MAX 7 #define SERIAL_MAX 7
#define PARALLEL_MAX 4 #define PARALLEL_MAX 4
#define SCREEN_RES_X 640 #define SCREEN_RES_X 640
@@ -124,7 +125,7 @@ extern int force_43; /* (C) video */
extern int video_filter_method; /* (C) video */ extern int video_filter_method; /* (C) video */
extern int video_vsync; /* (C) video */ extern int video_vsync; /* (C) video */
extern int video_framerate; /* (C) video */ extern int video_framerate; /* (C) video */
extern int gfxcard[2]; /* (C) graphics/video card */ extern int gfxcard[GFXCARD_MAX]; /* (C) graphics/video card */
extern char video_shader[512]; /* (C) video */ extern char video_shader[512]; /* (C) video */
extern int bugger_enabled; /* (C) enable ISAbugger */ extern int bugger_enabled; /* (C) enable ISAbugger */
extern int novell_keycard_enabled; /* (C) enable Novell NetWare 2.x key card emulation. */ extern int novell_keycard_enabled; /* (C) enable Novell NetWare 2.x key card emulation. */

View File

@@ -145,9 +145,11 @@ main_thread_fn()
} }
is_quit = 1; is_quit = 1;
if (gfxcard[1]) { for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
ui_deinit_monitor(1); if (gfxcard[i]) {
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ui_deinit_monitor(i);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
} }
QTimer::singleShot(0, QApplication::instance(), []() { QApplication::processEvents(); QApplication::instance()->quit(); }); QTimer::singleShot(0, QApplication::instance(), []() { QApplication::processEvents(); QApplication::instance()->quit(); });
} }

View File

@@ -36,8 +36,8 @@ SettingsDisplay::SettingsDisplay(QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
videoCard[0] = gfxcard[0]; for (uint8_t i = 0; i < GFXCARD_MAX; i ++)
videoCard[1] = gfxcard[1]; videoCard[i] = gfxcard[i];
onCurrentMachineChanged(machine); onCurrentMachineChanged(machine);
} }
@@ -50,7 +50,9 @@ void
SettingsDisplay::save() SettingsDisplay::save()
{ {
gfxcard[0] = ui->comboBoxVideo->currentData().toInt(); gfxcard[0] = ui->comboBoxVideo->currentData().toInt();
gfxcard[1] = ui->comboBoxVideoSecondary->currentData().toInt(); // TODO
for (uint8_t i = 1; i < GFXCARD_MAX; i ++)
gfxcard[i] = ui->comboBoxVideoSecondary->currentData().toInt();
voodoo_enabled = ui->checkBoxVoodoo->isChecked() ? 1 : 0; voodoo_enabled = ui->checkBoxVoodoo->isChecked() ? 1 : 0;
ibm8514_standalone_enabled = ui->checkBox8514->isChecked() ? 1 : 0; ibm8514_standalone_enabled = ui->checkBox8514->isChecked() ? 1 : 0;
xga_standalone_enabled = ui->checkBoxXga->isChecked() ? 1 : 0; xga_standalone_enabled = ui->checkBoxXga->isChecked() ? 1 : 0;
@@ -103,8 +105,10 @@ SettingsDisplay::onCurrentMachineChanged(int machineId)
ui->pushButtonConfigureSecondary->setEnabled(true); ui->pushButtonConfigureSecondary->setEnabled(true);
} }
ui->comboBoxVideo->setCurrentIndex(selectedRow); ui->comboBoxVideo->setCurrentIndex(selectedRow);
if (gfxcard[1] == 0) // TODO
ui->pushButtonConfigureSecondary->setEnabled(false); for (uint8_t i = 1; i < GFXCARD_MAX; i ++)
if (gfxcard[i] == 0)
ui->pushButtonConfigureSecondary->setEnabled(false);
} }
void void

View File

@@ -3,6 +3,8 @@
#include <QWidget> #include <QWidget>
#define VIDEOCARD_MAX 2
namespace Ui { namespace Ui {
class SettingsDisplay; class SettingsDisplay;
} }
@@ -36,7 +38,7 @@ private slots:
private: private:
Ui::SettingsDisplay *ui; Ui::SettingsDisplay *ui;
int machineId = 0; int machineId = 0;
int videoCard[2] = { 0, 0 }; int videoCard[VIDEOCARD_MAX] = { 0, 0 };
}; };
#endif // QT_SETTINGSDISPLAY_HPP #endif // QT_SETTINGSDISPLAY_HPP

View File

@@ -1168,7 +1168,7 @@ monitor_thread(void *param)
#endif #endif
} }
extern int gfxcard[2]; extern int gfxcard[GFXCARD_MAX];
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
@@ -1186,7 +1186,8 @@ main(int argc, char **argv)
return 6; return 6;
} }
gfxcard[1] = 0; for (uint8_t i = 1; i < GFXCARD_MAX; i++)
gfxcard[i] = 0;
eventthread = SDL_ThreadID(); eventthread = SDL_ThreadID();
blitmtx = SDL_CreateMutex(); blitmtx = SDL_CreateMutex();
if (!blitmtx) { if (!blitmtx) {

View File

@@ -349,12 +349,14 @@ video_reset(int card)
monitor_index_global = 0; monitor_index_global = 0;
loadfont("roms/video/mda/mda.rom", 0); loadfont("roms/video/mda/mda.rom", 0);
if ((card != VID_NONE) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY) && for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
(gfxcard[1] > VID_INTERNAL) && device_is_valid(video_card_getdevice(gfxcard[1]), machine)) { if ((card != VID_NONE) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY) &&
video_monitor_init(1); (gfxcard[i] > VID_INTERNAL) && device_is_valid(video_card_getdevice(gfxcard[i]), machine)) {
monitor_index_global = 1; video_monitor_init(i);
device_add(video_cards[gfxcard[1]].device); monitor_index_global = 1;
monitor_index_global = 0; device_add(video_cards[gfxcard[i]].device);
monitor_index_global = 0;
}
} }
/* Do not initialize internal cards here. */ /* Do not initialize internal cards here. */