[retro-gtk] environment: Implement RETRO_ENVIRONMENT_SET_GEOMETRY
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] environment: Implement RETRO_ENVIRONMENT_SET_GEOMETRY
- Date: Fri, 27 Apr 2018 07:33:50 +0000 (UTC)
commit cd3f053edacfc41c02be951e0b8251e6dd85b5ec
Author: Exalm <exalm7659 gmail com>
Date: Thu Apr 26 17:08:12 2018 +0500
environment: Implement RETRO_ENVIRONMENT_SET_GEOMETRY
Allows cores to change aspect ratio separately from framerate.
retro-gtk/retro-core-private.h | 2 ++
retro-gtk/retro-core.c | 17 ++++++++++++-----
retro-gtk/retro-environment.c | 13 ++++++++++++-
3 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/retro-gtk/retro-core-private.h b/retro-gtk/retro-core-private.h
index 2cf046c..ad128aa 100644
--- a/retro-gtk/retro-core-private.h
+++ b/retro-gtk/retro-core-private.h
@@ -66,6 +66,8 @@ void retro_core_set_support_no_game (RetroCore *self,
gchar *retro_core_get_name (RetroCore *self);
void retro_core_set_system_av_info (RetroCore *self,
RetroSystemAvInfo *system_av_info);
+void retro_core_set_geometry (RetroCore *self,
+ RetroGameGeometry *geometry);
void retro_core_poll_controllers (RetroCore *self);
gint16 retro_core_get_controller_input_state (RetroCore *self,
uint port,
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 598aee1..1a5bdf6 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -603,14 +603,21 @@ retro_core_set_system_av_info (RetroCore *self,
self->frames_per_second = system_av_info->timing.fps;
g_object_notify (G_OBJECT (self), "frames-per-second");
}
- if (system_av_info->geometry.aspect_ratio > 0.f)
- self->aspect_ratio = system_av_info->geometry.aspect_ratio;
- else
- self->aspect_ratio = (float) system_av_info->geometry.base_width /
- (float) system_av_info->geometry.base_height;
+ retro_core_set_geometry (self, &system_av_info->geometry);
self->sample_rate = system_av_info->timing.sample_rate;
}
+void
+retro_core_set_geometry (RetroCore *self,
+ RetroGameGeometry *geometry)
+{
+ if (geometry->aspect_ratio > 0.f)
+ self->aspect_ratio = geometry->aspect_ratio;
+ else
+ self->aspect_ratio = (float) geometry->base_width /
+ (float) geometry->base_height;
+}
+
/**
* retro_core_get_name:
* @self: a #RetroCore
diff --git a/retro-gtk/retro-environment.c b/retro-gtk/retro-environment.c
index 0a94048..82a9d18 100644
--- a/retro-gtk/retro-environment.c
+++ b/retro-gtk/retro-environment.c
@@ -214,6 +214,15 @@ set_disk_control_interface (RetroCore *self,
return TRUE;
}
+static gboolean
+set_geometry (RetroCore *self,
+ RetroGameGeometry *geometry)
+{
+ retro_core_set_geometry (self, geometry);
+
+ return TRUE;
+}
+
static gboolean
set_input_descriptors (RetroCore *self,
RetroInputDescriptor *descriptors)
@@ -347,6 +356,9 @@ environment_core_command (RetroCore *self,
case RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE:
set_disk_control_interface (self, (RetroDiskControlCallback *) data);
+ case RETRO_ENVIRONMENT_SET_GEOMETRY:
+ return set_geometry (self, (RetroGameGeometry *) data);
+
case RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS:
return set_input_descriptors (self, (RetroInputDescriptor *) data);
@@ -383,7 +395,6 @@ environment_core_command (RetroCore *self,
case RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK:
case RETRO_ENVIRONMENT_SET_CONTROLLER_INFO:
case RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK:
- case RETRO_ENVIRONMENT_SET_GEOMETRY:
case RETRO_ENVIRONMENT_SET_HW_RENDER:
case RETRO_ENVIRONMENT_SET_MEMORY_MAPS:
case RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]