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

Dummy Xbox port #1

Open
wants to merge 93 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
b407add
neverball: port dir_list_files() to win32
JayFoxRox Dec 18, 2019
365e4d5
neverball: port dir_exists() to win32
JayFoxRox Dec 18, 2019
aa02e65
neverball: pick xbox home path for NXDK
JayFoxRox Dec 18, 2019
b4b6218
neverball: disable set_env_var() for NXDK
JayFoxRox Dec 18, 2019
8aa529f
disable SDL_GL_SetAttribute for NXDK
JayFoxRox Dec 18, 2019
d10ea32
Add Dummy Xbox Port
JayFoxRox Dec 18, 2019
24a544b
REMOVEME annotate draw calls via stdout
JayFoxRox Dec 18, 2019
f6e11af
REMOVEME neverball log to hal/debug.h
JayFoxRox Dec 16, 2019
3f71786
REMOVEME only allow certain files to miss
JayFoxRox Dec 18, 2019
7e63c28
REMOVEME workaround for pdclib scanf bug
JayFoxRox Dec 19, 2019
82797b9
REMOVEME touch asserts and more debug print
JayFoxRox Dec 20, 2019
35628ef
REMOVEME more file related debug messages
JayFoxRox Dec 20, 2019
b15786c
hax
JayFoxRox Dec 21, 2019
7c43bbe
REMOVEME Disable some more asserts
JayFoxRox Dec 23, 2019
2114aac
more win
JayFoxRox Dec 23, 2019
0e1cb49
REMOVEME: Disable shadows in default config
JayFoxRox Dec 24, 2019
bf57c7e
more-xbox-hax
JayFoxRox Dec 24, 2019
336b6a0
neverball: Disable some log header (crashes Xbox port) - needs invest…
JayFoxRox Dec 27, 2019
aed0a5a
fixupxbox
JayFoxRox Dec 27, 2019
2622ee4
use libs from modern nxdk (untested)
JayFoxRox May 7, 2020
9d45a82
update to planned XGU (untested)
JayFoxRox May 7, 2020
e8cc6db
fix FFP on hw (untested)
JayFoxRox May 7, 2020
505fc05
use paths for modern nxdk compatibility
JayFoxRox May 7, 2020
0d22bc5
Remove hacky _windows.h for modern nxdk
JayFoxRox May 7, 2020
9c3260b
debug print where I assume problems
JayFoxRox May 7, 2020
c4cd351
remove stupid X suffix
JayFoxRox May 7, 2020
770cf65
Force user to configure their nxdk
JayFoxRox May 7, 2020
65c9146
remove redundant include
JayFoxRox May 7, 2020
3b56097
critical bugfix in win32 filesearch for neverball
JayFoxRox May 7, 2020
fabc89a
REMOVEME: many debug prints
JayFoxRox May 7, 2020
e6d8b6e
move log for modern nxdk and add entry message
JayFoxRox May 7, 2020
e4b7271
critical nxdk win32 filelist bugfix HACKY
JayFoxRox May 7, 2020
8fcffa5
split debugmessage in dir related func
JayFoxRox May 7, 2020
fb2c86f
force ascii in win32 filelist neverball code
JayFoxRox May 7, 2020
bb95c31
add nxdk workarounds in build-system
JayFoxRox May 7, 2020
0c3603b
fix path for modern nxdk
JayFoxRox May 7, 2020
1684130
hack for stack-corruption crash avoidance
JayFoxRox May 7, 2020
58bde6d
fix paths for new nxdk in asserts
JayFoxRox May 7, 2020
a805ff9
change config path so it finds default video mode
JayFoxRox May 7, 2020
f7daf42
hacks for windows path
JayFoxRox May 7, 2020
4acbc5d
critical fix to make path work on Xbox
JayFoxRox May 7, 2020
478fb30
show graphics
JayFoxRox May 7, 2020
0e912a0
Remove some debug prints
JayFoxRox May 14, 2020
3b76d17
partial normalize support
JayFoxRox May 14, 2020
2abd9f8
depth func support
JayFoxRox May 14, 2020
747bdad
invert front face mode for Xbox (WHY?)
JayFoxRox May 14, 2020
9da918d
undo texcoord bug workaround
JayFoxRox May 14, 2020
b696728
use newer xgu_set_texture_address
JayFoxRox May 14, 2020
40a8b89
add hacky states in setup_matrice
JayFoxRox May 14, 2020
29c9e14
fix transforms (2D and 3D work now)
JayFoxRox May 14, 2020
e014593
add workaround for safety (no longer needed with inverted front-face)
JayFoxRox May 14, 2020
f03ccf0
clear using XGU functions
JayFoxRox May 14, 2020
5c928ed
re-enable glDrawArrays
JayFoxRox May 14, 2020
4c90155
fix bug in base game where path wasn't normalized
JayFoxRox May 14, 2020
b356d4f
attempt to fix clear-color
JayFoxRox May 14, 2020
2c16610
add texture swizzling and wrapmodes
JayFoxRox May 14, 2020
f82cf03
depthfunc
JayFoxRox May 15, 2020
5793c57
texture matrices
JayFoxRox May 15, 2020
6a01304
Support depth mask
JayFoxRox May 15, 2020
51c7295
Support stencil func
JayFoxRox May 15, 2020
8d13366
Add texgen support (broken in XQEMU)
JayFoxRox May 15, 2020
d0ba3a5
leave note about tex matrix perf
JayFoxRox May 15, 2020
36957a4
backport nv2a-re changes
JayFoxRox May 15, 2020
09319de
Expect XGU in system nxdk
JayFoxRox May 15, 2020
edf68d9
Fix critical bug in setup_textures
JayFoxRox May 15, 2020
d3d915c
fixup xbox makefile copying wrong files
JayFoxRox May 15, 2020
365e7aa
fixup data move
JayFoxRox May 18, 2020
2710f4d
implement materials properly (?)
JayFoxRox May 18, 2020
5ec0a4e
check memory allocations
JayFoxRox May 18, 2020
62a17ed
fix typo
JayFoxRox May 18, 2020
5d18ff1
Use correct values for texfilter
JayFoxRox May 18, 2020
45ad85a
Avoid debugging to disk
JayFoxRox May 18, 2020
d97f393
Improve debug button (move from start to back)
JayFoxRox May 18, 2020
6583711
Improve logging of unimplemented things
JayFoxRox May 18, 2020
7b43ac9
Continue clipplane support
JayFoxRox May 18, 2020
f5972f2
more stencil ops
JayFoxRox May 18, 2020
8f22f7d
set clipping during init
JayFoxRox May 18, 2020
5c0560d
fix textures
JayFoxRox May 18, 2020
769888d
remove printing on clear
JayFoxRox May 18, 2020
ca72bdb
add an unconditional debugPrint (broken)
JayFoxRox May 21, 2020
6abfd16
attempt to fix lighting matrix
JayFoxRox May 21, 2020
eb7ca40
display memory information every frame
JayFoxRox May 21, 2020
97646a8
remove useless synchronization with GPU
JayFoxRox May 21, 2020
e714143
Attempt to enable zbuffer compression (if not already active)
JayFoxRox May 21, 2020
72d319d
free textures on deletion
JayFoxRox May 22, 2020
972ecd2
reset GPU command list pointer more often
JayFoxRox May 22, 2020
e742f31
generate mipmaps (unconditionally for now)
JayFoxRox May 22, 2020
8a63659
avoid setting some texture registers (errros on hw - FIXME)
JayFoxRox May 22, 2020
dbaf7c1
set mipmap level settings in texture units (FIXME: wrong values)
JayFoxRox May 22, 2020
f0c9bea
debug hacks
JayFoxRox May 22, 2020
4c7a184
Add GL_GENERATE_MIPMAP_SGIS to enable mipmaps in the game
JayFoxRox May 23, 2020
746d8c8
pick proper mipmap level (FIXME: Confirm if not off-by-one)
JayFoxRox May 23, 2020
42a8be9
Add forgotten alpha setter for setup_texenv_output
JayFoxRox May 23, 2020
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
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
118 changes: 118 additions & 0 deletions Makefile.nxdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
XBE_TITLE = Neverball
OUTPUT_DIR = bin
GEN_XISO = $(XBE_TITLE).iso

