diff --git a/desmume/src/gtk-glade/callbacks.cpp b/desmume/src/gtk-glade/callbacks.cpp index ed655cd55..03b2d96e5 100755 --- a/desmume/src/gtk-glade/callbacks.cpp +++ b/desmume/src/gtk-glade/callbacks.cpp @@ -32,7 +32,7 @@ gboolean ScreenInvert=FALSE; /* ******** Savestate menu items handling ******** */ -void set_menuitem_label(GtkWidget * w, char * text ) +static void set_menuitem_label(GtkWidget * w, char * text ) { GtkLabel * child; @@ -43,7 +43,7 @@ void set_menuitem_label(GtkWidget * w, char * text ) } } -void clear_savestate_menu(const char * cb_name, u8 num) +static void clear_savestate_menu(const char * cb_name, u8 num) { GtkWidget * w; char cb[40]; @@ -55,7 +55,7 @@ void clear_savestate_menu(const char * cb_name, u8 num) set_menuitem_label( w, text ); } -void update_savestate_menu(const char * cb_name, u8 num) +static void update_savestate_menu(const char * cb_name, u8 num) { GtkWidget * w; char cb[40]; @@ -65,11 +65,9 @@ void update_savestate_menu(const char * cb_name, u8 num) set_menuitem_label( w, savestates[num-1].date ); } -void update_savestates_menu() +static void update_savestates_menu() { - char cb[15]; u8 i; - GtkWidget * w; for( i = 1; i <= NB_STATES; i++ ) { @@ -86,7 +84,7 @@ void update_savestates_menu() } } -void update_savestate(u8 num) +static void update_savestate(u8 num) { desmume_pause(); savestate_slot(num); @@ -112,7 +110,7 @@ void enable_rom_features() { SET_SENSITIVE("wgt_Reset", TRUE); } -void MAINWINDOW_RESIZE() { +static void MAINWINDOW_RESIZE() { GtkWidget * spacer1 = glade_xml_get_widget(xml, "misc_sep3"); GtkWidget * spacer2 = glade_xml_get_widget(xml, "misc_sep4"); int dim1,dim2; @@ -155,7 +153,7 @@ void inline ADD_FILTER(GtkWidget * filech, const char * pattern, const char * na gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filech), pFilter); } -void file_open() { +static void file_open() { desmume_pause(); GtkWidget *pFileSelection; @@ -255,7 +253,7 @@ void on_fsXX_activate (GtkMenuItem *menuitem,gpointer user_data) { /* SUBMENU SIZE ***** ***** ***** ***** */ -void gtk_table_reattach(GtkTable * table, GtkWidget * w, +static void gtk_table_reattach(GtkTable * table, GtkWidget * w, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, GtkAttachOptions xoptions, GtkAttachOptions yoptions, guint xpadding, guint ypadding) { @@ -282,7 +280,7 @@ void gtk_table_reattach(GtkTable * table, GtkWidget * w, } } -void rightscreen(BOOL apply) { +static void rightscreen(BOOL apply) { GtkWidget *chk = glade_xml_get_widget(xml, "wvb_2_Sub"); GtkTable *table = (GtkTable *)glade_xml_get_widget(xml, "table_layout"); @@ -471,7 +469,7 @@ void on_wgt_Exec_toggled (GtkToggleToolButton *toggletoolbutton, gpointer user /* LAYERS ***** ***** ***** ***** */ -void change_bgx_layer(int layer, gboolean state, NDS_Screen scr) { +static void change_bgx_layer(int layer, gboolean state, NDS_Screen scr) { //if(!desmume_running()) return; if(state==TRUE) { GPU_addBack(scr.gpu, layer); diff --git a/desmume/src/gtk-glade/callbacks_IO.cpp b/desmume/src/gtk-glade/callbacks_IO.cpp index ffa23b2a2..2008ebd94 100755 --- a/desmume/src/gtk-glade/callbacks_IO.cpp +++ b/desmume/src/gtk-glade/callbacks_IO.cpp @@ -204,9 +204,11 @@ gboolean on_wDrawScreen_scroll_event (GtkWidget *widget, GdkEvent *event, gpoin // separate zoom factors not supported yet scr = 0; resize_incremental(scr,(GdkEventScroll*)event); + + return TRUE; } -void set_touch_pos (int x, int y) { +static void set_touch_pos (int x, int y) { s32 EmuX, EmuY; x /= ScreenCoeff_Size[1]; y /= ScreenCoeff_Size[1]; @@ -283,13 +285,13 @@ gboolean on_wDrawScreen_motion_notify_event (GtkWidget *widget, GdkEventMotion u16 Keypad_Temp[NB_KEYS]; guint temp_Key=0; -void init_labels() { +static void init_labels() { int i; char text[50], bname[20]; GtkButton *b; for (i=0; ibutton==1) update_regs(); + return TRUE; } gboolean on_wtools_1_draw_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { update_regs(); diff --git a/desmume/src/gtk-glade/dTools/callbacks_2_memview.cpp b/desmume/src/gtk-glade/dTools/callbacks_2_memview.cpp index faea80361..539758141 100755 --- a/desmume/src/gtk-glade/dTools/callbacks_2_memview.cpp +++ b/desmume/src/gtk-glade/dTools/callbacks_2_memview.cpp @@ -32,7 +32,8 @@ enum SHOW { static BOOL init=FALSE; static enum SHOW packmode=Bit8; -static u32 address=0, tmpaddr=0, bpl=0; int cpu=0; +static u32 address=0, tmpaddr=0; +int cpu=0; static char patt[512]; static u8 mem[0x100]; static dTools_dsp dsp; @@ -88,7 +89,7 @@ static void wtools_2_update() { for (j=0; j<16; j+=4, addr+=4,mem32++) { m32 = *mem32; *mem32 = MMU_read32(cpu, addr); if (m32 != *mem32) { - sprintf(txt, " %08X", *mem32); + sprintf(txt, " %08lX", *mem32); dTools_display_clear_char(&dsp, 12+3*j, i, 12); dTools_display_draw_text(&dsp, 12+3*j, i, txt); } @@ -102,6 +103,8 @@ gboolean on_wtools_2_draw_button_release_event(GtkWidget *widget, GdkEventButton // clear the red marks :) if (event->button==1) refresh(); + + return TRUE; } @@ -197,7 +200,6 @@ static void initialize() { GtkWidget * combo; GtkWidget * wPaint; GtkAdjustment *adj; - int i,j; if (init) return; combo = glade_xml_get_widget(xml_tools, "wtools_2_cpu"); @@ -269,7 +271,7 @@ static void refresh() { break; case Bit32: for (j=0; j<16; j+=4,ptxt+=12, mem32++) - sprintf(ptxt, " %08X ", *mem32); + sprintf(ptxt, " %08lX ", *mem32); break; } sprintf(ptxt, "| "); ptxt +=2; diff --git a/desmume/src/gtk-glade/dTools/callbacks_3_palview.cpp b/desmume/src/gtk-glade/dTools/callbacks_3_palview.cpp index 7e5fdc5df..0b7097474 100755 --- a/desmume/src/gtk-glade/dTools/callbacks_3_palview.cpp +++ b/desmume/src/gtk-glade/dTools/callbacks_3_palview.cpp @@ -111,7 +111,6 @@ static void wtools_3_update() { static void refresh() { int x,y,X,Y; u16 * addr = base_addr[palindex]; - COLOR c; COLOR32 c32; gdkGC = gdk_gc_new(wPaint->window); if (addr) { @@ -154,6 +153,7 @@ gboolean on_wtools_3_PalView_close (GtkWidget *widget, ...) { gboolean on_wtools_3_draw_expose_event (GtkWidget * widget, GdkEventExpose *event, gpointer user_data) { refresh(); + return TRUE; } void on_wtools_3_palette_changed (GtkComboBox *combo, gpointer user_data) { palindex = gtk_combo_box_get_active(combo); diff --git a/desmume/src/gtk-glade/dTools/callbacks_4_tileview.cpp b/desmume/src/gtk-glade/dTools/callbacks_4_tileview.cpp index af718bd0d..8695ac39a 100755 --- a/desmume/src/gtk-glade/dTools/callbacks_4_tileview.cpp +++ b/desmume/src/gtk-glade/dTools/callbacks_4_tileview.cpp @@ -20,6 +20,7 @@ */ #include "callbacks_dtools.h" +#include "../gdk_gl.h" void init_combo_memory(GtkComboBox *combo, u8 ** addresses) { GtkTreeIter iter; @@ -81,13 +82,6 @@ static int gl_context_num=0; #define TILE_NUM_MAX 1024 #define TILE_W_SZ 8 #define TILE_H_SZ 8 -static u16 tiles[TILE_NUM_MAX][TILE_H_SZ*TILE_W_SZ]; - -static COLOR c; -static COLOR32 c32; -static GdkGC * gdkGC; - - static void wtools_4_update() { @@ -101,7 +95,6 @@ static void refresh() { u8 * index16, * index256, * indexBMP; u16 * pal; int tile_n, index; - int i,j; guint Textures; if (!init) return; @@ -159,7 +152,8 @@ static void refresh() { } break; case 1: //256c - if (pal = pal_addr[palindex]) { + pal = pal_addr[palindex]; + if (pal) { pal += palnum*256; for (tile_n=0; tile_n<1024; tile_n++) { for (index=0; index<64; index++) { @@ -174,7 +168,8 @@ static void refresh() { } break; case 2: //16c - if (pal = pal_addr[palindex]) { + pal = pal_addr[palindex]; + if (pal) { pal += palnum*16; for (tile_n=0; tile_n<1024; tile_n++) { for (index=0; index<64; index++) { diff --git a/desmume/src/gtk-glade/gdk_3Demu.cpp b/desmume/src/gtk-glade/gdk_3Demu.cpp index edc1df46b..3f2cb2b59 100644 --- a/desmume/src/gtk-glade/gdk_3Demu.cpp +++ b/desmume/src/gtk-glade/gdk_3Demu.cpp @@ -44,6 +44,7 @@ static GdkGLContext *glcontext = NULL; static GdkGLDrawable *gldrawable; +#if 0 /* not used */ static void print_gl_config_attrib (GdkGLConfig *glconfig, const gchar *attrib_str, @@ -124,6 +125,7 @@ examine_gl_config_attrib (GdkGLConfig *glconfig) g_print ("\n"); } +#endif static bool diff --git a/desmume/src/gtk-glade/gdk_gl.cpp b/desmume/src/gtk-glade/gdk_gl.cpp index c9cbf095e..2e3633146 100755 --- a/desmume/src/gtk-glade/gdk_gl.cpp +++ b/desmume/src/gtk-glade/gdk_gl.cpp @@ -48,8 +48,8 @@ static int gtk_glade_use_software_colour_convert; #undef _DUP2 /* FIXME: Purpose of this code? */ -BOOL _fun_gl_Begin (int screen) { return FALSE; } -void _fun_gl_End (int screen) { } +static BOOL _fun_gl_Begin (int screen) { return FALSE; } +static void _fun_gl_End (int screen) { } fun_gl_Begin Open_GL_beg = _fun_gl_Begin; fun_gl_End Open_GL_end = _fun_gl_End; @@ -97,11 +97,12 @@ void my_gl_DrawBeautifulQuad( void) { glColor3ub(255,255,255); } - -void my_gl_DrawLogo() { +#if 0 /* not used */ +static void my_gl_DrawLogo() { } +#endif void my_gl_Clear(int screen) { @@ -222,7 +223,7 @@ void reshape (GtkWidget * widget, int screen) { /* TEXTURING */ /************************************************/ -void my_gl_Texture2D() { +static void my_gl_Texture2D() { glBindTexture(GL_TEXTURE_2D, Textures[0]); #define MyFILTER GL_LINEAR //#define MyFILTER GL_NEAREST @@ -256,7 +257,7 @@ my_gl_ScreenTex( int software_convert) { } } -void my_gl_ScreenTexApply(int screen) { +static void my_gl_ScreenTexApply(int screen) { float off = (screen)?0.375:0; glBegin(GL_QUADS); // texcoords 0.375 means 192, 1 means 256 diff --git a/desmume/src/gtk-glade/gdk_gl.h b/desmume/src/gtk-glade/gdk_gl.h index 8ee0f03cc..d3605a2e4 100755 --- a/desmume/src/gtk-glade/gdk_gl.h +++ b/desmume/src/gtk-glade/gdk_gl.h @@ -34,11 +34,11 @@ BOOL my_gl_Begin (int screen); void my_gl_End (int screen); void my_gl_Clear(int screen); void my_gl_DrawBeautifulQuad( void); +void my_gl_Identity( void); void init_GL_capabilities( int use_software_convert); void init_GL(GtkWidget * widget, int screen, int share_num); int init_GL_free_s(GtkWidget * widget, int share_num); int init_GL_free(GtkWidget * widget); -void register_gl_fun(fun_gl_Begin beg,fun_gl_End end); void reshape (GtkWidget * widget, int screen); gboolean screen (GtkWidget * widget, int off); diff --git a/desmume/src/gtk-glade/globals.h b/desmume/src/gtk-glade/globals.h index 06b657dd6..d15fb005e 100755 --- a/desmume/src/gtk-glade/globals.h +++ b/desmume/src/gtk-glade/globals.h @@ -96,7 +96,6 @@ typedef union _callback_arg{ #include "../saves.h" #include "../render3D.h" #include "desmume.h" -#include "gdk_gl.h" // autoconnect with strings as user_data diff --git a/desmume/src/gtk-glade/keyval_names.cpp b/desmume/src/gtk-glade/keyval_names.cpp index 61ff537d9..d60118470 100755 --- a/desmume/src/gtk-glade/keyval_names.cpp +++ b/desmume/src/gtk-glade/keyval_names.cpp @@ -22,7 +22,7 @@ #include "keyval_names.h" /* see */ -char * unknown="(unknown)"; +const char * unknown="(unknown)"; const char * KEYVAL_NAMES[0x10000]; const char * KEYNAME(int k) { diff --git a/desmume/src/gtk-glade/keyval_names.h b/desmume/src/gtk-glade/keyval_names.h index db71cf091..d2ec5b1dc 100755 --- a/desmume/src/gtk-glade/keyval_names.h +++ b/desmume/src/gtk-glade/keyval_names.h @@ -21,7 +21,7 @@ #include "globals.h" -extern char * unknown; +extern const char * unknown; extern const char * KEYVAL_NAMES[0x10000]; void KEYVAL(int k, const char * name); diff --git a/desmume/src/gtk-glade/main.cpp b/desmume/src/gtk-glade/main.cpp index 5ceabdbb7..2466d0bcf 100755 --- a/desmume/src/gtk-glade/main.cpp +++ b/desmume/src/gtk-glade/main.cpp @@ -217,7 +217,7 @@ void unregister_Tool(VoidFunPtr fun) { tools_to_update = g_list_remove(tools_to_update, (void *) fun); } -void notify_Tool (VoidFunPtr fun, gpointer func_data) { +static void notify_Tool (VoidFunPtr fun, gpointer func_data) { fun(); } @@ -249,7 +249,7 @@ gchar * get_ui_file (const char *filename) /* ***** ***** CONFIG FILE ***** ***** */ char * CONFIG_FILE; -int Read_ConfigFile() +static int Read_ConfigFile() { int i, tmp; GKeyFile * keyfile = g_key_file_new(); @@ -259,8 +259,6 @@ int Read_ConfigFile() g_key_file_load_from_file(keyfile, CONFIG_FILE, G_KEY_FILE_NONE, 0); - const char *c; - /* Load keypad keys */ for(i = 0; i < NB_KEYS; i++) { @@ -290,7 +288,7 @@ int Read_ConfigFile() return 0; } -int Write_ConfigFile() +static int Write_ConfigFile() { int i; GKeyFile * keyfile; diff --git a/desmume/src/gtk-glade/printscreen.cpp b/desmume/src/gtk-glade/printscreen.cpp index 798256757..0526cb0d1 100755 --- a/desmume/src/gtk-glade/printscreen.cpp +++ b/desmume/src/gtk-glade/printscreen.cpp @@ -85,7 +85,7 @@ int WriteBMP(const char *filename,u16 *bmp){ fwrite( &imageheader.r4, sizeof(imageheader.r4), 1, fichier); fwrite( &imageheader.r5, sizeof(imageheader.r5), 1, fichier); fwrite( &imageheader.r6, sizeof(imageheader.r6), 1, fichier); - int i,j,k; + int i,j; for(j=0;j<192*2;j++)for(i=0;i<256;i++){ u8 r,g,b; u16 pixel = bmp[i+(192*2-j)*256];