Skip to content

Commit

Permalink
Dummy Xbox port
Browse files Browse the repository at this point in the history
  • Loading branch information
JayFoxRox committed Sep 5, 2019
1 parent 5ee13f2 commit 65e722d
Show file tree
Hide file tree
Showing 23 changed files with 415 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@
/mapc.exe
/contrib/curve.exe
/*.dll

*.obj
/bin
/main.exe
/main.lib
/*.iso
/default.xbe
113 changes: 113 additions & 0 deletions Makefile.nxdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
NXDK_DIR = $(CURDIR)/../XboxDev/nxdk

XBE_TITLE = NeverballX
OUTPUT_DIR = bin
GEN_XISO = $(XBE_TITLE).iso

CFLAGS =

CFLAGS += -ferror-limit=0

CFLAGS += -DENABLE_OPENGLES=1
#CFLAGS += -DCONFIG_USER=\"$(USERDIR)\" \
#CFLAGS += -DCONFIG_DATA=\"$(DATADIR)\" \
#CFLAGS += -DCONFIG_LOCALE=\"$(LOCALEDIR)\"
CFLAGS += -I$(CURDIR)/share/ -I$(CURDIR)/xbox/ -D_CRTIMP=

BALL_SRCS := \
$(CURDIR)/share/lang.c \
$(CURDIR)/share/st_common.c \
$(CURDIR)/share/vec3.c \
$(CURDIR)/share/base_image.c \
$(CURDIR)/share/image.c \
$(CURDIR)/share/solid_base.c \
$(CURDIR)/share/solid_vary.c \
$(CURDIR)/share/solid_draw.c \
$(CURDIR)/share/solid_all.c \
$(CURDIR)/share/mtrl.c \
$(CURDIR)/share/part.c \
$(CURDIR)/share/geom.c \
$(CURDIR)/share/ball.c \
$(CURDIR)/share/gui.c \
$(CURDIR)/share/font.c \
$(CURDIR)/share/theme.c \
$(CURDIR)/share/base_config.c \
$(CURDIR)/share/config.c \
$(CURDIR)/share/video.c \
$(CURDIR)/share/glext.c \
$(CURDIR)/share/binary.c \
$(CURDIR)/share/state.c \
$(CURDIR)/share/audio.c \
$(CURDIR)/share/text.c \
$(CURDIR)/share/common.c \
$(CURDIR)/share/list.c \
$(CURDIR)/share/queue.c \
$(CURDIR)/share/cmd.c \
$(CURDIR)/share/array.c \
$(CURDIR)/share/dir.c \
$(CURDIR)/share/fbo.c \
$(CURDIR)/share/glsl.c \
$(CURDIR)/share/fs_common.c \
$(CURDIR)/share/fs_png.c \
$(CURDIR)/share/fs_jpg.c \
$(CURDIR)/share/fs_ov.c \
$(CURDIR)/share/log.c \
$(CURDIR)/share/joy.c \
$(CURDIR)/ball/hud.c \
$(CURDIR)/ball/game_common.c \
$(CURDIR)/ball/game_client.c \
$(CURDIR)/ball/game_server.c \
$(CURDIR)/ball/game_proxy.c \
$(CURDIR)/ball/game_draw.c \
$(CURDIR)/ball/score.c \
$(CURDIR)/ball/level.c \
$(CURDIR)/ball/progress.c \
$(CURDIR)/ball/set.c \
$(CURDIR)/ball/demo.c \
$(CURDIR)/ball/demo_dir.c \
$(CURDIR)/ball/util.c \
$(CURDIR)/ball/st_conf.c \
$(CURDIR)/ball/st_demo.c \
$(CURDIR)/ball/st_save.c \
$(CURDIR)/ball/st_goal.c \
$(CURDIR)/ball/st_fail.c \
$(CURDIR)/ball/st_done.c \
$(CURDIR)/ball/st_level.c \
$(CURDIR)/ball/st_over.c \
$(CURDIR)/ball/st_play.c \
$(CURDIR)/ball/st_set.c \
$(CURDIR)/ball/st_start.c \
$(CURDIR)/ball/st_title.c \
$(CURDIR)/ball/st_help.c \
$(CURDIR)/ball/st_name.c \
$(CURDIR)/ball/st_shared.c \
$(CURDIR)/ball/st_pause.c \
$(CURDIR)/ball/st_ball.c \
$(CURDIR)/ball/main.c

BALL_SRCS += share/solid_sim_sol.c
BALL_SRCS += share/fs_stdio.c
BALL_SRCS += share/tilt_null.c
BALL_SRCS += share/hmd_null.c

SRCS = $(BALL_SRCS) xbox/xbox.c
#SHADER_OBJS = ps.inl vs.inl

# Add SDL
NXDK_SDL = y

# Add vorbis and ogg
include $(CURDIR)/xbox/Makefile-vorbis.xbox
include $(CURDIR)/xbox/Makefile-ogg.xbox

all: $(OUTPUT_DIR)/default.xbe data $(GEN_XISO)

# Add data to XISO
#FIXME: Copy files to $(OUTPUT_DIR)
data: force
@echo "Updating data"
@cp -r $(CURDIR)/data $(OUTPUT_DIR)

force:

include $(NXDK_DIR)/Makefile
7 changes: 7 additions & 0 deletions share/base_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
#include "fs.h"

#ifdef _WIN32
#ifndef NXDK
#include <shlobj.h>
#endif
#endif

/*---------------------------------------------------------------------------*/

