Fixed the gtk glade port. As far as I can test it(that is

only the 2D part), it seems to be working...
This commit is contained in:
yabause 2008-09-13 12:31:23 +00:00
parent e4f9a0f5dc
commit 3287452dd7
20 changed files with 160 additions and 1495 deletions

View File

@ -16,16 +16,16 @@ glade_DATA = glade/DeSmuMe_Dtools.glade glade/DeSmuMe.glade glade/DeSmuME.xpm
bin_PROGRAMS = desmume-glade
desmume_glade_SOURCES = \
globals.h glade-xml.c \
callbacks.c callbacks.h callbacks_IO.c callbacks_IO.h \
desmume.c desmume.h \
keyval_names.c main.c printscreen.c gdk_gl.c gdk_gl.h \
dTools/callbacks_1_ioregs.c dTools/callbacks_2_memview.c \
dTools/callbacks_3_palview.c dTools/callbacks_4_tileview.c \
globals.h glade-xml.cpp \
callbacks.cpp callbacks.h callbacks_IO.cpp callbacks_IO.h \
desmume.cpp desmume.h \
keyval_names.cpp main.cpp printscreen.cpp gdk_gl.cpp gdk_gl.h \
dTools/callbacks_1_ioregs.cpp dTools/callbacks_2_memview.cpp \
dTools/callbacks_3_palview.cpp dTools/callbacks_4_tileview.cpp \
dTools/callbacks_dtools.h \
dTools/dTools_display.h \
gdk_3Demu.c gdk_3Demu.h \
../sndsdl.h ../sndsdl.c ../ctrlssdl.h ../ctrlssdl.c
gdk_3Demu.cpp gdk_3Demu.h \
../sndsdl.h ../sndsdl.cpp ../ctrlssdl.h ../ctrlssdl.cpp
desmume_glade_LDADD = ../libdesmume.a ../gdbstub/libgdbstub.a \
$(SDL_LIBS) $(GTKGLEXT_LIBS) $(LIBGLADE_LIBS) \

View File

