Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenPandora port, with separate Commit for GLES, ARM, and Pandora specific #281

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0a1694e
compiling: Pandora specific Makefile
ptitSeb Oct 12, 2013
0a3e439
renderer: GLES1.1 renderer on OpenGL 1
ptitSeb Oct 12, 2013
64ca2df
renderer: GLES1.1 context creation
ptitSeb Oct 12, 2013
c6dc623
compiling: Pandora specifics settings (keymap, screenres, font size)
ptitSeb Oct 12, 2013
51e822b
compiling: On ARM, avoid unaligned float access
ptitSeb Oct 12, 2013
c4b69fb
renderer: Tool to ease context creation for GLES
ptitSeb Oct 12, 2013
4cc62de
Update README with OpenPandora infos
ptitSeb Sep 2, 2013
8dcd3a9
debug: remove of some leftover printf
ptitSeb Oct 12, 2013
674c2ba
compiling: Makefile is compatible for boath Pandora and non-Pandora e…
ptitSeb Oct 12, 2013
17f602b
compiling: More unligned float access
ptitSeb Oct 12, 2013
c5f1ace
compiling: Better compile flags for Pandora build
ptitSeb Oct 12, 2013
831250f
compiling: Pandora is allways Fullscreen
ptitSeb Oct 12, 2013
93d67ae
fix: Mouse is now grabbed when loading a saved game
ptitSeb Oct 12, 2013
34216e3
Added libs folder directly to the repo
ptitSeb Feb 22, 2016
c2dd004
Fixed gitignore to not ignore libs
ptitSeb Feb 22, 2016
d89d193
Small pandora changes
ptitSeb Feb 22, 2016
6bf829c
Small Pandora fix
ptitSeb Feb 22, 2016
e7bbc66
Added preliminary (and untested) support for ODroid and RPI1/2
ptitSeb Feb 22, 2016
0a2fb6f
Small fix to Makefile for RPI and ODROID
ptitSeb Mar 5, 2016
67d06ba
Another small fix
ptitSeb Mar 5, 2016
442e143
And another one, for RPI only
ptitSeb Mar 5, 2016
1ab3fc4
Added miising opengles header for SDL
ptitSeb Mar 12, 2016
97d8cb3
Try to fix a new BUSERROR for RPI
ptitSeb Mar 28, 2016
fdbb124
Use FB Raw mode for Pandora and RPI by default
ptitSeb Mar 28, 2016
9f3b2c9
Another attempt to fix SEGBUS on RPI2
ptitSeb Mar 29, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
*.sh
*.o
projectx*
libs*
unix*
mingw*
data
Expand Down
80 changes: 74 additions & 6 deletions Makefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,43 @@
# make CC=i686-mingw32-gcc
CC=gcc

PANDORA=1
RPI?=0
ODROID?=0

# general compiler settings
ifeq ($(M32),1)
FLAGS= -m32
endif
ifeq ($(PANDORA),1)
ifeq ($(RPI),1)
FLAGS= -mfpu=vfpv3 -mfloat-abi=hard -fsingle-precision-constant -mno-unaligned-access -fdiagnostics-color=auto -O3 -fsigned-char
FLAGS+= -DRPI
FLAGS+= -DARM
FLAGS += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux
LDFLAGS= -mfpu=vfpv3 -mfloat-abi=hard
HAVE_GLES=1
else ifeq ($(RPI),2)
FLAGS= -mfpu=neon -mfloat-abi=hard -fsingle-precision-constant -mno-unaligned-access -fdiagnostics-color=auto -O3 -fsigned-char
FLAGS+= -DRPI
FLAGS+= -DARM
FLAGS += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux
LDFLAGS= -mfpu=neon -mfloat-abi=hard
HAVE_GLES=1
else ifeq ($(ODROID),1)
FLAGS= -mfpu=neon -mfloat-abi=hard -fsingle-precision-constant -mno-unaligned-access -fdiagnostics-color=auto -O3 -fsigned-char
FLAGS+= -DODROID
FLAGS+= -DARM
LDFLAGS= -mfpu=neon -mfloat-abi=hard
HAVE_GLES=1
else
FLAGS= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -march=armv7-a -fsingle-precision-constant -mno-unaligned-access -fdiagnostics-color=auto -O3 -fsigned-char
FLAGS+= -DPANDORA
FLAGS+= -DARM
LDFLAGS= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
HAVE_GLES=1
endif
endif
FLAGS+= -std=gnu99 -pipe
CFLAGS=$(FLAGS) -Wall -Wextra
LDFLAGS=$(FLAGS)
Expand All @@ -19,7 +52,11 @@ LDFLAGS=$(FLAGS)
DEBUG=1