CFLAGS =

CFLAGS += -ferror-limit=0

CFLAGS += -DENABLE_OPENGLES=1
#CFLAGS += -DCONFIG_USER=\"E:\\\\UDATA\\\\Neverball\"
CFLAGS += -DCONFIG_USER=\"D:\\\\Neverball\"
CFLAGS += -DCONFIG_DATA=\"D:\\\\Neverball\"
CFLAGS += -DCONFIG_LOCALE=\"D:\\\\Neverball\\\\locale\"
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 xbox/swizzle.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)/Neverball
@echo "Updating config"
@cp -r $(CURDIR)/xbox/neverballrc $(OUTPUT_DIR)/Neverball #FIXME: Buggy

force:

include $(NXDK_DIR)/Makefile

# nxdk workarounds
NXDK_CFLAGS := $(CFLAGS) $(NXDK_CFLAGS)
CFLAGS := -Wno-deprecated-declarations
50 changes: 33 additions & 17 deletions ball/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
#include "st_level.h"
#include "st_pause.h"

#ifdef NXDK
#include <hal/debug.h>
#else
#define debugPrint(...)
#endif

const char TITLE[] = "Neverball " VERSION;
const char ICON[] = "icon/neverball.png";

Expand Down Expand Up @@ -523,65 +529,70 @@ static void make_dirs_and_migrate(void)

