OSDN Git Service

[UI][Qt][DISPLAY] FLOPPY: Use 5inch icon using 5inch floppy.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 8 Nov 2020 19:16:31 +0000 (04:16 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 8 Nov 2020 19:16:31 +0000 (04:16 +0900)
15 files changed:
source/src/qt/gui/CMakeLists.txt
source/src/qt/gui/gl/qt_glutil_gl_tmpl.h
source/src/qt/gui/gl2/qt_glutil_gl2_0.cpp
source/src/qt/gui/gl3/qt_glutil_gl3_0.cpp
source/src/qt/gui/gl4_5/qt_glutil_gl4_5.cpp
source/src/qt/gui/gles2/qt_glutil_gles_2.cpp
source/src/qt/gui/menu_flags.h
source/src/qt/gui/menu_flags_tmpl.cpp
source/src/qt/gui/qt_drawitem.cpp
source/src/qt/gui/qt_glutil.cpp
source/src/vm/fm16pi/fm16pi.h
source/src/vm/fm7/fm7.h
source/src/vm/fmr30/fmr30.h
source/src/vm/fmr50/fmr50.h
source/src/vm/fmtowns/fmtowns.h

index 7fc2211..e8883ea 100644 (file)
@@ -1,6 +1,6 @@
 message("* qt/gui")
 
-set(THIS_LIB_VERSION 3.2.1)
+set(THIS_LIB_VERSION 3.2.2)
 #include(cotire)
 #include(PrecompiledHeader)
 
index 540ecb6..8977e8c 100644 (file)
@@ -303,7 +303,7 @@ public:
                screen_texture_width_old = using_flags->get_screen_width();
                screen_texture_height = using_flags->get_screen_height();
                screen_texture_height_old = using_flags->get_screen_height();
-               
+#if 0          
                if(using_flags->is_use_fd()) {
                        osd_led_bit_width = 10;
                }
@@ -316,7 +316,15 @@ public:
                if(using_flags->get_max_scsi() > 0) {
                        osd_led_bit_width = 24;
                }
-               
+               if(using_flags->is_use_compact_disc()) {
+                       osd_led_bit_width = 26;
+               }
+               if(using_flags->is_use_laser_disc()) {
+                       osd_led_bit_width = 28;
+               }
+#else
+               osd_led_bit_width = 32;
+#endif         
                int i;
                // Will fix: Must fix setup of vm_buttons[].
                button_desc_t *vm_buttons_d = using_flags->get_vm_buttons();
index c764d77..d1f343e 100644 (file)
@@ -251,14 +251,21 @@ void GLDraw_2_0::drawOsdIcons()
                        } else if((ii >= 14) && (ii < 16)) { // CMT(W)
                                major = 5;
                                minor = ii - 14;
-                       } else if(ii >= 16) {
-                               major = 4 + (ii / 8) - 2;
-                               minor = ii % 8;
+                       }  else if((ii >= 16) && (ii < 24)) { // HDD
+                               major = 8;
+                               minor = ii - 16;
+                       } else if((ii >= 24) && (ii < 26)) { // CD
+                               major = 6;
+                               minor = ii - 24;
+                       } else if((ii >= 26) && (ii < 28)) { // LD
+                               major = 7;
+                               minor = ii - 26;
                        } else {
                                major = 0;
                                minor = 0;
                        }
                        // ToDo: CD,LD and HDD.
+                       if(icon_texid[major][minor] != NULL) {
                        if(checkf) {
                                drawMain(osd_shader, vertex_osd[ii],
                                                 buffer_osd[ii],
@@ -271,7 +278,8 @@ void GLDraw_2_0::drawOsdIcons()
                                                 vertexOSD[ii],
                                                 icon_texid[major][minor]->textureId(),
                                                 color_off, false);
-                       }                       
+                       }
+                       }
                        _bit <<= 1;
                }
                osd_led_status_bak = osd_led_status;
