This commit is contained in:
David Schmidt 2012-02-18 06:21:43 +00:00
parent 4f0a1d79af
commit 1c9806253e
4 changed files with 47 additions and 18 deletions

View File

@ -1,6 +1,6 @@
/*
GSport - an Apple //gs Emulator
Copyright (C) 2010 - 2011 by GSport contributors
Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -556,7 +556,7 @@ cfg_get_tfe_name()
}
else
{
#ifdef WIN32
#ifdef _WIN32
cfg_printf("ERROR: Install/Enable WinPcap for Ethernet Support!!");
#else
cfg_printf("ERROR: Install/Enable LibPcap for Ethernet Support!!");
@ -799,10 +799,8 @@ config_load_roms()
if(*names_ptr == 0) {
continue;
}
setup_gsport_file(&g_cfg_tmp_path[0], CFG_PATH_MAX, 1, 0,
names_ptr);
if(g_cfg_tmp_path[0] != 0) {
file = fopen(&(g_cfg_tmp_path[0]), "rb");
if(!file) {
@ -817,14 +815,13 @@ config_load_roms()
if(ret != len) {
fatal_printf("While reading card ROM %s, file "
"is too short. (%d) Expected %d bytes, "
"read %d bytes\n", errno, len, ret);
"read %d bytes\n", &g_cfg_tmp_path[0], errno, len, ret);
continue;
}
printf("Read: %d bytes of ROM in slot %d\n", ret, i);
printf("Read: %d bytes of ROM in slot %d from file %s.\n", ret, i, &g_cfg_tmp_path[0]);
fclose(file);
}
}
more_than_8mb = (g_mem_size_exp > 0x800000);
/* Only do the patch if users wants more than 8MB of expansion mem */
@ -1151,7 +1148,7 @@ config_write_config_gsport_file()
fconf = fopen(g_config_gsport_name, "w+");
if(fconf == 0) {
halt_printf("cannot open %s! Stopping!\n");
halt_printf("cannot open %s! Stopping!\n",g_config_gsport_name);
return;
}

View File

@ -1,6 +1,6 @@
/*
GSport - an Apple //gs Emulator
Copyright (C) 2010 by GSport contributors
Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -40,7 +40,7 @@ int g_accept_events = 0; // OG To know if the emulator is ready to accept extern
char g_argv0_path[256] = "./";
const char *g_gsport_default_paths[] = { "", "./", "${HOME}/",
const char *g_gsport_default_paths[] = { "", "./", "${HOME}/","${CD}/",
"${HOME}/Library/GSport/",
"${0}/Contents/Resources/", "/usr/local/lib/",
"/usr/local/gsport/", "/usr/local/lib/gsport/", "/usr/share/gsport/",
@ -900,6 +900,7 @@ gsportmain(int argc, char **argv)
int tmp1;
int i;
char *final_arg = 0;
char *filename_ptr;
// OG Restoring globals
sim65816_initglobals();
@ -1055,10 +1056,24 @@ gsportmain(int argc, char **argv)
iwm_init();
config_init();
// If the final argument was not a switch, then treat it like a disk image filename to insert
if (final_arg)
cfg_inspect_maybe_insert_file(final_arg);
if (final_arg) {
#if defined(_WIN32) || defined(__CYGWIN__)
// On Windows, we need to change backslashes to forward slashes.
filename_ptr = malloc(strlen(final_arg +1));
strcpy(filename_ptr,final_arg);
for (i = 0; i < strlen(filename_ptr);i++) {
if (filename_ptr[i] == '\\') filename_ptr[i] = '/';
}
#else
filename_ptr = final_arg;
#endif
cfg_inspect_maybe_insert_file(filename_ptr);
f#if defined(_WIN32) || defined(__CYGWIN__)
free(filename_ptr);
#endif
}
printer_init(g_printer_dpi,85,110,g_printer_output,g_printer_multipage);
//If ethernet is enabled in config.gsport, lets initialize it
//If ethernet is enabled in config.gsport, let's initialize it
#ifdef HAVE_TFE
if (g_ethernet == 1)
{
@ -1282,6 +1297,15 @@ setup_gsport_file(char *outname, int maxlen, int ok_if_missing,
}
if(can_create_file) {
// If we didn't find a file, pick a place to put it.
#if defined (_WIN32) || defined(__CYGWIN__)
// Windows - use the current working directory
gsport_expand_path(&(local_path[0]), "${CD}/config.txt", 250);
#else
// Non-windows - use home directory
gsport_expand_path(&(local_path[0]), "${HOME}/config.txt", 250);
#endif
strcpy(outname, &(local_path[0]));
// Ask user if it's OK to create the file
x_dialog_create_gsport_conf(*name_ptr);
can_create_file = 0;
@ -1300,8 +1324,6 @@ setup_gsport_file(char *outname, int maxlen, int ok_if_missing,
return;
}
system("pwd");
my_exit(2);
}

View File

@ -1,6 +1,6 @@
/*
GSport - an Apple //gs Emulator
Copyright (C) 2010 by GSport contributors
Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -59,6 +59,8 @@ win_nonblock_read_stdin(int fd, char *bufptr, int len)
void
x_dialog_create_gsport_conf(const char *str)
{
// Just write the config file already...
config_write_config_gsport_file();
}
int

View File

@ -448,7 +448,7 @@ win_event_redraw()
LRESULT CALLBACK
win_event_handler(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
int i;
int i, j;
int numDraggedFiles;
int szFilename;
LPTSTR lpszFile;
@ -472,7 +472,15 @@ LPTSTR lpszFile;
for (i = 0; i < numDraggedFiles; i++) {
szFilename = DragQueryFile((HDROP)wParam, i, NULL, 0);
lpszFile = (LPTSTR)malloc(szFilename + 1);
szFilename = DragQueryFile((HDROP)wParam, i, lpszFile, szFilename + 1);
szFilename = DragQueryFile((HDROP)wParam, i, lpszFile, szFilename + 1);
// Need to swap out backslashes, swap in forward slashes
if (szFilename > 0) {
for (j = 0;j<szFilename;j++) {
if (lpszFile[j] == '\\') {
lpszFile[j] = '/';
}
}
}
cfg_inspect_maybe_insert_file(lpszFile);
free(lpszFile);
}