Browse Source

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

legacy
Sam Hocevar sam 13 years ago
parent
commit
92d0050938
4 changed files with 55 additions and 6 deletions
  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 View File

@@ -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 View File

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

dnl No exceptions
CXXFLAGS="${CXXFLAGS} -fno-exceptions"
dnl Optimizations
CXXFLAGS="${CXXFLAGS} ${REL} ${OPT}"
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")


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?
ac_cv_my_have_gl="no"
PKG_CHECK_MODULES(GLES2, glesv2,
@@ -95,11 +121,13 @@ AC_CHECK_HEADER(GL/gl.h,
AC_TRY_LINK([#include <GL/gl.h>],
[glLoadIdentity();],
[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)
GL_LIBS="-lopengl32"],
[AC_MSG_RESULT(no)])
LIBS="$LIBS_save"])
AC_CHECK_HEADER(PSGL/psgl.h,
[ac_cv_my_have_gl="yes"])
if test "${ac_cv_my_have_gl}" = "no"; then
AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
fi
@@ -135,10 +163,10 @@ LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
AC_CHECK_FUNCS(glBegin)
LIBS="${save_LIBS}"

dnl Use SDL? (always required)
dnl Use SDL? (always required on Linux or Win32)
ac_cv_my_have_sdl="yes"
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_LIBS="${SDL_LIBS} `sdl-config --libs`"
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"])
CPPFLAGS="${save_CPPFLAGS}"
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
AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL)
fi


+ 2
- 1
src/ps3app.cpp View File

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

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

/* Initialise everything */


+ 9
- 1
src/sdlinput.cpp View File

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

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

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

gamegroup = GAMEGROUP_BEFORE;
#endif
}

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

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

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

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



Loading…
Cancel
Save