Fix savestate name for wad games, crashfix for some wad files without MakerID (thanks lpfaint99), fix for US games using SJIS string (Megaman 9 is one of them) can't do the same for PAL games as it would break special chars = we do need an unicode build

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3368 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s
2009-06-08 02:25:21 +00:00
parent b701802fcf
commit 97691461ca
5 changed files with 37 additions and 36 deletions

View File

@ -133,8 +133,7 @@ bool IsVolumeWadFile(const IVolume *_rVolume)
u32 MagicWord = 0;
_rVolume->Read(0x02, 4, (u8*)&MagicWord);
return (Common::swap32(MagicWord) == 0x00204973);
// That would be 0x00206962 for boot2 wads
return (Common::swap32(MagicWord) == 0x00204973 || Common::swap32(MagicWord) == 0x00206962);
}
IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _PartitionGroup, u32 _VolumeType, u32 _VolumeNum, bool Korean)
@ -227,9 +226,8 @@ EDiscType GetDiscType(IBlobReader& _rReader)
{
u32 MagicWord = Reader.Read32(0x02);
// That would be 0x206962 for boot2 wads
// Should we add them too ?
if (MagicWord == 0x00204973)
// 0x206962 for boot2 wads
if (MagicWord == 0x00204973 || MagicWord == 0x00206962)
return(DISC_TYPE_WAD);
}

View File

@ -104,7 +104,6 @@ IVolume::ECountry CVolumeWAD::GetCountry() const
break; // SDK
default:
// PanicAlert("Unknown Country Code!");
country = COUNTRY_UNKNOWN;
break;
}
@ -132,9 +131,10 @@ std::string CVolumeWAD::GetMakerID() const
{
u32 Offset = ALIGN_40(hdr_size) + ALIGN_40(cert_size) + ALIGN_40(tick_size);
char temp[3];
if (!Read(0x198 + Offset, 2, (u8*)temp))
return "0";
char temp[3] = {1};
// Some weird channels use 0x0000 in place of the MakerID, so we need a check there
if (!Read(0x198 + Offset, 2, (u8*)temp) || temp[0] == 0 || temp[1] == 0)
return "00";
temp[2] = 0;
@ -153,16 +153,14 @@ bool CVolumeWAD::GetTitleID(u8* _pBuffer) const
std::string CVolumeWAD::GetName() const
{
if (m_pReader == NULL)
return "Unknown";
u32 footer_size;
if (!Read(0x1C, 4, (u8*)&footer_size))
return "Unknown";
// Offset to the english title
char temp[85];
if (!Read(0xF1 + OpeningBnrOffset, 84, (u8*)&temp))
if (!Read(0xF1 + OpeningBnrOffset, 84, (u8*)&temp) || footer_size < 0xF1)
return "Unknown";
char out_temp[43];