Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MWR timing optional (default off) (cfg "pce.mwrtiming_approx") #104

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mednafen/src/pce/pce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ static MDFN_COLD int LoadCommon(void)

vce = new VCE(IsSGX, vram_size);
vce->SetVDCUnlimitedSprites(MDFN_GetSettingB("pce.nospritelimit"));
vce->SetMWRTiming(MDFN_GetSettingB("pce.mwrtiming_approx"));


if(IsSGX)
MDFN_printf("SuperGrafx Emulation Enabled.\n");
Expand Down Expand Up @@ -1105,6 +1107,9 @@ static const MDFNSetting PCESettings[] =
{ "pce.nospritelimit", MDFNSF_NOFLAGS, gettext_noop("Remove 16-sprites-per-scanline hardware limit."),
gettext_noop("WARNING: Enabling this option may cause undesirable graphics glitching on some games(such as \"Bloody Wolf\")."), MDFNST_BOOL, "0" },

{ "pce.mwrtiming_approx", MDFNSF_NOFLAGS, gettext_noop("Approximate MWR VRAM access timing during active display"),
gettext_noop("WARNING: This is an approximation, and is not accurate; sprite prefetch during HBLANK is not simulated either."), MDFNST_BOOL, "0" },

{ "pce.cdbios", MDFNSF_EMU_STATE | MDFNSF_CAT_PATH, gettext_noop("Path to the CD BIOS"), NULL, MDFNST_STRING, "syscard3.pce" },
{ "pce.gecdbios", MDFNSF_EMU_STATE | MDFNSF_CAT_PATH, gettext_noop("Path to the GE CD BIOS"), gettext_noop("Games Express CD Card BIOS (Unlicensed)"), MDFNST_STRING, "gecard.pce" },

Expand Down
11 changes: 10 additions & 1 deletion mednafen/src/pce/vce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ bool VCE::WS_Hook(int32 vdc_cycles)
{
while (vdc[chip].ActiveDisplayPenaltyCycles > 0) // try to make accesses to ActiveDisplayPenaltyCycles as atomic as possible
{
to_steal++;
if (mwr_approximate)
{
to_steal++;
}
vdc[chip].ActiveDisplayPenaltyCycles--;
}
}
Expand Down Expand Up @@ -147,6 +150,7 @@ VCE::VCE(const bool want_sgfx, const uint32 vram_size)
}

SetVDCUnlimitedSprites(false);
SetMWRTiming(false);

memset(surf_clut, 0, sizeof(surf_clut));

Expand All @@ -167,6 +171,11 @@ void VCE::SetVDCUnlimitedSprites(const bool nospritelimit)
vdc[chip].SetUnlimitedSprites(nospritelimit);
}

void VCE::SetMWRTiming(const bool mwr_switch)
{
mwr_approximate = mwr_switch;
}

VCE::~VCE()
{

Expand Down
3 changes: 3 additions & 0 deletions mednafen/src/pce/vce.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class VCE final
~VCE() MDFN_COLD;

void SetVDCUnlimitedSprites(const bool nospritelimit);
void SetMWRTiming(const bool mwr_flag);
void SetShowHorizOS(bool show);
void SetLayerEnableMask(uint64 mask);

Expand Down Expand Up @@ -233,6 +234,8 @@ class VCE final
bool ShowHorizOS;
bool sgfx;

bool mwr_approximate; // flag whether to approximate MWR timing round-robin

bool skipframe;
int32 *LW;
unsigned chip_count; // = 1 when sgfx is false, = 2 when sgfx is true
Expand Down