Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9789 → Rev 9790

/contrib/games/wolf3d/SDL/SDL_mixer.c
File deleted
/contrib/games/wolf3d/SDL/SDL_sysaudio.h
File deleted
/contrib/games/wolf3d/SDL/uSDL.c
File deleted
/contrib/games/wolf3d/SDL/SDL_wave.h
File deleted
/contrib/games/wolf3d/SDL/SDL_audiocvt.c
File deleted
/contrib/games/wolf3d/SDL/SDL_wave.c
File deleted
/contrib/games/wolf3d/Makefile
1,14 → 1,18
CC = kos32-gcc
LD = kos32-ld
OBJCOPY = kos32-objcopy
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 -D_KOLIBRI
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds --image-base 0
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds --image-base 0 --subsystem native
 
INCLUDES = -I$(SDK_DIR)/sources/newlib/libc/include -I$(SDK_DIR)/sources/SDL-1.2.2_newlib/include -I. -I SDL_mixer
LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib -L $(SDK_DIR)/lib
 
TARGET = bin/wolf3d
 
OBJECTS += wl_cloudsky.o
OBJECTS += wl_debug.o
OBJECTS += id_sd.o
40,10 → 44,6
OBJECTS += kolibri.o
OBJECTS += mame/fmopl.o
 
SDL_OBJ += SDL/SDL_wave.o
SDL_OBJ += SDL/SDL_audiocvt.o
SDL_OBJ += SDL/SDL_mixer.o
SDL_OBJ += SDL/uSDL.o
 
SDL_MIX_OBJ += SDL_mixer/mixer.o
SDL_MIX_OBJ += SDL_mixer/music.o
52,11 → 52,13
SDL_MIX_OBJ += SDL_mixer/effects_internal.o
SDL_MIX_OBJ += SDL_mixer/effect_position.o
 
default: $(OBJECTS) $(SDL_MIX_OBJ) $(SDL_OBJ)
kos32-ld $(LDFLAGS) $(LIBPATH) --subsystem native -o bin/wolf3d $(OBJECTS) $(SDL_MIX_OBJ) $(SDL_OBJ) -lSDLn -lsound -lstdc++ -lsupc++ -lgcc -lc.dll
objcopy bin/wolf3d -O binary
kpack --nologo bin/wolf3d
LIBS = -lSDLn -lsound -lgcc -lc.dll
 
$(TARGET): $(OBJECTS) $(SDL_MIX_OBJ) $(SDL_OBJ)
$(LD) $(LDFLAGS) $(LIBPATH) -o $(TARGET) $(OBJECTS) $(SDL_MIX_OBJ) $(SDL_OBJ) $(LIBS)
$(OBJCOPY) $(TARGET) -O binary
$(KPACK) --nologo $(TARGET)
 
%.o : %.cpp
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
 
64,4 → 66,4
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
 
clean:
rm *.o SDL_mixer/*.o mame/*.o SDL/*.o *.d SDL_mixer/*.d mame/*.d SDL/*.d
rm -f $(OBJECTS)
/contrib/games/wolf3d/SDL_mixer/dynamic_mod.h
File deleted
/contrib/games/wolf3d/SDL_mixer/dynamic_ogg.h
File deleted
/contrib/games/wolf3d/SDL_mixer/load_ogg.h
File deleted
/contrib/games/wolf3d/SDL_mixer/dynamic_fluidsynth.h
File deleted
/contrib/games/wolf3d/SDL_mixer/dynamic_flac.h
File deleted
/contrib/games/wolf3d/SDL_mixer/dynamic_mp3.h
File deleted
/contrib/games/wolf3d/SDL_mixer/load_flac.h
File deleted
/contrib/games/wolf3d/SDL_mixer/fluidsynth.h
File deleted
/contrib/games/wolf3d/SDL_mixer/music_cmd.h
File deleted
/contrib/games/wolf3d/SDL_mixer/music_flac.h
File deleted
/contrib/games/wolf3d/SDL_mixer/music_modplug.h
File deleted
/contrib/games/wolf3d/SDL_mixer/wavestream.h
File deleted
/contrib/games/wolf3d/SDL_mixer/music_mad.h
File deleted
/contrib/games/wolf3d/SDL_mixer/music_mod.h
File deleted
/contrib/games/wolf3d/SDL_mixer/music_ogg.h
File deleted
/contrib/games/wolf3d/SDL_mixer/mixer.c
32,19 → 32,16
#include "SDL_mixer.h"
#include "load_aiff.h"
#include "load_voc.h"
#include "load_ogg.h"
#include "load_flac.h"
#include "dynamic_flac.h"
#include "dynamic_mod.h"
#include "dynamic_mp3.h"
#include "dynamic_ogg.h"
//#include "load_ogg.h"
//#include "load_flac.h"
//#include "dynamic_flac.h"
//#include "dynamic_mod.h"
//#include "dynamic_mp3.h"
//#include "dynamic_ogg.h"
 
#define __MIX_INTERNAL_EFFECT__
#include "effects_internal.h"
 
#define uSDL_Delay SDL_Delay
#define uSDL_GetTicks SDL_GetTicks
 
/* Magic numbers for various audio file formats */
#define RIFF 0x46464952 /* "RIFF" */
#define WAVE 0x45564157 /* "WAVE" */
303,7 → 300,7
}
 
