]> Shamusworld >> Repos - virtualjaguar/commitdiff
Fixed fullscreen mode, shrunk screen width.
authorShamus Hammons <jlhamm@acm.org>
Mon, 4 Feb 2013 04:34:12 +0000 (22:34 -0600)
committerShamus Hammons <jlhamm@acm.org>
Mon, 4 Feb 2013 04:34:12 +0000 (22:34 -0600)
Full screeen mode now correctly centers the image on wide screen
monitors. In addition, the virtual screen width has been reduced in size
back to what you would see on a TV with a modest amount of overscan.
Assuming all is well with this commit, this will be our 2.1.0 release.
Yes, there are still some regressions in a few games that we are aware
of, but the improvements over the last official release are too great to
hold this back any longer. :-)

.gitignore
src/gui/about.cpp
src/gui/debug/m68kdasmbrowser.cpp
src/gui/glwidget.cpp
src/gui/glwidget.h
src/gui/mainwin.cpp
src/tom.cpp
src/tom.h

index 9d442ad71f1280d040009256f755aeccddebbe7c..e98ddc538280deb084154a1d24270fdc40b126ac 100644 (file)
@@ -8,4 +8,6 @@ src/*~
 src/m68000/*~
 eeproms/*.eep
 software/
+build/
+regression-test/
 *~
index 14ccfd801395f6a0a388c19374e494cdaa90b6fd..e56c165f14d57c6dafd26ed01a76cc4c5129d82d 100644 (file)
@@ -20,6 +20,7 @@
 #include "about.h"
 #include "version.h"
 
+
 AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
 {
        setWindowTitle(tr("About Virtual Jaguar..."));
@@ -37,7 +38,7 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
                "</td></tr>"
                "<tr><td align='right'><b>Coders: </b></td><td>James Hammons (shamus)<br>Niels Wagenaar (nwagenaar)<br>Carwin Jones (Caz)<br>Adam Green</td></tr>"
                "<tr><td align='right'><b>Testers: </b></td><td>Cyrano Jones, LinkoVitch, neo-rg, Robert R,<br>TheUMan, Dissection, overridex, geormetal</td></tr>"
-               "<tr><td align='right'><b>Build Team: </b></td><td>ggn (win32)<br>LinkoVitch, goldenegg (MacOS)</td></tr>"
+               "<tr><td align='right'><b>Build Team: </b></td><td>shamus (win32)<br>goldenegg (MacOS)</td></tr>"
                "<tr><td align='right'><b>Homepage: </b></td><td>http://icculus.org/virtualjaguar/</td></tr>"
                "</table>"
                "<br><br>"
@@ -58,6 +59,7 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
        layout->addWidget(text);
 }
 
+
 void AboutWindow::keyPressEvent(QKeyEvent * e)
 {
        if (e->key() == Qt::Key_Escape || e->key() == Qt::Key_Return)
index 0d94aa321adf848d8c9436735fc02e2eba1e120a..af21b9ebaba93cafb2284a25bbb257fda1e1c6c9 100644 (file)
@@ -99,7 +99,7 @@ void M68KDasmBrowserWindow::keyPressEvent(QKeyEvent * e)
 #if 1
        else if (e->key() == Qt::Key_PageUp)
        {
-               memBase -= 480;
+               memBase -= 64;
 
                if (memBase < 0)
                        memBase = 0;
@@ -108,10 +108,10 @@ void M68KDasmBrowserWindow::keyPressEvent(QKeyEvent * e)
        }
        else if (e->key() == Qt::Key_PageDown)
        {
-               memBase += 480;
+               memBase += 64;
 
-               if (memBase > (0x200000 - 480))
-                       memBase = 0x200000 - 480;
+               if (memBase > (0xF00000 - 64))
+                       memBase = 0xF00000 - 64;
 
                RefreshContents();
        }
@@ -128,8 +128,8 @@ void M68KDasmBrowserWindow::keyPressEvent(QKeyEvent * e)
        {
                memBase += 16;
 
-               if (memBase > (0x200000 - 480))
-                       memBase = 0x200000 - 480;
+               if (memBase > (0xF00000 - 64))
+                       memBase = 0xF00000 - 64;
 
                RefreshContents();
        }
index 56fcd0ed824de8490a95cf8e3440b935310dbe8a..af51f47ed3c8c093a6b6b41d85cde92732ceec0c 100644 (file)
@@ -9,6 +9,7 @@
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
 // JLH  01/14/2010  Created this file
+// JLH  02/03/2013  Added "centered" fullscreen mode with correct aspect ratio
 //
 
 #include "glwidget.h"
 #include <GL/glext.h>
 #endif
 
+
 GLWidget::GLWidget(QWidget * parent/*= 0*/): QGLWidget(parent), texture(0),
