Use double pixel size to render amiga video (2x2)
[mercenary-reloaded.git] / src / mercenary / main.c
index 6e1af1c..0d8d582 100644 (file)
@@ -36,7 +36,7 @@
 
 static int config_amiga_speed = 1;
 static const char *config_gamesave_dir = ".mercenary";
-static int config_video_filter = 0;
+static int config_video_filter = 1;
 static int config_audio_filter = 1;
 
 #define CPU_SPEED      7093790.0;
@@ -72,6 +72,7 @@ static float *sound_buffer = NULL; /* sound buffer memory */
 static int sound_buffer_size; /* buffer sample size */
 static int sound_buffer_writep; /* write pointer at buffer */
 static int sound_buffer_readp; /* read pointer at buffer */
+static int double_size = 1; /* render in double size, so each pixle is 2*2 pixles wide */
 
 static const char *home_dir;
 
@@ -187,7 +188,7 @@ static void main_loop(void)
                        /* render game view without benson
                         * because benson is not updated before VBL IRQ, we don't want old image from double buffer
                         */
-                       emul_video(image, memory, palette, IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_DIWSTART, chipreg, 0, BENSON_AT_LINE);
+                       emul_video(image, memory, palette, IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_DIWSTART, chipreg, 0, BENSON_AT_LINE, double_size);
                }
                rc = event_sdl();
                if (rc)
@@ -210,7 +211,7 @@ static void main_loop(void)
                        /* render benson without game view
                         * because we only got benson refreshed during VBL IRQ
                         */
-                       emul_video(image, memory, palette, IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_DIWSTART, chipreg, BENSON_AT_LINE, IMAGE_HEIGHT);
+                       emul_video(image, memory, palette, IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_DIWSTART, chipreg, BENSON_AT_LINE, IMAGE_HEIGHT, double_size);
                        /* render sound to sound buffer
                         * buffer pointer read and write is atomic, so no locking required!
                         */
@@ -264,7 +265,7 @@ int main(int argc, char *argv[])
                return 0;
 
        /* allocate image */
-       image = calloc(IMAGE_WIDTH * IMAGE_HEIGHT, 3);
+       image = calloc(IMAGE_WIDTH * IMAGE_HEIGHT * ((double_size) ? 4 : 1), 3);
        if (!image) {
                fprintf(stderr, "Failed to allocate image buffer\n");
                goto done;
@@ -320,7 +321,7 @@ int main(int argc, char *argv[])
        rc = init_sdl(argv[0], SCREEN_WIDTH, SCREEN_HEIGHT, SOUND_SAMPLERATE, sdl_sound_chunk);
        if (rc < 0)
                goto done;
-       rc = init_opengl(IMAGE_WIDTH, IMAGE_HEIGHT);
+       rc = init_opengl((double_size) ? IMAGE_WIDTH * 2 : IMAGE_WIDTH, (double_size) ? IMAGE_HEIGHT * 2 : IMAGE_HEIGHT);
        if (rc < 0)
                goto done;
        resize_opengl(SCREEN_WIDTH, SCREEN_HEIGHT);