revision 447:3e095bfcb476
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 447:3e095bfcb476 |
parent | 446:def93c34c84c |
child | 448:3e5f0c52f0ec |
author | nkeynes |
date | Tue Oct 16 12:36:29 2007 +0000 (16 years ago) |
Add gui error reporting
Add initial controller settings dialog
Add initial controller settings dialog
src/Makefile.am | view | annotate | diff | log | ||
src/Makefile.in | view | annotate | diff | log | ||
src/gui.h | view | annotate | diff | log | ||
src/gui/ctrl_dlg.c | view | annotate | diff | log | ||
src/gui/gtkcb.c | view | annotate | diff | log | ||
src/gui/gtkui.c | view | annotate | diff | log | ||
src/gui/gtkui.h | view | annotate | diff | log | ||
src/gui/main_win.c | view | annotate | diff | log | ||
src/maple/maple.c | view | annotate | diff | log | ||
src/maple/maple.h | view | annotate | diff | log | ||
src/util.c | view | annotate | diff | log |
1.1 --- a/src/Makefile.am Tue Oct 16 12:28:42 2007 +00001.2 +++ b/src/Makefile.am Tue Oct 16 12:36:29 2007 +00001.3 @@ -39,6 +39,7 @@1.4 gui/debugif.c gui/debugif.h \1.5 gui/debugcb.c gui/debugcb.h \1.6 gui/mmr_win.c gui/debug_win.c gui/dump_win.c \1.7 + gui/ctrl_dlg.c \1.8 loader.c bootstrap.c util.c \1.9 display.c display.h \1.10 drivers/audio_null.c drivers/audio_esd.c \
2.1 --- a/src/Makefile.in Tue Oct 16 12:28:42 2007 +00002.2 +++ b/src/Makefile.in Tue Oct 16 12:36:29 2007 +00002.3 @@ -173,6 +173,7 @@2.4 gui/debugif.c gui/debugif.h \2.5 gui/debugcb.c gui/debugcb.h \2.6 gui/mmr_win.c gui/debug_win.c gui/dump_win.c \2.7 + gui/ctrl_dlg.c \2.8 loader.c bootstrap.c util.c \2.9 display.c display.h \2.10 drivers/audio_null.c drivers/audio_esd.c \2.11 @@ -238,11 +239,11 @@2.12 controller.$(OBJEXT) gtkui.$(OBJEXT) main_win.$(OBJEXT) \2.13 gtkcb.$(OBJEXT) support.$(OBJEXT) debugif.$(OBJEXT) \2.14 debugcb.$(OBJEXT) mmr_win.$(OBJEXT) debug_win.$(OBJEXT) \2.15 - dump_win.$(OBJEXT) loader.$(OBJEXT) bootstrap.$(OBJEXT) \2.16 - util.$(OBJEXT) display.$(OBJEXT) audio_null.$(OBJEXT) \2.17 - audio_esd.$(OBJEXT) video_null.$(OBJEXT) video_gtk.$(OBJEXT) \2.18 - video_x11.$(OBJEXT) gl_common.$(OBJEXT) gl_fbo.$(OBJEXT) \2.19 - gl_sl.$(OBJEXT) gl_slsrc.$(OBJEXT)2.20 + dump_win.$(OBJEXT) ctrl_dlg.$(OBJEXT) loader.$(OBJEXT) \2.21 + bootstrap.$(OBJEXT) util.$(OBJEXT) display.$(OBJEXT) \2.22 + audio_null.$(OBJEXT) audio_esd.$(OBJEXT) video_null.$(OBJEXT) \2.23 + video_gtk.$(OBJEXT) video_x11.$(OBJEXT) gl_common.$(OBJEXT) \2.24 + gl_fbo.$(OBJEXT) gl_sl.$(OBJEXT) gl_slsrc.$(OBJEXT)2.25 lxdream_OBJECTS = $(am_lxdream_OBJECTS)2.26 lxdream_DEPENDENCIES =2.27 lxdream_LDFLAGS =2.28 @@ -269,39 +270,39 @@2.29 @AMDEP_TRUE@ ./$(DEPDIR)/audio.Po ./$(DEPDIR)/audio_esd.Po \2.30 @AMDEP_TRUE@ ./$(DEPDIR)/audio_null.Po ./$(DEPDIR)/bios.Po \2.31 @AMDEP_TRUE@ ./$(DEPDIR)/bootstrap.Po ./$(DEPDIR)/cdi.Po \2.32 -@AMDEP_TRUE@ ./$(DEPDIR)/controller.Po ./$(DEPDIR)/dcload.Po \2.33 -@AMDEP_TRUE@ ./$(DEPDIR)/debug_win.Po ./$(DEPDIR)/debugcb.Po \2.34 -@AMDEP_TRUE@ ./$(DEPDIR)/debugif.Po ./$(DEPDIR)/dis-buf.Po \2.35 -@AMDEP_TRUE@ ./$(DEPDIR)/dis-init.Po ./$(DEPDIR)/display.Po \2.36 -@AMDEP_TRUE@ ./$(DEPDIR)/dmac.Po ./$(DEPDIR)/dreamcast.Po \2.37 -@AMDEP_TRUE@ ./$(DEPDIR)/dump_win.Po ./$(DEPDIR)/eventq.Po \2.38 -@AMDEP_TRUE@ ./$(DEPDIR)/gdimage.Po ./$(DEPDIR)/gdrom.Po \2.39 -@AMDEP_TRUE@ ./$(DEPDIR)/gendec.Po ./$(DEPDIR)/genglsl.Po \2.40 -@AMDEP_TRUE@ ./$(DEPDIR)/gl_common.Po ./$(DEPDIR)/gl_fbo.Po \2.41 -@AMDEP_TRUE@ ./$(DEPDIR)/gl_sl.Po ./$(DEPDIR)/gl_slsrc.Po \2.42 -@AMDEP_TRUE@ ./$(DEPDIR)/gtkcb.Po ./$(DEPDIR)/gtkui.Po \2.43 -@AMDEP_TRUE@ ./$(DEPDIR)/i386-dis.Po ./$(DEPDIR)/ide.Po \2.44 -@AMDEP_TRUE@ ./$(DEPDIR)/insparse.Po ./$(DEPDIR)/intc.Po \2.45 -@AMDEP_TRUE@ ./$(DEPDIR)/linux.Po ./$(DEPDIR)/loader.Po \2.46 -@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/main_win.Po \2.47 -@AMDEP_TRUE@ ./$(DEPDIR)/maple.Po ./$(DEPDIR)/mem.Po \2.48 -@AMDEP_TRUE@ ./$(DEPDIR)/mmr_win.Po ./$(DEPDIR)/nrg.Po \2.49 -@AMDEP_TRUE@ ./$(DEPDIR)/pvr2.Po ./$(DEPDIR)/pvr2mem.Po \2.50 -@AMDEP_TRUE@ ./$(DEPDIR)/rendbkg.Po ./$(DEPDIR)/rendcore.Po \2.51 -@AMDEP_TRUE@ ./$(DEPDIR)/render.Po ./$(DEPDIR)/rendsave.Po \2.52 -@AMDEP_TRUE@ ./$(DEPDIR)/rendsort.Po ./$(DEPDIR)/scif.Po \2.53 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4.Po ./$(DEPDIR)/sh4core.Po \2.54 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4dasm.Po ./$(DEPDIR)/sh4mem.Po \2.55 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4mmio.Po ./$(DEPDIR)/sh4stat.Po \2.56 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4trans.Po ./$(DEPDIR)/sh4x86.Po \2.57 -@AMDEP_TRUE@ ./$(DEPDIR)/support.Po ./$(DEPDIR)/syscall.Po \2.58 -@AMDEP_TRUE@ ./$(DEPDIR)/tacore.Po ./$(DEPDIR)/testsh4x86.Po \2.59 -@AMDEP_TRUE@ ./$(DEPDIR)/testxlt.Po ./$(DEPDIR)/texcache.Po \2.60 -@AMDEP_TRUE@ ./$(DEPDIR)/timer.Po ./$(DEPDIR)/util.Po \2.61 -@AMDEP_TRUE@ ./$(DEPDIR)/video_gtk.Po ./$(DEPDIR)/video_null.Po \2.62 -@AMDEP_TRUE@ ./$(DEPDIR)/video_x11.Po ./$(DEPDIR)/watch.Po \2.63 -@AMDEP_TRUE@ ./$(DEPDIR)/x86dasm.Po ./$(DEPDIR)/xltcache.Po \2.64 -@AMDEP_TRUE@ ./$(DEPDIR)/yuv.Po2.65 +@AMDEP_TRUE@ ./$(DEPDIR)/controller.Po ./$(DEPDIR)/ctrl_dlg.Po \2.66 +@AMDEP_TRUE@ ./$(DEPDIR)/dcload.Po ./$(DEPDIR)/debug_win.Po \2.67 +@AMDEP_TRUE@ ./$(DEPDIR)/debugcb.Po ./$(DEPDIR)/debugif.Po \2.68 +@AMDEP_TRUE@ ./$(DEPDIR)/dis-buf.Po ./$(DEPDIR)/dis-init.Po \2.69 +@AMDEP_TRUE@ ./$(DEPDIR)/display.Po ./$(DEPDIR)/dmac.Po \2.70 +@AMDEP_TRUE@ ./$(DEPDIR)/dreamcast.Po ./$(DEPDIR)/dump_win.Po \2.71 +@AMDEP_TRUE@ ./$(DEPDIR)/eventq.Po ./$(DEPDIR)/gdimage.Po \2.72 +@AMDEP_TRUE@ ./$(DEPDIR)/gdrom.Po ./$(DEPDIR)/gendec.Po \2.73 +@AMDEP_TRUE@ ./$(DEPDIR)/genglsl.Po ./$(DEPDIR)/gl_common.Po \2.74 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_fbo.Po ./$(DEPDIR)/gl_sl.Po \2.75 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_slsrc.Po ./$(DEPDIR)/gtkcb.Po \2.76 +@AMDEP_TRUE@ ./$(DEPDIR)/gtkui.Po ./$(DEPDIR)/i386-dis.Po \2.77 +@AMDEP_TRUE@ ./$(DEPDIR)/ide.Po ./$(DEPDIR)/insparse.Po \2.78 +@AMDEP_TRUE@ ./$(DEPDIR)/intc.Po ./$(DEPDIR)/linux.Po \2.79 +@AMDEP_TRUE@ ./$(DEPDIR)/loader.Po ./$(DEPDIR)/main.Po \2.80 +@AMDEP_TRUE@ ./$(DEPDIR)/main_win.Po ./$(DEPDIR)/maple.Po \2.81 +@AMDEP_TRUE@ ./$(DEPDIR)/mem.Po ./$(DEPDIR)/mmr_win.Po \2.82 +@AMDEP_TRUE@ ./$(DEPDIR)/nrg.Po ./$(DEPDIR)/pvr2.Po \2.83 +@AMDEP_TRUE@ ./$(DEPDIR)/pvr2mem.Po ./$(DEPDIR)/rendbkg.Po \2.84 +@AMDEP_TRUE@ ./$(DEPDIR)/rendcore.Po ./$(DEPDIR)/render.Po \2.85 +@AMDEP_TRUE@ ./$(DEPDIR)/rendsave.Po ./$(DEPDIR)/rendsort.Po \2.86 +@AMDEP_TRUE@ ./$(DEPDIR)/scif.Po ./$(DEPDIR)/sh4.Po \2.87 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4core.Po ./$(DEPDIR)/sh4dasm.Po \2.88 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4mem.Po ./$(DEPDIR)/sh4mmio.Po \2.89 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4stat.Po ./$(DEPDIR)/sh4trans.Po \2.90 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4x86.Po ./$(DEPDIR)/support.Po \2.91 +@AMDEP_TRUE@ ./$(DEPDIR)/syscall.Po ./$(DEPDIR)/tacore.Po \2.92 +@AMDEP_TRUE@ ./$(DEPDIR)/testsh4x86.Po ./$(DEPDIR)/testxlt.Po \2.93 +@AMDEP_TRUE@ ./$(DEPDIR)/texcache.Po ./$(DEPDIR)/timer.Po \2.94 +@AMDEP_TRUE@ ./$(DEPDIR)/util.Po ./$(DEPDIR)/video_gtk.Po \2.95 +@AMDEP_TRUE@ ./$(DEPDIR)/video_null.Po ./$(DEPDIR)/video_x11.Po \2.96 +@AMDEP_TRUE@ ./$(DEPDIR)/watch.Po ./$(DEPDIR)/x86dasm.Po \2.97 +@AMDEP_TRUE@ ./$(DEPDIR)/xltcache.Po ./$(DEPDIR)/yuv.Po2.98 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \2.99 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)2.100 CCLD = $(CC)2.101 @@ -386,6 +387,7 @@2.102 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootstrap.Po@am__quote@2.103 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi.Po@am__quote@2.104 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controller.Po@am__quote@2.105 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrl_dlg.Po@am__quote@2.106 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dcload.Po@am__quote@2.107 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_win.Po@am__quote@2.108 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debugcb.Po@am__quote@2.109 @@ -1639,6 +1641,28 @@2.110 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.111 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dump_win.obj `if test -f 'gui/dump_win.c'; then $(CYGPATH_W) 'gui/dump_win.c'; else $(CYGPATH_W) '$(srcdir)/gui/dump_win.c'; fi`2.113 +ctrl_dlg.o: gui/ctrl_dlg.c2.114 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrl_dlg.o -MD -MP -MF "$(DEPDIR)/ctrl_dlg.Tpo" \2.115 +@am__fastdepCC_TRUE@ -c -o ctrl_dlg.o `test -f 'gui/ctrl_dlg.c' || echo '$(srcdir)/'`gui/ctrl_dlg.c; \2.116 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ctrl_dlg.Tpo" "$(DEPDIR)/ctrl_dlg.Po"; \2.117 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/ctrl_dlg.Tpo"; exit 1; \2.118 +@am__fastdepCC_TRUE@ fi2.119 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gui/ctrl_dlg.c' object='ctrl_dlg.o' libtool=no @AMDEPBACKSLASH@2.120 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ctrl_dlg.Po' tmpdepfile='$(DEPDIR)/ctrl_dlg.TPo' @AMDEPBACKSLASH@2.121 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.122 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrl_dlg.o `test -f 'gui/ctrl_dlg.c' || echo '$(srcdir)/'`gui/ctrl_dlg.c2.123 +2.124 +ctrl_dlg.obj: gui/ctrl_dlg.c2.125 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrl_dlg.obj -MD -MP -MF "$(DEPDIR)/ctrl_dlg.Tpo" \2.126 +@am__fastdepCC_TRUE@ -c -o ctrl_dlg.obj `if test -f 'gui/ctrl_dlg.c'; then $(CYGPATH_W) 'gui/ctrl_dlg.c'; else $(CYGPATH_W) '$(srcdir)/gui/ctrl_dlg.c'; fi`; \2.127 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ctrl_dlg.Tpo" "$(DEPDIR)/ctrl_dlg.Po"; \2.128 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/ctrl_dlg.Tpo"; exit 1; \2.129 +@am__fastdepCC_TRUE@ fi2.130 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gui/ctrl_dlg.c' object='ctrl_dlg.obj' libtool=no @AMDEPBACKSLASH@2.131 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/ctrl_dlg.Po' tmpdepfile='$(DEPDIR)/ctrl_dlg.TPo' @AMDEPBACKSLASH@2.132 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.133 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrl_dlg.obj `if test -f 'gui/ctrl_dlg.c'; then $(CYGPATH_W) 'gui/ctrl_dlg.c'; else $(CYGPATH_W) '$(srcdir)/gui/ctrl_dlg.c'; fi`2.134 +2.135 audio_null.o: drivers/audio_null.c2.136 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio_null.o -MD -MP -MF "$(DEPDIR)/audio_null.Tpo" \2.137 @am__fastdepCC_TRUE@ -c -o audio_null.o `test -f 'drivers/audio_null.c' || echo '$(srcdir)/'`drivers/audio_null.c; \
3.1 --- a/src/gui.h Tue Oct 16 12:28:42 2007 +00003.2 +++ b/src/gui.h Tue Oct 16 12:36:29 2007 +00003.3 @@ -1,5 +1,5 @@3.4 /**3.5 - * $Id: gui.h,v 1.1 2007-10-10 11:02:04 nkeynes Exp $3.6 + * $Id: gui.h,v 1.2 2007-10-16 12:36:29 nkeynes Exp $3.7 *3.8 * Public GUI declarations (used from elsewhere in the system)3.9 *3.10 @@ -44,6 +44,8 @@3.11 */3.12 void gui_main_loop(void);3.14 +gboolean gui_error_dialog( const char *fmt, ... );3.15 +3.16 typedef enum { IO_IDE, IO_NETWORK } io_activity_type;3.18 /**
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00004.2 +++ b/src/gui/ctrl_dlg.c Tue Oct 16 12:36:29 2007 +00004.3 @@ -0,0 +1,156 @@4.4 +/**4.5 + * $Id: ctrl_dlg.c,v 1.1 2007-10-16 12:36:29 nkeynes Exp $4.6 + *4.7 + * Define the main (emu) GTK window, along with its menubars,4.8 + * toolbars, etc.4.9 + *4.10 + * Copyright (c) 2005 Nathan Keynes.4.11 + *4.12 + * This program is free software; you can redistribute it and/or modify4.13 + * it under the terms of the GNU General Public License as published by4.14 + * the Free Software Foundation; either version 2 of the License, or4.15 + * (at your option) any later version.4.16 + *4.17 + * This program is distributed in the hope that it will be useful,4.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of4.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4.20 + * GNU General Public License for more details.4.21 + */4.22 +4.23 +#include <assert.h>4.24 +#include <gtk/gtk.h>4.25 +4.26 +#include "dream.h"4.27 +#include "gui/gtkui.h"4.28 +#include "maple/maple.h"4.29 +4.30 +#define MAX_DEVICES 44.31 +4.32 +typedef struct maple_slot_data {4.33 + maple_device_t old_device;4.34 + maple_device_t new_device;4.35 + GtkWidget *button;4.36 + GtkWidget *combo;4.37 +} *maple_slot_data_t;4.38 +4.39 +static struct maple_slot_data maple_data[MAX_DEVICES];4.40 +4.41 +4.42 +gboolean controller_properties_activated( GtkButton *button, gpointer user_data )4.43 +{4.44 + maple_slot_data_t data = (maple_slot_data_t)user_data;4.45 +}4.46 +4.47 +gboolean controller_device_changed( GtkComboBox *combo, gpointer user_data )4.48 +{4.49 + maple_slot_data_t data = (maple_slot_data_t)user_data;4.50 + int active = gtk_combo_box_get_active(combo);4.51 + gtk_widget_set_sensitive(data->button, active != 0);4.52 + if( active != 0 ) {4.53 + gchar *devname = gtk_combo_box_get_active_text(combo);4.54 + const maple_device_class_t devclz = maple_get_device_class(devname);4.55 + assert(devclz != NULL);4.56 + if( data->new_device != NULL ) {4.57 + if( data->new_device->device_class != devclz ) {4.58 + data->new_device->destroy(data->new_device);4.59 + data->new_device = maple_new_device(devname);4.60 + }4.61 + } else {4.62 + data->new_device = maple_new_device(devname);4.63 + }4.64 + } else {4.65 + if( data->new_device != NULL && data->new_device != data->old_device ) {4.66 + data->new_device->destroy(data->new_device);4.67 + }4.68 + data->new_device = NULL;4.69 + }4.70 +}4.71 +4.72 +void controller_commit_changes( )4.73 +{4.74 + int i;4.75 + for( i=0; i<MAX_DEVICES; i++ ) {4.76 + if( maple_data[i].new_device != maple_data[i].old_device ) {4.77 + if( maple_data[i].old_device != NULL ) {4.78 + maple_detach_device(i,0);4.79 + }4.80 + if( maple_data[i].new_device != NULL ) {4.81 + maple_attach_device(maple_data[i].new_device, i, 0 );4.82 + }4.83 + }4.84 + }4.85 + dreamcast_save_config("testrc");4.86 +}4.87 +4.88 +void controller_cancel_changes( )4.89 +{4.90 + int i;4.91 + for( i=0; i<MAX_DEVICES; i++ ) {4.92 + if( maple_data[i].new_device != NULL &&4.93 + maple_data[i].new_device != maple_data[i].old_device ) {4.94 + maple_data[i].new_device->destroy(maple_data[i].new_device);4.95 + }4.96 + }4.97 +}4.98 +4.99 +GtkWidget *controller_pane_new()4.100 +{4.101 + GtkWidget *table = gtk_table_new(4, 3, TRUE);4.102 + GtkTreeIter iter;4.103 + int i,j;4.104 + const struct maple_device_class **devices = maple_get_device_classes();4.105 +4.106 + for( i=0; i< MAX_DEVICES; i++ ) {4.107 + char buf[12];4.108 + GtkWidget *combo, *button;4.109 + int active = 0;4.110 + maple_device_t device = maple_get_device(i,0);4.111 + sprintf( buf, "Slot %d.", i );4.112 + gtk_table_attach_defaults( GTK_TABLE(table), gtk_label_new(buf), 0, 1, i, i+1 );4.113 + combo = gtk_combo_box_new_text();4.114 + gtk_combo_box_append_text( GTK_COMBO_BOX(combo), "<empty>" );4.115 + for( j=0; devices[j] != NULL; j++ ) {4.116 + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), devices[j]->name);4.117 + if( device != NULL && device->device_class == devices[j] ) {4.118 + active = j+1;4.119 + }4.120 + }4.121 + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active);4.122 + gtk_table_attach_defaults( GTK_TABLE(table), combo, 1, 2, i, i+1 );4.123 + button = gtk_button_new_from_stock( GTK_STOCK_PROPERTIES );4.124 + gtk_widget_set_sensitive(button, active != 0);4.125 + gtk_table_attach_defaults( GTK_TABLE(table), button, 2, 3, i, i+1 );4.126 +4.127 + maple_data[i].old_device = device;4.128 + maple_data[i].new_device = device;4.129 + maple_data[i].combo = combo;4.130 + maple_data[i].button = button;4.131 + g_signal_connect( button, "activate",4.132 + G_CALLBACK( controller_properties_activated ), &maple_data[i] );4.133 + g_signal_connect( combo, "changed",4.134 + G_CALLBACK( controller_device_changed ), &maple_data[i] );4.135 +4.136 + }4.137 + return table;4.138 +}4.139 +4.140 +void controller_dialog_run( GtkWindow *parent )4.141 +{4.142 + GtkWidget *dialog =4.143 + gtk_dialog_new_with_buttons("Controller Settings", parent,4.144 + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,4.145 + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,4.146 + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,4.147 + NULL);4.148 + GtkWidget *panel = controller_pane_new();4.149 + gint result;4.150 + gtk_widget_show_all(panel);4.151 + gtk_container_add( GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), panel );4.152 + result = gtk_dialog_run( GTK_DIALOG(dialog) );4.153 + gtk_widget_destroy( dialog );4.154 + if( result == GTK_RESPONSE_ACCEPT ) {4.155 + controller_commit_changes();4.156 + } else {4.157 + controller_cancel_changes();4.158 + }4.159 +}
5.1 --- a/src/gui/gtkcb.c Tue Oct 16 12:28:42 2007 +00005.2 +++ b/src/gui/gtkcb.c Tue Oct 16 12:36:29 2007 +00005.3 @@ -1,5 +1,5 @@5.4 /**5.5 - * $Id: gtkcb.c,v 1.2 2007-10-11 08:22:03 nkeynes Exp $5.6 + * $Id: gtkcb.c,v 1.3 2007-10-16 12:36:29 nkeynes Exp $5.7 *5.8 * Action callbacks from the main window5.9 *5.10 @@ -150,7 +150,8 @@5.11 "copyright", "(C) 2003-2007 Nathan Keynes",5.12 NULL);5.13 gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);5.14 - gtk_widget_show(dialog);5.15 + gtk_dialog_run(GTK_DIALOG(dialog));5.16 + gtk_widget_destroy(dialog);5.18 }5.20 @@ -164,12 +165,17 @@5.21 gtk_gui_show_debugger();5.22 }5.24 +void path_settings_callback( GtkAction *action, gpointer user_data)5.25 +{5.26 +}5.27 +5.28 void audio_settings_callback( GtkAction *action, gpointer user_data)5.29 {5.30 }5.32 void controller_settings_callback( GtkAction *action, gpointer user_data)5.33 {5.34 + controller_dialog_run( NULL );5.35 }5.37 void network_settings_callback( GtkAction *action, gpointer user_data)
6.1 --- a/src/gui/gtkui.c Tue Oct 16 12:28:42 2007 +00006.2 +++ b/src/gui/gtkui.c Tue Oct 16 12:36:29 2007 +00006.3 @@ -1,5 +1,5 @@6.4 /**6.5 - * $Id: gtkui.c,v 1.2 2007-10-11 08:22:03 nkeynes Exp $6.6 + * $Id: gtkui.c,v 1.3 2007-10-16 12:36:29 nkeynes Exp $6.7 *6.8 * Core GTK-based user interface6.9 *6.10 @@ -70,6 +70,25 @@6.11 gtk_main();6.12 }6.14 +gboolean gui_error_dialog( const char *msg, ... )6.15 +{6.16 + if( main_win != NULL ) {6.17 + va_list args;6.18 + GtkWidget *dialog =6.19 + gtk_message_dialog_new( main_window_get_frame(main_win), GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,6.20 + GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, NULL );6.21 + va_start(args, msg);6.22 + gchar *markup = g_markup_vprintf_escaped( msg, args );6.23 + va_end( args );6.24 + gtk_message_dialog_set_markup( GTK_MESSAGE_DIALOG(dialog), markup );6.25 + g_free(markup);6.26 + gtk_dialog_run(GTK_DIALOG(dialog));6.27 + gtk_widget_destroy(dialog);6.28 + return TRUE;6.29 + }6.30 + return FALSE;6.31 +}6.32 +6.33 void gui_update_io_activity( io_activity_type io, gboolean active )6.34 {
7.1 --- a/src/gui/gtkui.h Tue Oct 16 12:28:42 2007 +00007.2 +++ b/src/gui/gtkui.h Tue Oct 16 12:36:29 2007 +00007.3 @@ -1,5 +1,5 @@7.4 /**7.5 - * $Id: gtkui.h,v 1.2 2007-10-11 08:22:03 nkeynes Exp $7.6 + * $Id: gtkui.h,v 1.3 2007-10-16 12:36:29 nkeynes Exp $7.7 *7.8 * Core GTK-based user interface7.9 *7.10 @@ -35,6 +35,7 @@7.11 */7.12 main_window_t main_window_new( const gchar *title );7.14 +GtkWindow *main_window_get_frame( main_window_t win );7.15 GtkWidget *main_window_get_renderarea( main_window_t win );7.16 void main_window_set_running( main_window_t win, gboolean running );7.17 void main_window_set_framerate( main_window_t win, float rate );7.18 @@ -66,6 +67,7 @@7.19 void debugger_action_callback( GtkAction *action, gpointer user_data);7.20 void exit_action_callback( GtkAction *action, gpointer user_data);7.22 +void path_settings_callback( GtkAction *action, gpointer user_data);7.23 void audio_settings_callback( GtkAction *action, gpointer user_data);7.24 void controller_settings_callback( GtkAction *action, gpointer user_data);7.25 void network_settings_callback( GtkAction *action, gpointer user_data);
8.1 --- a/src/gui/main_win.c Tue Oct 16 12:28:42 2007 +00008.2 +++ b/src/gui/main_win.c Tue Oct 16 12:36:29 2007 +00008.3 @@ -1,5 +1,5 @@8.4 /**8.5 - * $Id: main_win.c,v 1.3 2007-10-13 03:58:31 nkeynes Exp $8.6 + * $Id: main_win.c,v 1.4 2007-10-16 12:36:29 nkeynes Exp $8.7 *8.8 * Define the main (emu) GTK window, along with its menubars,8.9 * toolbars, etc.8.10 @@ -46,6 +46,7 @@8.11 { "SaveState", GTK_STOCK_SAVE_AS, "_Save state...", "F3", "Create an lxdream save state", G_CALLBACK(save_state_action_callback) },8.12 { "Debugger", NULL, "_Debugger", NULL, "Open debugger window", G_CALLBACK(debugger_action_callback) },8.13 { "Exit", GTK_STOCK_QUIT, "E_xit", NULL, "Exit lxdream", G_CALLBACK(exit_action_callback) },8.14 + { "PathSettings", NULL, "_Paths...", NULL, "Configure files and paths", G_CALLBACK(path_settings_callback) },8.15 { "AudioSettings", NULL, "_Audio...", NULL, "Configure audio output", G_CALLBACK(audio_settings_callback) },8.16 { "ControllerSettings", NULL, "_Controllers...", NULL, "Configure controllers", G_CALLBACK(controller_settings_callback) },8.17 { "NetworkSettings", NULL, "_Network...", NULL, "Configure network settings", G_CALLBACK(network_settings_callback) },8.18 @@ -193,3 +194,8 @@8.19 {8.20 return win->video;8.21 }8.22 +8.23 +GtkWindow *main_window_get_frame( main_window_t win )8.24 +{8.25 + return GTK_WINDOW(win->window);8.26 +}
9.1 --- a/src/maple/maple.c Tue Oct 16 12:28:42 2007 +00009.2 +++ b/src/maple/maple.c Tue Oct 16 12:36:29 2007 +00009.3 @@ -1,5 +1,5 @@9.4 /**9.5 - * $Id: maple.c,v 1.9 2006-06-15 10:33:05 nkeynes Exp $9.6 + * $Id: maple.c,v 1.10 2007-10-16 12:36:29 nkeynes Exp $9.7 *9.8 * Implements the core Maple bus, including DMA transfers to and from the bus.9.9 *9.10 @@ -37,14 +37,28 @@9.12 maple_device_t maple_new_device( const gchar *name )9.13 {9.14 + maple_device_class_t clz = maple_get_device_class(name);9.15 + if( clz != NULL ) {9.16 + return clz->new_device();9.17 + }9.18 + return NULL;9.19 +}9.20 +9.21 +const maple_device_class_t maple_get_device_class( const gchar *name )9.22 +{9.23 int i;9.24 for( i=0; maple_device_classes[i] != NULL; i++ ) {9.25 if( g_strcasecmp(maple_device_classes[i]->name, name ) == 0 )9.26 - return maple_device_classes[i]->new_device();9.27 + return maple_device_classes[i];9.28 }9.29 return NULL;9.30 }9.32 +const struct maple_device_class **maple_get_device_classes()9.33 +{9.34 + return maple_device_classes;9.35 +}9.36 +9.37 dreamcast_config_entry_t maple_get_device_config( maple_device_t dev )9.38 {9.39 if( dev->get_config == NULL )9.40 @@ -105,8 +119,10 @@9.41 gun = GETBYTE(1) & 0x01;9.42 length = GETBYTE(0) & 0xFF;9.43 return_addr = GETWORD(4);9.44 - if( return_addr == 0 ) {9.45 - /* ERROR */9.46 +9.47 + if( (return_addr & 0x1C000000) != 0x0C000000 ) {9.48 + ERROR( "Bad return address in maple packet: %08X", return_addr );9.49 + break;9.50 }9.51 return_buf = mem_get_region(return_addr);9.52 cmd = GETBYTE(8);9.53 @@ -114,10 +130,13 @@9.54 send_addr = GETBYTE(10);9.55 /* Sanity checks */9.56 if( GETBYTE(11) != length ||9.57 - send_addr != (port<<6) ||9.58 + send_addr >> 6 != port ||9.59 recv_addr >> 6 != port ||9.60 return_buf == NULL ) {9.61 - /* ERROR */9.62 + ERROR( "Received bad packet: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X",9.63 + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7],9.64 + buf[8], buf[9], buf[10], buf[11] );9.65 + break;9.66 }9.67 periph = 0;9.68 periph_id = recv_addr & 0x3F;9.69 @@ -221,6 +240,7 @@9.70 return_buf[3] = out_length;9.71 }9.72 buf += 12 + (length<<2);9.73 + address += 12 + (length<<2);9.74 }9.75 asic_event( EVENT_MAPLE_DMA );9.76 }9.77 @@ -256,6 +276,9 @@9.78 if( dev->detach != NULL ) {9.79 dev->detach(dev);9.80 }9.81 + if( dev->destroy != NULL ) {9.82 + dev->destroy(dev);9.83 + }9.84 if( periph == 0 ) {9.85 /* If we detach the main peripheral, we also have to detach all the9.86 * subperipherals, or the system could get quite confused
10.1 --- a/src/maple/maple.h Tue Oct 16 12:28:42 2007 +000010.2 +++ b/src/maple/maple.h Tue Oct 16 12:36:29 2007 +000010.3 @@ -1,5 +1,5 @@10.4 /**10.5 - * $Id: maple.h,v 1.5 2006-05-15 08:28:52 nkeynes Exp $10.6 + * $Id: maple.h,v 1.6 2007-10-16 12:36:29 nkeynes Exp $10.7 *10.8 * Maple bus definitions10.9 *10.10 @@ -89,8 +89,10 @@10.12 extern struct maple_device_class controller_class;10.14 -maple_device_t maple_new_device( const char *name );10.15 +maple_device_t maple_new_device( const gchar *name );10.16 maple_device_t maple_get_device( unsigned int port, unsigned int periph );10.17 +const maple_device_class_t maple_get_device_class( const gchar *name );10.18 +const struct maple_device_class **maple_get_device_classes();10.19 dreamcast_config_entry_t maple_get_device_config( maple_device_t dev );10.21 void maple_handle_buffer( uint32_t buffer );
11.1 --- a/src/util.c Tue Oct 16 12:28:42 2007 +000011.2 +++ b/src/util.c Tue Oct 16 12:36:29 2007 +000011.3 @@ -1,5 +1,5 @@11.4 /**11.5 - * $Id: util.c,v 1.9 2007-10-11 08:22:03 nkeynes Exp $11.6 + * $Id: util.c,v 1.10 2007-10-16 12:36:29 nkeynes Exp $11.7 *11.8 * Miscellaneous utility functions.11.9 *11.10 @@ -102,12 +102,23 @@11.11 if( level > global_msg_level ) {11.12 return; // ignored11.13 }11.14 +11.15 va_start(ap, msg);11.17 + if( level <= EMIT_ERR ) {11.18 + gchar *text = g_strdup_vprintf( msg, ap );11.19 + if( gui_error_dialog( text ) ) {11.20 + g_free(text);11.21 + va_end(ap);11.22 + return;11.23 + }11.24 + g_free(text);11.25 + }11.26 +11.27 +11.28 strftime( buf, sizeof(buf), "%H:%M:%S", localtime(&tm) );11.29 -11.30 fprintf( stderr, "%s %08X %-5s ", buf, sh4r.pc, msg_levels[level] );11.31 vfprintf( stderr, msg, ap );11.32 + va_end(ap);11.33 fprintf( stderr, "\n" );11.34 - va_end(ap);11.35 }
.