Expand Down Expand Up @@ -51,6 +53,7 @@ static const char *pick_data_path(const char *arg_data_path)
static const char *pick_home_path(void)
{
#ifdef _WIN32
#ifndef NXDK
static char path[MAX_PATH];

if (SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, path) == S_OK)
Expand All @@ -67,6 +70,10 @@ static const char *pick_home_path(void)
}
else
return fs_base_dir();
#else
//FIXME: Xbox
return fs_base_dir();
#endif
#else
const char *path;

Expand Down
4 changes: 4 additions & 0 deletions share/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,14 @@ int rand_between(int low, int high)

#ifdef _WIN32

#ifndef NXDK
/* MinGW hides this from ANSI C. MinGW-w64 doesn't. */
_CRTIMP int _putenv(const char *envstring);
#endif

int set_env_var(const char *name, const char *value)
{
#ifndef NXDK
if (name)
{
char str[MAXSTR];
Expand All @@ -345,6 +348,7 @@ int set_env_var(const char *name, const char *value)

return (_putenv(str) == 0);
}
#endif
return 0;
}

Expand Down
178 changes: 178 additions & 0 deletions xbox/GLES/gl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
typedef float GLfloat;
typedef int GLboolean;
typedef int GLenum;
typedef int GLint;
typedef int GLsizei;
typedef short GLshort;
typedef unsigned char GLubyte;
typedef unsigned int GLuint;
typedef unsigned short GLushort;
typedef void GLvoid;

#define GL_FALSE 0
#define GL_TRUE 1

// Hopefully each of these is unique..
#define GL_ALPHA_TEST 1
#define GL_ALWAYS 2
#define GL_AMBIENT 3
#define GL_BACK 4
#define GL_CCW 5
#define GL_CLAMP_TO_EDGE 6
#define GL_CLIP_PLANE0 7
#define GL_CLIP_PLANE1 8
#define GL_CLIP_PLANE2 9
#define GL_COLOR_BUFFER_BIT 10
#define GL_COLOR_MATERIAL 11
#define GL_CULL_FACE 12
#define GL_CW 13
#define GL_DEPTH_BUFFER_BIT 14
#define GL_DEPTH_TEST 15
#define GL_DIFFUSE 16
#define GL_EMISSION 17
#define GL_EQUAL 18
#define GL_EXTENSIONS 19
#define GL_FLOAT 21
#define GL_FRONT 22
#define GL_FRONT_AND_BACK 23
#define GL_GEQUAL 24
#define GL_GREATER 25
#define GL_KEEP 26
#define GL_LEQUAL 27
#define GL_LESS 28
#define GL_LIGHT0 29
#define GL_LIGHTING 30
#define GL_LIGHT_MODEL_AMBIENT 31
#define GL_LIGHT_MODEL_TWO_SIDE 32
#define GL_LINEAR 33
#define GL_LUMINANCE 34
#define GL_LUMINANCE_ALPHA 35
#define GL_MAX_TEXTURE_SIZE 36
#define GL_MAX_TEXTURE_UNITS 37
#define GL_MODELVIEW 38
#define GL_NEVER 39
#define GL_NORMAL_ARRAY 40
#define GL_NOTEQUAL 41
#define GL_ONE 42
#define GL_ONE_MINUS_SRC_ALPHA 43
#define GL_PACK_ALIGNMENT 44
#define GL_POINTS 45
#define GL_POLYGON_OFFSET_FILL 46
#define GL_POSITION 47
#define GL_PROJECTION 48
#define GL_RENDERER 49
#define GL_REPLACE 50
#define GL_RGB 51
#define GL_RGBA 52
#define GL_SHININESS 53
#define GL_SPECULAR 54
#define GL_SRC_ALPHA 55
#define GL_STENCIL_BUFFER_BIT 56
#define GL_TEXTURE 57
#define GL_TEXTURE_2D 58
#define GL_TEXTURE_COORD_ARRAY 59
#define GL_TEXTURE_MAG_FILTER 60
#define GL_TEXTURE_MIN_FILTER 61
#define GL_TEXTURE_WRAP_S 62
#define GL_TEXTURE_WRAP_T 63
#define GL_TRIANGLES 64
#define GL_TRIANGLE_STRIP 65
#define GL_UNPACK_ALIGNMENT 66
#define GL_UNSIGNED_BYTE 67
#define GL_UNSIGNED_SHORT 68
#define GL_VENDOR 69
#define GL_VERSION 70
#define GL_VERTEX_ARRAY 71



