Add some hooks to video init/deinit for PS3.

This commit is contained in:
Themaister 2012-01-11 23:44:29 +01:00
parent 67fb35b645
commit a39c37e1ee
4 changed files with 39 additions and 3 deletions

View File

@ -223,6 +223,7 @@ int main(int argc, char *argv[])
get_path_settings(return_to_MM);
ps3_graphics_init();
ps3_input_init();
menu_init();
@ -244,4 +245,5 @@ int main(int argc, char *argv[])
return ssnes_main(sizeof(argv_) / sizeof(argv_[0]) - 1, argv_);
ps3_input_deinit();
ps3_graphics_deinit();
}

View File

@ -98,7 +98,6 @@ static int16_t ps3_input_state(void *data, const struct snes_keybind **binds,
static void ps3_free_input(void *data)
{
(void)data;
cell_pad_input_deinit();
}
static void* ps3_input_initialize(void)

View File

@ -91,6 +91,7 @@ static bool load_fbo_proc(void) { return true; }
static bool g_quitting;
unsigned g_frame_count;
void *g_gl;
typedef struct gl
{
@ -804,6 +805,9 @@ static void psgl_deinit(gl_t *gl)
static void gl_free(void *data)
{
if (g_gl)
return;
gl_t *gl = data;
gl_shader_deinit();
@ -903,6 +907,9 @@ static void psgl_init_dbgfont(gl_t *gl)
static void *gl_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
if (g_gl)
return g_gl;
gl_t *gl = calloc(1, sizeof(gl_t));
if (!gl)
return NULL;
@ -1032,8 +1039,10 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
return NULL;
}
*input = NULL;
*input_data = NULL;
if (input)
*input = NULL;
if (input_data)
*input_data = NULL;
return gl;
}
@ -1061,3 +1070,26 @@ const video_driver_t video_gl = {
.ident = "gl"
};
// PS3 needs a working graphics stack before SSNES even starts.
// To deal with this main.c,
// the top level module owns the instance, and is created beforehand.
// When SSNES gets around to init it, it is already allocated.
// When SSNES wants to free it, it is ignored.
void ps3_video_init(void)
{
video_info_t video_info = {0};
// Might have to supply correct values here.
video_info.vsync = true;
video_info.force_aspect = true;
video_info.smooth = true;
video_info.input_scale = 2;
g_gl = gl_init(&video, NULL, NULL);
}
void ps3_video_deinit(void)
{
void *data = g_gl;
g_gl = NULL;
gl_free(data);
}

View File

@ -24,4 +24,7 @@
#include <GLES/glext.h>
#include <cell/dbgfont.h>
void ps3_video_init(void);
void ps3_video_deinit(void);
#endif