OSDN Git Service

.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 19 Feb 2023 17:09:27 +0000 (02:09 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 19 Feb 2023 17:09:27 +0000 (02:09 +0900)
23 files changed:
source/src/qt/CMakeLists.txt
source/src/qt/avio/CMakeLists.txt
source/src/qt/common/emu_thread.cpp
source/src/qt/common/emu_thread_slots.cpp
source/src/qt/common/qt_utils.cpp
source/src/qt/common/util_bubble2.cpp
source/src/qt/emuutils/CMakeLists.txt
source/src/qt/gui/CMakeLists.txt
source/src/qt/gui/commonclasses.h
source/src/qt/gui/draw_thread.cpp
source/src/qt/gui/emu_thread_tmpl.cpp
source/src/qt/gui/emu_thread_tmpl.h
source/src/qt/gui/mainwidget_base.h
source/src/qt/gui/menu_bubble.cpp
source/src/qt/gui/menu_bubble.h
source/src/qt/gui/menu_cart.cpp
source/src/qt/gui/menu_cart.h
source/src/qt/gui/menu_main.cpp
source/src/qt/gui/util_bubble.cpp
source/src/qt/gui/util_fd2.cpp
source/src/qt/osd_base.cpp
source/src/vm/common_vm/CMakeLists.txt
source/src/vm/fmgen/CMakeLists.txt

index 074e372..7e0372c 100644 (file)
@@ -1,5 +1,5 @@
 message("* qt/osd")
-SET(THIS_LIB_VERSION 9.1.0)
+SET(THIS_LIB_VERSION 9.2.0)
 
 set(s_qt_osd_headers
        osd_base.h
index b65ba1f..afd4d6a 100644 (file)
@@ -1,6 +1,6 @@
 message("* qt/avio")
 
-SET(THIS_LIB_VERSION 7.5.3)
+SET(THIS_LIB_VERSION 7.5.4)
 set(s_qt_avio_headers
        csp_avio_basic.h
        movie_saver.h
index 11b3bf2..c28cfe0 100644 (file)
@@ -44,8 +44,8 @@ EmuThreadClass::EmuThreadClass(Ui_MainWindowBase *rootWindow, std::shared_ptr<US
        connect(this, SIGNAL(sig_open_binary_save(int, QString)), MainWindow, SLOT(_open_binary_save(int, QString)));
        connect(this, SIGNAL(sig_open_cart(int, QString)), MainWindow, SLOT(_open_cart(int, QString)));
 
-       connect(this, SIGNAL(sig_open_bubble(int, QString)), MainWindow, SLOT(_open_bubble(int, QString)));
-       connect(this, SIGNAL(sig_open_b77_bubble(int, QString, int)), this, SLOT(do_open_bubble_casette(int, QString, int)));
+//     connect(this, SIGNAL(sig_open_bubble(int, QString)), MainWindow, SLOT(_open_bubble(int, QString)));
+//     connect(this, SIGNAL(sig_open_b77_bubble(int, QString, int)), this, SLOT(do_open_bubble_casette(int, QString, int)));
 
 
        p_osd->setParent(this);
@@ -540,7 +540,8 @@ _exit:
                csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL,
                                                          "EmuThread : EXIT");
        }
-       emit sig_finished();
+       emit sig_draw_finished();
+       emit sig_emu_finished();
        this->quit();
 }
 
index 5b858ca..9d1d221 100644 (file)
@@ -527,12 +527,12 @@ void EmuThreadClassBase::do_close_cartridge()
        int drv = tmp.drive;
        sub_close_cartridge_internal(drv);
 }
-void EmuThreadClassBase::do_close_cartidge_ui(int drv)
+void EmuThreadClassBase::do_close_cartridge_ui(int drv)
 {
        sub_close_cartridge_internal(drv);
 }
 
-void EmuThreadClassBase::sub_close_cartidge_internal(int drv)
+void EmuThreadClassBase::sub_close_cartridge_internal(int drv)
 {
        std::shared_ptr<USING_FLAGS> p = using_flags;
        if(p.get() == nullptr) return;
@@ -546,7 +546,7 @@ void EmuThreadClassBase::sub_close_cartidge_internal(int drv)
        }
 }
 
-void EmuThreadClassBase::do_open_cart(int drv, QString path)
+void EmuThreadClassBase::do_open_cartridge(int drv, QString path)
 {
        std::shared_ptr<USING_FLAGS> p = using_flags;
        if(p.get() == nullptr) return;
@@ -747,7 +747,7 @@ void EmuThreadClassBase::do_select_bubble_casette_b77(int drive, int slot)
        std::shared_ptr<USING_FLAGS> p = using_flags;
        if(p.get() == nullptr) return;
 
-       if(!((p->is_use_bubble()) && (p->get_max_dbubble() > drive))) return;
+       if(!((p->is_use_bubble()) && (p->get_max_bubble() > drive))) return;
 
        int bank_num = p_emu->b77_file[drive].bank_num;
        if(bank_num <= 0) return;
index 83b79db..6c9f09d 100644 (file)
@@ -100,7 +100,8 @@ void Ui_MainWindow::do_toggle_mouse(void)
 #ifdef USE_MOUSE
        if(hRunEmu == nullptr) return;
        EMU_TEMPLATE *p_emu = hRunEmu->get_emu();
-       if(emu == nullptr) return;
+       if(p_emu == nullptr) return;
+       if(graphicsView == nullptr) return;
 
        p_emu->lock_vm();
        bool flag = p_emu->is_mouse_enabled();
@@ -153,7 +154,6 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m)
                connect(action_SetFixedCpu[i], SIGNAL(triggered()),
                                hRunEmu, SLOT(do_set_emu_thread_to_fixed_cpu_from_action()));
        }
-       //connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_emu_thread()));
        connect(this, SIGNAL(sig_vm_reset()), hRunEmu, SLOT(do_reset()));
 
        for(int i = 0 ; i < using_flags->get_use_special_reset_num() ; i++) {
@@ -311,7 +311,6 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m)
        connect(p_osd, SIGNAL(sig_ui_compact_disc_eject(int)),
                        this, SLOT(do_ui_eject_compact_disc(int)),
                        Qt::QueuedConnection);
-
 #endif
 #if defined(USE_LASER_DISC)
        for(int ii = 0; ii < USE_LASER_DISC; ii++) {
@@ -342,24 +341,38 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m)
        connect(this, SIGNAL(sig_save_binary(int, QString)), hRunEmu, SLOT(do_save_binary(int, QString)));
 #endif
 #if defined(USE_BUBBLE)
