bsnes/sfc/system/system.hpp
Tim Allen 8c0b0fa4ad Update to v093r02 release.
byuu says:

Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
  as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
  Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
  easier

So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.

As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 22:45:54 +11:00

82 lines
1.7 KiB
C++

struct Interface;
struct System : property<System> {
enum class Region : unsigned { NTSC = 0, PAL = 1, Autodetect = 2 };
enum class ExpansionPortDevice : unsigned { None = 0, Satellaview = 1 };
void run();
void runtosave();
void init();
void term();
void load();
void unload();
void power();
void reset();
void frame();
void scanline();
//return *active* system information (settings are cached upon power-on)
readonly<Region> region;
readonly<ExpansionPortDevice> expansion;
readonly<unsigned> cpu_frequency;
readonly<unsigned> apu_frequency;
readonly<unsigned> serialize_size;
serializer serialize();
bool unserialize(serializer&);
System();
private:
void runthreadtosave();
void serialize(serializer&);
void serialize_all(serializer&);
void serialize_init();
friend class Cartridge;
friend class Video;
friend class Audio;
friend class Input;
};
extern System system;
#include "video.hpp"
#include "audio.hpp"
#include "input.hpp"
#include <sfc/scheduler/scheduler.hpp>
struct Configuration {
Input::Device controller_port1 = Input::Device::Joypad;
Input::Device controller_port2 = Input::Device::Joypad;
System::ExpansionPortDevice expansion_port = System::ExpansionPortDevice::Satellaview;
System::Region region = System::Region::Autodetect;
bool random = true;
};
extern Configuration configuration;
struct Random {
void seed(unsigned seed) {
iter = seed;
}
unsigned operator()(unsigned result) {
if(configuration.random == false) return result;
return iter = (iter >> 1) ^ (((iter & 1) - 1) & 0xedb88320);
}
void serialize(serializer& s) {
s.integer(iter);
}
private:
unsigned iter = 0;
};
extern Random random;