diff --git a/contrib/other/sdlquake-1.0.9/Makefile.kos b/contrib/other/sdlquake-1.0.9/Makefile.kos new file mode 100644 index 0000000000..3e01833f2d --- /dev/null +++ b/contrib/other/sdlquake-1.0.9/Makefile.kos @@ -0,0 +1,26 @@ +CC = kos32-gcc +LD = kos32-ld +KPACK = kpack + +SDK_DIR = $(abspath ../../sdk) + +CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -DSDL -D_KOLIBRI -DUSE_ASM +LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds --image-base 0 --subsystem native --stack 0x200000 + +INCLUDES = -I $(SDK_DIR)/sources/newlib/libc/include -I. -I$(SDK_DIR)/sources/SDL-1.2.2_newlib/include -I $(SDK_DIR)/sources/zlib +LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib + +C_SRC = chase.c cl_demo.c cl_input.c cl_main.c cl_parse.c cl_tent.c cmd.c common.c console.c crc.c cvar.c d_edge.c d_init.c d_modech.c d_part.c d_polyse.c d_scan.c d_sky.c d_sprite.c d_surf.c draw.c host.c host_cmd.c keys.c mathlib.c menu.c model.c net_loop.c net_main.c net_vcr.c pr_cmds.c pr_edict.c pr_exec.c r_aclip.c r_alias.c r_bsp.c r_draw.c r_edge.c r_efrag.c r_light.c r_main.c r_misc.c r_part.c r_sky.c r_sprite.c r_surf.c sbar.c screen.c snd_dma.c snd_mem.c snd_mix.c sv_main.c sv_move.c sv_phys.c sv_user.c view.c wad.c world.c zone.c sys_sdl.c vid_sdl.c cd_null.c snd_sdl.c net_none.c + +ASM_SRC = d_draw.S d_draw16.S d_parta.S d_polysa.S d_scana.S d_spr8.S d_varsa.S math.S r_aclipa.S r_aliasa.S r_drawa.S r_edgea.S r_varsa.S snd_mixa.S surf8.S surf16.S sys_wina.S worlda.S + +default: + $(CC) $(CFLAGS) $(INCLUDES) $(C_SRC) $(ASM_SRC) + $(LD) $(LDFLAGS) $(LIBPATH) -o sdlquake *.o -lSDLn -lsound -lgcc -lc.dll + strip -S sdlquake + objcopy sdlquake -O binary + $(KPACK) sdlquake + +clean: + rm *.o + diff --git a/contrib/other/sdlquake-1.0.9/dirname.c b/contrib/other/sdlquake-1.0.9/dirname.c new file mode 100644 index 0000000000..505c19953d --- /dev/null +++ b/contrib/other/sdlquake-1.0.9/dirname.c @@ -0,0 +1,50 @@ +#include +#include + +char *dirname (char *path) +{ + static const char dot[] = "."; + char *last_slash; + /* Find last '/'. */ + last_slash = path != NULL ? strrchr (path, '/') : NULL; + if (last_slash != NULL && last_slash != path && last_slash[1] == '\0') + { + /* Determine whether all remaining characters are slashes. */ + char *runp; + for (runp = last_slash; runp != path; --runp) + if (runp[-1] != '/') + break; + /* The '/' is the last character, we have to look further. */ + if (runp != path) + last_slash = memrchr (path, '/', runp - path); + } + if (last_slash != NULL) + { + /* Determine whether all remaining characters are slashes. */ + char *runp; + for (runp = last_slash; runp != path; --runp) + if (runp[-1] != '/') + break; + /* Terminate the path. */ + if (runp == path) + { + /* The last slash is the first character in the string. We have to + return "/". As a special case we have to return "//" if there + are exactly two slashes at the beginning of the string. See + XBD 4.10 Path Name Resolution for more information. */ + if (last_slash == path + 1) + ++last_slash; + else + last_slash = path + 1; + } + else + last_slash = runp; + last_slash[0] = '\0'; + } + else + /* This assignment is ill-designed but the XPG specs require to + return a string containing "." in any case no directory part is + found and so a static and constant string is required. */ + path = (char *) dot; + return path; +} diff --git a/contrib/other/sdlquake-1.0.9/host.c b/contrib/other/sdlquake-1.0.9/host.c index 603f6b3f0a..845429517b 100644 --- a/contrib/other/sdlquake-1.0.9/host.c +++ b/contrib/other/sdlquake-1.0.9/host.c @@ -834,7 +834,11 @@ Host_Init */ void Host_Init (quakeparms_t *parms) { - + #ifdef _KOLIBRI + #include "dirname.c" + parms->basedir=dirname(parms->argv[0]); + #endif + if (standard_quake) minimum_memory = MINIMUM_MEMORY; else