Archival snapshot of the Virtual World Entertainment Tesla cockpit software, 1994-1996: MUNGA engine and L4 pod layer source (Borland C++ 5.0), BT/RP game code, and game content (models, audio, maps, gauges, Division renderer data). Includes third-party libraries: Division dVS/DPL graphics, HMI SOS audio, WATTCP networking. Files are preserved byte-for-byte (.gitattributes disables all line-ending conversion). README.md documents the layout, target hardware, and toolchain. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
78 lines
1.6 KiB
C++
78 lines
1.6 KiB
C++
#include <munga.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(FILESTRM_HPP)
|
|
# include <filestrm.hpp>
|
|
#endif
|
|
|
|
#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::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);
|
|
}
|
|
|