mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
byuu says: Changelog: - added Cocoa target: higan can now be compiled for OS X Lion [Cydrak, byuu] - SNES/accuracy profile hires color blending improvements - fixes Marvelous text [AWJ] - fixed a slight bug in SNES/SA-1 VBR support caused by a typo - added support for multi-pass shaders that can load external textures (requires OpenGL 3.2+) - added game library path (used by ananke->Import Game) to Settings->Advanced - system profiles, shaders and cheats database can be stored in "all users" shared folders now (eg /usr/share on Linux) - all configuration files are in BML format now, instead of XML (much easier to read and edit this way) - main window supports drag-and-drop of game folders (but not game files / ZIP archives) - audio buffer clears when entering a modal loop on Windows (prevents audio repetition with DirectSound driver) - a substantial amount of code clean-up (probably the biggest refactoring to date) One highly desired target for this release was to default to the optimal drivers instead of the safest drivers, but because AMD drivers don't seem to like my OpenGL 3.2 driver, I've decided to postpone that. AMD has too big a market share. Hopefully with v093 officially released, we can get some public input on what AMD doesn't like.
101 lines
2.2 KiB
C++
101 lines
2.2 KiB
C++
#ifndef NALL_STREAM_STREAM_HPP
|
|
#define NALL_STREAM_STREAM_HPP
|
|
|
|
namespace nall {
|
|
|
|
struct stream {
|
|
virtual bool seekable() const = 0;
|
|
virtual bool readable() const = 0;
|
|
virtual bool writable() const = 0;
|
|
virtual bool randomaccess() const = 0;
|
|
|
|
virtual uint8_t* data() const { return nullptr; }
|
|
virtual unsigned size() const = 0;
|
|
virtual unsigned offset() const = 0;
|
|
virtual void seek(unsigned offset) const = 0;
|
|
|
|
virtual uint8_t read() const = 0;
|
|
virtual void write(uint8_t data) const = 0;
|
|
|
|
virtual uint8_t read(unsigned) const { return 0; }
|
|
virtual void write(unsigned, uint8_t) const {}
|
|
|
|
operator bool() const {
|
|
return size();
|
|
}
|
|
|
|
bool empty() const {
|
|
return size() == 0;
|
|
}
|
|
|
|
bool end() const {
|
|
return offset() >= size();
|
|
}
|
|
|
|
uintmax_t readl(unsigned length = 1) const {
|
|
uintmax_t data = 0, shift = 0;
|
|
while(length--) { data |= read() << shift; shift += 8; }
|
|
return data;
|
|
}
|
|
|
|
uintmax_t readm(unsigned length = 1) const {
|
|
uintmax_t data = 0;
|
|
while(length--) data = (data << 8) | read();
|
|
return data;
|
|
}
|
|
|
|
void read(uint8_t* data, unsigned length) const {
|
|
while(length--) *data++ = read();
|
|
}
|
|
|
|
string text() const {
|
|
string buffer;
|
|
buffer.resize(size() + 1);
|
|
buffer[size()] = 0;
|
|
seek(0);
|
|
read((uint8_t*)buffer.data(), size());
|
|
return buffer;
|
|
}
|
|
|
|
void writel(uintmax_t data, unsigned length = 1) const {
|
|
while(length--) {
|
|
write(data);
|
|
data >>= 8;
|
|
}
|
|
}
|
|
|
|
void writem(uintmax_t data, unsigned length = 1) const {
|
|
uintmax_t shift = 8 * length;
|
|
while(length--) {
|
|
shift -= 8;
|
|
write(data >> shift);
|
|
}
|
|
}
|
|
|
|
void write(const uint8_t* data, unsigned length) const {
|
|
while(length--) write(*data++);
|
|
}
|
|
|
|
struct byte {
|
|
operator uint8_t() const { return s.read(offset); }
|
|
byte& operator=(uint8_t data) { s.write(offset, data); return *this; }
|
|
byte(const stream& s, unsigned offset) : s(s), offset(offset) {}
|
|
|
|
private:
|
|
const stream& s;
|
|
const unsigned offset;
|
|
};
|
|
|
|
byte operator[](unsigned offset) const {
|
|
return byte(*this, offset);
|
|
}
|
|
|
|
stream() {}
|
|
virtual ~stream() {}
|
|
stream(const stream&) = delete;
|
|
stream& operator=(const stream&) = delete;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|