index 686bbc1..78ddc89 100644 (file)
@@ -1213,16 +1213,27 @@ void GLDraw_3_0::drawOsdIcons()
                                } else if((i >= 14) && (i < 16)) { // CMT(W)
                                        major = 5;
                                        minor = i - 14;
+                               } else if((i >= 16) && (i < 24)) { // HDD
+                                       major = 8;
+                                       minor = i - 16;
+                               } else if((i >= 24) && (i < 26)) { // CD
+                                       major = 6;
+                                       minor = i - 24;
+                               } else if((i >= 26) && (i < 28)) { // LD
+                                       major = 7;
+                                       minor = i - 26;
                                } else {
                                        major = 0;
                                        minor = 0;
                                }
                                // ToDo: CD(6),LD(7) and HDD(8).
                                if((major != 0) && (icon_texid[major][minor] != NULL)) {
-                                       drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i],
-                                                        icon_texid[major][minor]->textureId(),
-                                                        ((osd_led_status & bit) != 0) ? color_on : color_off,
-                                                        false, false, QVector3D(0.0, 0.0, 0.0));
+                                       if(icon_texid[major][minor] != NULL) {
+                                               drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i],
+                                                                icon_texid[major][minor]->textureId(),
+                                                                ((osd_led_status & bit) != 0) ? color_on : color_off,
+                                                                false, false, QVector3D(0.0, 0.0, 0.0));
+                                       }
                                }
                                bit <<= 1;
                        }
index 3fe930d..7e83d3b 100644 (file)
@@ -1332,15 +1332,26 @@ void GLDraw_4_5::drawOsdIcons()
                                } else if((i >= 14) && (i < 16)) { // CMT(W)
                                        major = 5;
                                        minor = i - 14;
+                               } else if((i >= 16) && (i < 24)) { // HDD
+                                       major = 8;
+                                       minor = i - 16;
+                               } else if((i >= 24) && (i < 26)) { // CD
+                                       major = 6;
+                                       minor = i - 24;
+                               } else if((i >= 26) && (i < 28)) { // LD
+                                       major = 7;
+                                       minor = i - 26;
                                } else {
                                        major = 0;
                                        minor = 0;
                                }
                                if(major != 0) {
-                                       drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i],
-                                                        icon_texid[major][minor]->textureId(),
-                                                        ((osd_led_status & bit) != 0) ? color_on : color_off,
-                                                        false, false, QVector3D(0.0, 0.0, 0.0));
+                                       if(icon_texid[major][minor] != NULL) {
+                                               drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i],
+                                                                icon_texid[major][minor]->textureId(),
+                                                                ((osd_led_status & bit) != 0) ? color_on : color_off,
+                                                                false, false, QVector3D(0.0, 0.0, 0.0));
+                                       }
                                }
                                bit <<= 1;
                        }
@@ -1827,13 +1838,11 @@ void GLDraw_4_5::uploadIconTexture(QPixmap *p, int icon_type, int localnum)
        if(p == NULL) return;
        p_wid->makeCurrent();
        QImage image = p->toImage();
-
        if(icon_texid[icon_type][localnum] != NULL) delete icon_texid[icon_type][localnum];
        {
                icon_texid[icon_type][localnum] = new QOpenGLTexture(image);
        }
        p_wid->doneCurrent();
-
 }
 
 
index f742d9c..a2e5b03 100644 (file)
@@ -1159,15 +1159,26 @@ void GLDraw_ES_2::drawOsdIcons()
                                } else if((i >= 14) && (i < 16)) { // CMT(W)
                                        major = 5;
                                        minor = i - 14;
+                               }  else if((i >= 16) && (i < 24)) { // HDD
+                                       major = 8;
+                                       minor = i - 16;
+                               } else if((i >= 24) && (i < 26)) { // CD
+                                       major = 6;
+                                       minor = i - 24;
+                               } else if((i >= 26) && (i < 28)) { // LD
+                                       major = 7;
+                                       minor = i - 26;
                                } else {
                                        major = 0;
                                        minor = 0;
                                }
                                if(major != 0) {
-                                       drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i],
-                                                        icon_texid[major][minor]->textureId(),
-                                                        ((osd_led_status & bit) != 0) ? color_on : color_off,
-                                                        false, false, QVector3D(0.0, 0.0, 0.0));
+                                       if(icon_texid[major][minor] != NULL) {
+                                               drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i],
+                                                                icon_texid[major][minor]->textureId(),
+                                                                ((osd_led_status & bit) != 0) ? color_on : color_off,
+                                                                false, false, QVector3D(0.0, 0.0, 0.0));
+                                       }
                                }
                                bit <<= 1;
                        }
