Selaa lähdekoodia

ps3: add a build-ps3 script that uses autoconf and automake.

legacy
Sam Hocevar sam 14 vuotta sitten
vanhempi
commit
92d0050938
4 muutettua tiedostoa jossa 55 lisäystä ja 6 poistoa
  1. +12
    -0
      build-ps3
  2. +32
    -4
      configure.ac
  3. +2
    -1
      src/ps3app.cpp
  4. +9
    -1
      src/sdlinput.cpp

+ 12
- 0
build-ps3 Näytä tiedosto

@@ -0,0 +1,12 @@
#!/bin/sh

## Native PS3 compilation for Lol Engine -- Sam Hocevar <sam@hocevar.net>

set -e

# Bootstrap, configure and make
# NOTE: ensure that $CELL_SDK is set and ppu-lv2-g++ is in the path
./bootstrap
./configure CXX=ppu-lv2-g++ CC=ppu-lv2-gcc ac_cv_exeext=.elf --host=none
make -j6


+ 32
- 4
configure.ac Näytä tiedosto

@@ -69,6 +69,8 @@ if test "${enable_experimental}" = "yes"; then
AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build) AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build)
fi fi


dnl No exceptions
CXXFLAGS="${CXXFLAGS} -fno-exceptions"
dnl Optimizations dnl Optimizations
CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}" CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule dnl Code qui fait des warnings == code de porc == deux baffes dans ta gueule
@@ -76,6 +78,30 @@ CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Ws


AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm") AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")



dnl Are we on the PS3?
AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
[LOL_LIBS="${LOL_LIBS} -lsysmodule_stub -lsysutil_stub -lresc_stub"
dnl For PSGL
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) # FIXME: hack
GL_LIBS="${GL_LIBS} -lPSGL -lgcm_cmd -lgcm_sys_stub"
if test "x${enable_debug}" = xyes; then
GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/debug"
elif test "x${enable_release}" = xyes; then
GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/ultra-opt"
else
GL_LIBS="${GL_LIBS} -L${CELL_SDK}/target/ppu/lib/PSGL/RSX/opt"
fi
dnl For the runtime Cg compiler
GL_LIBS="${GL_LIBS} -lcgc -lPSGLcgc"
dnl For the PNG decoder
LOL_LIBS="${LOL_LIBS} -lpngdec_stub"
dnl For the pad library
LOL_LIBS="${LOL_LIBS} -lio_stub -lusbd_stub -lpadfilter"
AC_PATH_PROG(MAKE_FSELF, make_fself, no)
AM_CONDITIONAL(USE_MAKE_FSELF, test "${MAKE_FSELF}" != "no")])


dnl Which version of OpenGL to use? dnl Which version of OpenGL to use?
ac_cv_my_have_gl="no" ac_cv_my_have_gl="no"
PKG_CHECK_MODULES(GLES2, glesv2, PKG_CHECK_MODULES(GLES2, glesv2,
@@ -95,11 +121,13 @@ AC_CHECK_HEADER(GL/gl.h,
AC_TRY_LINK([#include <GL/gl.h>], AC_TRY_LINK([#include <GL/gl.h>],
[glLoadIdentity();], [glLoadIdentity();],
[ac_cv_my_have_gl="yes" [ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hacky
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
GL_LIBS="-lopengl32"], GL_LIBS="-lopengl32"],
[AC_MSG_RESULT(no)]) [AC_MSG_RESULT(no)])
LIBS="$LIBS_save"]) LIBS="$LIBS_save"])
AC_CHECK_HEADER(PSGL/psgl.h,
[ac_cv_my_have_gl="yes"])
if test "${ac_cv_my_have_gl}" = "no"; then if test "${ac_cv_my_have_gl}" = "no"; then
AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]]) AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
fi fi
@@ -135,10 +163,10 @@ LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
AC_CHECK_FUNCS(glBegin) AC_CHECK_FUNCS(glBegin)
LIBS="${save_LIBS}" LIBS="${save_LIBS}"