// Getters
#define glGetIntegerv(...) 0
#define glGetString(...) 0

// Clearing
#define glClear(...) 0
#define glClearColor(...) 0

// Buffers
#define glGenBuffers(...) 0
#define glBindBuffer(...) 0
#define glBufferData(...) 0
#define glBufferSubData(...) 0
#define glDeleteBuffers(...) 0

// Vertex buffers
#define glTexCoordPointer(...) 0
#define glColorPointer(...) 0
#define glNormalPointer(...) 0
#define glVertexPointer(...) 0

// Draw calls
#define glDrawArrays(...) 0
#define glDrawElements(...) 0

// Matrix functions
#define glMatrixMode(...) 0
#define glLoadIdentity(...) 0
#define glMultMatrixf(...) 0
#define glOrthof(...) 0
#define glTranslatef(...) 0
#define glRotatef(...) 0
#define glScalef(...) 0
#define glPopMatrix(...) 0
#define glPushMatrix(...) 0
#define glViewport(...) 0

// Textures
#define glGenTextures(...) 0
#define glBindTexture(...) 0
#define glActiveTexture(...) 0
#define glClientActiveTexture(...) 0
#define glDeleteTextures(...) 0
#define glTexImage2D(...) 0
#define glTexParameteri(...) 0

// TexEnv
#define glTexEnvi(...) 0

// Renderstates
#define glAlphaFunc(...) 0
#define glBlendFunc(...) 0
#define glClipPlanef(...) 0
#define glColor4f(...) 0
#define glColor4ub(...) 0
#define glColorMask(...) 0
#define glCullFace(...) 0
#define glDepthFunc(...) 0
#define glDepthMask(...) 0
#define glDisable(...) 0
#define glDisableClientState(...) 0
#define glEnable(...) 0
#define glEnableClientState(...) 0
#define glFrontFace(...) 0

// Stencil actions
#define glStencilFunc(...) 0
#define glStencilOp(...) 0

// Misc.
#define glPointParameterf(...) 0
#define glPointParameterfv(...) 0
#define glPointSize(...) 0
#define glPolygonOffset(...) 0

// Pixel readback
#define glReadPixels(...) 0

// Lighting
#define glLightfv(...) 0
#define glLightModelf(...) 0
#define glLightModelfv(...) 0

// Materials
#define glMaterialfv(...) 0

// Pixel pushing
#define glPixelStorei(...) 0


7 changes: 7 additions & 0 deletions xbox/Makefile-ogg.xbox
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#OGG_DIR = $(NXDK_DIR)/lib/ogg
OGG_DIR = $(CURDIR)/xbox/nxdk-ogg
OGG_SRCS += $(wildcard $(OGG_DIR)/src/*.c)

SRCS += $(OGG_SRCS)
CFLAGS += -isystem $(OGG_DIR)/include \
-DXBOX
32 changes: 32 additions & 0 deletions xbox/Makefile-vorbis.xbox
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#VORBIS_DIR = $(NXDK_DIR)/lib/vorbis
VORBIS_DIR = $(CURDIR)/xbox/nxdk-vorbis

# libvorbis
VORBIS_SRCS += $(VORBIS_DIR)/lib/analysis.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/bitrate.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/block.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/codebook.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/envelope.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/floor0.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/floor1.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/info.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/lookup.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/lpc.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/lsp.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/mapping0.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/mdct.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/psy.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/registry.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/res0.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/sharedbook.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/smallft.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/synthesis.c
VORBIS_SRCS += $(VORBIS_DIR)/lib/window.c

# libvorbisfile
VORBIS_SRCS += $(VORBIS_DIR)/lib/vorbisfile.c

SRCS += $(VORBIS_SRCS)
CFLAGS += -isystem $(VORBIS_DIR)/include \
-DHAVE_ALLOCA_H \
-DXBOX
1 change: 1 addition & 0 deletions xbox/alloca.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define alloca(size) __builtin_alloca (size)
Loading

0 comments on commit 65e722d

Please sign in to comment.