-       connect(this, SIGNAL(sig_write_protect_bubble(int, bool)), hRunEmu, SLOT(do_write_protect_bubble_casette(int, bool)));
-       connect(this, SIGNAL(sig_open_bubble(int, QString, int)), hRunEmu, SLOT(do_open_bubble_casette(int, QString, int)));
-       connect(this, SIGNAL(sig_close_bubble(int)), hRunEmu, SLOT(do_close_bubble_casette(int)));
-       connect(hRunEmu, SIGNAL(sig_update_recent_bubble(int)), this, SLOT(do_update_recent_bubble(int)));
-       //connect(hRunEmu, SIGNAL(sig_change_osd_bubble(int, QString)), this, SLOT(do_change_osd_bubble(int, QString)));
-       drvs = USE_BUBBLE;
-       for(int ii = 0; ii < drvs; ii++) {
-               connect(menu_bubbles[ii],
-                               SIGNAL(sig_update_inner_bubble(int ,QStringList , class Action_Control **, QStringList , int, bool)),
-                               this,
-                               SLOT(do_update_inner_bubble(int ,QStringList , class Action_Control **, QStringList , int, bool))
-                       );
+       for(int ii = 0; ii < USE_BUBBLE; ii++) {
+               if(ii >= USE_BUBBLE_TMP) break;
+               Menu_BubbleClass *mp = menu_bubbles[ii];
+               if(mp != nullptr) {
+                       mp->connect_via_emu_thread(hRunEmu);
+                       connect(mp, SIGNAL(sig_set_inner_slot(int, int)),
+                                       hRunEmu, SLOT(do_select_bubble_casette_b77(int, int)),
+                                       Qt::QueuedConnection);
+               }
        }
+       connect(this, SIGNAL(sig_open_bubble(int, QString, int)),
+                       hRunEmu, SLOT(do_open_bubble_casette(int, QString, int)),
+                       Qt::QueuedConnection);
+       connect(this, SIGNAL(sig_close_bubble_ui(int)),
+                       hRunEmu, SLOT(do_close_bubble_ui(int)),
+                       Qt::QueuedConnection);
+
+       connect(p_osd, SIGNAL(sig_ui_bubble_insert_history(int, QString, quint64)),
+                       this, SLOT(do_ui_bubble_casette_insert_history(int, QString, ouint64)),
+                                        Qt::QueuedConnection);
+       connect(p_osd, SIGNAL(sig_ui_bubble_write_protect(int, quint64)),
+                       this, SLOT(do_ui_bubble_write_protect(int, quint64)),
+                                        Qt::QueuedConnection);
+       connect(p_osd, SIGNAL(sig_ui_bubble_closed(int)),
+                       this, SLOT(do_ui_eject_bubble_casette(int)),
+                       Qt::QueuedConnection);
+
 #endif
 
-       connect(this, SIGNAL(quit_emu_thread()), hRunEmu, SLOT(doExit()));
+       connect(this, SIGNAL(sig_quit_emu_thread()), hRunEmu, SLOT(doExit()), Qt::QueuedConnection);
        connect(hRunEmu, SIGNAL(sig_mouse_enable(bool)),
-                       this, SLOT(do_set_mouse_enable(bool)));
+                       this, SLOT(do_set_mouse_enable(bool)), Qt::QueuedConnection);
 
 
        hRunEmu->set_tape_play(false);
@@ -367,17 +380,16 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m)
        connect(hRunEmu, SIGNAL(sig_send_data_led(quint32)), this, SLOT(do_recv_data_led(quint32)), Qt::QueuedConnection);
 #endif
 #ifdef USE_AUTO_KEY
-       connect(this, SIGNAL(sig_start_auto_key(QString)), hRunEmu, SLOT(do_start_auto_key(QString)));
-       connect(this, SIGNAL(sig_stop_auto_key()), hRunEmu, SLOT(do_stop_auto_key()));
-       connect(this, SIGNAL(sig_set_roma_kana(bool)), hRunEmu, SLOT(set_romakana(bool)));
+       connect(this, SIGNAL(sig_start_auto_key(QString)), hRunEmu, SLOT(do_start_auto_key(QString)), Qt::QueuedConnection);
+       connect(this, SIGNAL(sig_stop_auto_key()), hRunEmu, SLOT(do_stop_auto_key()), Qt::QueuedConnection);
+       connect(this, SIGNAL(sig_set_roma_kana(bool)), hRunEmu, SLOT(set_romakana(bool)), Qt::QueuedConnection);
 #endif
 
        csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "EmuThread : Start.");
        objNameStr = QString("EmuThreadClass");
        hRunEmu->setObjectName(objNameStr);
 
-//     hDrawEmu = new DrawThreadClass((OSD*)(p_osd()), csp_logger, this);
-       hDrawEmu = new DrawThreadClass((OSD*)p_osd, csp_logger, nullptr);
+       hDrawEmu = new DrawThreadClass((OSD*)p_osd, csp_logger, this);
        p_emu->set_parent_handler((EmuThreadClass*)hRunEmu, hDrawEmu);
 
 #ifdef ONE_BOARD_MICRO_COMPUTER
@@ -404,24 +416,24 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m)
                connect(hRunEmu, SIGNAL(sig_set_draw_fps(double)), hDrawEmu, SLOT(do_set_frames_per_second(double)));
                connect(hRunEmu, SIGNAL(sig_draw_one_turn(bool)), hDrawEmu, SLOT(do_draw_one_turn(bool)));
                } else*/ {
-               connect(hRunEmu, SIGNAL(sig_draw_thread(bool)), hDrawEmu, SLOT(doDraw(bool)), Qt::DirectConnection);
+               connect(hRunEmu, SIGNAL(sig_draw_thread(bool)), hDrawEmu, SLOT(doDraw(bool)));
                connect(hRunEmu, SIGNAL(sig_set_draw_fps(double)), hDrawEmu, SLOT(do_set_frames_per_second(double)));
                connect(hRunEmu, SIGNAL(sig_draw_one_turn(bool)), hDrawEmu, SLOT(do_draw_one_turn(bool)));
        }
        //connect(hRunEmu, SIGNAL(sig_draw_thread(bool)), (OSD*)p_osd, SLOT(do_draw(bool)));
        //connect(hRunEmu, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
-       connect(this, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()));
+       connect(this, SIGNAL(quit_draw_thread()), hDrawEmu, SLOT(doExit()),  Qt::QueuedConnection);
 
        connect(glv, SIGNAL(sig_notify_move_mouse(double, double, double, double)),
-                       hRunEmu, SLOT(moved_mouse(double, double, double, double)));
+                       hRunEmu, SLOT(moved_mouse(double, double, double, double)), Qt::QueuedConnection);
        connect(glv, SIGNAL(do_notify_button_pressed(Qt::MouseButton)),
-               hRunEmu, SLOT(button_pressed_mouse(Qt::MouseButton)));
+               hRunEmu, SLOT(button_pressed_mouse(Qt::MouseButton)), Qt::QueuedConnection);
        connect(glv, SIGNAL(do_notify_button_released(Qt::MouseButton)),
-                       hRunEmu, SLOT(button_released_mouse(Qt::MouseButton)));
+                       hRunEmu, SLOT(button_released_mouse(Qt::MouseButton)), Qt::QueuedConnection);
 #ifdef USE_MOUSE
        connect(glv, SIGNAL(sig_toggle_mouse(void)),
-                       this, SLOT(do_toggle_mouse(void)));
-       connect(glv, SIGNAL(sig_toggle_grab_mouse()), this, SLOT(do_toggle_mouse()));
+                       this, SLOT(do_toggle_mouse(void)),  Qt::QueuedConnection);
+       connect(glv, SIGNAL(sig_toggle_grab_mouse()), this, SLOT(do_toggle_mouse()),  Qt::QueuedConnection);
 #endif
        connect(hRunEmu, SIGNAL(sig_resize_screen(int, int)),
                        glv, SLOT(resizeGL(int, int)), Qt::QueuedConnection);
@@ -435,8 +447,7 @@ void Ui_MainWindow::LaunchEmuThread(EmuThreadClassBase *m)
 
        connect((OSD*)p_osd, SIGNAL(sig_req_encueue_video(int, int, int)),
                        hDrawEmu, SLOT(do_req_encueue_video(int, int, int)));
