Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 549 → Rev 550

/programs/develop/open watcom/trunk/clib/h/commode.h
0,0 → 1,34
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: declaration for set commit mode function
*
****************************************************************************/
 
 
/* see note in commode.c */
_WCRTLINK extern void _WCI86FAR __set_commode( void );
#pragma aux __set_commode "*_";
/programs/develop/open watcom/trunk/clib/h/fmode.h
0,0 → 1,33
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
 
 
/* define _fmode to be _fmode */
/programs/develop/open watcom/trunk/clib/h/kolibri.h
0,0 → 1,105
 
#ifdef __cplusplus
extern "C"
{
#endif
 
 
#define FONT0 0x00000000
#define FONT1 0x10000000
 
#define BT_NORMAL 0x00000000
#define BT_NOFRAME 0x20000000
#define BT_HIDE 0x40000000
#define BT_DEL 0x80000000
 
#define EV_REDRAW 1
#define EV_KEY 2
#define EV_BUTTON 3
 
#define REL_SCREEN 0
#define REL_WINDOW 1
 
#define FILE_NOT_FOUND 5
#define FILE_EOF 6
 
 
typedef unsigned int DWORD;
typedef unsigned short int WORD;
 
typedef struct
{ DWORD pci_cmd;
DWORD irq;
DWORD glob_cntrl;
DWORD glob_sta;
DWORD codec_io_base;
DWORD ctrl_io_base;
DWORD codec_mem_base;
DWORD ctrl_mem_base;
DWORD codec_id;
} CTRL_INFO;
 
typedef struct
{ DWORD cmd;
DWORD offset;
DWORD r1;
DWORD count;
DWORD buff;
char r2;
char *name;
} FILEIO;
 
typedef struct
{ DWORD attr;
DWORD flags;
DWORD cr_time;
DWORD cr_date;
DWORD acc_time;
DWORD acc_date;
DWORD mod_time;
DWORD mod_date;
DWORD size;
DWORD size_high;
} FILEINFO;
 
void _stdcall InitHeap(int heap_size);
void* _stdcall UserAlloc(int size);
int _stdcall UserFree(void* p);
void _stdcall GetNotify(void *event);
 
void _stdcall CreateThread(void *fn, char *p_stack);
 
DWORD _stdcall GetMousePos(DWORD rel_type);
 
void _stdcall debug_out_hex(DWORD val);
void debug_out_str(char* str);
 
int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
int _stdcall read_file (const char *name,char*buff,DWORD offset, DWORD count,DWORD *reads);
int _stdcall write_file(const char *name,char*buff,int offset,int count,int *writes);
 
//void exit();
int _stdcall get_key(int *key);
int _stdcall remap_key(int key);
 
int _cdecl get_button_id();
 
void delay(int val);
int wait_for_event(int time);
int wait_for_event_infinite();
void BeginDraw(void);
void EndDraw(void);
 
void _stdcall GetScreenSize(int *x, int*y);
void _stdcall DrawWindow(int x,int y, int sx, int sy,int workcolor,int style,
int captioncolor,int windowtype,int bordercolor);
void _stdcall debug_out(int ch);
void _stdcall make_button(int x, int y, int xsize, int ysize, int id, int color);
void _stdcall draw_bar(int x, int y, int xsize, int ysize, int color);
void _stdcall write_text(int x,int y,int color,char* text,int len);
 
#ifdef __cplusplus
extern "C"
}
#endif
/programs/develop/open watcom/trunk/clib/h/openmode.h
0,0 → 1,75
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
 
 
#ifndef _OPENMODE_H_INCLUDED
#define _OPENMODE_H_INCLUDED
enum {
FILEATTR_MASK = 0x003f,
FILEATTR_NORMAL = 0x0000,
FILEATTR_READONLY = 0x0001,
FILEATTR_HIDDEN = 0x0002,
FILEATTR_SYSTEM = 0x0004,
FILEATTR_DIRECTORY = 0x0010,
FILEATTR_ARCHIVED = 0x0020
};
 
