Virtual ISO: Add Qt and Win32 user interfaces

This commit is contained in:
RichardG867
2022-03-26 23:38:38 -03:00
parent eeeb7b258d
commit e11b211af8
50 changed files with 151 additions and 25 deletions

View File

@@ -290,10 +290,11 @@ cdrom_image_open(cdrom_t *dev, const char *fn)
return image_open_abort(dev);
/* All good, reset state. */
if (i == 2)
if (i >= 2)
dev->cd_status = CD_STATUS_DATA_ONLY;
else
dev->cd_status = CD_STATUS_STOPPED;
dev->is_dir = (i == 3);
dev->seek_pos = 0;
dev->cd_buflen = 0;
dev->cdrom_capacity = image_get_capacity(dev);

View File

@@ -222,11 +222,13 @@ cdi_close(cd_img_t *cdi)
int
cdi_set_device(cd_img_t *cdi, const char *path)
{
if (cdi_load_cue(cdi, path))
return 1;
int ret;
if (cdi_load_iso(cdi, path))
return 2;
if ((ret = cdi_load_cue(cdi, path)))
return ret;
if ((ret = cdi_load_iso(cdi, path)))
return ret;
return 0;
}
@@ -528,7 +530,7 @@ cdi_track_push_back(cd_img_t *cdi, track_t *trk)
int
cdi_load_iso(cd_img_t *cdi, const char *filename)
{
int error;
int error, ret = 2;
track_t trk;
cdi->tracks = NULL;
@@ -541,6 +543,7 @@ cdi_load_iso(cd_img_t *cdi, const char *filename)
if (error) {
if ((trk.file != NULL) && (trk.file->close != NULL))
trk.file->close(trk.file);
ret = 3;
trk.file = viso_init(filename, &error);
if (error) {
if ((trk.file != NULL) && (trk.file->close != NULL))
@@ -586,7 +589,7 @@ cdi_load_iso(cd_img_t *cdi, const char *filename)
trk.file = NULL;
cdi_track_push_back(cdi, &trk);
return 1;
return ret;
}
static int

View File

@@ -104,7 +104,7 @@ typedef struct cdrom {
media status. */
speed, cur_speed;
FILE* img_fp;
int is_dir;
void *priv;
char image_path[1024],

View File

@@ -438,7 +438,8 @@
#define IDM_CDROM_EMPTY 0x4300
#define IDM_CDROM_RELOAD 0x4400
#define IDM_CDROM_IMAGE 0x4500
#define IDM_CDROM_HOST_DRIVE 0x4600
#define IDM_CDROM_DIR 0x4600
#define IDM_CDROM_HOST_DRIVE 0x4700
#define IDM_ZIP_IMAGE_NEW 0x5200
#define IDM_ZIP_IMAGE_EXISTING 0x5300

View File

@@ -229,6 +229,9 @@ msgstr "&Načíst znova předchozí obraz"
msgid "&Image"
msgstr "&Obraz..."
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "&Cílová snímková frekvence"

View File

@@ -229,6 +229,9 @@ msgstr "&Voriges Image neu laden"
msgid "&Image"
msgstr "&Image"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "Ziel&framerate"

View File

@@ -229,6 +229,9 @@ msgstr "&Reload previous image"
msgid "&Image"
msgstr "&Image"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "Target &framerate"

View File

@@ -229,6 +229,9 @@ msgstr "&Reload previous image"
msgid "&Image"
msgstr "&Image"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "Target &framerate"

View File

@@ -229,6 +229,9 @@ msgstr "&Recargar imagen previa"
msgid "&Image"
msgstr "&Imagen..."
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "&Tasa de refresco objetivo"

View File

@@ -229,6 +229,9 @@ msgstr "&Lataa edellinen levykuva uudelleen"
msgid "&Image"
msgstr "L&evykuva"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "&Kuvataajuustavoite"

View File

@@ -229,6 +229,9 @@ msgstr "&Recharger image précedente"
msgid "&Image"
msgstr "&Image"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "&Taux de rafraîchissement cible"

View File

@@ -229,6 +229,9 @@ msgstr "&Ponovo učitaj prethodnu sliku"
msgid "&Image"
msgstr "&Slika"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "&Ciljni broj okvira u sekundi"

View File

@@ -229,6 +229,9 @@ msgstr "Előző képfájl &újratöltése"
msgid "&Image"
msgstr "&Meglévő képfájl &megnyitása..."
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "Cél &képkockasebesség"

View File

@@ -229,6 +229,9 @@ msgstr "&Ricarica l'immagine precedente"
msgid "&Image"
msgstr "&Immagine"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "Imposta obiettivo &fotogrammi"

View File

@@ -229,6 +229,9 @@ msgstr "前のイメージを再読み込み(&R)"
msgid "&Image"
msgstr "イメージ(&I)"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "目標フレームレート(&F)"

View File

@@ -229,6 +229,9 @@ msgstr "이전 이미지 다시 불러오기(&R)"
msgid "&Image"
msgstr "이미지(&I)"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "목표 프레임 레이트(&F)"

View File

@@ -229,6 +229,9 @@ msgstr "&Przeładuj poprzedni obraz"
msgid "&Image"
msgstr "&Obraz"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "Docelowa &liczba klatek na sekundę"

View File

@@ -229,6 +229,9 @@ msgstr "&Recarregar imagem anterior"
msgid "&Image"
msgstr "&Imagem"
msgid "&Folder"
msgstr "&Pasta"
msgid "Target &framerate"
msgstr "&Taxa de quadro pretendida"

View File

@@ -229,6 +229,9 @@ msgstr "&Recarregar imagem anterior"
msgid "&Image"
msgstr "&Imagem"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "&Taxa de quadros de destino"

View File

@@ -229,6 +229,9 @@ msgstr "&Снова загрузить предыдущий образ"
msgid "&Image"
msgstr "&Образ..."
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "Целевая &частота кадров"

View File

@@ -229,6 +229,9 @@ msgstr "&Naloži zadnjo sliko"
msgid "&Image"
msgstr "&Slika"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "&Ciljno št. sličic na sekundo"

View File

@@ -229,6 +229,9 @@ msgstr "&Önceki imajı seç"
msgid "&Image"
msgstr "&İmaj seç"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "Hedef &kare oranı"

View File

@@ -229,6 +229,9 @@ msgstr "&Знову завантажити попередній образ"
msgid "&Image"
msgstr "&Образ..."
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "Цільова &частота кадрів"

View File

@@ -229,6 +229,9 @@ msgstr "载入上一个镜像(&R)"
msgid "&Image"
msgstr "镜像(&I)"
msgid "&Folder"
msgstr "&Folder"
msgid "Target &framerate"
msgstr "目标帧率(&F)"

View File

@@ -119,7 +119,9 @@ void MediaMenu::refresh(QMenu *parentMenu) {
menu->addAction(tr("&Reload previous image"), [this, i]() { cdromReload(i); });
menu->addSeparator();
cdromImagePos = menu->children().count();
menu->addAction(tr("&Image"), [this, i]() { cdromMount(i); })->setCheckable(true);
menu->addAction(tr("&Image"), [this, i]() { cdromMount(i, 0); })->setCheckable(true);
cdromDirPos = menu->children().count();
menu->addAction(tr("&Folder"), [this, i]() { cdromMount(i, 1); })->setCheckable(true);
cdromMenus[i] = menu;
cdromUpdateMenu(i);
});
@@ -358,18 +360,23 @@ void MediaMenu::cdromMute(int i) {
sound_cd_thread_reset();
}
void MediaMenu::cdromMount(int i) {
QString dir;
void MediaMenu::cdromMount(int i, int dir) {
QString filename;
QFileInfo fi(cdrom[i].image_path);
auto filename = QFileDialog::getOpenFileName(
parentWidget,
QString(),
QString(),
tr("CD-ROM images") %
util::DlgFilter({ "iso","cue" }) %
tr("All files") %
util::DlgFilter({ "*" }, true));
if (dir) {
filename = QFileDialog::getExistingDirectory(
parentWidget);
} else {
filename = QFileDialog::getOpenFileName(
parentWidget,
QString(),
QString(),
tr("CD-ROM images") %
util::DlgFilter({ "iso","cue" }) %
tr("All files") %
util::DlgFilter({ "*" }, true));
}
if (filename.isEmpty()) {
return;
@@ -419,8 +426,10 @@ void MediaMenu::cdromUpdateMenu(int i) {
muteMenu->setChecked(cdrom[i].sound_on == 0);
auto* imageMenu = dynamic_cast<QAction*>(childs[cdromImagePos]);
auto* dirMenu = dynamic_cast<QAction*>(childs[cdromDirPos]);
auto* emptyMenu = dynamic_cast<QAction*>(childs[cdromEmptyPos]);
imageMenu->setChecked(cdrom[i].host_drive == 200);
imageMenu->setChecked((cdrom[i].host_drive == 200) && !cdrom[i].is_dir);
dirMenu->setChecked((cdrom[i].host_drive == 200) && cdrom[i].is_dir);
emptyMenu->setChecked(cdrom[i].host_drive != 200);
auto* prevMenu = dynamic_cast<QAction*>(childs[cdromReloadPos]);

View File

@@ -36,7 +36,7 @@ public:
void floppyUpdateMenu(int i);
void cdromMute(int i);
void cdromMount(int i);
void cdromMount(int i, int dir);
void cdromEject(int i);
void cdromReload(int i);
void cdromUpdateMenu(int i);
@@ -79,6 +79,7 @@ private:
int cdromEmptyPos;
int cdromReloadPos;
int cdromImagePos;
int cdromDirPos;
int zipEjectPos;
int zipReloadPos;

View File

@@ -184,6 +184,13 @@ plat_getcwd(char *bufp, int max)
return 0;
}
char *
plat_get_basename(const char *path)
{
QFileInfo fi(path);
return fi.fileName().toUtf8().data();
}
void
plat_get_dirname(char *dest, const char *path)
{

View File

@@ -154,7 +154,7 @@ void SettingsFloppyCDROM::save() {
/* Removable devices category */
model = ui->tableViewCDROM->model();
for (int i = 0; i < CDROM_NUM; i++) {
cdrom[i].img_fp = NULL;
cdrom[i].is_dir = 0;
cdrom[i].priv = NULL;
cdrom[i].ops = NULL;
cdrom[i].image = NULL;

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Načíst znova předchozí obraz", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Obraz...", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Voriges Image neu laden", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Image", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Reload previous image", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Image", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Reload previous image", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Image", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Recargar imagen previa", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Imagen...", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Lataa edellinen levykuva uudelleen", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "L&evykuva", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Recharger image précedente", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Image", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Ponovo učitaj prethodnu sliku", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Slika", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -182,6 +182,7 @@ BEGIN
MENUITEM "Előző képfájl &újratöltése", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Meglévő képfájl &megnyitása...", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -178,6 +178,7 @@ BEGIN
MENUITEM "&Ricarica l'immagine precedente", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Immagine", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "前のイメージを再読み込み(&R)", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "イメージ(&I)", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "이전 이미지 다시 불러오기(&R)", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "이미지(&I)", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Przeładuj poprzedni obraz", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Obraz", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -180,6 +180,7 @@ BEGIN
MENUITEM "&Recarregar imagem anterior", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Imagem", IDM_CDROM_IMAGE
MENUITEM "&Pasta", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Recarregar imagem anterior", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Imagem", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Снова загрузить предыдущий образ", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Образ...", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Naloži zadnjo sliko", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Slika", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Önceki imajı seç", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&İmaj seç", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "&Знову завантажити попередній образ", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "&Образ...", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -177,6 +177,7 @@ BEGIN
MENUITEM "载入上一个镜像(&R)", IDM_CDROM_RELOAD
MENUITEM SEPARATOR
MENUITEM "镜像(&I)", IDM_CDROM_IMAGE
MENUITEM "&Folder", IDM_CDROM_DIR
END
END

View File

@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <shlobj.h>
#include <86box/86box.h>
#include <86box/cdrom.h>
#include <86box/config.h>
@@ -308,11 +309,13 @@ media_menu_update_cdrom(int id)
CheckMenuItem(menus[i], IDM_CDROM_MUTE | id, MF_BYCOMMAND | MF_UNCHECKED);
if (cdrom[id].host_drive == 200) {
CheckMenuItem(menus[i], IDM_CDROM_IMAGE | id, MF_BYCOMMAND | MF_CHECKED);
CheckMenuItem(menus[i], IDM_CDROM_IMAGE | id, MF_BYCOMMAND | (cdrom[id].is_dir ? MF_UNCHECKED : MF_CHECKED));
CheckMenuItem(menus[i], IDM_CDROM_DIR | id, MF_BYCOMMAND | (cdrom[id].is_dir ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(menus[i], IDM_CDROM_EMPTY | id, MF_BYCOMMAND | MF_UNCHECKED);
} else {
cdrom[id].host_drive = 0;
CheckMenuItem(menus[i], IDM_CDROM_IMAGE | id, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menus[i], IDM_CDROM_DIR | id, MF_BYCOMMAND | MF_UNCHECKED);
CheckMenuItem(menus[i], IDM_CDROM_EMPTY | id, MF_BYCOMMAND | MF_CHECKED);
}
@@ -672,6 +675,27 @@ media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
case IDM_CDROM_DIR:
BROWSEINFO bi = {
.hwndOwner = hwnd,
.ulFlags = BIF_EDITBOX
};
OleInitialize(NULL);
int old_dopause = dopause;
plat_pause(1);
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
plat_pause(old_dopause);
plat_chdir(usr_path);
if (pidl) {
wchar_t wbuf[MAX_PATH + 1];
if (SHGetPathFromIDList(pidl, wbuf)) {
char buf[MAX_PATH + 1];
c16stombs(buf, wbuf, sizeof(buf) - 1);
cdrom_mount(id, buf);
}
}
break;
case IDM_ZIP_IMAGE_NEW:
NewFloppyDialogCreate(hwnd, id | 0x80, 0); /* NewZIPDialogCreate */
break;

View File

@@ -599,7 +599,7 @@ win_settings_save(void)
/* Removable devices category */
memcpy(cdrom, temp_cdrom, CDROM_NUM * sizeof(cdrom_t));
for (i = 0; i < CDROM_NUM; i++) {
cdrom[i].img_fp = NULL;
cdrom[i].is_dir = 0;
cdrom[i].priv = NULL;
cdrom[i].ops = NULL;
cdrom[i].image = NULL;