Skip to content

Commit

Permalink
Merge pull request libretro#6 from 0ldsk00l/master
Browse files Browse the repository at this point in the history
Added support for MMC3 Big CHR-RAM Board
  • Loading branch information
hizzlekizzle authored Nov 28, 2019
2 parents 7f48c21 + 3623e01 commit 3aab0a3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/core/NstCartridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ namespace Nes

if (profile.board.type.empty() || !b.DetectBoard( profile.board.type.c_str(), profile.board.GetWram() ))
{
if (profile.board.mapper == Profile::Board::NO_MAPPER || (!b.DetectBoard( profile.board.mapper, profile.board.GetWram(), profileEx.wramAuto, profile.board.subMapper ) && board))
if (profile.board.mapper == Profile::Board::NO_MAPPER || (!b.DetectBoard( profile.board.mapper, profile.board.subMapper, profile.board.chrRam, profile.board.GetWram(), profileEx.wramAuto ) && board))
return RESULT_ERR_UNSUPPORTED_MAPPER;

if (profile.board.type.empty())
Expand Down
1 change: 1 addition & 0 deletions source/core/NstCartridgeInes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ namespace Nes
{
if (setup.chrRam)
{
profile.board.chrRam = setup.chrRam / SIZE_1K;
log << title
<< (setup.chrRam % SIZE_1K ? setup.chrRam : setup.chrRam / SIZE_1K)
<< (setup.chrRam % SIZE_1K ? " bytes" : "k")
Expand Down
5 changes: 5 additions & 0 deletions source/core/api/NstApiCartridge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,11 @@ namespace Nes
* Submapper ID.
*/
uint subMapper;

/**
* CHR RAM Size.
*/
uint chrRam;
};

/**
Expand Down
10 changes: 9 additions & 1 deletion source/core/board/NstBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ namespace Nes
return true;
}

bool Board::Context::DetectBoard(const byte mapper,const dword wram,bool wramAuto,const byte submapper)
bool Board::Context::DetectBoard(const byte mapper,const byte submapper,const dword chrRam,const dword wram,bool wramAuto)
{
Type::Id id;

Expand Down Expand Up @@ -1446,6 +1446,13 @@ namespace Nes
break;
}

if (chrRam == 32)
{
name = "UNL-MMC3BIGCHRRAM";
id = Type::UNL_MMC3BIGCHRRAM;
break;
}

if (nmt == Type::NMT_FOURSCREEN)
{
if (prg == SIZE_64K && (chr == SIZE_32K || chr == SIZE_64K) && !wram && !useWramAuto)
Expand Down Expand Up @@ -3403,6 +3410,7 @@ namespace Nes
case Type::STD_TR1ROM :
case Type::STD_TSROM :
case Type::STD_TVROM :
case Type::UNL_MMC3BIGCHRRAM :
case Type::UNL_TRXROM : return new TxRom (c);
case Type::STD_TLSROM : return new TlsRom (c);
case Type::STD_TKSROM : return new TksRom (c);
Expand Down
3 changes: 2 additions & 1 deletion source/core/board/NstBoard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ namespace Nes
UNL_UXROM_M5 = MakeId< 180, 4096, 8, 8, 0, CRM_0, NMT_X, 0 >::ID,
UNL_TRXROM = MakeId< 4, 512, 256, 8, 0, CRM_0, NMT_4, 0 >::ID,
UNL_XZY = MakeId< 176, 1024, 256, 8, 0, CRM_0, NMT_X, 0 >::ID,
UNL_MMC3BIGCHRRAM = MakeId< 4, 512, 0, 0, 0, CRM_32, NMT_X, 0 >::ID,
// Waixing
WAIXING_PS2_0 = MakeId< 15, 1024, 0, 0, 0, CRM_8, NMT_V, 0 >::ID,
WAIXING_PS2_1 = MakeId< 15, 1024, 0, 8, 0, CRM_8, NMT_V, 0 >::ID,
Expand Down Expand Up @@ -652,7 +653,7 @@ namespace Nes
Context(Cpu*,Apu*,Ppu*,Ram&,Ram&,const Ram&,Type::Nmt,bool,bool,Chips&);

bool DetectBoard(wcstring,dword);
bool DetectBoard(byte,dword,bool,byte);
bool DetectBoard(byte,byte,dword,dword,bool);

cstring name;
Type type;
Expand Down

0 comments on commit 3aab0a3

Please # to comment.