From 5c2e28e845efbf8ff61ff1988caa19f0ef465a3c Mon Sep 17 00:00:00 2001 From: Couriersud Date: Sat, 13 Feb 2010 19:26:39 +0000 Subject: [PATCH] No credit, please - put code not actually required in MAME into "#ifdef MESS" - Moved global definition of sdl_cwd from sdl_file.c back to sdl_main.c --- src/osd/osdcore.h | 27 ++++++++++------ src/osd/sdl/sdlfile.c | 10 +----- src/osd/sdl/sdlmain.c | 63 +++++++++++++++++++++++--------------- src/osd/sdl/sdlos_macosx.c | 8 ++++- src/osd/sdl/sdlos_unix.c | 9 +++++- src/osd/sdl/sdlos_win32.c | 9 ++++-- 6 files changed, 79 insertions(+), 47 deletions(-) diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h index 83b52d26571..96fa6bffb0e 100644 --- a/src/osd/osdcore.h +++ b/src/osd/osdcore.h @@ -810,6 +810,22 @@ void osd_free_executable(void *ptr, size_t size); void osd_break_into_debugger(const char *message); +/*----------------------------------------------------------------------------- + MESS specific code below +-----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------- + osd_get_clipboard_text: retrieves text from the clipboard + + Return value: + + the returned string needs to be free()-ed! + +-----------------------------------------------------------------------------*/ +char *osd_get_clipboard_text(void); + + +#ifdef MESS /*************************************************************************** DIRECTORY INTERFACES ***************************************************************************/ @@ -865,16 +881,6 @@ file_error osd_get_full_path(char **dst, const char *path); UNCATEGORIZED INTERFACES ***************************************************************************/ -/*----------------------------------------------------------------------------- - osd_get_clipboard_text: retrieves text from the clipboard - - Return value: - - the returned string needs to be free()-ed! - ------------------------------------------------------------------------------*/ -char *osd_get_clipboard_text(void); - /*----------------------------------------------------------------------------- osd_get_volume_name: retrieves the volume name @@ -888,5 +894,6 @@ char *osd_get_clipboard_text(void); -----------------------------------------------------------------------------*/ const char *osd_get_volume_name(int idx); +#endif #endif /* __OSDEPEND_H__ */ diff --git a/src/osd/sdl/sdlfile.c b/src/osd/sdl/sdlfile.c index 3ecd9b39b09..8c95280a557 100644 --- a/src/osd/sdl/sdlfile.c +++ b/src/osd/sdl/sdlfile.c @@ -27,7 +27,6 @@ #include #include #include -#include #include // MAME headers @@ -61,14 +60,7 @@ struct _osd_file //============================================================ -// Global variables -//============================================================ - -char sdl_cwd[512]; - - -//============================================================ -// Static variables +// Prototypes //============================================================ static UINT32 create_path_recursive(char *path); diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index e77698decf0..a92403a4a57 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -14,6 +14,13 @@ #include // standard includes +#ifdef MESS +#include +#endif +#ifdef SDLMAME_OS2 +#define INCL_DOS +#include +#endif // MAME headers #include "osdepend.h" @@ -36,29 +43,6 @@ #include #endif -#ifdef SDLMAME_OS2 -#define INCL_DOS -#include - -void MorphToPM() -{ - PPIB pib; - PTIB tib; - - DosGetInfoBlocks(&tib, &pib); - - // Change flag from VIO to PM: - if (pib->pib_ultype==2) pib->pib_ultype = 3; -} -#endif - -//============================================================ -// LOCAL VARIABLES -//============================================================ - -#include -extern char sdl_cwd[512]; - //============================================================ // OPTIONS //============================================================ @@ -75,6 +59,19 @@ extern char sdl_cwd[512]; #endif // MACOSX #endif // INI_PATH + +//============================================================ +// Global variables +//============================================================ + +#ifdef MESS +char sdl_cwd[512]; +#endif + +//============================================================ +// Local variables +//============================================================ + static const options_entry mame_sdl_options[] = { { SDLOPTION_INIPATH, INI_PATH, 0, "path to ini files" }, @@ -233,6 +230,23 @@ static const options_entry mame_sdl_options[] = { NULL } }; +//============================================================ +// OS2 specific +//============================================================ + +#ifdef SDLMAME_OS2 +void MorphToPM() +{ + PPIB pib; + PTIB tib; + + DosGetInfoBlocks(&tib, &pib); + + // Change flag from VIO to PM: + if (pib->pib_ultype==2) pib->pib_ultype = 3; +} +#endif + //============================================================ // main //============================================================ @@ -270,8 +284,9 @@ int main(int argc, char *argv[]) #ifdef SDLMAME_OS2 MorphToPM(); #endif - + #ifdef MESS getcwd(sdl_cwd, 511); + #endif #if defined(SDLMAME_X11) && (SDL_MAJOR_VERSION == 1) && (SDL_MINOR_VERSION == 2) if (SDL_Linked_Version()->patch < 10) diff --git a/src/osd/sdl/sdlos_macosx.c b/src/osd/sdl/sdlos_macosx.c index 5f3f29c9c2f..0251c7df836 100644 --- a/src/osd/sdl/sdlos_macosx.c +++ b/src/osd/sdl/sdlos_macosx.c @@ -207,7 +207,6 @@ int osd_setenv(const char *name, const char *value, int overwrite) return setenv(name, value, overwrite); } - //============================================================ // osd_get_clipboard_text //============================================================ @@ -307,6 +306,12 @@ char *osd_get_clipboard_text(void) return result; } +//============================================================ +// MESS specific code below +//============================================================ + +#ifdef MESS + //============================================================ // osd_stat //============================================================ @@ -392,3 +397,4 @@ void osd_get_emulator_directory(char *dir, size_t dir_size) { strncpy(dir, sdl_cwd, dir_size); } +#endif diff --git a/src/osd/sdl/sdlos_unix.c b/src/osd/sdl/sdlos_unix.c index 4e490de9a6b..10337782220 100644 --- a/src/osd/sdl/sdlos_unix.c +++ b/src/osd/sdl/sdlos_unix.c @@ -124,7 +124,6 @@ int osd_setenv(const char *name, const char *value, int overwrite) return setenv(name, value, overwrite); } - #if defined(SDL_VIDEO_DRIVER_X11) && defined(SDLMAME_X11) //============================================================ @@ -227,6 +226,13 @@ char *osd_get_clipboard_text(void) } #endif +//============================================================ +// MESS specific code below +// Disabled for MAME until it compiles +//============================================================ + +#ifdef MESS + //============================================================ // osd_stat //============================================================ @@ -312,3 +318,4 @@ void osd_get_emulator_directory(char *dir, size_t dir_size) { strncpy(dir, sdl_cwd, dir_size); } +#endif diff --git a/src/osd/sdl/sdlos_win32.c b/src/osd/sdl/sdlos_win32.c index efe51ffaa1e..a73de1a2b17 100644 --- a/src/osd/sdl/sdlos_win32.c +++ b/src/osd/sdl/sdlos_win32.c @@ -273,6 +273,9 @@ int osd_setenv(const char *name, const char *value, int overwrite) return result; } +//============================================================ +// MESS specific code below +//============================================================ //============================================================ // get_clipboard_text_by_format @@ -314,7 +317,6 @@ static char *get_clipboard_text_by_format(UINT format, char *(*convert)(LPCVOID } - //============================================================ // convert_wide //============================================================ @@ -356,6 +358,8 @@ char *osd_get_clipboard_text(void) return result; } +#ifdef MESS + //============================================================ // astring_from_utf8 //============================================================ @@ -581,4 +585,5 @@ void osd_get_emulator_directory(char *dir, size_t dir_size) s = strrchr(dir, '\\'); if (s) s[1] = '\0'; -} \ No newline at end of file +} +#endif