Initial import of Red Planet v4.10 Win32 source
Imports the current Win32 source for the pod-racing game 'Red Planet', built on the MUNGA engine and its L4 (Win32/DirectX) platform layer: - MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend - RP / RP_L4: Red Planet game logic and Win32 application - DivLoader, Setup1: asset loader and installer project - lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies Removed stale Subversion metadata and added .gitignore/.gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
#include "munga.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "filestrm.h"
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <sys\stat.h>
|
||||
|
||||
//#############################################################################
|
||||
//########################### FileStream ################################
|
||||
//#############################################################################
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
int
|
||||
FileStream::OpenImplementation(
|
||||
const char *file_name,
|
||||
Logical read_only
|
||||
)
|
||||
{
|
||||
if (read_only)
|
||||
{
|
||||
return _open(file_name, _O_BINARY | _O_RDONLY);
|
||||
}
|
||||
else
|
||||
{
|
||||
return _open(file_name, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IWRITE);
|
||||
}
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
void FileStream::FlushImplementation(int file_handle)
|
||||
{
|
||||
_commit(file_handle);
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
void FileStream::CloseImplementation(int file_handle)
|
||||
{
|
||||
_close(file_handle);
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
size_t
|
||||
FileStream::SeekImplementation(
|
||||
int file_handle,
|
||||
size_t where,
|
||||
Logical from_end
|
||||
)
|
||||
{
|
||||
return _lseek(file_handle, (long)where, (from_end) ? SEEK_END : SEEK_SET);
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
size_t
|
||||
FileStream::ReadImplementation(
|
||||
int file_handle,
|
||||
void *buffer,
|
||||
size_t length
|
||||
)
|
||||
{
|
||||
return _read(file_handle, buffer, length);
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
size_t
|
||||
FileStream::WriteImplementation(
|
||||
int file_handle,
|
||||
const void *buffer,
|
||||
size_t length
|
||||
)
|
||||
{
|
||||
return _write(file_handle, buffer, length);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user