fix occasional crash in sega d_xbrd.cpp, due to uninitialised custom read/write pointers (happens especially when compiled with -O0). also, monoized the segaPCM channels for Line of Fire, because the machine gun only comes out of the left side.

This commit is contained in:
dinkc64 2015-01-23 21:58:59 +00:00
parent 19dedf5b30
commit 4de7582212
1 changed files with 10 additions and 6 deletions

View File

@ -1,4 +1,5 @@
#include "sys16.h"
#include "segapcm.h"
/*====================================================
Input defs
@ -1698,12 +1699,12 @@ Memory Handlers
====================================================*/
typedef UINT8 (*io_custom_read)(UINT8);
static io_custom_read iochip_custom_read[2][5];
static io_custom_read iochip_custom_read[2][8] = {{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }};
typedef void (*io_custom_write)(UINT8);
static io_custom_write iochip_custom_write[2][5];
static io_custom_write iochip_custom_write[2][8] = {{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }};
static UINT8 iochip_regs[2][8];
static UINT8 iochip_regs[2][8] = {{ 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }};
static UINT8 LastsurvMux = 0;
static INT32 LastsurvPosition[2] = { 0, 0 };
@ -2486,8 +2487,11 @@ static INT32 LoffireInit()
BurnGunInit(2, true);
System16ProcessAnalogControlsDo = LoffireProcessAnalogControls;
return System16Init();
INT32 rc = System16Init();
SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_1, 1.0, BURN_SND_ROUTE_BOTH);
SegaPCMSetRoute(0, BURN_SND_SEGAPCM_ROUTE_2, 1.0, BURN_SND_ROUTE_BOTH);
return rc;
}
static UINT8 RacheroProcessAnalogControls(UINT16 value)
@ -2675,7 +2679,7 @@ static INT32 XBoardExit()
{
memset(iochip_regs, 0, sizeof(iochip_regs));
for (INT32 i = 0; i <= 4; i++) {
for (INT32 i = 0; i < 8; i++) {
iochip_custom_read[0][i] = NULL;
iochip_custom_read[1][i] = NULL;
iochip_custom_write[0][i] = NULL;