(Xbox) Seems that Xbox D3D does not free up all resources

for some reason and that they didn't anticipate full teardown/setup.
Not sure if I can confirm, but it has been hell so far trying to get
this to work. So, instead, implement a butt-ugly hack that forces
ownership over video/input lifetime state. Will properly refactor
the driver.*_data_own variables later so that this hack is less
ugly. Ideally we'd solve the teardown/setup problem but given this
is esoteric D3D gibberish - good luck debugging >_>
This commit is contained in:
twinaphex 2014-05-30 01:48:55 +02:00
parent a747ad29d3
commit ffd68d4878
4 changed files with 222 additions and 546 deletions

View File

@ -519,6 +519,9 @@ void init_drivers(void)
adjust_system_rates();
g_extern.frame_count = 0;
#ifdef _XBOX
if (!driver.video_data)
#endif
init_video_input();
if (!driver.video_cache_context_ack && g_extern.system.hw_render_callback.context_reset)
@ -557,13 +560,16 @@ void uninit_drivers(void)
if (g_extern.system.hw_render_callback.context_destroy && !driver.video_cache_context)
g_extern.system.hw_render_callback.context_destroy();
#ifndef _XBOX
uninit_video_input();
#endif
#ifdef HAVE_CAMERA
uninit_camera();
if (driver.camera_data_own)
driver.camera_data = NULL;
driver.camera_data_own = false;
#endif
#ifdef HAVE_LOCATION
@ -571,6 +577,7 @@ void uninit_drivers(void)
if (driver.location_data_own)
driver.location_data = NULL;
driver.location_data_own = false;
#endif
#ifdef HAVE_OSK
@ -578,26 +585,19 @@ void uninit_drivers(void)
if (driver.osk_data_own)
driver.osk_data = NULL;
#endif
if (driver.video_data_own)
driver.video_data = NULL;
if (driver.audio_data_own)
driver.audio_data = NULL;
if (driver.input_data_own)
driver.input_data = NULL;
#ifdef HAVE_CAMERA
driver.camera_data_own = false;
#endif
#ifdef HAVE_LOCATION
driver.location_data_own = false;
#endif
#ifdef HAVE_OSK
driver.osk_data_own = false;
#endif
#ifndef _XBOX
if (driver.video_data_own)
driver.video_data = NULL;
driver.video_data_own = false;
driver.audio_data_own = false;
if (driver.input_data_own)
driver.input_data = NULL;
driver.input_data_own = false;
#endif
if (driver.audio_data_own)
driver.audio_data = NULL;
driver.audio_data_own = false;
}
void rarch_init_dsp_filter(void)

View File

@ -49,6 +49,7 @@ extern bool d3d_restore(void *data);
static void d3d_resize(void *data, unsigned new_width, unsigned new_height)
{
(void)data;
#ifndef _XBOX
d3d_video_t *d3d = (d3d_video_t*)curD3D;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
if (!d3dr)
@ -62,6 +63,7 @@ static void d3d_resize(void *data, unsigned new_width, unsigned new_height)
d3d->video_info.height = d3d->screen_height = new_height;
d3d_restore(d3d);
}
#endif
}
#ifdef HAVE_WINDOW

View File

@ -170,9 +170,6 @@ static void xdk_input_poll(void *data)
{
xdk_input_t *xdk = (xdk_input_t*)data;
if (!xdk)
return;
#if defined(_XBOX1)
unsigned int dwInsertions, dwRemovals;
XGetDeviceChanges(XDEVICE_TYPE_GAMEPAD, reinterpret_cast<PDWORD>(&dwInsertions), reinterpret_cast<PDWORD>(&dwRemovals));
@ -337,7 +334,7 @@ static int16_t xdk_input_state(void *data, const struct retro_keybind **binds,
{
xdk_input_t *xdk = (xdk_input_t*)data;
if (!xdk || port >= MAX_PADS)
if (port >= MAX_PADS)
return 0;
switch (device)
@ -407,11 +404,10 @@ static uint64_t xdk_input_get_capabilities(void *data)
static bool xdk_input_set_rumble(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength)
{
xdk_input_t *xdk = (xdk_input_t*)data;
(void)xdk;
bool val = false;
if (!xdk)
return false;
#if 0
#if defined(_XBOX360)
XINPUT_VIBRATION rumble_state;
@ -474,7 +470,7 @@ static bool xdk_joypad_button(unsigned port_num, uint16_t joykey)
{
xdk_input_t *xdk = (xdk_input_t*)driver.input_data;
if (!xdk || port_num >= MAX_PADS)
if (port_num >= MAX_PADS)
return false;
return xdk->pad_state[port_num] & (1ULL << joykey);
@ -483,7 +479,7 @@ static bool xdk_joypad_button(unsigned port_num, uint16_t joykey)
static int16_t xdk_joypad_axis(unsigned port_num, uint32_t joyaxis)
{
xdk_input_t *xdk = (xdk_input_t*)driver.input_data;
if (!xdk || joyaxis == AXIS_NONE || port_num >= MAX_PADS)
if (joyaxis == AXIS_NONE || port_num >= MAX_PADS)
return 0;
int val = 0;
@ -527,8 +523,6 @@ static void xdk_joypad_poll(void)
static bool xdk_joypad_query_pad(unsigned pad)
{
xdk_input_t *xdk = (xdk_input_t*)driver.input_data;
if (!xdk)
return false;
return pad < MAX_PLAYERS && xdk->pad_state[pad];
}

File diff suppressed because it is too large Load Diff