@ -29,6 +29,71 @@ gboolean ScreenRight=FALSE;
gboolean ScreenGap=FALSE;
gboolean ScreenInvert=FALSE;
/* ******** Savestate menu items handling ******** */
void set_menuitem_label(GtkWidget * w, char * text )
{
GtkLabel * child;
if ( GTK_BIN(w)->child )
{
child = (GtkLabel*)GTK_BIN(w)->child;
gtk_label_set_text(child, text);
}
}
void clear_savestate_menu(char * cb_name, u8 num)
{
GtkWidget * w;
char cb[40];
char text[40];
sprintf( cb, "%s%d", cb_name, num);
sprintf( text, _("State %d (empty)"), num);
w = glade_xml_get_widget(xml, cb);
set_menuitem_label( w, text );
}
void update_savestate_menu(char * cb_name, u8 num)
{
GtkWidget * w;
char cb[40];
sprintf( cb, "%s%d", cb_name, num);
w = glade_xml_get_widget(xml, cb);
set_menuitem_label( w, savestates[num-1].date );
}
void update_savestates_menu()
{
char cb[15];
u8 i;
GtkWidget * w;
for( i = 1; i <= NB_STATES; i++ )
{
if( savestates[i-1].exists == TRUE )
{
update_savestate_menu("loadstate", i);
update_savestate_menu("savestate", i);
}
else
{
clear_savestate_menu("loadstate", i);
clear_savestate_menu("savestate", i);
}
}
}
void update_savestate(u8 num)
{
desmume_pause();
savestate_slot(num);
update_savestate_menu("savestate", num);
update_savestate_menu("loadstate", num);
desmume_resume();
}
/* inline & protos */
inline void SET_SENSITIVE(gchar *w, gboolean b) {
@ -186,7 +251,7 @@ void gtk_table_reattach(GtkTable * table, GtkWidget * w,
for (list = table->children; list; list = list->next)
{
GtkTableChild *table_child;
table_child = list->data;
table_child = (GtkTableChild *) list->data;
if (table_child->widget == w) {
table_child->left_attach = left_attach;
table_child->right_attach = right_attach;
@ -213,15 +278,15 @@ void rightscreen(BOOL apply) {
if (ScreenRight) {
/* we want to change the layout, lower screen goes right */
gtk_table_reattach(table, pDrawingArea2,
3,4, 0,1, 0,0, 0,0);
3,4, 0,1, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 0,0);
gtk_table_reattach(table, chk,
4,5, 0,1, 0,0, 0,0);
4,5, 0,1, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 0,0);
} else {
/* we want to change the layout, lower screen goes down */
gtk_table_reattach(table, pDrawingArea2,
1,2, 2,3, 0,0, 0,0);
1,2, 2,3, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 0,0);
gtk_table_reattach(table, chk,
0,1, 2,3, 0,0, 0,0);
0,1, 2,3, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 0,0);
ScreenRight = FALSE;
}
@ -268,7 +333,6 @@ void on_sizeXX_activate (GtkMenuItem *menuitem, gpointer user_data) {
/* MENU CONFIG ***** ***** ***** ***** */
u16 Keypad_Temp[NB_KEYS];
void on_menu_controls_activate (GtkMenuItem *menuitem, gpointer user_data) {
edit_controls();
@ -295,7 +359,7 @@ user_data)
dlg = (GtkDialog*)glade_xml_get_widget(xml, "wMainW");
msgbox = (GtkDialog*)
gtk_message_dialog_new((GtkWindow*)dlg,
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
(GtkDialogFlags) (GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT),
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
text
@ -358,7 +422,7 @@ void on_menu_tileview_activate (GtkMenuItem *menuitem, gpointer user_data)
gtk_widget_show(dlg);
}
void on_menu_wtoolsXX_activate (GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget * w = user_data;
GtkWidget * w = (GtkWidget *) user_data;
gtk_widget_show(w);
}

View File

@ -21,6 +21,8 @@
#include "globals.h"
extern "C" {
/* MENU FILE */
G_MODULE_EXPORT void on_menu_ouvrir_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data);
@ -68,3 +70,5 @@ G_MODULE_EXPORT void on_wgt_Quit_clicked (GtkToolButton *toolbutton, gpointer
/* LAYERS TOGGLE */
G_MODULE_EXPORT void on_wc_1_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data);
G_MODULE_EXPORT void on_wc_2_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data);
}

View File

