reios: allow hle savestates to be loaded in non-hle mode
Always initialize reios hooks during startup so hle savestates always work. Fix bios loading logic for naomi/aw
This commit is contained in:
parent
38c9eea50a
commit
e7a33e6de1
|
@ -207,7 +207,9 @@ bool LoadHle(const string& root)
|
||||||
if (!nvmem_load(root))
|
if (!nvmem_load(root))
|
||||||
WARN_LOG(FLASHROM, "No nvmem loaded\n");
|
WARN_LOG(FLASHROM, "No nvmem loaded\n");
|
||||||
|
|
||||||
return reios_init(sys_rom->data, sys_nvmem);
|
reios_reset(sys_rom->data, sys_nvmem);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 ReadFlash(u32 addr,u32 sz) { return sys_nvmem->Read(addr,sz); }
|
static u32 ReadFlash(u32 addr,u32 sz) { return sys_nvmem->Read(addr,sz); }
|
||||||
|
|
|
@ -123,7 +123,6 @@ void plugins_Term()
|
||||||
|
|
||||||
void plugins_Reset(bool hard)
|
void plugins_Reset(bool hard)
|
||||||
{
|
{
|
||||||
reios_reset();
|
|
||||||
libPvr_Reset(hard);
|
libPvr_Reset(hard);
|
||||||
libGDR_Reset(hard);
|
libGDR_Reset(hard);
|
||||||
libAICA_Reset(hard);
|
libAICA_Reset(hard);
|
||||||
|
@ -482,6 +481,7 @@ static void dc_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
mem_Init();
|
mem_Init();
|
||||||
|
reios_init();
|
||||||
|
|
||||||
init_done = true;
|
init_done = true;
|
||||||
}
|
}
|
||||||
|
@ -520,22 +520,20 @@ void dc_start_game(const char *path)
|
||||||
LoadSettings(false);
|
LoadSettings(false);
|
||||||
|
|
||||||
std::string data_path = get_readonly_data_path(DATA_PATH);
|
std::string data_path = get_readonly_data_path(DATA_PATH);
|
||||||
if ((settings.platform.system == DC_PLATFORM_DREAMCAST && settings.bios.UseReios)
|
|
||||||
|| !LoadRomFiles(data_path))
|
|
||||||
{
|
|
||||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||||
|
{
|
||||||
|
if (settings.bios.UseReios || !LoadRomFiles(data_path))
|
||||||
{
|
{
|
||||||
if (!LoadHle(data_path))
|
if (!LoadHle(data_path))
|
||||||
throw ReicastException("Failed to initialize HLE BIOS");
|
throw ReicastException("Failed to initialize HLE BIOS");
|
||||||
|
|
||||||
NOTICE_LOG(BOOT, "Did not load BIOS, using reios");
|
NOTICE_LOG(BOOT, "Did not load BIOS, using reios");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw ReicastException("Cannot find BIOS files in " + data_path);
|
LoadRomFiles(data_path);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
if (settings.platform.system == DC_PLATFORM_DREAMCAST)
|
||||||
{
|
{
|
||||||
mcfg_CreateDevices();
|
mcfg_CreateDevices();
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#define SYSINFO_ID_ADDR 0x8C001010
|
#define SYSINFO_ID_ADDR 0x8C001010
|
||||||
#define FONT_TABLE_ADDR 0xa0100020
|
#define FONT_TABLE_ADDR 0xa0100020
|
||||||
|
|
||||||
static u8* biosrom;
|
|
||||||
static MemChip *flashrom;
|
static MemChip *flashrom;
|
||||||
static u32 base_fad = 45150;
|
static u32 base_fad = 45150;
|
||||||
static bool descrambl = false;
|
static bool descrambl = false;
|
||||||
|
@ -446,7 +445,7 @@ static void reios_setup_state(u32 boot_addr) {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Setup registers to immitate a normal boot
|
//Setup registers to imitate a normal boot
|
||||||
r[15] = 0x8d000000;
|
r[15] = 0x8d000000;
|
||||||
|
|
||||||
gbr = 0x8c000000;
|
gbr = 0x8c000000;
|
||||||
|
@ -552,7 +551,7 @@ static void reios_setup_naomi(u32 boot_addr) {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Setup registers to immitate a normal boot
|
//Setup registers to imitate a normal boot
|
||||||
r[0] = 0x0c021000;
|
r[0] = 0x0c021000;
|
||||||
r[1] = 0x0c01f820;
|
r[1] = 0x0c01f820;
|
||||||
r[2] = 0xa0710004;
|
r[2] = 0xa0710004;
|
||||||
|
@ -686,20 +685,10 @@ static u32 hook_addr(hook_fp* fn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reios_init(u8* rom, MemChip* flash) {
|
bool reios_init()
|
||||||
|
{
|
||||||
INFO_LOG(REIOS, "reios: Init");
|
INFO_LOG(REIOS, "reios: Init");
|
||||||
|
|
||||||
biosrom = rom;
|
|
||||||
flashrom = flash;
|
|
||||||
|
|
||||||
memset(rom, 0x00, 2048 * 1024);
|
|
||||||
memset(GetMemPtr(0x8C000000, 0), 0, RAM_SIZE);
|
|
||||||
|
|
||||||
u16* rom16 = (u16*)rom;
|
|
||||||
|
|
||||||
rom16[0] = REIOS_OPCODE;
|
|
||||||
|
|
||||||
register_hook(0xA0000000, reios_boot);
|
register_hook(0xA0000000, reios_boot);
|
||||||
|
|
||||||
register_hook(0x8C001000, reios_sys_system);
|
register_hook(0x8C001000, reios_sys_system);
|
||||||
|
@ -710,6 +699,20 @@ bool reios_init(u8* rom, MemChip* flash) {
|
||||||
|
|
||||||
register_hook(dc_bios_entrypoint_gd2, reios_sys_gd2);
|
register_hook(dc_bios_entrypoint_gd2, reios_sys_gd2);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reios_reset(u8* rom, MemChip* flash)
|
||||||
|
{
|
||||||
|
flashrom = flash;
|
||||||
|
|
||||||
|
memset(rom, 0x00, BIOS_SIZE);
|
||||||
|
memset(GetMemPtr(0x8C000000, 0), 0, RAM_SIZE);
|
||||||
|
|
||||||
|
u16* rom16 = (u16*)rom;
|
||||||
|
|
||||||
|
rom16[0] = REIOS_OPCODE;
|
||||||
|
|
||||||
u8 *pFont = rom + (FONT_TABLE_ADDR % BIOS_SIZE);
|
u8 *pFont = rom + (FONT_TABLE_ADDR % BIOS_SIZE);
|
||||||
|
|
||||||
// 288 12 × 24 pixels (36 bytes) characters
|
// 288 12 × 24 pixels (36 bytes) characters
|
||||||
|
@ -734,11 +737,6 @@ bool reios_init(u8* rom, MemChip* flash) {
|
||||||
else
|
else
|
||||||
INFO_LOG(REIOS, "font.bin: loaded %zd bytes", size);
|
INFO_LOG(REIOS, "font.bin: loaded %zd bytes", size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reios_reset() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reios_term() {
|
void reios_term() {
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "hw/flashrom/flashrom.h"
|
#include "hw/flashrom/flashrom.h"
|
||||||
|
|
||||||
bool reios_init(u8* rom, MemChip *flash);
|
bool reios_init();
|
||||||
|
|
||||||
void reios_reset();
|
void reios_reset(u8* rom, MemChip *flash);
|
||||||
|
|
||||||
void reios_term();
|
void reios_term();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue