mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 11:43:00 +00:00
(RARCH_CONSOLE) Split up video code for console into rarch_console_video.c
This commit is contained in:
parent
10c00eaf70
commit
739fd99a21
@ -19,7 +19,11 @@
|
||||
#include <tchar.h>
|
||||
#include <xtl.h>
|
||||
#include "../../console/fileio/file_browser.h"
|
||||
|
||||
#include "../../console/rarch_console.h"
|
||||
#include "../../console/rarch_console_settings.h"
|
||||
#include "../../console/rarch_console_video.h"
|
||||
|
||||
#include "../xdk_d3d9.h"
|
||||
#include "menu.h"
|
||||
#include "../../message.h"
|
||||
|
@ -22,6 +22,9 @@
|
||||
CONSOLE EXTENSIONS
|
||||
============================================================ */
|
||||
#include "../rarch_console_rom_ext.c"
|
||||
|
||||
#include "../rarch_console_video.c"
|
||||
|
||||
#include "../rarch_console.c"
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
|
@ -31,86 +31,6 @@
|
||||
|
||||
default_paths_t default_paths;
|
||||
|
||||
/*============================================================
|
||||
VIDEO EXTENSIONS
|
||||
============================================================ */
|
||||
|
||||
#if defined(HAVE_HLSL)
|
||||
#include "../gfx/shader_hlsl.h"
|
||||
#elif defined(HAVE_CG) && defined(HAVE_OPENGL)
|
||||
#include "../gfx/shader_cg.h"
|
||||
#endif
|
||||
|
||||
struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
|
||||
{ "1:1", 1.0f },
|
||||
{ "2:1", 2.0f },
|
||||
{ "3:2", 1.5f },
|
||||
{ "3:4", 0.75f },
|
||||
{ "4:1", 4.0f },
|
||||
{ "4:3", 1.3333f },
|
||||
{ "4:4", 1.0f },
|
||||
{ "5:4", 1.25f },
|
||||
{ "6:5", 1.2f },
|
||||
{ "7:9", 0.7777f },
|
||||
{ "8:3", 2.6666f },
|
||||
{ "8:7", 1.1428f },
|
||||
{ "16:9", 1.7778f },
|
||||
{ "16:10", 1.6f },
|
||||
{ "16:15", 3.2f },
|
||||
{ "19:12", 1.5833f },
|
||||
{ "19:14", 1.3571f },
|
||||
{ "30:17", 1.7647f },
|
||||
{ "32:9", 3.5555f },
|
||||
{ "Auto", 1.0f },
|
||||
{ "Custom", 0.0f }
|
||||
};
|
||||
|
||||
char rotation_lut[ASPECT_RATIO_END][PATH_MAX] =
|
||||
{
|
||||
"Normal",
|
||||
"Vertical",
|
||||
"Flipped",
|
||||
"Flipped Rotated"
|
||||
};
|
||||
|
||||
void rarch_set_auto_viewport(unsigned width, unsigned height)
|
||||
{
|
||||
if(width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
unsigned aspect_x, aspect_y, len, highest, i;
|
||||
|
||||
len = width < height ? width : height;
|
||||
highest = 1;
|
||||
for (i = 1; i < len; i++)
|
||||
{
|
||||
if ((width % i) == 0 && (height % i) == 0)
|
||||
highest = i;
|
||||
}
|
||||
|
||||
aspect_x = width / highest;
|
||||
aspect_y = height / highest;
|
||||
|
||||
snprintf(aspectratio_lut[ASPECT_RATIO_AUTO].name, sizeof(aspectratio_lut[ASPECT_RATIO_AUTO].name), "%d:%d (Auto)", aspect_x, aspect_y);
|
||||
aspectratio_lut[ASPECT_RATIO_AUTO].value = (int)aspect_x / (int)aspect_y;
|
||||
}
|
||||
|
||||
#if defined(HAVE_HLSL) || defined(HAVE_CG) || defined(HAVE_GLSL)
|
||||
void rarch_load_shader(unsigned slot, const char *path)
|
||||
{
|
||||
#if defined(HAVE_HLSL)
|
||||
hlsl_load_shader(slot, path);
|
||||
#elif defined(HAVE_CG) && defined(HAVE_OPENGL)
|
||||
gl_cg_load_shader(slot, path);
|
||||
#else
|
||||
RARCH_WARN("Shader support is not implemented for this build.\n");
|
||||
#endif
|
||||
|
||||
if (g_console.info_msg_enable)
|
||||
rarch_settings_msg(S_MSG_SHADER_LOADING_SUCCEEDED, S_DELAY_180);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
RetroArch MAIN WRAP
|
||||
============================================================ */
|
||||
|
@ -23,98 +23,6 @@
|
||||
|
||||
#include "../general.h"
|
||||
|
||||
#include "rarch_console_settings.h"
|
||||
|
||||
#define IS_TIMER_NOT_EXPIRED(handle) (handle->frame_count < g_console.timer_expiration_frame_count)
|
||||
#define IS_TIMER_EXPIRED(handle) (!(IS_TIMER_NOT_EXPIRED(handle)))
|
||||
#define SET_TIMER_EXPIRATION(handle, value) (g_console.timer_expiration_frame_count = handle->frame_count + value)
|
||||
|
||||
/*============================================================
|
||||
VIDEO
|
||||
============================================================ */
|
||||
|
||||
#define MIN_SCALING_FACTOR (1.0f)
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#define MAX_SCALING_FACTOR (5.0f)
|
||||
#else
|
||||
#define MAX_SCALING_FACTOR (2.0f)
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
FBO_DEINIT = 0,
|
||||
FBO_INIT,
|
||||
FBO_REINIT
|
||||
};
|
||||
|
||||
enum aspect_ratio
|
||||
{
|
||||
ASPECT_RATIO_1_1 = 0,
|
||||
ASPECT_RATIO_2_1,
|
||||
ASPECT_RATIO_3_2,
|
||||
ASPECT_RATIO_3_4,
|
||||
ASPECT_RATIO_4_1,
|
||||
ASPECT_RATIO_4_3,
|
||||
ASPECT_RATIO_4_4,
|
||||
ASPECT_RATIO_5_4,
|
||||
ASPECT_RATIO_6_5,
|
||||
ASPECT_RATIO_7_9,
|
||||
ASPECT_RATIO_8_3,
|
||||
ASPECT_RATIO_8_7,
|
||||
ASPECT_RATIO_16_9,
|
||||
ASPECT_RATIO_16_10,
|
||||
ASPECT_RATIO_16_15,
|
||||
ASPECT_RATIO_19_12,
|
||||
ASPECT_RATIO_19_14,
|
||||
ASPECT_RATIO_30_17,
|
||||
ASPECT_RATIO_32_9,
|
||||
ASPECT_RATIO_AUTO,
|
||||
ASPECT_RATIO_CUSTOM,
|
||||
|
||||
ASPECT_RATIO_END,
|
||||
};
|
||||
|
||||
#define LAST_ASPECT_RATIO ASPECT_RATIO_CUSTOM
|
||||
|
||||
enum rotation
|
||||
{
|
||||
ORIENTATION_NORMAL = 0,
|
||||
ORIENTATION_VERTICAL,
|
||||
ORIENTATION_FLIPPED,
|
||||
ORIENTATION_FLIPPED_ROTATED,
|
||||
ORIENTATION_END
|
||||
};
|
||||
|
||||
#define LAST_ORIENTATION (ORIENTATION_END-1)
|
||||
|
||||
extern char rotation_lut[ASPECT_RATIO_END][PATH_MAX];
|
||||
|
||||
/* ABGR color format defines */
|
||||
|
||||
#define WHITE 0xffffffffu
|
||||
#define RED 0xff0000ffu
|
||||
#define GREEN 0xff00ff00u
|
||||
#define BLUE 0xffff0000u
|
||||
#define YELLOW 0xff00ffffu
|
||||
#define PURPLE 0xffff00ffu
|
||||
#define CYAN 0xffffff00u
|
||||
#define ORANGE 0xff0063ffu
|
||||
#define SILVER 0xff8c848cu
|
||||
#define LIGHTBLUE 0xFFFFE0E0U
|
||||
#define LIGHTORANGE 0xFFE0EEFFu
|
||||
|
||||
struct aspect_ratio_elem
|
||||
{
|
||||
char name[64];
|
||||
float value;
|
||||
};
|
||||
|
||||
extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
|
||||
|
||||
extern void rarch_set_auto_viewport(unsigned width, unsigned height);
|
||||
extern void rarch_load_shader(unsigned slot, const char *path);
|
||||
|
||||
enum
|
||||
{
|
||||
SOUND_MODE_NORMAL,
|
||||
|
96
console/rarch_console_video.c
Normal file
96
console/rarch_console_video.c
Normal file
@ -0,0 +1,96 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "rarch_console_settings.h"
|
||||
#include "rarch_console_video.h"
|
||||
|
||||
#if defined(HAVE_HLSL)
|
||||
#include "../gfx/shader_hlsl.h"
|
||||
#elif defined(HAVE_CG) && defined(HAVE_OPENGL)
|
||||
#include "../gfx/shader_cg.h"
|
||||
#endif
|
||||
|
||||
struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
|
||||
{ "1:1", 1.0f },
|
||||
{ "2:1", 2.0f },
|
||||
{ "3:2", 1.5f },
|
||||
{ "3:4", 0.75f },
|
||||
{ "4:1", 4.0f },
|
||||
{ "4:3", 1.3333f },
|
||||
{ "4:4", 1.0f },
|
||||
{ "5:4", 1.25f },
|
||||
{ "6:5", 1.2f },
|
||||
{ "7:9", 0.7777f },
|
||||
{ "8:3", 2.6666f },
|
||||
{ "8:7", 1.1428f },
|
||||
{ "16:9", 1.7778f },
|
||||
{ "16:10", 1.6f },
|
||||
{ "16:15", 3.2f },
|
||||
{ "19:12", 1.5833f },
|
||||
{ "19:14", 1.3571f },
|
||||
{ "30:17", 1.7647f },
|
||||
{ "32:9", 3.5555f },
|
||||
{ "Auto", 1.0f },
|
||||
{ "Custom", 0.0f }
|
||||
};
|
||||
|
||||
char rotation_lut[ASPECT_RATIO_END][PATH_MAX] =
|
||||
{
|
||||
"Normal",
|
||||
"Vertical",
|
||||
"Flipped",
|
||||
"Flipped Rotated"
|
||||
};
|
||||
|
||||
void rarch_set_auto_viewport(unsigned width, unsigned height)
|
||||
{
|
||||
if(width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
unsigned aspect_x, aspect_y, len, highest, i;
|
||||
|
||||
len = width < height ? width : height;
|
||||
highest = 1;
|
||||
for (i = 1; i < len; i++)
|
||||
{
|
||||
if ((width % i) == 0 && (height % i) == 0)
|
||||
highest = i;
|
||||
}
|
||||
|
||||
aspect_x = width / highest;
|
||||
aspect_y = height / highest;
|
||||
|
||||
snprintf(aspectratio_lut[ASPECT_RATIO_AUTO].name, sizeof(aspectratio_lut[ASPECT_RATIO_AUTO].name), "%d:%d (Auto)", aspect_x, aspect_y);
|
||||
aspectratio_lut[ASPECT_RATIO_AUTO].value = (int)aspect_x / (int)aspect_y;
|
||||
}
|
||||
|
||||
#if defined(HAVE_HLSL) || defined(HAVE_CG) || defined(HAVE_GLSL)
|
||||
void rarch_load_shader(unsigned slot, const char *path)
|
||||
{
|
||||
#if defined(HAVE_HLSL)
|
||||
hlsl_load_shader(slot, path);
|
||||
#elif defined(HAVE_CG) && defined(HAVE_OPENGL)
|
||||
gl_cg_load_shader(slot, path);
|
||||
#else
|
||||
RARCH_WARN("Shader support is not implemented for this build.\n");
|
||||
#endif
|
||||
|
||||
if (g_console.info_msg_enable)
|
||||
rarch_settings_msg(S_MSG_SHADER_LOADING_SUCCEEDED, S_DELAY_180);
|
||||
}
|
||||
#endif
|
106
console/rarch_console_video.h
Normal file
106
console/rarch_console_video.h
Normal file
@ -0,0 +1,106 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RARCH_CONSOLE_VIDEO_H__
|
||||
#define RARCH_CONSOLE_VIDEO_H__
|
||||
|
||||
#define IS_TIMER_NOT_EXPIRED(handle) (handle->frame_count < g_console.timer_expiration_frame_count)
|
||||
#define IS_TIMER_EXPIRED(handle) (!(IS_TIMER_NOT_EXPIRED(handle)))
|
||||
#define SET_TIMER_EXPIRATION(handle, value) (g_console.timer_expiration_frame_count = handle->frame_count + value)
|
||||
|
||||
#define MIN_SCALING_FACTOR (1.0f)
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#define MAX_SCALING_FACTOR (5.0f)
|
||||
#else
|
||||
#define MAX_SCALING_FACTOR (2.0f)
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
FBO_DEINIT = 0,
|
||||
FBO_INIT,
|
||||
FBO_REINIT
|
||||
};
|
||||
|
||||
enum aspect_ratio
|
||||
{
|
||||
ASPECT_RATIO_1_1 = 0,
|
||||
ASPECT_RATIO_2_1,
|
||||
ASPECT_RATIO_3_2,
|
||||
ASPECT_RATIO_3_4,
|
||||
ASPECT_RATIO_4_1,
|
||||
ASPECT_RATIO_4_3,
|
||||
ASPECT_RATIO_4_4,
|
||||
ASPECT_RATIO_5_4,
|
||||
ASPECT_RATIO_6_5,
|
||||
ASPECT_RATIO_7_9,
|
||||
ASPECT_RATIO_8_3,
|
||||
ASPECT_RATIO_8_7,
|
||||
ASPECT_RATIO_16_9,
|
||||
ASPECT_RATIO_16_10,
|
||||
ASPECT_RATIO_16_15,
|
||||
ASPECT_RATIO_19_12,
|
||||
ASPECT_RATIO_19_14,
|
||||
ASPECT_RATIO_30_17,
|
||||
ASPECT_RATIO_32_9,
|
||||
ASPECT_RATIO_AUTO,
|
||||
ASPECT_RATIO_CUSTOM,
|
||||
|
||||
ASPECT_RATIO_END,
|
||||
};
|
||||
|
||||
#define LAST_ASPECT_RATIO ASPECT_RATIO_CUSTOM
|
||||
|
||||
enum rotation
|
||||
{
|
||||
ORIENTATION_NORMAL = 0,
|
||||
ORIENTATION_VERTICAL,
|
||||
ORIENTATION_FLIPPED,
|
||||
ORIENTATION_FLIPPED_ROTATED,
|
||||
ORIENTATION_END
|
||||
};
|
||||
|
||||
#define LAST_ORIENTATION (ORIENTATION_END-1)
|
||||
|
||||
extern char rotation_lut[ASPECT_RATIO_END][PATH_MAX];
|
||||
|
||||
/* ABGR color format defines */
|
||||
|
||||
#define WHITE 0xffffffffu
|
||||
#define RED 0xff0000ffu
|
||||
#define GREEN 0xff00ff00u
|
||||
#define BLUE 0xffff0000u
|
||||
#define YELLOW 0xff00ffffu
|
||||
#define PURPLE 0xffff00ffu
|
||||
#define CYAN 0xffffff00u
|
||||
#define ORANGE 0xff0063ffu
|
||||
#define SILVER 0xff8c848cu
|
||||
#define LIGHTBLUE 0xFFFFE0E0U
|
||||
#define LIGHTORANGE 0xFFE0EEFFu
|
||||
|
||||
struct aspect_ratio_elem
|
||||
{
|
||||
char name[64];
|
||||
float value;
|
||||
};
|
||||
|
||||
extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
|
||||
|
||||
extern void rarch_set_auto_viewport(unsigned width, unsigned height);
|
||||
extern void rarch_load_shader(unsigned slot, const char *path);
|
||||
|
||||
#endif
|
@ -48,6 +48,8 @@
|
||||
#include "../../console/rarch_console.h"
|
||||
#include "../../console/rarch_console_input.h"
|
||||
#include "../../console/rarch_console_config.h"
|
||||
#include "../../console/rarch_console_settings.h"
|
||||
#include "../../console/rarch_console_video.h"
|
||||
#include "../../conf/config_file.h"
|
||||
#include "../../conf/config_file_macros.h"
|
||||
#include "../../general.h"
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include "../../console/rarch_console_rom_ext.h"
|
||||
#include "../../console/rarch_console_input.h"
|
||||
#include "../../console/rarch_console_config.h"
|
||||
#include "../../console/rarch_console_settings.h"
|
||||
#include "../../console/rarch_console_video.h"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include "../../console/rarch_console_rzlib.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user