Attempt to fix builds

This commit is contained in:
Akeraiotitasoft 2023-06-07 16:34:13 -07:00
parent 26b2438365
commit 732fdc6bbf
3 changed files with 466 additions and 380 deletions

View File

@ -57,15 +57,15 @@ static void StateRestore(int version) {
Sync(); Sync();
} }
void Mapper474_Init(CartInfo* info) { //void Mapper474_Init(CartInfo* info) {
if (info->submapper == 1) // if (info->submapper == 1)
{ // {
info->Power = M474Power_submapper1; // info->Power = M474Power_submapper1;
} // }
else // else
{ // {
// submapper 0 // // submapper 0
info->Power = M474Power; // info->Power = M474Power;
} // }
GameStateRestore = StateRestore; // GameStateRestore = StateRestore;
} //}

View File

@ -44,7 +44,8 @@ static void LatchPower(void) {
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} else { }
else {
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
} }
SetWriteHandler(addrreg0, addrreg1, LatchWrite); SetWriteHandler(addrreg0, addrreg1, LatchWrite);
@ -299,7 +300,8 @@ static void M78Sync() {
setchr8(latche >> 4); setchr8(latche >> 4);
if (submapper == 3) { if (submapper == 3) {
setmirror((latche >> 3) & 1); setmirror((latche >> 3) & 1);
} else { }
else {
setmirror(MI_0 + ((latche >> 3) & 1)); setmirror(MI_0 + ((latche >> 3) & 1));
} }
} }
@ -575,3 +577,82 @@ static void BMC11160Sync(void) {
void BMC11160_Init(CartInfo* info) { void BMC11160_Init(CartInfo* info) {
Latch_Init(info, BMC11160Sync, 0, 0x8000, 0xFFFF, 0, 0); Latch_Init(info, BMC11160Sync, 0, 0x8000, 0xFFFF, 0, 0);
} }
//------------------ Akerasoft NROM3XX /Mapper 474 ---------------------------
// Simple Akerasoft NROM3XX
static readfunc defapuread[0x1000];
static uint8 subMapper = 0;
static DECLFR(M474ReadCart) {
if (subMapper == 0)
{
if (A < 0x4020)
{
return defapuread[A - 0x4000](A);
}
else
{
return Page[A >> 11][A];
}
}
else
{
if (A < 0x4800)
{
return defapuread[A - 0x4000](A);
}
else
{
return Page[A >> 11][A];
}
}
}
static void M474Sync(void) {
setchr8(0);
setprg16(0x4000, 0);
setprg16(0x8000, 1);
setprg16(0xC000, 2);
}
static void M474Power(void) {
// 16 bytes: Header.PRG ROM size must be 3. Trainer and battery are forbidden; NES 2.0 PRG RAM size must be 0.
// 2048 bytes: Ignored.
// 47104 bytes : PRG ROM mapped to $4800 - $FFFF.
// 49119 bytes : PRG ROM mapped to $4020 - $FFFF.
// 8192¡Án bytes : CHR ROM mapped to PPU $0000 - $1FFF
// My English is very poor!
// In theory, it should not exceed 48K,I hope Fceux can improve the support for nes 2.0
if (PRGsize[0] >= 64 * 1024)
{
SetupCartCHRMapping(0x00, &PRGptr[0][0xC000], 0x2000, 0);
// this is hack..... fceux seems to have an error reading PRG settings
// not modify fceux other code,
// fceux load prg is 64k, have 8k chr in 0xC000
// fceux load chr is 8k,but 0xFF or 0x00
}
if (subMapper == 1)
{
SetReadHandler(0x4800, 0xFFFF, M474ReadCart);
}
else
{
SetReadHandler(0x4020, 0xFFFF, M474ReadCart);
}
M474Sync();
}
void Mapper474_Init(CartInfo* info) {
info->Power = M474Power;
subMapper = info->submapper;
for (int i = 0; i < 0x1000; i++) {
defapuread[i] = GetReadHandler(0x4000 | i);
}
}

View File

@ -288,7 +288,8 @@ static void SetInputNes20(uint8 expansion) {
GameInfo->input[0] = moo[x].input1; GameInfo->input[0] = moo[x].input1;
GameInfo->input[1] = moo[x].input2; GameInfo->input[1] = moo[x].input2;
GameInfo->inputfc = moo[x].inputfc; GameInfo->inputfc = moo[x].inputfc;
break; } break;
}
x++; x++;
} }
} }
@ -435,7 +436,8 @@ static void CheckHInfo(uint64 partialmd5) {
tofix |= 2; tofix |= 2;
Mirroring = 0; Mirroring = 0;
} }
} else if (Mirroring != moo[x].mirror) { }
else if (Mirroring != moo[x].mirror) {
if (Mirroring != (moo[x].mirror & ~4)) if (Mirroring != (moo[x].mirror & ~4))
if ((moo[x].mirror & ~4) <= 2) /* Don't complain if one-screen mirroring if ((moo[x].mirror & ~4) <= 2) /* Don't complain if one-screen mirroring
needs to be set(the iNES header can't needs to be set(the iNES header can't
@ -795,8 +797,7 @@ BMAPPINGLocal bmap[] = {
{"Impact Soft MMC3 Flash Board", 406, Mapper406_Init }, {"Impact Soft MMC3 Flash Board", 406, Mapper406_Init },
{"INX_007T_V01", 470, INX_007T_Init }, {"INX_007T_V01", 470, INX_007T_Init },
{"Akerasoft NROM3XX", 474, Mapper474_Init }, {"Akerasoft NROM3XX", 474, Mapper474_Init }, //simple implementation
{"KONAMI QTAi Board", 547, QTAi_Init }, {"KONAMI QTAi Board", 547, QTAi_Init },
{"", 0, NULL} {"", 0, NULL}
@ -832,7 +833,8 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
if (head.ROM_type & 8) { if (head.ROM_type & 8) {
Mirroring = 2; Mirroring = 2;
} else }
else
Mirroring = (head.ROM_type & 1); Mirroring = (head.ROM_type & 1);
MirroringAs2bits = head.ROM_type & 1; MirroringAs2bits = head.ROM_type & 1;
@ -1022,7 +1024,8 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
if (Mirroring == 2) { if (Mirroring == 2) {
ExtraNTARAM = (uint8*)FCEU_gmalloc(2048); ExtraNTARAM = (uint8*)FCEU_gmalloc(2048);
SetupCartMirroring(4, 1, ExtraNTARAM); SetupCartMirroring(4, 1, ExtraNTARAM);
} else if (Mirroring >= 0x10) }
else if (Mirroring >= 0x10)
SetupCartMirroring(2 + (Mirroring & 1), 1, 0); SetupCartMirroring(2 + (Mirroring & 1), 1, 0);
else else
SetupCartMirroring(Mirroring & 1, (Mirroring & 4) >> 2, 0); SetupCartMirroring(Mirroring & 1, (Mirroring & 4) >> 2, 0);
@ -1065,7 +1068,8 @@ init_ok:
// Extract Filename only. Should account for Windows/Unix this way. // Extract Filename only. Should account for Windows/Unix this way.
if (strrchr(name, '/')) { if (strrchr(name, '/')) {
name = strrchr(name, '/') + 1; name = strrchr(name, '/') + 1;
} else if (strrchr(name, '\\')) { }
else if (strrchr(name, '\\')) {
name = strrchr(name, '\\') + 1; name = strrchr(name, '\\') + 1;
} }
@ -1078,7 +1082,8 @@ init_ok:
// TODO: MD5 check against a list of all known PAL games instead? // TODO: MD5 check against a list of all known PAL games instead?
if (iNES2) { if (iNES2) {
FCEUI_SetVidSystem(((head.TV_system & 3) == 1) ? 1 : 0); FCEUI_SetVidSystem(((head.TV_system & 3) == 1) ? 1 : 0);
} else if (OverwriteVidMode) { }
else if (OverwriteVidMode) {
if (strstr(name, "(E)") || strstr(name, "(e)") if (strstr(name, "(E)") || strstr(name, "(e)")
|| strstr(name, "(Europe)") || strstr(name, "(PAL)") || strstr(name, "(Europe)") || strstr(name, "(PAL)")
|| strstr(name, "(F)") || strstr(name, "(f)") || strstr(name, "(F)") || strstr(name, "(f)")