enum {
OPENFLAG_FAIL_IF_EXISTS = 0x0000,
OPENFLAG_OPEN_IF_EXISTS = 0x0001,
OPENFLAG_REPLACE_IF_EXISTS = 0x0002,
OPENFLAG_FAIL_IF_NOT_EXISTS = 0x0000,
OPENFLAG_CREATE_IF_NOT_EXISTS = 0x0010
};
 
enum {
OPENMODE_DASD = 0x8000,
OPENMODE_WRITE_THROUGH = 0x4000,
OPENMODE_FAIL_ERRORS = 0x2000,
OPENMODE_NO_CACHE = 0x1000,
OPENMODE_LOCALITY_MASK = 0x0700,
OPENMODE_LOCALITY_RANDSEQ = 0x0300,
OPENMODE_LOCALITY_RANDOM = 0x0200,
OPENMODE_LOCALITY_SEQUENTIAL = 0x0100,
OPENMODE_LOCALITY_NONE = 0x0000,
OPENMODE_INHERITANCE = 0x0080,
OPENMODE_SHARE_MASK = 0x0070,
OPENMODE_DENY_COMPAT = 0x0000,
OPENMODE_DENY_ALL = 0x0010,
OPENMODE_DENY_WRITE = 0x0020,
OPENMODE_DENY_READ = 0x0030,
OPENMODE_DENY_NONE = 0x0040,
OPENMODE_ACCESS_MASK = 0x0007,
OPENMODE_ACCESS_RDONLY = 0x0000,
OPENMODE_ACCESS_WRONLY = 0x0001,
OPENMODE_ACCESS_RDWR = 0x0002
};
#endif
/programs/develop/open watcom/trunk/clib/h/qread.h
0,0 → 1,36
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: Prototype for __qread() internal helper.
*
****************************************************************************/
 
 
#ifdef __NETWARE__
#define __qread( h, b, l ) read( h, b, l )
#else
extern int __qread( int handle, void *buffer, unsigned len );
#endif
/programs/develop/open watcom/trunk/clib/src/fclose.c
44,19 → 44,7
#include "close.h"
#include "flush.h"
 
#ifdef DLHEAP
 
void* _cdecl dlmalloc(size_t);
void _cdecl dlfree(void*);
void _cdecl mf_init();
 
#define malloc dlmalloc
#define free dlfree
#define realloc dlrealloc
 
#define lib_free dlfree
#endif
 