fs_mkdir("Screenshots");
}

#include <assert.h>
/*---------------------------------------------------------------------------*/

int main(int argc, char *argv[])
{
int t1, t0;

debugPrint("%s:%d\n", __FILE__, __LINE__);
if (!fs_init(argc > 0 ? argv[0] : NULL))
{
fprintf(stderr, "Failure to initialize virtual file system (%s)\n",
fs_error());
return 1;
}

debugPrint("%s:%d\n", __FILE__, __LINE__);
opt_parse(argc, argv);

debugPrint("%s:%d\n", __FILE__, __LINE__);
config_paths(opt_data);
debugPrint("%s:%d\n", __FILE__, __LINE__);
log_init("Neverball", "neverball.log");
debugPrint("%s:%d\n", __FILE__, __LINE__);
make_dirs_and_migrate();

/* Initialize SDL. */

debugPrint("%s:%d\n", __FILE__, __LINE__);
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) == -1)
{
log_printf("Failure to initialize SDL (%s)\n", SDL_GetError());
return 1;
}

debugPrint("%s:%d\n", __FILE__, __LINE__);
/* Enable joystick events. */

debugPrint("%s:%d\n", __FILE__, __LINE__);
joy_init();

/* Intitialize configuration. */

debugPrint("%s:%d\n", __FILE__, __LINE__);
config_init();
config_load();

debugPrint("%s:%d\n", __FILE__, __LINE__);
/* Initialize localization. */

lang_init();

debugPrint("%s:%d\n", __FILE__, __LINE__);
/* Initialize audio. */

//assert(0);
audio_init();
tilt_init();

debugPrint("%s:%d\n", __FILE__, __LINE__);
/* Initialize video. */

if (!video_init())
if (!video_init()) {
assert(0);
return 1;
}
debugPrint("%s:%d\n", __FILE__, __LINE__);

/* Material system. */

mtrl_init();

debugPrint("%s:%d\n", __FILE__, __LINE__);
/* Screen states. */

init_state(&st_null);

//assert(0);
/* Initialize demo playback or load the level. */

if (opt_replay &&
Expand Down Expand Up @@ -623,11 +634,14 @@ int main(int argc, char *argv[])
/* Run the main game loop. */

t0 = SDL_GetTicks();

//assert(0);
while (loop())
{
//debugPrint("%d > %d?\n", t1, t0);
//assert(0);
if ((t1 = SDL_GetTicks()) > t0)
{
//assert(0);
/* Step the game state. */

st_timer(0.001f * (t1 - t0));
Expand All @@ -637,7 +651,9 @@ int main(int argc, char *argv[])
/* Render. */

hmd_step();
//assert(0);
st_paint(0.001f * t0);
//assert(0);
video_swap();

if (config_get_d(CONFIG_NICE))
Expand All @@ -653,7 +669,7 @@ int main(int argc, char *argv[])
hmd_free();
joy_quit();
SDL_Quit();

assert(0);
return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion ball/st_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static int null_enter(struct state *st, struct state *prev)

return 0;
}

#include <assert.h>
static void null_leave(struct state *st, struct state *next, int id)
{
mtrl_load_objects();
Expand All @@ -228,6 +228,7 @@ static void null_leave(struct state *st, struct state *next, int id)
geom_init();
gui_init();
hud_init();
//assert(0);
}

/*---------------------------------------------------------------------------*/
Expand Down
3 changes: 2 additions & 1 deletion ball/st_title.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,10 @@ static int filter_cmd(const union cmd *cmd)
{
return (cmd ? cmd->type != CMD_SOUND : 1);
}

#include <assert.h>
static int title_enter(struct state *st, struct state *prev)
{
//assert(0);
game_proxy_filter(filter_cmd);

/* Start the title screen music. */
Expand Down
Loading