Merge branch 'master' into lightgun

This commit is contained in:
bearoso 2018-09-27 12:23:22 -05:00 committed by GitHub
commit 7553d50a8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 14 deletions

View File

@ -1,6 +1,5 @@
DEBUG = 0
HAVE_EXCEPTIONS = 0
LAGFIX=1
HAVE_STRINGS_H = 1
SPACE :=
@ -44,11 +43,6 @@ ifneq ($(GIT_VERSION)," unknown")
CXXFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
ifeq ($(LAGFIX),1)
CFLAGS += -DLAGFIX
CXXFLAGS += -DLAGFIX
endif
# Unix
ifneq (,$(findstring unix,$(platform)))
CFLAGS += -flto

View File

@ -3235,6 +3235,12 @@ static void Initialize (void)
Settings.StretchScreenshots = 1;
Settings.SnapshotScreenshots = true;
Settings.OpenGLEnable = true;
Settings.SuperFXClockMultiplier = 100;
Settings.InterpolationMethod = DSP_INTERPOLATION_GAUSSIAN;
Settings.MaxSpriteTilesPerLine = 34;
Settings.OneClockCycle = 6;
Settings.OneSlowClockCycle = 8;
Settings.TwoClockCycles = 12;
for (int a = 0; a < kWindowCount; a++)
{

View File

@ -1380,6 +1380,20 @@ int CMemory::ScoreLoROM (bool8 skip_header, int32 romoff)
return (score);
}
int CMemory::First512BytesCountZeroes() const
{
const uint8 *buf = ROM;
int zeroCount = 0;
for (int i = 0; i < 512; i++)
{
if (buf[i] == 0)
{
zeroCount++;
}
}
return zeroCount;
}
uint32 CMemory::HeaderRemove (uint32 size, uint8 *buf)
{
uint32 calc_size = (size / 0x2000) * 0x2000;
@ -1590,13 +1604,21 @@ bool8 CMemory::LoadROMInt (int32 ROMfillSize)
ExtendedFormat = NOPE;
int hi_score, lo_score;
int score_headered;
int score_nonheadered;
hi_score = ScoreHiROM(FALSE);
lo_score = ScoreLoROM(FALSE);
score_nonheadered = max(hi_score, lo_score);
score_headered = max(ScoreHiROM(TRUE), ScoreLoROM(TRUE));
if (HeaderCount == 0 && !Settings.ForceNoHeader &&
((hi_score > lo_score && ScoreHiROM(TRUE) > hi_score) ||
(hi_score <= lo_score && ScoreLoROM(TRUE) > lo_score)))
bool size_is_likely_headered = ((ROMfillSize - 512) & 0xFFFF) == 0;
if (size_is_likely_headered) { score_headered += 2; } else { score_headered -= 2; }
if (First512BytesCountZeroes() >= 0x1E0) { score_headered += 2; } else { score_headered -= 2; }
bool headered_score_highest = score_headered > score_nonheadered;
if (HeaderCount == 0 && !Settings.ForceNoHeader && headered_score_highest)
{
memmove(ROM, ROM + 512, ROMfillSize - 512);
ROMfillSize -= 512;
@ -3820,7 +3842,7 @@ void CMemory::ApplyROMFixes (void)
Timings.HDMAStart = SNES_HDMA_START_HC + Settings.HDMATimingHack - 100;
Timings.HBlankStart = SNES_HBLANK_START_HC + Timings.HDMAStart - SNES_HDMA_START_HC;
Timings.IRQTriggerCycles = 10;
Timings.IRQTriggerCycles = 14;
if (!Settings.DisableGameSpecificHacks)
{

View File

@ -286,6 +286,7 @@ struct CMemory
int ScoreHiROM (bool8, int32 romoff = 0);
int ScoreLoROM (bool8, int32 romoff = 0);
int First512BytesCountZeroes() const;
uint32 HeaderRemove (uint32, uint8 *);
uint32 FileLoader (uint8 *, const char *, uint32);
uint32 MemLoader (uint8 *, const char*, uint32);

View File

@ -341,9 +341,9 @@ void S9xUpdateIRQPositions (bool initial)
else if (!PPU.HTimerEnabled && PPU.VTimerEnabled)
{
if (CPU.V_Counter == PPU.VTimerPosition && initial)
Timings.NextIRQTimer = CPU.Cycles + Timings.IRQTriggerCycles;
Timings.NextIRQTimer = CPU.Cycles + Timings.IRQTriggerCycles - ONE_DOT_CYCLE;
else
Timings.NextIRQTimer = CyclesUntilNext (Timings.IRQTriggerCycles, PPU.VTimerPosition);
Timings.NextIRQTimer = CyclesUntilNext (Timings.IRQTriggerCycles - ONE_DOT_CYCLE, PPU.VTimerPosition);
}
else
{
@ -1566,7 +1566,8 @@ void S9xSetCPU (uint8 Byte, uint16 Address)
CPU.IRQTransition = FALSE;
}
S9xUpdateIRQPositions(false);
if ((Byte & 0x30) != (Memory.FillRAM[0x4200] & 0x30))
S9xUpdateIRQPositions(false);
// NMI can trigger immediately during VBlank as long as NMI_read ($4210) wasn't cleard.
if ((Byte & 0x80) && !(Memory.FillRAM[0x4200] & 0x80) &&

View File

@ -229,7 +229,7 @@ void S9xSA1Init (void)
SA1.op2 = 0;
SA1.sum = 0;
SA1.overflow = FALSE;
SA1.VirtualBitmapFormat = 0;
SA1.VirtualBitmapFormat = 4;
SA1.variable_bit_pos = 0;
SA1Registers.PBPC = 0;
@ -303,6 +303,10 @@ void S9xSA1PostLoadState (void)
SA1.VirtualBitmapFormat = (Memory.FillRAM[0x223f] & 0x80) ? 2 : 4;
Memory.BWRAM = Memory.SRAM + (Memory.FillRAM[0x2224] & 7) * 0x2000;
S9xSA1SetBWRAMMemMap(Memory.FillRAM[0x2225]);
S9xSetSA1(Memory.FillRAM[0x2220], 0x2220);
S9xSetSA1(Memory.FillRAM[0x2221], 0x2221);
S9xSetSA1(Memory.FillRAM[0x2222], 0x2222);
S9xSetSA1(Memory.FillRAM[0x2223], 0x2223);
}
static void S9xSetSA1MemMap (uint32 which1, uint8 map)