#ifndef __UNIX__
void (*__RmTmpFileFn)( FILE *fp );
#endif
/programs/develop/open watcom/trunk/clib/src/fwrite.c
0,0 → 1,161
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: Platform independent fwrite() implementation.
*
****************************************************************************/
 
 
#include "variety.h"
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "fileacc.h"
#include "rtdata.h"
#include "seterrno.h"
#include "qwrite.h"
#include "flush.h"
#include "streamio.h"
 
 
_WCRTLINK size_t fwrite( const void *buf, size_t size, size_t n, FILE *fp )
{
size_t count;
unsigned oflag;
 
_ValidFile( fp, 0 );
_AccessFile( fp );
if( (fp->_flag & _WRITE) == 0 ) {
__set_errno( EBADF );
fp->_flag |= _SFERR;
_ReleaseFile( fp );
return( 0 ); /* POSIX says return 0 */
}
n *= size;
if( n == 0 ) {
_ReleaseFile( fp );
return( n );
}
if( _FP_BASE(fp) == NULL ) {
__ioalloc( fp ); /* allocate buffer */
}
oflag = fp->_flag & (_SFERR | _EOF); /* JBS 27-jan-92 */
fp->_flag &= ~(_SFERR | _EOF); /* JBS 27-jan-92 */
count = 0;
#if !defined( __UNIX__ )
if( fp->_flag & _BINARY ) { /* binary I/O */
#else
{
#endif
size_t bytes_left = n, bytes;
 
do {
/* if our buffer is empty, and user's buffer is larger,
then write directly from user's buffer. 28-apr-90 */
 
if( fp->_cnt == 0 && bytes_left >= fp->_bufsize ) {
bytes = bytes_left & -512; /* multiple of 512 */
if( bytes == 0 ) {
bytes = bytes_left; /* bufsize < 512 */
}
n = __qwrite( fileno( fp ), buf, bytes );
if( n == -1 ) {
fp->_flag |= _SFERR;
}
#if !defined( __UNIX__ )
else if( n == 0 ) {
_RWD_errno = ENOSPC;
fp->_flag |= _SFERR;
}
#endif
bytes = n;
} else {
bytes = fp->_bufsize - fp->_cnt;
if( bytes > bytes_left ) {
bytes = bytes_left;
}
memcpy( fp->_ptr, buf, bytes );
fp->_ptr += bytes;
fp->_cnt += bytes;
fp->_flag |= _DIRTY;
if( (fp->_cnt == fp->_bufsize) || (fp->_flag & _IONBF) ) {
__flush(fp);
}
}
buf = ((const char *)buf) + bytes;
count += bytes;
bytes_left -= bytes;
} while( bytes_left && !ferror( fp ) );
#if !defined( __UNIX__ )
} else { /* text I/O */
const char *bufptr;
int not_buffered;
#ifndef __NETWARE__
int old_orientation;
#endif
/* temporarily enable buffering saving the previous setting */
not_buffered = 0;
if( fp->_flag & _IONBF ) {
not_buffered = 1;
fp->_flag &= ~_IONBF;
fp->_flag |= _IOFBF;
}
 
/*** Use fputc, and make it think the stream is byte-oriented ***/
#ifndef __NETWARE__
old_orientation = _FP_ORIENTATION(fp);
_FP_ORIENTATION(fp) = _BYTE_ORIENTED;
#endif
bufptr = (const char *)buf;
do {
fputc( *(bufptr++), fp );
if( fp->_flag & (_EOF | _SFERR) ) break;
++count;
} while( count != n );
#ifndef __NETWARE__
_FP_ORIENTATION(fp) = old_orientation;
#endif
 
if( not_buffered ) { /* if wasn't buffered, then reset */
fp->_flag &= ~_IOFBF;
fp->_flag |= _IONBF;
__flush( fp );
}
#endif
}
if( fp->_flag & _SFERR ) {
/*
* Quantum 11-17-92 Temporary buffering confuses the return
* value if the call is interrupted.
* kludge: return 0 on error
*/
count = 0;
}
fp->_flag |= oflag; /* JBS 27-jan-92 */
_ReleaseFile( fp );
return( count / size );
}
/programs/develop/open watcom/trunk/clib/src/openklbr.c
67,6 → 67,7
} FILEINFO;
 