-       connect(hRunEmu, SIGNAL(sig_finished()), glv, SLOT(releaseKeyCode(void)));
-       connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_emu_thread()));
+
        objNameStr = QString("EmuDrawThread");
        hDrawEmu->setObjectName(objNameStr);
 
@@ -601,7 +612,7 @@ void Ui_MainWindow::OnMainWindowClosed(void)
 #endif
        emit quit_draw_thread();
        emit quit_joy_thread();
-       emit quit_emu_thread();
+       emit sig_quit_emu_thread();
        emit sig_quit_movie_thread();
        emit sig_quit_widgets();
 
@@ -624,10 +635,12 @@ void Ui_MainWindow::OnMainWindowClosed(void)
        }
        if(hRunEmu != nullptr) {
                OnCloseDebugger();
-               OSD* op = (OSD*)p_osd;
-               if(op != nullptr) {
-                       op->setParent(this);
-                       op->moveToThread(this->thread());
+               if(hRunEmu->get_emu() != nullptr) {
+                       OSD* op = (OSD*)(hRunEmu->get_emu()->get_osd());
+                       if(op != nullptr) {
+                               op->setParent(this);
+                               op->moveToThread(this->thread());
+                       }
                }
                hRunEmu->quit();
                if(!(hRunEmu->wait(2000))) {
@@ -1486,6 +1499,8 @@ void Ui_MainWindow::do_update_inner_fd(int drv, QStringList base, class Action_C
        if(hRunEmu == nullptr) return;
        EMU_TEMPLATE *p_emu = hRunEmu->get_emu();
        if(p_emu == nullptr) return;
+       std::shared_ptr<USING_FLAGS> up = using_flags;
+       if(up.get() == nullptr) return;
 
        if(use_d88_menus) {
                for(int ii = 0; ii < up->get_max_d88_banks(); ii++) {
@@ -1512,6 +1527,8 @@ void Ui_MainWindow::do_update_inner_bubble(int drv, QStringList base, class Acti
        if(hRunEmu == nullptr) return;
        EMU_TEMPLATE *p_emu = hRunEmu->get_emu();
        if(p_emu == nullptr) return;
+       std::shared_ptr<USING_FLAGS> up = using_flags;
+       if(up.get() == nullptr) return;
 
        if(use_d88_menus) {
                for(int ii = 0; ii < up->get_max_b77_banks(); ii++) {
@@ -1632,7 +1649,7 @@ void Ui_MainWindow::OnOpenDebugger()
                if(vm->get_cpu(no) != NULL && vm->get_cpu(no)->get_debugger() != NULL) {
                        QString windowName = QString::fromUtf8(vm->get_cpu(no)->get_device_name());
                        windowName = QString::fromUtf8("Debugger ") + windowName;
-                       p_emu->hDebugger.reset(new CSP_Debugger(emu, this));
+                       p_emu->hDebugger.reset(new CSP_Debugger(p_emu, this));
                        if(p_emu->hDebugger.get() == nullptr) {
                                return;
                        }
@@ -1686,7 +1703,7 @@ void Ui_MainWindow::OnCloseDebugger(void )
 
 QString Ui_MainWindow::get_system_version()
 {
-       if(hRunEmu == nullptr) return;
+       if(hRunEmu == nullptr) return QString::fromUtf8("");
        EMU_TEMPLATE *p_emu = hRunEmu->get_emu();
 
        QString guiver = get_gui_version();
index 79cdb29..20c5c1f 100644 (file)
@@ -51,19 +51,33 @@ void Ui_MainWindow::do_update_recent_bubble(int drv)
 }
 
 
-int Ui_MainWindow::set_recent_bubble(int drv, int num) 
+int Ui_MainWindow::set_recent_bubble(int drv, int num)
 {
        QString s_path;
+       std::shared_ptr<USING_FLAGS> p = using_flags;
+       if(p.get() == nullptr) return -1;
+       if(p_config == nullptr) return -1;
+
+       if(p->get_max_bubble() <= drv) return -1;
+       if((num < 0) || (num >= MAX_HISTORY)) return -1;
+       s_path = QString::fromLocal8Bit(p_config->recent_bubble_casette_path[drv][num]);
+       if(!(s_path.isEmpty())) {
+               _open_bubble(drv, s_path);
+               return 0;
+       }
+       return -1;
+#if 0
+       QString s_path;
        char path_shadow[PATH_MAX];
        int i;
 
-       
+
        if((num < 0) || (num >= MAX_HISTORY)) return -1;
        s_path = QString::fromLocal8Bit(p_config->recent_bubble_casette_path[drv][num]);
        strncpy(path_shadow, s_path.toLocal8Bit().constData(), PATH_MAX - 1);
        UPDATE_HISTORY(path_shadow, p_config->recent_bubble_casette_path[drv], listBubbles[drv]);
        strncpy(path_shadow, s_path.toLocal8Bit().constData(), PATH_MAX - 1);
-   
+
        strcpy(p_config->initial_bubble_casette_dir, get_parent_dir((const _TCHAR *)path_shadow));
        strncpy(path_shadow, s_path.toLocal8Bit().constData(), PATH_MAX - 1);
        {
@@ -79,6 +93,7 @@ int Ui_MainWindow::set_recent_bubble(int drv, int num)
                }
        }
        return 0;
+#endif
 }
 
 void Ui_MainWindow::_open_bubble(int drv, const QString fname)
@@ -107,7 +122,7 @@ void Ui_MainWindow::_open_bubble(int drv, const QString fname)
        }
 }
 
-void Ui_MainWindow::eject_bubble(int drv) 
+void Ui_MainWindow::eject_bubble(int drv)
 {
        int i;
        emit sig_close_bubble(drv);
index 1c949f3..d655a25 100644 (file)
@@ -1,6 +1,6 @@
 message("* qt/emuutils")
 
-SET(THIS_LIB_VERSION 7.10.0)
+SET(THIS_LIB_VERSION 7.11.0)
 
 set(s_qt_emuutils_headers
        ../gui/csp_logger.h
index 6ea1395..b691adf 100644 (file)
@@ -1,6 +1,6 @@
 message("* qt/gui")
 
-set(THIS_LIB_VERSION 8.5.0)
+set(THIS_LIB_VERSION 8.6.0)
 
 set(s_qt_gui_headers
          qt_dialogs.h
index 5f7b779..df7e1d3 100644 (file)
@@ -38,9 +38,9 @@ public:
        }
 public slots:
        void do_set_window_focus_type(bool flag);
-       
+
 signals:
-       int quit_emu_thread(void);
+       int sig_quit_emu_thread(void);
        int sig_set_dev_log_to_console(int, bool);
        int sig_set_dev_log_to_syslog(int, bool);
        int sig_set_window_focus_type(bool);
@@ -48,6 +48,3 @@ signals:
 QT_END_NAMESPACE
 
 #endif
-
-
index df87f6a..e79d946 100644 (file)
@@ -29,7 +29,7 @@
 #include "config.h"
 
 
-DrawThreadClass::DrawThreadClass(OSD_BASE *o, std::shared_ptr<CSP_Logger> logger,QObject *parent) : QThread(parent) {
+DrawThreadClass::DrawThreadClass(OSD_BASE *o, std::shared_ptr<CSP_Logger> logger,QObject *parent) : /*QThread(parent) */ QThread(nullptr) {
        MainWindow = (Ui_MainWindowBase *)parent;
        glv = MainWindow->getGraphicsView();
        p_osd = o;
@@ -55,10 +55,10 @@ DrawThreadClass::DrawThreadClass(OSD_BASE *o, std::shared_ptr<CSP_Logger> logger
 
        connect(screen, SIGNAL(refreshRateChanged(qreal)), this, SLOT(do_change_refresh_rate(qreal)));
        connect(this, SIGNAL(sig_update_screen(void *, bool)), glv, SLOT(update_screen(void *, bool)), Qt::QueuedConnection);
-       
+
        connect(this, SIGNAL(sig_update_osd()), glv, SLOT(update_osd()), Qt::QueuedConnection);
        connect(this, SIGNAL(sig_push_frames_to_avio(int, int, int)), glv->extfunc, SLOT(paintGL_OffScreen(int, int, int)));
-       
+
        //connect(this, SIGNAL(sig_call_draw_screen()), p_osd, SLOT(draw_screen()));
        //connect(this, SIGNAL(sig_call_no_draw_screen()), p_osd, SLOT(no_draw_screen()));
        use_separate_thread_draw = true;
@@ -170,7 +170,7 @@ void DrawThreadClass::do_draw_one_turn(bool _req_draw)
                if(ncount == 0) emit sig_update_osd();
        }
        ncount++;
-       if(ncount >= 8) ncount = 0; 
+       if(ncount >= 8) ncount = 0;
        if(rec_frame_count > 0) {
                emit sig_push_frames_to_avio(rec_frame_count,
                                                                         rec_frame_width, rec_frame_height);
@@ -197,10 +197,10 @@ void DrawThreadClass::doWork(const QString &param)
                renderSemaphore = s;
        }
        do {
-               double __fps = p_osd->vm_frame_rate(); // FPS; 
+               double __fps = p_osd->vm_frame_rate(); // FPS;
                vrate = 1.0e3 / __fps; // to Msec
                _rate = (wait_refresh < emu_frame_rate) ? emu_frame_rate : wait_refresh;
-               if((vrate * 2.0) > _rate) _rate = vrate * 2.0; 
+               if((vrate * 2.0) > _rate) _rate = vrate * 2.0;
                drate = (double)elapsed / 1.0e6; // nsec to msec
                wait_factor = (int)nearbyint(_rate);
 //             if(_rate >= drate) {
@@ -217,7 +217,7 @@ void DrawThreadClass::doWork(const QString &param)
                        rendered = true;
                } else {
                        rendered = false;
-               }                       
+               }
                /*printf("RATE:%f VM_RATE:%f ELAPSED:%f WAIT_FACTOR:%d RENDER=%s\n", _rate, vrate, drate,  wait_factor,
                  (rendered) ? "YES" : "NO");*/
                if(!bRunThread) goto __exit;
@@ -236,7 +236,7 @@ __exit:
 
 void DrawThreadClass::do_change_refresh_rate(qreal rate)
 {
-       refresh_rate = rate;    
+       refresh_rate = rate;
        wait_refresh = 1000.0 / (refresh_rate * 2.0);
        wait_count += (wait_refresh * 1.0);
 }
@@ -247,7 +247,7 @@ void DrawThreadClass::do_update_screen(void *p, bool is_mapped)
        bDrawReq = true;
        mapped_drawn = is_mapped;
 }
-       
+
 void DrawThreadClass::do_req_encueue_video(int count, int width, int height)
 {
        rec_frame_width = width;
@@ -283,7 +283,7 @@ void DrawThreadClass::req_unmap_screen_texture()
                if(glv->is_ready_to_map_vram_texture()) {
                                emit sig_unmap_texture();
                                textureMappingSemaphore->acquire();
-                               
+
                                //glv->do_unmap_vram_texture();
                                //mapping_status = false;
                                //mapping_pointer = NULL;
@@ -293,4 +293,3 @@ void DrawThreadClass::req_unmap_screen_texture()
                }
        }
 }
-
index ea53678..4c9c108 100644 (file)
@@ -32,7 +32,8 @@
 //#include "csp_logger.h"
 #include "menu_flags.h"
 
-EmuThreadClassBase::EmuThreadClassBase(Ui_MainWindowBase *rootWindow, std::shared_ptr<USING_FLAGS> p, QObject *parent) : QThread(parent) {
+EmuThreadClassBase::EmuThreadClassBase(Ui_MainWindowBase *rootWindow, std::shared_ptr<USING_FLAGS> p, QObject *parent) : QThread(parent)
+{
        MainWindow = rootWindow;
        bBlockTask = true;
        using_flags = p;
@@ -91,16 +92,17 @@ EmuThreadClassBase::EmuThreadClassBase(Ui_MainWindowBase *rootWindow, std::share
                        }
                }
        }
-       QMutexLocker _n(&keyMutex);
+       connect(this, SIGNAL(sig_draw_finished()), glv, SLOT(releaseKeyCode(void)));
+       connect(this, SIGNAL(sig_emu_finished()), rootWindow->getGraphicsView(), SLOT(deleteLater()));
 
+       QMutexLocker _n(&keyMutex);
 
        key_fifo = new FIFO(512 * 6);
        key_fifo->clear();
+}
 
-
-};
-
-EmuThreadClassBase::~EmuThreadClassBase() {
+EmuThreadClassBase::~EmuThreadClassBase()
+{
 
        delete drawCond;
 
@@ -568,12 +570,12 @@ QString EmuThreadClassBase::get_d88_file_disk_name(int drive, int banknum)
 
 bool EmuThreadClassBase::is_floppy_disk_protected(int drive)
 {
-       if(drive < 0) return QString::fromUtf8("");
-       if(p_emu == nullptr) return QString::fromUtf8("");
+       if(drive < 0) return false;
+       if(p_emu == nullptr) return false;
 
        std::shared_ptr<USING_FLAGS> p = using_flags;
-       if(p.get() == nullptr) return QString::fromUtf8("");
-       if(!(p->is_use_fd())) return QString::fromUtf8("");
+       if(p.get() == nullptr) return false;
+       if(!(p->is_use_fd())) return false;
 
 //     QMutexLocker _locker(&uiMutex);
        bool _b = p_emu->is_floppy_disk_protected(drive);
@@ -590,7 +592,7 @@ QString EmuThreadClassBase::get_d88_file_path(int drive)
        if(p.get() == nullptr) return QString::fromUtf8("");
        if(!(p->is_use_fd())) return QString::fromUtf8("");
 
-       if(drive < up->get_max_drive()) {
+       if(drive < p->get_max_drive()) {
 //             QMutexLocker _locker(&uiMutex);
                QString _n = QString::fromLocal8Bit((const char *)(&(p_emu->d88_file[drive].path)));
                return _n;
@@ -655,7 +657,7 @@ QString EmuThreadClassBase::get_b77_file_media_name(int drive, int banknum)
 
        if((drive < p->get_max_bubble()) && (banknum < get_b77_file_bank_num(drive))) {
 //             QMutexLocker _locker(&uiMutex);
-               QString _n = QString::fromLocal8Bit((const char *)(&(p_emu->b77_file[drive].disk_name[banknum][0])));
+               QString _n = QString::fromLocal8Bit((const char *)(&(p_emu->b77_file[drive].bubble_name[banknum][0])));
                return _n;
        }
 
@@ -884,7 +886,7 @@ void EmuThreadClassBase::get_hdd_string(void)
 {
        std::shared_ptr<USING_FLAGS> p = using_flags;
        if(p.get() == nullptr) return;
-       if(!(p->is_use_hd())) return;
+       if(!(p->is_use_hdd())) return;
 
        QString tmpstr, alamp;
        uint32_t access_drv = p_emu->is_hard_disk_accessed();
index 683127b..896e8f2 100644 (file)
@@ -231,6 +231,8 @@ protected:
                key_fifo->clear();
        };
        // Thread HOOK.
+       void sub_close_bubble_casette_internal(int drv);
+       void sub_close_cartridge_internal(int drv);
        void sub_close_compact_disc_internal(int drv);
        void sub_close_floppy_disk_internal(int drv);
        void sub_close_hard_disk_internal(int drv);
@@ -355,7 +357,8 @@ signals:
        int quit_draw_thread(void);
        int sig_screen_aspect(int);
        int sig_screen_size(int, int);
-       int sig_finished(void);
+       int sig_emu_finished(void);
+       int sig_draw_finished(void);
        int sig_mouse_enable(bool);
        int sig_update_recent_hard_disk(int);
 
index ed3764c..51aac94 100644 (file)
@@ -842,9 +842,10 @@ public slots:
        virtual void do_create_hard_disk(int drv, int sector_size, int sectors, int surfaces, int cylinders, QString name) { }
        void do_update_d88_list(int drv, int bank);
 
-       // Bubble Casette
-       int write_protect_bubble(int drv, bool flag);
-
+       void do_update_bubble_history(int drive, QStringList lst);
+       void do_ui_bubble_insert_history(int drv, QString fname, quint64 bank);
+       void do_ui_eject_bubble_casette(int drv);
+       void do_ui_bubble_write_protect(int drv, quint64 flag);
        virtual int set_b77_slot(int drive, int num) { return 0; }
        virtual void do_update_recent_bubble(int drv) { }
        virtual int set_recent_bubble(int drv, int num) { return 0; }
@@ -951,7 +952,7 @@ public slots:
        void do_start_draw_thread();
 signals:
        int message_changed(QString);
-       int quit_emu_thread();
+       int sig_quit_emu_thread();
        int call_joy_thread(EMU_TEMPLATE *);
        int quit_joy_thread();
        int quit_draw_thread();
@@ -1017,7 +1018,7 @@ signals:
 
        int sig_write_protect_bubble(int, bool);
        int sig_open_bubble(int, QString , int);
-       int sig_close_bubble(int);
+       int sig_close_bubble_ui(int);
 
        int sig_led_update(QRectF);
        int sig_start_auto_key(QString);
index 5c71ca3..1c6a3cd 100644 (file)
@@ -11,6 +11,7 @@
 #include "menu_disk.h"
 #include "menu_bubble.h"
 
+#include "emu_thread_tmpl.h"
 #include "qt_dialogs.h"
 
 Menu_BubbleClass::Menu_BubbleClass(QMenuBar *root_entry, QString desc, std::shared_ptr<USING_FLAGS> p, QWidget *parent, int drv, int base_drv) : Menu_MetaClass(root_entry, desc, p, parent, drv, base_drv)
@@ -23,7 +24,7 @@ Menu_BubbleClass::~Menu_BubbleClass()
 {
 }
 
-void Menu_HDDClass::connect_via_emu_thread(EmuThreadClassBase *p)
+void Menu_BubbleClass::connect_via_emu_thread(EmuThreadClassBase *p)
 {
        if(p == nullptr) return;
        connect(action_eject, SIGNAL(triggered()), p, SLOT(do_close_bubble_casette()), Qt::QueuedConnection);
index 0e755a9..908aadb 100644 (file)
@@ -19,9 +19,10 @@ protected:
 public:
        Menu_BubbleClass(QMenuBar *root_entry, QString desc, std::shared_ptr<USING_FLAGS> p, QWidget *parent = 0, int drv = 0, int base_drv = 1);
        ~Menu_BubbleClass();
-       void create_pulldown_menu_device_sub();
-       void connect_menu_device_sub(void);
-       void retranslate_pulldown_menu_device_sub(void);
+       void connect_via_emu_thread(EmuThreadClassBase *p) override;
+       void create_pulldown_menu_device_sub() override;
+       void connect_menu_device_sub(void) override;
+       void retranslate_pulldown_menu_device_sub(void) override;
 };
 
 QT_END_NAMESPACE
index 8a2798c..6d3dfde 100644 (file)
@@ -15,7 +15,9 @@
 #include "menu_metaclass.h"
 #include "menu_cart.h"
 
+#include "emu_thread_tmpl.h"
 #include "qt_dialogs.h"
+
 Menu_CartClass::Menu_CartClass(QMenuBar *root_entry, QString desc, std::shared_ptr<USING_FLAGS> p, QWidget *parent, int drv, int base_drv) : Menu_MetaClass(root_entry, desc, p, parent, drv, base_drv)
 {
        use_write_protect = false;
@@ -26,6 +28,13 @@ Menu_CartClass::~Menu_CartClass()
 {
 }
 
+void Menu_CartClass::connect_via_emu_thread(EmuThreadClassBase *p)
+{
+       if(p == nullptr) return;
+       connect(action_eject, SIGNAL(triggered()), p, SLOT(do_close_cartridge()), Qt::QueuedConnection);
+
+}
+
 void Menu_CartClass::create_pulldown_menu_device_sub(void)
 {
 }
@@ -34,7 +43,7 @@ void Menu_CartClass::create_pulldown_menu_device_sub(void)
 void Menu_CartClass::connect_menu_device_sub(void)
 {
        connect(this, SIGNAL(sig_open_media(int, QString)), p_wid, SLOT(_open_cart(int, QString)));
-       connect(this, SIGNAL(sig_eject_media(int)), p_wid, SLOT(eject_cart(int)));
+//     connect(this, SIGNAL(sig_eject_media(int)), p_wid, SLOT(eject_cart(int)));
        connect(this, SIGNAL(sig_set_recent_media(int, int)), p_wid, SLOT(set_recent_cart(int, int)));
 }
 
@@ -43,7 +52,7 @@ void Menu_CartClass::retranslate_pulldown_menu_device_sub(void)
        int drv = media_drive;
        QString drive_name = (QApplication::translate("MenuMedia", "Cartridge ", 0));
        drive_name += QString::number(drv);
-  
+
        if((drv < 0) || (drv >= 8)) return;
        action_insert->setText(QApplication::translate("MenuMedia", "Insert", 0));
        action_eject->setText(QApplication::translate("MenuMedia", "Eject", 0));
index 8b4666e..fd15b36 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
+class EmuThreadClassBase;
 class DLL_PREFIX Menu_CartClass: public Menu_MetaClass {
        Q_OBJECT
 protected:
 public:
        Menu_CartClass(QMenuBar *root_entry, QString desc, std::shared_ptr<USING_FLAGS> p, QWidget *parent = 0, int drv = 0, int base_drv = 1);
        ~Menu_CartClass();
-       void create_pulldown_menu_device_sub();
-       void connect_menu_device_sub(void);
-       void retranslate_pulldown_menu_device_sub(void);
+       void connect_via_emu_thread(EmuThreadClassBase *p) override;
+       void create_pulldown_menu_device_sub() override;
+       void connect_menu_device_sub(void) override;
+       void retranslate_pulldown_menu_device_sub(void) override;
 };
 
 QT_END_NAMESPACE
index 006fa04..39ed1ee 100644 (file)
@@ -91,7 +91,7 @@ Ui_MainWindowBase::~Ui_MainWindowBase()
 {
        // May need delete items via QVector.
        do_clear_sound_output_list();
-       
+
        graphicsView->releaseKeyboard();
        if(ledUpdateTimer != NULL) delete ledUpdateTimer;
        if(driveData != NULL) delete driveData;
@@ -169,7 +169,7 @@ void Ui_MainWindowBase::do_browse_document()
        QAction *cp = qobject_cast<QAction*>(QObject::sender());
        if(cp == nullptr) return;
        QString fname = cp->data().toString();
-       
+
        Dlg_BrowseText *dlg = new Dlg_BrowseText(fname, using_flags);
        dlg->show();
 }
@@ -219,7 +219,7 @@ void Ui_MainWindowBase::do_update_device_node_name(int id, const _TCHAR *name)
        } else {
                action_DevLogToConsole[id]->setEnabled(false);
                action_DevLogToConsole[id]->setVisible(false);
-               
+
 #if !defined(Q_OS_WIN)
                action_DevLogToSyslog[id]->setEnabled(false);
                action_DevLogToSyslog[id]->setVisible(false);
@@ -245,7 +245,7 @@ void Ui_MainWindowBase::do_set_dev_log_to_console(bool f)
        QAction *cp = qobject_cast<QAction*>(QObject::sender());
        if(cp == nullptr) return;
        int num = cp->data().value<int>();
-       
+
        csp_logger->set_device_node_log(num, 2, CSP_LOG_DEBUG, f);
        p_config->dev_log_to_console[num][0] = f;
 }
@@ -275,7 +275,7 @@ void Ui_MainWindowBase::do_set_emulate_cursor_as(void)
        QAction *cp = qobject_cast<QAction*>(QObject::sender());
        if(cp == nullptr) return;
        int num = cp->data().value<int>();
-       
+
        if((num < 0) || (num > 2)) return;
        p_config->cursor_as_ten_key = num;
        emit sig_emu_update_config();
@@ -286,7 +286,7 @@ void Ui_MainWindowBase::do_set_dev_log_to_syslog(bool f)
        QAction *cp = qobject_cast<QAction*>(QObject::sender());
        if(cp == nullptr) return;
        int num = cp->data().value<int>();
-       
+
        csp_logger->set_device_node_log(num, 2, CSP_LOG_DEBUG, f);
        p_config->dev_log_to_syslog[num][0] = f;
 }
@@ -296,7 +296,7 @@ void Ui_MainWindowBase::do_select_render_platform(void)
        QAction *cp = qobject_cast<QAction*>(QObject::sender());
        if(cp == nullptr) return;
        int num = cp->data().value<int>();
-       
+
        int _major = 0;
        int _minor = 0;
        int _type = -1;
@@ -375,7 +375,7 @@ void Ui_MainWindowBase::setupUi(void)
                ConfigSoundMenu();
        }
        if(using_flags->is_use_binary_file()) {
-               ConfigBinaryMenu(); 
+               ConfigBinaryMenu();
        }
        if(using_flags->is_use_qd()) {
                ConfigQuickDiskMenu();
@@ -393,7 +393,7 @@ void Ui_MainWindowBase::setupUi(void)
        if(using_flags->is_use_bubble()) {
                ConfigBubbleMenu();
        }
-       ConfigEmulatorMenu();   
+       ConfigEmulatorMenu();
        actionAbout = new Action_Control(this, using_flags);
        actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
 
@@ -417,10 +417,10 @@ void Ui_MainWindowBase::setupUi(void)
                                        // major == 3
                                        if(p_config->render_minor_version < 0) p_config->render_minor_version = 0;
                                        if(p_config->render_minor_version > 1) p_config->render_minor_version = 1;
-                               }                                       
+                               }
                                fmt.setVersion(p_config->render_major_version , p_config->render_minor_version ); // Requires >=Qt-4.8.0
                                csp_logger->debug_log(CSP_LOG_DEBUG,  CSP_LOG_TYPE_GENERAL, "Try to use OpenGL ES(v%d.%d).", p_config->render_major_version, p_config->render_minor_version);
-                       } else if(render_type == CONFIG_RENDER_PLATFORM_OPENGL_CORE) { 
+                       } else if(render_type == CONFIG_RENDER_PLATFORM_OPENGL_CORE) {
                                fmt.setProfile(QSurfaceFormat::CoreProfile); // Requires >=Qt-4.8.0
                                fmt.setVersion(4, 7); // Requires >=Qt-4.8.0
                                csp_logger->debug_log(CSP_LOG_DEBUG,  CSP_LOG_TYPE_GENERAL, "Try to use OpenGL CORE profile.");
@@ -440,15 +440,15 @@ void Ui_MainWindowBase::setupUi(void)
                connect(this, SIGNAL(sig_set_display_osd(bool)), graphicsView, SLOT(do_set_display_osd(bool)));
                connect(this, SIGNAL(sig_set_led_width(int)), graphicsView, SLOT(do_set_led_width(int)));
        }
-       
+
        bitmapImage = NULL;
        driveData = new CSP_DockDisks(this, using_flags);
        MainWindow->setDockOptions(QMainWindow::AnimatedDocks);
        if(p_config->virtual_media_position > 0) {
                driveData->setVisible(true);
-       } else {        
+       } else {
                driveData->setVisible(false);
-       }       
+       }
 
        pCentralWidget = new QWidget(this);
        pCentralLayout = new QVBoxLayout(pCentralWidget);
@@ -484,7 +484,7 @@ void Ui_MainWindowBase::setupUi(void)
        }
        pCentralWidget->setLayout(pCentralLayout);
        MainWindow->setCentralWidget(pCentralWidget);
-       
+
        if(p_config->focus_with_click) {
                graphicsView->setFocusPolicy(Qt::ClickFocus);
                graphicsView->setFocus(Qt::MouseFocusReason);
@@ -492,7 +492,7 @@ void Ui_MainWindowBase::setupUi(void)
                graphicsView->setFocusPolicy(Qt::NoFocus);
                graphicsView->setFocus(Qt::ActiveWindowFocusReason);
        }
-       
+
        driveData->setOrientation(p_config->virtual_media_position);
        connect(this, SIGNAL(sig_set_orientation_osd(int)), driveData, SLOT(setOrientation(int)));
        connect(graphicsView, SIGNAL(sig_resize_osd(int)), driveData, SLOT(setScreenWidth(int)));
@@ -505,7 +505,7 @@ void Ui_MainWindowBase::setupUi(void)
        statusbar->setObjectName(QString::fromUtf8("statusbar"));
        MainWindow->setStatusBar(statusbar);
        initStatusBar();
-       
+
        menubar = new QMenuBar(this);
        menubar->setObjectName(QString::fromUtf8("menubar"));
        menubar->setGeometry(QRect(0, 0, 1288, 27));
@@ -519,7 +519,7 @@ void Ui_MainWindowBase::setupUi(void)
        }
        menuCpu_Speed = createMenuNode(menuControl, QString::fromUtf8("menuCpu_Speed"));
        menuDebugger = createMenuNode(menuControl, QString::fromUtf8("menuDebugger"));
-       
+
        if(using_flags->is_use_fd()) {
                int base_drv = using_flags->get_base_floppy_disk_num();
                for(int i = 0; i < using_flags->get_max_drive(); i++) CreateFloppyMenu(i, base_drv + i);
@@ -571,7 +571,7 @@ void Ui_MainWindowBase::setupUi(void)
        //connect(this, SIGNAL(sig_update_screen(void)), graphicsView, SLOT(updateGL(void)));
 
        menuMachine = createMenuNode(menubar, QString::fromUtf8("menuMachine"));
-       
+
        if(using_flags->is_use_mouse()) {
                SET_ACTION_SINGLE_CONNECT(actionMouseEnable, true , true, false, SIGNAL(toggled(bool)), SLOT(do_set_mouse_enable(bool)));
 //             actionMouseEnable = new Action_Control(this, using_flags);
@@ -589,7 +589,7 @@ void Ui_MainWindowBase::setupUi(void)
                connect(action_RAMSize, SIGNAL(triggered()), this, SLOT(do_show_ram_size_dialog()));
                menuMachine->addSeparator();
        }
-               
+
 
        ConfigDeviceType();
        ConfigMouseType();
@@ -601,13 +601,13 @@ void Ui_MainWindowBase::setupUi(void)
        ConfigSerialType();
        ConfigMonitorType();
        ConfigMachineFeatures();
-       
+
        if(!using_flags->is_without_sound()) {
                menuSound = createMenuNode(menubar, QString::fromUtf8("menuSound"));
        }
        menuEmulator = createMenuNode(menubar, QString::fromUtf8("menuEmulator"));
        menuHELP = createMenuNode(menubar, QString::fromUtf8("menuHelp"));
-       
+
        MainWindow->setMenuBar(menubar);
 
        menubar->addAction(menuControl->menuAction());
@@ -685,11 +685,11 @@ void Ui_MainWindowBase::setupUi(void)
                CreateSoundMenu();
        }
        CreateEmulatorMenu();
-  
+
        menuHELP->addAction(actionAbout);
        connect(actionAbout, SIGNAL(triggered()), this, SLOT(do_show_about()));
        menuHELP->addSeparator();
-       
+
        actionHelp_AboutQt = new Action_Control(this, using_flags);
        actionHelp_AboutQt->setObjectName(QString::fromUtf8("menuHelp_AboutQt"));
        menuHELP->addAction(actionHelp_AboutQt);
@@ -725,10 +725,10 @@ void Ui_MainWindowBase::setupUi(void)
        SET_HELP_MENUENTRY(menuHelp_Histories, actionHelp_History_Relnote, "menuHelp_History_Relnote", "RELEASENOTE.txt");
        SET_HELP_MENUENTRY(menuHelp_Histories, actionHelp_History_ChangeLog, "menuHelp_History_Changelog", "ChangeLog.txt");
        SET_HELP_MENUENTRY(menuHelp_Histories, actionHelp_History_MR_TANAM, "menuHelp_History_MR_TANAM", "history_by_mr_tanam.txt");
-       
+
        SET_HELP_MENUENTRY(menuHELP, actionHelp_License, "menuHelp_License", "LICENSE.txt");
        SET_HELP_MENUENTRY(menuHELP, actionHelp_License_JP, "menuHelp_License_JP", "LICENSE.ja.txt");
-       
+
        if(p_config->window_mode <= 0) p_config->window_mode = 0;
        if(p_config->window_mode >= using_flags->get_screen_mode_num()) p_config->window_mode = using_flags->get_screen_mode_num() - 1;
        w = using_flags->get_screen_width();
@@ -766,10 +766,10 @@ void Ui_MainWindowBase::setupUi(void)
                }
        }
        graphicsView->setFixedSize(w, h);
-       
+
        connect(this, SIGNAL(sig_screen_multiply(double)), graphicsView, SLOT(do_set_screen_multiply(double)), Qt::QueuedConnection);
        connect(this, SIGNAL(sig_glv_set_fixed_size(int, int)), graphicsView, SLOT(do_set_fixed_size(int, int)), Qt::QueuedConnection);
-       
+
        set_screen_size(w, h);
        set_screen_aspect(p_config->window_stretch_type);
        if(actionScreenSize[p_config->window_mode] != nullptr) {
@@ -798,10 +798,10 @@ void Ui_MainWindowBase::setupUi(void)
        connect(action_SetupKeyboard, SIGNAL(triggered()), this, SLOT(rise_keyboard_dialog()));
 #if !defined(Q_OS_WIN)
        connect(action_LogToSyslog, SIGNAL(toggled(bool)), this, SLOT(do_set_syslog(bool)));
-#endif 
+#endif
        connect(action_LogToConsole, SIGNAL(toggled(bool)), this, SLOT(do_set_conslog(bool)));
        csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "Menu OK");
-          
+
        QImageReader reader(":/default.ico");
        QImage result = reader.read();
 
@@ -818,7 +818,7 @@ void Ui_MainWindowBase::setupUi(void)
        VolumeLowIcon = QIcon(":/icon_volume_low.png");
        VolumeMidIcon = QIcon(":/icon_volume_mid.png");
        VolumeHighIcon = QIcon(":/icon_volume_high.png");
-       
+
        ExitIcon = QIcon(":/icon_exit.png");
 
        csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_GENERAL, "setupUI() OK");
@@ -842,13 +842,13 @@ void Ui_MainWindowBase::retranslateUI_Help(void)
        actionHelp_AboutQt->setText(QApplication::translate("MenuHelp", "About Qt", 0));
        actionHelp_AboutQt->setToolTip(QApplication::translate("MenuHelp", "Display Qt version.", 0));
        actionHelp_AboutQt->setIcon(QApplication::style()->standardIcon(QStyle::SP_TitleBarMenuButton));
-       
+
        actionAbout->setText(QApplication::translate("MenuHelp", "About...", 0));
        actionAbout->setIcon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion));
        actionAbout->setToolTip(QApplication::translate("MenuHelp", "About this emulator.", 0));
 
        menuHelp_Readme->setTitle(QApplication::translate("MenuHelp", "READMEs", 0));