# might as well leave gprof support on by default as well
PROFILE=1
ifeq ($(PANDORA),1)
PROFILE=0
else
PROFILE=1
endif

# use this if you want to build everything statically
STATIC=0
Expand All @@ -45,7 +82,11 @@ ifeq ($(SSP),1)
endif

ifeq ($(DEBUG),1)
FLAGS+= -g
ifeq ($(PANDORA),1)
FLAGS+= -g
else
FLAGS+= -g
endif
else
CFLAGS+=-O3 -Winit-self
LDFLAGS+=-s
Expand All @@ -64,13 +105,18 @@ endif
#

# some systems use lua5.1
LUA=$(shell pkg-config lua && echo lua || echo lua5.1)
ifeq ($(PANDORA),1)
LUA=$(shell libs/pkgconfig.sh lua && echo lua || echo lua5.1)
else
LUA=$(shell pkg-config lua && echo lua || echo lua5.1)
endif
MACOSX=$(shell uname -a | grep -qi darwin && echo 1 || echo 0)

# which version of sdl do you want to ask pkgconfig for ?
SDL=1
ifeq ($(SDL),1)
SDL_=sdl
CFLAGS+=`sdl-config --cflags`
else
SDL_=sdl$(SDL)
endif
Expand All @@ -82,7 +128,12 @@ $(if $(shell test "$(GL)" -ge 3 -a "$(SDL)" -lt 2 && echo fail), \
$(error "GL >= 3 only supported with SDL >= 2"))

# library headers
CFLAGS+= `pkg-config --cflags $(SDL_) $(LUA) $(LUA)-socket libenet libpng zlib openal`
ifeq ($(PANDORA),1)
CFLAGS+= `libs/pkgconfig.sh --cflags $(LUA) $(LUA)-socket libenet libpng`
CFLAGS+= `pkg-config --cflags $(SDL_) zlib openal`
else
CFLAGS+= `pkg-config --cflags $(SDL_) $(LUA) $(LUA)-socket libenet libpng zlib openal`
endif
ifeq ($(MACOSX),1)
CFLAGS += -DMACOSX
endif
Expand All @@ -95,13 +146,23 @@ ifeq ($(STATIC),1)
LIB+= -Wl,-dn
PKG_CFG_OPTS= --static
endif
LIB+= `pkg-config $(PKG_CFG_OPTS) --libs $(LUA) $(LUA)-socket libenet libpng zlib openal` -lm
ifeq ($(PANDORA),1)
LIB+= `libs/pkgconfig.sh $(PKG_CFG_OPTS) --libs $(LUA) $(LUA)-socket libenet libpng`
LIB+= `pkg-config $(PKG_CFG_OPTS) --libs zlib openal` -lm -lX11
else
LIB+= `pkg-config $(PKG_CFG_OPTS) --libs $(LUA) $(LUA)-socket libenet libpng zlib openal` -lm
endif
LIB+= -lm
ifeq ($(STATIC),1)
LIB+= -Wl,-dy
endif

