Reios: perform initial configuration, as needed

This commit is contained in:
Ender's Games 2018-08-20 12:28:16 -04:00
parent 4424d84960
commit 78977387ac
6 changed files with 57 additions and 83 deletions

View File

@ -146,7 +146,7 @@ bool QueueRender(TA_context* ctx)
bool too_fast = (cycle_span / time_span) > (SH4_MAIN_CLOCK * 1.2);
if (rqueue && too_fast && settings.pvr.SynchronousRendering) {
if (rqueue && too_fast && settings.pvr.SynchronousRender) {
//wait for a frame if
// we have another one queue'd and
// sh4 run at > 120% on the last slice

View File

@ -37,7 +37,7 @@ void dispmanx_window_create()
src_rect.width = window_width << 16;
src_rect.height = window_height << 16;
if(settings.dispmanx.Maintain_Aspect)
if(settings.dispmanx.Keep_Aspect)
{
float screen_aspect = (float)screen_width / screen_height;
float window_aspect = (float)window_width / window_height;

View File

@ -186,8 +186,8 @@ int dc_init(int argc,wchar* argv[])
Get_Sh4Interpreter(&sh4_cpu);
printf("Using Interpreter\n");
}
InitAudio();
InitAudio();
sh4_cpu.Init();
mem_Init();
@ -207,6 +207,8 @@ int dc_init(int argc,wchar* argv[])
sh4_cpu.Reset(false);
LoadCustom();
return rv;
}
@ -242,38 +244,6 @@ void dc_stop()
sh4_cpu.Stop();
}
char *configFile;
void LoadCustom()
{
configFile = reios_disk_id();
settings.dynarec.Enable = cfgLoadInt(configFile,"Dynarec.Enabled", settings.dynarec.Enable ? 1 : 0) != 0;
settings.dynarec.idleskip = cfgLoadInt(configFile,"Dynarec.idleskip", settings.dynarec.idleskip ? 1 : 0) != 0;
settings.dynarec.unstable_opt = cfgLoadInt(configFile,"Dynarec.unstable-opt", settings.dynarec.unstable_opt);
settings.dynarec.safemode = cfgLoadInt(configFile,"Dynarec.safemode", settings.dynarec.safemode);
//disable_nvmem can't be loaded, because nvmem init is before cfg load
settings.dreamcast.cable = cfgLoadInt(configFile,"Dreamcast.Cable", settings.dreamcast.cable);
settings.dreamcast.region = cfgLoadInt(configFile,"Dreamcast.Region", settings.dreamcast.region);
settings.dreamcast.broadcast = cfgLoadInt(configFile,"Dreamcast.Broadcast", settings.dreamcast.broadcast);
settings.aica.LimitFPS = cfgLoadInt(configFile,"aica.LimitFPS", settings.aica.LimitFPS);
settings.aica.NoBatch = cfgLoadInt(configFile,"aica.NoBatch", settings.aica.NoBatch);
settings.aica.NoSound = cfgLoadInt(configFile,"aica.NoSound", settings.aica.NoSound);
settings.rend.UseMipmaps = cfgLoadInt(configFile,"rend.UseMipmaps", settings.rend.UseMipmaps);
settings.rend.WideScreen = cfgLoadInt(configFile,"rend.WideScreen", settings.rend.WideScreen);
settings.rend.ModifierVolumes = cfgLoadInt(configFile,"rend.ModifierVolumes", settings.rend.ModifierVolumes);
settings.rend.Clipping = cfgLoadInt(configFile,"rend.Clipping", settings.rend.Clipping);
settings.pvr.subdivide_transp = cfgLoadInt(configFile,"pvr.Subdivide", settings.pvr.subdivide_transp);
settings.pvr.ta_skip = cfgLoadInt(configFile,"ta.skip", settings.pvr.ta_skip);
settings.pvr.rend = cfgLoadInt(configFile,"pvr.rend", settings.pvr.rend);
settings.pvr.MaxThreads = cfgLoadInt(configFile, "pvr.MaxThreads", settings.pvr.MaxThreads);
settings.pvr.SynchronousRendering = cfgLoadInt(configFile, "pvr.SynchronousRendering", settings.pvr.SynchronousRendering);
}
void LoadSettings()
{
#ifndef _ANDROID
@ -300,23 +270,23 @@ void LoadSettings()
settings.pvr.rend = cfgLoadInt("config","pvr.rend",0);
settings.pvr.MaxThreads = cfgLoadInt("config", "pvr.MaxThreads", 3);
settings.pvr.SynchronousRendering = cfgLoadInt("config", "pvr.SynchronousRendering", 0);
settings.pvr.SynchronousRender = cfgLoadInt("config", "pvr.SynchronousRendering", 0);
settings.debug.SerialConsole = cfgLoadInt("config", "Debug.SerialConsoleEnabled", 0) != 0;
settings.debug.SerialConsole = cfgLoadInt("config", "Debug.SerialConsoleEnabled", 0) != 0;
settings.bios.UseReios = cfgLoadInt("config", "bios.UseReios", 0);
settings.reios.ElfFile = cfgLoadStr("reios", "ElfFile", "");
settings.bios.UseReios = cfgLoadInt("config", "bios.UseReios", 0);
settings.reios.ElfFile = cfgLoadStr("reios", "ElfFile", "");
settings.validate.OpenGlChecks = cfgLoadInt("validate", "OpenGlChecks", 0) != 0;
settings.validate.OpenGlChecks = cfgLoadInt("validate", "OpenGlChecks", 0) != 0;
#endif
settings.pvr.HashLogFile = cfgLoadStr("testing", "ta.HashLogFile", "");
settings.pvr.HashCheckFile = cfgLoadStr("testing", "ta.HashCheckFile", "");
settings.pvr.HashLogFile = cfgLoadStr("testing", "ta.HashLogFile", "");
settings.pvr.HashCheckFile = cfgLoadStr("testing", "ta.HashCheckFile", "");
#if SUPPORT_DISPMANX
settings.dispmanx.Width = cfgLoadInt("dispmanx","width",640);
settings.dispmanx.Height = cfgLoadInt("dispmanx","height",480);
settings.dispmanx.Maintain_Aspect = cfgLoadBool("dispmanx","maintain_aspect",true);
settings.dispmanx.Width = cfgLoadInt("dispmanx","width",640);
settings.dispmanx.Height = cfgLoadInt("dispmanx","height",480);
settings.dispmanx.Keep_Aspect = cfgLoadBool("dispmanx","maintain_aspect",true);
#endif
#if (HOST_OS != OS_LINUX || defined(_ANDROID) || defined(TARGET_PANDORA))
@ -336,26 +306,32 @@ void LoadSettings()
settings.dreamcast.region = min(max(settings.dreamcast.region, 0),3);
settings.dreamcast.broadcast= min(max(settings.dreamcast.broadcast,0),4);
*/
LoadCustom();
}
void SaveCustom()
void LoadCustom()
{
cfgSaveInt(configFile,"Dynarec.Enabled", settings.dynarec.Enable);
cfgSaveInt(configFile,"Dreamcast.Cable", settings.dreamcast.cable);
cfgSaveInt(configFile,"Dreamcast.RTC", settings.dreamcast.RTC);
cfgSaveInt(configFile,"Dreamcast.Region", settings.dreamcast.region);
cfgSaveInt(configFile,"Dreamcast.Broadcast",settings.dreamcast.broadcast);
char *reios_id = reios_disk_id();
settings.dynarec.idleskip = cfgLoadInt(reios_id,"Dynarec.idleskip", settings.dynarec.idleskip ? 1 : 0) != 0;
settings.dynarec.unstable_opt = cfgLoadInt(reios_id,"Dynarec.unstable-opt", settings.dynarec.unstable_opt);
settings.dynarec.safemode = cfgLoadInt(reios_id,"Dynarec.safemode", settings.dynarec.safemode);
settings.rend.ModifierVolumes = cfgLoadInt(reios_id,"rend.ModifierVolumes", settings.rend.ModifierVolumes);
settings.rend.Clipping = cfgLoadInt(reios_id,"rend.Clipping", settings.rend.Clipping);
settings.pvr.subdivide_transp = cfgLoadInt(reios_id,"pvr.Subdivide", settings.pvr.subdivide_transp);
settings.pvr.ta_skip = cfgLoadInt(reios_id,"ta.skip", settings.pvr.ta_skip);
settings.pvr.rend = cfgLoadInt(reios_id,"pvr.rend", settings.pvr.rend);
settings.pvr.MaxThreads = cfgLoadInt(reios_id, "pvr.MaxThreads", settings.pvr.MaxThreads);
settings.pvr.SynchronousRender = cfgLoadInt(reios_id, "pvr.SynchronousRendering", settings.pvr.SynchronousRender);
}
void SaveSettings()
{
cfgSaveInt("config","Dynarec.Enabled", settings.dynarec.Enable);
cfgSaveInt("config","Dreamcast.Cable", settings.dreamcast.cable);
cfgSaveInt("config","Dreamcast.RTC", settings.dreamcast.RTC);
cfgSaveInt("config","Dreamcast.Region", settings.dreamcast.region);
cfgSaveInt("config","Dreamcast.Broadcast",settings.dreamcast.broadcast);
SaveCustom();
}
cfgSaveInt("config","Dynarec.Enabled", settings.dynarec.Enable);
cfgSaveInt("config","Dreamcast.Cable", settings.dreamcast.cable);
cfgSaveInt("config","Dreamcast.RTC", settings.dreamcast.RTC);
cfgSaveInt("config","Dreamcast.Region", settings.dreamcast.region);
cfgSaveInt("config","Dreamcast.Broadcast", settings.dreamcast.broadcast);
}

