revision 450:207461e79f21
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 450:207461e79f21 |
parent | 449:21440948c684 |
child | 451:50622730f226 |
author | nkeynes |
date | Wed Oct 17 11:26:45 2007 +0000 (16 years ago) |
Split config management out to config.[ch]
Manage config filename
Check home dir + sysconfdir for conf file
Initial work on a path settings dialog
Manage config filename
Check home dir + sysconfdir for conf file
Initial work on a path settings dialog
src/Makefile.am | view | annotate | diff | log | ||
src/Makefile.in | view | annotate | diff | log | ||
src/config.c | view | annotate | diff | log | ||
src/config.h | view | annotate | diff | log | ||
src/dreamcast.c | view | annotate | diff | log | ||
src/dreamcast.h | view | annotate | diff | log | ||
src/gui/ctrl_dlg.c | view | annotate | diff | log | ||
src/gui/debugcb.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/gui/path_dlg.c | view | annotate | diff | log | ||
src/loader.c | view | annotate | diff | log | ||
src/main.c | view | annotate | diff | log | ||
src/maple/controller.c | view | annotate | diff | log | ||
src/maple/maple.c | view | annotate | diff | log | ||
src/maple/maple.h | view | annotate | diff | log |
1.1 --- a/src/Makefile.am Tue Oct 16 12:38:01 2007 +00001.2 +++ b/src/Makefile.am Wed Oct 17 11:26:45 2007 +00001.3 @@ -3,6 +3,7 @@1.4 INCLUDES = \1.5 -DPACKAGE_DATA_DIR=\""$(datadir)"\" \1.6 -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \1.7 + -DPACKAGE_CONF_DIR=\""$(sysconfdir)"\" \1.8 -Ish4 \1.9 @PACKAGE_CFLAGS@1.11 @@ -14,7 +15,7 @@1.12 genglsl_SOURCES = tools/genglsl.c1.14 lxdream_SOURCES = \1.15 - main.c \1.16 + main.c config.c config.h \1.17 mem.c mem.h mmio.h watch.c \1.18 asic.c asic.h \1.19 syscall.c syscall.h bios.c dcload.c \1.20 @@ -39,7 +40,7 @@1.21 gui/debugif.c gui/debugif.h \1.22 gui/debugcb.c gui/debugcb.h \1.23 gui/mmr_win.c gui/debug_win.c gui/dump_win.c \1.24 - gui/ctrl_dlg.c \1.25 + gui/ctrl_dlg.c gui/path_dlg.c \1.26 loader.c bootstrap.c util.c \1.27 display.c display.h \1.28 drivers/audio_null.c drivers/audio_esd.c \
2.1 --- a/src/Makefile.in Tue Oct 16 12:38:01 2007 +00002.2 +++ b/src/Makefile.in Wed Oct 17 11:26:45 2007 +00002.3 @@ -136,6 +136,7 @@2.4 INCLUDES = \2.5 -DPACKAGE_DATA_DIR=\""$(datadir)"\" \2.6 -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \2.7 + -DPACKAGE_CONF_DIR=\""$(sysconfdir)"\" \2.8 -Ish4 \2.9 @PACKAGE_CFLAGS@2.11 @@ -148,7 +149,7 @@2.12 genglsl_SOURCES = tools/genglsl.c2.14 lxdream_SOURCES = \2.15 - main.c \2.16 + main.c config.c config.h \2.17 mem.c mem.h mmio.h watch.c \2.18 asic.c asic.h \2.19 syscall.c syscall.h bios.c dcload.c \2.20 @@ -173,7 +174,7 @@2.21 gui/debugif.c gui/debugif.h \2.22 gui/debugcb.c gui/debugcb.h \2.23 gui/mmr_win.c gui/debug_win.c gui/dump_win.c \2.24 - gui/ctrl_dlg.c \2.25 + gui/ctrl_dlg.c gui/path_dlg.c \2.26 loader.c bootstrap.c util.c \2.27 display.c display.h \2.28 drivers/audio_null.c drivers/audio_esd.c \2.29 @@ -221,8 +222,8 @@2.30 genglsl_OBJECTS = $(am_genglsl_OBJECTS)2.31 genglsl_DEPENDENCIES =2.32 genglsl_LDFLAGS =2.33 -am_lxdream_OBJECTS = main.$(OBJEXT) mem.$(OBJEXT) watch.$(OBJEXT) \2.34 - asic.$(OBJEXT) syscall.$(OBJEXT) bios.$(OBJEXT) \2.35 +am_lxdream_OBJECTS = main.$(OBJEXT) config.$(OBJEXT) mem.$(OBJEXT) \2.36 + watch.$(OBJEXT) asic.$(OBJEXT) syscall.$(OBJEXT) bios.$(OBJEXT) \2.37 dcload.$(OBJEXT) ide.$(OBJEXT) gdimage.$(OBJEXT) \2.38 gdrom.$(OBJEXT) nrg.$(OBJEXT) cdi.$(OBJEXT) linux.$(OBJEXT) \2.39 dreamcast.$(OBJEXT) eventq.$(OBJEXT) sh4.$(OBJEXT) \2.40 @@ -239,11 +240,12 @@2.41 controller.$(OBJEXT) gtkui.$(OBJEXT) main_win.$(OBJEXT) \2.42 gtkcb.$(OBJEXT) support.$(OBJEXT) debugif.$(OBJEXT) \2.43 debugcb.$(OBJEXT) mmr_win.$(OBJEXT) debug_win.$(OBJEXT) \2.44 - dump_win.$(OBJEXT) ctrl_dlg.$(OBJEXT) loader.$(OBJEXT) \2.45 - bootstrap.$(OBJEXT) util.$(OBJEXT) display.$(OBJEXT) \2.46 - audio_null.$(OBJEXT) audio_esd.$(OBJEXT) video_null.$(OBJEXT) \2.47 - video_gtk.$(OBJEXT) video_x11.$(OBJEXT) gl_common.$(OBJEXT) \2.48 - gl_fbo.$(OBJEXT) gl_sl.$(OBJEXT) gl_slsrc.$(OBJEXT)2.49 + dump_win.$(OBJEXT) ctrl_dlg.$(OBJEXT) path_dlg.$(OBJEXT) \2.50 + loader.$(OBJEXT) bootstrap.$(OBJEXT) util.$(OBJEXT) \2.51 + display.$(OBJEXT) audio_null.$(OBJEXT) audio_esd.$(OBJEXT) \2.52 + video_null.$(OBJEXT) video_gtk.$(OBJEXT) video_x11.$(OBJEXT) \2.53 + gl_common.$(OBJEXT) gl_fbo.$(OBJEXT) gl_sl.$(OBJEXT) \2.54 + gl_slsrc.$(OBJEXT)2.55 lxdream_OBJECTS = $(am_lxdream_OBJECTS)2.56 lxdream_DEPENDENCIES =2.57 lxdream_LDFLAGS =2.58 @@ -270,24 +272,25 @@2.59 @AMDEP_TRUE@ ./$(DEPDIR)/audio.Po ./$(DEPDIR)/audio_esd.Po \2.60 @AMDEP_TRUE@ ./$(DEPDIR)/audio_null.Po ./$(DEPDIR)/bios.Po \2.61 @AMDEP_TRUE@ ./$(DEPDIR)/bootstrap.Po ./$(DEPDIR)/cdi.Po \2.62 -@AMDEP_TRUE@ ./$(DEPDIR)/controller.Po ./$(DEPDIR)/ctrl_dlg.Po \2.63 -@AMDEP_TRUE@ ./$(DEPDIR)/dcload.Po ./$(DEPDIR)/debug_win.Po \2.64 -@AMDEP_TRUE@ ./$(DEPDIR)/debugcb.Po ./$(DEPDIR)/debugif.Po \2.65 -@AMDEP_TRUE@ ./$(DEPDIR)/dis-buf.Po ./$(DEPDIR)/dis-init.Po \2.66 -@AMDEP_TRUE@ ./$(DEPDIR)/display.Po ./$(DEPDIR)/dmac.Po \2.67 -@AMDEP_TRUE@ ./$(DEPDIR)/dreamcast.Po ./$(DEPDIR)/dump_win.Po \2.68 -@AMDEP_TRUE@ ./$(DEPDIR)/eventq.Po ./$(DEPDIR)/gdimage.Po \2.69 -@AMDEP_TRUE@ ./$(DEPDIR)/gdrom.Po ./$(DEPDIR)/gendec.Po \2.70 -@AMDEP_TRUE@ ./$(DEPDIR)/genglsl.Po ./$(DEPDIR)/gl_common.Po \2.71 -@AMDEP_TRUE@ ./$(DEPDIR)/gl_fbo.Po ./$(DEPDIR)/gl_sl.Po \2.72 -@AMDEP_TRUE@ ./$(DEPDIR)/gl_slsrc.Po ./$(DEPDIR)/gtkcb.Po \2.73 -@AMDEP_TRUE@ ./$(DEPDIR)/gtkui.Po ./$(DEPDIR)/i386-dis.Po \2.74 -@AMDEP_TRUE@ ./$(DEPDIR)/ide.Po ./$(DEPDIR)/insparse.Po \2.75 -@AMDEP_TRUE@ ./$(DEPDIR)/intc.Po ./$(DEPDIR)/linux.Po \2.76 -@AMDEP_TRUE@ ./$(DEPDIR)/loader.Po ./$(DEPDIR)/main.Po \2.77 -@AMDEP_TRUE@ ./$(DEPDIR)/main_win.Po ./$(DEPDIR)/maple.Po \2.78 -@AMDEP_TRUE@ ./$(DEPDIR)/mem.Po ./$(DEPDIR)/mmr_win.Po \2.79 -@AMDEP_TRUE@ ./$(DEPDIR)/nrg.Po ./$(DEPDIR)/pvr2.Po \2.80 +@AMDEP_TRUE@ ./$(DEPDIR)/config.Po ./$(DEPDIR)/controller.Po \2.81 +@AMDEP_TRUE@ ./$(DEPDIR)/ctrl_dlg.Po ./$(DEPDIR)/dcload.Po \2.82 +@AMDEP_TRUE@ ./$(DEPDIR)/debug_win.Po ./$(DEPDIR)/debugcb.Po \2.83 +@AMDEP_TRUE@ ./$(DEPDIR)/debugif.Po ./$(DEPDIR)/dis-buf.Po \2.84 +@AMDEP_TRUE@ ./$(DEPDIR)/dis-init.Po ./$(DEPDIR)/display.Po \2.85 +@AMDEP_TRUE@ ./$(DEPDIR)/dmac.Po ./$(DEPDIR)/dreamcast.Po \2.86 +@AMDEP_TRUE@ ./$(DEPDIR)/dump_win.Po ./$(DEPDIR)/eventq.Po \2.87 +@AMDEP_TRUE@ ./$(DEPDIR)/gdimage.Po ./$(DEPDIR)/gdrom.Po \2.88 +@AMDEP_TRUE@ ./$(DEPDIR)/gendec.Po ./$(DEPDIR)/genglsl.Po \2.89 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_common.Po ./$(DEPDIR)/gl_fbo.Po \2.90 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_sl.Po ./$(DEPDIR)/gl_slsrc.Po \2.91 +@AMDEP_TRUE@ ./$(DEPDIR)/gtkcb.Po ./$(DEPDIR)/gtkui.Po \2.92 +@AMDEP_TRUE@ ./$(DEPDIR)/i386-dis.Po ./$(DEPDIR)/ide.Po \2.93 +@AMDEP_TRUE@ ./$(DEPDIR)/insparse.Po ./$(DEPDIR)/intc.Po \2.94 +@AMDEP_TRUE@ ./$(DEPDIR)/linux.Po ./$(DEPDIR)/loader.Po \2.95 +@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/main_win.Po \2.96 +@AMDEP_TRUE@ ./$(DEPDIR)/maple.Po ./$(DEPDIR)/mem.Po \2.97 +@AMDEP_TRUE@ ./$(DEPDIR)/mmr_win.Po ./$(DEPDIR)/nrg.Po \2.98 +@AMDEP_TRUE@ ./$(DEPDIR)/path_dlg.Po ./$(DEPDIR)/pvr2.Po \2.99 @AMDEP_TRUE@ ./$(DEPDIR)/pvr2mem.Po ./$(DEPDIR)/rendbkg.Po \2.100 @AMDEP_TRUE@ ./$(DEPDIR)/rendcore.Po ./$(DEPDIR)/render.Po \2.101 @AMDEP_TRUE@ ./$(DEPDIR)/rendsave.Po ./$(DEPDIR)/rendsort.Po \2.102 @@ -386,6 +389,7 @@2.103 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bios.Po@am__quote@2.104 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootstrap.Po@am__quote@2.105 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi.Po@am__quote@2.106 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Po@am__quote@2.107 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controller.Po@am__quote@2.108 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrl_dlg.Po@am__quote@2.109 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dcload.Po@am__quote@2.110 @@ -421,6 +425,7 @@2.111 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Po@am__quote@2.112 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmr_win.Po@am__quote@2.113 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nrg.Po@am__quote@2.114 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path_dlg.Po@am__quote@2.115 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvr2.Po@am__quote@2.116 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvr2mem.Po@am__quote@2.117 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rendbkg.Po@am__quote@2.118 @@ -1663,6 +1668,28 @@2.119 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.120 @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.122 +path_dlg.o: gui/path_dlg.c2.123 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT path_dlg.o -MD -MP -MF "$(DEPDIR)/path_dlg.Tpo" \2.124 +@am__fastdepCC_TRUE@ -c -o path_dlg.o `test -f 'gui/path_dlg.c' || echo '$(srcdir)/'`gui/path_dlg.c; \2.125 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/path_dlg.Tpo" "$(DEPDIR)/path_dlg.Po"; \2.126 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/path_dlg.Tpo"; exit 1; \2.127 +@am__fastdepCC_TRUE@ fi2.128 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gui/path_dlg.c' object='path_dlg.o' libtool=no @AMDEPBACKSLASH@2.129 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/path_dlg.Po' tmpdepfile='$(DEPDIR)/path_dlg.TPo' @AMDEPBACKSLASH@2.130 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.131 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o path_dlg.o `test -f 'gui/path_dlg.c' || echo '$(srcdir)/'`gui/path_dlg.c2.132 +2.133 +path_dlg.obj: gui/path_dlg.c2.134 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT path_dlg.obj -MD -MP -MF "$(DEPDIR)/path_dlg.Tpo" \2.135 +@am__fastdepCC_TRUE@ -c -o path_dlg.obj `if test -f 'gui/path_dlg.c'; then $(CYGPATH_W) 'gui/path_dlg.c'; else $(CYGPATH_W) '$(srcdir)/gui/path_dlg.c'; fi`; \2.136 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/path_dlg.Tpo" "$(DEPDIR)/path_dlg.Po"; \2.137 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/path_dlg.Tpo"; exit 1; \2.138 +@am__fastdepCC_TRUE@ fi2.139 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gui/path_dlg.c' object='path_dlg.obj' libtool=no @AMDEPBACKSLASH@2.140 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/path_dlg.Po' tmpdepfile='$(DEPDIR)/path_dlg.TPo' @AMDEPBACKSLASH@2.141 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@2.142 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o path_dlg.obj `if test -f 'gui/path_dlg.c'; then $(CYGPATH_W) 'gui/path_dlg.c'; else $(CYGPATH_W) '$(srcdir)/gui/path_dlg.c'; fi`2.143 +2.144 audio_null.o: drivers/audio_null.c2.145 @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.146 @am__fastdepCC_TRUE@ -c -o audio_null.o `test -f 'drivers/audio_null.c' || echo '$(srcdir)/'`drivers/audio_null.c; \
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00003.2 +++ b/src/config.c Wed Oct 17 11:26:45 2007 +00003.3 @@ -0,0 +1,294 @@3.4 +/**3.5 + * $Id: config.c,v 1.1 2007-10-17 11:26:45 nkeynes Exp $3.6 + *3.7 + * User configuration support3.8 + *3.9 + * Copyright (c) 2005 Nathan Keynes.3.10 + *3.11 + * This program is free software; you can redistribute it and/or modify3.12 + * it under the terms of the GNU General Public License as published by3.13 + * the Free Software Foundation; either version 2 of the License, or3.14 + * (at your option) any later version.3.15 + *3.16 + * This program is distributed in the hope that it will be useful,3.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of3.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3.19 + * GNU General Public License for more details.3.20 + */3.21 +3.22 +#include <unistd.h>3.23 +#include <stdio.h>3.24 +#include <errno.h>3.25 +#include <stdlib.h>3.26 +#include <string.h>3.27 +#include <glib/gstrfuncs.h>3.28 +#include "dream.h"3.29 +#include "config.h"3.30 +#include "maple/maple.h"3.31 +3.32 +gboolean lxdream_load_config_file( const gchar *filename );3.33 +gboolean lxdream_save_config_file( const gchar *filename );3.34 +gboolean lxdream_load_config_stream( FILE *f );3.35 +gboolean lxdream_save_config_stream( FILE *f );3.36 +3.37 +static struct lxdream_config_entry global_config[] =3.38 + {{ "bios", CONFIG_TYPE_FILE, "dcboot.rom" },3.39 + { "flash", CONFIG_TYPE_FILE, "dcflash.rom" },3.40 + { "default path", CONFIG_TYPE_PATH, "." },3.41 + { "save path", CONFIG_TYPE_PATH, "save" },3.42 + { "bootstrap", CONFIG_TYPE_FILE, "IP.BIN" },3.43 + { NULL, CONFIG_TYPE_NONE }};3.44 +3.45 +static struct lxdream_config_entry serial_config[] =3.46 + {{ "device", CONFIG_TYPE_FILE, "/dev/ttyS1" },3.47 + { NULL, CONFIG_TYPE_NONE }};3.48 +3.49 +struct lxdream_config_group lxdream_config_root[] =3.50 + {{ "global", global_config },3.51 + { "controllers", NULL },3.52 + { "serial", serial_config },3.53 + { NULL, CONFIG_TYPE_NONE }};3.54 +3.55 +static gchar *lxdream_config_load_filename = NULL;3.56 +static gchar *lxdream_config_save_filename = NULL;3.57 +3.58 +gboolean lxdream_find_config()3.59 +{3.60 + char *home = getenv("HOME");3.61 + if( lxdream_config_save_filename == NULL ) {3.62 + lxdream_config_save_filename = g_strdup_printf("%s/.%s", home, DEFAULT_CONFIG_FILENAME);3.63 + }3.64 + if( lxdream_config_load_filename == NULL ) {3.65 + if( access(lxdream_config_save_filename, R_OK) == 0 ) {3.66 + lxdream_config_load_filename = g_strdup(lxdream_config_save_filename);3.67 + } else if( access( PACKAGE_CONF_DIR "/" DEFAULT_CONFIG_FILENAME, R_OK ) == 0 ) {3.68 + lxdream_config_load_filename = g_strdup(PACKAGE_CONF_DIR "/" DEFAULT_CONFIG_FILENAME);3.69 + } else if( access( "./" DEFAULT_CONFIG_FILENAME, R_OK ) == 0 ) {3.70 + lxdream_config_load_filename = g_strdup("./" DEFAULT_CONFIG_FILENAME);3.71 + } else {3.72 + lxdream_config_load_filename = g_strdup(lxdream_config_save_filename);3.73 + }3.74 + }3.75 +}3.76 +3.77 +void lxdream_set_config_filename( const gchar *filename )3.78 +{3.79 + if( lxdream_config_load_filename != NULL ) {3.80 + g_free(lxdream_config_load_filename);3.81 + }3.82 + lxdream_config_load_filename = g_strdup(filename);3.83 + if( lxdream_config_save_filename != NULL ) {3.84 + g_free(lxdream_config_save_filename);3.85 + }3.86 + lxdream_config_save_filename = g_strdup(filename);3.87 +}3.88 +3.89 +void lxdream_set_default_config( )3.90 +{3.91 + struct lxdream_config_group *group = lxdream_config_root;3.92 + while( group->key != NULL ) {3.93 + struct lxdream_config_entry *param = group->params;3.94 + if( param != NULL ) {3.95 + while( param->key != NULL ) {3.96 + if( param->value != param->default_value ) {3.97 + if( param->value != NULL )3.98 + free( param->value );3.99 + param->value = (gchar *)param->default_value;3.100 + }3.101 + param++;3.102 + }3.103 + }3.104 + group++;3.105 + }3.106 + maple_detach_all();3.107 +}3.108 +3.109 +const gchar *lxdream_get_config_value( int key )3.110 +{3.111 + return global_config[key].value;3.112 +}3.113 +3.114 +void lxdream_set_config_value( int key, const gchar *value )3.115 +{3.116 + struct lxdream_config_entry *param = &global_config[key];3.117 + if( param->value != param->default_value && param->value != NULL ) {3.118 + free( param->value );3.119 + }3.120 + param->value = g_strdup(value);3.121 +}3.122 +3.123 +gboolean lxdream_load_config( )3.124 +{3.125 + if( lxdream_config_load_filename == NULL ) {3.126 + lxdream_find_config();3.127 + }3.128 + return lxdream_load_config_file(lxdream_config_load_filename);3.129 +}3.130 +3.131 +gboolean lxdream_save_config( )3.132 +{3.133 + if( lxdream_config_save_filename == NULL ) {3.134 + lxdream_find_config();3.135 + }3.136 + return lxdream_save_config_file(lxdream_config_save_filename);3.137 +}3.138 +3.139 +gboolean lxdream_load_config_file( const gchar *filename )3.140 +{3.141 + FILE *f;3.142 + gboolean result;3.143 +3.144 + if( access(filename, F_OK) != 0 ) {3.145 + INFO( "Configuration file '%s' does not exist, creating from defaults" );3.146 + lxdream_set_default_config();3.147 + lxdream_save_config();3.148 + }3.149 +3.150 + f = fopen(filename, "ro");3.151 + if( f == NULL ) {3.152 + ERROR( "Unable to open configuration file '%s': %s", filename, strerror(errno) );3.153 + lxdream_set_default_config();3.154 + return FALSE;3.155 + }3.156 +3.157 + result = lxdream_load_config_stream( f );3.158 + fclose(f);3.159 + return result;3.160 +}3.161 +3.162 +gboolean lxdream_load_config_stream( FILE *f )3.163 +{3.164 +3.165 + char buf[512];3.166 + int maple_device = -1, maple_subdevice = -1;3.167 + struct lxdream_config_group devgroup;3.168 + struct lxdream_config_group *group = NULL;3.169 + maple_device_t device = NULL;3.170 + lxdream_set_default_config();3.171 +3.172 + while( fgets( buf, sizeof(buf), f ) != NULL ) {3.173 + g_strstrip(buf);3.174 + if( buf[0] == '#' )3.175 + continue;3.176 + if( *buf == '[' ) {3.177 + char *p = strchr(buf, ']');3.178 + if( p != NULL ) {3.179 + struct lxdream_config_group *tmp_group;3.180 + maple_device = maple_subdevice = -1;3.181 + *p = '\0';3.182 + g_strstrip(buf+1);3.183 + tmp_group = &lxdream_config_root[0];3.184 + while( tmp_group->key != NULL ) {3.185 + if( strcasecmp(tmp_group->key, buf+1) == 0 ) {3.186 + group = tmp_group;3.187 + break;3.188 + }3.189 + tmp_group++;3.190 + }3.191 + }3.192 + } else if( group != NULL ) {3.193 + char *value = strchr( buf, '=' );3.194 + if( value != NULL ) {3.195 + struct lxdream_config_entry *param = group->params;3.196 + *value = '\0';3.197 + value++;3.198 + g_strstrip(buf);3.199 + g_strstrip(value);3.200 + if( strcmp(group->key,"controllers") == 0 ) {3.201 + if( g_strncasecmp( buf, "device ", 7 ) == 0 ) {3.202 + maple_device = strtoul( buf+7, NULL, 0 );3.203 + if( maple_device < 0 || maple_device > 3 ) {3.204 + ERROR( "Device number must be between 0..3 (not '%s')", buf+7);3.205 + continue;3.206 + }3.207 + maple_subdevice = 0;3.208 + device = maple_new_device( value );3.209 + if( device == NULL ) {3.210 + ERROR( "Unrecognized device '%s'", value );3.211 + } else {3.212 + devgroup.key = "controllers";3.213 + devgroup.params = maple_get_device_config(device);3.214 + maple_attach_device( device, maple_device, maple_subdevice );3.215 + group = &devgroup;3.216 + }3.217 + continue;3.218 + } else if( g_strncasecmp( buf, "subdevice ", 10 ) == 0 ) {3.219 + maple_subdevice = strtoul( buf+10, NULL, 0 );3.220 + if( maple_device == -1 ) {3.221 + ERROR( "Subdevice not allowed without primary device" );3.222 + } else if( maple_subdevice < 1 || maple_subdevice > 5 ) {3.223 + ERROR( "Subdevice must be between 1..5 (not '%s')", buf+10 );3.224 + } else if( (device = maple_new_device(value)) == NULL ) {3.225 + ERROR( "Unrecognized subdevice '%s'", value );3.226 + } else {3.227 + devgroup.key = "controllers";3.228 + devgroup.params = maple_get_device_config(device);3.229 + maple_attach_device( device, maple_device, maple_subdevice );3.230 + group = &devgroup;3.231 + }3.232 + continue;3.233 + }3.234 + }3.235 + while( param->key != NULL ) {3.236 + if( strcasecmp( param->key, buf ) == 0 ) {3.237 + param->value = g_strdup(value);3.238 + break;3.239 + }3.240 + param++;3.241 + }3.242 + }3.243 + }3.244 + }3.245 + return TRUE;3.246 +}3.247 +3.248 +gboolean lxdream_save_config_file( const gchar *filename )3.249 +{3.250 + FILE *f = fopen(filename, "wo");3.251 + gboolean result;3.252 + if( f == NULL ) {3.253 + ERROR( "Unable to open '%s': %s", filename, strerror(errno) );3.254 + return FALSE;3.255 + }3.256 + result = lxdream_save_config_stream(f);3.257 + fclose(f);3.258 + return TRUE;3.259 +}3.260 +3.261 +gboolean lxdream_save_config_stream( FILE *f )3.262 +{3.263 + struct lxdream_config_group *group = &lxdream_config_root[0];3.264 +3.265 + while( group->key != NULL ) {3.266 + struct lxdream_config_entry *entry = group->params;3.267 + fprintf( f, "[%s]\n", group->key );3.268 +3.269 + if( entry != NULL ) {3.270 + while( entry->key != NULL ) {3.271 + fprintf( f, "%s = %s\n", entry->key, entry->value );3.272 + entry++;3.273 + }3.274 + } else if( strcmp(group->key, "controllers") == 0 ) {3.275 + int i,j;3.276 + for( i=0; i<4; i++ ) {3.277 + for( j=0; j<6; j++ ) {3.278 + maple_device_t dev = maple_get_device( i, j );3.279 + if( dev != NULL ) {3.280 + if( j == 0 )3.281 + fprintf( f, "Device %d = %s\n", i, dev->device_class->name );3.282 + else3.283 + fprintf( f, "Subdevice %d = %s\n", j, dev->device_class->name );3.284 + entry = dev->get_config(dev);3.285 + while( entry->key != NULL ) {3.286 + fprintf( f, "%*c%s = %s\n", j==0?4:8, ' ',entry->key, entry->value );3.287 + entry++;3.288 + }3.289 + }3.290 + }3.291 + }3.292 + }3.293 + fprintf( f, "\n" );3.294 + group++;3.295 + }3.296 + return TRUE;3.297 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00004.2 +++ b/src/config.h Wed Oct 17 11:26:45 2007 +00004.3 @@ -0,0 +1,83 @@4.4 +/**4.5 + * $Id: config.h,v 1.1 2007-10-17 11:26:45 nkeynes Exp $4.6 + *4.7 + * User configuration support4.8 + *4.9 + * Copyright (c) 2005 Nathan Keynes.4.10 + *4.11 + * This program is free software; you can redistribute it and/or modify4.12 + * it under the terms of the GNU General Public License as published by4.13 + * the Free Software Foundation; either version 2 of the License, or4.14 + * (at your option) any later version.4.15 + *4.16 + * This program is distributed in the hope that it will be useful,4.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of4.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4.19 + * GNU General Public License for more details.4.20 + */4.21 +4.22 +#ifndef lxdream_config_H4.23 +#define lxdream_config_H 14.24 +4.25 +#include <glib/gtypes.h>4.26 +4.27 +#define CONFIG_TYPE_NONE 04.28 +#define CONFIG_TYPE_FILE 14.29 +#define CONFIG_TYPE_PATH 24.30 +#define CONFIG_TYPE_KEY 34.31 +4.32 +#define DEFAULT_CONFIG_FILENAME "lxdreamrc"4.33 +4.34 +typedef struct lxdream_config_entry {4.35 + const gchar *key;4.36 + const int type;4.37 + const gchar *default_value;4.38 + gchar *value;4.39 +} *lxdream_config_entry_t;4.40 +4.41 +typedef struct lxdream_config_group {4.42 + const gchar *key;4.43 + struct lxdream_config_entry *params;4.44 +} *lxdream_config_group_t;4.45 +4.46 +#define CONFIG_BIOS_PATH 04.47 +#define CONFIG_FLASH_PATH 14.48 +#define CONFIG_DEFAULT_PATH 24.49 +#define CONFIG_SAVE_PATH 34.50 +#define CONFIG_BOOTSTRAP 44.51 +4.52 +extern struct lxdream_config_group lxdream_config_root[];4.53 +4.54 +/* Global config values */4.55 +const gchar *lxdream_get_config_value( int key );4.56 +4.57 +void lxdream_set_config_value( int key, const gchar *value );4.58 +4.59 +/**4.60 + * Search the standard locations for the configuration file:4.61 + * $HOME/.lxdreamrc4.62 + * $CWD/lxdreamrc4.63 + * $SYSCONF_DIR/lxdreamrc4.64 + * @return TRUE if the file was found, otherwise FALSE.4.65 + */4.66 +gboolean lxdream_find_config( );4.67 +4.68 +/**4.69 + * Set the configuration file filename to the supplied string.4.70 + * The string is copied internally (ie can be released by the4.71 + * caller).4.72 + */4.73 +void lxdream_set_config_filename( const gchar *filename );4.74 +4.75 +/**4.76 + * Load the configuration from the previously determined filename.4.77 + */4.78 +gboolean lxdream_load_config( );4.79 +4.80 +/**4.81 + * Update the configuration4.82 + */4.83 +gboolean lxdream_save_config( );4.84 +4.85 +4.86 +#endif /* !lxdream_config_H */
5.1 --- a/src/dreamcast.c Tue Oct 16 12:38:01 2007 +00005.2 +++ b/src/dreamcast.c Wed Oct 17 11:26:45 2007 +00005.3 @@ -1,5 +1,5 @@5.4 /**5.5 - * $Id: dreamcast.c,v 1.23 2007-10-06 08:59:42 nkeynes Exp $5.6 + * $Id: dreamcast.c,v 1.24 2007-10-17 11:26:45 nkeynes Exp $5.7 * Central switchboard for the system. This pulls all the individual modules5.8 * together into some kind of coherent structure. This is also where you'd5.9 * add Naomi support, if I ever get a board to play with...5.10 @@ -18,8 +18,8 @@5.11 */5.13 #include <errno.h>5.14 -#include <glib/gstrfuncs.h>5.15 #include "dream.h"5.16 +#include "config.h"5.17 #include "mem.h"5.18 #include "aica/aica.h"5.19 #include "asic.h"5.20 @@ -67,13 +67,13 @@5.21 mem_create_ram_region( 0x00800000, 2 MB, MEM_REGION_AUDIO );5.22 mem_create_ram_region( 0x00703000, 8 KB, MEM_REGION_AUDIO_SCRATCH );5.23 mem_create_ram_region( 0x05000000, 8 MB, MEM_REGION_VIDEO );5.24 - if( mem_load_rom( dreamcast_get_config_value(CONFIG_BIOS_PATH),5.25 + if( mem_load_rom( lxdream_get_config_value(CONFIG_BIOS_PATH),5.26 0x00000000, 0x00200000, 0x89f2b1a1 ) == NULL ) {5.27 /* Bios wasn't found. Dump an empty ram region in there for something to do */5.28 mem_create_ram_region( 0x00000000, 0x00200000, MEM_REGION_BIOS );5.29 }5.30 mem_create_ram_region( 0x00200000, 0x00020000, MEM_REGION_FLASH );5.31 - mem_load_block( dreamcast_get_config_value(CONFIG_FLASH_PATH),5.32 + mem_load_block( lxdream_get_config_value(CONFIG_FLASH_PATH),5.33 0x00200000, 0x00020000 );5.35 /* Load in the rest of the core modules */5.36 @@ -87,7 +87,7 @@5.38 void dreamcast_save_flash()5.39 {5.40 - const char *file = dreamcast_get_config_value(CONFIG_FLASH_PATH);5.41 + const char *file = lxdream_get_config_value(CONFIG_FLASH_PATH);5.42 mem_save_block( file, 0x00200000, 0x00020000 );5.43 }5.45 @@ -207,204 +207,6 @@5.46 return dreamcast_state == STATE_RUNNING;5.47 }5.49 -/***************************** User Configuration **************************/5.50 -5.51 -5.52 -static struct dreamcast_config_entry global_config[] =5.53 - {{ "bios", CONFIG_TYPE_FILE, "dcboot.rom" },5.54 - { "flash", CONFIG_TYPE_FILE, "dcflash.rom" },5.55 - { "default path", CONFIG_TYPE_PATH, "." },5.56 - { "save path", CONFIG_TYPE_PATH, "save" },5.57 - { "bootstrap", CONFIG_TYPE_FILE, "IP.BIN" },5.58 - { NULL, CONFIG_TYPE_NONE }};5.59 -5.60 -static struct dreamcast_config_entry serial_config[] =5.61 - {{ "device", CONFIG_TYPE_FILE, "/dev/ttyS1" },5.62 - { NULL, CONFIG_TYPE_NONE }};5.63 -5.64 -struct dreamcast_config_group dreamcast_config_root[] =5.65 - {{ "global", global_config },5.66 - { "controllers", NULL },5.67 - { "serial", serial_config },5.68 - { NULL, CONFIG_TYPE_NONE }};5.69 -5.70 -void dreamcast_set_default_config( )5.71 -{5.72 - struct dreamcast_config_group *group = dreamcast_config_root;5.73 - while( group->key != NULL ) {5.74 - struct dreamcast_config_entry *param = group->params;5.75 - if( param != NULL ) {5.76 - while( param->key != NULL ) {5.77 - if( param->value != param->default_value ) {5.78 - if( param->value != NULL )5.79 - free( param->value );5.80 - param->value = (gchar *)param->default_value;5.81 - }5.82 - param++;5.83 - }5.84 - }5.85 - group++;5.86 - }5.87 - maple_detach_all();5.88 -}5.89 -5.90 -const gchar *dreamcast_get_config_value( int key )5.91 -{5.92 - return global_config[key].value;5.93 -}5.94 -5.95 -gboolean dreamcast_load_config( const gchar *filename )5.96 -{5.97 - FILE *f = fopen(filename, "ro");5.98 - gboolean result;5.99 -5.100 - if( f == NULL ) {5.101 - ERROR( "Unable to open '%s': %s", filename, strerror(errno) );5.102 - return FALSE;5.103 - }5.104 -5.105 - result = dreamcast_load_config_stream( f );5.106 - fclose(f);5.107 - return result;5.108 -}5.109 -5.110 -gboolean dreamcast_load_config_stream( FILE *f )5.111 -{5.112 -5.113 - char buf[512];5.114 - int maple_device = -1, maple_subdevice = -1;5.115 - struct dreamcast_config_group devgroup;5.116 - struct dreamcast_config_group *group = NULL;5.117 - maple_device_t device = NULL;5.118 - dreamcast_set_default_config();5.119 -5.120 - while( fgets( buf, sizeof(buf), f ) != NULL ) {5.121 - g_strstrip(buf);5.122 - if( buf[0] == '#' )5.123 - continue;5.124 - if( *buf == '[' ) {5.125 - char *p = strchr(buf, ']');5.126 - if( p != NULL ) {5.127 - struct dreamcast_config_group *tmp_group;5.128 - maple_device = maple_subdevice = -1;5.129 - *p = '\0';5.130 - g_strstrip(buf+1);5.131 - tmp_group = &dreamcast_config_root[0];5.132 - while( tmp_group->key != NULL ) {5.133 - if( strcasecmp(tmp_group->key, buf+1) == 0 ) {5.134 - group = tmp_group;5.135 - break;5.136 - }5.137 - tmp_group++;5.138 - }5.139 - }5.140 - } else if( group != NULL ) {5.141 - char *value = strchr( buf, '=' );5.142 - if( value != NULL ) {5.143 - struct dreamcast_config_entry *param = group->params;5.144 - *value = '\0';5.145 - value++;5.146 - g_strstrip(buf);5.147 - g_strstrip(value);5.148 - if( strcmp(group->key,"controllers") == 0 ) {5.149 - if( g_strncasecmp( buf, "device ", 7 ) == 0 ) {5.150 - maple_device = strtoul( buf+7, NULL, 0 );5.151 - if( maple_device < 0 || maple_device > 3 ) {5.152 - ERROR( "Device number must be between 0..3 (not '%s')", buf+7);5.153 - continue;5.154 - }5.155 - maple_subdevice = 0;5.156 - device = maple_new_device( value );5.157 - if( device == NULL ) {5.158 - ERROR( "Unrecognized device '%s'", value );5.159 - } else {5.160 - devgroup.key = "controllers";5.161 - devgroup.params = maple_get_device_config(device);5.162 - maple_attach_device( device, maple_device, maple_subdevice );5.163 - group = &devgroup;5.164 - }5.165 - continue;5.166 - } else if( g_strncasecmp( buf, "subdevice ", 10 ) == 0 ) {5.167 - maple_subdevice = strtoul( buf+10, NULL, 0 );5.168 - if( maple_device == -1 ) {5.169 - ERROR( "Subdevice not allowed without primary device" );5.170 - } else if( maple_subdevice < 1 || maple_subdevice > 5 ) {5.171 - ERROR( "Subdevice must be between 1..5 (not '%s')", buf+10 );5.172 - } else if( (device = maple_new_device(value)) == NULL ) {5.173 - ERROR( "Unrecognized subdevice '%s'", value );5.174 - } else {5.175 - devgroup.key = "controllers";5.176 - devgroup.params = maple_get_device_config(device);5.177 - maple_attach_device( device, maple_device, maple_subdevice );5.178 - group = &devgroup;5.179 - }5.180 - continue;5.181 - }5.182 - }5.183 - while( param->key != NULL ) {5.184 - if( strcasecmp( param->key, buf ) == 0 ) {5.185 - param->value = g_strdup(value);5.186 - break;5.187 - }5.188 - param++;5.189 - }5.190 - }5.191 - }5.192 - }5.193 - return TRUE;5.194 -}5.195 -5.196 -gboolean dreamcast_save_config( const gchar *filename )5.197 -{5.198 - FILE *f = fopen(filename, "wo");5.199 - gboolean result;5.200 - if( f == NULL ) {5.201 - ERROR( "Unable to open '%s': %s", filename, strerror(errno) );5.202 - return FALSE;5.203 - }5.204 - result = dreamcast_save_config_stream(f);5.205 - fclose(f);5.206 - return TRUE;5.207 -}5.208 -5.209 -gboolean dreamcast_save_config_stream( FILE *f )5.210 -{5.211 - struct dreamcast_config_group *group = &dreamcast_config_root[0];5.212 -5.213 - while( group->key != NULL ) {5.214 - struct dreamcast_config_entry *entry = group->params;5.215 - fprintf( f, "[%s]\n", group->key );5.216 -5.217 - if( entry != NULL ) {5.218 - while( entry->key != NULL ) {5.219 - fprintf( f, "%s = %s\n", entry->key, entry->value );5.220 - entry++;5.221 - }5.222 - } else if( strcmp(group->key, "controllers") == 0 ) {5.223 - int i,j;5.224 - for( i=0; i<4; i++ ) {5.225 - for( j=0; j<6; j++ ) {5.226 - maple_device_t dev = maple_get_device( i, j );5.227 - if( dev != NULL ) {5.228 - if( j == 0 )5.229 - fprintf( f, "Device %d = %s\n", i, dev->device_class->name );5.230 - else5.231 - fprintf( f, "Subdevice %d = %s\n", j, dev->device_class->name );5.232 - entry = dev->get_config(dev);5.233 - while( entry->key != NULL ) {5.234 - fprintf( f, "%*c%s = %s\n", j==0?4:8, ' ',entry->key, entry->value );5.235 - entry++;5.236 - }5.237 - }5.238 - }5.239 - }5.240 - }5.241 - fprintf( f, "\n" );5.242 - group++;5.243 - }5.244 - return TRUE;5.245 -}5.246 -5.247 /********************************* Save States *****************************/5.249 struct save_state_header {
6.1 --- a/src/dreamcast.h Tue Oct 16 12:38:01 2007 +00006.2 +++ b/src/dreamcast.h Wed Oct 17 11:26:45 2007 +00006.3 @@ -1,5 +1,5 @@6.4 /**6.5 - * $Id: dreamcast.h,v 1.17 2007-10-09 08:12:29 nkeynes Exp $6.6 + * $Id: dreamcast.h,v 1.18 2007-10-17 11:26:45 nkeynes Exp $6.7 *6.8 * Public interface for dreamcast.c -6.9 * Central switchboard for the system. This pulls all the individual modules6.10 @@ -38,25 +38,6 @@6.11 #define XLAT_TEMP_CACHE_SIZE 2 MB6.12 #define XLAT_OLD_CACHE_SIZE 8 MB6.14 -#define CONFIG_TYPE_NONE 06.15 -#define CONFIG_TYPE_FILE 16.16 -#define CONFIG_TYPE_PATH 26.17 -#define CONFIG_TYPE_KEY 36.18 -6.19 -#define DEFAULT_CONFIG_FILENAME "lxdream.rc"6.20 -6.21 -typedef struct dreamcast_config_entry {6.22 - const gchar *key;6.23 - const int type;6.24 - const gchar *default_value;6.25 - gchar *value;6.26 -} *dreamcast_config_entry_t;6.27 -6.28 -typedef struct dreamcast_config_group {6.29 - const gchar *key;6.30 - struct dreamcast_config_entry *params;6.31 -} *dreamcast_config_group_t;6.32 -6.33 void dreamcast_configure(void);6.34 void dreamcast_configure_aica_only(void);6.35 void dreamcast_init(void);6.36 @@ -67,11 +48,6 @@6.37 void dreamcast_shutdown(void);6.38 gboolean dreamcast_is_running(void);6.40 -gboolean dreamcast_load_config( const gchar *filename );6.41 -gboolean dreamcast_save_config( const gchar *filename );6.42 -gboolean dreamcast_load_config_stream( FILE *f );6.43 -gboolean dreamcast_save_config_stream( FILE *f );6.44 -6.45 #define DREAMCAST_SAVE_MAGIC "%!-lxDream!Save\0"6.46 #define DREAMCAST_SAVE_VERSION 0x000100006.48 @@ -81,16 +57,6 @@6.49 #define SCENE_SAVE_MAGIC "%!-lxDream!Scene"6.50 #define SCENE_SAVE_VERSION 0x000100006.52 -extern struct dreamcast_config_group dreamcast_config_root[];6.53 -6.54 -/* Global config values */6.55 -const gchar *dreamcast_get_config_value( int key );6.56 -#define CONFIG_BIOS_PATH 06.57 -#define CONFIG_FLASH_PATH 16.58 -#define CONFIG_DEFAULT_PATH 26.59 -#define CONFIG_SAVE_PATH 36.60 -#define CONFIG_BOOTSTRAP 46.61 -6.62 #ifdef __cplusplus6.63 }6.64 #endif
7.1 --- a/src/gui/ctrl_dlg.c Tue Oct 16 12:38:01 2007 +00007.2 +++ b/src/gui/ctrl_dlg.c Wed Oct 17 11:26:45 2007 +00007.3 @@ -1,5 +1,5 @@7.4 /**7.5 - * $Id: ctrl_dlg.c,v 1.1 2007-10-16 12:36:29 nkeynes Exp $7.6 + * $Id: ctrl_dlg.c,v 1.2 2007-10-17 11:26:45 nkeynes Exp $7.7 *7.8 * Define the main (emu) GTK window, along with its menubars,7.9 * toolbars, etc.7.10 @@ -79,7 +79,7 @@7.11 }7.12 }7.13 }7.14 - dreamcast_save_config("testrc");7.15 + lxdream_save_config();7.16 }7.18 void controller_cancel_changes( )7.19 @@ -93,7 +93,7 @@7.20 }7.21 }7.23 -GtkWidget *controller_pane_new()7.24 +GtkWidget *controller_panel_new()7.25 {7.26 GtkWidget *table = gtk_table_new(4, 3, TRUE);7.27 GtkTreeIter iter;7.28 @@ -125,7 +125,7 @@7.29 maple_data[i].new_device = device;7.30 maple_data[i].combo = combo;7.31 maple_data[i].button = button;7.32 - g_signal_connect( button, "activate",7.33 + g_signal_connect( button, "clicked",7.34 G_CALLBACK( controller_properties_activated ), &maple_data[i] );7.35 g_signal_connect( combo, "changed",7.36 G_CALLBACK( controller_device_changed ), &maple_data[i] );7.37 @@ -136,18 +136,7 @@7.39 void controller_dialog_run( GtkWindow *parent )7.40 {7.41 - GtkWidget *dialog =7.42 - gtk_dialog_new_with_buttons("Controller Settings", parent,7.43 - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,7.44 - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,7.45 - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,7.46 - NULL);7.47 - GtkWidget *panel = controller_pane_new();7.48 - gint result;7.49 - gtk_widget_show_all(panel);7.50 - gtk_container_add( GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), panel );7.51 - result = gtk_dialog_run( GTK_DIALOG(dialog) );7.52 - gtk_widget_destroy( dialog );7.53 + gint result = gtk_gui_run_property_dialog( "Controller Settings", controller_panel_new() );7.54 if( result == GTK_RESPONSE_ACCEPT ) {7.55 controller_commit_changes();7.56 } else {
8.1 --- a/src/gui/debugcb.c Tue Oct 16 12:38:01 2007 +00008.2 +++ b/src/gui/debugcb.c Wed Oct 17 11:26:45 2007 +00008.3 @@ -1,5 +1,5 @@8.4 /**8.5 - * $Id: debugcb.c,v 1.1 2007-10-10 11:02:04 nkeynes Exp $8.6 + * $Id: debugcb.c,v 1.2 2007-10-17 11:26:45 nkeynes Exp $8.7 *8.8 * All GTK callbacks go here (stubs are autogenerated by Glade)8.9 *8.10 @@ -16,12 +16,9 @@8.11 * GNU General Public License for more details.8.12 */8.14 -#ifdef HAVE_CONFIG_H8.15 -# include <config.h>8.16 -#endif8.17 -8.18 #include <gnome.h>8.20 +#include "config.h"8.21 #include "gui/debugcb.h"8.22 #include "gui/debugif.h"8.23 #include "gui/gtkui.h"8.24 @@ -49,7 +46,7 @@8.25 on_open1_activate (GtkMenuItem *menuitem,8.26 gpointer user_data)8.27 {8.28 - const gchar *dir = dreamcast_get_config_value(CONFIG_DEFAULT_PATH);8.29 + const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);8.30 open_file_dialog( "Open...", file_load_magic, NULL, NULL, dir );8.31 }8.33 @@ -73,7 +70,7 @@8.34 on_save_next_scene_activate( GtkMenuItem *menuitem,8.35 gpointer user_data)8.36 {8.37 - const gchar *dir = dreamcast_get_config_value(CONFIG_SAVE_PATH);8.38 + const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);8.39 save_file_dialog( "Save next scene...", pvr2_save_next_scene, "*.dsc", "lxdream scene file (*.dsc)", dir );8.40 }8.42 @@ -106,7 +103,7 @@8.43 on_load_btn_clicked (GtkButton *button,8.44 gpointer user_data)8.45 {8.46 - const gchar *dir = dreamcast_get_config_value(CONFIG_DEFAULT_PATH);8.47 + const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);8.48 open_file_dialog( "Open...", gdrom_mount_image, NULL, NULL, dir );8.49 }8.51 @@ -344,7 +341,7 @@8.52 on_loadstate_button_clicked (GtkToolButton *toolbutton,8.53 gpointer user_data)8.54 {8.55 - const gchar *dir = dreamcast_get_config_value(CONFIG_SAVE_PATH);8.56 + const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);8.57 open_file_dialog( "Load state...", dreamcast_load_state, "*.dst", "lxDream Save State (*.dst)", dir );8.58 }8.60 @@ -353,7 +350,7 @@8.61 on_savestate_button_clicked (GtkToolButton *toolbutton,8.62 gpointer user_data)8.63 {8.64 - const gchar *dir = dreamcast_get_config_value(CONFIG_SAVE_PATH);8.65 + const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);8.66 save_file_dialog( "Save state...", dreamcast_save_state, "*.dst", "lxDream Save State (*.dst)", dir );8.67 }
9.1 --- a/src/gui/gtkcb.c Tue Oct 16 12:38:01 2007 +00009.2 +++ b/src/gui/gtkcb.c Wed Oct 17 11:26:45 2007 +00009.3 @@ -1,5 +1,5 @@9.4 /**9.5 - * $Id: gtkcb.c,v 1.3 2007-10-16 12:36:29 nkeynes Exp $9.6 + * $Id: gtkcb.c,v 1.4 2007-10-17 11:26:45 nkeynes Exp $9.7 *9.8 * Action callbacks from the main window9.9 *9.10 @@ -17,6 +17,7 @@9.11 */9.13 #include "dream.h"9.14 +#include "config.h"9.15 #include "dreamcast.h"9.16 #include "gdrom/gdrom.h"9.17 #include "gui/gtkui.h"9.18 @@ -113,7 +114,7 @@9.20 void mount_action_callback( GtkAction *action, gpointer user_data)9.21 {9.22 - const gchar *dir = dreamcast_get_config_value(CONFIG_DEFAULT_PATH);9.23 + const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);9.24 open_file_dialog( "Open...", gdrom_mount_image, NULL, NULL, dir );9.25 }9.26 void reset_action_callback( GtkAction *action, gpointer user_data)9.27 @@ -133,12 +134,12 @@9.29 void load_state_action_callback( GtkAction *action, gpointer user_data)9.30 {9.31 - const gchar *dir = dreamcast_get_config_value(CONFIG_SAVE_PATH);9.32 + const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);9.33 open_file_dialog( "Load state...", dreamcast_load_state, "*.dst", "lxDream Save State (*.dst)", dir );9.34 }9.35 void save_state_action_callback( GtkAction *action, gpointer user_data)9.36 {9.37 - const gchar *dir = dreamcast_get_config_value(CONFIG_SAVE_PATH);9.38 + const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);9.39 save_file_dialog( "Save state...", dreamcast_save_state, "*.dst", "lxDream Save State (*.dst)", dir );9.40 }9.41 void about_action_callback( GtkAction *action, gpointer user_data)9.42 @@ -167,6 +168,7 @@9.44 void path_settings_callback( GtkAction *action, gpointer user_data)9.45 {9.46 + path_dialog_run();9.47 }9.49 void audio_settings_callback( GtkAction *action, gpointer user_data)9.50 @@ -175,7 +177,7 @@9.52 void controller_settings_callback( GtkAction *action, gpointer user_data)9.53 {9.54 - controller_dialog_run( NULL );9.55 + controller_dialog_run( );9.56 }9.58 void network_settings_callback( GtkAction *action, gpointer user_data)
10.1 --- a/src/gui/gtkui.c Tue Oct 16 12:38:01 2007 +000010.2 +++ b/src/gui/gtkui.c Wed Oct 17 11:26:45 2007 +000010.3 @@ -1,5 +1,5 @@10.4 /**10.5 - * $Id: gtkui.c,v 1.3 2007-10-16 12:36:29 nkeynes Exp $10.6 + * $Id: gtkui.c,v 1.4 2007-10-17 11:26:45 nkeynes Exp $10.7 *10.8 * Core GTK-based user interface10.9 *10.10 @@ -210,3 +210,19 @@10.11 gdk_colormap_alloc_color(map, &gui_colour_white, TRUE, TRUE);10.12 gui_fixed_font = pango_font_description_from_string("Courier 10");10.13 }10.14 +10.15 +gint gtk_gui_run_property_dialog( const gchar *title, GtkWidget *panel )10.16 +{10.17 + GtkWidget *dialog =10.18 + gtk_dialog_new_with_buttons(title, main_window_get_frame(main_win),10.19 + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,10.20 + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,10.21 + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,10.22 + NULL);10.23 + gint result;10.24 + gtk_widget_show_all(panel);10.25 + gtk_container_add( GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), panel );10.26 + result = gtk_dialog_run( GTK_DIALOG(dialog) );10.27 + gtk_widget_destroy( dialog );10.28 + return result;10.29 +}
11.1 --- a/src/gui/gtkui.h Tue Oct 16 12:38:01 2007 +000011.2 +++ b/src/gui/gtkui.h Wed Oct 17 11:26:45 2007 +000011.3 @@ -1,5 +1,5 @@11.4 /**11.5 - * $Id: gtkui.h,v 1.3 2007-10-16 12:36:29 nkeynes Exp $11.6 + * $Id: gtkui.h,v 1.4 2007-10-17 11:26:45 nkeynes Exp $11.7 *11.8 * Core GTK-based user interface11.9 *11.10 @@ -34,7 +34,6 @@11.11 * opaque pointer to the window.11.12 */11.13 main_window_t main_window_new( const gchar *title );11.14 -11.15 GtkWindow *main_window_get_frame( main_window_t win );11.16 GtkWidget *main_window_get_renderarea( main_window_t win );11.17 void main_window_set_running( main_window_t win, gboolean running );11.18 @@ -42,14 +41,19 @@11.19 void main_window_set_speed( main_window_t win, double speed );11.21 debug_window_t debug_window_new();11.22 -11.23 void debug_window_show( debug_window_t win, gboolean show );11.24 void debug_window_set_running( debug_window_t win, gboolean running );11.25 void debug_window_update(debug_window_t win);11.27 mmio_window_t mmio_window_new();11.28 +void mmio_window_show( mmio_window_t win, gboolean show );11.30 -void mmio_window_show( mmio_window_t win, gboolean show );11.31 +void controller_dialog_run();11.32 +void path_dialog_run();11.33 +11.34 +/********************* Helper functions **********************/11.35 +11.36 +gint gtk_gui_run_property_dialog( const gchar *title, GtkWidget *panel );11.38 /******************** Video driver hooks *********************/
12.1 --- a/src/gui/main_win.c Tue Oct 16 12:38:01 2007 +000012.2 +++ b/src/gui/main_win.c Wed Oct 17 11:26:45 2007 +000012.3 @@ -1,5 +1,5 @@12.4 /**12.5 - * $Id: main_win.c,v 1.4 2007-10-16 12:36:29 nkeynes Exp $12.6 + * $Id: main_win.c,v 1.5 2007-10-17 11:26:45 nkeynes Exp $12.7 *12.8 * Define the main (emu) GTK window, along with its menubars,12.9 * toolbars, etc.12.10 @@ -54,7 +54,7 @@12.11 { "About", GTK_STOCK_ABOUT, "_About...", NULL, "About lxdream", G_CALLBACK(about_action_callback) }12.12 };12.13 static const GtkToggleActionEntry ui_toggle_actions[] = {12.14 - { "FullScreen", NULL, "_Full Screen", "F9", "Toggle full screen video", G_CALLBACK(fullscreen_toggle_callback), 0 },12.15 + { "FullScreen", NULL, "_Full Screen", "<alt>Return", "Toggle full screen video", G_CALLBACK(fullscreen_toggle_callback), 0 },12.16 };12.19 @@ -74,6 +74,7 @@12.20 " <menuitem action='Exit'/>"12.21 " </menu>"12.22 " <menu action='SettingsMenu'>"12.23 + " <menuitem action='PathSettings'/>"12.24 " <menuitem action='AudioSettings'/>"12.25 " <menuitem action='ControllerSettings'/>"12.26 " <menuitem action='NetworkSettings'/>"
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000013.2 +++ b/src/gui/path_dlg.c Wed Oct 17 11:26:45 2007 +000013.3 @@ -0,0 +1,141 @@13.4 +/**13.5 + * $Id: path_dlg.c,v 1.1 2007-10-17 11:26:45 nkeynes Exp $13.6 + *13.7 + * Define the main (emu) GTK window, along with its menubars,13.8 + * toolbars, etc.13.9 + *13.10 + * Copyright (c) 2005 Nathan Keynes.13.11 + *13.12 + * This program is free software; you can redistribute it and/or modify13.13 + * it under the terms of the GNU General Public License as published by13.14 + * the Free Software Foundation; either version 2 of the License, or13.15 + * (at your option) any later version.13.16 + *13.17 + * This program is distributed in the hope that it will be useful,13.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of13.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13.20 + * GNU General Public License for more details.13.21 + */13.22 +13.23 +#include <assert.h>13.24 +#include <gtk/gtk.h>13.25 +13.26 +#include "dream.h"13.27 +#include "config.h"13.28 +#include "gui/gtkui.h"13.29 +13.30 +static const gchar *path_label[] = { "Bios rom", "Flash rom", "Default disc path",13.31 + "Save state path", "Bootstrap IP.BIN" };13.32 +static const int path_id[] = { CONFIG_BIOS_PATH, CONFIG_FLASH_PATH, CONFIG_DEFAULT_PATH,13.33 + CONFIG_SAVE_PATH, CONFIG_BOOTSTRAP };13.34 +static GtkFileChooserAction path_action[] = {13.35 + GTK_FILE_CHOOSER_ACTION_OPEN,13.36 + GTK_FILE_CHOOSER_ACTION_OPEN,13.37 + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,13.38 + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,13.39 + GTK_FILE_CHOOSER_ACTION_OPEN };13.40 +13.41 +static GtkWidget *path_entry[5];13.42 +13.43 +static gboolean path_file_button_clicked( GtkWidget *button, gpointer user_data )13.44 +{13.45 + GtkWidget *entry = GTK_WIDGET(user_data);13.46 + GtkWidget *file = gtk_file_chooser_dialog_new( "Select file", NULL,13.47 + GTK_FILE_CHOOSER_ACTION_OPEN,13.48 + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,13.49 + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,13.50 + NULL );13.51 + const gchar *filename = gtk_entry_get_text(GTK_ENTRY(entry));13.52 + gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file), filename );13.53 + gtk_window_set_modal( GTK_WINDOW(file), TRUE );13.54 + gtk_widget_show_all( file );13.55 + gint result = gtk_dialog_run(GTK_DIALOG(file));13.56 + if( result == GTK_RESPONSE_ACCEPT ) {13.57 + filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );13.58 + gtk_entry_set_text(GTK_ENTRY(entry), filename);13.59 + }13.60 + gtk_widget_destroy(file);13.61 +}13.62 +13.63 +static gboolean path_dir_button_clicked( GtkWidget *button, gpointer user_data )13.64 +{13.65 + GtkWidget *entry = GTK_WIDGET(user_data);13.66 + GtkWidget *file = gtk_file_chooser_dialog_new( "Select file", NULL,13.67 + GTK_FILE_CHOOSER_ACTION_OPEN,13.68 + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,13.69 + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,13.70 + NULL );13.71 + const gchar *filename = gtk_entry_get_text(GTK_ENTRY(entry));13.72 + gtk_file_chooser_set_action( GTK_FILE_CHOOSER(file), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );13.73 + gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file), filename );13.74 + gtk_window_set_modal( GTK_WINDOW(file), TRUE );13.75 + gtk_widget_show_all( file );13.76 + gint result = gtk_dialog_run(GTK_DIALOG(file));13.77 + if( result == GTK_RESPONSE_ACCEPT ) {13.78 + filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );13.79 + gtk_entry_set_text(GTK_ENTRY(entry), filename);13.80 + }13.81 + gtk_widget_destroy(file);13.82 +}13.83 +13.84 +static gboolean path_text_changed( GtkWidget *entry, gpointer user_data )13.85 +{13.86 + const gchar *text = gtk_entry_get_text( GTK_ENTRY(entry) );13.87 +}13.88 +13.89 +GtkWidget *path_panel_new(void)13.90 +{13.91 + GtkWidget *table = gtk_table_new( 5, 3, FALSE );13.92 + GtkWidget *desc = gtk_label_new(NULL);13.93 + int i;13.94 + for( i=0; i<5; i++ ) {13.95 + GtkWidget *text = path_entry[i] = gtk_entry_new();13.96 + GtkWidget *button = gtk_button_new();13.97 + gtk_table_attach( GTK_TABLE(table), gtk_label_new(path_label[i]), 0, 1, i, i+1,13.98 + GTK_SHRINK, GTK_SHRINK, 0, 0);13.99 + gtk_entry_set_text( GTK_ENTRY(text), lxdream_get_config_value(path_id[i]) );13.100 + gtk_table_attach_defaults( GTK_TABLE(table), text, 1, 2, i, i+1 );13.101 + gtk_table_attach( GTK_TABLE(table), button, 2, 3, i, i+1, GTK_SHRINK, GTK_SHRINK, 0, 0 );13.102 + if( path_action[i] == GTK_FILE_CHOOSER_ACTION_OPEN ) {13.103 + GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);13.104 + gtk_button_set_image( GTK_BUTTON(button), image );13.105 + g_signal_connect( button, "clicked", G_CALLBACK(path_file_button_clicked), text );13.106 + } else {13.107 + GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_BUTTON);13.108 + gtk_button_set_image( GTK_BUTTON(button), image );13.109 + g_signal_connect( button, "clicked", G_CALLBACK(path_dir_button_clicked), text );13.110 + }13.111 + }13.112 + return table;13.113 +13.114 +}13.115 +13.116 +void path_panel_commit_changes()13.117 +{13.118 + int i;13.119 + for(i=0; i<5; i++ ) {13.120 + const char *filename = gtk_entry_get_text( GTK_ENTRY(path_entry[i]) );13.121 + lxdream_set_config_value( path_id[i], filename );13.122 + }13.123 +13.124 + lxdream_save_config();13.125 +}13.126 +13.127 +void path_dialog_run( void )13.128 +{13.129 + GtkWidget *dialog =13.130 + gtk_dialog_new_with_buttons("Path Settings", NULL,13.131 + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,13.132 + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,13.133 + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,13.134 + NULL);13.135 + gint result;13.136 + GtkWidget *panel = path_panel_new();13.137 + gtk_widget_show_all(panel);13.138 + gtk_container_add( GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), panel );13.139 + result = gtk_dialog_run( GTK_DIALOG(dialog) );13.140 + if( result == GTK_RESPONSE_ACCEPT ) {13.141 + path_panel_commit_changes();13.142 + }13.143 + gtk_widget_destroy( dialog );13.144 +}
14.1 --- a/src/loader.c Tue Oct 16 12:38:01 2007 +000014.2 +++ b/src/loader.c Wed Oct 17 11:26:45 2007 +000014.3 @@ -1,5 +1,5 @@14.4 /**14.5 - * $Id: loader.c,v 1.18 2007-10-16 12:28:42 nkeynes Exp $14.6 + * $Id: loader.c,v 1.19 2007-10-17 11:26:45 nkeynes Exp $14.7 *14.8 * File loading routines, mostly for loading demos without going through the14.9 * whole procedure of making a CD image for them.14.10 @@ -27,6 +27,7 @@14.11 #include "sh4core.h"14.12 #include "bootstrap.h"14.13 #include "dreamcast.h"14.14 +#include "config.h"14.15 #include "loader.h"14.16 #include "syscall.h"14.18 @@ -109,7 +110,7 @@14.20 void file_load_postload( int pc )14.21 {14.22 - const gchar *bootstrap_file = dreamcast_get_config_value(CONFIG_BOOTSTRAP);14.23 + const gchar *bootstrap_file = lxdream_get_config_value(CONFIG_BOOTSTRAP);14.24 if( bootstrap_file != NULL ) {14.25 /* Load in a bootstrap before the binary, to initialize everything14.26 * correctly
15.1 --- a/src/main.c Tue Oct 16 12:38:01 2007 +000015.2 +++ b/src/main.c Wed Oct 17 11:26:45 2007 +000015.3 @@ -1,5 +1,5 @@15.4 /**15.5 - * $Id: main.c,v 1.29 2007-10-16 12:28:42 nkeynes Exp $15.6 + * $Id: main.c,v 1.30 2007-10-17 11:26:44 nkeynes Exp $15.7 *15.8 * Main program, initializes dreamcast and gui, then passes control off to15.9 * the gtk main loop (currently).15.10 @@ -19,18 +19,16 @@15.11 * GNU General Public License for more details.15.12 */15.14 -#ifdef HAVE_CONFIG_H15.15 -# include <config.h>15.16 -#endif15.17 #include <unistd.h>15.18 #include <getopt.h>15.19 -#include "gui.h"15.20 #include "dream.h"15.21 +#include "config.h"15.22 #include "syscall.h"15.23 #include "mem.h"15.24 #include "dreamcast.h"15.25 #include "display.h"15.26 #include "loader.h"15.27 +#include "gui.h"15.28 #include "aica/audio.h"15.29 #include "gdrom/gdrom.h"15.30 #include "maple/maple.h"15.31 @@ -45,7 +43,6 @@15.32 char *disc_file = NULL;15.33 char *display_driver_name = "gtk";15.34 char *audio_driver_name = "esd";15.35 -char *config_file = DEFAULT_CONFIG_FILENAME;15.36 gboolean start_immediately = FALSE;15.37 gboolean headless = FALSE;15.38 gboolean without_bios = FALSE;15.39 @@ -79,7 +76,7 @@15.40 aica_program = optarg;15.41 break;15.42 case 'c': /* Config file */15.43 - config_file = optarg;15.44 + lxdream_set_config_filename(optarg);15.45 break;15.46 case 'd': /* Mount disc */15.47 disc_file = optarg;15.48 @@ -124,7 +121,7 @@15.49 }15.50 }15.52 - dreamcast_load_config( config_file );15.53 + lxdream_load_config( );15.55 if( aica_program == NULL ) {15.56 dreamcast_init();
16.1 --- a/src/maple/controller.c Tue Oct 16 12:38:01 2007 +000016.2 +++ b/src/maple/controller.c Wed Oct 17 11:26:45 2007 +000016.3 @@ -1,5 +1,5 @@16.4 /**16.5 - * $Id: controller.c,v 1.6 2007-10-08 11:49:35 nkeynes Exp $16.6 + * $Id: controller.c,v 1.7 2007-10-17 11:26:45 nkeynes Exp $16.7 *16.8 * Implements the standard dreamcast controller16.9 *16.10 @@ -29,14 +29,14 @@16.11 void controller_detach( maple_device_t dev );16.12 void controller_destroy( maple_device_t dev );16.13 maple_device_t controller_new();16.14 -dreamcast_config_entry_t controller_get_config( maple_device_t dev );16.15 +lxdream_config_entry_t controller_get_config( maple_device_t dev );16.16 int controller_get_cond( maple_device_t dev, int function, unsigned char *outbuf,16.17 int *outlen );16.19 typedef struct controller_device {16.20 struct maple_device dev;16.21 uint32_t condition[2];16.22 - struct dreamcast_config_entry config[CONTROLLER_CONFIG_ENTRIES];16.23 + struct lxdream_config_entry config[CONTROLLER_CONFIG_ENTRIES];16.24 } *controller_device_t;16.26 struct maple_device_class controller_class = { "Sega Controller", controller_new };16.27 @@ -119,7 +119,7 @@16.28 }16.29 }16.31 -dreamcast_config_entry_t controller_get_config( maple_device_t mdev )16.32 +lxdream_config_entry_t controller_get_config( maple_device_t mdev )16.33 {16.34 controller_device_t dev = (controller_device_t)mdev;16.35 return dev->config;
17.1 --- a/src/maple/maple.c Tue Oct 16 12:38:01 2007 +000017.2 +++ b/src/maple/maple.c Wed Oct 17 11:26:45 2007 +000017.3 @@ -1,5 +1,5 @@17.4 /**17.5 - * $Id: maple.c,v 1.10 2007-10-16 12:36:29 nkeynes Exp $17.6 + * $Id: maple.c,v 1.11 2007-10-17 11:26:45 nkeynes Exp $17.7 *17.8 * Implements the core Maple bus, including DMA transfers to and from the bus.17.9 *17.10 @@ -59,7 +59,7 @@17.11 return maple_device_classes;17.12 }17.14 -dreamcast_config_entry_t maple_get_device_config( maple_device_t dev )17.15 +lxdream_config_entry_t maple_get_device_config( maple_device_t dev )17.16 {17.17 if( dev->get_config == NULL )17.18 return NULL;
18.1 --- a/src/maple/maple.h Tue Oct 16 12:38:01 2007 +000018.2 +++ b/src/maple/maple.h Wed Oct 17 11:26:45 2007 +000018.3 @@ -1,5 +1,5 @@18.4 /**18.5 - * $Id: maple.h,v 1.6 2007-10-16 12:36:29 nkeynes Exp $18.6 + * $Id: maple.h,v 1.7 2007-10-17 11:26:45 nkeynes Exp $18.7 *18.8 * Maple bus definitions18.9 *18.10 @@ -16,10 +16,11 @@18.11 * GNU General Public License for more details.18.12 */18.14 -#ifndef dream_maple_H18.15 -#define dream_maple_H 118.16 +#ifndef lxdream_maple_H18.17 +#define lxdream_maple_H 118.19 -#include "dreamcast.h"18.20 +#include <stdint.h>18.21 +#include "config.h"18.23 #define MAPLE_CMD_INFO 1 /* Request device information */18.24 #define MAPLE_CMD_EXT_INFO 2 /* Request extended information */18.25 @@ -70,7 +71,7 @@18.26 maple_device_class_t device_class;18.27 unsigned char ident[112];18.28 unsigned char version[80];18.29 - dreamcast_config_entry_t (*get_config)(struct maple_device *dev);18.30 + lxdream_config_entry_t (*get_config)(struct maple_device *dev);18.31 void (*attach)(struct maple_device *dev);18.32 void (*detach)(struct maple_device *dev);18.33 void (*destroy)(struct maple_device *dev);18.34 @@ -93,7 +94,7 @@18.35 maple_device_t maple_get_device( unsigned int port, unsigned int periph );18.36 const maple_device_class_t maple_get_device_class( const gchar *name );18.37 const struct maple_device_class **maple_get_device_classes();18.38 -dreamcast_config_entry_t maple_get_device_config( maple_device_t dev );18.39 +lxdream_config_entry_t maple_get_device_config( maple_device_t dev );18.41 void maple_handle_buffer( uint32_t buffer );18.42 void maple_attach_device( maple_device_t dev, unsigned int port, unsigned int periph );18.43 @@ -101,4 +102,4 @@18.44 void maple_detach_all( );18.45 void maple_reattach_all( );18.47 -#endif /* !dream_maple_H */18.48 +#endif /* !lxdream_maple_H */
.