/* Mix any playing channels... */
sdl_ticks = uSDL_GetTicks();
sdl_ticks = SDL_GetTicks();
for ( i=0; i<num_channels; ++i ) {
if( ! mix_channel[i].paused ) {
if ( mix_channel[i].expire > 0 && mix_channel[i].expire < sdl_ticks ) {
860,7 → 857,7
 
/* Queue up the audio data for this channel */
if ( which >= 0 && which < num_channels ) {
Uint32 sdl_ticks = uSDL_GetTicks();
Uint32 sdl_ticks = SDL_GetTicks();
if (Mix_Playing(which))
_Mix_channel_done_playing(which);
mix_channel[which].samples = chunk->abuf;
891,7 → 888,7
}
} else if ( which < num_channels ) {
SDL_LockAudio();
mix_channel[which].expire = (ticks>0) ? ( uSDL_GetTicks() + ticks) : 0;
mix_channel[which].expire = (ticks>0) ? ( SDL_GetTicks() + ticks) : 0;
SDL_UnlockAudio();
++ status;
}
930,7 → 927,7
 
/* Queue up the audio data for this channel */
if ( which >= 0 && which < num_channels ) {
Uint32 sdl_ticks = uSDL_GetTicks();
Uint32 sdl_ticks = SDL_GetTicks();
if (Mix_Playing(which))
_Mix_channel_done_playing(which);
mix_channel[which].samples = chunk->abuf;
1049,7 → 1046,7
mix_channel[which].fade_volume = mix_channel[which].volume;
mix_channel[which].fading = MIX_FADING_OUT;
mix_channel[which].fade_length = ms;
mix_channel[which].ticks_fade = uSDL_GetTicks();
mix_channel[which].ticks_fade = SDL_GetTicks();
 
/* only change fade_volume_reset if we're not fading. */
if (mix_channel[which].fading == MIX_NO_FADING) {
1154,7 → 1151,7
/* Pause a particular channel (or all) */
void Mix_Pause(int which)
{
Uint32 sdl_ticks = uSDL_GetTicks();
Uint32 sdl_ticks = SDL_GetTicks();
if ( which == -1 ) {
int i;
 
1173,7 → 1170,7
/* Resume a paused channel */
void Mix_Resume(int which)
{
Uint32 sdl_ticks = uSDL_GetTicks();
Uint32 sdl_ticks = SDL_GetTicks();
 
SDL_LockAudio();
if ( which == -1 ) {
1263,7 → 1260,7
int Mix_GroupOldest(int tag)
{
int chan = -1;
Uint32 mintime = uSDL_GetTicks();
Uint32 mintime = SDL_GetTicks();
int i;
for( i=0; i < num_channels; i ++ ) {
if ( (mix_channel[i].tag==tag || tag==-1) && mix_channel[i].playing > 0
/contrib/games/wolf3d/SDL_mixer/music.c
70,11 → 70,8
#if defined(MP3_MUSIC) || defined(MP3_MAD_MUSIC)
static SDL_AudioSpec used_mixer;
#endif
unsigned uSDL_GetTicks();
unsigned SDL_GetTicks();
 
#define uSDL_Delay SDL_Delay
#define uSDL_GetTicks SDL_GetTicks
 
int volatile music_active = 1;
static int volatile music_stopped = 0;
static int music_loops = 0;
764,7 → 761,7
/* Wait for any fade out to finish */
while ( music->fading == MIX_FADING_OUT ) {
SDL_UnlockAudio();
uSDL_Delay(100);
SDL_Delay(100);
SDL_LockAudio();
}
if ( music == music_playing ) {
1016,7 → 1013,7
/* If the current music is fading out, wait for the fade to complete */
while ( music_playing && (music_playing->fading == MIX_FADING_OUT) ) {
SDL_UnlockAudio();
uSDL_Delay(100);
SDL_Delay(100);
SDL_LockAudio();
}
music_active = 1;
/contrib/games/wolf3d/Tupfile.lua
20,10 → 20,9
"joystick_stub.cpp", "kolibri.cpp", "mame/fmopl.cpp",
}
 
-- SDL and SDL_mixer --
-- SDL_mixer stubs --
compile_gcc{
"SDL/SDL_wave.c", "SDL/SDL_audiocvt.c", "SDL/SDL_mixer.c", "SDL_mixer/mixer.c", "SDL_mixer/music.c",
"SDL_mixer/load_aiff.c", "SDL_mixer/load_voc.c",
"SDL_mixer/mixer.c", "SDL_mixer/music.c", "SDL_mixer/load_aiff.c", "SDL_mixer/load_voc.c",
"SDL_mixer/effects_internal.c", "SDL_mixer/effect_position.c",
}
 
/contrib/games/wolf3d/id_in.cpp
650,7 → 650,7
IN_ProcessEvents();
if (IN_CheckAck())
return true;
uSDL_Delay(5);
SDL_Delay(5);
} while (GetTimeCount() - lasttime < delay);
return(false);
}
/contrib/games/wolf3d/id_sd.cpp
935,7 → 935,7
 
SD_FadeOutMusic();
while (SD_MusicPlaying())
uSDL_Delay(5);
SDL_Delay(5);
 
switch (mode)
{
1284,7 → 1284,7
SD_WaitSoundDone(void)
{
while (SD_SoundPlaying())
uSDL_Delay(5);
SDL_Delay(5);
}
 
///////////////////////////////////////////////////////////////////////////
/contrib/games/wolf3d/id_sd.h
119,17 → 119,11
extern int DigiMap[];
extern int DigiChannel[];
 
#ifdef _KOLIBRI
extern void uSDL_Delay(unsigned time);
#else
#define uSDL_Delay SDL_Delay
#endif
#define GetTimeCount() ((SDL_GetTicks()*7)/100)
 
#define GetTimeCount() (( uSDL_GetTicks()*7)/100)
 
inline void Delay(int wolfticks)
{
if(wolfticks>0) uSDL_Delay(wolfticks * 100/ 7);
if(wolfticks>0) SDL_Delay(wolfticks * 100/ 7);
}
 
// Function prototypes
/contrib/games/wolf3d/id_us_1.cpp
741,7 → 741,7
 
cursorvis ^= true;
}
else uSDL_Delay(5);
else SDL_Delay(5);
if (cursorvis)
USL_XORICursor(x,y,s,cursor);
 
772,7 → 772,7
void US_InitRndT(int randomize)
{
if(randomize)
rndindex = ( uSDL_GetTicks() >> 4) & 0xff;
rndindex = ( SDL_GetTicks() >> 4) & 0xff;
else
rndindex = 0;
}
/contrib/games/wolf3d/id_vl.h
28,7 → 28,7
// VGA hardware routines
//
 
#define VL_WaitVBL(a) uSDL_Delay((a)*8)
#define VL_WaitVBL(a) SDL_Delay((a)*8)
 
void VL_SetVGAPlaneMode (void);
void VL_SetTextMode (void);
/contrib/games/wolf3d/kolibri.cpp
1,215 → 1,7
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ksys.h>
#include <string.h>
 
#define asm_inline __asm__ __volatile__
 
#pragma pack(push,1)
typedef union{
unsigned val;
struct{
short x;
short y;
};
}ksys_pos_t;
 
typedef union ksys_oskey_t{
unsigned val;
struct{
unsigned char state;
unsigned char code;
unsigned char ctrl_key;
};
}ksys_oskey_t;
 
typedef struct{
unsigned handle;
unsigned io_code;
unsigned *input;
int inp_size;
void *output;
int out_size;
}ksys_ioctl_t;
 
typedef struct{
void *data;
size_t size;
}ksys_ufile_t;
 
 
typedef struct{
unsigned p00;
union{
uint64_t p04;
struct {
unsigned p04dw;
unsigned p08dw;
};
};
unsigned p12;
union {
unsigned p16;
const char *new_name;
void *bdfe;
void *buf16;
const void *cbuf16;
};
char p20;
const char *p21;
}ksys70_t;
 
typedef struct {
int cpu_usage; //+0
int window_pos_info; //+4
short int reserved1; //+8
char name[12]; //+10
int memstart; //+22
int memused; //+26
int pid; //+30
int winx_start; //+34
int winy_start; //+38
int winx_size; //+42
int winy_size; //+46
short int slot_info; //+50
short int reserved2; //+52
int clientx; //+54
int clienty; //+58
int clientwidth; //+62
int clientheight; //+66
unsigned char window_state;//+70
char reserved3[1024-71]; //+71
}ksys_proc_table_t;
 
#pragma pack(pop)
 
static inline
int _ksys_process_info(ksys_proc_table_t* table, int pid)
{
int val;
asm_inline(
"int $0x40"
:"=a"(val)
:"a"(9), "b"(table), "c"(pid)
:"memory"
);
return val;
}
 
static inline
void _ksys_change_window(int new_x, int new_y, int new_w, int new_h)
{
asm_inline(
"int $0x40"
::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w),"S"(new_h)
);
}
 
static inline
ksys_pos_t _ksys_screen_size()
{
ksys_pos_t size;
ksys_pos_t size_tmp;
asm_inline(
"int $0x40"
:"=a"(size_tmp)
:"a"(14)
:"memory"
);
size.x = size_tmp.y;
size.y = size_tmp.x;
return size;
}
 
void *memrchr(const void *m, int c, size_t n)
{
const unsigned char *s = (const unsigned char*)m;
c = (unsigned char)c;
while (n--) if (s[n]==c) return (void *)(s+n);
return 0;
}
 
void kolibri_set_win_center()
{
ksys_proc_table_t *info = (ksys_proc_table_t*)malloc(sizeof(ksys_proc_table_t));
_ksys_process_info(info, -1);
 
ksys_pos_t screen_size= _ksys_screen_size();
int new_x = screen_size.x/2-info->winx_size/2;
int new_y = screen_size.y/2-info->winy_size/2;
_ksys_change_window(new_x, new_y, -1, -1);
free(info);
}
 
int mkdir(const char *path, unsigned v)
{
int status;
ksys70_t dir_opt;
dir_opt.p00 = 9;
dir_opt.p21 = path;
asm_inline(
"int $0x40"
:"=a"(status)
:"a"(70), "b"(&dir_opt)
:"memory"
);
return status;
}
 
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 = (char*)memrchr((void*)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;
}
 
void setcwd(char* path){
asm_inline(
"int $0x40"
::"a"(30), "b"(1), "c"(path)
:"memory"
);
}
extern unsigned screenWidth;
extern unsigned screenHeight;
 
/contrib/games/wolf3d/wl_def.h
24,10 → 24,6
# define O_BINARY 0
#endif
 
#define uSDL_Delay SDL_Delay
#define uSDL_GetTicks SDL_GetTicks
 
 
#pragma pack(1)
 
#if defined(_arch_dreamcast)
1395,7 → 1391,7
#endif
#define DEMOCOND_SDL (!DEMOCOND_ORIG)
 
#define GetTicks() (( uSDL_GetTicks()*7)/100)
#define GetTicks() (( SDL_GetTicks()*7)/100)
 
#define ISPOINTER(x) ((((uintptr_t)(x)) & ~0xffff) != 0)
 
/contrib/games/wolf3d/wl_draw.cpp
1074,12 → 1074,12
if (lasttimecount > (int32_t) GetTimeCount())
lasttimecount = GetTimeCount(); // if the game was paused a LONG time
 
uint32_t curtime = uSDL_GetTicks();
uint32_t curtime = SDL_GetTicks();
tics = (curtime * 7) / 100 - lasttimecount;
if(!tics)
{
// wait until end of current tic
uSDL_Delay(((lasttimecount + 1) * 100) / 7 - curtime);
SDL_Delay(((lasttimecount + 1) * 100) / 7 - curtime);
tics = 1;
}
 
/contrib/games/wolf3d/wl_inter.cpp
403,7 → 403,7
static int which = 0, max = 10;
int pics[2] = { L_GUYPIC, L_GUY2PIC };
 
uSDL_Delay(5);
SDL_Delay(5);
 
if ((int32_t) GetTimeCount () - lastBreathTime > max)
{
/contrib/games/wolf3d/wl_main.cpp
11,6 → 11,11
#include "wl_atmos.h"
#include <SDL_syswm.h>
 
#ifdef _KOLIBRI
#include <sys/ksys.h>
#include <libgen.h>
#endif
 
/*
=============================================================================
 
24,10 → 29,6
*/
 
extern byte signon[];
extern void kolibri_set_win_center();
extern char* dirname(char* path);
extern void setcwd(char* path);
 
extern boolean SD_Started;
/*
=============================================================================
1128,7 → 1129,7
 
#ifndef SPEAR
#ifndef UPLOAD
start = (( uSDL_GetTicks()/10)%3)*6;
start = (( SDL_GetTicks()/10)%3)*6;
#else
start = 0;
#endif
1239,9 → 1240,6
#endif
 
SignonScreen ();
#ifdef _KOLIBRI
kolibri_set_win_center();
#endif
 
#if defined _WIN32
if(!fullscreen)
1978,7 → 1976,7
int main (int argc, char *argv[])
{
#ifdef _KOLIBRI
setcwd(dirname(argv[0]));
_ksys_setcwd(dirname(argv[0]));
kolibri_set_win_max();
#endif
 
/contrib/games/wolf3d/wl_menu.cpp
1956,7 → 1956,7
DrawMouseSens ();
do
{
uSDL_Delay(5);
SDL_Delay(5);
ReadAnyControl (&ci);
switch (ci.dir)
{
2228,7 → 2228,7
redraw = 0;
}
 
uSDL_Delay(5);
SDL_Delay(5);
ReadAnyControl (&ci);
 
if (type == MOUSE || type == JOYSTICK)
2274,7 → 2274,7
lastFlashTime = GetTimeCount();
VW_UpdateScreen ();
}
else uSDL_Delay(5);
else SDL_Delay(5);
 
//
// WHICH TYPE OF INPUT DO WE PROCESS?
2397,7 → 2397,7
while (!cust->allowed[which]);
redraw = 1;
SD_PlaySound (MOVEGUN1SND);
while (ReadAnyControl (&ci), ci.dir != dir_None) uSDL_Delay(5);
while (ReadAnyControl (&ci), ci.dir != dir_None) SDL_Delay(5);
IN_ClearKeysDown ();
break;
 
2411,7 → 2411,7
while (!cust->allowed[which]);
redraw = 1;
SD_PlaySound (MOVEGUN1SND);
while (ReadAnyControl (&ci), ci.dir != dir_None) uSDL_Delay(5);
while (ReadAnyControl (&ci), ci.dir != dir_None) SDL_Delay(5);
IN_ClearKeysDown ();
break;
case dir_North:
2837,7 → 2837,7
do
{
CheckPause ();
uSDL_Delay(5);
SDL_Delay(5);
ReadAnyControl (&ci);
switch (ci.dir)
{
3284,7 → 3284,7
routine (which);
VW_UpdateScreen ();
}
else uSDL_Delay(5);
else SDL_Delay(5);
 
CheckPause ();
 
3484,7 → 3484,7
VWB_DrawPic (x, y, C_CURSOR1PIC);
VW_UpdateScreen ();
SD_PlaySound (MOVEGUN1SND);
uSDL_Delay(1); //Fixed too long delay in the menu
SDL_Delay(1); //Fixed too long delay in the menu
}
 
 
3526,7 → 3526,7
int32_t startTime = GetTimeCount ();
do
{
uSDL_Delay(5);
SDL_Delay(5);
ReadAnyControl (&ci);
}
while ((int32_t) GetTimeCount () - startTime < count && ci.dir != dir_None);
3732,7 → 3732,7
tick ^= 1;
lastBlinkTime = GetTimeCount();
}
else uSDL_Delay(5);
else SDL_Delay(5);
 
#ifdef SPANISH
}
/contrib/games/wolf3d/wl_play.cpp
406,11 → 406,11
if (demoplayback || demorecord) // demo recording and playback needs to be constant
{
// wait up to DEMOTICS Wolf tics
uint32_t curtime = uSDL_GetTicks();
uint32_t curtime = SDL_GetTicks();
lasttimecount += DEMOTICS;
int32_t timediff = (lasttimecount * 100) / 7 - curtime;
if(timediff > 0)
uSDL_Delay(timediff);
SDL_Delay(timediff);
 
if(timediff < -2 * DEMOTICS) // more than 2-times DEMOTICS behind?
lasttimecount = (curtime * 7) / 100; // yes, set to current timecount
/contrib/games/wolf3d/wl_text.cpp
669,7 → 669,7
firstpage = false;
}
}
uSDL_Delay(5);
SDL_Delay(5);
 
LastScan = 0;
ReadAnyControl(&ci);