index 5b56a2b..570c9a9 100644 (file)
@@ -79,7 +79,8 @@ protected:
        int base_fd_num;
        int max_drive;
        int max_d88_banks;
-
+       uint32_t floppy_type_bit;
+       
        int max_draw_ranges;
        
        bool use_joystick;
@@ -258,6 +259,7 @@ public:
        int get_max_drive() { return max_drive; }
        int get_max_d88_banks() { return max_d88_banks; }
        int get_base_floppy_disk_num() { return base_fd_num; }
+       uint32_t get_floppy_type_bit() { return floppy_type_bit; }
 
        bool is_use_joystick() { return use_joystick; }
        bool is_use_joy_button_captions() { return use_joy_button_captions; }
index 000217b..9fd7e52 100644 (file)
@@ -34,7 +34,8 @@ USING_FLAGS::USING_FLAGS(config_t *cfg)
 
        use_fd = false;
        max_drive = max_d88_banks = 0;
-
+       floppy_type_bit = 0x00000000;
+       
        max_draw_ranges = 0;
        use_ram_size = false;
        max_ram_size = 1;
index 6da412b..38eb09d 100644 (file)
@@ -97,13 +97,23 @@ void CSP_DrawItem::drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &FGC
        this->fill(BGColor);
        {
                double _nwidth = (__width > __height) ? (__height - 2.0) : (__width - 2.0) ;
-               _nwidth = _nwidth * (0.88 * 0.90);
+               //_nwidth = _nwidth * (0.88 * 0.90);
+               _nwidth = _nwidth * 0.88;
                painter.begin(this);
                int xbase = (int)((__width - _nwidth) / 2.0);
                int ybase = (int)((__height - _nwidth) * 0.5);
                int wbase = (int)_nwidth;
                int hbase = wbase;
-               drawRectItem(xbase, ybase, wbase, hbase, fill_brush, FGColor, FGColor);
+               {
+                       //QPointF points[4] = {
+                       //      QPointF((float)xbase, (float)ybase),
+                       //      QPointF((float)(xbase + wbase), (float)ybase),
+                       //      QPointF((float)(xbase + wbase), (float)(ybase + hbase)),
+                       //      QPointF((float)(xbase), (float)(ybase + hbase))
+                       //};
+                       //drawPolygonItem(points, 4, fill_brush, FGColor, FGColor);
+                       drawRectItem(xbase, ybase, wbase, hbase, fill_brush, FGColor, FGColor);
+               }
                {
                        int r = (int)((_nwidth * 0.35) / 2.0);
                        int x = xbase + wbase / 2 - r;
@@ -122,6 +132,13 @@ void CSP_DrawItem::drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &FGC
                        int x = (xbase + wbase / 2) - (int)(w / 2.0); 
                        int y = (ybase + wbase / 2) + (int)(_nwidth * 0.45 / 2.0); 
                        drawRectItem(x, y, w, h, fill_brush, FGColor2, FGColor2);
+//                     QPointF points[4] = {
+//                             QPointF((float)x, (float)y),
+//                             QPointF((float)(x+ w), (float)y),
+//                             QPointF((float)(x + w), (float)(y + h)),
+//                             QPointF((float)(x), (float)(y + h))
+//                     };
+//                     drawPolygonItem(points, 4, fill_brush, FGColor2, FGColor2);
                }
                if(!text.isEmpty()) {
                        int x = xbase + (int)(_nwidth * 0.65); 
index 9b4ea86..e6a3195 100644 (file)
@@ -81,7 +81,8 @@ void GLDrawClass::do_update_icon(int icon_type, int localnum, QString message, Q
                        draw_item->clearCanvas(nullColor);
                        break;
                case 1: 
-                       draw_item->drawFloppy5Inch(bg, fg, fg2, tg, pt, message);
+                       draw_item->drawFloppy5Inch(bg, fg3, fg2, tg, pt, message);
+                       icon_type = 2; // Workaround
                        break;
                case 2:
                        draw_item->drawFloppy3_5Inch(bg, fg3, fg2, fg, tg, pt, message);
@@ -151,13 +152,17 @@ void GLDrawClass::initializeGL(void)
        }
        if(using_flags->is_use_fd()) {
                int drvs = using_flags->get_max_drive();
+               uint32_t drvbit = using_flags->get_floppy_type_bit();
                QString ts, tmps;
                for(int i = 0; i < drvs; i++) {
                        tmps = QString::fromUtf8("");
                        ts.setNum(i);
                        tmps = tmps + ts + QString::fromUtf8(":");
-                       do_update_icon(1, i, tmps, BG, FG, FG2, FG3, LG, TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
-                       do_update_icon(2, i, tmps, BG, FG, FG2, FG3, LG, TG2, 12.0f); // Dedicate to 3.5/5/8? and startnum.
+                       if((drvbit & (1 << i)) == 0) {
+                               do_update_icon(1, i, tmps, BG, FG, FG2, FG3, LG, TG2, 12.0f); // Dedicate to 3.5/5/8? and startnum.
+                       } else {
+                               do_update_icon(2, i, tmps, BG, FG, FG2, FG3, LG, TG2, 12.0f); // Dedicate to 3.5/5/8? and startnum.
+                       }
                }
        }
        if(using_flags->is_use_qd()) {
@@ -183,8 +188,8 @@ void GLDrawClass::initializeGL(void)
                        tmps = QString::fromUtf8("");
                        ts.setNum(i + 1);
                        tmps = tmps + ts;
-                       do_update_icon(4, i, tmps, R_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
-                       do_update_icon(5, i, tmps, W_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f); // Dedicate to 3.5/5/8? and startnum.
+                       do_update_icon(4, i, tmps, R_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f);
+                       do_update_icon(5, i, tmps, W_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f);
                }
        }       
 }
index f9cf3e6..fcf5b74 100644 (file)
@@ -29,6 +29,7 @@
 
 // device informations for win32
 #define USE_FLOPPY_DISK                2
+#define USE_FLOPPY_TYPE_BIT 0x0003 /* 3.5, 3.5 */
 #define USE_AUTO_KEY           5
 #define USE_AUTO_KEY_RELEASE   6
 #define USE_NOTIFY_POWER_OFF
index a1170a1..f4c7ca4 100644 (file)
 #define MB8877_NO_BUSY_AFTER_SEEK
 
 //#define ENABLE_OPENCL // If OpenCL renderer is enabled, define here.
-
+#if defined(_FM77_VARIANTS) || defined(_FM77AV_VARIANTS)
+       #define USE_FLOPPY_TYPE_BIT 0x0003 /* 5.0, 5.0, 3.5, 3.5 */
+#else
+       #define USE_FLOPPY_TYPE_BIT 0x0000 /* 5.0, 5.0, 5.0, 5.0 */
+#endif
 //#include "../../config.h"
 #include "../../common.h"
 #include "../../fileio.h"
index cf3c0b1..bb3c0f8 100644 (file)
@@ -37,6 +37,7 @@
 
 // device informations for win32
 #define USE_FLOPPY_DISK                2
+#define USE_FLOPPY_TYPE_BIT 0x0003 /* 3.5, 3.5 */
 #define USE_HARD_DISK          7
 #define USE_AUTO_KEY           5
 #define USE_AUTO_KEY_RELEASE   6
index ae3d762..f3d92a4 100644 (file)
@@ -83,6 +83,8 @@
 // device informations for win32
 #define USE_CPU_TYPE           2
 #define USE_FLOPPY_DISK                4
+#define USE_FLOPPY_TYPE_BIT 0x0003 /* 3.5, 3.5, 5.0, 5.0 */
+
 #define USE_HARD_DISK          7
 #define USE_AUTO_KEY           5
 #define USE_AUTO_KEY_RELEASE   6
index 13a62b6..839c997 100644 (file)
 #define USE_FLOPPY_DISK     4 // ??
 #define USE_CART                       2
 #define USE_SPECIAL_RESET      12 /* 'CD' 'F0' - 'F3' 'H0' - 'H4' 'ICM' 'DEBUG' */
+#define USE_FLOPPY_TYPE_BIT 0x0003 /* 5.0, 5.0, 3.5, 3.5 */
 
 #define NOTIFY_KEY_DOWN
 #define USE_ALT_F10_KEY