Skip to content

Commit

Permalink
Add Boot Dreamcast BIOS option
Browse files Browse the repository at this point in the history
Reload roms/flash when starting a new game
Better naomi reset (still have issues)
Fix error reporting with Naomi
  • Loading branch information
flyinghead committed Mar 26, 2019
1 parent f5c8961 commit a3f9764
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 18 deletions.
10 changes: 6 additions & 4 deletions core/hw/naomi/naomi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ u32 naomi_updates;

//#define NAOMI_COMM

u32 BoardID=0x980055AA;
static const u32 BoardID=0x980055AA;
u32 GSerialBuffer=0,BSerialBuffer=0;
int GBufPos=0,BBufPos=0;
int GState=0,BState=0;
Expand Down Expand Up @@ -388,6 +388,7 @@ u32 reg_dimm_48; //parameters
u32 reg_dimm_4c=0x11; //status/control reg ?

bool NaomiDataRead = false;
static bool aw_ram_test_skipped = false;

void naomi_process(u32 r3c,u32 r40,u32 r44, u32 r48)
{
Expand Down Expand Up @@ -552,6 +553,8 @@ void naomi_reg_Term()
void naomi_reg_Reset(bool Manual)
{
NaomiDataRead = false;
aw_ram_test_skipped = false;
BLastCmd = 0;
}

void Update_naomi()
Expand Down Expand Up @@ -632,7 +635,6 @@ void Update_naomi()

static u8 aw_maple_devs;
extern bool coin_chute;
static bool once = false;

u32 libExtDevice_ReadMem_A0_006(u32 addr,u32 size) {
addr &= 0x7ff;
Expand All @@ -645,10 +647,10 @@ u32 libExtDevice_ReadMem_A0_006(u32 addr,u32 size) {
// c/d - 3P/4P coin inputs (EX. IO board), active low
//
// (ab == 0) -> BIOS skip RAM test
if (!once)
if (!aw_ram_test_skipped)
{
// Skip RAM test at startup
once = true;
aw_ram_test_skipped = true;
return 0;
}
if (coin_chute)
Expand Down
4 changes: 2 additions & 2 deletions core/hw/naomi/naomi_cart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,11 @@ bool naomi_cart_SelectFile()
if (!naomi_cart_LoadRom(SelectedFile))
{
printf("Cannot load %s: error %d\n", SelectedFile, errno);
cfgSetVirtual("config", "image", "");

return false;
}

cfgSaveStr("emu", "gamefile", SelectedFile);

return true;
}

Expand Down
29 changes: 22 additions & 7 deletions core/nullDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ s32 plugins_Init()
if (s32 rv = libGDR_Init())
return rv;
#endif
#if DC_PLATFORM == DC_PLATFORM_NAOMI || DC_PLATFORM == DC_PLATFORM_ATOMISWAVE
if (!naomi_cart_SelectFile())
return rv_serror;
#endif

if (s32 rv = libAICA_Init())
return rv;
Expand Down Expand Up @@ -312,11 +308,25 @@ int dc_start_game(const char *path)
{
InitSettings();
LoadSettings(false);
settings.dreamcast.RTC = GetRTC_now(); // FIXME This shouldn't be in settings anymore
#if DC_PLATFORM == DC_PLATFORM_DREAMCAST
if (DiscSwap())
LoadCustom();
if (!settings.bios.UseReios)
#endif
LoadRomFiles(get_readonly_data_path(DATA_PATH));
#if DC_PLATFORM == DC_PLATFORM_DREAMCAST
if (path == NULL)
{
// Boot BIOS
settings.imgread.LastImage[0] = 0;
TermDrive();
InitDrive();
}
else
{
if (DiscSwap())
LoadCustom();
}
#elif DC_PLATFORM == DC_PLATFORM_NAOMI || DC_PLATFORM == DC_PLATFORM_ATOMISWAVE
LoadRomFiles(get_readonly_data_path(DATA_PATH));
if (!naomi_cart_SelectFile())
return -6;
LoadCustom();
Expand Down Expand Up @@ -355,6 +365,11 @@ int dc_start_game(const char *path)
if (plugins_Init())
return -3;

#if DC_PLATFORM == DC_PLATFORM_NAOMI || DC_PLATFORM == DC_PLATFORM_ATOMISWAVE
if (!naomi_cart_SelectFile())
return -6;
#endif

LoadCustom();

#if FEAT_SHREC != DYNAREC_NONE
Expand Down
13 changes: 12 additions & 1 deletion core/rend/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,17 @@ static void gui_display_content()
{
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(8 * scaling, 20 * scaling)); // from 8, 4

#if DC_PLATFORM == DC_PLATFORM_DREAMCAST
ImGui::PushID("bios");
if (ImGui::Selectable("Dreamcast BIOS"))
{
gui_state = ClosedNoResume;
cfgSetVirtual("config", "image", "");
gui_start_game("");
}
ImGui::PopID();
#endif

for (auto game : game_list)
if (filter.PassFilter(game.name.c_str()))
{
Expand Down Expand Up @@ -1470,7 +1481,7 @@ int msgboxf(const wchar* text, unsigned int type, ...) {
va_start(args, type);
vsnprintf(temp, sizeof(temp), text, args);
va_end(args);
printf("%s", temp);
printf("%s\n", temp);

gui_display_notification(temp, 2000);

Expand Down
7 changes: 3 additions & 4 deletions core/serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,6 @@ extern u8 q_subchannel[96];

//./core/hw/naomi/naomi.o
extern u32 naomi_updates;
extern u32 BoardID;
extern u32 GSerialBuffer;
extern u32 BSerialBuffer;
extern int GBufPos;
Expand Down Expand Up @@ -1094,7 +1093,7 @@ bool dc_serialize(void **data, unsigned int *total_size)
REICAST_SA(q_subchannel,96);

REICAST_S(naomi_updates);
REICAST_S(BoardID);
REICAST_S(i); //BoardID
REICAST_S(GSerialBuffer);
REICAST_S(BSerialBuffer);
REICAST_S(GBufPos);
Expand Down Expand Up @@ -1509,7 +1508,7 @@ static bool dc_unserialize_libretro(void **data, unsigned int *total_size)


REICAST_US(naomi_updates);
REICAST_US(BoardID);
REICAST_US(i); // BoardID
REICAST_US(GSerialBuffer);
REICAST_US(BSerialBuffer);
REICAST_US(GBufPos);
Expand Down Expand Up @@ -1900,7 +1899,7 @@ bool dc_unserialize(void **data, unsigned int *total_size)


REICAST_US(naomi_updates);
REICAST_US(BoardID);
REICAST_US(i); // BoardID
REICAST_US(GSerialBuffer);
REICAST_US(BSerialBuffer);
REICAST_US(GBufPos);
Expand Down

0 comments on commit a3f9764

Please sign in to comment.