static MDFN_COLD void Load(MDFNFILE *fp) { try { uint8 hes_header[4]; const bool IsHES = false; IsSGX = false; fp->read(hes_header, 4); fp->seek(0, SEEK_SET); /*if(!memcmp(hes_header, "HESM", 4)) IsHES = true;*/ LoadCommonPre(); for(int x = 0; x < 0x100; x++) { HuCPU.PCERead[x] = PCEBusRead; HuCPU.PCEWrite[x] = PCENullWrite; } if(IsHES) HES_Load(fp); else { uint32 crc; crc = HuC_Load(fp); if(fp->ext == "sgx") IsSGX = true; else { for(auto const& e : sgx_table) { if(e.crc == crc) { IsSGX = true; MDFN_printf(_("SuperGrafx: %s\n"), e.name); break; } } } } LoadCommon(); } catch(...) { Cleanup(); throw; } }
static int LoadCD(std::vector<CDIF *> *CDInterfaces) { std::string bios_path = MDFN_MakeFName(MDFNMKF_FIRMWARE, 0, MDFN_GetSettingS("pce_fast.cdbios").c_str() ); //IsHES = 0; IsSGX = 0; LoadCommonPre(); if(!HuCLoadCD(bios_path.c_str())) return(0); SCSICD_SetDisc(true, NULL, true); SCSICD_SetDisc(false, (*CDInterfaces)[0], true); return(LoadCommon()); }
static MDFN_COLD void LoadCD(std::vector<CDIF *> *CDInterfaces) { try { std::string bios_path = MDFN_MakeFName(MDFNMKF_FIRMWARE, 0, MDFN_GetSettingS("pce_fast.cdbios")); //IsHES = 0; IsSGX = 0; LoadCommonPre(); HuC_LoadCD(bios_path.c_str()); cdifs = CDInterfaces; PCECD_Drive_SetDisc(true, NULL, true); LoadCommon(); } catch(...) { Cleanup(); throw; } }
static int Load(const char *name, MDFNFILE *fp) { uint32 headerlen = 0; uint32 r_size; //IsHES = 0; IsSGX = 0; /*if(!memcmp(fp->data, "HESM", 4)) IsHES = 1;*/ LoadCommonPre(); if(!IsHES) { if(fp->size & 0x200) // 512 byte header! headerlen = 512; } r_size = fp->size - headerlen; if(r_size > 4096 * 1024) r_size = 4096 * 1024; for(int x = 0; x < 0x100; x++) { PCERead[x] = PCEBusRead; PCEWrite[x] = PCENullWrite; } uint32 crc = crc32(0, fp->data + headerlen, fp->size - headerlen); if(IsHES) { if(!PCE_HESLoad(fp->data, fp->size)) return(0); } else HuCLoad(fp->data + headerlen, fp->size - headerlen, crc); if(!strcasecmp(fp->ext, "sgx")) IsSGX = TRUE; if(fp->size >= 8192 && !memcmp(fp->data + headerlen, "DARIUS Version 1.11b", strlen("DARIUS VERSION 1.11b"))) { MDFN_printf("SuperGfx: Darius Plus\n"); IsSGX = 1; } if(crc == 0x4c2126b0) { MDFN_printf("SuperGfx: Aldynes\n"); IsSGX = 1; } if(crc == 0x8c4588e2) { MDFN_printf("SuperGfx: 1941 - Counter Attack\n"); IsSGX = 1; } if(crc == 0x1f041166) { MDFN_printf("SuperGfx: Madouou Granzort\n"); IsSGX = 1; } if(crc == 0xb486a8ed) { MDFN_printf("SuperGfx: Daimakaimura\n"); IsSGX = 1; } if(crc == 0x3b13af61) { MDFN_printf("SuperGfx: Battle Ace\n"); IsSGX = 1; } return(LoadCommon()); }