Add Boot Dreamcast BIOS option

Reload roms/flash when starting a new game
Better naomi reset (still have issues)
Fix error reporting with Naomi
This commit is contained in:
Flyinghead 2019-03-26 17:20:44 +01:00
parent f5c896121e
commit a3f9764936
5 changed files with 45 additions and 18 deletions

View File

@ -15,7 +15,7 @@ u32 naomi_updates;
//#define NAOMI_COMM //#define NAOMI_COMM
u32 BoardID=0x980055AA; static const u32 BoardID=0x980055AA;
u32 GSerialBuffer=0,BSerialBuffer=0; u32 GSerialBuffer=0,BSerialBuffer=0;
int GBufPos=0,BBufPos=0; int GBufPos=0,BBufPos=0;
int GState=0,BState=0; int GState=0,BState=0;
@ -388,6 +388,7 @@ u32 reg_dimm_48; //parameters
u32 reg_dimm_4c=0x11; //status/control reg ? u32 reg_dimm_4c=0x11; //status/control reg ?
bool NaomiDataRead = false; bool NaomiDataRead = false;
static bool aw_ram_test_skipped = false;
void naomi_process(u32 r3c,u32 r40,u32 r44, u32 r48) void naomi_process(u32 r3c,u32 r40,u32 r44, u32 r48)
{ {
@ -552,6 +553,8 @@ void naomi_reg_Term()
void naomi_reg_Reset(bool Manual) void naomi_reg_Reset(bool Manual)
{ {
NaomiDataRead = false; NaomiDataRead = false;
aw_ram_test_skipped = false;
BLastCmd = 0;
} }
void Update_naomi() void Update_naomi()
@ -632,7 +635,6 @@ void Update_naomi()
static u8 aw_maple_devs; static u8 aw_maple_devs;
extern bool coin_chute; extern bool coin_chute;
static bool once = false;
u32 libExtDevice_ReadMem_A0_006(u32 addr,u32 size) { u32 libExtDevice_ReadMem_A0_006(u32 addr,u32 size) {
addr &= 0x7ff; addr &= 0x7ff;
@ -645,10 +647,10 @@ u32 libExtDevice_ReadMem_A0_006(u32 addr,u32 size) {
// c/d - 3P/4P coin inputs (EX. IO board), active low // c/d - 3P/4P coin inputs (EX. IO board), active low
// //
// (ab == 0) -> BIOS skip RAM test // (ab == 0) -> BIOS skip RAM test
if (!once) if (!aw_ram_test_skipped)
{ {
// Skip RAM test at startup // Skip RAM test at startup
once = true; aw_ram_test_skipped = true;
return 0; return 0;
} }
if (coin_chute) if (coin_chute)

View File

@ -636,11 +636,11 @@ bool naomi_cart_SelectFile()
if (!naomi_cart_LoadRom(SelectedFile)) if (!naomi_cart_LoadRom(SelectedFile))
{ {
printf("Cannot load %s: error %d\n", SelectedFile, errno); printf("Cannot load %s: error %d\n", SelectedFile, errno);
cfgSetVirtual("config", "image", "");
return false; return false;
} }
cfgSaveStr("emu", "gamefile", SelectedFile);
return true; return true;
} }

View File

@ -96,10 +96,6 @@ s32 plugins_Init()
if (s32 rv = libGDR_Init()) if (s32 rv = libGDR_Init())
return rv; return rv;
#endif #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()) if (s32 rv = libAICA_Init())
return rv; return rv;
@ -312,11 +308,25 @@ int dc_start_game(const char *path)
{ {
InitSettings(); InitSettings();
LoadSettings(false); LoadSettings(false);
settings.dreamcast.RTC = GetRTC_now(); // FIXME This shouldn't be in settings anymore
#if DC_PLATFORM == DC_PLATFORM_DREAMCAST #if DC_PLATFORM == DC_PLATFORM_DREAMCAST
if (DiscSwap()) if (!settings.bios.UseReios)
LoadCustom(); #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 #elif DC_PLATFORM == DC_PLATFORM_NAOMI || DC_PLATFORM == DC_PLATFORM_ATOMISWAVE
LoadRomFiles(get_readonly_data_path(DATA_PATH));
if (!naomi_cart_SelectFile()) if (!naomi_cart_SelectFile())
return -6; return -6;
LoadCustom(); LoadCustom();
@ -355,6 +365,11 @@ int dc_start_game(const char *path)
if (plugins_Init()) if (plugins_Init())
return -3; return -3;
#if DC_PLATFORM == DC_PLATFORM_NAOMI || DC_PLATFORM == DC_PLATFORM_ATOMISWAVE
if (!naomi_cart_SelectFile())
return -6;
#endif
LoadCustom(); LoadCustom();
#if FEAT_SHREC != DYNAREC_NONE #if FEAT_SHREC != DYNAREC_NONE

View File

@ -1268,6 +1268,17 @@ static void gui_display_content()
{ {
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(8 * scaling, 20 * scaling)); // from 8, 4 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) for (auto game : game_list)
if (filter.PassFilter(game.name.c_str())) if (filter.PassFilter(game.name.c_str()))
{ {
@ -1470,7 +1481,7 @@ int msgboxf(const wchar* text, unsigned int type, ...) {
va_start(args, type); va_start(args, type);
vsnprintf(temp, sizeof(temp), text, args); vsnprintf(temp, sizeof(temp), text, args);
va_end(args); va_end(args);
printf("%s", temp); printf("%s\n", temp);
gui_display_notification(temp, 2000); gui_display_notification(temp, 2000);

View File

@ -617,7 +617,6 @@ extern u8 q_subchannel[96];
//./core/hw/naomi/naomi.o //./core/hw/naomi/naomi.o
extern u32 naomi_updates; extern u32 naomi_updates;
extern u32 BoardID;
extern u32 GSerialBuffer; extern u32 GSerialBuffer;
extern u32 BSerialBuffer; extern u32 BSerialBuffer;
extern int GBufPos; extern int GBufPos;
@ -1094,7 +1093,7 @@ bool dc_serialize(void **data, unsigned int *total_size)
REICAST_SA(q_subchannel,96); REICAST_SA(q_subchannel,96);
REICAST_S(naomi_updates); REICAST_S(naomi_updates);
REICAST_S(BoardID); REICAST_S(i); //BoardID
REICAST_S(GSerialBuffer); REICAST_S(GSerialBuffer);
REICAST_S(BSerialBuffer); REICAST_S(BSerialBuffer);
REICAST_S(GBufPos); REICAST_S(GBufPos);
@ -1509,7 +1508,7 @@ static bool dc_unserialize_libretro(void **data, unsigned int *total_size)
REICAST_US(naomi_updates); REICAST_US(naomi_updates);
REICAST_US(BoardID); REICAST_US(i); // BoardID
REICAST_US(GSerialBuffer); REICAST_US(GSerialBuffer);
REICAST_US(BSerialBuffer); REICAST_US(BSerialBuffer);
REICAST_US(GBufPos); REICAST_US(GBufPos);
@ -1900,7 +1899,7 @@ bool dc_unserialize(void **data, unsigned int *total_size)
REICAST_US(naomi_updates); REICAST_US(naomi_updates);
REICAST_US(BoardID); REICAST_US(i); // BoardID
REICAST_US(GSerialBuffer); REICAST_US(GSerialBuffer);
REICAST_US(BSerialBuffer); REICAST_US(BSerialBuffer);
REICAST_US(GBufPos); REICAST_US(GBufPos);