OSDN Git Service

[DRAW][OpenGL][Qt][FM7] Fix wrong screen aspect on VMs without variable lines.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 17 Jan 2017 05:43:17 +0000 (14:43 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 17 Jan 2017 05:43:17 +0000 (14:43 +0900)
source/src/qt/common/menu_flags.cpp
source/src/qt/common/menu_flags.h
source/src/qt/gui/CMakeLists.txt
source/src/qt/gui/qt_glutil_gl2_0.cpp
source/src/qt/gui/qt_glutil_gl3_0.cpp
source/src/vm/fm7/fm7.h

index 5b14ba8..d39686b 100644 (file)
@@ -94,8 +94,20 @@ USING_FLAGS::USING_FLAGS(config_t *cfg)
        use_vm_auto_key_table = false;
        support_tv_render = false;
        
+       real_screen_width  = SCREEN_WIDTH;
+       real_screen_height = SCREEN_HEIGHT;
+       
+#if defined(SCREEN_FAKE_WIDTH)
+       screen_width = SCREEN_FAKE_WIDTH;
+#else
        screen_width = SCREEN_WIDTH;
+#endif
+#if defined(SCREEN_FAKE_HEIGHT)
+       screen_height = SCREEN_FAKE_HEIGHT;
+#else
        screen_height = SCREEN_HEIGHT;
+#endif
+       
        screen_width_aspect = WINDOW_WIDTH_ASPECT;
        screen_height_aspect = WINDOW_HEIGHT_ASPECT;
        max_button = 0;
index 83ce0b5..42718a7 100644 (file)
@@ -125,6 +125,9 @@ private:
        int screen_width;
        int screen_height;
        
+       int real_screen_width;
+       int real_screen_height;
+       
        int screen_width_aspect;
        int screen_height_aspect;
        bool notify_key_down_lr_shift;
@@ -263,6 +266,9 @@ public:
        int get_screen_height() { return screen_height; }
        int get_screen_width_aspect() { return screen_width_aspect; }
        int get_screen_height_aspect() { return screen_height_aspect; }
+       int get_real_screen_width() { return real_screen_width; }
+       int get_real_screen_height() { return real_screen_height; }
+       
        int get_screen_mode_num() { return screen_mode_num; }
        int get_max_button() { return max_button; }
        button_desc_t *get_vm_buttons() { return vm_buttons_d; }
index 77fd4ce..353b6b7 100644 (file)
@@ -157,8 +157,8 @@ target_link_libraries(CSPgui PUBLIC
          )
 
 set_target_properties(CSPgui PROPERTIES 
-                            SOVERSION 2.4.0
-                            VERSION 2.4.0
+                            SOVERSION 2.4.1
+                            VERSION 2.4.1
                             )
 INSTALL(TARGETS CSPgui DESTINATION ${LIBCSP_INSTALL_DIR})
 endif()
index 2663eee..467550f 100644 (file)
@@ -32,8 +32,8 @@ GLDraw_2_0::GLDraw_2_0(GLDrawClass *parent, USING_FLAGS *p, EMU *emu) : QObject(
        glVertGrids = NULL;
        glHorizGrids = NULL;
 
-       vert_lines = using_flags->get_screen_height();
-       horiz_pixels = using_flags->get_screen_width();
+       vert_lines = using_flags->get_real_screen_height();
+       horiz_pixels = using_flags->get_real_screen_width();
        set_brightness = false;
        crt_flag = false;
        smoosing = false;
@@ -351,13 +351,13 @@ void GLDraw_2_0::initFBO(void)
        if(using_flags->get_max_button() > 0) {
                initButtons();
        }
-       glHorizGrids = (GLfloat *)malloc(sizeof(float) * (using_flags->get_screen_height() + 2) * 6);
+       glHorizGrids = (GLfloat *)malloc(sizeof(float) * (using_flags->get_real_screen_height() + 2) * 6);
        if(glHorizGrids != NULL) {
-               doSetGridsHorizonal(using_flags->get_screen_height(), true);
+               doSetGridsHorizonal(using_flags->get_real_screen_height(), true);
        }
-       glVertGrids  = (GLfloat *)malloc(sizeof(float) * (using_flags->get_screen_width() + 2) * 6);
+       glVertGrids  = (GLfloat *)malloc(sizeof(float) * (using_flags->get_real_screen_width() + 2) * 6);
        if(glVertGrids != NULL) {
-               doSetGridsVertical(using_flags->get_screen_width(), true);
+               doSetGridsVertical(using_flags->get_real_screen_width(), true);
        }
        // Init view
        extfunc_2->glClearColor(0.0, 0.0, 0.0, 1.0);
@@ -432,7 +432,7 @@ void GLDraw_2_0::doSetGridsHorizonal(int lines, bool force)
        vert_lines = lines;
        yf = -screen_height;
        if(vert_lines <= 0) return;
-       if(vert_lines > using_flags->get_screen_height()) vert_lines = using_flags->get_screen_height();
+       if(vert_lines > using_flags->get_real_screen_height()) vert_lines = using_flags->get_real_screen_height();
        
        delta = (2.0f * screen_height) / (float)vert_lines;
        yf = yf - delta * 1.0f;
@@ -458,13 +458,13 @@ void GLDraw_2_0::doSetGridsVertical(int pixels, bool force)
        if((pixels == horiz_pixels) && !force) return;
        horiz_pixels = pixels;
        if(horiz_pixels <= 0) return;
-       if(horiz_pixels > using_flags->get_screen_width()) horiz_pixels = using_flags->get_screen_width();
+       if(horiz_pixels > using_flags->get_real_screen_width()) horiz_pixels = using_flags->get_real_screen_width();
        
        xf = -screen_width;
        delta = (2.0f * screen_width) / (float)horiz_pixels;
        xf = xf - delta * 0.75f;
        if(glVertGrids != NULL) {
-               if(horiz_pixels > using_flags->get_screen_width()) horiz_pixels = using_flags->get_screen_width();
+               if(horiz_pixels > using_flags->get_real_screen_width()) horiz_pixels = using_flags->get_real_screen_width();
                for(i = 0; i < (horiz_pixels + 1) ; i++) {
                        glVertGrids[i * 6]     = xf; // XBegin
                        glVertGrids[i * 6 + 3] = xf; // XEnd
index 7c55a84..dd038e6 100644 (file)
@@ -233,13 +233,13 @@ GLDraw_3_0::~GLDraw_3_0()
 
 void GLDraw_3_0::initFBO(void)
 {
-       glHorizGrids = (GLfloat *)malloc(sizeof(float) * (using_flags->get_screen_height() + 2) * 6);
+       glHorizGrids = (GLfloat *)malloc(sizeof(float) * (using_flags->get_real_screen_height() + 2) * 6);
        if(glHorizGrids != NULL) {
-               doSetGridsHorizonal(using_flags->get_screen_height(), true);
+               doSetGridsHorizonal(using_flags->get_real_screen_height(), true);
        }
-       glVertGrids  = (GLfloat *)malloc(sizeof(float) * (using_flags->get_screen_width() + 2) * 6);
+       glVertGrids  = (GLfloat *)malloc(sizeof(float) * (using_flags->get_real_screen_width() + 2) * 6);
        if(glVertGrids != NULL) {
-               doSetGridsVertical(using_flags->get_screen_width(), true);
+               doSetGridsVertical(using_flags->get_real_screen_width(), true);
        }
        if(using_flags->get_max_button() > 0) {
                initButtons();
@@ -486,11 +486,11 @@ void GLDraw_3_0::initLocalGLObjects(void)
        }
        initGridShaders(":/grids_vertex_shader_fixed.glsl", ":/grids_vertex_shader.glsl", ":/grids_fragment_shader.glsl");
        
-       initGridVertexObject(&grids_horizonal_buffer, &grids_horizonal_vertex, using_flags->get_screen_height() + 3);
-       doSetGridsHorizonal(using_flags->get_screen_height(), true);
+       initGridVertexObject(&grids_horizonal_buffer, &grids_horizonal_vertex, using_flags->get_real_screen_height() + 3);
+       doSetGridsHorizonal(using_flags->get_real_screen_height(), true);
        
-       initGridVertexObject(&grids_vertical_buffer, &grids_vertical_vertex, using_flags->get_screen_width() + 3);
-       doSetGridsVertical(using_flags->get_screen_width(), true);
+       initGridVertexObject(&grids_vertical_buffer, &grids_vertical_vertex, using_flags->get_real_screen_width() + 3);
+       doSetGridsVertical(using_flags->get_real_screen_width(), true);
 
        do_set_texture_size(NULL, -1, -1);
        p_wid->doneCurrent();
index ba50e58..27faa74 100644 (file)
 # if defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX) || defined(_FM77L4)
 #define SCREEN_WIDTH           640
 #define SCREEN_HEIGHT          400
+#undef SCREEN_FAKE_WIDTH
+#undef SCREEN_FAKE_HEIGHT
 #else
 #define SCREEN_WIDTH           640
 #define SCREEN_HEIGHT          200
+#define SCREEN_FAKE_WIDTH   640
+#define SCREEN_FAKE_HEIGHT  400
 #endif
 #define WINDOW_HEIGHT_ASPECT 480
 #define HAS_MC6809