mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-04 14:27:38 +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);
|
||||
break;
|
||||
case MENU_ITEM_RESIZE_MODE:
|
||||
g_console.input_loop = INPUT_LOOP_RESIZE_MODE;
|
||||
break;
|
||||
case MENU_ITEM_FRAME_ADVANCE:
|
||||
if (g_console.emulator_initialized)
|
||||
@ -603,6 +604,8 @@ void menu_loop(void)
|
||||
if(g_console.emulator_initialized)
|
||||
video_xdk360.set_swap_block_state(NULL, true);
|
||||
|
||||
g_console.input_loop = INPUT_LOOP_MENU;
|
||||
|
||||
do
|
||||
{
|
||||
g_frame_count++;
|
||||
@ -622,7 +625,18 @@ void menu_loop(void)
|
||||
&& IS_TIMER_EXPIRED());
|
||||
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 = XuiTimersRun(); /* Update XUI timers */
|
||||
|
||||
|
@ -31,6 +31,12 @@ enum
|
||||
SETTING_SCALE_ENABLED
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
INPUT_LOOP_MENU,
|
||||
INPUT_LOOP_RESIZE_MODE
|
||||
};
|
||||
|
||||
class CRetroArch : public CXuiModule
|
||||
{
|
||||
public:
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "xdk360_input.h"
|
||||
#include "xdk360_video_general.h"
|
||||
#include "shared.h"
|
||||
#include "menu.h"
|
||||
|
||||
static uint64_t state[4];
|
||||
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)
|
||||
{
|
||||
(void)data;
|
||||
|
@ -31,5 +31,6 @@
|
||||
|
||||
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_loop(void);
|
||||
|
||||
#endif
|
||||
|
@ -270,7 +270,7 @@ static void xdk360_gfx_free(void * data)
|
||||
free(vid);
|
||||
}
|
||||
|
||||
static void set_viewport(bool force_full)
|
||||
void set_viewport(bool force_full)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
@ -296,14 +296,15 @@ static void set_viewport(bool force_full)
|
||||
float delta;
|
||||
|
||||
// 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)
|
||||
//{
|
||||
// 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;
|
||||
//}
|
||||
if (device_aspect > desired_aspect)
|
||||
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;
|
||||
}
|
||||
else if (device_aspect > desired_aspect)
|
||||
{
|
||||
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
||||
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;
|
||||
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);
|
||||
|
||||
vid->fbo_enabled = 1;
|
||||
|
@ -63,6 +63,7 @@ void xdk360_video_init (void);
|
||||
void xdk360_video_deinit (void);
|
||||
void xdk360_video_set_vsync (bool vsync);
|
||||
void xdk360_set_fbo_enable (bool enable);
|
||||
void set_viewport(bool force_full);
|
||||
|
||||
extern void *g_d3d;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user