naomi: search parent rom path for gdrom
This commit is contained in:
parent
4dd05ca23f
commit
305ab38ac8
|
@ -495,9 +495,16 @@ void GDCartridge::device_start()
|
|||
u8 buffer[2048];
|
||||
std::string gdrom_path = get_game_basename() + "/" + gdrom_name;
|
||||
Disc *gdrom = OpenDisc((gdrom_path + ".chd").c_str());
|
||||
if (gdrom == NULL)
|
||||
if (gdrom == nullptr)
|
||||
gdrom = OpenDisc((gdrom_path + ".gdi").c_str());
|
||||
if (gdrom == NULL)
|
||||
if (gdrom_parent_name != nullptr && gdrom == nullptr)
|
||||
{
|
||||
std::string gdrom_parent_path = get_game_basename() + "/" + gdrom_parent_name;
|
||||
gdrom = OpenDisc((gdrom_parent_path + ".chd").c_str());
|
||||
if (gdrom == nullptr)
|
||||
gdrom = OpenDisc((gdrom_parent_path + ".gdi").c_str());
|
||||
}
|
||||
if (gdrom == nullptr)
|
||||
throw NaomiCartException("Naomi GDROM: Cannot open " + gdrom_path + ".chd or " + gdrom_path + ".gdi");
|
||||
|
||||
// primary volume descriptor
|
||||
|
|
|
@ -20,10 +20,6 @@ class GDCartridge: public NaomiCartridge {
|
|||
public:
|
||||
GDCartridge(u32 size) : NaomiCartridge(size)
|
||||
{
|
||||
gdrom_name = NULL;
|
||||
dimm_data = NULL;
|
||||
dimm_data_size = 0;
|
||||
dimm_cur_address = 0;
|
||||
}
|
||||
~GDCartridge()
|
||||
{
|
||||
|
@ -39,17 +35,18 @@ public:
|
|||
virtual bool Read(u32 offset, u32 size, void* dst) override;
|
||||
virtual std::string GetGameId() override;
|
||||
|
||||
void SetGDRomName(const char *name) { this->gdrom_name = name; }
|
||||
void SetGDRomName(const char *name, const char *parentName) { this->gdrom_name = name; this->gdrom_parent_name = parentName; }
|
||||
|
||||
private:
|
||||
enum { FILENAME_LENGTH=24 };
|
||||
|
||||
const char *gdrom_name;
|
||||
const char *gdrom_name = nullptr;
|
||||
const char *gdrom_parent_name = nullptr;
|
||||
|
||||
u32 dimm_cur_address;
|
||||
u32 dimm_cur_address = 0;
|
||||
|
||||
u8 *dimm_data;
|
||||
u32 dimm_data_size;
|
||||
u8 *dimm_data = nullptr;
|
||||
u32 dimm_data_size = 0;
|
||||
|
||||
static const u32 DES_LEFTSWAP[];
|
||||
static const u32 DES_RIGHTSWAP[];
|
||||
|
|
|
@ -258,7 +258,7 @@ static void naomi_cart_LoadZip(const char *filename)
|
|||
case GD:
|
||||
{
|
||||
GDCartridge *gdcart = new GDCartridge(game->size);
|
||||
gdcart->SetGDRomName(game->gdrom_name);
|
||||
gdcart->SetGDRomName(game->gdrom_name, game->parent_name);
|
||||
CurrentCartridge = gdcart;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue