Skip to content

Commit

Permalink
fix #408 by moving the game specific flags (CFTBL & PH) from gameSpec…
Browse files Browse the repository at this point in the history
…ific2 to gameSpecific1
  • Loading branch information
toxieainc committed Jan 11, 2025
1 parent 1302113 commit c59bcba
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/wpc/s7.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static void updsol(void) {
if (core_gameData->sxx.muxSol) {
if (coreGlobals.pulsedSolState & (1 << (core_gameData->sxx.muxSol - 1))) {
/* active mux */
UINT32 muxsol = core_gameData->hw.gameSpecific2; // mux affected solenoids
UINT32 muxsol = core_gameData->hw.gameSpecific2; // mux affected solenoids (for Defender only so far)
s7locals.custSol = coreGlobals.pulsedSolState & muxsol;
coreGlobals.pulsedSolState &= ~muxsol;
}
Expand Down
4 changes: 2 additions & 2 deletions src/wpc/s7games.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ S7_ROMEND
CORE_GAMEDEF(splbn,l0,"Spellbinder (L-0 BETA)",1982,"Williams / Jess M. Askey",s7_mS7S,0)

/*----------------------------------
/Time Fantasy - Sys.7 (Game #515)
/ Time Fantasy - Sys.7 (Game #515)
/----------------------------------*/
// MOVED TO tmfnt.c

Expand All @@ -429,7 +429,7 @@ CORE_GAMEDEF(wrlok,l3,"Warlok (L-3)",1982,"Williams",s7_mS7S,0)
// Multiplex solenoid requires custom solenoid handler.
extern int dfndrCustSol(int);
static core_tGameData dfndrGameData = {
GEN_S7, s7_dispS7, {FLIP_SWNO(0,59),0,0,10,0,0,0,0x3FF,dfndrCustSol},
GEN_S7, s7_dispS7, {FLIP_SWNO(0,59),0,0,10,0,0,0,0x3FF,dfndrCustSol}, // gameSpecific2 encodes the muxed solenoid mask
NULL,{{0}},{11,{55,56,57,58,0,0}}
};
static void init_dfndr(void) { core_gameData = &dfndrGameData; }
Expand Down
12 changes: 6 additions & 6 deletions src/wpc/sims/s11/full/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,13 @@ CORE_CLONEDEF(dd,p6, l2, "Dr. Dude (PA-6 Prototype)", 1990, "Bally", s11c_one,0)
/ Simulation Definitions
/-----------------------*/
static sim_tSimData ddSimData = {
2, /* 2 game specific input ports */
dd_stateDef, /* Definition of all states */
dd_inportData, /* Keyboard Entries */
{ stRTrough, stCTrough, stLTrough, stDrain, stDrain, stDrain, stDrain }, /*Position where balls start.. Max 7 Balls Allowed*/
2, /* 2 game specific input ports */
dd_stateDef, /* Definition of all states */
dd_inportData, /* Keyboard Entries */
{ stRTrough, stCTrough, stLTrough, stDrain, stDrain, stDrain, stDrain }, /*Position where balls start.. Max 7 Balls Allowed*/
NULL, /* no init */
dd_handleBallState, /*Function to handle ball state changes*/
dd_drawStatic, /*Function to handle mechanical state changes*/
dd_handleBallState, /*Function to handle ball state changes*/
dd_drawStatic, /*Function to handle mechanical state changes*/
TRUE, /* Simulate manual shooter? */
NULL /* Custom key conditions? */
};
Expand Down
14 changes: 7 additions & 7 deletions src/wpc/sims/wpc/full/cftbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ static int cftbl_handleBallState(sim_tBallStatus *ball, int *inports) {
{

/* Ball in Shooter Lane */
case stBallLane:
case stBallLane:
if (ball->speed < 15)
return setState(stNotEnough,15); /*Ball not plunged hard enough*/
return setState(stNotEnough,15);/*Ball not plunged hard enough*/
if (ball->speed < 22)
return setState(stpaiD,22); /*Ball rolled down 'D' Letter*/
if (ball->speed < 29)
Expand All @@ -266,7 +266,7 @@ static int cftbl_handleBallState(sim_tBallStatus *ball, int *inports) {
if (ball->speed < 43)
return setState(stPaid,43); /*Ball rolled down 'P' Letter*/
if (ball->speed < 51)
return setState(stDownFromLeft,51); /*Ball rolled down from left*/
return setState(stDownFromLeft,51);/*Ball rolled down from left*/
break;

/*-----------------
Expand Down Expand Up @@ -450,10 +450,10 @@ static sim_tSimData cftblSimData = {
2, /* 2 game specific input ports */
cftbl_stateDef, /* Definition of all states */
cftbl_inportData, /* Keyboard Entries */
{ stRTrough, stCTrough, stLTrough, stDrain, stDrain, stDrain, stDrain }, /*Position where balls start.. Max 7 Balls Allowed*/
{ stRTrough, stCTrough, stLTrough, stDrain, stDrain, stDrain, stDrain }, /* Position where balls start.. Max 7 Balls Allowed */
NULL, /* no init */
cftbl_handleBallState,/*Function to handle ball state changes*/
cftbl_drawStatic, /*Function to handle mechanical state changes*/
cftbl_handleBallState,/* Function to handle ball state changes */
cftbl_drawStatic, /* Function to handle mechanical state changes */
TRUE, /* Simulate manual shooter? */
NULL /* Custom key conditions? */
};
Expand All @@ -465,7 +465,7 @@ static core_tGameData cftblGameData = {
GEN_WPCFLIPTRON, wpc_dispDMD,
{
FLIP_SW(FLIP_L | FLIP_U) | FLIP_SOL(FLIP_L),
0,1,0,0,0,0,WPC_CFTBL, // 8 ramp lights 'Chase Light' wired between GI outputs 1/4 and 2 bit decoder wired on solenoid outputs 20/24 => directly handled in main WPC driver
0,1,0,0,0,WPC_CFTBL,0, // 8 ramp lights 'Chase Light' wired between GI outputs 1/4 and 2 bit decoder wired on solenoid outputs 20/24 => directly handled in main WPC driver
NULL, cftbl_handleMech, NULL, cftbl_drawMech,
NULL
#ifdef ENABLE_MECHANICAL_SAMPLES
Expand Down
3 changes: 3 additions & 0 deletions src/wpc/wmssnd.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ static void s67s_init(struct sndbrdData *brdData) {

// Note that the speech board games featured a potentiometer on the separate speech board to mix speech and sound (so it could be tweaked by the operator!).
// For the moment, the mixing sounds okay as-is.

// If ever passing in per-game mixing levels via hw.gameSpecific2 (like done for Sys9/11/WPC), then note that we use that for Defender already, for its muxed solenoids.
}

static WRITE_HANDLER(s67s_ctrl_w) {
Expand Down Expand Up @@ -1173,6 +1175,7 @@ static void wpcs_init(struct sndbrdData *brdData) {
int hcgain = (core_gameData->hw.gameSpecific2 & 0x1ffff);
int ymvol = ((core_gameData->hw.gameSpecific2) >> 18) & 0x7f;
int dacvol = ((core_gameData->hw.gameSpecific2) >> 25) & 0x7f;

locals.brdData = *brdData;
/* the non-paged ROM is at the end of the image. move it to its correct place */
memcpy(memory_region(REGION_CPU1+locals.brdData.cpuNo) + 0x00c000, locals.brdData.romRegion + 0x07c000, 0x4000);
Expand Down
20 changes: 10 additions & 10 deletions src/wpc/wpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static void wpc_zc(int data) {
// More precise implementation with better physic emulation
if (options.usemodsol & (CORE_MODOUT_ENABLE_PHYSOUT_GI | CORE_MODOUT_FORCE_ON))
core_write_pwm_output_8b(CORE_MODOUT_GI0, wpclocals.conductingGITriacs & 0x1F);
if (core_gameData->hw.gameSpecific2 == WPC_CFTBL && (options.usemodsol & (CORE_MODOUT_ENABLE_PHYSOUT_LAMPS | CORE_MODOUT_FORCE_ON))) // CFTBL chase lights
if ((core_gameData->hw.gameSpecific1 & WPC_CFTBL) && (options.usemodsol & (CORE_MODOUT_ENABLE_PHYSOUT_LAMPS | CORE_MODOUT_FORCE_ON))) // CFTBL chase lights
{
int chase_2b = ((coreGlobals.pulsedSolState >> 22) & 2) | ((coreGlobals.pulsedSolState >> 19) & 1); // 2 bit decoder => select one of the 4 chase light strings
int chase_gi = ((wpclocals.conductingGITriacs & 1) ? 0x0F : 0x00) | ((wpclocals.conductingGITriacs & 8) ? 0xF0 : 0x00); // GI outputs
Expand Down Expand Up @@ -602,7 +602,7 @@ READ_HANDLER(wpc_r) {
return ~coreGlobals.swMatrix[CORE_FLIPPERSWCOL];
break;
case WPC_FLIPPERSW95:
if (core_gameData->hw.gameSpecific2 == WPC_PH) { // PH: reel switches
if (core_gameData->hw.gameSpecific1 & WPC_PH) { // PH: reel switches
return ~coreGlobals.swMatrix[3];
}
if (core_gameData->gen & GENWPC_HASWPC95)
Expand Down Expand Up @@ -776,7 +776,7 @@ WRITE_HANDLER(wpc_w) {
}
break;
case WPC_FLIPPERCOIL95: /* WPC_EXTBOARD4 */
if (core_gameData->hw.gameSpecific2 == WPC_PH) { // PH: LED digits
if (core_gameData->hw.gameSpecific1 & WPC_PH) { // PH: LED digits
if (data != 0xff) {
coreGlobals.segments[core_BitColToNum(0xff ^ data)].w = wpclocals.alphaSeg[core_BitColToNum(0xff ^ data)].w = core_bcd2seg7[wpc_data[WPC_EXTBOARD1]];
}
Expand Down Expand Up @@ -810,7 +810,7 @@ WRITE_HANDLER(wpc_w) {
break;
case WPC_LAMPCOLUMN: /* row and column can be written in any order */
core_write_pwm_output_lamp_matrix(CORE_MODOUT_LAMP0, data, wpc_data[WPC_LAMPROW], 8);
if (core_gameData->hw.gameSpecific2 == WPC_PH) { // PH uses 192 lamps
if (core_gameData->hw.gameSpecific1 & WPC_PH) { // PH uses 192 lamps
core_write_pwm_output_lamp_matrix(CORE_MODOUT_LAMP0 + 64, data, wpc_data[WPC_EXTBOARD2], 8);
core_write_pwm_output_lamp_matrix(CORE_MODOUT_LAMP0 + 128, data, wpc_data[WPC_EXTBOARD3], 8);
}
Expand All @@ -831,7 +831,7 @@ WRITE_HANDLER(wpc_w) {
wpclocals.conductingGITriacs |= data; // Triac that were turned on before will continue to conduct until next zero cross, therefore we 'or' them with previous pulsed state
if (options.usemodsol & (CORE_MODOUT_ENABLE_PHYSOUT_GI | CORE_MODOUT_FORCE_ON))
core_write_pwm_output_8b(CORE_MODOUT_GI0, wpclocals.conductingGITriacs & 0x1F);
if (core_gameData->hw.gameSpecific2 == WPC_CFTBL && (options.usemodsol & (CORE_MODOUT_ENABLE_PHYSOUT_LAMPS | CORE_MODOUT_FORCE_ON))) // CFTBL chase lights
if ((core_gameData->hw.gameSpecific1 & WPC_CFTBL) && (options.usemodsol & (CORE_MODOUT_ENABLE_PHYSOUT_LAMPS | CORE_MODOUT_FORCE_ON))) // CFTBL chase lights
{
int chase_2b = ((coreGlobals.pulsedSolState >> 22) & 2) | ((coreGlobals.pulsedSolState >> 19) & 1); // 2 bit decoder => select one of the 4 chase light strings
int chase_gi = ((wpclocals.conductingGITriacs & 1) ? 0x0F : 0x00) | ((wpclocals.conductingGITriacs & 8) ? 0xF0 : 0x00); // GI outputs
Expand Down Expand Up @@ -884,7 +884,7 @@ WRITE_HANDLER(wpc_w) {
}
break; /* just save position */
case WPC_EXTBOARD2: /* WPC_ALPHA1LO */
if (core_gameData->hw.gameSpecific2 == WPC_PH) { // PH: lamps 65 .. 128 (data is row of 2nd matrix)
if (core_gameData->hw.gameSpecific1 & WPC_PH) { // PH: lamps 65 .. 128 (data is row of 2nd matrix)
core_write_pwm_output_lamp_matrix(CORE_MODOUT_LAMP0 + 64, wpc_data[WPC_LAMPCOLUMN], data, 8);
}
else if (wpc_modsol_aux_board == 2)
Expand All @@ -901,7 +901,7 @@ WRITE_HANDLER(wpc_w) {
}
break;
case WPC_EXTBOARD3: /* WPC_ALPHA1HI */
if (core_gameData->hw.gameSpecific2 == WPC_PH) { // PH: lamps 129 .. 192 (data is row of 3rd matrix)
if (core_gameData->hw.gameSpecific1 & WPC_PH) { // PH: lamps 129 .. 192 (data is row of 3rd matrix)
core_write_pwm_output_lamp_matrix(CORE_MODOUT_LAMP0 + 128, wpc_data[WPC_LAMPCOLUMN], data, 8);
}
if ((core_gameData->gen & GENWPC_HASDMD) == 0) // WPC_ALPHA1HI
Expand Down Expand Up @@ -935,7 +935,7 @@ WRITE_HANDLER(wpc_w) {
core_write_pwm_output_8b(CORE_MODOUT_SOL0 + 16, data);
coreGlobals.pulsedSolState = (coreGlobals.pulsedSolState & 0xFF00FFFF) | (data<<16);
data |= wpc_data[offset];
if (core_gameData->hw.gameSpecific2 == WPC_CFTBL) // CFTBL chase lights
if (core_gameData->hw.gameSpecific1 & WPC_CFTBL) // CFTBL chase lights
{
int chase_2b = ((coreGlobals.pulsedSolState >> 22) & 2) | ((coreGlobals.pulsedSolState >> 19) & 1); // 2 bit decoder => select one of the 4 chase light strings
int chase_gi = ((wpclocals.conductingGITriacs & 1) ? 0x0F : 0x00) | ((wpclocals.conductingGITriacs & 8) ? 0xF0 : 0x00); // GI outputs
Expand Down Expand Up @@ -1183,7 +1183,7 @@ static MACHINE_INIT(wpc) {
sndbrd_0_init(SNDBRD_DCS, 1, memory_region(DCS_ROMREGION),NULL,NULL);
break;
case GEN_WPC95:
//WPC95 only controls 3 of the 5 Triacs, the other 2 are ALWAYS ON (power wired directly)
// WPC95 only controls 3 of the 5 Triacs, the other 2 are ALWAYS ON (power wired directly)
// We simulate this here by setting the bits to simulate full intensity immediately at power up.
wpc_data[WPC_GILAMPS] = 0x18;
coreGlobals.gi[CORE_MAXGI-2] = 8;
Expand All @@ -1196,7 +1196,7 @@ static MACHINE_INIT(wpc) {
// Init DMD PWM shading
if (core_gameData->gen & (GEN_WPCDMD | GEN_WPCFLIPTRON | GEN_WPCDCS | GEN_WPCSECURITY | GEN_WPC95DCS | GEN_WPC95))
{
const int isPH = core_gameData->hw.gameSpecific2 == WPC_PH;
const int isPH = (core_gameData->hw.gameSpecific1 & WPC_PH);
core_dmd_pwm_init(&dmdlocals.pwm_state, 128, isPH ? 64 : 32, isPH ? CORE_DMD_PWM_FILTER_WPC_PH : CORE_DMD_PWM_FILTER_WPC, isPH ? CORE_DMD_PWM_COMBINER_SUM_2 : CORE_DMD_PWM_COMBINER_SUM_3);
dmdlocals.pwm_state.revByte = 1;
}
Expand Down
6 changes: 3 additions & 3 deletions src/wpc/wpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ extern MACHINE_DRIVER_EXTERN(wpc_95S);
#define wpc_m95S wpc_95S

// Game specific options
#define WPC_CFTBL 0x01 // CFTBL specific hardware: chase light 2 bit decoder from solenoid #3 output, wired through triacs to 2 GI outputs, leading to 8 additional PWM controlled GI
#define WPC_PH 0x02 // Phantom Haus specific hardware (not really a pinball)

#define WPC_CFTBL 0x01 // CFTBL specific hardware: chase light 2 bit decoder from solenoid #3 output, wired through triacs to 2 GI outputs, leading to 8 additional PWM controlled GI
#define WPC_PH 0x02 // Phantom Haus specific hardware (not really a pinball)
// next: 0x04

int wpc_m2sw(int col, int row);
void wpc_set_modsol_aux_board(int board);
Expand Down
10 changes: 5 additions & 5 deletions src/wpc/wpcgames.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ WPC_INPUT_PORTS_START(wpc, 0) WPC_INPUT_PORTS_END
/--------------*/
static core_tGameData tttGameData = {
GEN_WPC95, wpc_dispDMD,
{ FLIP_SW(FLIP_L | FLIP_U) | FLIP_SOL(FLIP_L), 0,0,0,0,0,1 },
{ FLIP_SW(FLIP_L | FLIP_U) | FLIP_SOL(FLIP_L), 0,0,0,0,0,0,0 },
NULL,
{
"905 123456 12345 123",
Expand Down Expand Up @@ -60,7 +60,7 @@ static void ph_drawMech(BMTYPE **line) {
}
static core_tGameData phGameData = {
GEN_WPC95, wpc_dispDMD64,
{ FLIP_SWNO(0,0), 0,16,0,0,0,0,WPC_PH, NULL, NULL, mech_getPos, ph_drawMech },
{ FLIP_SWNO(0,0), 0,16,0,0,0,WPC_PH,0, NULL, NULL, mech_getPos, ph_drawMech },
NULL,
{
"901 100031 64739 123",
Expand Down Expand Up @@ -155,7 +155,7 @@ CORE_GAMEDEF(tfdmd,l3,"WPC Test Fixture: DMD (L-3)",1991,"Bally",wpc_mDMD,GAME_N
/---------------*/
static core_tGameData tfsGameData = {
GEN_WPCSECURITY, wpc_dispDMD,
{ FLIP_SW(FLIP_L | FLIP_U) | FLIP_SOL(FLIP_L | FLIP_U), 0,0,0,0,0,1 },
{ FLIP_SW(FLIP_L | FLIP_U) | FLIP_SOL(FLIP_L | FLIP_U), 0,0,0,0,0,0,0 },
NULL,
{
"648 123456 12345 123",
Expand All @@ -178,7 +178,7 @@ CORE_GAMEDEF(tfs,12,"WPC Test Fixture: Security (1.2)",1994,"Bally",wpc_mSecurit
/---------------*/
static core_tGameData tf95GameData = {
GEN_WPC95, wpc_dispDMD,
{ FLIP_SW(FLIP_L | FLIP_U) | FLIP_SOL(FLIP_L | FLIP_U), 0,0,0,0,0,1 },
{ FLIP_SW(FLIP_L | FLIP_U) | FLIP_SOL(FLIP_L | FLIP_U), 0,0,0,0,0,0,0 },
NULL,
{
"648 123456 12345 123",
Expand Down Expand Up @@ -223,7 +223,7 @@ CORE_GAMEDEF(tfa,13,"WPC Test Fixture: Alphanumeric (L-3)",1990,"Bally",wpc_mAlp
/-------------------*/
static core_tGameData rushGameData = {
GEN_WPCFLIPTRON, wpc_dispDMD,
{ FLIP_SW(FLIP_L | FLIP_U) | FLIP_SOL(FLIP_L), 0,0,0,0,0,1 },
{ FLIP_SW(FLIP_L | FLIP_U) | FLIP_SOL(FLIP_L), 0,0,0,0,0,0,0 },
NULL,
{
"",
Expand Down

0 comments on commit c59bcba

Please sign in to comment.