Skip to content

Commit

Permalink
hacks: force ntsc option
Browse files Browse the repository at this point in the history
  • Loading branch information
JaCzekanski committed Sep 5, 2019
1 parent eeccbfa commit 1a4bc86
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ const json defaultConfig = {
{"width", 640u},
{"height", 480u}
}},
{"vsync", false}
{"vsync", false},
{"forceNtsc", false},
}}
}},
{"debug", {
Expand Down
3 changes: 2 additions & 1 deletion src/device/gpu/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ GPU::GPU() {
GPU::~GPU() { bus.unlistenAll(busToken); }

void GPU::reload() {
forceNtsc = config["options"]["graphics"]["forceNtsc"];
auto mode = config["options"]["graphics"]["rendering_mode"].get<RenderingMode>();
softwareRendering = (mode & RenderingMode::SOFTWARE) != 0;
hardwareRendering = (mode & RenderingMode::HARDWARE) != 0;
Expand Down Expand Up @@ -746,7 +747,7 @@ bool GPU::insideDrawingArea(int x, int y) const {
&& (y < VRAM_HEIGHT);
}

bool GPU::isNtsc() { return gp1_08.videoMode == GP1_08::VideoMode::ntsc; }
bool GPU::isNtsc() { return forceNtsc || gp1_08.videoMode == GP1_08::VideoMode::ntsc; }

void GPU::dumpVram() {
std::vector<uint8_t> vram;
Expand Down
1 change: 1 addition & 0 deletions src/device/gpu/gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class GPU {
// Hardware rendering
std::vector<Vertex> vertices;

bool forceNtsc;
bool softwareRendering;
bool hardwareRendering;

Expand Down
36 changes: 29 additions & 7 deletions src/platform/windows/gui/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,42 @@ void graphicsOptionsWindow() {
bus.notify(Event::Config::Gte{});
}

bool vsync = config["options"]["graphics"]["vsync"];
if (ImGui::Checkbox("VSync", &vsync)) {
config["options"]["graphics"]["vsync"] = vsync;
bus.notify(Event::Config::Graphics{});
}

ImGui::Separator();
ImGui::Text("Hacks");

bool forceNtsc = config["options"]["graphics"]["forceNtsc"];
if (ImGui::Checkbox("Force NTSC", &forceNtsc)) {
config["options"]["graphics"]["forceNtsc"] = forceNtsc;
bus.notify(Event::Config::Graphics{});
}

ImGui::SameLine();
ImGui::TextDisabled("(?)");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::TextUnformatted(
"Force 60Hz mode for PAL games (50Hz)\n"
"Since some PAL games are slowed down versions of NTSC equivalent,\n"
"this option might be useful to bring back such titles to the original speed.");
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}

if (widescreen) {
bool forceWidescreen = config["options"]["graphics"]["forceWidescreen"];
if (ImGui::Checkbox("Force widescreen in 3d (hack)", &forceWidescreen)) {
if (ImGui::Checkbox("Force widescreen in 3d", &forceWidescreen)) {
config["options"]["graphics"]["forceWidescreen"] = forceWidescreen;
bus.notify(Event::Config::Gte{});
}
}

bool vsync = config["options"]["graphics"]["vsync"];
if (ImGui::Checkbox("VSync", &vsync)) {
config["options"]["graphics"]["vsync"] = vsync;
bus.notify(Event::Config::Graphics{});
}

ImGui::End();
}

Expand Down

0 comments on commit 1a4bc86

Please sign in to comment.