int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
int _stdcall create_file(const char *name);
 
 
typedef struct
76,7 → 77,7
}__file_handle;
 
 
static char* getfullpath(const char* path)
char* getfullpath(const char* path)
{
int prev_is_slash=0;
int len=0, depth=0, i;
177,21 → 178,28
 
}
 
 
static HANDLE __createFileHandle(const CHAR_TYPE *name)
static HANDLE __openFileHandle(const CHAR_TYPE *name, int mode)
{
FILEINFO info;
__file_handle *handle;
char *path;
int err;
 
path = getfullpath(name);
if(get_fileinfo(path,&info))
if(err=get_fileinfo(path,&info))
{
// printf("failed getfileinfo %s\n\r", path);
if(mode & O_CREAT)
err=create_file(path);
if(err)
{
lib_free(path);
return (HANDLE)-1;
};
};
if ( !(handle=(__file_handle*)lib_malloc(sizeof( __file_handle) )))
{ lib_free(path);
205,7 → 213,6
};
 
 
 
static int __F_NAME(_sopen,__wsopen)( const CHAR_TYPE *name, int mode, int share, va_list args )
{
HANDLE handle;
225,25 → 232,13
 
/*** Open the file ***/
handle = __createFileHandle( name);
handle = __openFileHandle( name, mode);
if( handle==(HANDLE)-1 )
{
 
printf("handle = -1 \n\r");
if( mode&O_CREAT )
{
// handle = CreateFileA( name, desired_access,
// share_mode, NULL, create_disp,
// fileattr, NULL );
}
if( handle == (HANDLE)-1 )
{
__freePOSIXHandle( hid );
return( -1 ); //error
}
}
 
// Now use the slot we got.
__setOSHandle( hid, handle ); // JBS 99/11/01
/programs/develop/open watcom/trunk/clib/src/qwrit.c
34,20 → 34,15
#include <stdio.h>
#include <errno.h>
 
//#if defined(__NT__)
//#elif defined(__OS2__)
//#else
// #include "tinyio.h"
//#endif
 
#include "iomode.h"
#include "fileacc.h"
#include "rtcheck.h"
#include "rtdata.h"
#include "seterrno.h"
//#include "defwin.h"
#include "qwrite.h"
#include "liballoc.h"
 
 
/*
Use caution when setting the file pointer in a multithreaded
application. You must synchronize access to shared resources. For
56,80 → 51,65
using a critical section object or a mutex object.
*/
 
typedef struct
{ DWORD attr;
DWORD flags;
DWORD cr_time;
DWORD cr_date;
DWORD acc_time;
DWORD acc_date;
DWORD mod_time;
DWORD mod_date;
DWORD size;
DWORD size_high;
} FILEINFO;
 
typedef struct
{
char *name;
unsigned int offset;
}__file_handle;
 
int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
int _stdcall write_file(const char *name,const void *buff,unsigned offset,unsigned count,unsigned *writes);
char* getfullpath(const char* path);
 
int __qwrite( int handle, const void *buffer, unsigned len )
{
int atomic;
#if defined(__NT__)
DWORD len_written;
HANDLE h;
int error;
__file_handle *fh;
unsigned len_written;
#elif defined(__WARP__)
#elif defined(__OS2_286__)
#else
#endif
#if !defined(__NT__)
tiny_ret_t rc;
#endif
 
__handle_check( handle, -1 );
 
#if defined(__NT__)
h = __getOSHandle( handle );
#endif
fh = (__file_handle*) __getOSHandle( handle );
 
atomic = 0;
if( __GetIOMode( handle ) & _APPEND )
{
FILEINFO info;
_AccessFileH( handle );
atomic = 1;
#if defined(__NT__)
// if( SetFilePointer( h, 0, NULL, FILE_END ) == -1 )
// {
// error = GetLastError();
// _ReleaseFileH( handle );
// return( __set_errno_dos( error ) );
// }
#elif defined(__OS2__)
#else
rc = TinySeek( handle, 0L, SEEK_END );
#endif
#if !defined(__NT__)
if( TINY_ERROR( rc ) ) {
get_fileinfo(fh->name,&info);
fh->offset = info.size;
};
 
if(write_file(fh->name,buffer,fh->offset,len,&len_written))
{
if ( len_written == 0)
{
if( atomic == 1 )
_ReleaseFileH( handle );
return( __set_errno_dos( TINY_INFO( rc ) ) );
}
#endif
}
#if defined(__NT__)
 
// if( !WriteFile( h, buffer, len, &len_written, NULL ) )
// {
// error = GetLastError();
// if( atomic == 1 ) {
// _ReleaseFileH( handle );
// }
// return( __set_errno_dos( error ) );
// }
return (-1);
};
};
#elif defined(__OS2__)
#elif defined(__WINDOWS_386__)
#else
rc = TinyWrite( handle, buffer, len );
len_written = TINY_LINFO( rc );
#endif
fh->offset+=len_written;
 
#if !defined(__NT__)
if( TINY_ERROR( rc ) ) {
if( atomic == 1 ) {
_ReleaseFileH( handle );
}
return( __set_errno_dos( TINY_INFO( rc ) ) );
}
#endif
if( len_written != len ) {
__set_errno( ENOSPC );
}
 
if( atomic == 1 )
{
_ReleaseFileH( handle );
136,3 → 116,14
}
return( len_written );
}
 
int write_once(const char *name, void *buffer, unsigned len)
{ char *path;
unsigned count;
 
path= getfullpath(name);
write_file(path,buffer,0,len,&count);
lib_free(path);
return count;
}
/programs/develop/sdk/trunk/sound/include/sound.h
7,8 → 7,7
{
#endif
 
#define SOUND_VERSION 5
 
#define SOUND_VERSION 0x0100
#define PCM_ALL 0
 
#define PCM_OUT 0x08000000
/programs/games/doom/trunk/kolibc/include/sound.h
File deleted
/programs/games/doom/trunk/kolibc/include/kolibri.h
File deleted
/programs/games/doom/trunk/kolibc/include/mf.h
File deleted
/programs/games/doom/trunk/kolibc/include/kolibc.h
File deleted
/programs/games/doom/trunk/d_main.c
1168,9 → 1168,9
if (p && p < myargc-1)
{
if (M_CheckParm("-cdrom"))
sprintf(file, "c:\\doomdata\\"SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
sprintf(file, "c:\\doomdata\\doomsav%c.dsg",myargv[p+1][0]);
else
sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
sprintf(file, "doomsav%c.dsg",myargv[p+1][0]);
G_LoadGame (file);
}
/programs/games/doom/trunk/g_game.c
1269,13 → 1269,13
void G_DoSaveGame (void)
{
char name[100];
char name[128];
char name2[VERSIONSIZE];
char* description;
int length;
int i;
sprintf (name,"%d.dsg",savegameslot);
sprintf (name,"doomsav%d.dsg",savegameslot);
description = savedescription;
save_p = savebuffer = screens[1]+0x4000;
1306,6 → 1306,7
length = save_p - savebuffer;
if (length > SAVEGAMESIZE)
I_Error ("Savegame buffer overrun");
M_WriteFile (name, savebuffer, length);
gameaction = ga_nothing;
savedescription[0] = 0;
/programs/games/doom/trunk/h/kolibri.h
File deleted
/programs/games/doom/trunk/h/dstrings.h
38,7 → 38,7
#endif
 
// Misc. other strings.
#define SAVEGAMENAME "doomsav"
//#define SAVEGAMENAME "doomsav"
 
 
//
/programs/games/doom/trunk/m_menu.c
512,7 → 512,7
for (i = 0;i < load_end;i++)
{
sprintf(name,SAVEGAMENAME"%d.dsg",i);
sprintf(name,"doomsav%d.dsg",i);
 
handle = fopen (name, "r");
if (handle == NULL)
572,10 → 572,11
{
char name[256];
if (M_CheckParm("-cdrom"))
sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",choice);
else
sprintf(name,SAVEGAMENAME"%d.dsg",choice);
// if (M_CheckParm("-cdrom"))
// sprintf(name,"c:\\doomdata\\doomsav%d.dsg",choice);
// else
sprintf(name,"doomsav%d.dsg",choice);
 
G_LoadGame (name);
M_ClearMenus ();
}
622,6 → 623,7
//
void M_DoSave(int slot)
{
 
G_SaveGame (slot,savegamestrings[slot]);
M_ClearMenus ();
 
/programs/games/doom/trunk/m_misc.c
29,7 → 29,6
 
#include <stdlib.h>
#include <ctype.h>
//#include "//kolibc.h"
 
//extern int access(char *file, int mode);
 
106,6 → 105,8
#define O_BINARY 0
#endif
 
int write_once(const char *name, void *buffer, unsigned len);
 
boolean
M_WriteFile
( char const* name,
112,16 → 113,21
void* source,
int length )
{
FILE *handle;
// FILE *handle;
int count;
handle = fopen ( name, "wb");
// handle = fopen ( name, "wb");
 
if (handle == NULL)
return false;
// if (handle == NULL)
// return false;
 
// printf("writeFile %s, &s, %d \n\r", name, source, length);
count = write_once(name, source, length);
// printf("%d \n\r", count);
// count = fwrite (source, 1, length, handle);
fclose (handle);
// fclose (handle);
if (count < length)
return false;
/programs/games/doom/trunk/s_sound.c
257,10 → 257,22
}
 
if(ver< SOUND_VERSION)
if( SOUND_VERSION>(ver&0xFFFF))
{
printf("Sound service version mismatch\n\r");
printf("Installed version: %d, required version %d\n\r",
printf("Sound version mismatch\n\r");
printf("Current version: %d, required version %d\n\r",
ver&0xFFFF, SOUND_VERSION);
_asm
{
mov eax, -1
int 0x40
};
};
if(SOUND_VERSION<(ver >> 16))
{
printf("Sound version obsolete\n\r");
printf("Compatible version: %d, required version %d\n\r",
ver, SOUND_VERSION);
_asm
{
/programs/games/doom/trunk/system/include/kolibri.h
0,0 → 1,106
 
#ifdef __cplusplus
extern "C"
{
#endif
 
 
#define FONT0 0x00000000
#define FONT1 0x10000000
 
#define BT_NORMAL 0x00000000
#define BT_NOFRAME 0x20000000
#define BT_HIDE 0x40000000
#define BT_DEL 0x80000000
 
#define EV_REDRAW 1
#define EV_KEY 2
#define EV_BUTTON 3
 
#define REL_SCREEN 0
#define REL_WINDOW 1
 
#define FILE_NOT_FOUND 5
#define FILE_EOF 6
 
 
typedef unsigned int DWORD;
typedef unsigned short int WORD;
 
typedef struct
{ DWORD pci_cmd;
DWORD irq;
DWORD glob_cntrl;
DWORD glob_sta;
DWORD codec_io_base;
DWORD ctrl_io_base;
DWORD codec_mem_base;
DWORD ctrl_mem_base;
DWORD codec_id;
} CTRL_INFO;
 
typedef struct
{ DWORD cmd;
DWORD offset;
DWORD r1;
DWORD count;
DWORD buff;
char r2;
char *name;
} FILEIO;
 
typedef struct
{ DWORD attr;
DWORD flags;
DWORD cr_time;
DWORD cr_date;
DWORD acc_time;
DWORD acc_date;
DWORD mod_time;
DWORD mod_date;
DWORD size;
DWORD size_high;
} FILEINFO;
 
void _stdcall InitHeap(int heap_size);
void* _stdcall UserAlloc(int size);
int _stdcall UserFree(void* p);
void _stdcall GetNotify(void *event);
 
void _stdcall CreateThread(void *fn, char *p_stack);
 
DWORD _stdcall GetMousePos(DWORD rel_type);
 
void _stdcall debug_out_hex(DWORD val);
void debug_out_str(char* str);
 
int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
int _stdcall create_file(const char *name);
int _stdcall read_file (const char *name,char*buff,DWORD offset,DWORD count,DWORD *reads);
int _stdcall write_file(const char *name,const void *buff,DWORD offset,DWORD count,DWORD *writes);
 
//void exit();
int _stdcall get_key(int *key);
int _stdcall remap_key(int key);
 
int _cdecl get_button_id();
 
void delay(int val);
int wait_for_event(int time);
int wait_for_event_infinite();
void BeginDraw(void);
void EndDraw(void);
 
void _stdcall GetScreenSize(int *x, int*y);
void _stdcall DrawWindow(int x,int y, int sx, int sy,int workcolor,int style,
int captioncolor,int windowtype,int bordercolor);
void _stdcall debug_out(int ch);
void _stdcall make_button(int x, int y, int xsize, int ysize, int id, int color);
void _stdcall draw_bar(int x, int y, int xsize, int ysize, int color);
void _stdcall write_text(int x,int y,int color,char* text,int len);
 
#ifdef __cplusplus
extern "C"
}
#endif
/programs/games/doom/trunk/system/include/sound.h
0,0 → 1,133
 
#ifndef _SOUND_H_
#define _SOUND_H_
 
#ifdef __cplusplus
extern "C"
{
#endif
 
#define SOUND_VERSION 0x0100
#define PCM_ALL 0
 
#define PCM_OUT 0x08000000
#define PCM_RING 0x10000000
#define PCM_STATIC 0x20000000
#define PCM_FLOAT 0x40000000
#define PCM_FILTER 0x80000000
 
#define PCM_2_16_48 1
#define PCM_1_16_48 2
#define PCM_2_16_44 3
#define PCM_1_16_44 4
#define PCM_2_16_32 5
#define PCM_1_16_32 6
#define PCM_2_16_24 7
#define PCM_1_16_24 8
#define PCM_2_16_22 9
#define PCM_1_16_22 10
#define PCM_2_16_16 11
#define PCM_1_16_16 12
#define PCM_2_16_12 13
#define PCM_1_16_12 14
#define PCM_2_16_11 15
#define PCM_1_16_11 16
#define PCM_2_16_8 17
#define PCM_1_16_8 18
#define PCM_2_8_48 19
#define PCM_1_8_48 20
#define PCM_2_8_44 21
#define PCM_1_8_44 22
#define PCM_2_8_32 23
#define PCM_1_8_32 24
#define PCM_2_8_24 25
#define PCM_1_8_24 26
#define PCM_2_8_22 27
#define PCM_1_8_22 28
#define PCM_2_8_16 29
#define PCM_1_8_16 30
#define PCM_2_8_12 31
#define PCM_1_8_12 32
#define PCM_2_8_11 33
#define PCM_1_8_11 34
#define PCM_2_8_8 35
#define PCM_1_8_8 36
 
#define SRV_GETVERSION 0
#define SND_CREATE_BUFF 1
#define SND_DESTROY_BUFF 2
#define SND_SETFORMAT 3
#define SND_GETFORMAT 4
#define SND_RESET 5
#define SND_SETPOS 6
#define SND_GETPOS 7
#define SND_SETBUFF 8
#define SND_OUT 9
#define SND_PLAY 10
#define SND_STOP 11
#define SND_SETVOLUME 12
#define SND_GETVOLUME 13
#define SND_SETPAN 14
#define SND_GETPAN 15
#define SND_GETBUFFSIZE 16
 
#define PLAY_SYNC 0x80000000
 
typedef unsigned int SNDBUF;
 
int _stdcall InitSound(int *version);
 
int _stdcall CreateBuffer(unsigned int format,int size,SNDBUF *buf);
int _stdcall DestroyBuffer(SNDBUF hBuff);
 
int _stdcall SetFormat(SNDBUF hBuff, unsigned int format);
int _stdcall GetFormat(SNDBUF hBuff, unsigned int *format);
 
int _stdcall ResetBuffer(SNDBUF hBuff, unsigned int flags);
int _stdcall SetBufferPos(SNDBUF hBuff, int offset);
int _stdcall GetBufferPos(SNDBUF hBuff, int *offset);
int _stdcall GetBufferSize(SNDBUF hBuff, int *size);
 
int _stdcall SetBuffer(SNDBUF hBuff,void* buff,
int offs, int size);
int _stdcall WaveOut(SNDBUF hBuff,void *buff, int size);
int _stdcall PlayBuffer(SNDBUF hBuff,unsigned int flags);
int _stdcall StopBuffer(SNDBUF hBuff);
 
int _stdcall SetVolume(SNDBUF hBuff, int left, int right);
int _stdcall GetVolume(SNDBUF hBuff, int *left, int *right);
int _stdcall SetPan(SNDBUF hBuff, int pan);
int _stdcall GetPan(SNDBUF hBuff, int *pan);
 
int _stdcall GetMasterVol(int* vol);
int _stdcall SetMasterVol(int vol);
 
 
typedef struct
{
unsigned int riff_id;
unsigned int riff_size;
unsigned int riff_format;
 
unsigned int fmt_id;
unsigned int fmt_size;
 
unsigned short int wFormatTag;
unsigned short int nChannels;
unsigned int nSamplesPerSec;
unsigned int nAvgBytesPerSec;
unsigned short int nBlockAlign;
unsigned short int wBitsPerSample;
unsigned int data_id;
unsigned int data_size;
} WAVEHEADER;
 
 
unsigned int _stdcall test_wav(WAVEHEADER *hdr);
 
#ifdef __cplusplus
extern "C"
}
#endif
 
#endif //_SOUND_H_
/programs/games/doom/trunk/w_wad.c
42,22 → 42,10
 
extern char *main_file;
 
#ifdef DLHEAP
 
void* _cdecl dlmalloc(size_t);
void _cdecl dlfree(void*);
void _cdecl mf_init();
 
#define malloc dlmalloc
#define free dlfree
#define realloc dlrealloc
 
#endif
 
size_t FileSize(FILE *handle);
 
int _stdcall read_file (char *name, void *buff,
size_t offset, size_t count, size_t *reads);
//int _stdcall read_file (char *name, void *buff,
// size_t offset, size_t count, size_t *reads);
 
 
 
196,7 → 184,6
length = header.numlumps*sizeof(filelump_t);
 
fileinfo = alloca(length);
fseek (handle, header.infotableofs, SEEK_SET);
fread (fileinfo, 1, length, handle);
numlumps += header.numlumps;