mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
byuu says: Basically just a project rename, with s/bsnes/higan and the new icon from lowkee added in. It won't compile on Windows because I forgot to update the resource.rc file, and a path transform command isn't working on Windows. It was really just meant as a starting point, so that v091 WIPs can flow starting from .00 with the new name (it overshadows bsnes v091, so publicly speaking this "shouldn't exist" and will probably be deleted from Google Code when v092 is ready.)
43 lines
1.0 KiB
C++
Executable File
43 lines
1.0 KiB
C++
Executable File
#ifndef NALL_STREAM_FILE_HPP
|
|
#define NALL_STREAM_FILE_HPP
|
|
|
|
#include <nall/file.hpp>
|
|
|
|
namespace nall {
|
|
|
|
struct filestream : stream {
|
|
using stream::read;
|
|
using stream::write;
|
|
|
|
bool seekable() const { return true; }
|
|
bool readable() const { return true; }
|
|
bool writable() const { return pwritable; }
|
|
bool randomaccess() const { return false; }
|
|
|
|
unsigned size() const { return pfile.size(); }
|
|
unsigned offset() const { return pfile.offset(); }
|
|
void seek(unsigned offset) const { pfile.seek(offset); }
|
|
|
|
uint8_t read() const { return pfile.read(); }
|
|
void write(uint8_t data) const { pfile.write(data); }
|
|
|
|
filestream(const string &filename) {
|
|
pfile.open(filename, file::mode::readwrite);
|
|
pwritable = pfile.open();
|
|
if(!pwritable) pfile.open(filename, file::mode::read);
|
|
}
|
|
|
|
filestream(const string &filename, file::mode mode) {
|
|
pfile.open(filename, mode);
|
|
pwritable = mode == file::mode::write || mode == file::mode::readwrite;
|
|
}
|
|
|
|
private:
|
|
mutable file pfile;
|
|
bool pwritable;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|