Previous 15994 Revisions Next

r4432 Sunday 22nd March, 2009 at 20:06:01 UTC by R. Belmont
[SDLMESS] Sync with SDLMAME 0.130u1. Includes Mac OS X and BSD improvements.
[ROOT]makefile.sdl
[src/osd/sdl]drawogl.c input.c osd_opengl.h osdsdl.h osinline.h sdl.mak sdldir.c sdlfile.c sdlmain.c sdlmisc.c sdlprefix.h sdlsync.h sdltime.c video.c video.h window.c window.h

src/osd/sdl/osd_opengl.h
r4431r4432
18401840   OSD_GL_UNUSED(void,glVertex2sv,(const GLshort *v))
18411841   OSD_GL_UNUSED(void,glVertex3d,(GLdouble x, GLdouble y, GLdouble z))
18421842   OSD_GL_UNUSED(void,glVertex3dv,(const GLdouble *v))
1843   OSD_GL_UNUSED(void,glVertex3f,(GLfloat x, GLfloat y, GLfloat z))
1843   OSD_GL(void,glVertex3f,(GLfloat x, GLfloat y, GLfloat z))
18441844   OSD_GL_UNUSED(void,glVertex3fv,(const GLfloat *v))
18451845   OSD_GL_UNUSED(void,glVertex3i,(GLint x, GLint y, GLint z))
18461846   OSD_GL_UNUSED(void,glVertex3iv,(const GLint *v))
src/osd/sdl/sdlmisc.c
r4431r4432
5050{
5151#if defined(SDLMAME_DARWIN)
5252   return (void *)malloc(size);
53#elif defined(SDLMAME_FREEBSD)
53#elif defined(SDLMAME_BSD)
5454   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
5555#elif defined(SDLMAME_UNIX)
5656   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
src/osd/sdl/drawogl.c
r4431r4432
2222#include "render.h"
2323#include "options.h"
2424#include "driver.h"
25#include "rendutil.h"
2526
2627// standard SDL headers
2728#include <SDL/SDL.h>
r4431r4432
128129//============================================================
129130
130131#define DEBUG_MODE_SCORES   0
132#define USE_WIN32_STYLE_LINES   0   // use the same method baseline does - yields somewhat nicer vectors but a little buggy
131133
132134//============================================================
133135//  CONSTANTS
r4431r4432
258260    GLfloat       texVerticex[8];
259261};
260262
263/* line_aa_step is used for drawing antialiased lines */
264typedef struct _line_aa_step line_aa_step;
265struct _line_aa_step
266{
267   float      xoffs, yoffs;            // X/Y deltas
268   float      weight;               // weight contribution
269};
261270
271static const line_aa_step line_aa_1step[] =
272{
273   {  0.00f,  0.00f,  1.00f  },
274   { 0 }
275};
276
277static const line_aa_step line_aa_4step[] =
278{
279   { -0.25f,  0.00f,  0.25f  },
280   {  0.25f,  0.00f,  0.25f  },
281   {  0.00f, -0.25f,  0.25f  },
282   {  0.00f,  0.25f,  0.25f  },
283   { 0 }
284};
285
262286//============================================================
263287//  INLINES
264288//============================================================
r4431r4432
11511175   render_primitive *prim;
11521176   texture_info *texture=NULL;
11531177   float vofs, hofs;
1154    int  pendingPrimitive=GL_NO_PRIMITIVE, curPrimitive=GL_NO_PRIMITIVE;
1178   int  pendingPrimitive=GL_NO_PRIMITIVE, curPrimitive=GL_NO_PRIMITIVE, scrnum, is_vector;
1179   const device_config *screen;
1180   const screen_config *scrconfig;
11551181
11561182   if (video_config.novideo)
11571183   {
r4431r4432
11711197      glDepthFunc(GL_LEQUAL);
11721198      glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
11731199   }
1200
1201   // figure out if we're vector
1202   scrnum = is_vector = 0;
1203   for (screen = video_screen_first(window->machine->config); screen != NULL; screen = video_screen_next(screen))
1204   {
1205      if (scrnum == window->index)
1206      {
1207         scrconfig = screen->inline_config;
1208         is_vector = (scrconfig->type == SCREEN_TYPE_VECTOR) ? 1 : 0;
1209         break;
1210      }
1211      else
1212      {
1213         scrnum++;
1214      }
1215   }
1216
11741217   // only clear if the geometry changes (and for 2 frames afterward to clear double and triple buffers)
1175   if ((sdl->blittimer > 0) || (video_config.isvector))
1218   if ((sdl->blittimer > 0) || (is_vector))
11761219   {
11771220      glClear(GL_COLOR_BUFFER_BIT);
11781221      sdl->blittimer--;
r4431r4432
12891332          * since entering and leaving one is most expensive..
12901333          */
12911334         case RENDER_PRIMITIVE_LINE:
1335            #if !USE_WIN32_STYLE_LINES
12921336            // check if it's really a point
12931337            if (((prim->bounds.x1 - prim->bounds.x0) == 0) && ((prim->bounds.y1 - prim->bounds.y0) == 0))
12941338            {
r4431r4432
13031347                pendingPrimitive=GL_NO_PRIMITIVE;
13041348            }
13051349
1306                if ( pendingPrimitive==GL_NO_PRIMITIVE )
1307                   set_blendmode(sdl, PRIMFLAG_GET_BLENDMODE(prim->flags));
1350                      if ( pendingPrimitive==GL_NO_PRIMITIVE )
1351            {
1352                         set_blendmode(sdl, PRIMFLAG_GET_BLENDMODE(prim->flags));
1353            }
13081354
13091355            glColor4f(prim->color.r, prim->color.g, prim->color.b, prim->color.a);
13101356
r4431r4432
13241370               glVertex2f(prim->bounds.x0+hofs, prim->bounds.y0+vofs);
13251371               glVertex2f(prim->bounds.x1+hofs, prim->bounds.y1+vofs);
13261372            }
1373            #else
1374            {
1375               const line_aa_step *step = line_aa_4step;
1376               render_bounds b0, b1;
1377               float r, g, b, a;
1378               float effwidth;
1379
1380               // we're not gonna play fancy here.  close anything pending and let's go.
1381               if (pendingPrimitive!=GL_NO_PRIMITIVE && pendingPrimitive!=curPrimitive)
1382               {
1383                   glEnd();
1384                   pendingPrimitive=GL_NO_PRIMITIVE;
1385               }
1386
1387               set_blendmode(sdl, PRIMFLAG_GET_BLENDMODE(prim->flags));
1388
1389               // compute the effective width based on the direction of the line
1390               effwidth = prim->width;
1391               if (effwidth < 0.5f)
1392                  effwidth = 0.5f;
1393
1394               // determine the bounds of a quad to draw this line
1395               render_line_to_quad(&prim->bounds, effwidth, &b0, &b1);
1396
1397               // fix window position
1398               b0.x0 += hofs;
1399               b0.x1 += hofs;
1400               b1.x0 += hofs;
1401               b1.x1 += hofs;
1402               b0.y0 += vofs;
1403               b0.y1 += vofs;
1404               b1.y0 += vofs;
1405               b1.y1 += vofs;
1406
1407               // iterate over AA steps
1408               for (step = PRIMFLAG_GET_ANTIALIAS(prim->flags) ? line_aa_4step : line_aa_1step; step->weight != 0; step++)
1409               {
1410                  glBegin(GL_TRIANGLE_STRIP);
1411
1412                  // rotate the unit vector by 135 degrees and add to point 0
1413                  glVertex2f(b0.x0 + step->xoffs, b0.y0 + step->yoffs);
1414
1415                  // rotate the unit vector by -135 degrees and add to point 0
1416                  glVertex2f(b0.x1 + step->xoffs, b0.y1 + step->yoffs);
1417
1418                  // rotate the unit vector by 45 degrees and add to point 1
1419                  glVertex2f(b1.x0 + step->xoffs, b1.y0 + step->yoffs);
1420
1421                  // rotate the unit vector by -45 degrees and add to point 1
1422                  glVertex2f(b1.x1 + step->xoffs, b1.y1 + step->yoffs);
1423
1424                  // determine the color of the line
1425                  r = (prim->color.r * step->weight);
1426                  g = (prim->color.g * step->weight);
1427                  b = (prim->color.b * step->weight);
1428                  a = (prim->color.a * 255.0f);
1429                  if (r > 1.0) r = 1.0;
1430                  if (g > 1.0) g = 1.0;
1431                  if (b > 1.0) b = 1.0;
1432                  if (a > 1.0) a = 1.0;
1433                  glColor4f(r, g, b, a);
1434
1435//                  texture = texture_update(window, prim, 0);
1436//                  if (texture) printf("line has texture!\n");
1437
1438                  // if we have a texture to use for the vectors, use it here
1439                  #if 0
1440                  if (d3d->vector_texture != NULL)
1441                  {
1442                     printf("SDL: textured lines unsupported\n");
1443                     vertex[0].u0 = d3d->vector_texture->ustart;
1444                     vertex[0].v0 = d3d->vector_texture->vstart;
1445
1446                     vertex[2].u0 = d3d->vector_texture->ustop;
1447                     vertex[2].v0 = d3d->vector_texture->vstart;
1448
1449                     vertex[1].u0 = d3d->vector_texture->ustart;
1450                     vertex[1].v0 = d3d->vector_texture->vstop;
1451
1452                     vertex[3].u0 = d3d->vector_texture->ustop;
1453                     vertex[3].v0 = d3d->vector_texture->vstop;
1454                  }
1455                  #endif
1456                  glEnd();
1457               }
1458            }
1459            #endif
13271460            break;
13281461
13291462         case RENDER_PRIMITIVE_QUAD:
src/osd/sdl/sdl.mak
r4431r4432
127127
128128ifeq ($(TARGETOS),freebsd)
129129TARGETOS = unix
130DEFS += -DNO_THREAD_COOPERATIVE -DNO_DEBUGGER
130DEFS += -DNO_THREAD_COOPERATIVE
131131endif
132132
133ifeq ($(TARGETOS),openbsd)
134TARGETOS = unix
135DEFS += -DNO_THREAD_COOPERATIVE
136endif
137
133138ifeq ($(TARGETOS),unix)
134139DEFS += -DSDLMAME_UNIX
135140ifndef NO_X11
r4431r4432
147152endif
148153ifdef PPC
149154ifdef PTR64
150CFLAGS += -arch ppc64
155CCOMFLAGS += -arch ppc64
151156LDFLAGS += -arch ppc64
152157else
153CFLAGS += -arch ppc
158CCOMFLAGS += -arch ppc
154159LDFLAGS += -arch ppc
155160endif
156161else
157162ifdef PTR64
158CFLAGS += -arch x86_64
163CCOMFLAGS += -arch x86_64
159164LDFLAGS += -arch x86_64
160165else
161CFLAGS += -arch i386
166CCOMFLAGS += -arch i386
162167LDFLAGS += -arch i386
163168endif
164169endif
src/osd/sdl/sdldir.c
r4431r4432
1313#ifdef SDLMAME_LINUX
1414#define __USE_LARGEFILE64
1515#endif
16#ifndef SDLMAME_FREEBSD
16#ifndef SDLMAME_BSD
1717#define _XOPEN_SOURCE 500
1818#endif
1919
r4431r4432
4343struct _osd_directory
4444{
4545   osd_directory_entry ent;
46#if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
46#if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_OS2)
4747   struct dirent *data;
4848#else
4949   struct dirent64 *data;
r4431r4432
5252};
5353
5454
55#if defined (SDLMAME_LINUX) || defined (SDLMAME_FREEBSD) || defined(SDLMAME_DARWIN)
55#if defined (SDLMAME_LINUX) || defined (SDLMAME_BSD) || defined(SDLMAME_DARWIN)
5656static osd_dir_entry_type get_attributes_enttype(int attributes)
5757{
5858   if (attributes == DT_DIR)
r4431r4432
8585
8686static UINT64 osd_get_file_size(const char *file)
8787{
88#if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
88#if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_OS2)
8989   struct stat st;
9090   if(stat(file, &st))
9191      return 0;
r4431r4432
171171
172172const osd_directory_entry *osd_readdir(osd_directory *dir)
173173{
174   #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
174   #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_OS2)
175175   dir->data = readdir(dir->fd);
176176   #else
177177   dir->data = readdir64(dir->fd);
r4431r4432
181181      return NULL;
182182
183183   dir->ent.name = dir->data->d_name;
184   #if defined (SDLMAME_LINUX) || defined (SDLMAME_FREEBSD) || defined(SDLMAME_DARWIN)
184   #if defined (SDLMAME_LINUX) || defined (SDLMAME_BSD) || defined(SDLMAME_DARWIN)
185185   dir->ent.type = get_attributes_enttype(dir->data->d_type);
186186   #else
187187   dir->ent.type = get_attributes_stat(dir->data->d_name);
src/osd/sdl/input.c
r4431r4432
10971097   // register the mice
10981098   sdlinput_register_mice(machine);
10991099
1100#ifdef MAME_DEBUG
1101   if (mouse_enabled)
1100   if (machine->debug_flags & DEBUG_FLAG_ENABLED)
11021101   {
1103      mame_printf_warning("Debug Build: Disabling input grab in window mode ...\n");
1102      mame_printf_warning("Debug Build: Disabling input grab for -debug\n");
11041103      mouse_enabled = 0;
11051104   }
1106#endif
1105
11071106   // get Sixaxis special mode info
11081107   sixaxis_mode = options_get_bool(mame_options(), SDLOPTION_SIXAXIS);
11091108
src/osd/sdl/sdltime.c
r4431r4432
376376{
377377#if defined(__i386__) || defined(__x86_64__)
378378   UINT64 result;
379   UINT32 r1, r2;
380379
381380   // use RDTSC
382381   __asm__ __volatile__ (
383382      "rdtsc"
384      : "=a" (r1), "=d" (r2)
383      : "=A" (result)
385384   );
386385
387   result = ((UINT64)r2<<32) | (UINT64)r1;
388386   return result;
389387#else
390388   return (*ticks_counter)();
src/osd/sdl/sdlprefix.h
r4431r4432
3030#elif defined(__linux__)
3131#define SDLMAME_LINUX 1
3232
33#elif defined(__FreeBSD__) || defined(__DragonFly__)
34#define SDLMAME_FREEBSD 1
33#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
34#define SDLMAME_BSD 1
3535#endif
3636
3737// fix for Ubuntu 8.10
src/osd/sdl/video.c
r4431r4432
121121   // we need the beam width in a float, contrary to what the core does.
122122   video_config.beamwidth = options_get_float(mame_options(), OPTION_BEAM);
123123
124   if (machine->config->video_attributes & SCREEN_TYPE_VECTOR)
125   {
126      video_config.isvector = 1;
127   }
128   else
129   {
130      video_config.isvector = 0;
131   }
132
133124   // initialize the window system so we can make windows
134125   if (sdlwindow_init(machine))
135126      goto error;
src/osd/sdl/window.c
r4431r4432
780780   window->refresh = config->refresh;
781781   window->monitor = monitor;
782782   window->machine = machine;
783   window->index = index;
783784   
784785   //FIXME: these should be per_window in config-> or even better a bit set
785786   window->fullscreen = !video_config.windowed;
src/osd/sdl/video.h
r4431r4432
109109   int               fullstretch;
110110
111111   // vector options
112   int               isvector;      // 1 if vector, 0 if raster
113112   float            beamwidth;      // beam width
114113
115114   // OpenGL options
src/osd/sdl/window.h
r4431r4432
5656   // monitor info
5757   sdl_monitor_info *   monitor;
5858   int               fullscreen;
59   int         index;
5960   
6061   // diverse flags
6162   int               minwidth, minheight;
src/osd/sdl/sdlfile.c
r4431r4432
1313#ifdef SDLMAME_LINUX
1414#define __USE_LARGEFILE64
1515#endif
16#ifndef SDLMAME_FREEBSD
16#ifndef SDLMAME_BSD
1717#define _XOPEN_SOURCE 500
1818#endif
1919
r4431r4432
9696   UINT32 access;
9797   const char *src;
9898   char *dst;
99        #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
99        #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_OS2)
100100   struct stat st;
101101   #else
102102   struct stat64 st;
r4431r4432
180180   #endif
181181
182182   // attempt to open the file
183        #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
183        #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_OS2)
184184   (*file)->handle = open(tmpstr, access, 0666);
185185   #else
186186   (*file)->handle = open64(tmpstr, access, 0666);
r4431r4432
203203            // attempt to reopen the file
204204            if (error == NO_ERROR)
205205            {
206                              #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
206                              #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_OS2)
207207               (*file)->handle = open(tmpstr, access, 0666);
208208               #else
209209               (*file)->handle = open64(tmpstr, access, 0666);
r4431r4432
223223   }
224224
225225   // get the file size
226        #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
226        #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_OS2)
227227   fstat((*file)->handle, &st);
228228   #else
229229   fstat64((*file)->handle, &st);
r4431r4432
253253{
254254   ssize_t result;
255255
256#if defined(SDLMAME_DARWIN) || defined(SDLMAME_FREEBSD)
256#if defined(SDLMAME_DARWIN) || defined(SDLMAME_BSD)
257257   result = pread(file->handle, buffer, count, offset);
258258   if (result < 0)
259259#elif defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_OS2)
r4431r4432
281281{
282282   UINT32 result;
283283
284#if defined(SDLMAME_DARWIN) || defined(SDLMAME_FREEBSD)
284#if defined(SDLMAME_DARWIN) || defined(SDLMAME_BSD)
285285   result = pwrite(file->handle, buffer, count, offset);
286286   if (!result)
287287#elif defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_OS2)
r4431r4432
465465{
466466   int err;
467467   osd_directory_entry *result = NULL;
468   #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
468   #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_OS2)
469469   struct stat st;
470470   #else
471471   struct stat64 st;
472472   #endif
473473   
474   #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
474   #if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_OS2)
475475   err = stat(path, &st);
476476   #else
477477   err = stat64(path, &st);
src/osd/sdl/sdlsync.h
r4431r4432
210210
211211INLINE int osd_event_wait(osd_event *event, osd_ticks_t timeout)
212212{
213   return WaitForSingleObject((HANDLE) event, timeout * 1000 / osd_ticks_per_second());
213   int ret = WaitForSingleObject((HANDLE) event, timeout * 1000 / osd_ticks_per_second());
214   return ( ret == WAIT_OBJECT_0);
214215}
215216
216217INLINE void osd_event_reset(osd_event *event)
src/osd/sdl/osinline.h
r4431r4432
1717#if defined(__i386__) || defined(__x86_64__)
1818
1919
20INLINE void osd_yield_processor(void)
20INLINE void ATTR_FORCE_INLINE
21osd_yield_processor(void)
2122{
2223   __asm__ __volatile__ ( " rep ; nop ;" );
2324}
r4431r4432
2930//  osd_exchange64
3031//============================================================
3132
32ATTR_UNUSED
33INLINE INT64 _osd_exchange64(INT64 volatile *ptr, INT64 exchange)
33INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE
34_osd_exchange64(INT64 volatile *ptr, INT64 exchange)
3435{
3536   register INT64 ret;
3637   __asm__ __volatile__ (
r4431r4432
4950#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__)
5051
5152
52INLINE void osd_yield_processor(void)
53INLINE void ATTR_FORCE_INLINE
54osd_yield_processor(void)
5355{
5456   __asm__ __volatile__ ( " nop \n nop \n" );
5557}
r4431r4432
6264//  osd_exchange64
6365//============================================================
6466
65ATTR_UNUSED
66INLINE INT64 _osd_exchange64(INT64 volatile *ptr, INT64 exchange)
67INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE
68_osd_exchange64(INT64 volatile *ptr, INT64 exchange)
6769{
6870   register INT64 ret;
6971   __asm__ __volatile__ (
7072      "1: ldarx  %[ret], 0, %[ptr]      \n"
7173      "   stdcx. %[exchange], 0, %[ptr] \n"
72      "   bne--  1b                     \n"
74      "   bne-   1b                     \n"
7375      : [ret]      "=&r" (ret)
7476      : [ptr]      "r"   (ptr)
7577      , [exchange] "r"   (exchange)
src/osd/sdl/sdlmain.c
r4431r4432
455455   MACRO_VERBOSE(SDLMAME_LINUX);
456456   MACRO_VERBOSE(SDLMAME_SOLARIS);
457457   MACRO_VERBOSE(SDLMAME_IRIX);
458   MACRO_VERBOSE(SDLMAME_FREEBSD);
458   MACRO_VERBOSE(SDLMAME_BSD);
459459   MACRO_VERBOSE(LSB_FIRST);
460460   MACRO_VERBOSE(PTR64);
461461   MACRO_VERBOSE(MAME_DEBUG);
src/osd/sdl/osdsdl.h
r4431r4432
210210#else
211211#define SDLMAME_EVENTS_IN_WORKER_THREAD   (0)
212212#endif
213
213         
214214#if defined(SDLMAME_WIN32)
215#define SDLMAME_INIT_IN_WORKER_THREAD   (1)
215#if (SDL_VERSION_ATLEAST(1,3,0))
216#define SDLMAME_INIT_IN_WORKER_THREAD (0) //FIXME: breaks mt
217#define SDL13_COMBINE_RESIZE (1)
216218#else
217#define SDLMAME_INIT_IN_WORKER_THREAD   (0)
219#define SDLMAME_INIT_IN_WORKER_THREAD (1)
220#define SDL13_COMBINE_RESIZE (0)
218221#endif
222#else
223#define SDL13_COMBINE_RESIZE (0)
224#define SDLMAME_INIT_IN_WORKER_THREAD (0)
225#endif
219226
220227#if defined(SDLMAME_NO_X11) || defined(SDLMAME_WIN32)
221228#define SDLMAME_HAS_DEBUGGER          (0)
makefile.sdl
r4431r4432
11###########################################################################
22#
3#   makefile.sdl
3#   makefile
44#
55#   Core makefile for building SDLMAME and derivatives
66#
r4431r4432
146146# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
147147# OPTIMIZE = 3
148148
149# experimental: uncomment to compile everything as C++ for stricter type checking
150# CPP_COMPILE = 1
149151
152
150153###########################################################################
151154##################   END USER-CONFIGURABLE OPTIONS   ######################
152155###########################################################################
r4431r4432
210213DEBUGSUFFIX = d
211214endif
212215
216# cpp builds get a 'pp' suffix
217ifdef CPP_COMPILE
218CPPSUFFIX = pp
219endif
220
213221# the name is just 'target' if no subtarget; otherwise it is
214222# the concatenation of the two (e.g., mametiny)
215223ifeq ($(TARGET),$(SUBTARGET))
r4431r4432
219227endif
220228
221229# fullname is prefix+name+suffix+debugsuffix
222FULLNAME = $(PREFIX)$(NAME)$(SUFFIX)$(DEBUGSUFFIX)
230FULLNAME = $(PREFIX)$(NAME)$(CPPSUFFIX)$(SUFFIX)$(DEBUGSUFFIX)
223231
224232# add an EXE suffix to get the final emulator name
225233EMULATOR = $(FULLNAME)$(EXE)
r4431r4432
281289
282290#-------------------------------------------------
283291# compile flags
292# CCOMFLAGS are common flags
293# CONLYFLAGS are flags only used when compiling for C
294# CPPONLYFLAGS are flags only used when compiling for C++
284295#-------------------------------------------------
285296
286# we compile to C89 standard with GNU extensions
287CFLAGS = -std=gnu89
297# start with empties for everything
298CCOMFLAGS =
299CONLYFLAGS =
300CPPONLYFLAGS =
288301
302# CFLAGS is defined based on C or C++ targets
303# (remember, expansion only happens when used, so doing it here is ok)
304ifdef CPP_COMPILE
305CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
306else
307CFLAGS = $(CCOMFLAGS) $(CONLYFLAGS)
308endif
309
310# we compile C-only to C89 standard with GNU extensions
311# we compile C++ code to C++98 standard with GNU extensions
312CONLYFLAGS += -std=gnu89
313CPPONLYFLAGS += -x c++ -std=gnu++98
314
289315# this speeds it up a bit by piping between the preprocessor/compiler/assembler
290CFLAGS += -pipe
316CCOMFLAGS += -pipe
291317
292# add -g if we need symbols
318# add -g if we need symbols, and ensure we have frame pointers
293319ifdef SYMBOLS
294CFLAGS += -g
320CCOMFLAGS += -g -fno-omit-frame-pointer
295321endif
296322
297323# add -v if we need verbose build information
298324ifdef VERBOSE
299CFLAGS += -v
325CCOMFLAGS += -v
300326endif
301327
302# add a basic set of warnings
303CFLAGS += \
304   -Wall \
305   -Wpointer-arith \
306   -Wbad-function-cast \
307   -Wcast-align \
308   -Wstrict-prototypes \
309   -Wundef \
310   -Wformat-security \
311   -Wwrite-strings \
312
313328# add profiling information for the compiler
314329ifdef PROFILE
315CFLAGS += -pg
330CCOMFLAGS += -pg
316331endif
317332
318# this warning is not supported on the os2 compilers
319ifneq ($(TARGETOS),os2)
320CFLAGS += -Wdeclaration-after-statement
321endif
322
323333# add the optimization flag
324CFLAGS += -O$(OPTIMIZE)
334CCOMFLAGS += -O$(OPTIMIZE)
325335
326336# if we are optimizing, include optimization options
327337# and make all errors into warnings
328338ifneq ($(OPTIMIZE),0)
329CFLAGS += $(ARCHOPTS) -fno-strict-aliasing
330339ifneq ($(TARGETOS),os2)
331CFLAGS += -Werror
340CCOMFLAGS += -Werror -fno-strict-aliasing $(ARCHOPTS)
341else
342CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
332343endif
333344endif
334345
335# if symbols are on, make sure we have frame pointers
336ifdef SYMBOLS
337CFLAGS += -fno-omit-frame-pointer
346# add a basic set of warnings
347CCOMFLAGS += \
348   -Wall \
349   -Wcast-align \
350   -Wundef \
351   -Wformat-security \
352   -Wwrite-strings \
353   -Wno-sign-compare
354
355# warnings only applicable to C compiles
356CONLYFLAGS += \
357   -Wpointer-arith \
358   -Wbad-function-cast \
359   -Wstrict-prototypes
360
361# this warning is not supported on the os2 compilers
362ifneq ($(TARGETOS),os2)
363CONLYFLAGS += -Wdeclaration-after-statement
338364endif
339365
340366
341
342367#-------------------------------------------------
343368# include paths
344369#-------------------------------------------------
345370
346371# add core include paths
347CFLAGS += \
372CCOMFLAGS += \
348373   -I$(SRC)/$(TARGET) \
349374   -I$(SRC)/$(TARGET)/includes \
350375   -I$(OBJ)/$(TARGET)/layout \
r4431r4432
392417LDFLAGSEMULATOR += -Wl,-Map,$(FULLNAME).map
393418endif
394419
395# any reason why this doesn't work for all cases?
396ifeq ($(TARGETOS),macosx)
397LDFLAGSEMULATOR += -Xlinker -all_load
398endif
399420
400421
401
402422#-------------------------------------------------
403423# define the standard object directory; other
404424# projects can add their object directories to
r4431r4432
434454
435455# add expat XML library
436456ifdef BUILD_EXPAT
437CFLAGS += -I$(SRC)/lib/expat
457CCOMFLAGS += -I$(SRC)/lib/expat
438458EXPAT = $(OBJ)/libexpat.a
439459else
440460LIBS += -lexpat
r4431r4432
443463
444464# add ZLIB compression library
445465ifdef BUILD_ZLIB
446CFLAGS += -I$(SRC)/lib/zlib
466CCOMFLAGS += -I$(SRC)/lib/zlib
447467ZLIB = $(OBJ)/libz.a
448468else
449469LIBS += -lz
r4431r4432
460480all: maketree buildtools emulator tools
461481
462482
483
484
463485#-------------------------------------------------
464486# defines needed by multiple make files
465487#-------------------------------------------------

Previous 15994 Revisions Next


© 1998-2018 The MESS Team