• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revision4f2e5a2c70471646cd671359406d9b5a6174def4 (tree)
Zeit2023-01-26 00:43:28
AutorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[UI][Qt][EMU_THREAD][WIP][DONOTBUILD] Updating APIs around virtual medias.

Ändern Zusammenfassung

Diff

--- a/source/src/emu.cpp
+++ b/source/src/emu.cpp
@@ -19,6 +19,8 @@
1919 #include "fifo.h"
2020 #include "fileio.h"
2121
22+#include "osdcall_types.h"
23+
2224 // ----------------------------------------------------------------------------
2325 // initialize
2426 // ----------------------------------------------------------------------------
@@ -159,6 +161,22 @@ EMU::~EMU()
159161 #endif
160162 }
161163
164+// messaging proxies.
165+// These are mostly used for replying mounting virtual media.
166+// 20230125 K.O
167+void EMU::osdcall_string(int media_type, int drive,int message_type, _TCHAR* message)
168+{
169+ __LIKELY_IF(osd != nullptr) {
170+ osd->string_message_from_emu(media_type, drive, message_type, message);
171+ }
172+}
173+
174+void EMU::osdcall_int(EMU_MEDIA_TYPE media_type, int drive, EMU_MESSAGE_TYPE message_type, int64_t data)
175+{
176+ __LIKELY_IF(osd != nullptr) {
177+ osd->int_message_from_emu(media_type, drive, message_type, data);
178+ }
179+}
162180
163181
164182 #ifdef OSD_QT
@@ -2630,7 +2648,7 @@ void EMU::open_floppy_disk(int drv, const _TCHAR* file_path, int bank)
26302648 }
26312649 delete fio;
26322650 }
2633-
2651+
26342652 if(vm->is_floppy_disk_inserted(drv)) {
26352653 vm->close_floppy_disk(drv);
26362654 // wait 0.5sec
@@ -2713,6 +2731,7 @@ uint32_t EMU::floppy_disk_indicator_color()
27132731 {
27142732 return vm->floppy_disk_indicator_color();
27152733 }
2734+
27162735 #endif
27172736
27182737 #ifdef USE_QUICK_DISK
@@ -2916,6 +2935,7 @@ uint32_t EMU::is_hard_disk_accessed()
29162935 {
29172936 return vm->is_hard_disk_accessed();
29182937 }
2938+
29192939 #endif
29202940
29212941 #ifdef USE_TAPE
@@ -3174,6 +3194,7 @@ uint32_t EMU::is_laser_disc_accessed()
31743194 {
31753195 return vm->is_laser_disc_accessed();
31763196 }
3197+
31773198 #endif
31783199
31793200 #ifdef USE_BINARY_FILE
--- a/source/src/emu_template.h
+++ b/source/src/emu_template.h
@@ -12,6 +12,8 @@
1212 #include <assert.h>
1313 #include "common.h"
1414 #include "config.h"
15+// For UIs
16+#include "osdcall_types.h"
1517
1618 //#include "vm/vm_template.h"
1719 #if defined(_USE_QT)
@@ -459,7 +461,7 @@ public:
459461 virtual bool is_floppy_disk_protected(int drv) { return false;}
460462 virtual uint32_t is_floppy_disk_accessed() { return 0x00000000; }
461463 virtual uint32_t floppy_disk_indicator_color() { return 0x00000000; }
462-
464+
463465 // cartridge
464466 virtual void open_cart(int drv, const _TCHAR* file_path) {}
465467 virtual void close_cart(int drv) {}
@@ -471,6 +473,10 @@ public:
471473 virtual bool is_quick_disk_connected(int drv) { return false; }
472474 virtual bool is_quick_disk_inserted(int drv) { return false; }
473475 virtual uint32_t is_quick_disk_accessed() { return 0x00000000; }
476+ virtual bool get_quick_disk_status(int drive = 0, _TCHAR* media_name, size_t buflen, bool& play, int& wait_count, int& cur_bank)
477+ {
478+ return false;
479+ }
474480
475481 // hard disk
476482 virtual bool create_blank_hard_disk(const _TCHAR* file_path,
@@ -480,6 +486,10 @@ public:
480486 virtual void close_hard_disk(int drv) {}
481487 virtual bool is_hard_disk_inserted(int drv) { return false; }
482488 virtual uint32_t is_hard_disk_accessed() { return 0x00000000; }
489+ virtual bool get_hard_disk_status(int drive = 0, _TCHAR* media_name, size_t buflen, bool& play, int& wait_count, int& cur_bank)
490+ {
491+ return false;
492+ }
483493
484494 // tape (CMT)
485495 virtual void play_tape(int drv, const _TCHAR* file_path) {}
@@ -540,5 +550,11 @@ public:
540550 virtual void load_state(const _TCHAR* file_path) {}
541551 virtual const _TCHAR *state_file_path(int num) { return (const _TCHAR*)_T("."); }
542552
553+ // messaging proxies.
554+ // These are mostly used for replying mounting virtual media.
555+ // 20230125 K.O
556+ virtual void __FASTCALL osdcall_string(EMU_MEDIA_TYPE media_type, int drive, EMU_MESSAGE_TYPE message_type, _TCHAR* message) {}
557+ virtual void __FASTCALL osdcall_int(EMU_MEDIA_TYPE media_type, int drive, EMU_MESSAGE_TYPE message_type, int64_t data) { }
558+
543559 };
544560
--- a/source/src/qt/common/emu_thread_slots.cpp
+++ b/source/src/qt/common/emu_thread_slots.cpp
@@ -520,16 +520,91 @@ void EmuThreadClassBase::do_close_disk(int drv)
520520
521521 void EmuThreadClassBase::do_open_disk(int drv, QString path, int bank)
522522 {
523+ if(path.isEmpty()) return;
524+ if(path.isNull()) return;
525+
526+ if(using_flags.get() == nullptr) return;
523527 if(!(using_flags->is_use_fd())) return;
528+
524529 const _TCHAR *file_path = (const _TCHAR *)(path.toLocal8Bit().constData());
525530 if(!(FILEIO::IsFileExisting(file_path))) return; // File not found.
526-
531+
532+ bool reserved = p_emu->is_floppy_disk_inserted(drv));
527533 p_emu->open_floppy_disk(drv, file_path, bank);
528534
529535 fd_open_wait_count[drv] = (int)(get_emu_frame_rate() * 0.05);
530536 fd_reserved_path[drv] = path;
531537 }
532538
539+// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
540+void EmuThreadClassBase::done_open_floppy_disk(int drive, QString path)
541+{
542+ if((using_flags.get() == nullptr) || (p_config == nullptr)) return;
543+
544+ if(!(using_flags->is_use_fd())) return;
545+ if((drive < 0) || (drive >= using_flags->get_max_drive())) return;
546+
547+ QStringList list;
548+ _TCHAR path_shadow[_MAX_PATH] = {0};
549+ strncpy(path_shadow, path.toLocal8Bit().constData(), _MAX_PATH - 1);
550+ UPDATE_HISTORY(path_shadow, p_config->recent_floppy_disk_path[drive], list);
551+
552+ const _TCHAR* __dir = get_parent_dir((const _TCHAR *)path_shadow);
553+ strncpy(p_config->initial_floppy_disk_dir, __dir, _MAX_PATH - 1);
554+
555+ emit sig_ui_update_floppy_list(drive, list);
556+ emit sig_ui_clear_d88(drive);
557+
558+ bool _f = check_file_extension(path_shadow, ".d88");
559+ _f |= check_file_extension(path_shadow, ".d77");
560+ QString relpath = QString::fromUtf8("");
561+ if(strlen(&(__dir[0])) > 1) {
562+ relpath = QString::fromLocal8Bit(&(__dir[1]));
563+ }
564+
565+ if(_f) {
566+ if(p_emu != nullptr) {
567+ int slot = p_emu->d88_file[drive].cur_bank;
568+ for(int i = 0; i < p_emu->d88_file[drive].bank_num; i++) {
569+ if(i >= 64) break;
570+ _TCHAR tmpname[128] = {0};
571+ my_strcpy_s(tmpname, 127, p_emu->d88_file[drive].disk_name[i]);
572+ QString tmps = QString::fromLocal8Bit(tmpname);
573+ emit sig_ui_update_d88(drive, i, tmps);
574+ if(i == slot) {
575+ emit sig_ui_select_d88(drive, i);
576+ relpath = tmps;
577+ }
578+ }
579+ }
580+ }
581+ emit sig_change_virtual_media(CSP_DockDisks_Domain_FD, drive, relpath);
582+}
583+
584+void EmuThreadClassBase::done_close_floppy_disk(int drive)
585+{
586+ emit sig_ui_close_floppy_disk(drive);
587+ emit sig_change_virtual_media(CSP_DockDisks_Domain_FD, drive, QString::fromUtf8(""));
588+}
589+
590+void EmuThreadClassBase::done_select_d88(int drive, int slot)
591+{
592+ if(p_emu == nullptr) return;
593+
594+ if(slot < 0) return;
595+ if(slot >= 64) return;
596+ if(p_emu->d88_file[drive].bank_num < 0) return;
597+ if(p_emu->d88_file[drive].bank_num >= 64) return;
598+ if(p_emu->d88_file[drive].bank_num <= slot) return;
599+ p_emu->d88_file[drive].cur_bank = slot;
600+ emit sig_ui_select_d88(drive, slot);
601+
602+ _TCHAR tmpname[128] = {0};
603+ my_strcpy_s(tmpname, 127, p_emu->d88_file[drive].disk_name[slot]);
604+ QString tmps = QString::fromLocal8Bit(tmpname);
605+ emit sig_change_virtual_media(CSP_DockDisks_Domain_FD, drive, tmps);
606+}
607+
533608 void EmuThreadClassBase::do_play_tape(int drv, QString name)
534609 {
535610 if(using_flags->is_use_tape()) {
@@ -605,6 +680,34 @@ void EmuThreadClassBase::do_cmt_push_apss_rewind(int drv)
605680 }
606681 }
607682
683+// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
684+void EmuThreadClassBase::done_open_tape(int drive, QString path)
685+{
686+ if((using_flags.get() == nullptr) || (p_config == nullptr)) return;
687+
688+ if(!(using_flags->is_use_tape())) return;
689+ if((drive < 0) || (drive >= using_flags->get_max_tape())) return;
690+
691+ QStringList list;
692+ _TCHAR path_shadow[_MAX_PATH] = {0};
693+ strncpy(path_shadow, path.toLocal8Bit().constData(), _MAX_PATH - 1);
694+ UPDATE_HISTORY(path_shadow, p_config->recent_tape_path[drive], list);
695+
696+ const _TCHAR* __dir = get_parent_dir((const _TCHAR *)path_shadow);
697+ strncpy(p_config->initial_tape_dir, __dir, _MAX_PATH - 1);
698+
699+ QString relpath = QString::fromUtf8("");
700+ if(strlen(&(__dir[0])) > 1) {
701+ relpath = QString::fromLocal8Bit(&(__dir[1]));
702+ }
703+ emit sig_ui_update_tape_list(drive, list);
704+ emit sig_change_virtual_media(CSP_DockDisks_Domain_CMT, drive, relpath);
705+}
706+void EmuThreadClassBase::done_close_tape(int drive)
707+{
708+ emit sig_ui_close_tape(drive);
709+ emit sig_change_virtual_media(CSP_DockDisks_Domain_CMT, drive, QString::fromUtf8(""));
710+}
608711
609712 void EmuThreadClassBase::do_write_protect_quickdisk(int drv, bool flag)
610713 {
@@ -631,6 +734,33 @@ void EmuThreadClassBase::do_open_quickdisk(int drv, QString path)
631734 emit sig_change_virtual_media(CSP_DockDisks_Domain_QD, drv, path);
632735 }
633736 }
737+// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
738+void EmuThreadClassBase::done_open_quick_disk(int drive, QString path)
739+{
740+ if((using_flags.get() == nullptr) || (p_config == nullptr)) return;
741+
742+ if(!(using_flags->is_use_qd())) return;
743+ if((drive < 0) || (drive >= using_flags->get_max_qd())) return;
744+
745+ QStringList list;
746+ _TCHAR path_shadow[_MAX_PATH] = {0};
747+ strncpy(path_shadow, path.toLocal8Bit().constData(), _MAX_PATH - 1);
748+ UPDATE_HISTORY(path_shadow, p_config->recent_quick_disk_path[drive], list);
749+ const _TCHAR* __dir = get_parent_dir((const _TCHAR *)path_shadow);
750+ strncpy(p_config->initial_quick_disk_dir, __dir, _MAX_PATH - 1);
751+
752+ QString relpath = QString::fromUtf8("");
753+ if(strlen(&(__dir[0])) > 1) {
754+ relpath = QString::fromLocal8Bit(&(__dir[1]));
755+ }
756+ emit sig_ui_update_quick_disk_list(drive, list);
757+ emit sig_change_virtual_media(CSP_DockDisks_Domain_QD, drive, relpath);
758+}
759+void EmuThreadClassBase::done_close_quick_disk(int drive)
760+{
761+ emit sig_ui_close_quick_disk(drive);
762+ emit sig_change_virtual_media(CSP_DockDisks_Domain_QD, drive, QString::fromUtf8(""));
763+}
634764
635765 void EmuThreadClassBase::do_open_cdrom(int drv, QString path)
636766 {
@@ -648,6 +778,34 @@ void EmuThreadClassBase::do_eject_cdrom(int drv)
648778 emit sig_change_virtual_media(CSP_DockDisks_Domain_CD, drv, QString::fromUtf8(""));
649779 }
650780 }
781+// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
782+void EmuThreadClassBase::done_open_compact_disc(int drive, QString path)
783+{
784+ if((using_flags.get() == nullptr) || (p_config == nullptr)) return;
785+
786+ if(!(using_flags->is_use_compact_disc())) return;
787+ if((drive < 0) || (drive >= using_flags->get_max_cd())) return;
788+
789+ QStringList list;
790+ _TCHAR path_shadow[_MAX_PATH] = {0};
791+ strncpy(path_shadow, path.toLocal8Bit().constData(), _MAX_PATH - 1);
792+ UPDATE_HISTORY(path_shadow, p_config->recent_compact_disc_path[drive], list);
793+
794+ const _TCHAR* __dir = get_parent_dir((const _TCHAR *)path_shadow);
795+ strncpy(p_config->initial_compact_disc_dir, __dir, _MAX_PATH - 1);
796+
797+ QString relpath = QString::fromUtf8("");
798+ if(strlen(&(__dir[0])) > 1) {
799+ relpath = QString::fromLocal8Bit(&(__dir[1]));
800+ }
801+ emit sig_ui_update_compact_disc_list(drive, list);
802+ emit sig_change_virtual_media(CSP_DockDisks_Domain_CD, drive, relpath);
803+}
804+void EmuThreadClassBase::done_close_compact_disc(int drive)
805+{
806+ emit sig_ui_close_compact_disc(drive);
807+ emit sig_change_virtual_media(CSP_DockDisks_Domain_CD, drive, QString::fromUtf8(""));
808+}
651809
652810 void EmuThreadClassBase::do_close_hard_disk(int drv)
653811 {
@@ -666,6 +824,34 @@ void EmuThreadClassBase::do_open_hard_disk(int drv, QString path)
666824 emit sig_change_virtual_media(CSP_DockDisks_Domain_HD, drv, path);
667825 }
668826 }
827+// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
828+void EmuThreadClassBase::done_open_hard_disk(int drive, QString path)
829+{
830+ if((using_flags.get() == nullptr) || (p_config == nullptr)) return;
831+
832+ if(!(using_flags->is_use_hdd())) return;
833+ if((drive < 0) || (drive >= using_flags->get_max_hdd())) return;
834+
835+ QStringList list;
836+ _TCHAR path_shadow[_MAX_PATH] = {0};
837+ strncpy(path_shadow, path.toLocal8Bit().constData(), _MAX_PATH - 1);
838+ UPDATE_HISTORY(path_shadow, p_config->recent_hard_disk_path[drive], list);
839+
840+ const _TCHAR* __dir = get_parent_dir((const _TCHAR *)path_shadow);
841+ strncpy(p_config->initial_hard_disk_dir, __dir, _MAX_PATH - 1);
842+
843+ QString relpath = QString::fromUtf8("");
844+ if(strlen(&(__dir[0])) > 1) {
845+ relpath = QString::fromLocal8Bit(&(__dir[1]));
846+ }
847+ emit sig_ui_update_hard_disk_list(drive, list);
848+ emit sig_change_virtual_media(CSP_DockDisks_Domain_HD, drive, relpath);
849+}
850+void EmuThreadClassBase::done_close_hard_disk(int drive)
851+{
852+ emit sig_ui_close_hard_disk(drive);
853+ emit sig_change_virtual_media(CSP_DockDisks_Domain_HD, drive, QString::fromUtf8(""));
854+}
669855
670856 void EmuThreadClassBase::do_close_cart(int drv)
671857 {
@@ -685,6 +871,34 @@ void EmuThreadClassBase::do_open_cart(int drv, QString path)
685871 }
686872 }
687873
874+// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
875+void EmuThreadClassBase::done_open_cart(int drive, QString path)
876+{
877+ if((using_flags.get() == nullptr) || (p_config == nullptr)) return;
878+
879+ if(!(using_flags->is_use_cart())) return;
880+ if((drive < 0) || (drive >= using_flags->get_max_cart())) return;
881+
882+ QStringList list;
883+ _TCHAR path_shadow[_MAX_PATH] = {0};
884+ strncpy(path_shadow, path.toLocal8Bit().constData(), _MAX_PATH - 1);
885+ UPDATE_HISTORY(path_shadow, p_config->recent_cart_path[drive], list);
886+
887+ const _TCHAR* __dir = get_parent_dir((const _TCHAR *)path_shadow);
888+ strncpy(p_config->initial_cart_dir, __dir, _MAX_PATH - 1);
889+
890+ QString relpath = QString::fromUtf8("");
891+ if(strlen(&(__dir[0])) > 1) {
892+ relpath = QString::fromLocal8Bit(&(__dir[1]));
893+ }
894+ emit sig_ui_update_cart_list(drive, list);
895+ emit sig_change_virtual_media(CSP_DockDisks_Domain_CART, drive, relpath);
896+}
897+void EmuThreadClassBase::done_close_cart(int drive)
898+{
899+ emit sig_ui_close_cart(drive);
900+ emit sig_change_virtual_media(CSP_DockDisks_Domain_CART, drive, QString::fromUtf8(""));
901+}
688902
689903 void EmuThreadClassBase::do_close_laser_disc(int drv)
690904 {
@@ -703,6 +917,34 @@ void EmuThreadClassBase::do_open_laser_disc(int drv, QString path)
703917 emit sig_change_virtual_media(CSP_DockDisks_Domain_LD, drv, path);
704918 }
705919 }
920+// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
921+void EmuThreadClassBase::done_open_laser_disc(int drive, QString path)
922+{
923+ if((using_flags.get() == nullptr) || (p_config == nullptr)) return;
924+
925+ if(!(using_flags->is_use_laser_disc())) return;
926+ if((drive < 0) || (drive >= using_flags->get_max_ld())) return;
927+
928+ QStringList list;
929+ _TCHAR path_shadow[_MAX_PATH] = {0};
930+ strncpy(path_shadow, path.toLocal8Bit().constData(), _MAX_PATH - 1);
931+ UPDATE_HISTORY(path_shadow, p_config->recent_laser_disc_path[drive], list);
932+
933+ const _TCHAR* __dir = get_parent_dir((const _TCHAR *)path_shadow);
934+ strncpy(p_config->initial_laser_disc_dir, __dir, _MAX_PATH - 1);
935+
936+ QString relpath = QString::fromUtf8("");
937+ if(strlen(&(__dir[0])) > 1) {
938+ relpath = QString::fromLocal8Bit(&(__dir[1]));
939+ }
940+ emit sig_ui_update_laser_disc_list(drive, list);
941+ emit sig_change_virtual_media(CSP_DockDisks_Domain_LD, drive, relpath);
942+}
943+void EmuThreadClassBase::done_close_laser_disc(int drive)
944+{
945+ emit sig_ui_close_laser_disc(drive);
946+ emit sig_change_virtual_media(CSP_DockDisks_Domain_LD, drv, QString::fromUtf8(""));
947+}
706948
707949 void EmuThreadClassBase::do_load_binary(int drv, QString path)
708950 {
@@ -722,6 +964,33 @@ void EmuThreadClassBase::do_save_binary(int drv, QString path)
722964 }
723965 }
724966
967+// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
968+void EmuThreadClassBase::done_open_binary(int drive, QString path)
969+{
970+ if((using_flags.get() == nullptr) || (p_config == nullptr)) return;
971+
972+ if(!(using_flags->is_use_binary_file())) return;
973+ if((drive < 0) || (drive >= using_flags->get_max_binary())) return;
974+
975+ QStringList list;
976+ _TCHAR path_shadow[_MAX_PATH] = {0};
977+ strncpy(path_shadow, path.toLocal8Bit().constData(), _MAX_PATH - 1);
978+ UPDATE_HISTORY(path_shadow, p_config->recent_binary_path[drive], list);
979+ const _TCHAR* __dir = get_parent_dir((const _TCHAR *)path_shadow);
980+ strncpy(p_config->initial_binary_dir, __dir, _MAX_PATH - 1);
981+
982+ QString relpath = QString::fromUtf8("");
983+ if(strlen(&(__dir[0])) > 1) {
984+ relpath = QString::fromLocal8Bit(&(__dir[1]));
985+ }
986+ emit sig_ui_update_binary_list(drive, list);
987+ emit sig_change_virtual_media(CSP_DockDisks_Domain_Binary, drive, relpath);
988+}
989+void EmuThreadClassBase::done_close_binary(int drive)
990+{
991+ emit sig_ui_close_binary(drive);
992+ emit sig_change_virtual_media(CSP_DockDisks_Domain_Binary, drv, QString::fromUtf8(""));
993+}
725994
726995 void EmuThreadClassBase::do_write_protect_bubble_casette(int drv, bool flag)
727996 {
@@ -738,7 +1007,7 @@ void EmuThreadClassBase::do_close_bubble_casette(int drv)
7381007 p_emu->close_bubble_casette(drv);
7391008 p_emu->b77_file[drv].bank_num = 0;
7401009 p_emu->b77_file[drv].cur_bank = -1;
741- emit sig_change_virtual_media(CSP_DockDisks_Domain_Bubble, drv, QString::fromUtf8(""));
1010+// emit sig_change_virtual_media(CSP_DockDisks_Domain_Bubble, drv, QString::fromUtf8(""));
7421011 }
7431012 }
7441013
@@ -791,6 +1060,71 @@ void EmuThreadClassBase::do_open_bubble_casette(int drv, QString path, int bank)
7911060 emit sig_update_recent_bubble(drv);
7921061
7931062 }
1063+// Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI)
1064+void EmuThreadClassBase::done_open_bubble(int drive, QString path)
1065+{
1066+ if((using_flags.get() == nullptr) || (p_config == nullptr)) return;
1067+
1068+ if(!(using_flags->is_use_bubble())) return;
1069+ if((drive < 0) || (drive >= using_flags->get_max_bubble())) return;
1070+
1071+ QStringList list;
1072+ _TCHAR path_shadow[_MAX_PATH] = {0};
1073+ strncpy(path_shadow, path.toLocal8Bit().constData(), _MAX_PATH - 1);
1074+ UPDATE_HISTORY(path_shadow, p_config->recent_bubble_casette_path[drive], list);
1075+
1076+ const _TCHAR* __dir = get_parent_dir((const _TCHAR *)path_shadow);
1077+ strncpy(p_config->initial_bubble_casette_dir, __dir, _MAX_PATH - 1);
1078+
1079+ emit sig_ui_update_bubble_casette_list(drive, list);
1080+ emit sig_ui_clear_b77(drive);
1081+
1082+ QString relpath = QString::fromUtf8("");
1083+ if(strlen(&(__dir[0])) > 1) {
1084+ relpath = QString::fromLocal8Bit(&(__dir[1]));
1085+ }
1086+ bool _f = check_file_extension(path_shadow, ".b77");
1087+ if(_f) {
1088+ if(p_emu != nullptr) {
1089+ int slot = p_emu->b77_file[drive].cur_bank;
1090+ for(int i = 0; i < p_emu->b77_file[drive].bank_num; i++) {
1091+ if(i >= 16) break;
1092+ _TCHAR tmpname[128] = {0};
1093+ my_strcpy_s(tmpname, 127, p_emu->b77_file[drive].bubble_name[i]);
1094+ QString tmps = QString::fromLocal8Bit(tmpname);
1095+ emit sig_ui_update_b77(drive, i, tmps);
1096+ if(i == slot) {
1097+ emit sig_ui_select_b77(drive, i);
1098+ relpath = tmps;
1099+ }
1100+ }
1101+ }
1102+ }
1103+ emit sig_change_virtual_media(CSP_DockDisks_Domain_Bubble, drive, relpath);
1104+}
1105+
1106+void EmuThreadClassBase::done_close_bubble_casette(int drive)
1107+{
1108+ emit sig_ui_close_bubble_casette(drive);
1109+ emit sig_change_virtual_media(CSP_DockDisks_Domain_Bubble, drive, QString::fromUtf8(""));
1110+}
1111+
1112+void EmuThreadClassBase::done_select_b77(int drive, int slot)
1113+{
1114+ if(p_emu == nullptr) return;
1115+
1116+ if(slot < 0) return;
1117+ if(slot >= 16) return;
1118+ if(p_emu->b77_file[drive].bank_num < 0) return;
1119+ if(p_emu->b77_file[drive].bank_num >= 64) return;
1120+ if(p_emu->b77_file[drive].bank_num <= slot) return;
1121+ p_emu->b77_file[drive].cur_bank = slot;
1122+ _TCHAR tmpname[128] = {0};
1123+ my_strcpy_s(tmpname, 127, p_emu->b77_file[drive].bubble_name[slot]);
1124+ QString tmps = QString::fromLocal8Bit(tmpname);
1125+ emit sig_ui_select_b77(drive, slot);
1126+ emit sig_change_virtual_media(CSP_DockDisks_Domain_Bubble, drive, tmps);
1127+}
7941128
7951129 // Debugger
7961130
--- a/source/src/qt/gui/emu_thread_tmpl.cpp
+++ b/source/src/qt/gui/emu_thread_tmpl.cpp
@@ -211,7 +211,7 @@ void EmuThreadClassBase::button_released_mouse(Qt::MouseButton button)
211211 }
212212 }
213213
214-
214+// New UI
215215 void EmuThreadClassBase::do_key_down(uint32_t vk, uint32_t mod, bool repeat)
216216 {
217217 key_queue_t sp;
@@ -256,6 +256,8 @@ void EmuThreadClassBase::sample_access_drv(void)
256256 }
257257
258258
259+
260+
259261 void EmuThreadClassBase::do_update_config()
260262 {
261263 bUpdateConfigReq = true;
--- a/source/src/qt/gui/emu_thread_tmpl.h
+++ b/source/src/qt/gui/emu_thread_tmpl.h
@@ -360,6 +360,36 @@ public slots:
360360 void set_romakana(bool flag);
361361 void do_close_debugger(void);
362362
363+ // Signal from EMU:: -> OSD:: -> EMU_THREAD (-> GUI (menu_foo[bar]))
364+ void done_open_floppy_disk(int drive, QString path);
365+ void done_close_floppy_disk(int drive);
366+ void done_select_d88(int drive, int slot);
367+
368+ void done_open_tape(int drive, QString path);
369+ void done_close_tape(int drive);
370+
371+ void done_open_quick_disk(int drive, QString path);
372+ void done_close_quick_disk(int drive);
373+
374+ void done_open_compact_disc(int drive, QString path);
375+ void done_close_compact_disc(int drive);
376+
377+ void done_open_hard_disk(int drive, QString path);
378+ void done_close_hard_disk(int drive);
379+
380+ void done_open_cart(int drive, QString path);
381+ void done_close_cart(int drive);
382+
383+ void done_open_laser_disc(int drive, QString path);
384+ void done_close_laser_disc(int drive);
385+
386+ void done_open_binary(int drive, QString path);
387+ void done_close_binary(int drive);
388+
389+ void done_open_bubble(int drive, QString path);
390+ void done_close_bubble(int drive);
391+ void done_select_b77(int drive, int slot);
392+
363393 signals:
364394 int message_changed(QString);
365395 int window_title_changed(QString);
@@ -412,6 +442,41 @@ signals:
412442 int sig_set_draw_fps(double);
413443 int sig_draw_one_turn(bool);
414444 int sig_update_d88_list(int, int);
445+
446+// Signal from (EMU:: -> OSD:: ->) EMU_THREAD -> GUI(menu_foo[bar])
447+ int sig_ui_update_floppy_list(int, QStringList);
448+ int sig_ui_close_floppy_disk(int);
449+ int sig_ui_clear_d88(int);
450+ int sig_ui_update_d88(int, int, QString);
451+ int sig_ui_select_d88(int, int);
452+
453+ int sig_ui_update_tape_list(int, QStringList);
454+ int sig_ui_close_tape(int);
455+
456+ int sig_ui_update_quick_disk_list(int, QStringList);
457+ int sig_ui_close_quick_disk(int);
458+
459+ int sig_ui_update_compact_disc_list(int, QStringList);
460+ int sig_ui_close_compact_disc(int);
461+
462+ int sig_ui_update_hard_disk_list(int, QStringList);
463+ int sig_ui_close_hard_disk(int);
464+
465+ int sig_ui_update_cart_list(int, QStringList);
466+ int sig_ui_close_cart_disk(int);
467+
468+ int sig_ui_update_laser_disc_list(int, QStringList);
469+ int sig_ui_close_laser_disc(int);
470+
471+ int sig_ui_update_binary_list(int, QStringList);
472+ int sig_ui_close_binary(int);
473+
474+ int sig_ui_update_bubble_casette_list(int, QStringList);
475+ int sig_ui_close_bubble_casette(int);
476+ int sig_ui_clear_b77(int);
477+ int sig_ui_update_b77(int, int, QString);
478+ int sig_ui_select_b77(int, int);
479+
415480 };
416481
417482 QT_END_NAMESPACE
--- a/source/src/qt/gui/menu_metaclass.cpp
+++ b/source/src/qt/gui/menu_metaclass.cpp
@@ -53,7 +53,6 @@ Menu_MetaClass::Menu_MetaClass(QMenuBar *root_entry, QString desc, std::shared_p
5353 initial_dir = QString::fromUtf8("");
5454
5555 ext_filter.clear();
56- history.clear();
5756 inner_media_list.clear();
5857 window_title = QString::fromUtf8("");
5958
@@ -256,28 +255,42 @@ void Menu_MetaClass::do_update_histories(QStringList lst)
256255 {
257256 int ii;
258257 QString tmps;
259-
260- history.clear();
261- for(ii = 0; ii < MAX_HISTORY; ii++) {
262- tmps = QString::fromUtf8("");
263- if(ii < lst.size()) tmps = lst.value(ii);
264- history << tmps;
265- action_recent_list[ii]->setText(tmps);
266- if(!tmps.isEmpty()) {
267- action_recent_list[ii]->setVisible(true);
268- } else {
269- action_recent_list[ii]->setVisible(false);
270- }
258+ for(int i = 0; i < lst.size(); i++) {
259+ if(i >= MAX_HISTORY) break;
260+ action_recent_list[i]->setText(lst.at(i));
261+ action_recent_list[i]->setVisible(true);
271262 }
263+ for(int i = lst.size(); i < MAX_HISTORY; i++) {
264+ action_recent_list[i]->setText(QString::fromUtf8(""));
265+ action_recent_list[i]->setVisible(false);
266+ }
272267 }
273268
269+void Menu_MetaClass::do_add_media(QStringList path)
270+{
271+ if(path.isEmpty()) return;
272+ if(path.isNull()) return;
273+
274+ QStringList list;
275+ list.clear();
276+ list.append(path);
277+ for(int i = 0; i < MAX_HISTORY; i++) {
278+ if(action_recent_list[i] != nullptr) {
279+ QString tmps = action_recent_list[i]->text();
280+ if(tmps != path) {
281+ list.append(tmps);
282+ }
283+ }
284+ }
285+ do_update_histories(list);
286+}
274287 void Menu_MetaClass::do_clear_inner_media(void)
275288 {
276289 int ii;
277290 inner_media_list.clear();
278291 if(use_d88_menus) {
279292 for(ii = 0; ii < using_flags->get_max_d88_banks(); ii++) {
280- if(action_select_media_list[ii] != NULL) {
293+ if(action_select_media_list[ii] != nullptr) {
281294 action_select_media_list[ii]->setText(QString::fromUtf8(""));
282295 action_select_media_list[ii]->setVisible(false);
283296 }
--- a/source/src/qt/gui/util_fd.cpp
+++ b/source/src/qt/gui/util_fd.cpp
@@ -89,3 +89,21 @@ void Ui_MainWindowBase::ConfigFloppyMenu(void)
8989 ConfigFloppyMenuSub(i);
9090 }
9191 }
92+
93+void Uo_MainWindowBase::do_update_floppy_history(int drive, QStringList lst)
94+{
95+ if((drive < 0) || (drive >= using_flags->get_max_drive())) {
96+ if(menu_fds[drv] != nullptr) {
97+ menu_fds[drv]->do_update_histories(lst);
98+ }
99+ }
100+}
101+
102+void Uo_MainWindowBase::do_insert_floppy_history(int drive, QString path)
103+{
104+ if((drive < 0) || (drive >= using_flags->get_max_drive())) {
105+ if(menu_fds[drv] != nullptr) {
106+ menu_fds[drv]->do_update_histories(lst);
107+ }
108+ }
109+}
--- a/source/src/qt/osd_base.cpp
+++ b/source/src/qt/osd_base.cpp
@@ -671,3 +671,12 @@ Sint16* OSD_BASE::create_sound(int *extra_frames)
671671 return (Sint16 *)vm->create_sound(extra_frames);
672672 }
673673
674+void OSD_BASE::string_message_to_binary(int media_type, int drive, int message_type, _TCHAR* message)
675+{
676+}
677+void OSD_BASE::string_message_from_emu(int media_type, int drive, int message_type, _TCHAR* message)
678+{
679+ switch(media_type) {
680+ case EMU_MEDIA_TYPE::BINARY:
681+ }
682+}
--- a/source/src/qt/osd_base.h
+++ b/source/src/qt/osd_base.h
@@ -714,6 +714,9 @@ public slots:
714714 void do_set_host_sound_output_device(QString device_name);
715715 void do_update_master_volume(int level);
716716
717+ // Messaging wrapper from EMU:: to OSD::
718+ void __FASTCALL string_message_from_emu(EMU_MEDIA_TYPE media_type, int drive, EMU_MESSAGE_TYPE message_type, _TCHAR* message);
719+ void __FASTCALL int_message_from_emu(EMU_MEDIA_TYPE media_type, int drive, EMU_MESSAGE_TYPE message_type, int64_t data);
717720 signals:
718721 int sig_update_screen(void *, bool);
719722 int sig_save_screen(const char *);
@@ -761,7 +764,23 @@ signals:
761764 int sig_change_virtual_media(int, int, QString);
762765
763766 int sig_notify_power_off(void); // To GUI 20230120 K.O
767+
768+ // To GUI 20230125 K.O
769+ int sig_notify_opened_virtual_media(int type, int drive, QString path);
770+ int sig_notify_closed_virtual_media(int type, int drive);
771+ int sig_notify_update_virtual_media_list(int type, int drive, QStringList names);
772+
773+ int sig_notify_error_virtual_media(int type, int drive, int64_t status);
774+ int sig_notify_select_d88(int drive, int cur_bank);
775+ int sig_notify_update_d88_list(int drive, int bank_num, QStringList names);
776+ int sig_notify_clear_b77_list(int drive, int cur_bank);
777+
778+ int sig_notify_select_b77(int drive, int cur_bank);
779+ int sig_notify_update_b77_list(int drive, int bank_num, QStringList names);
780+ int sig_notify_clear_b77_list(int drive, int cur_bank);
781+
764782 };
783+
765784 QT_END_NAMESPACE
766785
767786 #endif
Show on old repository browser