Cleaner init. Get rid of LastImage
This commit is contained in:
parent
329230bf8d
commit
d5e24d8aed
|
@ -216,4 +216,5 @@ void libAICA_Reset(bool manual)
|
|||
void libAICA_Term()
|
||||
{
|
||||
sgc_Term();
|
||||
term_mem();
|
||||
}
|
||||
|
|
|
@ -54,9 +54,6 @@ static inline void DYNACALL WriteMemArm(u32 addr,T data)
|
|||
u32 sh4_ReadMem_reg(u32 addr,u32 size);
|
||||
void sh4_WriteMem_reg(u32 addr,u32 data,u32 size);
|
||||
|
||||
void init_mem();
|
||||
void term_mem();
|
||||
|
||||
#define aica_reg_16 ((u16*)aica_reg)
|
||||
|
||||
#define AICA_RAM_SIZE (ARAM_SIZE)
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
//called when plugin is used by emu (you should do first time init here)
|
||||
s32 libARM_Init()
|
||||
{
|
||||
init_mem();
|
||||
arm_Init();
|
||||
|
||||
return rv_ok;
|
||||
|
@ -18,7 +17,6 @@ s32 libARM_Init()
|
|||
//called when plugin is unloaded by emu, only if dcInit is called (eg, not called to enumerate plugins)
|
||||
void libARM_Term()
|
||||
{
|
||||
term_mem();
|
||||
//arm7_Term ?
|
||||
}
|
||||
|
||||
|
|
|
@ -2189,6 +2189,14 @@ struct maple_naomi_jamma : maple_sega_controller
|
|||
|
||||
break;
|
||||
|
||||
case MDCF_GetCondition:
|
||||
w8(MDRE_UnknownCmd);
|
||||
w8(0x00);
|
||||
w8(0x00);
|
||||
w8(0x00);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
INFO_LOG(MAPLE, "Unknown Maple command %x", cmd);
|
||||
w8(MDRE_UnknownCmd);
|
||||
|
|
|
@ -192,8 +192,7 @@ bool InitDrive(u32 fileflags)
|
|||
|
||||
// FIXME: Data loss if buffer is too small
|
||||
wchar fn[512];
|
||||
strncpy(fn,settings.imgread.LastImage, sizeof(fn));
|
||||
fn[sizeof(fn) - 1] = '\0';
|
||||
fn[0] = '\0';
|
||||
|
||||
#ifdef BUILD_DREAMCAST
|
||||
int gfrv=GetFile(fn,0,fileflags);
|
||||
|
@ -214,20 +213,14 @@ bool InitDrive(u32 fileflags)
|
|||
return false;
|
||||
}
|
||||
|
||||
// FIXME: Data loss if buffer is too small
|
||||
strncpy(settings.imgread.LastImage, fn, sizeof(settings.imgread.LastImage));
|
||||
settings.imgread.LastImage[sizeof(settings.imgread.LastImage) - 1] = '\0';
|
||||
|
||||
SaveSettings();
|
||||
|
||||
if (!InitDrive_(fn))
|
||||
{
|
||||
//msgboxf("Selected image failed to load",MBX_ICONERROR);
|
||||
NullDriveDiscType=NoDisk;
|
||||
gd_setdisc();
|
||||
sns_asc=0x29;
|
||||
sns_ascq=0x00;
|
||||
sns_key=0x6;
|
||||
NullDriveDiscType = NoDisk;
|
||||
gd_setdisc();
|
||||
sns_asc = 0x29;
|
||||
sns_ascq = 0x00;
|
||||
sns_key = 0x6;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -256,8 +249,7 @@ bool DiscSwap(u32 fileflags)
|
|||
|
||||
// FIXME: Data loss if buffer is too small
|
||||
wchar fn[512];
|
||||
strncpy(fn, settings.imgread.LastImage, sizeof(fn));
|
||||
fn[sizeof(fn) - 1] = '\0';
|
||||
fn[0] = '\0';
|
||||
|
||||
|
||||
#ifdef BUILD_DREAMCAST
|
||||
|
@ -267,7 +259,7 @@ bool DiscSwap(u32 fileflags)
|
|||
#endif
|
||||
if (gfrv == 0)
|
||||
{
|
||||
NullDriveDiscType=Open;
|
||||
NullDriveDiscType = Open;
|
||||
gd_setdisc();
|
||||
return true;
|
||||
}
|
||||
|
@ -276,17 +268,10 @@ bool DiscSwap(u32 fileflags)
|
|||
return false;
|
||||
}
|
||||
|
||||
// FIXME: Data loss if buffer is too small
|
||||
strncpy(settings.imgread.LastImage, fn, sizeof(settings.imgread.LastImage));
|
||||
settings.imgread.LastImage[sizeof(settings.imgread.LastImage) - 1] = '\0';
|
||||
|
||||
|
||||
SaveSettings();
|
||||
|
||||
if (!InitDrive_(fn))
|
||||
{
|
||||
//msgboxf("Selected image failed to load",MBX_ICONERROR);
|
||||
NullDriveDiscType=Open;
|
||||
NullDriveDiscType = Open;
|
||||
gd_setdisc();
|
||||
}
|
||||
|
||||
|
@ -296,10 +281,10 @@ bool DiscSwap(u32 fileflags)
|
|||
|
||||
void TermDrive()
|
||||
{
|
||||
if (disc!=0)
|
||||
if (disc != NULL)
|
||||
delete disc;
|
||||
|
||||
disc=0;
|
||||
disc = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
137
core/nullDC.cpp
137
core/nullDC.cpp
|
@ -311,7 +311,6 @@ void dc_reset(bool manual)
|
|||
sh4_cpu.Reset(manual);
|
||||
}
|
||||
|
||||
static bool init_done;
|
||||
static bool reset_requested;
|
||||
|
||||
int reicast_init(int argc, char* argv[])
|
||||
|
@ -359,81 +358,14 @@ int reicast_init(int argc, char* argv[])
|
|||
#define DATA_PATH "/"
|
||||
#endif
|
||||
|
||||
bool game_started;
|
||||
|
||||
int dc_start_game(const char *path)
|
||||
static int dc_init()
|
||||
{
|
||||
if (path != NULL)
|
||||
cfgSetVirtual("config", "image", path);
|
||||
static bool init_done;
|
||||
|
||||
if (init_done)
|
||||
{
|
||||
InitSettings();
|
||||
dc_reset(true);
|
||||
LoadSettings(false);
|
||||
#if DC_PLATFORM == DC_PLATFORM_DREAMCAST
|
||||
if (!settings.bios.UseReios)
|
||||
#endif
|
||||
if (!LoadRomFiles(get_readonly_data_path(DATA_PATH)))
|
||||
return -5;
|
||||
|
||||
#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
|
||||
if (!naomi_cart_SelectFile())
|
||||
return -6;
|
||||
LoadCustom();
|
||||
#if DC_PLATFORM == DC_PLATFORM_NAOMI
|
||||
mcfg_CreateNAOMIJamma();
|
||||
#elif DC_PLATFORM == DC_PLATFORM_ATOMISWAVE
|
||||
mcfg_CreateAtomisWaveControllers();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
game_started = true;
|
||||
dc_resume();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (settings.bios.UseReios || !LoadRomFiles(get_readonly_data_path(DATA_PATH)))
|
||||
{
|
||||
#ifdef USE_REIOS
|
||||
if (!LoadHle(get_readonly_data_path(DATA_PATH)))
|
||||
{
|
||||
return -5;
|
||||
}
|
||||
else
|
||||
{
|
||||
NOTICE_LOG(BOOT, "Did not load bios, using reios\n");
|
||||
}
|
||||
#else
|
||||
ERROR_LOG(BOOT, "Cannot find BIOS files\n");
|
||||
return -5;
|
||||
#endif
|
||||
}
|
||||
|
||||
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
|
||||
Get_Sh4Recompiler(&sh4_cpu);
|
||||
sh4_cpu.Init(); // Also initialize the interpreter
|
||||
|
@ -450,17 +382,74 @@ int dc_start_game(const char *path)
|
|||
}
|
||||
|
||||
mem_Init();
|
||||
mem_map_default(); // TODO needs to be called again if changing platform
|
||||
|
||||
mem_map_default();
|
||||
init_done = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool game_started;
|
||||
|
||||
int dc_start_game(const char *path)
|
||||
{
|
||||
if (path != NULL)
|
||||
cfgSetVirtual("config", "image", path);
|
||||
|
||||
int rc = dc_init();
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
|
||||
InitSettings();
|
||||
dc_reset(true);
|
||||
LoadSettings(false);
|
||||
if (!LoadRomFiles(get_readonly_data_path(DATA_PATH)))
|
||||
{
|
||||
#if DC_PLATFORM == DC_PLATFORM_DREAMCAST
|
||||
#ifdef USE_REIOS
|
||||
if (settings.bios.UseReios)
|
||||
{
|
||||
if (!LoadHle(get_readonly_data_path(DATA_PATH)))
|
||||
{
|
||||
ERROR_LOG(BOOT, "Cannot init HLE BIOS");
|
||||
return -5;
|
||||
}
|
||||
else
|
||||
{
|
||||
NOTICE_LOG(BOOT, "Did not load bios, using reios");
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ERROR_LOG(BOOT, "Cannot find BIOS files");
|
||||
return -5;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DC_PLATFORM == DC_PLATFORM_DREAMCAST
|
||||
if (path == NULL)
|
||||
{
|
||||
// Boot BIOS
|
||||
TermDrive();
|
||||
InitDrive();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DiscSwap())
|
||||
LoadCustom();
|
||||
}
|
||||
#elif DC_PLATFORM == DC_PLATFORM_NAOMI || DC_PLATFORM == DC_PLATFORM_ATOMISWAVE
|
||||
if (!naomi_cart_SelectFile())
|
||||
return -6;
|
||||
LoadCustom();
|
||||
#if DC_PLATFORM == DC_PLATFORM_NAOMI
|
||||
mcfg_CreateNAOMIJamma();
|
||||
#elif DC_PLATFORM == DC_PLATFORM_ATOMISWAVE
|
||||
mcfg_CreateAtomisWaveControllers();
|
||||
#endif
|
||||
init_done = true;
|
||||
|
||||
dc_reset(true);
|
||||
#endif
|
||||
|
||||
game_started = true;
|
||||
dc_resume();
|
||||
|
|
|
@ -707,7 +707,6 @@ struct settings_t
|
|||
bool PatchRegion;
|
||||
bool LoadDefaultImage;
|
||||
char DefaultImage[512];
|
||||
char LastImage[512];
|
||||
} imgread;
|
||||
|
||||
struct
|
||||
|
|
Loading…
Reference in New Issue