mirror of https://github.com/snes9xgit/snes9x.git
Add more aspect correction options.
This commit is contained in:
parent
27533c777e
commit
ea09396218
|
@ -63,10 +63,26 @@ S9xSetEndianess (int type)
|
|||
double
|
||||
S9xGetAspect (void)
|
||||
{
|
||||
if (gui_config->aspect_ratio)
|
||||
return (4.0 / 3.0);
|
||||
else
|
||||
return (8.0 / 7.0);
|
||||
double native_aspect = 256.0 / (gui_config->overscan ? 240.0 : 224.0);
|
||||
double aspect;
|
||||
|
||||
switch (gui_config->aspect_ratio)
|
||||
{
|
||||
case 0: /* Square pixels */
|
||||
aspect = native_aspect;
|
||||
break;
|
||||
|
||||
case 1: /* 4:3 */
|
||||
aspect = native_aspect * 7 / 6;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
default: /* Correct */
|
||||
aspect = native_aspect * 8 / 7;
|
||||
break;
|
||||
}
|
||||
|
||||
return aspect;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -307,7 +307,7 @@ event_fullscreen (GtkWidget *widget, gpointer data)
|
|||
static void
|
||||
event_exact_pixels_1x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (256, 224);
|
||||
((Snes9xWindow *) data)->resize_to_multiple (1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ event_exact_pixels_1x (GtkWidget *widget, gpointer data)
|
|||
static void
|
||||
event_exact_pixels_2x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (256 * 2, 224 * 2);
|
||||
((Snes9xWindow *) data)->resize_to_multiple (2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ event_exact_pixels_2x (GtkWidget *widget, gpointer data)
|
|||
static void
|
||||
event_exact_pixels_3x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (256 * 3, 224 * 3);
|
||||
((Snes9xWindow *) data)->resize_to_multiple (3);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ event_exact_pixels_3x (GtkWidget *widget, gpointer data)
|
|||
static void
|
||||
event_exact_pixels_4x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (256 * 4, 224 * 4);
|
||||
((Snes9xWindow *) data)->resize_to_multiple (4);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -339,47 +339,7 @@ event_exact_pixels_4x (GtkWidget *widget, gpointer data)
|
|||
static void
|
||||
event_exact_pixels_5x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (256 * 5, 224 * 5);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
event_correct_aspect_1x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (224 * 4 / 3, 224);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
event_correct_aspect_2x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (224 * 4 * 2 / 3, 224 * 2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
event_correct_aspect_3x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (224 * 4 * 3 / 3, 224 * 3);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
event_correct_aspect_4x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (224 * 4 * 4 / 3, 224 * 4);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
event_correct_aspect_5x (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
((Snes9xWindow *) data)->resize_viewport (224 * 4 * 5 / 3, 224 * 5);
|
||||
((Snes9xWindow *) data)->resize_to_multiple (5);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -626,11 +586,6 @@ Snes9xWindow::Snes9xWindow (Snes9xConfig *config) :
|
|||
{ "exact_3x", G_CALLBACK (event_exact_pixels_3x) },
|
||||
{ "exact_4x", G_CALLBACK (event_exact_pixels_4x) },
|
||||
{ "exact_5x", G_CALLBACK (event_exact_pixels_5x) },
|
||||
{ "correct_1x", G_CALLBACK (event_correct_aspect_1x) },
|
||||
{ "correct_2x", G_CALLBACK (event_correct_aspect_2x) },
|
||||
{ "correct_3x", G_CALLBACK (event_correct_aspect_3x) },
|
||||
{ "correct_4x", G_CALLBACK (event_correct_aspect_4x) },
|
||||
{ "correct_5x", G_CALLBACK (event_correct_aspect_5x) },
|
||||
{ "open_multicart", G_CALLBACK (event_open_multicart) },
|
||||
|
||||
{ NULL, NULL }
|
||||
|
@ -2044,3 +1999,14 @@ Snes9xWindow::update_accels (void)
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
Snes9xWindow::resize_to_multiple (int factor)
|
||||
{
|
||||
int h = (config->overscan ? 240 : 224) * factor;
|
||||
int w = h * S9xGetAspect ();
|
||||
|
||||
resize_viewport (w, h);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ class Snes9xWindow : public GtkBuilderWindow
|
|||
void reset_screensaver (void);
|
||||
void update_accels (void);
|
||||
void toggle_ui (void);
|
||||
void resize_to_multiple (int factor);
|
||||
void resize_viewport (int width, int height);
|
||||
void expose (GdkEventExpose *event, cairo_t *cr);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue