mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Improve SDL2 support as much as I can, for now. The game compiles, links, and starts, but all three renderers either don't display correctly or crash.
To build with SDL2: make RENDERTYPE=SDL SDL_TARGET=2 git-svn-id: https://svn.eduke32.com/eduke32@4074 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
84e61d03bf
commit
612284cfea
7 changed files with 123 additions and 85 deletions
|
@ -277,7 +277,11 @@ endif
|
||||||
ifeq ($(RENDERTYPE),SDL)
|
ifeq ($(RENDERTYPE),SDL)
|
||||||
ifeq ($(PLATFORM),WINDOWS)
|
ifeq ($(PLATFORM),WINDOWS)
|
||||||
OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
|
OURCOMMONFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
|
||||||
|
ifeq ($(SDL_TARGET),1)
|
||||||
LIBS+= platform/Windows/lib$(WINLIB)/SDL_mixer.lib
|
LIBS+= platform/Windows/lib$(WINLIB)/SDL_mixer.lib
|
||||||
|
else
|
||||||
|
LIBS+= -l$(SDLNAME)_mixer
|
||||||
|
endif
|
||||||
LIBDIRS+= -L$(SDLROOT)/lib
|
LIBDIRS+= -L$(SDLROOT)/lib
|
||||||
else
|
else
|
||||||
ifneq ($(PLATFORM),DARWIN)
|
ifneq ($(PLATFORM),DARWIN)
|
||||||
|
|
|
@ -9,36 +9,10 @@ EDITORLIB=libbuild.a
|
||||||
# SDK locations - adjust to match your setup
|
# SDK locations - adjust to match your setup
|
||||||
# Overrides must use absolute paths since this Makefile is included at different directory levels
|
# Overrides must use absolute paths since this Makefile is included at different directory levels
|
||||||
#
|
#
|
||||||
SDLCONFIG ?= sdl-config
|
|
||||||
SDLNAME ?= SDL
|
|
||||||
SDL_FRAMEWORK ?= 1
|
|
||||||
|
|
||||||
DXROOT=$(abspath $(dir $(MAKEFILE_COMMON))../sdk/dx)
|
DXROOT=$(abspath $(dir $(MAKEFILE_COMMON))../sdk/dx)
|
||||||
#DXROOT=/c/sdks/directx/dx8
|
#DXROOT=/c/sdks/directx/dx8
|
||||||
SDLROOT=$(abspath $(dir $(MAKEFILE_COMMON))../sdk/SDL)
|
SDLROOT=$(abspath $(dir $(MAKEFILE_COMMON))../sdk/SDL)
|
||||||
|
|
||||||
ifneq ($(PLATFORM),WINDOWS)
|
|
||||||
SDLVERSION:=$(strip $(shell $(SDLCONFIG) --version))
|
|
||||||
ifneq ($(SDLVERSION),)
|
|
||||||
SDLROOT:=$(strip $(shell $(SDLCONFIG) --prefix))
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Uncomment the following line to enable SDL 2.X detection
|
|
||||||
#TRYSDL2=1
|
|
||||||
ifeq ($(TRYSDL2),1)
|
|
||||||
SDL2CONFIG ?= sdl2-config
|
|
||||||
SDL2NAME ?= SDL2
|
|
||||||
|
|
||||||
SDL2VERSION:=$(strip $(shell $(SDL2CONFIG) --version))
|
|
||||||
ifneq ($(SDL2VERSION),)
|
|
||||||
SDLVERSION:=$(SDL2VERSION)
|
|
||||||
SDLCONFIG:=$(SDL2CONFIG)
|
|
||||||
SDLNAME:=$(SDL2NAME)
|
|
||||||
SDLROOT:=$(strip $(shell $(SDLCONFIG) --prefix))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
DXROOT_OVERRIDE ?=
|
DXROOT_OVERRIDE ?=
|
||||||
SDLROOT_OVERRIDE ?=
|
SDLROOT_OVERRIDE ?=
|
||||||
ifneq ($(DXROOT_OVERRIDE),)
|
ifneq ($(DXROOT_OVERRIDE),)
|
||||||
|
@ -48,6 +22,26 @@ ifneq ($(SDLROOT_OVERRIDE),)
|
||||||
SDLROOT=$(SDLROOT_OVERRIDE)
|
SDLROOT=$(SDLROOT_OVERRIDE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
SDL_TARGET ?= 1
|
||||||
|
|
||||||
|
ifeq ($(SDL_TARGET),2)
|
||||||
|
SDLCONFIG ?= sdl2-config
|
||||||
|
SDLNAME ?= SDL2
|
||||||
|
endif
|
||||||
|
ifeq ($(SDL_TARGET),1)
|
||||||
|
SDLCONFIG ?= sdl-config
|
||||||
|
SDLNAME ?= SDL
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(PLATFORM),WINDOWS)
|
||||||
|
SDLVERSION:=$(strip $(shell $(SDLCONFIG) --version))
|
||||||
|
ifneq ($(SDLVERSION),)
|
||||||
|
SDLROOT:=$(strip $(shell $(SDLCONFIG) --prefix))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
SDL_FRAMEWORK ?= 1
|
||||||
|
|
||||||
|
|
||||||
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4)))
|
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4)))
|
||||||
L_SSP := -lssp
|
L_SSP := -lssp
|
||||||
|
@ -185,7 +179,11 @@ ifneq (0,$(CLANG))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
SDL_STATIC?=1
|
||||||
|
|
||||||
ifeq ($(RENDERTYPE),SDL)
|
ifeq ($(RENDERTYPE),SDL)
|
||||||
|
BUILDCOMMONFLAGS += -DSDL_TARGET=$(SDL_TARGET)
|
||||||
|
|
||||||
ifeq ($(SDL_FRAMEWORK),1)
|
ifeq ($(SDL_FRAMEWORK),1)
|
||||||
BUILDCOMMONFLAGS += -DSDL_FRAMEWORK
|
BUILDCOMMONFLAGS += -DSDL_FRAMEWORK
|
||||||
endif
|
endif
|
||||||
|
@ -207,7 +205,12 @@ ifeq ($(RENDERTYPE),SDL)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
BUILDCOMMONFLAGS += -D_GNU_SOURCE=1
|
BUILDCOMMONFLAGS += -D_GNU_SOURCE=1
|
||||||
BUILDLIBS+= -lmingw32 -lSDLmain -lSDL
|
ifneq ($(SDL_STATIC),0)
|
||||||
|
ifneq ($(SDL_TARGET),1) # Since SDL2 is under the zlib license, link statically if possible.
|
||||||
|
BUILDLIBS+= -static
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
BUILDLIBS+= -l$(SDLNAME)main -l$(SDLNAME) -lmingw32 -limm32 -lole32 -loleaut32 -lwinmm -lversion
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (1,$(WITHOUT_GTK))
|
ifeq (1,$(WITHOUT_GTK))
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
#define __SDL_INC_H
|
#define __SDL_INC_H
|
||||||
|
|
||||||
#if defined(SDL_FRAMEWORK)
|
#if defined(SDL_FRAMEWORK)
|
||||||
|
# if (SDL_TARGET == 2)
|
||||||
|
# include <SDL2/SDL.h>
|
||||||
|
# include <SDL2/SDL_thread.h>
|
||||||
|
# else
|
||||||
# include <SDL/SDL.h>
|
# include <SDL/SDL.h>
|
||||||
|
# include <SDL/SDL_thread.h>
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# include "SDL.h"
|
# include "SDL.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,10 +35,18 @@ Minimum required SDL versions:
|
||||||
#if defined(_NEED_SDLMIXER)
|
#if defined(_NEED_SDLMIXER)
|
||||||
# if defined(SDL_FRAMEWORK)
|
# if defined(SDL_FRAMEWORK)
|
||||||
# if defined(_WIN32) || defined(GEKKO)
|
# if defined(_WIN32) || defined(GEKKO)
|
||||||
|
# if (SDL_TARGET == 2)
|
||||||
|
# include <SDL2/SDL_mixer.h>
|
||||||
|
# else
|
||||||
# include <SDL/SDL_mixer.h>
|
# include <SDL/SDL_mixer.h>
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# if (SDL_TARGET == 2)
|
||||||
|
# include <SDL2_mixer/SDL_mixer.h>
|
||||||
# else
|
# else
|
||||||
# include <SDL_mixer/SDL_mixer.h>
|
# include <SDL_mixer/SDL_mixer.h>
|
||||||
# endif
|
# endif
|
||||||
|
# endif
|
||||||
# else
|
# else
|
||||||
# include "SDL_mixer.h"
|
# include "SDL_mixer.h"
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// for the Build Engine
|
// for the Build Engine
|
||||||
// by Jonathon Fowler (jf@jonof.id.au)
|
// by Jonathon Fowler (jf@jonof.id.au)
|
||||||
//
|
//
|
||||||
// Use SDL 1.2 or 1.3 from http://www.libsdl.org
|
// Use SDL 1.2 or 2.0 from http://www.libsdl.org
|
||||||
|
|
||||||
#define __STDC_FORMAT_MACROS
|
#define __STDC_FORMAT_MACROS
|
||||||
#define __STDC_LIMIT_MACROS
|
#define __STDC_LIMIT_MACROS
|
||||||
|
@ -81,6 +81,7 @@ static SDL_Surface *sdl_surface2;
|
||||||
static SDL_Palette *sdl_palptr;
|
static SDL_Palette *sdl_palptr;
|
||||||
static SDL_Window *sdl_window;
|
static SDL_Window *sdl_window;
|
||||||
static SDL_Renderer *sdl_renderer;
|
static SDL_Renderer *sdl_renderer;
|
||||||
|
static SDL_GLContext sdl_context;
|
||||||
#endif
|
#endif
|
||||||
int32_t xres=-1, yres=-1, bpp=0, fullscreen=0, bytesperline;
|
int32_t xres=-1, yres=-1, bpp=0, fullscreen=0, bytesperline;
|
||||||
intptr_t frameplace=0;
|
intptr_t frameplace=0;
|
||||||
|
@ -560,7 +561,14 @@ int32_t initinput(void)
|
||||||
{
|
{
|
||||||
i = SDL_NumJoysticks();
|
i = SDL_NumJoysticks();
|
||||||
initprintf("%d joystick(s) found\n",i);
|
initprintf("%d joystick(s) found\n",i);
|
||||||
for (j=0; j<i; j++) initprintf(" %d. %s\n", j+1, SDL_JoystickName(j));
|
for (j=0; j<i; j++)
|
||||||
|
initprintf(" %d. %s\n", j+1,
|
||||||
|
#if SDL_MAJOR_VERSION==1
|
||||||
|
SDL_JoystickName(j)
|
||||||
|
#else
|
||||||
|
SDL_JoystickNameForIndex(j)
|
||||||
|
#endif
|
||||||
|
);
|
||||||
joydev = SDL_JoystickOpen(0);
|
joydev = SDL_JoystickOpen(0);
|
||||||
if (joydev)
|
if (joydev)
|
||||||
{
|
{
|
||||||
|
@ -736,12 +744,17 @@ void grabmouse(char a)
|
||||||
if (a != mousegrab)
|
if (a != mousegrab)
|
||||||
{
|
{
|
||||||
#if !defined __ANDROID__ && (!defined DEBUGGINGAIDS || defined _WIN32 || defined __APPLE__)
|
#if !defined __ANDROID__ && (!defined DEBUGGINGAIDS || defined _WIN32 || defined __APPLE__)
|
||||||
|
#if SDL_MAJOR_VERSION==1
|
||||||
SDL_GrabMode g;
|
SDL_GrabMode g;
|
||||||
|
|
||||||
g = SDL_WM_GrabInput(a ? SDL_GRAB_ON : SDL_GRAB_OFF);
|
g = SDL_WM_GrabInput(a ? SDL_GRAB_ON : SDL_GRAB_OFF);
|
||||||
mousegrab = (g == SDL_GRAB_ON);
|
mousegrab = (g == SDL_GRAB_ON);
|
||||||
|
|
||||||
SDL_ShowCursor(mousegrab ? SDL_DISABLE : SDL_ENABLE);
|
SDL_ShowCursor(mousegrab ? SDL_DISABLE : SDL_ENABLE);
|
||||||
|
#else
|
||||||
|
if (!SDL_SetRelativeMouseMode(a ? SDL_TRUE : SDL_FALSE))
|
||||||
|
mousegrab = a;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
mousegrab = a;
|
mousegrab = a;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1041,11 +1054,7 @@ void getvalidmodes(void)
|
||||||
pf.BitsPerPixel = cdepths[j];
|
pf.BitsPerPixel = cdepths[j];
|
||||||
pf.BytesPerPixel = cdepths[j] >> 3;
|
pf.BytesPerPixel = cdepths[j] >> 3;
|
||||||
|
|
||||||
modes = SDL_ListModes(&pf, SURFACE_FLAGS
|
modes = SDL_ListModes(&pf, SURFACE_FLAGS | SDL_FULLSCREEN);
|
||||||
// #if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3)
|
|
||||||
| SDL_FULLSCREEN // not implemented/working in SDL 1.3 SDL_compat.c
|
|
||||||
//#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
if (modes == (SDL_Rect **)0)
|
if (modes == (SDL_Rect **)0)
|
||||||
{
|
{
|
||||||
|
@ -1179,10 +1188,10 @@ static void destroy_window_and_renderer()
|
||||||
sdl_window = NULL;
|
sdl_window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t create_window_and_renderer(int32_t x, int32_t y, int32_t fs, uint32_t flags)
|
static int32_t create_window_and_renderer(int32_t x, int32_t y, int32_t c, int32_t fs, uint32_t flags)
|
||||||
{
|
{
|
||||||
sdl_window = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,
|
sdl_window = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,
|
||||||
x,y, ((fs&1)?SDL_WINDOW_FULLSCREEN:0));
|
x,y, ((fs&1)?SDL_WINDOW_FULLSCREEN:0) | (c > 8 ? SDL_WINDOW_OPENGL : 0));
|
||||||
if (!sdl_window)
|
if (!sdl_window)
|
||||||
{
|
{
|
||||||
initprintf("Unable to set video mode: SDL_CreateWindow failed: %s\n",
|
initprintf("Unable to set video mode: SDL_CreateWindow failed: %s\n",
|
||||||
|
@ -1199,6 +1208,9 @@ static int32_t create_window_and_renderer(int32_t x, int32_t y, int32_t fs, uint
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c > 8)
|
||||||
|
sdl_context = SDL_GL_CreateContext(sdl_window);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1338,7 +1350,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
|
||||||
# else
|
# else
|
||||||
destroy_window_and_renderer();
|
destroy_window_and_renderer();
|
||||||
|
|
||||||
if (create_window_and_renderer(x,y,fs, SDL_RENDERER_ACCELERATED) == -1)
|
if (create_window_and_renderer(x,y,c,fs, SDL_RENDERER_ACCELERATED) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1361,7 +1373,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
|
||||||
destroy_window_and_renderer();
|
destroy_window_and_renderer();
|
||||||
|
|
||||||
// init
|
// init
|
||||||
if (create_window_and_renderer(x,y,fs, SDL_RENDERER_SOFTWARE |
|
if (create_window_and_renderer(x,y,c,fs, SDL_RENDERER_SOFTWARE |
|
||||||
SDL_RENDERER_TARGETTEXTURE) == -1)
|
SDL_RENDERER_TARGETTEXTURE) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -1764,7 +1776,13 @@ int32_t setpalette(int32_t start, int32_t num)
|
||||||
Bmemcpy(sdlayer_pal, curpalettefaded, 256*4);
|
Bmemcpy(sdlayer_pal, curpalettefaded, 256*4);
|
||||||
|
|
||||||
for (i=start, n=num; n>0; i++, n--)
|
for (i=start, n=num; n>0; i++, n--)
|
||||||
curpalettefaded[i].f = sdlayer_pal[i].unused = 0;
|
curpalettefaded[i].f =
|
||||||
|
#if SDL_MAJOR_VERSION==1
|
||||||
|
sdlayer_pal[i].unused
|
||||||
|
#else
|
||||||
|
sdlayer_pal[i].a
|
||||||
|
#endif
|
||||||
|
= 0;
|
||||||
|
|
||||||
needpalupdate = 1;
|
needpalupdate = 1;
|
||||||
|
|
||||||
|
@ -1877,12 +1895,11 @@ static SDL_Surface *loadappicon(void)
|
||||||
|
|
||||||
int32_t handleevents_peekkeys(void)
|
int32_t handleevents_peekkeys(void)
|
||||||
{
|
{
|
||||||
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION == 2)
|
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
#if SDL_MAJOR_VERSION==1
|
||||||
return SDL_PeepEvents(NULL, 1, SDL_PEEKEVENT, SDL_EVENTMASK(SDL_KEYDOWN));
|
return SDL_PeepEvents(NULL, 1, SDL_PEEKEVENT, SDL_EVENTMASK(SDL_KEYDOWN));
|
||||||
#else
|
#else
|
||||||
// SDL 1.3 up has not been tested to compile.
|
return SDL_PeepEvents(NULL, 1, SDL_PEEKEVENT, SDL_KEYDOWN, SDL_KEYDOWN);
|
||||||
return 0;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1901,7 +1918,7 @@ int32_t handleevents(void)
|
||||||
{
|
{
|
||||||
switch (ev.type)
|
switch (ev.type)
|
||||||
{
|
{
|
||||||
#if (SDL_MAJOR_VERSION > 1 || SDL_MINOR_VERSION > 2)
|
#if (SDL_MAJOR_VERSION > 1 || (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION > 2))
|
||||||
case SDL_TEXTINPUT:
|
case SDL_TEXTINPUT:
|
||||||
j = 0;
|
j = 0;
|
||||||
do
|
do
|
||||||
|
@ -1930,9 +1947,17 @@ int32_t handleevents(void)
|
||||||
ev.key.keysym.scancode == SDL_SCANCODE_TAB) &&
|
ev.key.keysym.scancode == SDL_SCANCODE_TAB) &&
|
||||||
((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
|
((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
|
||||||
{
|
{
|
||||||
if (OSD_HandleChar(ev.key.keysym.unicode & 0x7f))
|
char keyvalue;
|
||||||
|
switch (ev.key.keysym.scancode)
|
||||||
{
|
{
|
||||||
keyasciififo[keyasciififoend] = ev.key.keysym.unicode & 0x7f;
|
case SDL_SCANCODE_RETURN: keyvalue = '\n'; break;
|
||||||
|
case SDL_SCANCODE_BACKSPACE: keyvalue = '\b'; break;
|
||||||
|
case SDL_SCANCODE_TAB: keyvalue = '\t'; break;
|
||||||
|
default: keyvalue = 0; break;
|
||||||
|
}
|
||||||
|
if (OSD_HandleChar(keyvalue))
|
||||||
|
{
|
||||||
|
keyasciififo[keyasciififoend] = keyvalue;
|
||||||
keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1));
|
keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1966,6 +1991,23 @@ int32_t handleevents(void)
|
||||||
keypresscallback(code, 0);
|
keypresscallback(code, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SDL_MOUSEWHEEL:
|
||||||
|
// initprintf("wheel y %d\n",ev.wheel.y);
|
||||||
|
if (ev.wheel.y > 0)
|
||||||
|
{
|
||||||
|
mwheelup = totalclock;
|
||||||
|
mouseb |= 16;
|
||||||
|
if (mousepresscallback)
|
||||||
|
mousepresscallback(5, 1);
|
||||||
|
}
|
||||||
|
if (ev.wheel.y < 0)
|
||||||
|
{
|
||||||
|
mwheeldown = totalclock;
|
||||||
|
mouseb |= 32;
|
||||||
|
if (mousepresscallback)
|
||||||
|
mousepresscallback(6, 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
switch (ev.window.event)
|
switch (ev.window.event)
|
||||||
{
|
{
|
||||||
|
@ -1999,25 +2041,6 @@ int32_t handleevents(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/*
|
|
||||||
case SDL_MOUSEWHEEL:
|
|
||||||
initprintf("wheel y %d\n",ev.wheel.y);
|
|
||||||
if (ev.wheel.y > 0)
|
|
||||||
{
|
|
||||||
mwheelup = totalclock;
|
|
||||||
mouseb |= 16;
|
|
||||||
if (mousepresscallback)
|
|
||||||
mousepresscallback(5, 1);
|
|
||||||
}
|
|
||||||
if (ev.wheel.y < 0)
|
|
||||||
{
|
|
||||||
mwheeldown = totalclock;
|
|
||||||
mouseb |= 32;
|
|
||||||
if (mousepresscallback)
|
|
||||||
mousepresscallback(6, 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
// #warning Using SDL 1.3 or 2.X
|
// #warning Using SDL 1.3 or 2.X
|
||||||
#else // SDL 1.3+ ^^^ | vvv SDL 1.2
|
#else // SDL 1.3+ ^^^ | vvv SDL 1.2
|
||||||
// #warning Using SDL 1.2
|
// #warning Using SDL 1.2
|
||||||
|
@ -2444,7 +2467,7 @@ static int32_t buildkeytranslationtable(void)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else // if SDL 1.3
|
#else // if SDL 1.3+
|
||||||
static int32_t buildkeytranslationtable(void)
|
static int32_t buildkeytranslationtable(void)
|
||||||
{
|
{
|
||||||
memset(keytranslation,0,sizeof(keytranslation));
|
memset(keytranslation,0,sizeof(keytranslation));
|
||||||
|
|
|
@ -5,9 +5,10 @@ OBJ=obj
|
||||||
OBJNAME=libjfaudiolib.a
|
OBJNAME=libjfaudiolib.a
|
||||||
SRC=src
|
SRC=src
|
||||||
INC=include
|
INC=include
|
||||||
|
EINC=../../$(EROOT)/include
|
||||||
|
|
||||||
# for BUILD_ECHOFLAGS:
|
# for BUILD_ECHOFLAGS:
|
||||||
OURCOMMONFLAGS=$(BASECOMMONFLAGS) $(BUILDCOMMONFLAGS) -I$(INC) -I$(SRC) -DHAVE_VORBIS
|
OURCOMMONFLAGS=$(BASECOMMONFLAGS) $(BUILDCOMMONFLAGS) -I$(INC) -I$(EINC) -I$(SRC) -DHAVE_VORBIS
|
||||||
ifneq ($(PLATFORM),WII)
|
ifneq ($(PLATFORM),WII)
|
||||||
OURCOMMONFLAGS+= -DHAVE_FLAC
|
OURCOMMONFLAGS+= -DHAVE_FLAC
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -22,20 +22,9 @@
|
||||||
* libSDL output driver for MultiVoc
|
* libSDL output driver for MultiVoc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#if defined(SDL_FRAMEWORK)
|
#define _NEED_SDLMIXER
|
||||||
# include <SDL/SDL.h>
|
#include "sdl_inc.h"
|
||||||
# if defined(_WIN32) || defined(GEKKO)
|
|
||||||
# include <SDL/SDL_mixer.h>
|
|
||||||
# else
|
|
||||||
# include <SDL_mixer/SDL_mixer.h>
|
|
||||||
# endif
|
|
||||||
# include <SDL/SDL_thread.h>
|
|
||||||
#else
|
|
||||||
# include "SDL.h"
|
|
||||||
# include "SDL_mixer.h"
|
|
||||||
# include "SDL_thread.h"
|
|
||||||
#endif
|
|
||||||
#include "driver_sdl.h"
|
#include "driver_sdl.h"
|
||||||
#include "multivoc.h"
|
#include "multivoc.h"
|
||||||
|
|
||||||
|
|
|
@ -484,7 +484,11 @@ int32_t MUSIC_PlaySong(char *song, int32_t loopflag)
|
||||||
else initprintf("%s: fopen: %s\n", __func__, strerror(errno));
|
else initprintf("%s: fopen: %s\n", __func__, strerror(errno));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
music_musicchunk = Mix_LoadMUS_RW(SDL_RWFromMem((char *) song, g_musicSize));
|
music_musicchunk = Mix_LoadMUS_RW(SDL_RWFromMem((char *) song, g_musicSize)
|
||||||
|
#if (SDL_MAJOR_VERSION > 1)
|
||||||
|
, SDL_FALSE
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
if (music_musicchunk != NULL)
|
if (music_musicchunk != NULL)
|
||||||
if (Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_LoopSong)?-1:0) == -1)
|
if (Mix_PlayMusic(music_musicchunk, (loopflag == MUSIC_LoopSong)?-1:0) == -1)
|
||||||
|
|
Loading…
Reference in a new issue