-       
+
        actionHelp_README->setText(QApplication::translate("MenuHelp", "General Document", 0));
        actionHelp_README_QT->setText(QApplication::translate("MenuHelp", "About Qt ports", 0));
        actionHelp_README_Artane->setText(QApplication::translate("MenuHelp", "About Qt ports (Japanese).", 0));
@@ -959,7 +959,7 @@ void Ui_MainWindowBase::setCoreApplication(QApplication *p)
        connect(this, SIGNAL(quit_emulator_all()), CoreApplication, SLOT(closeAllWindows()));
        connect(actionHelp_AboutQt, SIGNAL(triggered()),
                        this->CoreApplication, SLOT(aboutQt()));
-       
+
 }
 
 #include <string>
@@ -989,14 +989,14 @@ void Ui_MainWindowBase::doChangeMessage_EmuThread(QString message)
 
 void Ui_MainWindowBase::StopEmuThread(void)
 {
-       emit quit_emu_thread();
+       emit sig_quit_emu_thread();
 }
 
 void Ui_MainWindowBase::delete_emu_thread(void)
 {
        //do_release_emu_resources();
        emit sig_quit_all();
-}  
+}
 // Utility
 #include <QActionGroup>
 #include <QTextCodec>
@@ -1044,7 +1044,7 @@ void Ui_MainWindowBase::do_set_window_title(QString s)
        }
        tmps = tmps + QString::fromUtf8(")");
        MainWindow->setWindowTitle(tmps);
