libgambatte CDL - dont log anything while the bios runs (fixes #1349)

This commit is contained in:
zeromus 2018-11-12 17:52:26 -05:00
parent a3e0a9818e
commit 25ff1f9539
3 changed files with 256 additions and 237 deletions

View File

@ -71,15 +71,19 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>..\output\dll</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>..\output\dll</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>..\output\dll</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>..\output\dll</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -219,4 +223,9 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties />
</VisualStudio>
</ProjectExtensions>
</Project> </Project>

View File

@ -212,14 +212,19 @@ public:
unsigned read(const unsigned P, const unsigned long cycleCounter) { unsigned read(const unsigned P, const unsigned long cycleCounter) {
if (readCallback) if (readCallback)
readCallback(P, (cycleCounter - basetime) >> 1); readCallback(P, (cycleCounter - basetime) >> 1);
bool biosRange = ((!gbIsCgb_ && P < 0x100) || (gbIsCgb_ && P < 0x900 && (P < 0x100 || P >= 0x200)));
if(biosMode) {
if (biosRange)
return readBios(P);
}
else
{
if(cdCallback) if(cdCallback)
{ {
CDMapResult map = CDMap(P); CDMapResult map = CDMap(P);
if(map.type != eCDLog_AddrType_None) if(map.type != eCDLog_AddrType_None)
cdCallback(map.addr,map.type,eCDLog_Flags_Data); cdCallback(map.addr,map.type,eCDLog_Flags_Data);
} }
if (biosMode && ((!gbIsCgb_ && P < 0x100) || (gbIsCgb_ && P < 0x900 && (P < 0x100 || P >= 0x200)))) {
return readBios(P);
} }
return cart.rmem(P >> 12) ? cart.rmem(P >> 12)[P] : nontrivial_read(P, cycleCounter); return cart.rmem(P >> 12) ? cart.rmem(P >> 12)[P] : nontrivial_read(P, cycleCounter);
} }
@ -227,14 +232,19 @@ public:
unsigned read_excb(const unsigned P, const unsigned long cycleCounter, bool first) { unsigned read_excb(const unsigned P, const unsigned long cycleCounter, bool first) {
if (execCallback) if (execCallback)
execCallback(P, (cycleCounter - basetime) >> 1); execCallback(P, (cycleCounter - basetime) >> 1);
bool biosRange = ((!gbIsCgb_ && P < 0x100) || (gbIsCgb_ && P < 0x900 && (P < 0x100 || P >= 0x200)));
if (biosMode) {
if(biosRange)
return readBios(P);
}
else
{
if(cdCallback) if(cdCallback)
{ {
CDMapResult map = CDMap(P); CDMapResult map = CDMap(P);
if(map.type != eCDLog_AddrType_None) if(map.type != eCDLog_AddrType_None)
cdCallback(map.addr,map.type,first?eCDLog_Flags_ExecFirst : eCDLog_Flags_ExecOperand); cdCallback(map.addr,map.type,first?eCDLog_Flags_ExecFirst : eCDLog_Flags_ExecOperand);
} }
if (biosMode && ((!gbIsCgb_ && P < 0x100) || (gbIsCgb_ && P < 0x900 && (P < 0x100 || P >= 0x200)))) {
return readBios(P);
} }
return cart.rmem(P >> 12) ? cart.rmem(P >> 12)[P] : nontrivial_read(P, cycleCounter); return cart.rmem(P >> 12) ? cart.rmem(P >> 12)[P] : nontrivial_read(P, cycleCounter);
} }
@ -260,7 +270,7 @@ public:
nontrivial_write(P, data, cycleCounter); nontrivial_write(P, data, cycleCounter);
if (writeCallback) if (writeCallback)
writeCallback(P, (cycleCounter - basetime) >> 1); writeCallback(P, (cycleCounter - basetime) >> 1);
if(cdCallback) if(cdCallback && !biosMode)
{ {
CDMapResult map = CDMap(P); CDMapResult map = CDMap(P);
if(map.type != eCDLog_AddrType_None) if(map.type != eCDLog_AddrType_None)
@ -275,7 +285,7 @@ public:
nontrivial_ff_write(P, data, cycleCounter); nontrivial_ff_write(P, data, cycleCounter);
if (writeCallback) if (writeCallback)
writeCallback(P, (cycleCounter - basetime) >> 1); writeCallback(P, (cycleCounter - basetime) >> 1);
if(cdCallback) if(cdCallback && !biosMode)
{ {
CDMapResult map = CDMap(P); CDMapResult map = CDMap(P);
if(map.type != eCDLog_AddrType_None) if(map.type != eCDLog_AddrType_None)

Binary file not shown.