Skip to content

Commit

Permalink
ms: add color emulation for non-linear blue
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeUsher committed Oct 24, 2023
1 parent 84e3663 commit f1fb33a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ares/ms/vdp/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ auto VDP::colorMasterSystem(n32 color) -> n64 {
n64 g = image::normalize(G, 2, 16);
n64 b = image::normalize(B, 2, 16);

//master system has non-linear blue output
if(colorEmulation->value()) {
u8 values[4] = {0, 104, 170, 255};
b = image::normalize(values[B], 8, 16);
}

return r << 32 | g << 16 | b << 0;
}

Expand Down
5 changes: 5 additions & 0 deletions ares/ms/vdp/vdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ auto VDP::load(Node::Object parent) -> void {
if(value == 1) screen->setSize(256, 240);
});
overscan->setDynamic(true);

colorEmulation = screen->append<Node::Setting::Boolean>("Color Emulation", true, [&](auto value) {
screen->resetPalette();
});
colorEmulation->setDynamic(true);
}

if(Display::LCD()) {
Expand Down
1 change: 1 addition & 0 deletions ares/ms/vdp/vdp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ struct VDP : Thread {
Node::Object node;
Node::Video::Screen screen;
Node::Setting::Boolean overscan;
Node::Setting::Boolean colorEmulation;
Node::Setting::Natural revision;
Node::Setting::Boolean interframeBlending; //Game Gear only
Memory::Writable<n8 > vram; //16KB
Expand Down

0 comments on commit f1fb33a

Please sign in to comment.