-       textureWidth(0), textureHeight(0), buffer(0), rasterWidth(340), rasterHeight(240)
+       textureWidth(0), textureHeight(0), buffer(0), rasterWidth(340), rasterHeight(240),
+       offset(0)
 {
        // Screen pitch has to be the texture width (in 32-bit pixels)...
        JaguarSetScreenPitch(1024);
 }
 
+
 GLWidget::~GLWidget()
 {
-//     free(backbuffer);
+       if (buffer)
+               delete[] buffer;
 }
 
+
 void GLWidget::initializeGL()
 {
        format().setDoubleBuffer(true);
@@ -49,18 +55,29 @@ void GLWidget::initializeGL()
        glClearColor(0.0, 0.0, 0.0, 0.0);
 }
 
+
 void GLWidget::paintGL()
 {
 //kludge
 rasterHeight = (vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCREEN_HEIGHT_PAL);
 
-       unsigned outputWidth  = width();
+       // If we're in fullscreen mode, we take the value of the screen width as
+       // set by MainWin, since it may be wider than what our aspect ratio allows.
+       // In that case, we adjust the viewport over so that it's centered on the
+       // screen. Otherwise, we simply take the width from our width() funtion
+       // which will always be correct in windowed mode.
+
+//     unsigned outputWidth  = width();
+       if (!fullscreen)
+               outputWidth = width();
+
        unsigned outputHeight = height();
 
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(0, outputWidth, 0, outputHeight, -1.0, 1.0);
-       glViewport(0, 0, outputWidth, outputHeight);
+//     glViewport(0, 0, outputWidth, outputHeight);
+       glViewport(0 + offset, 0, outputWidth, outputHeight);
 
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
@@ -79,13 +96,21 @@ rasterHeight = (vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCRE
        unsigned v = outputHeight;
 
        glBegin(GL_TRIANGLE_STRIP);
+#if 1
        glTexCoord2f(0, 0); glVertex3i(0, v, 0);
        glTexCoord2f(w, 0); glVertex3i(u, v, 0);
        glTexCoord2f(0, h); glVertex3i(0, 0, 0);
        glTexCoord2f(w, h); glVertex3i(u, 0, 0);
+#else
+       glTexCoord2f(0, 0); glVertex3i(0 + offset, v, 0);
+       glTexCoord2f(w, 0); glVertex3i(u + offset, v, 0);
+       glTexCoord2f(0, h); glVertex3i(0 + offset, 0, 0);
+       glTexCoord2f(w, h); glVertex3i(u + offset, 0, 0);
+#endif
        glEnd();
 }
 
+
 void GLWidget::resizeGL(int width, int height)
 {
        if (width > textureWidth || height > textureHeight)
@@ -118,6 +143,7 @@ memset(buffer, 0xFF, textureWidth * textureHeight * sizeof(uint32_t));
        }
 }
 
+
 #if 0
 class RubyGLWidget: public QGLWidget
 {
index 39ed1815438b39755c045ea33c3e50a2fde9f283..1b000797efe9aa146608b30c07e835ecbb5e42e4 100644 (file)
@@ -38,6 +38,9 @@ class GLWidget: public QGLWidget
 
                bool synchronize;
                unsigned filter;
+               int offset;
+               bool fullscreen;
+               int outputWidth;
 };
 
 #endif // __GLWIDGET_H__
