ares: update cores to use refreshRateHint api

Most systems will use an accurate refresh rate calculated from display timing

N64, PS1, PC-Engine and Neo Geo Pocket use 50hz and 60hz until we determine how to calculate.
このコミットが含まれているのは:
Luke Usher 2024-04-09 11:23:29 +01:00
コミット ec0b625ea5
23個のファイルの変更28行の追加0行の削除

ファイルの表示

@ -112,6 +112,7 @@ auto TIA::scanline() -> void {
}
auto TIA::frame() -> void {
screen->refreshRateHint(system.frequency(), 228, io.vcounter);
screen->frame();
scheduler.exit(Event::Frame);
}

ファイルの表示

@ -72,6 +72,10 @@ auto Screen::setRefresh(function<void ()> refresh) -> void {
_refresh = refresh;
}
auto Screen::refreshRateHint(double pixelFrequency, int dotsPerLine, int linesPerFrame) -> void {
refreshRateHint(1.0f / ((double)(dotsPerLine * linesPerFrame) / pixelFrequency));
}
auto Screen::refreshRateHint(double refreshRate) -> void {
lock_guard<recursive_mutex> lock(_mutex);
platform->refreshRateHint(refreshRate);

ファイルの表示

@ -35,6 +35,7 @@ struct Screen : Video {
auto setRefresh(function<void ()> refresh) -> void;
auto setViewport(u32 x, u32 y, u32 width, u32 height) -> void;
auto refreshRateHint(double refreshRate) -> void;
auto refreshRateHint(double pixelFrequency, int dotsPerLine, int linesPerFrame) -> void;
auto setSize(u32 width, u32 height) -> void;
auto setScale(f64 scaleX, f64 scaleY) -> void;

ファイルの表示

@ -17,6 +17,7 @@ auto VDP::load(Node::Object parent) -> void {
screen->setScale(1.0, 1.0);
screen->setAspect(8.0, 7.0);
screen->setViewport(0, 0, 284, 243);
screen->refreshRateHint(system.colorburst(), 228, 262);
TMS9918::load(screen);
}

ファイルの表示

@ -21,6 +21,7 @@ auto PPU::load(Node::Object parent) -> void {
screen->setSize(282, displayHeight());
screen->setScale(1.0, 1.0);
Region::PAL() ? screen->setAspect(55.0, 43.0) :screen->setAspect(8.0, 7.0);
screen->refreshRateHint(system.frequency() / rate(), 341, vlines());
debugger.load(node);
}

ファイルの表示

@ -27,6 +27,7 @@ auto PPU::load(Node::Object parent) -> void {
screen->setSize(160, 144);
screen->setScale(1.0, 1.0);
screen->setAspect(1.0, 1.0);
screen->refreshRateHint(4 * 1024 * 1024, 456, 154);
if(Model::GameBoy()) {
screen->colors(1 << 2, {&PPU::colorGameBoy, this});

ファイルの表示

@ -35,6 +35,7 @@ auto PPU::load(Node::Object parent) -> void {
screen->setScale(1.0, 1.0);
screen->setAspect(1.0, 1.0);
screen->setViewport(0, 0, 240, 160);
screen->refreshRateHint(system.frequency() / 4, 308, 228);
colorEmulation = screen->append<Node::Setting::Boolean>("Color Emulation", true, [&](auto value) {
screen->resetPalette();

ファイルの表示

@ -25,6 +25,7 @@ auto VDP::load(Node::Object parent) -> void {
screen->setSize(1280, 480);
screen->setScale(0.25, 0.5);
screen->setAspect(32, 35);
screen->refreshRateHint(system.frequency(), 3420, frameHeight());
psg.load(node);
debugger.load(node);

ファイルの表示

@ -39,6 +39,7 @@ auto VDP::load(Node::Object parent) -> void {
screen->setSize(1388, visibleHeight() * 2);
screen->setScale(0.25, 0.5);
Region::PAL() ? screen->setAspect(111.0, 100.0) : screen->setAspect(32.0, 35.0);
screen->refreshRateHint(system.frequency(), 3420, frameHeight());
psg.load(node);
debugger.load(node);

ファイルの表示

@ -24,6 +24,7 @@ auto VDP::load(Node::Object parent) -> void {
if((Model::MarkIII() || Model::MasterSystemI()) && Region::NTSCJ()) defaultRevision = 1;
revision = node->append<Node::Setting::Natural>("Revision", defaultRevision);
revision->setAllowedValues({1, 2});
screen->refreshRateHint(system.colorburst() * 15, 3420, Region::PAL() ? 313 : 262);
if(Display::CRT()) {
screen->colors(1 << 6, {&VDP::colorMasterSystem, this});

ファイルの表示

@ -30,6 +30,8 @@ auto VDP::load(Node::Object parent) -> void {
V9938::pram.allocate(16);
V9938::load(screen);
}
screen->refreshRateHint(system.colorburst(), 228, 262);
}
auto VDP::unload() -> void {

ファイルの表示

@ -17,6 +17,7 @@ auto VDP::load(Node::Object parent) -> void {
screen->setViewport(0, 0, 284, 243);
screen->setScale(1.0, 1.0);
screen->setAspect(8.0, 7.0);
screen->refreshRateHint(Constants::Colorburst::NTSC, 228, 262);
TMS9918::load(screen);
}

ファイルの表示

@ -21,6 +21,7 @@ auto VI::load(Node::Object parent) -> void {
#endif
screen = node->append<Node::Video::Screen>("Screen", width, height);
screen->setRefresh({&VI::refresh, this});
screen->refreshRateHint(Region::PAL() ? 50 : 60); // TODO: More accurate refresh rate hint
screen->colors((1 << 24) + (1 << 15), [&](n32 color) -> n64 {
if(color < (1 << 24)) {
u64 a = 65535;

ファイルの表示

@ -16,6 +16,7 @@ auto LSPC::load(Node::Object parent) -> void {
screen->setSize(320, 256);
screen->setScale(1.0, 1.0);
screen->setAspect(1.0, 1.0);
screen->refreshRateHint(6'000'000, 384, 264);
vram.allocate(68_KiB >> 1);
pram.allocate(16_KiB >> 1);

ファイルの表示

@ -21,6 +21,7 @@ auto KGE::load(Node::Object parent) -> void {
screen->setViewport(0, 0, 160, 152);
screen->setScale(1.0, 1.0);
screen->setAspect(1.0, 1.0);
screen->refreshRateHint(60); // TODO: More accurate refresh rate hint
interframeBlending = screen->append<Node::Setting::Boolean>("Interframe Blending", true, [&](auto value) {
screen->setInterframeBlending(value);

ファイルの表示

@ -28,6 +28,7 @@ auto VDP::load(Node::Object parent) -> void {
screen->setSize(1128, 263);
screen->setScale(0.25, 1.0);
screen->setAspect(8.0, 7.0);
screen->refreshRateHint(60); // TODO: More accurate refresh rate hint
colorEmulation = screen->append<Node::Setting::Boolean>("Color Emulation", true, [&](auto value) {
screen->resetPalette();

ファイルの表示

@ -43,6 +43,7 @@ auto VDP::load(Node::Object parent) -> void {
screen->setSize(1128, 263);
screen->setScale(0.25, 1.0);
screen->setAspect(8.0, 7.0);
screen->refreshRateHint(60); // TODO: More accurate refresh rate hint
colorEmulation = screen->append<Node::Setting::Boolean>("Color Emulation", true, [&](auto value) {
screen->resetPalette();

ファイルの表示

@ -1,6 +1,8 @@
auto GPU::Blitter::queue() -> void {
self.refreshed = true;
self.screen->refreshRateHint(self.io.videoMode ? 50 : 60); // TODO: More accurate refresh rate hint
//if the display is disabled, output a black screen image
if(blank = self.io.displayDisable) {
self.screen->frame();

ファイルの表示

@ -26,6 +26,7 @@ auto PPU::load(Node::Object parent) -> void {
screen->setSize(564, height() * 2);
screen->setScale(0.5, 0.5);
Region::PAL() ? screen->setAspect(55.0, 43.0) :screen->setAspect(8.0, 7.0);
screen->refreshRateHint(system.cpuFrequency(), 1364, Region::PAL() ? 312 : 262);
vramSize = node->append<Node::Setting::Natural>("VRAM", 64_KiB);
vramSize->setAllowedValues({64_KiB, 128_KiB});

ファイルの表示

@ -37,6 +37,7 @@ auto PPU::load(Node::Object parent) -> void {
screen->setSize(564, height() * 2);
screen->setScale(0.5, 0.5);
Region::PAL() ? screen->setAspect(55.0, 43.0) :screen->setAspect(8.0, 7.0);
screen->refreshRateHint(system.cpuFrequency(), 1364, Region::PAL() ? 312 : 262);
versionPPU1 = node->append<Node::Setting::Natural>("PPU1 Version", 1);
versionPPU1->setAllowedValues({1});

ファイルの表示

@ -17,6 +17,7 @@ auto VDP::load(Node::Object parent) -> void {
screen->setViewport(0, 0, 284, 243);
screen->setScale(1.0, 1.0);
screen->setAspect(8.0, 7.0);
screen->refreshRateHint(system.colorburst(), 228, 262);
TMS9918::load(screen);
}

ファイルの表示

@ -15,6 +15,7 @@ auto ULA::load(Node::Object parent) -> void {
screen->setScale(1.0, 1.0);
screen->setAspect(1.0, 1.0);
screen->setViewport(0, 0, screen->width(), screen->height());
screen->refreshRateHint(system.frequency(), 224, 312);
stream = node->append<Node::Audio::Stream>("Audio");
stream->setChannels(1);

ファイルの表示

@ -221,6 +221,7 @@ auto PPU::frame() -> void {
io.vcounter = 0;
io.field = !io.field;
screen->setViewport(0, 0, screen->width(), screen->height());
screen->refreshRateHint(3'072'000, 256, io.vcounter);
screen->frame();
scheduler.exit(Event::Frame);
}