Skip to content

Commit

Permalink
Update to version 0.9.36.1 - http://forum.fobby.net/index.php?t=msg&t…
Browse files Browse the repository at this point in the history
  • Loading branch information
uberushaximus committed Jun 22, 2014
1 parent 53c11ed commit 214f024
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 88 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
-- 0.9.36.1: --

June 22, 2014:
Fixed a bug that could cause an assert() to trigger under certain circumstances when the scale2x/scale3x/scale4x special scaler is used with
SNES emulation.

PSX: Fixed a major SPU emulation regression in 0.9.36 that completely broke sample playback on a channel when the playback rate
was set near the maximum.

PSX: Fixed noise emulation playback frequency calculation(particularly for the lowest noise playback frequencies), per tests on a PS1.
It's unlikely to have any audible effect on games, though.

-- 0.9.36: --

June 17, 2014:
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -4314,7 +4314,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
#
# Avoid trailing and leading zeroes in the decimal version components to avoid confusing not-so-learned people.
#
MEDNAFEN_VERSION='0.9.36'
MEDNAFEN_VERSION='0.9.36.1'
MEDNAFEN_VERSION_NUMERIC=0x000936

ac_aux_dir=
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIR([m4])
#
# Avoid trailing and leading zeroes in the decimal version components to avoid confusing not-so-learned people.
#
MEDNAFEN_VERSION='0.9.36'
MEDNAFEN_VERSION='0.9.36.1'
MEDNAFEN_VERSION_NUMERIC=0x000936

AC_CANONICAL_HOST
Expand Down
18 changes: 14 additions & 4 deletions src/demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,22 @@ static void Draw(EmulateSpecStruct* espec)
int y1 = espec->DisplayRect.y + (espec->DisplayRect.h - middle_size) / 3;
int y2 = espec->DisplayRect.y + (espec->DisplayRect.h - middle_size) / 3 + middle_size;
int y3 = espec->DisplayRect.y + espec->DisplayRect.h;
static const int w2_tab[8] = { 200, 160, 100, 80, 50, 40, 25, 20 };
static const int w2_tab[16] = { 200, 160, 100, 80, 50, 40, 32, 25,
20, 16, 10, 8, 5, 4, 2, 1 };
int w0 = 400;
int w1 = 800;
int w2 = w2_tab[((w2_select >> 8) & 0x7)];
int w2 = w2_tab[((w2_select >> 8) & 0xF)];
int w2_font = MDFN_FONT_9x18_18x18;
char w2_text[16];

if(w2 < 8)
w2_font = MDFN_FONT_4x5;
else if(w2 < 16)
w2_font = MDFN_FONT_5x7;
else if(w2 < 20)
w2_font = MDFN_FONT_6x13_12x13;


trio_snprintf(w2_text, sizeof(w2_text), "%d", w2);

espec->LineWidths[0] = 0;
Expand All @@ -159,7 +169,7 @@ static void Draw(EmulateSpecStruct* espec)
DrawTextTransShadow(espec->surface->pixels + espec->DisplayRect.x + (y1 + (y2 - y1) / 2 - 9) * espec->surface->pitchinpix, espec->surface->pitchinpix << 2, w1, "800", espec->surface->MakeColor(0xFF, 0, 0), espec->surface->MakeColor(0, 0, 0), true, MDFN_FONT_9x18_18x18);

MDFN_DrawFillRect(espec->surface, espec->DisplayRect.x, y2, w2, y3 - y2, espec->surface->MakeColor(0xFF, 0xFF, 0xFF), espec->surface->MakeColor(0x00, 0x00, 0xFF));
DrawTextTransShadow(espec->surface->pixels + espec->DisplayRect.x + (y2 + (y3 - y2) / 2 - 9) * espec->surface->pitchinpix, espec->surface->pitchinpix << 2, w2, w2_text, espec->surface->MakeColor(0xFF, 0, 0), espec->surface->MakeColor(0, 0, 0), true, MDFN_FONT_9x18_18x18);
DrawTextTransShadow(espec->surface->pixels + espec->DisplayRect.x + (y2 + (y3 - y2) / 2 - 9) * espec->surface->pitchinpix, espec->surface->pitchinpix << 2, w2, w2_text, espec->surface->MakeColor(0xFF, 0, 0), espec->surface->MakeColor(0, 0, 0), true, w2_font);
}
}
middle_size += middle_size_inc;
Expand All @@ -168,7 +178,7 @@ static void Draw(EmulateSpecStruct* espec)
if(middle_size <= 0)
middle_size_inc = 1;

w2_select += 7;
w2_select += 9;
}


