2016-03-20 17:00:00 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* REminiscence - Flashback interpreter
|
2019-10-27 17:00:00 +01:00
|
|
|
* Copyright (C) 2005-2019 Gregory Montoir (cyx@users.sourceforge.net)
|
2015-08-02 18:00:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FILE_H__
|
|
|
|
#define FILE_H__
|
|
|
|
|
|
|
|
#include "intern.h"
|
|
|
|
|
|
|
|
struct File_impl;
|
|
|
|
struct FileSystem;
|
|
|
|
|
|
|
|
struct File {
|
|
|
|
File();
|
|
|
|
~File();
|
|
|
|
|
|
|
|
File_impl *_impl;
|
|
|
|
|
|
|
|
bool open(const char *filename, const char *mode, FileSystem *fs);
|
|
|
|
bool open(const char *filename, const char *mode, const char *directory);
|
2019-12-28 17:00:00 +01:00
|
|
|
void openMemoryBuffer(int initialCapacity);
|
2015-08-02 18:00:00 +02:00
|
|
|
void close();
|
|
|
|
bool ioErr() const;
|
|
|
|
uint32_t size();
|
|
|
|
void seek(int32_t off);
|
|
|
|
uint32_t read(void *ptr, uint32_t len);
|
|
|
|
uint8_t readByte();
|
|
|
|
uint16_t readUint16LE();
|
|
|
|
uint32_t readUint32LE();
|
|
|
|
uint16_t readUint16BE();
|
|
|
|
uint32_t readUint32BE();
|
2017-11-03 17:00:00 +01:00
|
|
|
uint32_t write(const void *ptr, uint32_t size);
|
2015-08-02 18:00:00 +02:00
|
|
|
void writeByte(uint8_t b);
|
2019-10-27 17:00:00 +01:00
|
|
|
void writeUint16LE(uint16_t n);
|
|
|
|
void writeUint32LE(uint32_t n);
|
2015-08-02 18:00:00 +02:00
|
|
|
void writeUint16BE(uint16_t n);
|
|
|
|
void writeUint32BE(uint32_t n);
|
|
|
|
};
|
|
|
|
|
2019-10-27 17:00:00 +01:00
|
|
|
void dumpFile(const char *filename, const uint8_t *p, int size);
|
|
|
|
|
2015-08-02 18:00:00 +02:00
|
|
|
#endif // FILE_H__
|