mirror of
https://github.com/holub/mame
synced 2025-05-19 20:29:09 +03:00
The return of the "misc"
- Added sdlmisc_<targetos>.c again. This was necessary since certain tools create stubs for e.g. osd_break_into_debugger. If we do not have this in a separate file, the link stage may break. - Applied OS/2 patch [Credit: KO Myung-Hun] - Cleaned up #includes. Removed stdlib.h were possible. - More malloc to osd_malloc rename. - SDL monitor modes are read now when they are needed. This is now consistent across platforms.
This commit is contained in:
parent
a63d3b5de4
commit
10bee5ce78
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -3967,6 +3967,10 @@ src/osd/sdl/sdl.mak svneol=native#text/plain
|
|||||||
src/osd/sdl/sdldir.c svneol=native#text/plain
|
src/osd/sdl/sdldir.c svneol=native#text/plain
|
||||||
src/osd/sdl/sdlfile.c svneol=native#text/plain
|
src/osd/sdl/sdlfile.c svneol=native#text/plain
|
||||||
src/osd/sdl/sdlmain.c svneol=native#text/plain
|
src/osd/sdl/sdlmain.c svneol=native#text/plain
|
||||||
|
src/osd/sdl/sdlmisc_macosx.c svneol=native#text/plain
|
||||||
|
src/osd/sdl/sdlmisc_os2.c svneol=native#text/plain
|
||||||
|
src/osd/sdl/sdlmisc_unix.c svneol=native#text/plain
|
||||||
|
src/osd/sdl/sdlmisc_win32.c svneol=native#text/plain
|
||||||
src/osd/sdl/sdlos.h svneol=native#text/plain
|
src/osd/sdl/sdlos.h svneol=native#text/plain
|
||||||
src/osd/sdl/sdlos_macosx.c svneol=native#text/plain
|
src/osd/sdl/sdlos_macosx.c svneol=native#text/plain
|
||||||
src/osd/sdl/sdlos_os2.c svneol=native#text/plain
|
src/osd/sdl/sdlos_os2.c svneol=native#text/plain
|
||||||
|
@ -28,7 +28,10 @@
|
|||||||
|
|
||||||
// OpenGL headers
|
// OpenGL headers
|
||||||
#include "osd_opengl.h"
|
#include "osd_opengl.h"
|
||||||
|
#include "sdlos.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "gl_shader_tool.h"
|
||||||
#include "gl_shader_mgr.h"
|
#include "gl_shader_mgr.h"
|
||||||
|
|
||||||
#if defined(SDLMAME_MACOSX)
|
#if defined(SDLMAME_MACOSX)
|
||||||
@ -748,7 +751,7 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height)
|
|||||||
|
|
||||||
sdl->glsl_vid_attributes = video_config.glsl_vid_attributes;
|
sdl->glsl_vid_attributes = video_config.glsl_vid_attributes;
|
||||||
|
|
||||||
if (getenv(SDLENV_VMWARE) != NULL)
|
if (osd_getenv(SDLENV_VMWARE) != NULL)
|
||||||
{
|
{
|
||||||
sdl->usetexturerect = 1;
|
sdl->usetexturerect = 1;
|
||||||
sdl->texpoweroftwo = 1;
|
sdl->texpoweroftwo = 1;
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
|
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
|
||||||
#include "osdcomm.h"
|
#include "osdcomm.h"
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
#include "osdepend.h"
|
#include "osdepend.h"
|
||||||
|
|
||||||
|
#include "osd_opengl.h"
|
||||||
|
|
||||||
#include "gl_shader_mgr.h"
|
#include "gl_shader_mgr.h"
|
||||||
|
#include "gl_shader_tool.h"
|
||||||
|
|
||||||
|
// OSD headers
|
||||||
|
|
||||||
#define GLSL_VERTEX_SHADER_INT_NUMBER 1 // general
|
#define GLSL_VERTEX_SHADER_INT_NUMBER 1 // general
|
||||||
#define GLSL_VERTEX_SHADER_MAX_NUMBER 2 // general + custom
|
#define GLSL_VERTEX_SHADER_MAX_NUMBER 2 // general + custom
|
||||||
|
@ -2,16 +2,6 @@
|
|||||||
#ifndef GL_SHADER_MGR_H
|
#ifndef GL_SHADER_MGR_H
|
||||||
#define GL_SHADER_MGR_H
|
#define GL_SHADER_MGR_H
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
|
|
||||||
// OpenGL headers
|
|
||||||
#include "osd_opengl.h"
|
|
||||||
|
|
||||||
#include "gl_shader_tool.h"
|
|
||||||
|
|
||||||
// OSD headers
|
|
||||||
#include "window.h"
|
|
||||||
|
|
||||||
// #define GLSL_SOURCE_ON_DISK 1
|
// #define GLSL_SOURCE_ON_DISK 1
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -27,10 +27,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "gl_shader_tool.h"
|
#include "gl_shader_tool.h"
|
||||||
|
|
||||||
|
@ -257,6 +257,7 @@ OSDCOREOBJS = \
|
|||||||
$(SDLOBJ)/strconv.o \
|
$(SDLOBJ)/strconv.o \
|
||||||
$(SDLOBJ)/sdldir.o \
|
$(SDLOBJ)/sdldir.o \
|
||||||
$(SDLOBJ)/sdlfile.o \
|
$(SDLOBJ)/sdlfile.o \
|
||||||
|
$(SDLOBJ)/sdlmisc_$(BASE_TARGETOS).o \
|
||||||
$(SDLOBJ)/sdlos_$(BASE_TARGETOS).o \
|
$(SDLOBJ)/sdlos_$(BASE_TARGETOS).o \
|
||||||
$(SDLOBJ)/sdlsync_$(SYNC_IMPLEMENTATION).o \
|
$(SDLOBJ)/sdlsync_$(SYNC_IMPLEMENTATION).o \
|
||||||
$(SDLOBJ)/sdlwork.o
|
$(SDLOBJ)/sdlwork.o
|
||||||
|
@ -23,13 +23,9 @@
|
|||||||
#define _XOPEN_SOURCE 500
|
#define _XOPEN_SOURCE 500
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
//#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#ifndef __USE_BSD
|
#ifndef __USE_BSD
|
||||||
#define __USE_BSD // to get DT_xxx on Linux
|
#define __USE_BSD // to get DT_xxx on Linux
|
||||||
#endif
|
#endif
|
||||||
@ -37,6 +33,7 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
|
#include "sdlos.h"
|
||||||
|
|
||||||
#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2)
|
#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2)
|
||||||
#define PATHSEPCH '\\'
|
#define PATHSEPCH '\\'
|
||||||
@ -113,20 +110,20 @@ osd_directory *osd_opendir(const char *dirname)
|
|||||||
char *tmpstr, *envstr;
|
char *tmpstr, *envstr;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
dir = (osd_directory *) malloc(sizeof(osd_directory));
|
dir = (osd_directory *) osd_malloc(sizeof(osd_directory));
|
||||||
if (dir)
|
if (dir)
|
||||||
{
|
{
|
||||||
memset(dir, 0, sizeof(osd_directory));
|
memset(dir, 0, sizeof(osd_directory));
|
||||||
dir->fd = NULL;
|
dir->fd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpstr = (char *) malloc(strlen(dirname)+1);
|
tmpstr = (char *) osd_malloc(strlen(dirname)+1);
|
||||||
strcpy(tmpstr, dirname);
|
strcpy(tmpstr, dirname);
|
||||||
|
|
||||||
if (tmpstr[0] == '$')
|
if (tmpstr[0] == '$')
|
||||||
{
|
{
|
||||||
char *envval;
|
char *envval;
|
||||||
envstr = (char *) malloc(strlen(tmpstr)+1);
|
envstr = (char *) osd_malloc(strlen(tmpstr)+1);
|
||||||
|
|
||||||
strcpy(envstr, tmpstr);
|
strcpy(envstr, tmpstr);
|
||||||
|
|
||||||
@ -138,12 +135,12 @@ osd_directory *osd_opendir(const char *dirname)
|
|||||||
|
|
||||||
envstr[i] = '\0';
|
envstr[i] = '\0';
|
||||||
|
|
||||||
envval = getenv(&envstr[1]);
|
envval = osd_getenv(&envstr[1]);
|
||||||
if (envval != NULL)
|
if (envval != NULL)
|
||||||
{
|
{
|
||||||
j = strlen(envval) + strlen(tmpstr) + 1;
|
j = strlen(envval) + strlen(tmpstr) + 1;
|
||||||
free(tmpstr);
|
osd_free(tmpstr);
|
||||||
tmpstr = (char *) malloc(j);
|
tmpstr = (char *) osd_malloc(j);
|
||||||
|
|
||||||
// start with the value of $HOME
|
// start with the value of $HOME
|
||||||
strcpy(tmpstr, envval);
|
strcpy(tmpstr, envval);
|
||||||
@ -154,19 +151,19 @@ osd_directory *osd_opendir(const char *dirname)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf(stderr, "Warning: osd_opendir environment variable %s not found.\n", envstr);
|
fprintf(stderr, "Warning: osd_opendir environment variable %s not found.\n", envstr);
|
||||||
free(envstr);
|
osd_free(envstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
dir->fd = opendir(tmpstr);
|
dir->fd = opendir(tmpstr);
|
||||||
|
|
||||||
if (dir && (dir->fd == NULL))
|
if (dir && (dir->fd == NULL))
|
||||||
{
|
{
|
||||||
free(dir);
|
osd_free(dir);
|
||||||
dir = NULL;
|
dir = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmpstr)
|
if (tmpstr)
|
||||||
free(tmpstr);
|
osd_free(tmpstr);
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,6 +202,6 @@ void osd_closedir(osd_directory *dir)
|
|||||||
{
|
{
|
||||||
if (dir->fd != NULL)
|
if (dir->fd != NULL)
|
||||||
closedir(dir->fd);
|
closedir(dir->fd);
|
||||||
free(dir);
|
osd_free(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,18 +23,15 @@
|
|||||||
#define _XOPEN_SOURCE 500
|
#define _XOPEN_SOURCE 500
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
// MAME headers
|
// MAME headers
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
|
#include "sdlos.h"
|
||||||
|
|
||||||
#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2)
|
#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2)
|
||||||
#define PATHSEPCH '\\'
|
#define PATHSEPCH '\\'
|
||||||
@ -114,7 +111,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
|
|||||||
tmpstr = NULL;
|
tmpstr = NULL;
|
||||||
|
|
||||||
// allocate a file object, plus space for the converted filename
|
// allocate a file object, plus space for the converted filename
|
||||||
*file = (osd_file *) malloc(sizeof(**file) + sizeof(char) * strlen(path));
|
*file = (osd_file *) osd_malloc(sizeof(**file) + sizeof(char) * strlen(path));
|
||||||
if (*file == NULL)
|
if (*file == NULL)
|
||||||
{
|
{
|
||||||
filerr = FILERR_OUT_OF_MEMORY;
|
filerr = FILERR_OUT_OF_MEMORY;
|
||||||
@ -143,14 +140,14 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpstr = (char *) malloc(strlen((*file)->filename)+1);
|
tmpstr = (char *) osd_malloc(strlen((*file)->filename)+1);
|
||||||
strcpy(tmpstr, (*file)->filename);
|
strcpy(tmpstr, (*file)->filename);
|
||||||
|
|
||||||
// does path start with an environment variable?
|
// does path start with an environment variable?
|
||||||
if (tmpstr[0] == '$')
|
if (tmpstr[0] == '$')
|
||||||
{
|
{
|
||||||
char *envval;
|
char *envval;
|
||||||
envstr = (char *) malloc(strlen(tmpstr)+1);
|
envstr = (char *) osd_malloc(strlen(tmpstr)+1);
|
||||||
|
|
||||||
strcpy(envstr, tmpstr);
|
strcpy(envstr, tmpstr);
|
||||||
|
|
||||||
@ -162,12 +159,12 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
|
|||||||
|
|
||||||
envstr[i] = '\0';
|
envstr[i] = '\0';
|
||||||
|
|
||||||
envval = getenv(&envstr[1]);
|
envval = osd_getenv(&envstr[1]);
|
||||||
if (envval != NULL)
|
if (envval != NULL)
|
||||||
{
|
{
|
||||||
j = strlen(envval) + strlen(tmpstr) + 1;
|
j = strlen(envval) + strlen(tmpstr) + 1;
|
||||||
free(tmpstr);
|
osd_free(tmpstr);
|
||||||
tmpstr = (char *) malloc(j);
|
tmpstr = (char *) osd_malloc(j);
|
||||||
|
|
||||||
// start with the value of $HOME
|
// start with the value of $HOME
|
||||||
strcpy(tmpstr, envval);
|
strcpy(tmpstr, envval);
|
||||||
@ -178,7 +175,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf(stderr, "Warning: osd_open environment variable %s not found.\n", envstr);
|
fprintf(stderr, "Warning: osd_open environment variable %s not found.\n", envstr);
|
||||||
free(envstr);
|
osd_free(envstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2)
|
#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2)
|
||||||
@ -218,12 +215,12 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we still failed, clean up and free
|
// if we still failed, clean up and osd_free
|
||||||
if ((*file)->handle == -1)
|
if ((*file)->handle == -1)
|
||||||
{
|
{
|
||||||
free(*file);
|
osd_free(*file);
|
||||||
*file = NULL;
|
*file = NULL;
|
||||||
free(tmpstr);
|
osd_free(tmpstr);
|
||||||
return error_to_file_error(errno);
|
return error_to_file_error(errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,11 +239,11 @@ error:
|
|||||||
// cleanup
|
// cleanup
|
||||||
if (filerr != FILERR_NONE && *file != NULL)
|
if (filerr != FILERR_NONE && *file != NULL)
|
||||||
{
|
{
|
||||||
free(*file);
|
osd_free(*file);
|
||||||
*file = NULL;
|
*file = NULL;
|
||||||
}
|
}
|
||||||
if (tmpstr)
|
if (tmpstr)
|
||||||
free(tmpstr);
|
osd_free(tmpstr);
|
||||||
return filerr;
|
return filerr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +313,7 @@ file_error osd_close(osd_file *file)
|
|||||||
{
|
{
|
||||||
// close the file handle and free the file structure
|
// close the file handle and free the file structure
|
||||||
close(file->handle);
|
close(file->handle);
|
||||||
free(file);
|
osd_free(file);
|
||||||
return FILERR_NONE;
|
return FILERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +484,7 @@ osd_directory_entry *osd_stat(const char *path)
|
|||||||
|
|
||||||
// create an osd_directory_entry; be sure to make sure that the caller can
|
// create an osd_directory_entry; be sure to make sure that the caller can
|
||||||
// free all resources by just freeing the resulting osd_directory_entry
|
// free all resources by just freeing the resulting osd_directory_entry
|
||||||
result = (osd_directory_entry *) malloc(sizeof(*result) + strlen(path) + 1);
|
result = (osd_directory_entry *) osd_malloc(sizeof(*result) + strlen(path) + 1);
|
||||||
strcpy(((char *) result) + sizeof(*result), path);
|
strcpy(((char *) result) + sizeof(*result), path);
|
||||||
result->name = ((char *) result) + sizeof(*result);
|
result->name = ((char *) result) + sizeof(*result);
|
||||||
result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE;
|
result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE;
|
||||||
|
@ -14,9 +14,6 @@
|
|||||||
#include <SDL/SDL_version.h>
|
#include <SDL/SDL_version.h>
|
||||||
|
|
||||||
// standard includes
|
// standard includes
|
||||||
#include <time.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
// MAME headers
|
// MAME headers
|
||||||
#include "osdepend.h"
|
#include "osdepend.h"
|
||||||
@ -29,15 +26,11 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "osdsdl.h"
|
#include "osdsdl.h"
|
||||||
|
#include "sdlos.h"
|
||||||
|
|
||||||
// we override SDL's normal startup on Win32
|
// we override SDL's normal startup on Win32
|
||||||
// please see sdlprefix.h as well
|
// please see sdlprefix.h as well
|
||||||
|
|
||||||
#ifdef SDLMAME_UNIX
|
|
||||||
#include <signal.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SDLMAME_X11) && (SDL_MAJOR_VERSION == 1) && (SDL_MINOR_VERSION == 2)
|
#if defined(SDLMAME_X11) && (SDL_MAJOR_VERSION == 1) && (SDL_MINOR_VERSION == 2)
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
@ -248,33 +241,6 @@ static const options_entry mame_sdl_options[] =
|
|||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SDLMAME_WIN32
|
|
||||||
|
|
||||||
/* mingw has no setenv */
|
|
||||||
|
|
||||||
static int setenv(const char *name, const char *value, int overwrite)
|
|
||||||
{
|
|
||||||
char *buf;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
if (!overwrite)
|
|
||||||
{
|
|
||||||
if (getenv(name) != NULL)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
buf = (char *) osd_malloc(strlen(name)+strlen(value)+2);
|
|
||||||
sprintf(buf, "%s=%s", name, value);
|
|
||||||
result = putenv(buf);
|
|
||||||
|
|
||||||
/* will be referenced by environment
|
|
||||||
* Therefore it is not freed here
|
|
||||||
*/
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// main
|
// main
|
||||||
//============================================================
|
//============================================================
|
||||||
@ -328,7 +294,7 @@ int main(int argc, char *argv[])
|
|||||||
char buf[130];
|
char buf[130];
|
||||||
if (XMatchVisualInfo(display, DefaultScreen(display), 24, TrueColor, &vi)) {
|
if (XMatchVisualInfo(display, DefaultScreen(display), 24, TrueColor, &vi)) {
|
||||||
snprintf(buf, sizeof(buf), "0x%lx", vi.visualid);
|
snprintf(buf, sizeof(buf), "0x%lx", vi.visualid);
|
||||||
setenv(SDLENV_VISUALID, buf, 0);
|
osd_setenv(SDLENV_VISUALID, buf, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (display)
|
if (display)
|
||||||
@ -507,14 +473,14 @@ void osd_init(running_machine *machine)
|
|||||||
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
||||||
{
|
{
|
||||||
mame_printf_verbose("Setting SDL audiodriver '%s' ...\n", stemp);
|
mame_printf_verbose("Setting SDL audiodriver '%s' ...\n", stemp);
|
||||||
setenv(SDLENV_AUDIODRIVER, stemp, 1);
|
osd_setenv(SDLENV_AUDIODRIVER, stemp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
stemp = options_get_string(mame_options(), SDLOPTION_VIDEODRIVER);
|
stemp = options_get_string(mame_options(), SDLOPTION_VIDEODRIVER);
|
||||||
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
||||||
{
|
{
|
||||||
mame_printf_verbose("Setting SDL videodriver '%s' ...\n", stemp);
|
mame_printf_verbose("Setting SDL videodriver '%s' ...\n", stemp);
|
||||||
setenv(SDLENV_VIDEODRIVER, stemp, 1);
|
osd_setenv(SDLENV_VIDEODRIVER, stemp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_VERSION_ATLEAST(1,3,0))
|
if (SDL_VERSION_ATLEAST(1,3,0))
|
||||||
@ -523,7 +489,7 @@ void osd_init(running_machine *machine)
|
|||||||
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
||||||
{
|
{
|
||||||
mame_printf_verbose("Setting SDL renderdriver '%s' ...\n", stemp);
|
mame_printf_verbose("Setting SDL renderdriver '%s' ...\n", stemp);
|
||||||
setenv(SDLENV_RENDERDRIVER, stemp, 1);
|
osd_setenv(SDLENV_RENDERDRIVER, stemp, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +501,7 @@ void osd_init(running_machine *machine)
|
|||||||
stemp = options_get_string(mame_options(), SDLOPTION_GL_LIB);
|
stemp = options_get_string(mame_options(), SDLOPTION_GL_LIB);
|
||||||
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) != 0)
|
||||||
{
|
{
|
||||||
setenv("SDL_VIDEO_GL_DRIVER", stemp, 1);
|
osd_setenv("SDL_VIDEO_GL_DRIVER", stemp, 1);
|
||||||
mame_printf_verbose("Setting SDL_VIDEO_GL_DRIVER = '%s' ...\n", stemp);
|
mame_printf_verbose("Setting SDL_VIDEO_GL_DRIVER = '%s' ...\n", stemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
59
src/osd/sdl/sdlmisc_macosx.c
Normal file
59
src/osd/sdl/sdlmisc_macosx.c
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
//============================================================
|
||||||
|
//
|
||||||
|
// sdlos_*.c - OS specific low level code
|
||||||
|
//
|
||||||
|
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
|
||||||
|
// Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
//
|
||||||
|
// SDLMAME by Olivier Galibert and R. Belmont
|
||||||
|
//
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
// standard sdl header
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
||||||
|
// MAME headers
|
||||||
|
#include "osdcore.h"
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_alloc_executable
|
||||||
|
//
|
||||||
|
// allocates "size" bytes of executable memory. this must take
|
||||||
|
// things like NX support into account.
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void *osd_alloc_executable(size_t size)
|
||||||
|
{
|
||||||
|
return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_free_executable
|
||||||
|
//
|
||||||
|
// frees memory allocated with osd_alloc_executable
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void osd_free_executable(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
munmap(ptr, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_break_into_debugger
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void osd_break_into_debugger(const char *message)
|
||||||
|
{
|
||||||
|
#ifdef MAME_DEBUG
|
||||||
|
printf("MAME exception: %s\n", message);
|
||||||
|
printf("Attempting to fall into debugger\n");
|
||||||
|
kill(getpid(), SIGTRAP);
|
||||||
|
#else
|
||||||
|
printf("Ignoring MAME exception: %s\n", message);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
61
src/osd/sdl/sdlmisc_os2.c
Normal file
61
src/osd/sdl/sdlmisc_os2.c
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
//============================================================
|
||||||
|
//
|
||||||
|
// sdlos_*.c - OS specific low level code
|
||||||
|
//
|
||||||
|
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
|
||||||
|
// Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
//
|
||||||
|
// SDLMAME by Olivier Galibert and R. Belmont
|
||||||
|
//
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
// standard sdl header
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define INCL_DOS
|
||||||
|
#include <os2.h>
|
||||||
|
|
||||||
|
// MAME headers
|
||||||
|
#include "osdepend.h"
|
||||||
|
#include "osdcore.h"
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_alloc_executable
|
||||||
|
//
|
||||||
|
// allocates "size" bytes of executable memory. this must take
|
||||||
|
// things like NX support into account.
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void *osd_alloc_executable(size_t size)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
DosAllocMem( &p, size, fALLOC );
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_free_executable
|
||||||
|
//
|
||||||
|
// frees memory allocated with osd_alloc_executable
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void osd_free_executable(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
DosFreeMem( ptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_break_into_debugger
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void osd_break_into_debugger(const char *message)
|
||||||
|
{
|
||||||
|
printf("Ignoring MAME exception: %s\n", message);
|
||||||
|
}
|
||||||
|
|
63
src/osd/sdl/sdlmisc_unix.c
Normal file
63
src/osd/sdl/sdlmisc_unix.c
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
//============================================================
|
||||||
|
//
|
||||||
|
// sdlos_*.c - OS specific low level code
|
||||||
|
//
|
||||||
|
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
|
||||||
|
// Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
//
|
||||||
|
// SDLMAME by Olivier Galibert and R. Belmont
|
||||||
|
//
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
// MAME headers
|
||||||
|
#include "osdcore.h"
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_alloc_executable
|
||||||
|
//
|
||||||
|
// allocates "size" bytes of executable memory. this must take
|
||||||
|
// things like NX support into account.
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void *osd_alloc_executable(size_t size)
|
||||||
|
{
|
||||||
|
#if defined(SDLMAME_BSD)
|
||||||
|
return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
|
||||||
|
#elif defined(SDLMAME_UNIX)
|
||||||
|
return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_free_executable
|
||||||
|
//
|
||||||
|
// frees memory allocated with osd_alloc_executable
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void osd_free_executable(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
#ifdef SDLMAME_SOLARIS
|
||||||
|
munmap((char *)ptr, size);
|
||||||
|
#else
|
||||||
|
munmap(ptr, size);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_break_into_debugger
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void osd_break_into_debugger(const char *message)
|
||||||
|
{
|
||||||
|
#ifdef MAME_DEBUG
|
||||||
|
printf("MAME exception: %s\n", message);
|
||||||
|
printf("Attempting to fall into debugger\n");
|
||||||
|
kill(getpid(), SIGTRAP);
|
||||||
|
#else
|
||||||
|
printf("Ignoring MAME exception: %s\n", message);
|
||||||
|
#endif
|
||||||
|
}
|
57
src/osd/sdl/sdlmisc_win32.c
Normal file
57
src/osd/sdl/sdlmisc_win32.c
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
//============================================================
|
||||||
|
//
|
||||||
|
// sdlos_*.c - OS specific low level code
|
||||||
|
//
|
||||||
|
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
|
||||||
|
// Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
//
|
||||||
|
// SDLMAME by Olivier Galibert and R. Belmont
|
||||||
|
//
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
// standard sdl header
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
// MAME headers
|
||||||
|
#include "osdcore.h"
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_alloc_executable
|
||||||
|
//
|
||||||
|
// allocates "size" bytes of executable memory. this must take
|
||||||
|
// things like NX support into account.
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void *osd_alloc_executable(size_t size)
|
||||||
|
{
|
||||||
|
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_free_executable
|
||||||
|
//
|
||||||
|
// frees memory allocated with osd_alloc_executable
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void osd_free_executable(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
VirtualFree(ptr, 0, MEM_RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_break_into_debugger
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void osd_break_into_debugger(const char *message)
|
||||||
|
{
|
||||||
|
if (IsDebuggerPresent())
|
||||||
|
{
|
||||||
|
OutputDebugStringA(message);
|
||||||
|
DebugBreak();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -26,4 +26,33 @@
|
|||||||
int osd_num_processors(void);
|
int osd_num_processors(void);
|
||||||
|
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------
|
||||||
|
osd_getenv: return pointer to environment variable
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
name - name of environment variable
|
||||||
|
|
||||||
|
Return value:
|
||||||
|
|
||||||
|
pointer to value
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
char *osd_getenv(const char *name);
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------
|
||||||
|
osd_setenv: set environment variable
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
name - name of environment variable
|
||||||
|
value - value to write
|
||||||
|
overwrite - overwrite if it exists
|
||||||
|
|
||||||
|
Return value:
|
||||||
|
|
||||||
|
0 on success
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
int osd_setenv(const char *name, const char *value, int overwrite);
|
||||||
|
|
||||||
#endif /* __SDLOS__ */
|
#endif /* __SDLOS__ */
|
||||||
|
@ -11,15 +11,7 @@
|
|||||||
|
|
||||||
// standard sdl header
|
// standard sdl header
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
@ -168,44 +160,6 @@ int osd_num_processors(void)
|
|||||||
return processors;
|
return processors;
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
|
||||||
// osd_alloc_executable
|
|
||||||
//
|
|
||||||
// allocates "size" bytes of executable memory. this must take
|
|
||||||
// things like NX support into account.
|
|
||||||
//============================================================
|
|
||||||
|
|
||||||
void *osd_alloc_executable(size_t size)
|
|
||||||
{
|
|
||||||
return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================================
|
|
||||||
// osd_free_executable
|
|
||||||
//
|
|
||||||
// frees memory allocated with osd_alloc_executable
|
|
||||||
//============================================================
|
|
||||||
|
|
||||||
void osd_free_executable(void *ptr, size_t size)
|
|
||||||
{
|
|
||||||
munmap(ptr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================================
|
|
||||||
// osd_break_into_debugger
|
|
||||||
//============================================================
|
|
||||||
|
|
||||||
void osd_break_into_debugger(const char *message)
|
|
||||||
{
|
|
||||||
#ifdef MAME_DEBUG
|
|
||||||
printf("MAME exception: %s\n", message);
|
|
||||||
printf("Attempting to fall into debugger\n");
|
|
||||||
kill(getpid(), SIGTRAP);
|
|
||||||
#else
|
|
||||||
printf("Ignoring MAME exception: %s\n", message);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_malloc
|
// osd_malloc
|
||||||
//============================================================
|
//============================================================
|
||||||
@ -232,3 +186,21 @@ void osd_free(void *ptr)
|
|||||||
#error "MALLOC_DEBUG not yet supported"
|
#error "MALLOC_DEBUG not yet supported"
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_getenv
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
char *osd_getenv(const char *name)
|
||||||
|
{
|
||||||
|
return getenv(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================
|
||||||
|
// osd_setenv
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
int osd_setenv(const char *name, const char *value, int overwrite)
|
||||||
|
{
|
||||||
|
return setenv(name, value, overwrite);
|
||||||
|
}
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <os2.h>
|
#include <os2.h>
|
||||||
|
|
||||||
// MAME headers
|
// MAME headers
|
||||||
#include "osdepend.h"
|
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
|
|
||||||
|
|
||||||
@ -184,40 +183,47 @@ int osd_num_processors(void)
|
|||||||
return numprocs;
|
return numprocs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_alloc_executable
|
// osd_malloc
|
||||||
//
|
|
||||||
// allocates "size" bytes of executable memory. this must take
|
|
||||||
// things like NX support into account.
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
void *osd_alloc_executable(size_t size)
|
void *osd_malloc(size_t size)
|
||||||
{
|
{
|
||||||
void *p;
|
#ifndef MALLOC_DEBUG
|
||||||
|
return malloc(size);
|
||||||
|
#else
|
||||||
|
#error "MALLOC_DEBUG not yet supported"
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
DosAllocMem( &p, size, fALLOC );
|
|
||||||
return p;
|
//============================================================
|
||||||
|
// osd_free
|
||||||
|
//============================================================
|
||||||
|
|
||||||
|
void osd_free(void *ptr)
|
||||||
|
{
|
||||||
|
#ifndef MALLOC_DEBUG
|
||||||
|
free(ptr);
|
||||||
|
#else
|
||||||
|
#error "MALLOC_DEBUG not yet supported"
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_free_executable
|
// osd_getenv
|
||||||
//
|
|
||||||
// frees memory allocated with osd_alloc_executable
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
void osd_free_executable(void *ptr, size_t size)
|
char *osd_getenv(const char *name)
|
||||||
{
|
{
|
||||||
DosFreeMem( ptr );
|
return getenv(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_break_into_debugger
|
// osd_setenv
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
void osd_break_into_debugger(const char *message)
|
int osd_setenv(const char *name, const char *value, int overwrite)
|
||||||
{
|
{
|
||||||
printf("Ignoring MAME exception: %s\n", message);
|
return setenv(name, value, overwrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,13 +9,11 @@
|
|||||||
//
|
//
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
// MAME headers
|
// MAME headers
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
@ -104,48 +102,20 @@ void osd_free(void *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_alloc_executable
|
// osd_getenv
|
||||||
//
|
|
||||||
// allocates "size" bytes of executable memory. this must take
|
|
||||||
// things like NX support into account.
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
void *osd_alloc_executable(size_t size)
|
char *osd_getenv(const char *name)
|
||||||
{
|
{
|
||||||
#if defined(SDLMAME_BSD)
|
return getenv(name);
|
||||||
return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
|
|
||||||
#elif defined(SDLMAME_UNIX)
|
|
||||||
return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_free_executable
|
// osd_setenv
|
||||||
//
|
|
||||||
// frees memory allocated with osd_alloc_executable
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
void osd_free_executable(void *ptr, size_t size)
|
int osd_setenv(const char *name, const char *value, int overwrite)
|
||||||
{
|
{
|
||||||
#ifdef SDLMAME_SOLARIS
|
return setenv(name, value, overwrite);
|
||||||
munmap((char *)ptr, size);
|
|
||||||
#else
|
|
||||||
munmap(ptr, size);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
|
||||||
// osd_break_into_debugger
|
|
||||||
//============================================================
|
|
||||||
|
|
||||||
void osd_break_into_debugger(const char *message)
|
|
||||||
{
|
|
||||||
#ifdef MAME_DEBUG
|
|
||||||
printf("MAME exception: %s\n", message);
|
|
||||||
printf("Attempting to fall into debugger\n");
|
|
||||||
kill(getpid(), SIGTRAP);
|
|
||||||
#else
|
|
||||||
printf("Ignoring MAME exception: %s\n", message);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
// standard sdl header
|
// standard sdl header
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
@ -241,38 +239,35 @@ void osd_free(void *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_alloc_executable
|
// osd_getenv
|
||||||
//
|
|
||||||
// allocates "size" bytes of executable memory. this must take
|
|
||||||
// things like NX support into account.
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
void *osd_alloc_executable(size_t size)
|
char *osd_getenv(const char *name)
|
||||||
{
|
{
|
||||||
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
return getenv(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_free_executable
|
// osd_setenv
|
||||||
//
|
|
||||||
// frees memory allocated with osd_alloc_executable
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
void osd_free_executable(void *ptr, size_t size)
|
int osd_setenv(const char *name, const char *value, int overwrite)
|
||||||
{
|
{
|
||||||
VirtualFree(ptr, 0, MEM_RELEASE);
|
char *buf;
|
||||||
}
|
int result;
|
||||||
|
|
||||||
//============================================================
|
if (!overwrite)
|
||||||
// osd_break_into_debugger
|
|
||||||
//============================================================
|
|
||||||
|
|
||||||
void osd_break_into_debugger(const char *message)
|
|
||||||
{
|
|
||||||
if (IsDebuggerPresent())
|
|
||||||
{
|
{
|
||||||
OutputDebugStringA(message);
|
if (osd_getenv(name) != NULL)
|
||||||
DebugBreak();
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
buf = (char *) osd_malloc(strlen(name)+strlen(value)+2);
|
||||||
|
sprintf(buf, "%s=%s", name, value);
|
||||||
|
result = putenv(buf);
|
||||||
|
|
||||||
|
/* will be referenced by environment
|
||||||
|
* Therefore it is not freed here
|
||||||
|
*/
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@ -27,14 +27,13 @@
|
|||||||
|
|
||||||
#if defined(__sun__) && defined(__svr4__)
|
#if defined(__sun__) && defined(__svr4__)
|
||||||
#define SDLMAME_SOLARIS 1
|
#define SDLMAME_SOLARIS 1
|
||||||
//#undef _XOPEN_SOURCE
|
#undef _XOPEN_SOURCE
|
||||||
|
#undef _XOPEN_VERSION
|
||||||
#undef _XOPEN_SOURCE_EXTENDED
|
#undef _XOPEN_SOURCE_EXTENDED
|
||||||
#undef _XPG6
|
#undef _XPG6
|
||||||
#undef _XPG5
|
#undef _XPG5
|
||||||
#undef _XPG4_2
|
#undef _XPG4_2
|
||||||
|
|
||||||
#undef _XOPEN_SOURCE
|
|
||||||
#undef _XOPEN_VERSION
|
|
||||||
#define _XOPEN_SOURCE
|
#define _XOPEN_SOURCE
|
||||||
#define _XOPEN_VERSION 4
|
#define _XOPEN_VERSION 4
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ struct _osd_event {
|
|||||||
|
|
||||||
struct _osd_thread {
|
struct _osd_thread {
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
|
osd_thread_callback callback;
|
||||||
|
void *param;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _osd_scalable_lock
|
struct _osd_scalable_lock
|
||||||
@ -400,12 +402,21 @@ int osd_event_wait(osd_event *event, osd_ticks_t timeout)
|
|||||||
// osd_thread_create
|
// osd_thread_create
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
|
static void worker_thread_entry(void *param)
|
||||||
|
{
|
||||||
|
osd_thread *thread = (osd_thread *) param;
|
||||||
|
|
||||||
|
thread->callback(thread->param);
|
||||||
|
}
|
||||||
|
|
||||||
osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam)
|
osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam)
|
||||||
{
|
{
|
||||||
osd_thread *thread;
|
osd_thread *thread;
|
||||||
|
|
||||||
thread = (osd_thread *)calloc(1, sizeof(osd_thread));
|
thread = (osd_thread *)calloc(1, sizeof(osd_thread));
|
||||||
thread->thread = _beginthread(callback, NULL, 65535, cbparam);
|
thread->callback = callback;
|
||||||
|
thread->param = cbparam;
|
||||||
|
thread->thread = _beginthread(worker_thread_entry, NULL, 65535, thread);
|
||||||
if ( thread->thread == -1 )
|
if ( thread->thread == -1 )
|
||||||
{
|
{
|
||||||
free(thread);
|
free(thread);
|
||||||
|
@ -571,7 +571,7 @@ static int effective_num_processors(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if the OSDPROCESSORS environment variable is set, use that value if valid
|
// if the OSDPROCESSORS environment variable is set, use that value if valid
|
||||||
procsoverride = getenv(SDLENV_PROCESSORS);
|
procsoverride = osd_getenv(SDLENV_PROCESSORS);
|
||||||
if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0)
|
if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0)
|
||||||
return MIN(4 * physprocs, numprocs);
|
return MIN(4 * physprocs, numprocs);
|
||||||
|
|
||||||
@ -590,7 +590,7 @@ static UINT32 effective_cpu_mask(int index)
|
|||||||
char buf[5];
|
char buf[5];
|
||||||
UINT32 mask = 0xFFFF;
|
UINT32 mask = 0xFFFF;
|
||||||
|
|
||||||
s = getenv(SDLENV_CPUMASKS);
|
s = osd_getenv(SDLENV_CPUMASKS);
|
||||||
if (s != NULL && strcmp(s,"none"))
|
if (s != NULL && strcmp(s,"none"))
|
||||||
{
|
{
|
||||||
if (!strcmp(s,"auto"))
|
if (!strcmp(s,"auto"))
|
||||||
|
@ -11,12 +11,9 @@
|
|||||||
|
|
||||||
// standard sdl header
|
// standard sdl header
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
// MAME headers
|
// MAME headers
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "options.h"
|
|
||||||
#include "emuopts.h"
|
#include "emuopts.h"
|
||||||
|
|
||||||
#include "osdepend.h"
|
#include "osdepend.h"
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
@ -41,10 +41,6 @@
|
|||||||
#include <os2.h>
|
#include <os2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// standard C headers
|
|
||||||
#include <math.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
// MAME headers
|
// MAME headers
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "rendutil.h"
|
#include "rendutil.h"
|
||||||
@ -60,8 +56,7 @@
|
|||||||
#include "debugwin.h"
|
#include "debugwin.h"
|
||||||
|
|
||||||
#include "osdsdl.h"
|
#include "osdsdl.h"
|
||||||
|
#include "sdlos.h"
|
||||||
#include "osd_opengl.h"
|
|
||||||
|
|
||||||
#ifdef MESS
|
#ifdef MESS
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@ -251,7 +246,7 @@ void sdlvideo_monitor_refresh(sdl_monitor_info *monitor)
|
|||||||
SDL_VideoDriverName(monitor->monitor_device, sizeof(monitor->monitor_device)-1);
|
SDL_VideoDriverName(monitor->monitor_device, sizeof(monitor->monitor_device)-1);
|
||||||
if (first_call==0)
|
if (first_call==0)
|
||||||
{
|
{
|
||||||
char *dimstr = getenv(SDLENV_DESKTOPDIM);
|
char *dimstr = osd_getenv(SDLENV_DESKTOPDIM);
|
||||||
const SDL_VideoInfo *sdl_vi;
|
const SDL_VideoInfo *sdl_vi;
|
||||||
|
|
||||||
sdl_vi = SDL_GetVideoInfo();
|
sdl_vi = SDL_GetVideoInfo();
|
||||||
@ -431,11 +426,6 @@ static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect,
|
|||||||
// guess the aspect ratio assuming square pixels
|
// guess the aspect ratio assuming square pixels
|
||||||
monitor->aspect = (float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top);
|
monitor->aspect = (float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top);
|
||||||
|
|
||||||
// SDL will crash if monitors are queried here
|
|
||||||
// This will be done in window.c (Ughh, ugly)
|
|
||||||
|
|
||||||
monitor->modes = NULL;
|
|
||||||
|
|
||||||
// save the primary monitor handle
|
// save the primary monitor handle
|
||||||
if (info.dwFlags & MONITORINFOF_PRIMARY)
|
if (info.dwFlags & MONITORINFOF_PRIMARY)
|
||||||
primary_monitor = monitor;
|
primary_monitor = monitor;
|
||||||
@ -505,7 +495,6 @@ static void init_monitors(void)
|
|||||||
EnumDisplayMonitors(NULL, NULL, monitor_enum_callback, (LPARAM)&tailptr);
|
EnumDisplayMonitors(NULL, NULL, monitor_enum_callback, (LPARAM)&tailptr);
|
||||||
#else
|
#else
|
||||||
add_primary_monitor((void *)&tailptr);
|
add_primary_monitor((void *)&tailptr);
|
||||||
sdl_monitor_list->modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_DOUBLEBUF);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
#ifndef __SDLVIDEO__
|
#ifndef __SDLVIDEO__
|
||||||
#define __SDLVIDEO__
|
#define __SDLVIDEO__
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// CONSTANTS
|
// CONSTANTS
|
||||||
//============================================================
|
//============================================================
|
||||||
@ -52,6 +50,13 @@ enum {
|
|||||||
// TYPE DEFINITIONS
|
// TYPE DEFINITIONS
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
|
typedef struct _sdl_mode sdl_mode;
|
||||||
|
struct _sdl_mode
|
||||||
|
{
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct _sdl_monitor_info sdl_monitor_info;
|
typedef struct _sdl_monitor_info sdl_monitor_info;
|
||||||
struct _sdl_monitor_info
|
struct _sdl_monitor_info
|
||||||
{
|
{
|
||||||
@ -67,10 +72,6 @@ struct _sdl_monitor_info
|
|||||||
float aspect; // computed/configured aspect ratio of the physical device
|
float aspect; // computed/configured aspect ratio of the physical device
|
||||||
int center_width; // width of first physical screen for centering
|
int center_width; // width of first physical screen for centering
|
||||||
int center_height; // height of first physical screen for centering
|
int center_height; // height of first physical screen for centering
|
||||||
#if !SDL_VERSION_ATLEAST(1,3,0)
|
|
||||||
//FIXME: This should not be a SDL-type
|
|
||||||
SDL_Rect **modes; // supported modes
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -934,7 +934,7 @@ static void pick_best_mode(sdl_window_info *window, int *fswidth, int *fsheight)
|
|||||||
minimum_height -= 4;
|
minimum_height -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SDLMAME_WIN32)
|
#if 1 // defined(SDLMAME_WIN32)
|
||||||
/*
|
/*
|
||||||
* We need to do this here. If SDL_ListModes is
|
* We need to do this here. If SDL_ListModes is
|
||||||
* called in init_monitors, the call will crash
|
* called in init_monitors, the call will crash
|
||||||
|
Loading…
Reference in New Issue
Block a user