dnl Use SDL? (always required)
dnl Use SDL? (always required on Linux or Win32)
ac_cv_my_have_sdl="yes" ac_cv_my_have_sdl="yes"
AC_PATH_PROG(SDL_CONFIG, sdl-config, no) AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
if test "${SDL_CONFIG}" != "no"; then
if test "${SDL_CONFIG}" != "no" -a "x$cross_compiling" != xyes; then
SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`" SDL_CFLAGS="${SDL_CFLAGS} `sdl-config --cflags`"
SDL_LIBS="${SDL_LIBS} `sdl-config --libs`" SDL_LIBS="${SDL_LIBS} `sdl-config --libs`"
fi fi
@@ -159,7 +187,7 @@ AC_CHECK_HEADERS(SDL_mixer.h, [:], [ac_cv_my_have_sdl="no"])
AC_CHECK_HEADERS(SDL_image.h, [:], [ac_cv_my_have_sdl="no"]) AC_CHECK_HEADERS(SDL_image.h, [:], [ac_cv_my_have_sdl="no"])
CPPFLAGS="${save_CPPFLAGS}" CPPFLAGS="${save_CPPFLAGS}"
if test "${ac_cv_my_have_sdl}" = "no"; then if test "${ac_cv_my_have_sdl}" = "no"; then
AC_MSG_ERROR([[One of SDL, SDL_Image or SDL_Mixer not found]])
AC_MSG_WARN([[One of SDL, SDL_Image or SDL_Mixer not found]])
else else
AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL) AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
fi fi


+ 2
- 1
src/ps3app.cpp Näytä tiedosto

@@ -94,7 +94,8 @@ Ps3App::Ps3App(char const *title, vec2i res, float fps) :


PSGLcontext *ctx = psglCreateContext(); PSGLcontext *ctx = psglCreateContext();
psglMakeCurrent(ctx, psgl); psglMakeCurrent(ctx, psgl);
psglLoadShaderLibrary(REMOTE_PATH "/shaders.bin");
/* TODO: load our shaders when we actually ship them */
//psglLoadShaderLibrary("/shaders.bin");
psglResetCurrentContext(); psglResetCurrentContext();


/* Initialise everything */ /* Initialise everything */


+ 9
- 1
src/sdlinput.cpp Näytä tiedosto

@@ -12,7 +12,9 @@
# include "config.h" # include "config.h"
#endif #endif


#include <SDL.h>
#if defined USE_SDL
# include <SDL.h>
#endif


#include "core.h" #include "core.h"
#include "sdlinput.h" #include "sdlinput.h"
@@ -39,13 +41,16 @@ private:
SdlInput::SdlInput() SdlInput::SdlInput()
: data(new SdlInputData()) : data(new SdlInputData())
{ {
#if defined USE_SDL
SDL_Init(SDL_INIT_TIMER); SDL_Init(SDL_INIT_TIMER);


gamegroup = GAMEGROUP_BEFORE; gamegroup = GAMEGROUP_BEFORE;
#endif
} }


void SdlInput::TickGame(float deltams) void SdlInput::TickGame(float deltams)
{ {
#if defined USE_SDL
Entity::TickGame(deltams); Entity::TickGame(deltams);


/* Handle mouse input */ /* Handle mouse input */
@@ -88,6 +93,7 @@ void SdlInput::TickGame(float deltams)
if (keystate[i]) if (keystate[i])
Input::KeyPressed(i, deltams); Input::KeyPressed(i, deltams);
#endif #endif
#endif
} }


SdlInput::~SdlInput() SdlInput::~SdlInput()
@@ -99,11 +105,13 @@ vec2i SdlInputData::GetMousePos()
{ {
vec2i ret(-1, -1); vec2i ret(-1, -1);


#if defined USE_SDL
if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) if (SDL_GetAppState() & SDL_APPMOUSEFOCUS)
{ {
SDL_GetMouseState(&ret.x, &ret.y); SDL_GetMouseState(&ret.x, &ret.y);
ret.y = Video::GetSize().y - 1 - ret.y; ret.y = Video::GetSize().y - 1 - ret.y;
} }
#endif
return ret; return ret;
} }




Ladataan…
Peruuta
Tallenna