Skip to content

Commit

Permalink
[DMG] Finalize MM01 support. Added CLI parameters for MMM01 as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
shonumi committed Dec 16, 2016
1 parent 31d5d84 commit f7e1663
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
16 changes: 14 additions & 2 deletions src/common/config.cpp
Expand Up @@ -527,7 +527,18 @@ bool parse_cli_args()
else if((config::cli_args[x] == "-f") || (config::cli_args[x] == "--fullscreen")) { config::flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; }

//Use multicart mode if applicable for a given ROM
else if(config::cli_args[x] == "--multicart") { config::use_multicart = true; }
else if(config::cli_args[x] == "--multicart")
{
config::use_multicart = true;
config::use_mmm01 = false;
}

//Use MMM01 mode if applicable for a given ROM
else if(config::cli_args[x] == "--mmm01")
{
config::use_multicart = false;
config::use_mmm01 = true;
}

//Use OpenGL for screen drawing
else if(config::cli_args[x] == "--opengl") { config::use_opengl = true; }
Expand Down Expand Up @@ -573,7 +584,8 @@ bool parse_cli_args()
std::cout<<"GBE+ Command Line Options:\n";
std::cout<<"-b [FILE], --bios [FILE] \t\t Load and use BIOS file\n";
std::cout<<"-d, --debug \t\t\t\t Start the command-line debugger\n";
std::cout<<"--multicart \t\t\t\t Use multicart mode if applicable\n";
std::cout<<"--multicart \t\t\t\t Use MBC1M multicart mode if applicable\n";
std::cout<<"--mmm01 \t\t\t\t Use MMM01 multicart mode if applicable\n";
std::cout<<"--opengl \t\t\t\t Use OpenGL for screen drawing and scaling\n";
std::cout<<"--cheats \t\t\t\t Use Gameshark or Game Genie cheats\n";
std::cout<<"--patch \t\t\t\t Use a patch file for the ROM\n";
Expand Down
4 changes: 2 additions & 2 deletions src/dmg/mmm01.cpp
Expand Up @@ -38,7 +38,7 @@ void DMG_MMU::mmm01_write(u16 address, u8 value)
if(bank_mode == 0)
{
rom_bank &= 0xFF;
rom_bank |= (value << 8);
rom_bank |= ((value & 0x1F) << 8);
}

//For convenience (save state compatibility) lower 8-bits is ROM bank
Expand Down Expand Up @@ -74,7 +74,7 @@ u8 DMG_MMU::mmm01_read(u16 address)
}

//Read using ROM Banking - Bank 1
if((address >= 0x4000) && (address <= 0x7FFF))
else if((address >= 0x4000) && (address <= 0x7FFF))
{
//Read normally if ROM mode has not been set
if(bank_mode == 0) { return memory_map[address]; }
Expand Down
5 changes: 2 additions & 3 deletions src/dmg/mmu.cpp
Expand Up @@ -57,7 +57,7 @@ void DMG_MMU::reset()
cart.mbc_type = ROM_ONLY;
cart.battery = false;
cart.ram = false;
cart.multicart = config::use_multicart;
cart.multicart = config::use_multicart | config::use_mmm01;
cart.rumble = false;

cart.rtc = false;
Expand Down Expand Up @@ -1615,7 +1615,7 @@ bool DMG_MMU::read_file(std::string filename)
if(cart.mbc_type != ROM_ONLY)
{
//Use a file positioner
u32 file_pos = (config::use_mmm01) ? 0x0 : 0x8000;
u32 file_pos = 0x8000;
u8 bank_count = 0;

while(file_pos < (cart.rom_size * 1024))
Expand Down Expand Up @@ -2245,4 +2245,3 @@ void DMG_MMU::set_apu_data(dmg_apu_data* ex_apu_stat) { apu_stat = ex_apu_stat;

/****** Points the MMU to an sio_data structure (FROM SIO ITSELF) ******/
void DMG_MMU::set_sio_data(dmg_sio_data* ex_sio_stat) { sio_stat = ex_sio_stat; }

0 comments on commit f7e1663

Please sign in to comment.