index 88b4d19e160e201a4e2876f8d104e480fa27ef0b..1c990faec8337d5a7c038907150cbce48a524a51 100644 (file)
@@ -874,12 +874,19 @@ void MainWin::SetFullScreen(bool state/*= true*/)
                // NOTE: Really should check here to see which dimension constrains the other.
                //       Right now, we assume that height is the constraint.
                int newWidth = (int)(aspectRatio * (double)r.height());
+               videoWidget->offset = (r.width() - newWidth) / 2;
+               videoWidget->fullscreen = true;
+               videoWidget->outputWidth = newWidth;
 
-               videoWidget->setFixedSize(newWidth, r.height());
+//             videoWidget->setFixedSize(newWidth, r.height());
+               videoWidget->setFixedSize(r.width(), r.height());
                showFullScreen();
        }
        else
        {
+               // Reset the video widget to windowed mode
+               videoWidget->offset = 0;
+               videoWidget->fullscreen = false;
                menuBar()->show();
                statusBar()->show();
                showNormal();
index db3f277e1e3d775d38c5a77ff20ded9faf270493..845f1551f37f1b88548a3e796ccc39a977300ee6 100644 (file)
 // Split the difference? (Seems to be OK for the most part...)
 
 // (-10 +10)*4 is for opening up the display by 16 pixels (may go to 20). Need to change VIRTUAL_SCREEN_WIDTH to match this as well (went from 320 to 340; this is 4 HCs per one of those pixels).
-#define LEFT_VISIBLE_HC                        (208 - 16 - (8 * 4))
+//NB: Went back to 330. May shrink more. :-)
+//#define LEFT_VISIBLE_HC                      (208 - 16 - (8 * 4))
+//#define LEFT_VISIBLE_HC                      (208 - 16 - (3 * 4))
+#define LEFT_VISIBLE_HC                        (208 - 16 - (1 * 4))
 //#define RIGHT_VISIBLE_HC             (1488 - 16 + (10 * 4))
 #define RIGHT_VISIBLE_HC               (LEFT_VISIBLE_HC + (VIRTUAL_SCREEN_WIDTH * 4))
 //#define TOP_VISIBLE_VC               25
 //Are these PAL horizontals correct?
 //They seem to be for the most part, but there are some games that seem to be
 //shifted over to the right from this "window".
-#define LEFT_VISIBLE_HC_PAL            (208 - 16 - (4 * 4))
+//#define LEFT_VISIBLE_HC_PAL          (208 - 16 - (4 * 4))
+//#define LEFT_VISIBLE_HC_PAL          (208 - 16 - (-1 * 4))
+#define LEFT_VISIBLE_HC_PAL            (208 - 16 - (-3 * 4))
 //#define RIGHT_VISIBLE_HC_PAL (1488 - 16 + (10 * 4))
 #define RIGHT_VISIBLE_HC_PAL   (LEFT_VISIBLE_HC_PAL + (VIRTUAL_SCREEN_WIDTH * 4))
 #define TOP_VISIBLE_VC_PAL             67
index 8b95a75aaab3f04f84ef9e7948b8e557ebf7d085..72521488bbdccf6939a6012625a50546f424e009 100644 (file)
--- a/src/tom.h
+++ b/src/tom.h
@@ -16,7 +16,8 @@
 
 // NB: This virtual width is for PWIDTH = 4
 //#define VIRTUAL_SCREEN_WIDTH            320
-#define VIRTUAL_SCREEN_WIDTH            340
+//was:340, 330
+#define VIRTUAL_SCREEN_WIDTH            326
 #define VIRTUAL_SCREEN_HEIGHT_NTSC      240
 #define VIRTUAL_SCREEN_HEIGHT_PAL       256