@ -22,6 +22,8 @@
#include "globals.h"
extern "C" {
/* INPUT BUTTONS / KEYBOARD */
G_MODULE_EXPORT gboolean on_wMainW_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
G_MODULE_EXPORT gboolean on_wMainW_key_release_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
@ -45,3 +47,5 @@ G_MODULE_EXPORT void on_button_kb_key_clicked (GtkButton *button, gpointer u
/* Joystick configuration / Key definition */
G_MODULE_EXPORT void on_button_joy_axis_clicked (GtkButton *button, gpointer user_data);
G_MODULE_EXPORT void on_button_joy_key_clicked (GtkButton *button, gpointer user_data);
}

View File

@ -66,7 +66,8 @@ static void wtools_1_update () {
static u32 mem[NBR_IO_REGS];
static void update_regs_fast(){
char text[10], *mask;
char text[10];
const char * mask;
int i; u32 w, m;
for( i = 0; i < NBR_IO_REGS; i++ )
{
@ -91,7 +92,8 @@ static void update_regs_fast(){
static void update_regs()
{
char text[80], *mask;
char text[80];
const char * mask;
int len, i;
if (init==FALSE) {

View File

@ -19,8 +19,13 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __CALLBACKS_DTOOLS_H__
#define __CALLBACKS_DTOOLS_H__
#include "../globals.h"
extern "C" {
/* ***** ***** IO REGISTERS ***** ***** */
G_MODULE_EXPORT void on_wtools_1_combo_cpu_changed (GtkComboBox *, gpointer );
G_MODULE_EXPORT void on_wtools_1_IOregs_show (GtkWidget *, gpointer );
@ -69,3 +74,6 @@ G_MODULE_EXPORT void on_wtools_4_palnum_value_changed (GtkSpinButton *, gpoi
G_MODULE_EXPORT void on_wtools_4_rXX_toggled (GtkToggleButton *togglebutton, gpointer user_data);
G_MODULE_EXPORT gboolean on_wDraw_Tile_expose_event (GtkWidget *, GdkEventExpose *, gpointer );
}
#endif

View File

@ -92,7 +92,7 @@ static void inline dTools_display_clear_char(dTools_dsp * dsp, int x, int y, int
static void inline dTools_display_select_attr(dTools_dsp * dsp, int index) {
PangoAttrList *attr = NULL;
attr = g_list_nth_data(dsp->attr_list, index);
attr = (PangoAttrList*) g_list_nth_data(dsp->attr_list, index);
if (attr != NULL) {
dsp->curr_attr = attr;
}

View File

@ -159,10 +159,10 @@ init_opengl_gdk_3Demu( void) {
return 0;
}
glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGBA |
glconfig = gdk_gl_config_new_by_mode ((GdkGLConfigMode) (GDK_GL_MODE_RGBA |
GDK_GL_MODE_DEPTH |
GDK_GL_MODE_STENCIL |
GDK_GL_MODE_SINGLE);
GDK_GL_MODE_SINGLE));
if (glconfig == NULL)
{
g_print (_("*** No appropriate OpenGL-capable visual found.\n"));

View File

@ -175,9 +175,9 @@ void init_GL_capabilities( int use_software_convert) {
uint16_t blank_texture[256 * 512];
my_glConfig = gdk_gl_config_new_by_mode (
GDK_GL_MODE_RGBA
(GdkGLConfigMode) (GDK_GL_MODE_RGBA
| GDK_GL_MODE_DEPTH
| GDK_GL_MODE_DOUBLE
| GDK_GL_MODE_DOUBLE)
);
gtk_glade_use_software_colour_convert = use_software_convert;

View File

@ -108,7 +108,7 @@ autoconnect_foreach_StringObject(const char *signal_handler, GList *signals,
if (!g_module_symbol(allsymbols, signal_handler, (gpointer)&func))
if (!g_module_symbol(allsymbols, signal_handler, (void **)&func))
g_warning(_("could not find signal handler '%s'."), signal_handler);
@ -116,7 +116,7 @@ autoconnect_foreach_StringObject(const char *signal_handler, GList *signals,
for (; signals != NULL; signals = signals->next) {
GladeSignalData *data = signals->data;
GladeSignalData *data = (GladeSignalData *) signals->data;
if (data->connect_object) {
@ -156,15 +156,15 @@ autoconnect_foreach_StringObject(const char *signal_handler, GList *signals,
} else {
GObject *other = g_hash_table_lookup(self->priv->name_hash,
GObject *other = (GObject *) g_hash_table_lookup(self->priv->name_hash,
data->connect_object);
g_signal_connect_object(data->signal_object, data->signal_name,
func, other, (data->signal_after ? G_CONNECT_AFTER : 0)
func, other, (GConnectFlags) ((data->signal_after ? G_CONNECT_AFTER : 0)
| G_CONNECT_SWAPPED);
| G_CONNECT_SWAPPED));
}
@ -242,7 +242,7 @@ glade_xml_signal_autoconnect_StringObject (GladeXML *self)
/* get a handle on the main executable -- use this to find symbols */
allsymbols = g_module_open(NULL, 0);
allsymbols = g_module_open(NULL, (GModuleFlags) 0);
priv = (nopriv_GladeXMLPrivate *)self->priv;

View File

@ -106,13 +106,12 @@ glade_xml_signal_autoconnect_StringObject (GladeXML *self);
//---
int Frameskip;
u16 Keypad_Temp[NB_KEYS];
extern int Frameskip;
/* main.c */
GtkWidget * pWindow;
GtkWidget * pDrawingArea, * pDrawingArea2;
GladeXML * xml, * xml_tools;
extern GtkWidget * pWindow;
extern GtkWidget * pDrawingArea, * pDrawingArea2;
extern GladeXML * xml, * xml_tools;
typedef void (*VoidFunPtr)();
void notify_Tools();
@ -124,13 +123,11 @@ gchar * get_ui_file (const char *filename);
void enable_rom_features();
void resize (float Size1, float Size2);
void rotate(float angle);
gboolean ScreenInvert;
gboolean ScreenGap;
gboolean ScreenRight;
extern gboolean ScreenInvert;
/* callbacks_IO.c */
float ScreenCoeff_Size[2];
float ScreenRotate;
extern float ScreenCoeff_Size[2];
extern float ScreenRotate;
void black_screen ();
void edit_controls();
@ -140,8 +137,7 @@ void init_joy_labels();
int WriteBMP(const char *filename,u16 *bmp);
/* keyvalnames.c -see <gdk/gdkkeysyms.h>- */
char * KEYVAL_NAMES[0x10000];
char * KEYNAME(int k);
const char * KEYNAME(int k);
void init_keyvals();
#endif /* __GLOBALS_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
/* keyval_names.c - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "keyval_names.h"
/* see <gdk/gdkkeysyms.h> */
char * unknown="(unknown)";
const char * KEYVAL_NAMES[0x10000];
const char * KEYNAME(int k) {
const char * s = unknown;
s = KEYVAL_NAMES[k & 0xFFFF];
return s;
}
void KEYVAL(int k, const char * name) {
if (KEYVAL_NAMES[k] == unknown)
KEYVAL_NAMES[k] = name;
}

View File

@ -25,6 +25,7 @@
#include "dTools/callbacks_dtools.h"
#include "globals.h"
#include "../gdbstub.h"
#include "keyval_names.h"
#ifdef GTKGLEXT_AVAILABLE
#include <gtk/gtkgl.h>
@ -38,7 +39,6 @@
SDL_sem *glade_fps_limiter_semaphore;
int glade_fps_limiter_disabled = 0;
GtkWidget * pWindow;
GtkWidget * pDrawingArea, * pDrawingArea2;
GladeXML * xml, * xml_tools;
@ -210,11 +210,11 @@ GList * tools_to_update = NULL;
// register tool
void register_Tool(VoidFunPtr fun) {
tools_to_update = g_list_append(tools_to_update, fun);
tools_to_update = g_list_append(tools_to_update, (void *) fun);
}
void unregister_Tool(VoidFunPtr fun) {
if (tools_to_update == NULL) return;
tools_to_update = g_list_remove(tools_to_update, fun);
tools_to_update = g_list_remove(tools_to_update, (void *) fun);
}
void notify_Tool (VoidFunPtr fun, gpointer func_data) {
@ -309,71 +309,6 @@ int Write_ConfigFile()
return 0;
}
/* ******** Savestate menu items handling ******** */
void set_menuitem_label(GtkWidget * w, char * text )
{
GtkLabel * child;
if ( GTK_BIN(w)->child )
{
child = (GtkLabel*)GTK_BIN(w)->child;
gtk_label_set_text(child, text);
}
}
void clear_savestate_menu(char * cb_name, u8 num)
{
GtkWidget * w;
char cb[40];
char text[40];
sprintf( cb, "%s%d", cb_name, num);
sprintf( text, _("State %d (empty)"), num);
w = glade_xml_get_widget(xml, cb);
set_menuitem_label( w, text );
}
void update_savestate_menu(char * cb_name, u8 num)
{
GtkWidget * w;
char cb[40];
sprintf( cb, "%s%d", cb_name, num);
w = glade_xml_get_widget(xml, cb);
set_menuitem_label( w, savestates[num-1].date );
}
void update_savestates_menu()
{
char cb[15];
u8 i;
GtkWidget * w;
for( i = 1; i <= NB_STATES; i++ )
{
if( savestates[i-1].exists == TRUE )
{
update_savestate_menu("loadstate", i);
update_savestate_menu("savestate", i);
}
else
{
clear_savestate_menu("loadstate", i);
clear_savestate_menu("savestate", i);
}
}
}
void update_savestate(u8 num)
{
desmume_pause();
savestate_slot(num);
update_savestate_menu("savestate", num);
update_savestate_menu("loadstate", num);
desmume_resume();
}
/*
* The thread handling functions needed by the GDB stub code.
@ -391,7 +326,7 @@ createThread_gdb( void (*thread_function)( void *data),
void
joinThread_gdb( void *thread_handle) {
g_thread_join( thread_handle);
g_thread_join((GThread *) thread_handle);
}