View File

@ -87,7 +87,7 @@ bool reios_locate_bootfile(const char* bootfile="1ST_READ.BIN") {
fwrite(GetMemPtr(0x8c010000, 0), 1, len, f);
fclose(f);
}
delete[] temp;
return true;
}
@ -103,7 +103,7 @@ char reios_maker_id[17];
char reios_device_info[17];
char reios_area_symbols[9];
char reios_peripherals[9];
char reios_product_number[11];
char reios_product_number[9];
char reios_product_version[7];
char reios_releasedate[17];
char reios_boot_filename[17];
@ -111,20 +111,27 @@ char reios_software_company[17];
char reios_software_name[129];
char reios_bootfile[32];
char* reios_disk_id() {
bool pre_init = false;
void reios_pre_init()
{
if (libGDR_GetDiscType() == GdRom) {
base_fad = 45150;
descrambl = false;
}
else {
} else {
u8 ses[6];
libGDR_GetSessionInfo(ses, 0);
libGDR_GetSessionInfo(ses, ses[2]);
base_fad = (ses[3] << 16) | (ses[4] << 8) | (ses[5] << 0);
descrambl = true;
}
pre_init = true;
}
char* reios_disk_id() {
if (!pre_init) reios_pre_init();
libGDR_ReadSector(GetMemPtr(0x8c008000, 0), base_fad, 256, 2048);
memset(ip_bin, 0, sizeof(ip_bin));
memcpy(ip_bin, GetMemPtr(0x8c008000, 0), 256);
@ -133,7 +140,7 @@ char* reios_disk_id() {
memcpy(&reios_device_info[0], &ip_bin[32], 16 * sizeof(char));
memcpy(&reios_area_symbols[0], &ip_bin[48], 8 * sizeof(char));
memcpy(&reios_peripherals[0], &ip_bin[56], 8 * sizeof(char));
memcpy(&reios_product_number[0], &ip_bin[64], 10 * sizeof(char));
memcpy(&reios_product_number[0], &ip_bin[64], 8 * sizeof(char));
memcpy(&reios_product_version[0], &ip_bin[74], 6 * sizeof(char));
memcpy(&reios_releasedate[0], &ip_bin[80], 16 * sizeof(char));
memcpy(&reios_boot_filename[0], &ip_bin[96], 16 * sizeof(char));
@ -145,17 +152,7 @@ char* reios_disk_id() {
const char* reios_locate_ip() {
if (libGDR_GetDiscType() == GdRom) {
base_fad = 45150;
descrambl = false;
}
else {
u8 ses[6];
libGDR_GetSessionInfo(ses, 0);
libGDR_GetSessionInfo(ses, ses[2]);
base_fad = (ses[3] << 16) | (ses[4] << 8) | (ses[5] << 0);
descrambl = true;
}
if (!pre_init) reios_pre_init();
printf("reios: loading ip.bin from FAD: %d\n", base_fad);

View File

@ -668,7 +668,7 @@ struct settings_t
{
u32 Width;
u32 Height;
bool Maintain_Aspect;
bool Keep_Aspect;
} dispmanx;
#endif
@ -715,7 +715,7 @@ struct settings_t
u32 rend;
u32 MaxThreads;
u32 SynchronousRendering;
u32 SynchronousRender;
string HashLogFile;
string HashCheckFile;
@ -733,6 +733,7 @@ struct settings_t
extern settings_t settings;
void LoadSettings();
void LoadCustom();
void SaveSettings();
u32 GetRTC_now();
extern u32 patchRB;

View File

@ -140,7 +140,7 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_pvrrender(JNIEnv *env
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_syncedrender(JNIEnv *env,jobject obj, jint sync)
{
settings.pvr.SynchronousRendering = sync;
settings.pvr.SynchronousRender = sync;
}
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_modvols(JNIEnv *env,jobject obj, jint volumes)