# dynamic only libraries
LIB+= `pkg-config --libs $(SDL_)`
ifeq ($(PANDORA),1)
LIB+= `sdl-config --libs`
else
LIB+= `pkg-config --libs $(SDL_)`
endif
ifeq ($(MINGW),1)
LIB += -L./mingw/bin
LIB += -lglu32 -lopengl32
Expand All @@ -111,9 +172,14 @@ else ifeq ($(MACOSX),1)
#LIB += -L/usr/X11/lib/ -lGL -lGLU
LIB += -framework OpenGL # OpenGL bundle on OSX.
LIB += -framework Cocoa # Used to target Quartz by SDL_.
else
ifeq ($(HAVE_GLES),1)
LIB += -lGLES_CM -lEGL
CFLAGS += -DHAVE_GLES
else
LIB += -lGL -lGLU
endif
endif
ifneq ($(MINGW),1)
# apparently on some systems -ldl is explicitly required
# perhaps this is part of the default libs on others...?
Expand Down Expand Up @@ -178,11 +244,13 @@ check:
@echo "PROFILE = $(PROFILE)"
@echo "MUDFLAP = $(MUDFLAP)"
@echo "STATIC = $(STATIC)"
@echo "PANDORA = $(PANDORA)"
@echo "PKG_CFG_OPTS = $(PKG_CFG_OPTS)"
@echo "MINGW = $(MINGW)"
@echo "CROSS = $(CROSS)"
@echo "BOT = $(BOT)"
@echo "GL = $(GL)"
@echo "HAVE_GLES = $(HAVE_GLES)"
@echo "RENDER_DISABLED = $(RENDER_DISABLED)"
@echo "LUA = $(LUA)"
@echo "SDL = $(SDL)"
Expand Down
6 changes: 6 additions & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
This repo holds the community port of Forsaken!

Check out the [Wiki](https://github.com/ForsakenX/forsaken/wiki) for more information.

This version is compatible with OpenPandora (ARM and GLES)

#OpenPandora

For information about Forsaken on OpenPandora, look here: http://boards.openpandora.org/index.php/topic/14178-projectx-forsaken/
38 changes: 38 additions & 0 deletions SDL_opengles.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

/**
* \file SDL_opengles.h
*
* This is a simple file to encapsulate the OpenGL ES 1.X API headers.
*/

#ifdef __IPHONEOS__
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#else
#include <GLES/gl.h>
#include <GLES/glext.h>
#endif

#ifndef APIENTRY
#define APIENTRY
#endif
8 changes: 8 additions & 0 deletions bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,18 @@ static bool BSP_LoadPortal( BSP_PORTAL *p, char **Buffer )
int16_tpnt = (int16_t *) *Buffer;
p->group = *int16_tpnt++;
floatpnt = (float *) int16_tpnt;
#ifdef ARM
memcpy(&p->normal, floatpnt, 4*3);
floatpnt+=3;
memcpy(&p->offset, floatpnt, 4);
floatpnt++;
#else
p->normal.x = *floatpnt++;
p->normal.y = *floatpnt++;
p->normal.z = *floatpnt++;
p->offset = *floatpnt++;

#endif
*Buffer = (char *) floatpnt;

return BSP_Loadtree( &p->bsp, Buffer );
Expand Down
10 changes: 9 additions & 1 deletion camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ bool Cameraload( char * Filename )
int16Pnt = (int16_t*) Buffer;
CamPnt->Group = *int16Pnt++;
FloatPnt = (float*) int16Pnt;

#ifdef ARM
memcpy(&CamPnt->Pos, FloatPnt, 4*3);
FloatPnt+=3;
memcpy(&CamPnt->Dir, FloatPnt, 4*3);
FloatPnt+=3;
memcpy(&CamPnt->Up, FloatPnt, 4*3);
FloatPnt+=3;
#else
CamPnt->Pos.x = *FloatPnt++;
CamPnt->Pos.y = *FloatPnt++;
CamPnt->Pos.z = *FloatPnt++;
Expand All @@ -121,6 +128,7 @@ bool Cameraload( char * Filename )
CamPnt->Up.x = *FloatPnt++;
CamPnt->Up.y = *FloatPnt++;
CamPnt->Up.z = *FloatPnt++;
#endif
Buffer = (char*) FloatPnt;
Tempv.x = CamPnt->Pos.x + CamPnt->Dir.x;
Tempv.y = CamPnt->Pos.y + CamPnt->Dir.y;
Expand Down
Loading