This file is no longer necessary

This commit is contained in:
Volker Ruppert 2002-11-28 17:59:18 +00:00
parent 995701a4b1
commit 86346ec5ff

View File

@ -1,117 +0,0 @@
----------------------------------------------------------------------
Patch name: patch.sdl-win32-console
Author: Bryce Denney
Date: Mon Nov 25 13:21:42 EST 2002
Detailed description:
This untested patch shows how and where to call RedirectIOToConsole() when
compiling with SDL on win32. I believe this, or something like it, will
fix the problem of having no console window on SDL.
- enable RedirectIOToConsole() when compiling with SDL on win32, so that
it can be called in main().
- move main() down below the definition of RedirectIOToConsole(), and
add a call to RedirectIOToConsole()
- in WinMain, Bochs always asked the user to press ENTER before exiting.
I moved that code to main() with #ifdef WIN32...#endif around it.
(Maybe this should only be done when Bochs explictly creates a console
window, though.)
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on DATE, release version VER
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
Index: main.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/main.cc,v
retrieving revision 1.195
diff -u -r1.195 main.cc
--- main.cc 25 Nov 2002 18:17:13 -0000 1.195
+++ main.cc 25 Nov 2002 18:28:40 -0000
@@ -1506,23 +1506,17 @@
// quit via longjmp
}
SIM->set_quit_context (NULL);
+#if defined(WIN32)
+ // ask user to press ENTER before exiting, so that they can read messages
+ // before the console window is closed.
+ fprintf (stderr, "\nBochs is exiting. Press ENTER when you're ready to close this window.\n");
+ char buf[16];
+ fgets (buf, sizeof(buf), stdin);
+#endif
return 0;
}
-#if !defined(__WXMSW__)
-// normal main function, presently in for all cases except for
-// wxWindows under win32.
-int main (int argc, char *argv[])
-{
- bx_startup_flags.argc = argc;
- bx_startup_flags.argv = argv;
- return bxmain ();
-}
-#else
-
-// special WinMain function for wxWindows under win32
-
-#define MAX_ARGLEN 128
+#if defined(__WXMSW__)
// win32 applications get the whole command line in one long string.
// This function is used to split up the string into argc and argv,
@@ -1608,7 +1602,9 @@
*argc_out = argc;
return 0;
}
+#endif /* if defined(__WXMSW__) */
+#if defined(__WXMSW__) || (BX_WITH_SDL && defined(WIN32))
// The RedirectIOToConsole() function is copied from an article called "Adding
// Console I/O to a Win32 GUI App" in Windows Developer Journal, December 1997.
// It creates a console window.
@@ -1649,7 +1645,9 @@
*stderr = *fp;
setvbuf( stderr, NULL, _IONBF, 0 );
}
+#endif /* if defined(__WXMSW__) || (BX_WITH_SDL && defined(WIN32)) */
+#if defined(__WXMSW__)
// only used for wxWindows/win32.
// This works ok in Cygwin with a standard wxWindows compile. In
// VC++ wxWindows must be compiled with -DNOMAIN=1.
@@ -1666,11 +1664,22 @@
int max_argv = 20;
bx_startup_flags.argv = (char**) malloc (max_argv * sizeof (char*));
split_string_into_argv (m_lpCmdLine, &bx_startup_flags.argc, bx_startup_flags.argv, max_argv);
- int status = bxmain ();
- fprintf (stderr, "\nBochs is exiting. Press ENTER when you're ready to close this window.\n");
- char buf[16];
- fgets (buf, sizeof(buf), stdin);
- return status;
+ return bxmain ();
+}
+#endif
+
+#if !defined(__WXMSW__)
+// normal main function, presently in for all cases except for
+// wxWindows under win32.
+int main (int argc, char *argv[])
+{
+ bx_startup_flags.argc = argc;
+ bx_startup_flags.argv = argv;
+#if BX_WITH_SDL && defined(WIN32)
+ // if SDL/win32, try to create a console window.
+ RedirectIOToConsole ();
+#endif
+ return bxmain ();
}
#endif