-       
+
 }
 
 void Ui_MainWindowBase::do_set_mouse_enable(bool flag)
@@ -1111,4 +1111,3 @@ void Ui_MainWindowBase::OnCloseDebugger(void)
  * This is main for Qt.
  */
 DLL_PREFIX std::shared_ptr<CSP_Logger> csp_logger;
-
index bb8e450..86eb365 100644 (file)
 #include "qt_dialogs.h"
 //#include "csp_logger.h"
 
-int Ui_MainWindowBase::do_write_protect_bubble(int drv, bool flag)
-{
-       if((drv < 0) || (drv >= using_flags->get_max_bubble())) return -1;
-       emit sig_write_protect_bubble(drv, flag);
-       return 0;
-}
-
-
 // Common Routine
 
 void Ui_MainWindowBase::CreateBubbleMenu(int drv, int drv_base)
@@ -74,3 +66,107 @@ void Ui_MainWindowBase::ConfigBubbleMenu(void)
                ConfigBubbleMenuSub(i);
        }
 }
+
+void Ui_MainWindowBase::do_ui_bubble_closed(int drive)
+{
+}
+
+int Ui_MainWindowBase::set_recent_bubble(int drv, int num)
+{
+       QString s_path;
+       std::shared_ptr<USING_FLAGS> p = using_flags;
+       if(p.get() == nullptr) return -1;
+       if(p_config == nullptr) return -1;
+
+       if(p->get_max_bubble() <= drv) return -1;
+       if((num < 0) || (num >= MAX_HISTORY)) return -1;
+       s_path = QString::fromLocal8Bit(p_config->recent_bubble_casette_path[drv][num]);
+       if(!(s_path.isEmpty())) {
+               _open_bubble(drv, s_path);
+               return 0;
+       }
+       return -1;
+}
+
+
+void Ui_MainWindowBase::do_ui_bubble_insert_history(int drv, QString fname, quint64 bank)
+{
+       std::shared_ptr<USING_FLAGS>p = using_flags;
+       if(p.get() == nullptr) return;
+       if(fname.length() <= 0) return;
+       if(p->get_max_bubble() <= drv) return;
+       if(p_config == nullptr) return;
+
+       _TCHAR path_shadow[_MAX_PATH] = {0};
+
+       my_strncpy_s(path_shadow, _MAX_PATH, fname.toLocal8Bit().constData(), _TRUNCATE);
+       if(!(FILEIO::IsFileExisting(path_shadow))) return;
+
+       if((bank & EMU_MEDIA_TYPE::MULTIPLE_SLOT_DETECT_MASK) == 0) {
+               UPDATE_HISTORY(path_shadow, p_config->recent_bubble_casette_path[drv], listBubbles[drv]);
+               my_strncpy_s(p_config->initial_floppy_bubble_casette_dir,
+                                        sizeof(p_config->initial_bubble_casette_dir) / sizeof(_TCHAR),
+                                        get_parent_dir((const _TCHAR *)path_shadow),
+                                        _TRUNCATE);
+       // Update List
+               my_strncpy_s(path_shadow,
+                                       _MAX_PATH,
+                                        fname.toLocal8Bit().constData(),
+                                        _TRUNCATE);
+               menu_bubbles[drv]->do_set_initialize_directory(p_config->initial_bubble_casette_dir);
+               do_update_bubble_history(drv, listBubbles[drv]);
+       }
+       listB77[drv].clear();
+       QString int_name = fname;
+       if(check_file_extension(path_shadow, ".b77")) {
+               UPDATE_B77_LIST(drv, listB77[drv]);
+               unsigned int xbank = bank & EMU_MEDIA_TYPE::EMU_SLOT_MASK;
+               if(listB77[drv].size() > xbank) {
+                       int_name = listB77[drv].at(xbank);
+               }
+       }
+       if(menu_bubbles[drv] != nullptr) {
+               menu_bubbles[drv]->do_update_inner_media(listB77[drv], bank & EMU_MEDIA_TYPE::EMU_SLOT_MASK);
+       }
+       // ToDO: Replace signal model.
+       if(driveData != nullptr) {
+               driveData->updateMediaFileName(CSP_DockDisks_Domain_Bubble, drv, int_name);
+       }
+
+}
+void Ui_MainWindowBase::do_ui_eject_bubble_casette(int drv)
+{
+       if(menu_bubbless[drv] != nullptr) {
+               menu_bubbless[drv]->do_clear_inner_media();
+       }
+       // ToDO: Replace signal model.
+       if(driveData != nullptr) {
+               driveData->updateMediaFileName(CSP_DockDisks_Domain_Bubble, drv, QString::fromUtf8(""));
+       }
+}
+void Ui_MainWindowBase::do_ui_bubble_write_protect(int drv, quint64 flag)
+{
+       if(drive < 0) return;
+
+       std::shared_ptr<USING_FLAGS>p = using_flags;
+       if(p.get() == nullptr) return;
+       if(!(p->is_use_bubble()) || (p->get_max_bubble() <= drive)) return;
+       if(menu_bubbless[drive] != nullptr) return;
+
+       if((flag & EMU_MESSAGE_TYPE::WRITE_PROTECT) != 0) {
+               menu_bubbles[drive]->do_set_write_protect(true);
+       } else {
+               menu_bubbles[drive]->do_set_write_protect(false);
+       }
+}
+
+void Ui_MainWindowBase::do_update_bubble_history(int drive, QStringList lst)
+{
+       std::shared_ptr<USING_FLAGS> p = using_flags;
+       if(p.get() == nullptr) return;
+
+       if((drive < 0) || (drive >= p->get_max_bubble())) return;
+       if(menu_bubbless[drive] != nullptr) {
+               menu_bubbless[drive]->do_update_histories(lst);
+       }
+}
index 6a6548d..ce4acc6 100644 (file)
@@ -62,8 +62,10 @@ int Ui_MainWindowBase::set_recent_disk(int drv, int num)
 
 void Ui_MainWindowBase::do_ui_floppy_insert_history(int drv, QString fname, quint64 bank)
 {
+       std::shared_ptr<USING_FLAGS>p = using_flags;
+       if(p.get() == nullptr) return;
        if(fname.length() <= 0) return;
-       if(using_flags->get_max_drive() <= drv) return;
+       if(p->get_max_drive() <= drv) return;
 
        _TCHAR path_shadow[_MAX_PATH] = {0};
 
index eda59f2..b105124 100644 (file)
@@ -762,7 +762,7 @@ void OSD_BASE::osdcall_unmount(EMU_MEDIA_TYPE::type_t media_type, int drive, EMU
                emit sig_ui_binary_closed(drive);
                break;
        case EMU_MEDIA_TYPE::BUBBLE_CASETTE :
-               emit sig_ui_binary_closed(drive);
+               emit sig_ui_bubble_closed(drive);
                break;
        case EMU_MEDIA_TYPE::CARTRIDGE :
                emit sig_ui_cartridge_eject(drive);
index 6f1e42d..f94f95b 100644 (file)
@@ -1,6 +1,6 @@
 message("* vm/common_vm")
 
-SET(THIS_LIB_VERSION 7.6.3)
+SET(THIS_LIB_VERSION 7.6.4)
 
 #include(cotire)
 set(s_vm_common_vm_srcs
index 264debc..5308791 100644 (file)
@@ -1,7 +1,7 @@
 cmake_minimum_required (VERSION 3.0)
 
 message("* vm/fmgen")
-SET(THIS_LIB_VERSION 5.5.3)
+SET(THIS_LIB_VERSION 5.5.4)
 add_definitions(-D__LIBFMGEN_VERSION=\"libCSPfmgen.${THIS_LIB_VERSION}\")
 
 SET(s_vm_fmgen_srcs