Пример #1
0
static void reios_boot(void)
{
	printf("-----------------\n");
	printf("REIOS: Booting up\n");
	printf("-----------------\n");
	//setup syscalls
	//find boot file
	//boot it

	memset(GetMemPtr(0x8C000000, 0), 0xFF, 64 * 1024);

	setup_syscall(hook_addr(&reios_sys_system), dc_bios_syscall_system);
	setup_syscall(hook_addr(&reios_sys_font), dc_bios_syscall_font);
	setup_syscall(hook_addr(&reios_sys_flashrom), dc_bios_syscall_flashrom);
	setup_syscall(hook_addr(&reios_sys_gd), dc_bios_syscall_gd);
	setup_syscall(hook_addr(&reios_sys_misc), dc_bios_syscall_misc);

	WriteMem32(dc_bios_entrypoint_gd_do_bioscall, REIOS_OPCODE);
	//Infinitive loop for arm !
	WriteMem32(0x80800000, 0xEAFFFFFE);

	if (settings.reios.ElfFile.size())
   {
		if (!reios_loadElf(settings.reios.ElfFile))
			msgboxf("Failed to open %s\n", MBX_ICONERROR, settings.reios.ElfFile.c_str());
		reios_setup_state(0x8C010000);
	}
	else
   {
		if (DC_PLATFORM == DC_PLATFORM_DREAMCAST)
      {
         if (!bootfile_inited)
            msgboxf("Failed to locate bootfile", MBX_ICONERROR);
         reios_setup_state(0xac008300);
      }
		else
      {
         verify(DC_PLATFORM == DC_PLATFORM_NAOMI);

         u32* sz = (u32*)naomi_cart_GetPtr(0x368, 4);
         if (!sz) {
            msgboxf("Naomi boot failure", MBX_ICONERROR);
         }

         int size = *sz;

         verify(size < RAM_SIZE && naomi_cart_GetPtr(size - 1, 1) && "Invalid cart size");

         WriteMemBlock_nommu_ptr(0x0c020000, (u32*)naomi_cart_GetPtr(0, size), size);

         reios_setuo_naomi(0x0c021000);
      }
	}
}
Пример #2
0
bool naomi_cart_Read(u32 offset, u32 size, void* dst) {
	if (!RomPtr)
		return false;

	memcpy(dst, naomi_cart_GetPtr(offset, size), size);
	return true;
}