Expand Down
6 changes: 5 additions & 1 deletion src/drivers/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,13 @@ static void SubBlit(MDFN_Surface *source_surface, const MDFN_Rect &src_rect, con
if(CurrentScaler->id == NTVB_SCALE4X || CurrentScaler->id == NTVB_SCALE3X || CurrentScaler->id == NTVB_SCALE2X)
{
#ifdef WANT_FANCY_SCALERS
//
// scale2x and scale3x apparently can't handle source heights less than 2.
// scale4x, it's less than 4
if(eff_src_rect.h < 2 || (CurrentScaler->id == NTVB_SCALE4X && eff_src_rect.h < 4))
//
// None can handle source widths less than 2.
//
if(eff_src_rect.w < 2 || eff_src_rect.h < 2 || (CurrentScaler->id == NTVB_SCALE4X && eff_src_rect.h < 4))
{
nnx(CurrentScaler->id - NTVB_SCALE2X + 2, eff_source_surface, &eff_src_rect, bah_surface, &boohoo_rect);
}
Expand Down
56 changes: 39 additions & 17 deletions src/psx/spu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ static const int16 FIR_Table[256][4] =
#include "spu_fir_table.inc"
};

static const uint32 NoiseFreqTable[64] =
{
#include "spu_nft.inc"
};

PS_SPU::PS_SPU()
{
last_rate = -1;
Expand All @@ -96,8 +91,6 @@ PS_SPU::PS_SPU()
memset(IntermediateBuffer, 0, sizeof(IntermediateBuffer));

resampler = NULL;

for(int16 a = 32760; a >= 0; a++);
}

PS_SPU::~PS_SPU()
Expand Down Expand Up @@ -154,6 +147,7 @@ void PS_SPU::Power(void)
GlobalSweep[0].Power();
GlobalSweep[1].Power();

NoiseDivider = 0;
NoiseCounter = 0;
LFSR = 0;

Expand Down Expand Up @@ -363,8 +357,6 @@ void PS_SPU::RunDecoder(SPU_Voice *voice)

//for(int z = 0; z < 4; z++)
{
const uint16 CV = SPURAM[voice->CurAddr];

if(SPUControl & 0x40)
{
unsigned test_addr = voice->CurAddr & 0x3FFFF;
Expand All @@ -378,6 +370,8 @@ void PS_SPU::RunDecoder(SPU_Voice *voice)

if((voice->CurAddr & 0x7) == 0)
{
const uint16 CV = SPURAM[voice->CurAddr];

voice->DecodeShift = CV & 0xF;
voice->DecodeWeight = (CV >> 4) & 0xF;
voice->DecodeFlags = (CV >> 8) & 0xFF;
Expand All @@ -396,9 +390,15 @@ void PS_SPU::RunDecoder(SPU_Voice *voice)
}
}
}
voice->CurAddr = (voice->CurAddr + 1) & 0x3FFFF;
}
else

//
// Don't else this block; we need to ALWAYS decode 4 samples per call to RunDecoder() if DecodeAvail < 11, or else sample playback
// at higher rates will fail horribly.
//
{
const uint16 CV = SPURAM[voice->CurAddr];
const unsigned shift = voice->DecodeShift;
const int32 weight_m1 = Weights[voice->DecodeWeight][0];
const int32 weight_m2 = Weights[voice->DecodeWeight][1];
Expand All @@ -421,8 +421,8 @@ void PS_SPU::RunDecoder(SPU_Voice *voice)
}
voice->DecodeWritePos = (voice->DecodeWritePos + 4) & 0x1F;
voice->DecodeAvail += 4;
voice->CurAddr = (voice->CurAddr + 1) & 0x3FFFF;
}
voice->CurAddr = (voice->CurAddr + 1) & 0x3FFFF;
}
}

Expand Down Expand Up @@ -560,6 +560,32 @@ INLINE uint16 PS_SPU::ReadSPURAM(uint32 addr)

#include "spu_reverb.inc"

INLINE void PS_SPU::RunNoise(void)
{
const unsigned rf = ((SPUControl >> 8) & 0x3F);
uint32 NoiseDividerInc = (2 << (rf >> 2));
uint32 NoiseCounterInc = 4 + (rf & 0x3);

if(rf >= 0x3C)
{
NoiseDividerInc = 0x8000;
NoiseCounterInc = 8;
}

NoiseDivider += NoiseDividerInc;
if(NoiseDivider & 0x8000)
{
NoiseDivider = 0;

NoiseCounter += NoiseCounterInc;
if(NoiseCounter & 0x8)
{
NoiseCounter &= 0x7;
LFSR = (LFSR << 1) | (((LFSR >> 15) ^ (LFSR >> 12) ^ (LFSR >> 11) ^ (LFSR >> 10) ^ 1) & 1);
}
}
}

int32 PS_SPU::UpdateFromCDC(int32 clocks)
//pscpu_timestamp_t PS_SPU::Update(const pscpu_timestamp_t timestamp)
{
Expand Down Expand Up @@ -800,12 +826,7 @@ int32 PS_SPU::UpdateFromCDC(int32 clocks)

CWA = (CWA + 1) & 0x1FF;

NoiseCounter += NoiseFreqTable[(SPUControl >> 8) & 0x3F];
if(NoiseCounter >= 0x8000)
{
NoiseCounter -= 0x8000;
LFSR = (LFSR << 1) | (((LFSR >> 15) ^ (LFSR >> 12) ^ (LFSR >> 11) ^ (LFSR >> 10) ^ 1) & 1);
}
RunNoise();

clamp(&accum_l, -32768, 32767);
clamp(&accum_r, -32768, 32767);
Expand Down Expand Up @@ -1271,6 +1292,7 @@ int PS_SPU::StateAction(StateMem *sm, int load, int data_only)
SFVOICE(23),
#undef SFVOICE

SFVAR(NoiseDivider),
SFVAR(NoiseCounter),
SFVAR(LFSR),

Expand Down
2 changes: 2 additions & 0 deletions src/psx/spu.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ class PS_SPU


void RunReverb(int32 in_l, int32 in_r, int32 &out_l, int32 &out_r);
void RunNoise(void);
bool GetCDAudio(int32 &l, int32 &r);

SPU_Voice Voices[24];

uint32 NoiseDivider;
uint32 NoiseCounter;
uint16 LFSR;

Expand Down
64 changes: 0 additions & 64 deletions src/psx/spu_nft.inc

This file was deleted.

0 comments on commit 214f024

Please sign in to comment.