mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-04 22:46:46 +00:00
(360) Custom resize mode now works
This commit is contained in:
parent
2103440c91
commit
74d12bf1a1
16
360/menu.cpp
16
360/menu.cpp
@ -238,6 +238,7 @@ HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
|
|||||||
video_xdk360.set_rotation(NULL, g_console.screen_orientation);
|
video_xdk360.set_rotation(NULL, g_console.screen_orientation);
|
||||||
break;
|
break;
|
||||||
case MENU_ITEM_RESIZE_MODE:
|
case MENU_ITEM_RESIZE_MODE:
|
||||||
|
g_console.input_loop = INPUT_LOOP_RESIZE_MODE;
|
||||||
break;
|
break;
|
||||||
case MENU_ITEM_FRAME_ADVANCE:
|
case MENU_ITEM_FRAME_ADVANCE:
|
||||||
if (g_console.emulator_initialized)
|
if (g_console.emulator_initialized)
|
||||||
@ -603,6 +604,8 @@ void menu_loop(void)
|
|||||||
if(g_console.emulator_initialized)
|
if(g_console.emulator_initialized)
|
||||||
video_xdk360.set_swap_block_state(NULL, true);
|
video_xdk360.set_swap_block_state(NULL, true);
|
||||||
|
|
||||||
|
g_console.input_loop = INPUT_LOOP_MENU;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
g_frame_count++;
|
g_frame_count++;
|
||||||
@ -622,7 +625,18 @@ void menu_loop(void)
|
|||||||
&& IS_TIMER_EXPIRED());
|
&& IS_TIMER_EXPIRED());
|
||||||
g_console.mode_switch = g_console.menu_enable ? MODE_MENU : MODE_EMULATION;
|
g_console.mode_switch = g_console.menu_enable ? MODE_MENU : MODE_EMULATION;
|
||||||
|
|
||||||
app.RunFrame(); /* Update XUI */
|
switch(g_console.input_loop)
|
||||||
|
{
|
||||||
|
case INPUT_LOOP_MENU:
|
||||||
|
app.RunFrame(); /* Update XUI */
|
||||||
|
break;
|
||||||
|
case INPUT_LOOP_RESIZE_MODE:
|
||||||
|
xdk360_input_loop();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
hr = app.Render(); /* Render XUI */
|
hr = app.Render(); /* Render XUI */
|
||||||
hr = XuiTimersRun(); /* Update XUI timers */
|
hr = XuiTimersRun(); /* Update XUI timers */
|
||||||
|
|
||||||
|
@ -31,6 +31,12 @@ enum
|
|||||||
SETTING_SCALE_ENABLED
|
SETTING_SCALE_ENABLED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
INPUT_LOOP_MENU,
|
||||||
|
INPUT_LOOP_RESIZE_MODE
|
||||||
|
};
|
||||||
|
|
||||||
class CRetroArch : public CXuiModule
|
class CRetroArch : public CXuiModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "xdk360_input.h"
|
#include "xdk360_input.h"
|
||||||
#include "xdk360_video_general.h"
|
#include "xdk360_video_general.h"
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
#include "menu.h"
|
||||||
|
|
||||||
static uint64_t state[4];
|
static uint64_t state[4];
|
||||||
static unsigned pads_connected;
|
static unsigned pads_connected;
|
||||||
@ -105,6 +106,53 @@ void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xdk360_input_loop(void)
|
||||||
|
{
|
||||||
|
int custom_viewport_x_tmp, custom_viewport_y_tmp, custom_viewport_width_tmp,
|
||||||
|
custom_viewport_height_tmp;
|
||||||
|
|
||||||
|
XINPUT_STATE state;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT || state.Gamepad.sThumbLX < -DEADZONE)
|
||||||
|
g_console.custom_viewport_x -= 1;
|
||||||
|
else if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT || state.Gamepad.sThumbLX > DEADZONE)
|
||||||
|
g_console.custom_viewport_x += 1;
|
||||||
|
|
||||||
|
if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP || state.Gamepad.sThumbLY > DEADZONE)
|
||||||
|
g_console.custom_viewport_y += 1;
|
||||||
|
else if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN || state.Gamepad.sThumbLY < -DEADZONE)
|
||||||
|
g_console.custom_viewport_y -= 1;
|
||||||
|
|
||||||
|
if (state.Gamepad.sThumbRX < -DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB)
|
||||||
|
g_console.custom_viewport_width -= 1;
|
||||||
|
else if (state.Gamepad.sThumbRX > DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB)
|
||||||
|
g_console.custom_viewport_width += 1;
|
||||||
|
|
||||||
|
if (state.Gamepad.sThumbRY > DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER)
|
||||||
|
g_console.custom_viewport_height += 1;
|
||||||
|
else if (state.Gamepad.sThumbRY < -DEADZONE || state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER)
|
||||||
|
g_console.custom_viewport_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
|
||||||
|
}
|
||||||
|
if(state.Gamepad.wButtons & XINPUT_GAMEPAD_B)
|
||||||
|
{
|
||||||
|
g_console.input_loop = INPUT_LOOP_MENU;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool xdk360_key_pressed(void *data, int key)
|
static bool xdk360_key_pressed(void *data, int key)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
@ -31,5 +31,6 @@
|
|||||||
|
|
||||||
extern void xdk360_input_init(void);
|
extern void xdk360_input_init(void);
|
||||||
extern void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);
|
extern void xdk360_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);
|
||||||
|
extern void xdk360_input_loop(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -270,7 +270,7 @@ static void xdk360_gfx_free(void * data)
|
|||||||
free(vid);
|
free(vid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_viewport(bool force_full)
|
void set_viewport(bool force_full)
|
||||||
{
|
{
|
||||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||||
@ -296,14 +296,15 @@ static void set_viewport(bool force_full)
|
|||||||
float delta;
|
float delta;
|
||||||
|
|
||||||
// If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff),
|
// If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff),
|
||||||
//if(g_console.aspect_ratio_index == ASPECT_RATIO_CUSTOM)
|
if(g_console.aspect_ratio_index == ASPECT_RATIO_CUSTOM)
|
||||||
//{
|
{
|
||||||
// m_viewport_x_temp = g_console.custom_viewport_x;
|
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
||||||
// m_viewport_y_temp = g_console.custom_viewport_y;
|
m_viewport_x_temp = g_console.custom_viewport_x;
|
||||||
// m_viewport_width_temp = g_console.custom_viewport_width;
|
m_viewport_y_temp = g_console.custom_viewport_y;
|
||||||
// m_viewport_height_temp = g_console.custom_viewport_height;
|
m_viewport_width_temp = g_console.custom_viewport_width;
|
||||||
//}
|
m_viewport_height_temp = g_console.custom_viewport_height;
|
||||||
if (device_aspect > desired_aspect)
|
}
|
||||||
|
else if (device_aspect > desired_aspect)
|
||||||
{
|
{
|
||||||
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
||||||
m_viewport_x_temp = (int)(width * (0.5 - delta));
|
m_viewport_x_temp = (int)(width * (0.5 - delta));
|
||||||
@ -496,6 +497,12 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
|||||||
vp.MaxZ = 1.0f;
|
vp.MaxZ = 1.0f;
|
||||||
vid->d3d_render_device->SetViewport(&vp);
|
vid->d3d_render_device->SetViewport(&vp);
|
||||||
|
|
||||||
|
if(g_console.custom_viewport_width == 0)
|
||||||
|
g_console.custom_viewport_width = vp.Width;
|
||||||
|
|
||||||
|
if(g_console.custom_viewport_height == 0)
|
||||||
|
g_console.custom_viewport_height = vp.Height;
|
||||||
|
|
||||||
xdk360_set_orientation(NULL, g_console.screen_orientation);
|
xdk360_set_orientation(NULL, g_console.screen_orientation);
|
||||||
|
|
||||||
vid->fbo_enabled = 1;
|
vid->fbo_enabled = 1;
|
||||||
|
@ -63,6 +63,7 @@ void xdk360_video_init (void);
|
|||||||
void xdk360_video_deinit (void);
|
void xdk360_video_deinit (void);
|
||||||
void xdk360_video_set_vsync (bool vsync);
|
void xdk360_video_set_vsync (bool vsync);
|
||||||
void xdk360_set_fbo_enable (bool enable);
|
void xdk360_set_fbo_enable (bool enable);
|
||||||
|
void set_viewport(bool force_full);
|
||||||
|
|
||||||
extern void *g_d3d;
|
extern void *g_d3d;
|
||||||
|
|
||||||
|
@ -219,6 +219,9 @@ struct console_settings
|
|||||||
uint32_t supported_resolutions_count;
|
uint32_t supported_resolutions_count;
|
||||||
uint32_t control_timer_expiration_frame_count;
|
uint32_t control_timer_expiration_frame_count;
|
||||||
uint32_t timer_expiration_frame_count;
|
uint32_t timer_expiration_frame_count;
|
||||||
|
#ifdef RARCH_CONSOLE
|
||||||
|
uint32_t input_loop;
|
||||||
|
#endif
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
DWORD volume_device_type;
|
DWORD volume_device_type;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user