bsnes/higan/sfc/system/random.cpp
Tim Allen f1ebef2ea8 Update to v097r01 release.
byuu says:

A minor WIP to get us started.

Changelog:
- System::Video merged to PPU::Video
- System::Audio merged to DSP::Audio
- System::Configuration merged to Interface::Settings
- created emulator/emulator.cpp and accompanying object file for shared
  code between all cores

Currently, emulator.cpp just holds a videoColor() function that takes
R16G16B16, performs gamma/saturation/luma adjust, and outputs
(currently) A8R8G8B8. It's basically an internal function call for cores
to use when generating palette entries. This code used to exist inside
ui-tomoko/program/interface.cpp, but we have to move it internal for
software display emulation. But in the future, we could add other useful
cross-core functionality here.
2016-01-23 18:29:34 +11:00

15 lines
293 B
C++

Random random;
auto Random::seed(uint seed) -> void {
iter = seed;
}
auto Random::operator()(uint result) -> uint {
if(!settings.random) return result;
return iter = (iter >> 1) ^ (((iter & 1) - 1) & 0xedb88320);
}
auto Random::serialize(serializer& s) -> void {
s.integer(iter);
}