d_nes: add Chao Ji Zhan Hun: Super Contra 7 (China)

- NES adds SOCD scenes
- Fixed a typo in a SOCD
- Fixed some incorrect SOCD settings
This commit is contained in:
taoenwen 2025-07-04 16:46:04 +08:00
parent 184cac9c05
commit 4c8b72fff7
5 changed files with 39 additions and 9 deletions

View File

@ -119,7 +119,7 @@ struct HoldCoin {
template <int N, typename T> template <int N, typename T>
struct ClearOpposite { struct ClearOpposite {
// T prev[N << 2]; // T prev[N << 2];
T prev[N << 1], prev_a[N << 1], prev_b[N << 1]; T prev[N], prev_a[N], prev_b[N];
void reset() { void reset() {
memset(&prev, 0, sizeof(prev)); memset(&prev, 0, sizeof(prev));
@ -186,7 +186,7 @@ struct ClearOpposite {
} }
const T inp_u = (1 << i), inp_d = (inp_u << 1), inp_l = (inp_u << 2), inp_r = (inp_u << 3); const T inp_u = (1 << i), inp_d = (inp_u << 1), inp_l = (inp_u << 2), inp_r = (inp_u << 3);
const T inp_ud = (inp_u | inp_d), inp_lr = (inp_l & inp_r); const T inp_ud = (inp_u | inp_d), inp_lr = (inp_l | inp_r);
const T inp_e = (inp & (inp_ud | inp_lr)), prev_e = (prev[n] & (inp_ud | inp_lr)); const T inp_e = (inp & (inp_ud | inp_lr)), prev_e = (prev[n] & (inp_ud | inp_lr));
if (((inp_e == (inp_d | inp_l)) && (prev_e == (inp_d | inp_r))) || if (((inp_e == (inp_d | inp_l)) && (prev_e == (inp_d | inp_r))) ||

View File

@ -135,7 +135,7 @@ UINT8 NeoReset = 0, NeoSystem = 0;
UINT8 NeoCDBios = 0; UINT8 NeoCDBios = 0;
UINT8 NeoUniHW = 0; UINT8 NeoUniHW = 0;
UINT8 NeoOverscan = 0; UINT8 NeoOverscan = 0;
static ClearOpposite<2, UINT8> clear_opposite; static ClearOpposite<4, UINT8> clear_opposite;
static UINT8 OldDebugDip[2] = { 0, 0 }; static UINT8 OldDebugDip[2] = { 0, 0 };
@ -4546,8 +4546,8 @@ static void NeoStandardInputs(INT32 nBank)
NeoInput[10] |= (NeoButton3[i] & 1) << i; NeoInput[10] |= (NeoButton3[i] & 1) << i;
NeoInput[11] |= (NeoButton4[i] & 1) << i; NeoInput[11] |= (NeoButton4[i] & 1) << i;
} }
clear_opposite.check(0, NeoInput[ 8], 0x0c, 0x03, nSocd[2]); clear_opposite.check(2, NeoInput[ 8], 0x0c, 0x03, nSocd[2]);
clear_opposite.check(1, NeoInput[ 9], 0x0c, 0x03, nSocd[3]); clear_opposite.check(3, NeoInput[ 9], 0x0c, 0x03, nSocd[3]);
if (NeoDiag[1]) { if (NeoDiag[1]) {
NeoInput[13] |= 0x80; NeoInput[13] |= 0x80;
@ -4563,8 +4563,8 @@ static void NeoStandardInputs(INT32 nBank)
NeoInput[ 2] |= (NeoButton1[i] & 1) << i; NeoInput[ 2] |= (NeoButton1[i] & 1) << i;
NeoInput[ 3] |= (NeoButton2[i] & 1) << i; NeoInput[ 3] |= (NeoButton2[i] & 1) << i;
} }
clear_opposite.check(2, NeoInput[ 0], 0x0c, 0x03, nSocd[0]); clear_opposite.check(0, NeoInput[ 0], 0x0c, 0x03, nSocd[0]);
clear_opposite.check(3, NeoInput[ 1], 0x0c, 0x03, nSocd[1]); clear_opposite.check(1, NeoInput[ 1], 0x0c, 0x03, nSocd[1]);
if (NeoDiag[0]) { if (NeoDiag[0]) {
NeoInput[ 5] |= 0x80; NeoInput[ 5] |= 0x80;
} }

View File

@ -27447,6 +27447,24 @@ struct BurnDriver BurnDrvnes_champlodrun = {
SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT
}; };
// Chao Ji Zhan Hun: Super Contra 7 (China)
static struct BurnRomInfo nes_supercontra7RomDesc[] = {
{ "Chao Ji Zhan Hun - Super Contra 7 (China)(1996)(E.S.C Co.).nes", 262160, 0x69480594, BRF_ESS | BRF_PRG },
};
STD_ROM_PICK(nes_supercontra7)
STD_ROM_FN(nes_supercontra7)
struct BurnDriver BurnDrvnes_supercontra7 = {
"nes_supercontra7", NULL, NULL, NULL, "1996",
" Chao Ji Zhan Hun: Super Contra 7 (China)\0", NULL, "E.S.C Co.", "NES / Famicom",
L"Chao Ji Zhan Hun: Super Contra 7 (China)\0\u8d85\u7d1a\u6230\u9b42: Super Contra 7\0", NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_NES, GBF_PLATFORM | GBF_RUNGUN, 0,
NESGetZipName, nes_supercontra7RomInfo, nes_supercontra7RomName, NULL, NULL, NULL, NULL, NESInputInfo, NESDIPInfo,
NESInit, NESExit, NESFrame, NESDraw, NESScan, &NESRecalc, 0x40,
SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT
};
// Chaos World (Japan) // Chaos World (Japan)
static struct BurnRomInfo nes_chaosworldjRomDesc[] = { static struct BurnRomInfo nes_chaosworldjRomDesc[] = {
{ "Chaos World (Japan)(1991)(Natsume).nes", 393232, 0xe2ae3e63, BRF_ESS | BRF_PRG }, { "Chaos World (Japan)(1991)(Natsume).nes", 393232, 0xe2ae3e63, BRF_ESS | BRF_PRG },

View File

@ -30,6 +30,8 @@ static UINT8 DrvInputs[4] = { 0, 0, 0, 0 };
static UINT32 JoyShifter[2] = { 0, 0 }; static UINT32 JoyShifter[2] = { 0, 0 };
static UINT8 JoyStrobe = 0; static UINT8 JoyStrobe = 0;
static ClearOpposite<4, UINT8> clear_opposite;
// Zapper emulation // Zapper emulation
INT16 ZapperX; INT16 ZapperX;
INT16 ZapperY; INT16 ZapperY;
@ -10982,6 +10984,8 @@ static INT32 DrvDoReset()
cyc_counter = 0; cyc_counter = 0;
mega_cyc_counter = 0; mega_cyc_counter = 0;
clear_opposite.reset();
{ {
INT32 nAspectX, nAspectY; INT32 nAspectX, nAspectY;
BurnDrvGetAspect(&nAspectX, &nAspectY); BurnDrvGetAspect(&nAspectX, &nAspectY);
@ -11378,6 +11382,7 @@ INT32 NESDraw()
return 0; return 0;
} }
#if 0
static void clear_opposites(UINT8 &inpt) static void clear_opposites(UINT8 &inpt)
{ {
// some games will straight-up crash or go berzerk if up+down or left+right // some games will straight-up crash or go berzerk if up+down or left+right
@ -11390,6 +11395,7 @@ static void clear_opposites(UINT8 &inpt)
if ((inpt & ( (1 << 6) | (1 << 7) )) == ((1 << 6) | (1 << 7)) ) if ((inpt & ( (1 << 6) | (1 << 7) )) == ((1 << 6) | (1 << 7)) )
inpt &= ~((1 << 6) | (1 << 7)); // left + right pressed, cancel both inpt &= ~((1 << 6) | (1 << 7)); // left + right pressed, cancel both
} }
#endif
#define DEBUG_CYC 0 #define DEBUG_CYC 0
@ -11425,11 +11431,16 @@ INT32 NESFrame()
DrvInputs[2] ^= (NESJoy3[i] & 1) << i; DrvInputs[2] ^= (NESJoy3[i] & 1) << i;
DrvInputs[3] ^= (NESJoy4[i] & 1) << i; DrvInputs[3] ^= (NESJoy4[i] & 1) << i;
} }
#if 0
clear_opposites(DrvInputs[0]); clear_opposites(DrvInputs[0]);
clear_opposites(DrvInputs[1]); clear_opposites(DrvInputs[1]);
clear_opposites(DrvInputs[2]); clear_opposites(DrvInputs[2]);
clear_opposites(DrvInputs[3]); clear_opposites(DrvInputs[3]);
#endif
clear_opposite.check(0, DrvInputs[0], 0x30, 0xc0, nSocd[0]);
clear_opposite.check(1, DrvInputs[1], 0x30, 0xc0, nSocd[1]);
clear_opposite.check(2, DrvInputs[2], 0x30, 0xc0, nSocd[2]);
clear_opposite.check(3, DrvInputs[3], 0x30, 0xc0, nSocd[3]);
if (NESMode & (USE_ZAPPER | VS_ZAPPER)) { if (NESMode & (USE_ZAPPER | VS_ZAPPER)) {
BurnGunMakeInputs(0, ZapperX, ZapperY); BurnGunMakeInputs(0, ZapperX, ZapperY);
@ -11553,6 +11564,7 @@ INT32 NESScan(INT32 nAction, INT32 *pnMin)
SCAN_VAR(JoyShifter); SCAN_VAR(JoyShifter);
SCAN_VAR(JoyStrobe); SCAN_VAR(JoyStrobe);
SCAN_VAR(ZapperReloadTimer); SCAN_VAR(ZapperReloadTimer);
clear_opposite.scan();
ScanVar(NES_CPU_RAM, 0x800, "CPU Ram"); ScanVar(NES_CPU_RAM, 0x800, "CPU Ram");
ScanVar(Cart.WorkRAM, Cart.WorkRAMSize, "Work Ram"); ScanVar(Cart.WorkRAM, Cart.WorkRAMSize, "Work Ram");

View File

@ -13,7 +13,7 @@ UINT8 PgmBtn2[8] = {0,0,0,0,0,0,0,0};
UINT8 PgmInput[9] = {0,0,0,0,0,0,0,0,0}; UINT8 PgmInput[9] = {0,0,0,0,0,0,0,0,0};
UINT8 PgmReset = 0; UINT8 PgmReset = 0;
static HoldCoin<4> hold_coin; static HoldCoin<4> hold_coin;
static ClearOpposite<2, UINT8> clear_opposite; static ClearOpposite<4, UINT8> clear_opposite;
INT32 nPGM68KROMLen = 0; INT32 nPGM68KROMLen = 0;
INT32 nPGMTileROMLen = 0; INT32 nPGMTileROMLen = 0;