Code cleanup by riccardom (patch 2155179)
Fixed the compilation for gtk-glade port.
This commit is contained in:
parent
dc4ffd3119
commit
efe749182a
|
@ -63,7 +63,7 @@ void desmume_free()
|
|||
int desmume_open(const char *filename)
|
||||
{
|
||||
int i;
|
||||
noticed_3D=attempted_3D_op=FALSE;
|
||||
noticed_3D=FALSE;
|
||||
clear_savestates();
|
||||
i = NDS_LoadROM(filename, savetype, savesize, NULL);
|
||||
return i;
|
||||
|
@ -91,7 +91,7 @@ void desmume_resume()
|
|||
|
||||
void desmume_reset()
|
||||
{
|
||||
noticed_3D=attempted_3D_op=FALSE;
|
||||
noticed_3D=FALSE;
|
||||
NDS_Reset();
|
||||
desmume_resume();
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ static void Draw()
|
|||
gboolean EmuLoop(gpointer data)
|
||||
{
|
||||
int i;
|
||||
if (!noticed_3D && attempted_3D_op) {
|
||||
if (!noticed_3D) {
|
||||
GtkWidget * dlg = glade_xml_get_widget(xml, "w3Dop");
|
||||
gtk_widget_show(dlg);
|
||||
noticed_3D=TRUE;
|
||||
|
|
|
@ -94,7 +94,6 @@ typedef union _callback_arg{
|
|||
#include "../ctrlssdl.h"
|
||||
#include "../types.h"
|
||||
#include "../saves.h"
|
||||
#include "../gl_vertex.h"
|
||||
#include "../render3D.h"
|
||||
#include "desmume.h"
|
||||
#include "gdk_gl.h"
|
||||
|
|
|
@ -119,7 +119,8 @@ struct configured_features {
|
|||
};
|
||||
|
||||
static void
|
||||
init_configured_features( struct configured_features *config) {
|
||||
init_configured_features( struct configured_features *config)
|
||||
{
|
||||
config->arm9_gdb_port = 0;
|
||||
config->arm7_gdb_port = 0;
|
||||
|
||||
|
@ -142,7 +143,8 @@ init_configured_features( struct configured_features *config) {
|
|||
|
||||
static int
|
||||
fill_configured_features( struct configured_features *config,
|
||||
int argc, char ** argv) {
|
||||
int argc, char ** argv)
|
||||
{
|
||||
int good_args = 1;
|
||||
int print_usage = 0;
|
||||
int i;
|
||||
|
@ -180,75 +182,60 @@ fill_configured_features( struct configured_features *config,
|
|||
printf( "\n");
|
||||
printf( " --help Display this message\n");
|
||||
good_args = 0;
|
||||
}
|
||||
else if ( strcmp( argv[i], "--disable-sound") == 0) {
|
||||
} else if ( strcmp( argv[i], "--disable-sound") == 0) {
|
||||
config->disable_sound = 1;
|
||||
}
|
||||
#ifdef GTKGLEXT_AVAILABLE
|
||||
else if ( strcmp( argv[i], "--opengl-2d") == 0) {
|
||||
} else if ( strcmp( argv[i], "--opengl-2d") == 0) {
|
||||
config->screen.opengl = 1;
|
||||
}
|
||||
else if ( strcmp( argv[i], "--soft-convert") == 0) {
|
||||
} else if ( strcmp( argv[i], "--soft-convert") == 0) {
|
||||
config->screen.soft_colour = 1;
|
||||
}
|
||||
else if ( strcmp( argv[i], "--disable-3d") == 0) {
|
||||
} else if ( strcmp( argv[i], "--disable-3d") == 0) {
|
||||
config->disable_3d = 1;
|
||||
}
|
||||
#endif
|
||||
else if ( strcmp( argv[i], "--disable-limiter") == 0) {
|
||||
} else if ( strcmp( argv[i], "--disable-limiter") == 0) {
|
||||
config->disable_limiter = 1;
|
||||
}
|
||||
else if ( strncmp( argv[i], "--fwlang=", 9) == 0) {
|
||||
} else if ( strncmp( argv[i], "--fwlang=", 9) == 0) {
|
||||
char *end_char;
|
||||
int lang = strtoul( &argv[i][9], &end_char, 10);
|
||||
|
||||
if ( lang >= 0 && lang <= 5) {
|
||||
config->firmware_language = lang;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf( stderr, "Firmware language must be set to a value from 0 to 5.\n");
|
||||
good_args = 0;
|
||||
}
|
||||
}
|
||||
else if ( strncmp( argv[i], "--arm9gdb=", 10) == 0) {
|
||||
} else if ( strncmp( argv[i], "--arm9gdb=", 10) == 0) {
|
||||
char *end_char;
|
||||
unsigned long port_num = strtoul( &argv[i][10], &end_char, 10);
|
||||
|
||||
if ( port_num > 0 && port_num < 65536) {
|
||||
config->arm9_gdb_port = port_num;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf( stderr, "ARM9 GDB stub port must be in the range 1 to 65535\n");
|
||||
good_args = 0;
|
||||
}
|
||||
}
|
||||
else if ( strncmp( argv[i], "--arm7gdb=", 10) == 0) {
|
||||
} else if ( strncmp( argv[i], "--arm7gdb=", 10) == 0) {
|
||||
char *end_char;
|
||||
unsigned long port_num = strtoul( &argv[i][10], &end_char, 10);
|
||||
|
||||
if ( port_num > 0 && port_num < 65536) {
|
||||
config->arm7_gdb_port = port_num;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf( stderr, "ARM7 GDB stub port must be in the range 1 to 65535\n");
|
||||
good_args = 0;
|
||||
}
|
||||
}
|
||||
else if ( strncmp( argv[i], "--cflash=", 9) == 0) {
|
||||
} else if ( strncmp( argv[i], "--cflash=", 9) == 0) {
|
||||
if ( config->cflash_disk_image_file == NULL) {
|
||||
config->cflash_disk_image_file = &argv[i][9];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf( stderr, "CFlash disk image file (\"%s\") already set\n",
|
||||
config->cflash_disk_image_file);
|
||||
good_args = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ( config->nds_file == NULL) {
|
||||
config->nds_file = argv[i];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf( stderr, "NDS file (\"%s\") already set\n", config->nds_file);
|
||||
good_args = 0;
|
||||
}
|
||||
|
@ -275,7 +262,8 @@ fill_configured_features( struct configured_features *config,
|
|||
*/
|
||||
void *
|
||||
createThread_gdb( void (*thread_function)( void *data),
|
||||
void *thread_data) {
|
||||
void *thread_data)
|
||||
{
|
||||
GThread *new_thread = g_thread_create( (GThreadFunc)thread_function,
|
||||
thread_data,
|
||||
TRUE,
|
||||
|
@ -290,8 +278,6 @@ joinThread_gdb( void *thread_handle) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
u16 Keypad_Temp[NB_KEYS];
|
||||
|
||||
int Write_ConfigFile()
|
||||
|
@ -302,14 +288,12 @@ int Write_ConfigFile()
|
|||
|
||||
keyfile = g_key_file_new();
|
||||
|
||||
for(i = 0; i < NB_KEYS; i++)
|
||||
{
|
||||
for(i = 0; i < NB_KEYS; i++) {
|
||||
g_key_file_set_integer(keyfile, "KEYS", key_names[i], keyboard_cfg[i]);
|
||||
g_key_file_set_integer(keyfile, "JOYKEYS", key_names[i], joypad_cfg[i]);
|
||||
}
|
||||
|
||||
// if(FirmwareFile[0])
|
||||
// {
|
||||
// if(FirmwareFile[0]) {
|
||||
// ini_add_section(ini, "FIRMWARE");
|
||||
// ini_add_value(ini, "FIRMWARE", "FILE", FirmwareFile);
|
||||
// }
|
||||
|
@ -336,8 +320,7 @@ int Read_ConfigFile()
|
|||
const char *c;
|
||||
|
||||
/* Load keyboard keys */
|
||||
for(i = 0; i < NB_KEYS; i++)
|
||||
{
|
||||
for(i = 0; i < NB_KEYS; i++) {
|
||||
tmp = g_key_file_get_integer(keyfile, "KEYS", key_names[i], &error);
|
||||
if (error != NULL) {
|
||||
g_error_free(error);
|
||||
|
@ -348,8 +331,7 @@ int Read_ConfigFile()
|
|||
}
|
||||
|
||||
/* Load joystick keys */
|
||||
for(i = 0; i < NB_KEYS; i++)
|
||||
{
|
||||
for(i = 0; i < NB_KEYS; i++) {
|
||||
tmp = g_key_file_get_integer(keyfile, "JOYKEYS", key_names[i], &error);
|
||||
if (error != NULL) {
|
||||
g_error_free(error);
|
||||
|
@ -424,8 +406,7 @@ static void Launch()
|
|||
{
|
||||
desmume_resume();
|
||||
|
||||
if(!regMainLoop)
|
||||
{
|
||||
if(!regMainLoop) {
|
||||
g_idle_add_full(EMULOOP_PRIO, &EmuLoop, pWindow, NULL); regMainLoop = TRUE;
|
||||
}
|
||||
|
||||
|
@ -490,13 +471,11 @@ static void *Open_Select(GtkWidget* widget, gpointer data)
|
|||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_any);
|
||||
|
||||
/* Affichage fenetre */
|
||||
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection)))
|
||||
{
|
||||
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
/* Recuperation du chemin */
|
||||
sChemin = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||
if(Open((const char*)sChemin, bad_glob_cflash_disk_image_file) < 0)
|
||||
{
|
||||
if(Open((const char*)sChemin, bad_glob_cflash_disk_image_file) < 0) {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection),
|
||||
GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_ERROR,
|
||||
|
@ -628,7 +607,8 @@ gtk_init_sub_gl_area(GtkWidget *widget,
|
|||
|
||||
#ifdef GTKGLEXT_AVAILABLE
|
||||
static int
|
||||
top_screen_expose_fn( GtkWidget *widget, GdkEventExpose *event, gpointer data) {
|
||||
top_screen_expose_fn( GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
|
||||
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);
|
||||
int software_convert = *((int *)data);
|
||||
|
@ -662,8 +642,7 @@ top_screen_expose_fn( GtkWidget *widget, GdkEventExpose *event, gpointer data) {
|
|||
GL_RGB,
|
||||
GL_UNSIGNED_BYTE,
|
||||
converted);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 256, 384,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
|
@ -759,7 +738,8 @@ bottom_screen_expose_fn(GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
|||
|
||||
static gboolean
|
||||
common_configure_fn( GtkWidget *widget,
|
||||
GdkEventConfigure *event ) {
|
||||
GdkEventConfigure *event )
|
||||
{
|
||||
if ( gtk_widget_is_gl_capable( widget) == FALSE)
|
||||
return TRUE;
|
||||
|
||||
|
@ -819,8 +799,7 @@ common_configure_fn( GtkWidget *widget,
|
|||
|
||||
top = 0.0;
|
||||
bottom = 192.0 * ((double)event->height / other_dimen);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
top = 0.0;
|
||||
bottom = 192.0;
|
||||
|
||||
|
@ -910,13 +889,11 @@ static gboolean Stylus_Move(GtkWidget *w, GdkEventMotion *e, gpointer data)
|
|||
const int *opengl = (const int *)data;
|
||||
|
||||
|
||||
if(click)
|
||||
{
|
||||
if(click) {
|
||||
int scaled_x, scaled_y;
|
||||
if(e->is_hint)
|
||||
gdk_window_get_pointer(w->window, &x, &y, &state);
|
||||
else
|
||||
{
|
||||
else {
|
||||
x= (gint)e->x;
|
||||
y= (gint)e->y;
|
||||
state=(GdkModifierType)e->state;
|
||||
|
@ -930,8 +907,7 @@ static gboolean Stylus_Move(GtkWidget *w, GdkEventMotion *e, gpointer data)
|
|||
if ( !(*opengl)) {
|
||||
scaled_y -= 192;
|
||||
}
|
||||
if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK))
|
||||
{
|
||||
if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK)) {
|
||||
EmuX = scaled_x;
|
||||
EmuY = scaled_y;
|
||||
if(EmuX<0) EmuX = 0; else if(EmuX>255) EmuX = 255;
|
||||
|
@ -949,10 +925,8 @@ static gboolean Stylus_Press(GtkWidget *w, GdkEventButton *e, gpointer data)
|
|||
s32 EmuX, EmuY;
|
||||
const int *opengl = (const int *)data;
|
||||
|
||||
if(desmume_running())
|
||||
{
|
||||
if(e->button == 1)
|
||||
{
|
||||
if(desmume_running()) {
|
||||
if(e->button == 1) {
|
||||
int scaled_x, scaled_y;
|
||||
click = TRUE;
|
||||
|
||||
|
@ -964,8 +938,7 @@ static gboolean Stylus_Press(GtkWidget *w, GdkEventButton *e, gpointer data)
|
|||
if ( !(*opengl)) {
|
||||
scaled_y -= 192;
|
||||
}
|
||||
if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK))
|
||||
{
|
||||
if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK)) {
|
||||
EmuX = scaled_x;
|
||||
EmuY = scaled_y;
|
||||
if(EmuX<0) EmuX = 0; else if(EmuX>255) EmuX = 255;
|
||||
|
@ -1044,8 +1017,7 @@ void Modify_Key(GtkWidget* widget, gpointer data)
|
|||
|
||||
gtk_widget_show_all(GTK_DIALOG(mkDialog)->vbox);
|
||||
|
||||
switch(gtk_dialog_run(GTK_DIALOG(mkDialog)))
|
||||
{
|
||||
switch(gtk_dialog_run(GTK_DIALOG(mkDialog))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
|
||||
Keypad_Temp[Key] = Modify_Key_Chosen;
|
||||
|
@ -1079,9 +1051,7 @@ void Edit_Controls(GtkWidget* widget, gpointer data)
|
|||
GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
|
||||
|
||||
for(i = 0; i < NB_KEYS; i++)
|
||||
{
|
||||
for(i = 0; i < NB_KEYS; i++) {
|
||||
sprintf(Key_Label, "%s (%s)", key_names[i], gdk_keyval_name(Keypad_Temp[i]));
|
||||
ecKey = gtk_button_new_with_label(Key_Label);
|
||||
g_signal_connect(G_OBJECT(ecKey), "clicked", G_CALLBACK(Modify_Key), GINT_TO_POINTER(i));
|
||||
|
@ -1090,8 +1060,7 @@ void Edit_Controls(GtkWidget* widget, gpointer data)
|
|||
|
||||
gtk_widget_show_all(GTK_DIALOG(ecDialog)->vbox);
|
||||
|
||||
switch (gtk_dialog_run(GTK_DIALOG(ecDialog)))
|
||||
{
|
||||
switch (gtk_dialog_run(GTK_DIALOG(ecDialog))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
memcpy(&keyboard_cfg, &Keypad_Temp, sizeof(keyboard_cfg));
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
|
@ -1124,38 +1093,30 @@ void Modify_Layer(GtkWidget* widget, gpointer data)
|
|||
int i;
|
||||
gchar *Layer = (gchar*)data;
|
||||
|
||||
if(!desmume_running())
|
||||
{
|
||||
if(!desmume_running()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(memcmp(Layer, "Sub", 3) == 0)
|
||||
{
|
||||
if(memcmp(Layer, "Sub BG", 6) == 0)
|
||||
{
|
||||
if(memcmp(Layer, "Sub", 3) == 0) {
|
||||
if(memcmp(Layer, "Sub BG", 6) == 0) {
|
||||
i = atoi(Layer + strlen("Sub BG "));
|
||||
if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)) == TRUE) {
|
||||
if(!SubScreen.gpu->dispBG[i]) GPU_addBack(SubScreen.gpu, i);
|
||||
} else {
|
||||
if(SubScreen.gpu->dispBG[i]) GPU_remove(SubScreen.gpu, i); }
|
||||
if(SubScreen.gpu->dispBG[i]) GPU_remove(SubScreen.gpu, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* TODO: Disable sprites */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(memcmp(Layer, "Main BG", 7) == 0)
|
||||
{
|
||||
} else {
|
||||
if(memcmp(Layer, "Main BG", 7) == 0) {
|
||||
i = atoi(Layer + strlen("Main BG "));
|
||||
if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)) == TRUE) {
|
||||
if(!MainScreen.gpu->dispBG[i]) GPU_addBack(MainScreen.gpu, i);
|
||||
} else {
|
||||
if(MainScreen.gpu->dispBG[i]) GPU_remove(MainScreen.gpu, i); }
|
||||
if(MainScreen.gpu->dispBG[i]) GPU_remove(MainScreen.gpu, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* TODO: Disable sprites */
|
||||
}
|
||||
}
|
||||
|
@ -1201,7 +1162,8 @@ typedef struct
|
|||
}BmpFileHeader;
|
||||
|
||||
|
||||
int WriteBMP(const char *filename,u16 *bmp){
|
||||
int WriteBMP(const char *filename,u16 *bmp)
|
||||
{
|
||||
BmpFileHeader fileheader;
|
||||
BmpImageHeader imageheader;
|
||||
fileheader.size = 14;
|
||||
|
@ -1338,19 +1300,15 @@ int SelectFirmwareFile_Load(GtkWidget *w, gpointer data)
|
|||
if(FirmwareFile[0]) gtk_file_chooser_select_uri(GTK_FILE_CHOOSER(pFileSelection), FirmwareFile);
|
||||
|
||||
/* Affichage fenetre */
|
||||
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection)))
|
||||
{
|
||||
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
/* Recuperation du chemin */
|
||||
sChemin = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||
if(LoadFirmware((const char*)sChemin) < 0)
|
||||
{
|
||||
if(LoadFirmware((const char*)sChemin) < 0) {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Unable to load :\n%s", sChemin);
|
||||
gtk_dialog_run(GTK_DIALOG(pDialog));
|
||||
gtk_widget_destroy(pDialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Selected firmware :\n%s", sChemin);
|
||||
gtk_dialog_run(GTK_DIALOG(pDialog));
|
||||
gtk_widget_destroy(pDialog);
|
||||
|
@ -1408,19 +1366,15 @@ int SelectFirmwareFile_Load(GtkWidget *w, gpointer data)
|
|||
if(FirmwareFile[0]) gtk_file_chooser_select_uri(GTK_FILE_CHOOSER(pFileSelection), FirmwareFile);
|
||||
|
||||
/* Affichage fenetre */
|
||||
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection)))
|
||||
{
|
||||
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
/* Recuperation du chemin */
|
||||
sChemin = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||
if(LoadFirmware((const char*)sChemin) < 0)
|
||||
{
|
||||
if(LoadFirmware((const char*)sChemin) < 0) {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Unable to load :\n%s", sChemin);
|
||||
gtk_dialog_run(GTK_DIALOG(pDialog));
|
||||
gtk_widget_destroy(pDialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Selected firmware :\n%s", sChemin);
|
||||
gtk_dialog_run(GTK_DIALOG(pDialog));
|
||||
gtk_widget_destroy(pDialog);
|
||||
|
@ -1477,8 +1431,7 @@ void dTool_CloseCallback(int tool)
|
|||
static inline void _updateDTools()
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < dTools_list_size; i++)
|
||||
{
|
||||
for(i = 0; i < dTools_list_size; i++) {
|
||||
if(dTools_running[i]) { dTools_list[i]->update(); }
|
||||
}
|
||||
}
|
||||
|
@ -1489,13 +1442,11 @@ gboolean EmuLoop(gpointer data)
|
|||
{
|
||||
int i;
|
||||
|
||||
if(desmume_running()) /* Si on est en train d'executer le programme ... */
|
||||
{
|
||||
if(desmume_running()) { /* Si on est en train d'executer le programme ... */
|
||||
static int limiter_frame_counter = 0;
|
||||
fps_FrameCount += Frameskip + 1;
|
||||
if(!fps_SecStart) fps_SecStart = SDL_GetTicks();
|
||||
if(SDL_GetTicks() - fps_SecStart >= 1000)
|
||||
{
|
||||
if(SDL_GetTicks() - fps_SecStart >= 1000) {
|
||||
fps_SecStart = SDL_GetTicks();
|
||||
fps = fps_FrameCount;
|
||||
fps_FrameCount = 0;
|
||||
|
@ -1541,7 +1492,8 @@ gboolean EmuLoop(gpointer data)
|
|||
*
|
||||
* @return The interval to the next call (required by SDL)
|
||||
*/
|
||||
static Uint32 fps_limiter_fn(Uint32 interval, void *param) {
|
||||
static Uint32 fps_limiter_fn(Uint32 interval, void *param)
|
||||
{
|
||||
SDL_sem *sdl_semaphore = (SDL_sem *)param;
|
||||
|
||||
/* signal the semaphore if it is getting low */
|
||||
|
@ -1559,7 +1511,8 @@ static void dui_set_accel_group(gpointer action, gpointer group) {
|
|||
/////////////////////////////// MAIN ///////////////////////////////
|
||||
|
||||
static int
|
||||
common_gtk_main( struct configured_features *my_config) {
|
||||
common_gtk_main( struct configured_features *my_config)
|
||||
{
|
||||
int i;
|
||||
SDL_TimerID limiter_timer;
|
||||
|
||||
|
@ -1625,8 +1578,7 @@ common_gtk_main( struct configured_features *my_config) {
|
|||
glconfig = gdk_gl_config_new_by_mode ((GdkGLConfigMode)(GDK_GL_MODE_RGB |
|
||||
GDK_GL_MODE_DEPTH |
|
||||
GDK_GL_MODE_DOUBLE));
|
||||
if (glconfig == NULL)
|
||||
{
|
||||
if (glconfig == NULL) {
|
||||
g_print ("*** Cannot find the double-buffered visual.\n");
|
||||
g_print ("*** Trying single-buffered visual.\n");
|
||||
|
||||
|
@ -1641,8 +1593,7 @@ common_gtk_main( struct configured_features *my_config) {
|
|||
#endif
|
||||
/* FIXME: SDL_INIT_VIDEO is needed for joystick support to work!?
|
||||
Perhaps it needs a "window" to catch events...? */
|
||||
if(SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO) == -1)
|
||||
{
|
||||
if(SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO) == -1) {
|
||||
fprintf(stderr, "Error trying to initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
return 1;
|
||||
|
@ -1682,8 +1633,7 @@ common_gtk_main( struct configured_features *my_config) {
|
|||
|
||||
if ( my_config->screen.opengl) {
|
||||
gtk_window_set_resizable(GTK_WINDOW (pWindow), TRUE);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gtk_window_set_resizable(GTK_WINDOW (pWindow), FALSE);
|
||||
}
|
||||
|
||||
|
@ -1832,8 +1782,7 @@ common_gtk_main( struct configured_features *my_config) {
|
|||
|
||||
pMenu = gtk_menu_new();
|
||||
|
||||
for(i = 0; i < dTools_list_size; i++)
|
||||
{
|
||||
for(i = 0; i < dTools_list_size; i++) {
|
||||
pMenuItem = gtk_menu_item_new_with_label(dTools_list[i]->name);
|
||||
g_signal_connect(G_OBJECT(pMenuItem), "activate", G_CALLBACK(Start_dTool), GINT_TO_POINTER(i));
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(pMenu), pMenuItem);
|
||||
|
@ -1938,10 +1887,10 @@ common_gtk_main( struct configured_features *my_config) {
|
|||
|
||||
/* each frame expose the top screen */
|
||||
nds_screen_widget = top_screen_widget;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
} else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
pDrawingArea= gtk_drawing_area_new();
|
||||
|
||||
gtk_drawing_area_size(GTK_DRAWING_AREA(pDrawingArea), 256, 384);
|
||||
|
@ -1959,7 +1908,6 @@ common_gtk_main( struct configured_features *my_config) {
|
|||
g_signal_connect(G_OBJECT(pDrawingArea), "motion_notify_event",
|
||||
G_CALLBACK(Stylus_Move), &my_config->screen.opengl);
|
||||
|
||||
|
||||
g_signal_connect( G_OBJECT(pDrawingArea), "realize",
|
||||
G_CALLBACK(Draw), NULL ) ;
|
||||
g_signal_connect( G_OBJECT(pDrawingArea), "expose_event",
|
||||
|
@ -2032,14 +1980,10 @@ common_gtk_main( struct configured_features *my_config) {
|
|||
|
||||
|
||||
/* Vérifie la ligne de commandes */
|
||||
if( my_config->nds_file != NULL)
|
||||
{
|
||||
if(Open( my_config->nds_file, bad_glob_cflash_disk_image_file) >= 0)
|
||||
{
|
||||
if( my_config->nds_file != NULL) {
|
||||
if(Open( my_config->nds_file, bad_glob_cflash_disk_image_file) >= 0) {
|
||||
Launch();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pWindow),
|
||||
GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_INFO,
|
||||
|
@ -2087,7 +2031,8 @@ common_gtk_main( struct configured_features *my_config) {
|
|||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[]) {
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
struct configured_features my_config;
|
||||
|
||||
init_configured_features( &my_config);
|
||||
|
|
Loading…
Reference in New Issue