mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 04:44:02 +00:00
(360) refactor viewport settings code - also need to update
PS3 after this commit
This commit is contained in:
parent
74d12bf1a1
commit
4ecdddb2cb
24
360/main.c
24
360/main.c
@ -171,10 +171,10 @@ static void set_default_settings (void)
|
||||
g_console.throttle_enable = true;
|
||||
g_console.aspect_ratio_index = 0;
|
||||
strlcpy(g_console.default_rom_startup_dir, "game:", sizeof(g_console.default_rom_startup_dir));
|
||||
g_console.custom_viewport_width = 0;
|
||||
g_console.custom_viewport_height = 0;
|
||||
g_console.custom_viewport_x = 0;
|
||||
g_console.custom_viewport_y = 0;
|
||||
g_console.viewports.custom_vp.width = 0;
|
||||
g_console.viewports.custom_vp.height = 0;
|
||||
g_console.viewports.custom_vp.x = 0;
|
||||
g_console.viewports.custom_vp.y = 0;
|
||||
|
||||
//g_extern
|
||||
g_extern.state_slot = 0;
|
||||
@ -263,10 +263,10 @@ static void init_settings (bool load_libretro_path)
|
||||
CONFIG_GET_BOOL_CONSOLE(gamma_correction_enable, "gamma_correction_enable");
|
||||
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
|
||||
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
|
||||
CONFIG_GET_INT_CONSOLE(custom_viewport_x, "custom_viewport_x");
|
||||
CONFIG_GET_INT_CONSOLE(custom_viewport_y, "custom_viewport_y");
|
||||
CONFIG_GET_INT_CONSOLE(custom_viewport_width, "custom_viewport_width");
|
||||
CONFIG_GET_INT_CONSOLE(custom_viewport_height, "custom_viewport_height");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.x, "custom_viewport_x");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.y, "custom_viewport_y");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.width, "custom_viewport_width");
|
||||
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.height, "custom_viewport_height");
|
||||
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
|
||||
|
||||
// g_extern
|
||||
@ -307,10 +307,10 @@ static void save_settings (void)
|
||||
config_set_bool(conf, "gamma_correction_enable", g_console.gamma_correction_enable);
|
||||
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
|
||||
config_set_int(conf, "aspect_ratio_index", g_console.aspect_ratio_index);
|
||||
config_set_int(conf, "custom_viewport_width", g_console.custom_viewport_width);
|
||||
config_set_int(conf, "custom_viewport_height", g_console.custom_viewport_height);
|
||||
config_set_int(conf, "custom_viewport_x", g_console.custom_viewport_x);
|
||||
config_set_int(conf, "custom_viewport_y", g_console.custom_viewport_y);
|
||||
config_set_int(conf, "custom_viewport_width", g_console.viewports.custom_vp.width);
|
||||
config_set_int(conf, "custom_viewport_height", g_console.viewports.custom_vp.height);
|
||||
config_set_int(conf, "custom_viewport_x", g_console.viewports.custom_vp.x);
|
||||
config_set_int(conf, "custom_viewport_y", g_console.viewports.custom_vp.y);
|
||||
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
|
||||
|
||||
// g_extern
|
||||
|
@ -115,37 +115,37 @@ void xdk360_input_loop(void)
|
||||
|
||||
XInputGetState(0, &state);
|
||||
|
||||
custom_viewport_x_tmp = g_console.custom_viewport_x;
|
||||
custom_viewport_y_tmp = g_console.custom_viewport_y;
|
||||
custom_viewport_width_tmp = g_console.custom_viewport_width;
|
||||
custom_viewport_height_tmp = g_console.custom_viewport_height;
|
||||
custom_viewport_x_tmp = g_console.viewports.custom_vp.x;
|
||||
custom_viewport_y_tmp = g_console.viewports.custom_vp.y;
|
||||
custom_viewport_width_tmp = g_console.viewports.custom_vp.width;
|
||||
custom_viewport_height_tmp = g_console.viewports.custom_vp.height;
|
||||
|
||||
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT || state.Gamepad.sThumbLX < -DEADZONE)
|
||||
g_console.custom_viewport_x -= 1;
|
||||
g_console.viewports.custom_vp.x -= 1;
|
||||
else if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT || state.Gamepad.sThumbLX > DEADZONE)
|
||||
g_console.custom_viewport_x += 1;
|
||||
g_console.viewports.custom_vp.x += 1;
|
||||
|
||||
if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP || state.Gamepad.sThumbLY > DEADZONE)
|
||||
g_console.custom_viewport_y += 1;
|
||||
g_console.viewports.custom_vp.y += 1;
|
||||
else if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN || state.Gamepad.sThumbLY < -DEADZONE)
|
||||
g_console.custom_viewport_y -= 1;
|
||||
g_console.viewports.custom_vp.y -= 1;
|
||||
|
||||
if (state.Gamepad.sThumbRX < -DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB)
|
||||
g_console.custom_viewport_width -= 1;
|
||||
g_console.viewports.custom_vp.width -= 1;
|
||||
else if (state.Gamepad.sThumbRX > DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB)
|
||||
g_console.custom_viewport_width += 1;
|
||||
g_console.viewports.custom_vp.width += 1;
|
||||
|
||||
if (state.Gamepad.sThumbRY > DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER)
|
||||
g_console.custom_viewport_height += 1;
|
||||
g_console.viewports.custom_vp.height += 1;
|
||||
else if (state.Gamepad.sThumbRY < -DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER)
|
||||
g_console.custom_viewport_height -= 1;
|
||||
g_console.viewports.custom_vp.height -= 1;
|
||||
|
||||
if (state.Gamepad.wButtons & XINPUT_GAMEPAD_Y)
|
||||
{
|
||||
g_console.custom_viewport_x = 0;
|
||||
g_console.custom_viewport_y = 0;
|
||||
g_console.custom_viewport_width = 1280; //FIXME: hardcoded
|
||||
g_console.custom_viewport_height = 720; //FIXME: hardcoded
|
||||
g_console.viewports.custom_vp.x = 0;
|
||||
g_console.viewports.custom_vp.y = 0;
|
||||
g_console.viewports.custom_vp.width = 1280; //FIXME: hardcoded
|
||||
g_console.viewports.custom_vp.height = 720; //FIXME: hardcoded
|
||||
}
|
||||
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_B)
|
||||
{
|
||||
|
@ -299,10 +299,10 @@ void set_viewport(bool force_full)
|
||||
if(g_console.aspect_ratio_index == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
||||
m_viewport_x_temp = g_console.custom_viewport_x;
|
||||
m_viewport_y_temp = g_console.custom_viewport_y;
|
||||
m_viewport_width_temp = g_console.custom_viewport_width;
|
||||
m_viewport_height_temp = g_console.custom_viewport_height;
|
||||
m_viewport_x_temp = g_console.viewports.custom_vp.x;
|
||||
m_viewport_y_temp = g_console.viewports.custom_vp.y;
|
||||
m_viewport_width_temp = g_console.viewports.custom_vp.width;
|
||||
m_viewport_height_temp = g_console.viewports.custom_vp.height;
|
||||
}
|
||||
else if (device_aspect > desired_aspect)
|
||||
{
|
||||
@ -497,11 +497,11 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
||||
vp.MaxZ = 1.0f;
|
||||
vid->d3d_render_device->SetViewport(&vp);
|
||||
|
||||
if(g_console.custom_viewport_width == 0)
|
||||
g_console.custom_viewport_width = vp.Width;
|
||||
if(g_console.viewports.custom_vp.width == 0)
|
||||
g_console.viewports.custom_vp.width = vp.Width;
|
||||
|
||||
if(g_console.custom_viewport_height == 0)
|
||||
g_console.custom_viewport_height = vp.Height;
|
||||
if(g_console.viewports.custom_vp.height == 0)
|
||||
g_console.viewports.custom_vp.height = vp.Height;
|
||||
|
||||
xdk360_set_orientation(NULL, g_console.screen_orientation);
|
||||
|
||||
|
17
general.h
17
general.h
@ -180,6 +180,14 @@ struct settings
|
||||
|
||||
// Settings and/or global state that is specific to a console-style implementation.
|
||||
#ifdef RARCH_CONSOLE
|
||||
typedef struct
|
||||
{
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
} viewport_t;
|
||||
|
||||
struct console_settings
|
||||
{
|
||||
#ifdef __CELLOS_LV2__
|
||||
@ -201,10 +209,11 @@ struct console_settings
|
||||
bool triple_buffering_enable;
|
||||
float overscan_amount;
|
||||
uint32_t aspect_ratio_index;
|
||||
uint32_t custom_viewport_width;
|
||||
uint32_t custom_viewport_height;
|
||||
uint32_t custom_viewport_x;
|
||||
uint32_t custom_viewport_y;
|
||||
struct
|
||||
{
|
||||
viewport_t auto_vp;
|
||||
viewport_t custom_vp;
|
||||
} viewports;
|
||||
uint32_t emulator_initialized;
|
||||
uint32_t external_launcher_support;
|
||||
uint32_t screen_orientation;
|
||||
|
Loading…
x
Reference in New Issue
Block a user