Change internal state of custom viewport

This commit is contained in:
twinaphex 2015-09-26 20:05:00 +02:00
parent cdf597aa89
commit f104173c7e
3 changed files with 12 additions and 25 deletions

View File

@ -1189,13 +1189,10 @@ static bool config_load_file(const char *path, bool set_defaults)
const char *extra_path = NULL; const char *extra_path = NULL;
char tmp_str[PATH_MAX_LENGTH] = {0}; char tmp_str[PATH_MAX_LENGTH] = {0};
char tmp_append_path[PATH_MAX_LENGTH] = {0}; /* Don't destroy append_config_path. */ char tmp_append_path[PATH_MAX_LENGTH] = {0}; /* Don't destroy append_config_path. */
int vp_width = 0, vp_height = 0, vp_x = 0, vp_y = 0;
unsigned msg_color = 0; unsigned msg_color = 0;
config_file_t *conf = NULL; config_file_t *conf = NULL;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
video_viewport_t *custom_vp = (video_viewport_t*)
video_viewport_get_custom();
if (path) if (path)
{ {
@ -1369,19 +1366,10 @@ static bool config_load_file(const char *path, bool set_defaults)
#endif #endif
CONFIG_GET_INT_BASE(conf, settings, state_slot, "state_slot"); CONFIG_GET_INT_BASE(conf, settings, state_slot, "state_slot");
CONFIG_GET_INT_BASE(conf, settings, video_viewport_custom.width, "custom_viewport_width");
config_get_int(conf, "custom_viewport_width", &vp_width); CONFIG_GET_INT_BASE(conf, settings, video_viewport_custom.height, "custom_viewport_height");
config_get_int(conf, "custom_viewport_height", &vp_height); CONFIG_GET_INT_BASE(conf, settings, video_viewport_custom.x, "custom_viewport_x");
config_get_int(conf, "custom_viewport_x", &vp_x); CONFIG_GET_INT_BASE(conf, settings, video_viewport_custom.y, "custom_viewport_y");
config_get_int(conf, "custom_viewport_y", &vp_y);
if (custom_vp)
{
custom_vp->width = vp_width;
custom_vp->height = vp_height;
custom_vp->x = vp_x;
custom_vp->y = vp_y;
}
if (config_get_hex(conf, "video_message_color", &msg_color)) if (config_get_hex(conf, "video_message_color", &msg_color))
{ {
@ -2421,8 +2409,6 @@ bool config_save_file(const char *path)
config_file_t *conf = config_file_new(path); config_file_t *conf = config_file_new(path);
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
const video_viewport_t *custom_vp = (const video_viewport_t*)
video_viewport_get_custom();
if (!conf) if (!conf)
conf = config_file_new(NULL); conf = config_file_new(NULL);
@ -2697,13 +2683,13 @@ bool config_save_file(const char *path)
config_set_int(conf, "current_resolution_id", config_set_int(conf, "current_resolution_id",
global->console.screen.resolutions.current.id); global->console.screen.resolutions.current.id);
config_set_int(conf, "custom_viewport_width", config_set_int(conf, "custom_viewport_width",
custom_vp->width); settings->video_viewport_custom.width);
config_set_int(conf, "custom_viewport_height", config_set_int(conf, "custom_viewport_height",
custom_vp->height); settings->video_viewport_custom.height);
config_set_int(conf, "custom_viewport_x", config_set_int(conf, "custom_viewport_x",
custom_vp->x); settings->video_viewport_custom.x);
config_set_int(conf, "custom_viewport_y", config_set_int(conf, "custom_viewport_y",
custom_vp->y); settings->video_viewport_custom.y);
config_set_float(conf, "video_font_size", settings->video.font_size); config_set_float(conf, "video_font_size", settings->video.font_size);

View File

@ -33,6 +33,8 @@ extern "C" {
typedef struct settings typedef struct settings
{ {
video_viewport_t video_viewport_custom;
struct struct
{ {
char driver[32]; char driver[32];

View File

@ -16,8 +16,6 @@
#include "../general.h" #include "../general.h"
static video_viewport_t video_viewport_custom;
struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = { struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
{ "4:3", 1.3333f }, { "4:3", 1.3333f },
{ "16:9", 1.7778f }, { "16:9", 1.7778f },
@ -230,7 +228,8 @@ struct retro_system_av_info *video_viewport_get_system_av_info(void)
struct video_viewport *video_viewport_get_custom(void) struct video_viewport *video_viewport_get_custom(void)
{ {
return &video_viewport_custom; settings_t *settings = config_get_ptr();
return &settings->video_viewport_custom;
} }
void video_viewport_reset_custom(void) void video_viewport_reset_custom(void)