posixGTK: Added Graphics Settings dialog and 3D core switch ui
This commit is contained in:
parent
b460d76698
commit
08e2244cea
|
@ -56,6 +56,7 @@ OPT(autoframeskip, bool, true, Config, AudoFrameskip)
|
|||
OPT(frameskip, int, 0, Config, Frameskip)
|
||||
OPT(use_jit,bool,false,Config,JIT_Enabled)
|
||||
OPT(jit_max_block_size,int,100,Config,JITBlockSize)
|
||||
OPT(core3D,int,1,Config,Core3D)
|
||||
|
||||
/* Audio */
|
||||
OPT(audio_enabled, bool, true, Audio, Enabled)
|
||||
|
|
|
@ -29,7 +29,7 @@ static void glx_endOpenGL(void) { }
|
|||
static bool glx_init(void) { return true; }
|
||||
static int xerror_handler(Display *dpy, XErrorEvent *ev) { return 0; }
|
||||
|
||||
static GLXContext ctx;
|
||||
static GLXContext ctx = NULL;
|
||||
static GLXPbuffer pbuf;
|
||||
|
||||
typedef GLXContext (*wtf)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
||||
|
@ -45,6 +45,8 @@ int deinit_glx_3Demu(void)
|
|||
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
ctx = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -155,4 +157,9 @@ int init_glx_3Demu(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool is_glx_initialized(void)
|
||||
{
|
||||
return ctx != NULL;
|
||||
}
|
||||
|
||||
#endif // HAVE_GLX
|
||||
|
|
|
@ -21,4 +21,5 @@
|
|||
#ifdef HAVE_GL_GLX
|
||||
int init_glx_3Demu(void);
|
||||
int deinit_glx_3Demu(void);
|
||||
bool is_glx_initialized(void);
|
||||
#endif
|
||||
|
|
|
@ -163,6 +163,8 @@ static void EmulationSettingsDialog();
|
|||
static void ToggleJIT();
|
||||
static void JITMaxBlockSizeChanged(GtkAdjustment* adj,void *);
|
||||
#endif
|
||||
static void GraphicsSettingsDialog();
|
||||
|
||||
|
||||
static const char *ui_description =
|
||||
"<ui>"
|
||||
|
@ -320,6 +322,7 @@ static const char *ui_description =
|
|||
#ifdef HAVE_JIT
|
||||
" <menuitem action='emulationsettings'/>"
|
||||
#endif
|
||||
" <menuitem action='graphicssettings'/>"
|
||||
" <menuitem action='enableaudio'/>"
|
||||
#ifdef FAKE_MIC
|
||||
" <menuitem action='micnoise'/>"
|
||||
|
@ -421,6 +424,7 @@ static const GtkActionEntry action_entries[] = {
|
|||
#ifdef HAVE_JIT
|
||||
{ "emulationsettings",NULL,"Em_ulation Settings",NULL,NULL,EmulationSettingsDialog},
|
||||
#endif
|
||||
{ "graphicssettings",NULL,"_Graphics Settings",NULL,NULL, GraphicsSettingsDialog},
|
||||
{ "SPUModeMenu", NULL, "Audio _Synchronization" },
|
||||
{ "SPUInterpolationMenu", NULL, "Audio _Interpolation" },
|
||||
{ "CheatMenu", NULL, "_Cheat" },
|
||||
|
@ -664,6 +668,9 @@ init_configured_features( class configured_features *config )
|
|||
{
|
||||
if(config->render3d == COMMANDLINE_RENDER3D_GL || config->render3d == COMMANDLINE_RENDER3D_OLDGL || config->render3d == COMMANDLINE_RENDER3D_AUTOGL)
|
||||
config->engine_3d = 2;
|
||||
else if (config->render3d == COMMANDLINE_RENDER3D_DEFAULT)
|
||||
// Setting it to -1 so that common_gtk_main() will ignore it and load it from file or reconfigure it.
|
||||
config->engine_3d = -1;
|
||||
else
|
||||
config->engine_3d = 1;
|
||||
|
||||
|
@ -727,6 +734,8 @@ fill_configured_features( class configured_features *config,
|
|||
goto error;
|
||||
}
|
||||
|
||||
// Check if the commandLine argument was actually passed
|
||||
if (config->engine_3d != -1) {
|
||||
if (config->engine_3d != 0 && config->engine_3d != 1
|
||||
#if defined(HAVE_LIBOSMESA) || defined(HAVE_GL_GLX)
|
||||
&& config->engine_3d != 2
|
||||
|
@ -739,7 +748,7 @@ fill_configured_features( class configured_features *config,
|
|||
"\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef GDB_STUB
|
||||
if (config->arm9_gdb_port != 0 && (config->arm9_gdb_port < 1 || config->arm9_gdb_port > 65535)) {
|
||||
g_printerr("ARM9 GDB stub port must be in the range 1 to 65535\n");
|
||||
|
@ -2194,6 +2203,73 @@ static void Edit_Joystick_Controls()
|
|||
|
||||
}
|
||||
|
||||
static void GraphicsSettingsDialog()
|
||||
{
|
||||
GtkWidget *gsDialog;
|
||||
GtkWidget *gsKey, *coreCombo;
|
||||
|
||||
gsDialog = gtk_dialog_new_with_buttons("Graphics Settings",
|
||||
GTK_WINDOW(pWindow),
|
||||
GTK_DIALOG_MODAL,
|
||||
GTK_STOCK_OK,
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_STOCK_CANCEL,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
|
||||
gsKey = gtk_label_new("3D Core\n");
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gsDialog)->vbox), gsKey, TRUE, FALSE, 0);
|
||||
|
||||
coreCombo = gtk_combo_box_text_new();
|
||||
|
||||
gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(coreCombo) , 0, "Null");
|
||||
gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(coreCombo) , 1, "Software Raserizer");
|
||||
#if defined(HAVE_LIBOSMESA) || defined(HAVE_GL_GLX)
|
||||
gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(coreCombo) , 2, "OpenGL");
|
||||
#endif
|
||||
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(coreCombo), cur3DCore);
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(gsDialog)->vbox), coreCombo, TRUE, FALSE, 0);
|
||||
|
||||
|
||||
|
||||
gtk_widget_show_all(GTK_DIALOG(gsDialog)->vbox);
|
||||
|
||||
switch (gtk_dialog_run(GTK_DIALOG(gsDialog))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
// Start: OK Response block
|
||||
{
|
||||
int sel3DCore = gtk_combo_box_get_active(GTK_COMBO_BOX(coreCombo));
|
||||
|
||||
// Change only if needed
|
||||
if (sel3DCore != cur3DCore) {
|
||||
#if defined(HAVE_LIBOSMESA)
|
||||
if (sel3DCore == 2 && !is_osmesa_initialized()) {
|
||||
init_osmesa_3Demu();
|
||||
}
|
||||
#elif defined(HAVE_GL_GLX)
|
||||
if (sel3DCore == 2 && !is_glx_initialized()) {
|
||||
init_glx_3Demu();
|
||||
}
|
||||
#endif
|
||||
if (NDS_3D_ChangeCore(sel3DCore)) {
|
||||
config.core3D = sel3DCore;
|
||||
} else {
|
||||
g_printerr("Failed to change the 3D Core!");
|
||||
}
|
||||
}
|
||||
}
|
||||
// End: OK Response Block
|
||||
break;
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
case GTK_RESPONSE_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_widget_destroy(gsDialog);
|
||||
|
||||
}
|
||||
|
||||
static void ToggleLayerVisibility(GtkToggleAction* action, gpointer data)
|
||||
{
|
||||
guint Layer = GPOINTER_TO_UINT(data);
|
||||
|
@ -3238,10 +3314,24 @@ common_gtk_main( class configured_features *my_config)
|
|||
OGLCreateRenderer_3_2_Func = OGLCreateRenderer_3_2;
|
||||
|
||||
//Set the 3D emulation to use
|
||||
unsigned core = my_config->engine_3d;
|
||||
int core = my_config->engine_3d;
|
||||
// setup the gdk 3D emulation;
|
||||
|
||||
// Check if commandLine argument was passed or not
|
||||
if (core == -1) {
|
||||
// If it was not passed, then get the Renderer config from the file
|
||||
core = config.core3D;
|
||||
|
||||
// Check if it is valid
|
||||
if (!(core >= 0 && core <= 2)) {
|
||||
// If it is invalid, reset it to softwareRasterizer
|
||||
core = 1;
|
||||
}
|
||||
//Set this too for clarity
|
||||
my_config->engine_3d = core;
|
||||
}
|
||||
#if defined(HAVE_LIBOSMESA) || defined(HAVE_GL_GLX)
|
||||
if(my_config->engine_3d == 2)
|
||||
if(core == 2)
|
||||
{
|
||||
#if defined(HAVE_LIBOSMESA)
|
||||
core = init_osmesa_3Demu()
|
||||
|
@ -3252,7 +3342,7 @@ common_gtk_main( class configured_features *my_config)
|
|||
}
|
||||
#endif
|
||||
NDS_3D_ChangeCore(core);
|
||||
if(my_config->engine_3d != 0 && gpu3D == &gpu3DNull) {
|
||||
if(core != 0 && gpu3D == &gpu3DNull) {
|
||||
g_printerr("Failed to initialise openGL 3D emulation; "
|
||||
"removing 3D support\n");
|
||||
}
|
||||
|
|
|
@ -65,4 +65,9 @@ int init_osmesa_3Demu(void)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_osmesa_initialized(void)
|
||||
{
|
||||
return ctx != NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -21,4 +21,5 @@
|
|||
#ifdef HAVE_LIBOSMESA
|
||||
int init_osmesa_3Demu(void);
|
||||
void deinit_osmesa_3Demu(void);
|
||||
bool is_osmesa_initialized(void);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue