Merge pull request #240 from retro-wertz/fix
fixes crash, audio states and comments
This commit is contained in:
@@ -49,10 +49,8 @@ static uint8 vpsg1[8];
|
||||
static uint8 vpsg2[4];
|
||||
static int32 cvbc[3];
|
||||
static int32 vcount[3];
|
||||
static int32 dcount[2];
|
||||
static int32 saw1phaseacc;
|
||||
static int32 dcount[3];
|
||||
static int32 phaseacc;
|
||||
static uint8 b3; /* clock counter, resets phaseacc on the 7th clock */
|
||||
|
||||
static SFORMAT SStateRegs[] =
|
||||
{
|
||||
@@ -64,12 +62,11 @@ static SFORMAT SStateRegs[] =
|
||||
{ &cvbc[2], 4 | FCEUSTATE_RLSB, "BC03" },
|
||||
{ &dcount[0], 4 | FCEUSTATE_RLSB, "DCT0" },
|
||||
{ &dcount[1], 4 | FCEUSTATE_RLSB, "DCT1" },
|
||||
{ &dcount[2], 4 | FCEUSTATE_RLSB, "DCT2" },
|
||||
{ &vcount[0], 4 | FCEUSTATE_RLSB, "VCT0" },
|
||||
{ &vcount[1], 4 | FCEUSTATE_RLSB, "VCT1" },
|
||||
{ &vcount[2], 4 | FCEUSTATE_RLSB, "VCT1" },
|
||||
{ &saw1phaseacc, 4| FCEUSTATE_RLSB, "SAW1" },
|
||||
{ &phaseacc, 4 | FCEUSTATE_RLSB, "PACC" },
|
||||
{ &b3, 1, "CLKC" },
|
||||
{ &vcount[2], 4 | FCEUSTATE_RLSB, "VCT2" },
|
||||
{ &phaseacc, 4 | FCEUSTATE_RLSB, "ACCU" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
@@ -235,20 +232,20 @@ static void DoSawV(void) {
|
||||
freq3 = (vpsg2[1] + ((vpsg2[2] & 15) << 8) + 1);
|
||||
|
||||
for (V = start; V < end; V++) {
|
||||
saw1phaseacc -= nesincsize;
|
||||
if (saw1phaseacc <= 0) {
|
||||
vcount[2] -= nesincsize;
|
||||
if (vcount[2] <= 0) {
|
||||
int32 t;
|
||||
rea:
|
||||
t = freq3;
|
||||
t <<= 18;
|
||||
saw1phaseacc += t;
|
||||
vcount[2] += t;
|
||||
phaseacc += vpsg2[0] & 0x3f;
|
||||
b3++;
|
||||
if (b3 == 7) {
|
||||
b3 = 0;
|
||||
dcount[2]++;
|
||||
if (dcount[2] == 7) {
|
||||
dcount[2] = 0;
|
||||
phaseacc = 0;
|
||||
}
|
||||
if (saw1phaseacc <= 0)
|
||||
if (vcount[2] <= 0)
|
||||
goto rea;
|
||||
duff = (((phaseacc >> 3) & 0x1f) << 4) * 6 / 8;
|
||||
}
|
||||
@@ -304,9 +301,9 @@ static void DoSawVHQ(void) {
|
||||
if (vcount[2] <= 0) {
|
||||
vcount[2] = (vpsg2[1] + ((vpsg2[2] & 15) << 8) + 1) << 1;
|
||||
phaseacc += vpsg2[0] & 0x3f;
|
||||
b3++;
|
||||
if (b3 == 7) {
|
||||
b3 = 0;
|
||||
dcount[2]++;
|
||||
if (dcount[2] == 7) {
|
||||
dcount[2] = 0;
|
||||
phaseacc = 0;
|
||||
}
|
||||
}
|
||||
@@ -315,7 +312,6 @@ static void DoSawVHQ(void) {
|
||||
cvbc[2] = SOUNDTS;
|
||||
}
|
||||
|
||||
|
||||
void VRC6Sound(int Count) {
|
||||
int x;
|
||||
|
||||
@@ -343,6 +339,7 @@ static void VRC6_ESI(void) {
|
||||
GameExpSound.HiFill = VRC6SoundHQ;
|
||||
GameExpSound.HiSync = VRC6SyncHQ;
|
||||
|
||||
phaseacc = 0;
|
||||
memset(cvbc, 0, sizeof(cvbc));
|
||||
memset(vcount, 0, sizeof(vcount));
|
||||
memset(dcount, 0, sizeof(dcount));
|
||||
@@ -368,8 +365,8 @@ void Mapper24_Init(CartInfo *info) {
|
||||
MapIRQHook = VRC6IRQHook;
|
||||
VRC6_ESI();
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&SStateRegs, ~0, 0, 0);
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
AddExState(&SStateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper26_Init(CartInfo *info) {
|
||||
@@ -388,8 +385,8 @@ void Mapper26_Init(CartInfo *info) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
AddExState(&SStateRegs, ~0, 0, 0);
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
AddExState(&SStateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void NSFVRC6_Init(void) {
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#define RETRO_DEVICE_FC_4PLAYERS RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 2)
|
||||
#define RETRO_DEVICE_FC_AUTO RETRO_DEVICE_JOYPAD
|
||||
|
||||
#define NES_WIDTH 256
|
||||
#define NES_HEIGHT 240
|
||||
#define NES_8_7_PAR ((width * (8.0 / 7.0)) / height)
|
||||
#define NES_4_3 ((width / (height * (256.0 / 240.0))) * 4.0 / 3.0)
|
||||
|
||||
@@ -795,16 +797,16 @@ void retro_get_system_info(struct retro_system_info *info)
|
||||
void retro_get_system_av_info(struct retro_system_av_info *info)
|
||||
{
|
||||
#ifdef PSP
|
||||
unsigned width = use_overscan ? 256 : (256 - 16);
|
||||
unsigned height = use_overscan ? 240 : (240 - 16);
|
||||
unsigned width = NES_WIDTH - (use_overscan ? 16 : 0);
|
||||
unsigned height = NES_HEIGHT - (use_overscan ? 16 : 0);
|
||||
#else
|
||||
unsigned width = 256 - (overscan_h ? 16 : 0);
|
||||
unsigned height = 240 - (overscan_v ? 16 : 0);
|
||||
unsigned width = NES_WIDTH - (overscan_h ? 16 : 0);
|
||||
unsigned height = NES_HEIGHT - (overscan_v ? 16 : 0);
|
||||
#endif
|
||||
info->geometry.base_width = width;
|
||||
info->geometry.base_height = height;
|
||||
info->geometry.max_width = width;
|
||||
info->geometry.max_height = height;
|
||||
info->geometry.max_width = NES_WIDTH;
|
||||
info->geometry.max_height = NES_HEIGHT;
|
||||
info->geometry.aspect_ratio = (float)(use_par ? NES_8_7_PAR : NES_4_3);
|
||||
info->timing.sample_rate = (float)sndsamplerate;
|
||||
if (FSettings.PAL || dendy)
|
||||
|
||||
@@ -761,7 +761,7 @@ static void RDoTriangleNoisePCMLQ(void) {
|
||||
else
|
||||
amptab[0] = EnvUnits[2].decvolume;
|
||||
|
||||
/* Modify Square wave volume based on channel volume modifiers
|
||||
/* Modify Triangle wave volume based on channel volume modifiers
|
||||
* Note: the formulat x = x * y /100 does not yield exact results,
|
||||
* but is "close enough" and avoids the need for using double vales
|
||||
* or implicit cohersion which are slower (we need speed here)
|
||||
@@ -872,7 +872,7 @@ static void RDoNoise(void) {
|
||||
else
|
||||
amptab[0] = EnvUnits[2].decvolume;
|
||||
|
||||
/* Modify Square wave volume based on channel volume modifiers
|
||||
/* Modify Noise wave volume based on channel volume modifiers
|
||||
* Note: the formulat x = x * y /100 does not yield exact results,
|
||||
* but is "close enough" and avoids the need for using double vales
|
||||
* or implicit cohersion which are slower (we need speed here)
|
||||
|
||||
Reference in New Issue
Block a user