Small unicode fix for extracting files (ISOProperties.cpp)

Change some PanicYesNo to AskYesNo so that they will always show (WiiSaveCrypted.cpp)
Adds more country filtering options to Gamelist (france, italy, korea, taiwan, and unknown country)
Misc. fixes for potential crashes that can only occur with a corrupted dump == check filesize of a dump before spending time looking for the cause of a crash :P

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4802 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2010-01-11 05:07:56 +00:00
parent a19be73be3
commit 183804e442
12 changed files with 105 additions and 38 deletions

View File

@ -92,6 +92,11 @@ void SConfig::SaveSettings()
ini.Set("GameList", "ListJap", m_ListJap);
ini.Set("GameList", "ListPal", m_ListPal);
ini.Set("GameList", "ListUsa", m_ListUsa);
ini.Set("GameList", "ListFrance", m_ListFrance);
ini.Set("GameList", "ListItaly", m_ListItaly);
ini.Set("GameList", "ListKorea", m_ListKorea);
ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
ini.Set("GameList", "ListUnknown", m_ListUnknown);
// Core
ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
@ -202,6 +207,12 @@ void SConfig::LoadSettings()
ini.Get("GameList", "ListPal", &m_ListPal, true);
ini.Get("GameList", "ListUsa", &m_ListUsa, true);
ini.Get("GameList", "ListFrance", &m_ListFrance, true);
ini.Get("GameList", "ListItaly", &m_ListItaly, true);
ini.Get("GameList", "ListKorea", &m_ListKorea, true);
ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true);
ini.Get("GameList", "ListUnknown", &m_ListUnknown, true);
// Core
ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, true);
ini.Get("Core", "UseDynarec", &m_LocalCoreStartupParameter.bUseJIT, true);

View File

@ -73,6 +73,7 @@ struct SConfig
bool m_InterfaceStatusbar;
bool m_InterfaceLogWindow;
bool m_InterfaceConsole;
bool m_ListDrives;
bool m_ListWad;
bool m_ListWii;
@ -80,6 +81,11 @@ struct SConfig
bool m_ListPal;
bool m_ListUsa;
bool m_ListJap;
bool m_ListFrance;
bool m_ListItaly;
bool m_ListKorea;
bool m_ListTaiwan;
bool m_ListUnknown;
SysConf* m_SYSCONF;

View File

@ -31,16 +31,20 @@ CBannerLoaderGC::CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem)
{
// load the opening.bnr
size_t FileSize = (size_t) _rFileSystem.GetFileSize("opening.bnr");
if (FileSize > 0)
if (FileSize == sizeof(DVDBanner) || FileSize == sizeof(DVDBanner2))
{
m_pBannerFile = new u8[FileSize];
if (m_pBannerFile)
{
_rFileSystem.ReadFile("opening.bnr", m_pBannerFile, FileSize);
m_IsValid = true;
m_BNRType = getBannerType();
if (m_BNRType == BANNER_UNKNOWN)
PanicAlert("Invalid opening.bnr found in gcm:\n%s\n You may need to redump this game.",
_rFileSystem.GetVolume()->GetName().c_str());
else m_IsValid = true;
}
}
else WARN_LOG(DISCIO, "Invalid opening.bnr size: %0x", FileSize);
}
@ -54,15 +58,13 @@ CBannerLoaderGC::~CBannerLoaderGC()
}
bool
CBannerLoaderGC::IsValid()
bool CBannerLoaderGC::IsValid()
{
return m_IsValid;
}
bool
CBannerLoaderGC::GetBanner(u32* _pBannerImage)
bool CBannerLoaderGC::GetBanner(u32* _pBannerImage)
{
if (!IsValid())
{
@ -76,8 +78,7 @@ CBannerLoaderGC::GetBanner(u32* _pBannerImage)
}
bool
CBannerLoaderGC::GetName(std::string _rName[])
bool CBannerLoaderGC::GetName(std::string _rName[])
{
bool returnCode = false;
@ -87,7 +88,7 @@ CBannerLoaderGC::GetName(std::string _rName[])
}
// find Banner type
switch (getBannerType())
switch (m_BNRType)
{
case CBannerLoaderGC::BANNER_BNR1:
{
@ -139,8 +140,7 @@ CBannerLoaderGC::GetName(std::string _rName[])
}
bool
CBannerLoaderGC::GetCompany(std::string& _rCompany)
bool CBannerLoaderGC::GetCompany(std::string& _rCompany)
{
_rCompany = "N/A";
@ -157,8 +157,7 @@ CBannerLoaderGC::GetCompany(std::string& _rCompany)
}
bool
CBannerLoaderGC::GetDescription(std::string* _rDescription)
bool CBannerLoaderGC::GetDescription(std::string* _rDescription)
{
bool returnCode = false;
@ -168,7 +167,7 @@ CBannerLoaderGC::GetDescription(std::string* _rDescription)
}
// find Banner type
switch (getBannerType())
switch (m_BNRType)
{
case CBannerLoaderGC::BANNER_BNR1:
{
@ -202,8 +201,7 @@ CBannerLoaderGC::GetDescription(std::string* _rDescription)
}
void
CBannerLoaderGC::decode5A3image(u32* dst, u16* src, int width, int height)
void CBannerLoaderGC::decode5A3image(u32* dst, u16* src, int width, int height)
{
for (int y = 0; y < height; y += 4)
{

View File

@ -80,6 +80,7 @@ class CBannerLoaderGC
u8* m_pBannerFile;
bool m_IsValid;
BANNER_TYPE m_BNRType;
void decode5A3image(u32* dst, u16* src, int width, int height);
BANNER_TYPE getBannerType();

View File

@ -83,6 +83,7 @@ void ReadGC(std::string FileName)
if (!DiscIO::IsVolumeWiiDisc(OpenISO) && !DiscIO::IsVolumeWadFile(OpenISO))
{
pFileSystem = DiscIO::CreateFileSystem(OpenISO);
if(!pFileSystem) return;
pFileSystem->GetFileList(GCFiles);
}
FileAccess = true;

View File

@ -83,6 +83,8 @@ u64 CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _Max
if (pFileInfo->m_FileSize > _MaxBufferSize)
return 0;
DEBUG_LOG(DISCIO, "Filename: %s. Offset: %0x. Size: %0x",_rFullPath, pFileInfo->m_Offset, pFileInfo->m_FileSize);
m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer);
return pFileInfo->m_FileSize;
}

View File

@ -28,6 +28,7 @@
#include "VolumeWad.h"
#include "Hash.h"
#include "StringUtil.h"
namespace DiscIO
{
@ -103,6 +104,11 @@ IVolume* CreateVolumeFromFilename(const std::string& _rFilename, u32 _PartitionG
case DISC_TYPE_UNK:
default:
std::string Filename, ext;
SplitPath(_rFilename, NULL, &Filename, &ext);
Filename += ext;
NOTICE_LOG(DISCIO, "%s does not have the Magic word for a gcm, wiidisc or wad file\n"
"Set Log Verbosity to Warning and attempt to load the game again to view the values", Filename.c_str());
delete pReader;
return NULL;
}
@ -220,6 +226,7 @@ EDiscType GetDiscType(IBlobReader& _rReader)
else
return(DISC_TYPE_WII_CONTAINER);
}
WARN_LOG(DISCIO, "Wiidisc magicword not found.\n Offset: 0x18 value: %04x", MagicWord);
}
// check for WAD
@ -229,6 +236,7 @@ EDiscType GetDiscType(IBlobReader& _rReader)
// 0x206962 for boot2 wads
if (MagicWord == 0x00204973 || MagicWord == 0x00206962)
return(DISC_TYPE_WAD);
WARN_LOG(DISCIO, "Wad magicword not found.\n Offset: 0x02 value: %04x", MagicWord);
}
// check for GC
@ -237,6 +245,7 @@ EDiscType GetDiscType(IBlobReader& _rReader)
if (MagicWord == 0xC2339F3D)
return(DISC_TYPE_GC);
WARN_LOG(DISCIO, "GCM magicword not found.\n Offset: 0x1C value: %04x", MagicWord);
}
return DISC_TYPE_UNK;

View File

@ -252,13 +252,6 @@ EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
EVT_MENU(IDM_LOGWINDOW, CFrame::OnToggleLogWindow)
EVT_MENU(IDM_CONSOLEWINDOW, CFrame::OnToggleConsole)
EVT_MENU(IDM_LISTDRIVES, CFrame::GameListChanged)
EVT_MENU(IDM_LISTWII, CFrame::GameListChanged)
EVT_MENU(IDM_LISTGC, CFrame::GameListChanged)
EVT_MENU(IDM_LISTWAD, CFrame::GameListChanged)
EVT_MENU(IDM_LISTJAP, CFrame::GameListChanged)
EVT_MENU(IDM_LISTPAL, CFrame::GameListChanged)
EVT_MENU(IDM_LISTUSA, CFrame::GameListChanged)
EVT_MENU(IDM_PURGECACHE, CFrame::GameListChanged)
EVT_MENU(IDM_LOADLASTSTATE, CFrame::OnLoadLastState)
@ -272,6 +265,7 @@ EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT8, CFrame::OnSaveState)
EVT_MENU_RANGE(IDM_FRAMESKIP0, IDM_FRAMESKIP9, CFrame::OnFrameSkip)
EVT_MENU_RANGE(IDM_DRIVE1, IDM_DRIVE24, CFrame::OnBootDrive)
EVT_MENU_RANGE(IDM_CONNECT_WIIMOTE1, IDM_CONNECT_WIIMOTE4, CFrame::OnConnectWiimote)
EVT_MENU_RANGE(IDM_LISTWAD, IDM_LISTDRIVES, CFrame::GameListChanged)
// Other
EVT_ACTIVATE(CFrame::OnActive)
@ -659,11 +653,19 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
SConfig::GetInstance().m_ListWad) &&
(SConfig::GetInstance().m_ListJap &&
SConfig::GetInstance().m_ListUsa &&
SConfig::GetInstance().m_ListPal)))
SConfig::GetInstance().m_ListPal &&
SConfig::GetInstance().m_ListFrance &&
SConfig::GetInstance().m_ListItaly &&
SConfig::GetInstance().m_ListKorea &&
SConfig::GetInstance().m_ListTaiwan &&
SConfig::GetInstance().m_ListUnknown)))
{
SConfig::GetInstance().m_ListGC = SConfig::GetInstance().m_ListWii =
SConfig::GetInstance().m_ListWad = SConfig::GetInstance().m_ListJap =
SConfig::GetInstance().m_ListUsa = SConfig::GetInstance().m_ListPal = true;
SConfig::GetInstance().m_ListGC = SConfig::GetInstance().m_ListWii =
SConfig::GetInstance().m_ListWad = SConfig::GetInstance().m_ListJap =
SConfig::GetInstance().m_ListUsa = SConfig::GetInstance().m_ListPal =
SConfig::GetInstance().m_ListFrance = SConfig::GetInstance().m_ListItaly =
SConfig::GetInstance().m_ListKorea = SConfig::GetInstance().m_ListTaiwan =
SConfig::GetInstance().m_ListUnknown= true;
GetMenuBar()->FindItem(IDM_LISTGC)->Check(true);
GetMenuBar()->FindItem(IDM_LISTWII)->Check(true);
@ -671,6 +673,11 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
GetMenuBar()->FindItem(IDM_LISTJAP)->Check(true);
GetMenuBar()->FindItem(IDM_LISTUSA)->Check(true);
GetMenuBar()->FindItem(IDM_LISTPAL)->Check(true);
GetMenuBar()->FindItem(IDM_LISTFRANCE)->Check(true);
GetMenuBar()->FindItem(IDM_LISTITALY)->Check(true);
GetMenuBar()->FindItem(IDM_LISTKOREA)->Check(true);
GetMenuBar()->FindItem(IDM_LISTTAIWAN)->Check(true);
GetMenuBar()->FindItem(IDM_LIST_UNK)->Check(true);
m_GameListCtrl->Update();
}

View File

@ -243,10 +243,19 @@ void CFrame::CreateMenu()
regionMenu->Check(IDM_LISTPAL, SConfig::GetInstance().m_ListPal);
regionMenu->AppendCheckItem(IDM_LISTUSA, _T("Show USA"));
regionMenu->Check(IDM_LISTUSA, SConfig::GetInstance().m_ListUsa);
regionMenu->AppendSeparator();
regionMenu->AppendCheckItem(IDM_LISTFRANCE, _T("Show France"));
regionMenu->Check(IDM_LISTFRANCE, SConfig::GetInstance().m_ListFrance);
regionMenu->AppendCheckItem(IDM_LISTITALY, _T("Show Italy"));
regionMenu->Check(IDM_LISTITALY, SConfig::GetInstance().m_ListItaly);
regionMenu->AppendCheckItem(IDM_LISTKOREA, _T("Show Korea"));
regionMenu->Check(IDM_LISTKOREA, SConfig::GetInstance().m_ListKorea);
regionMenu->AppendCheckItem(IDM_LISTTAIWAN, _T("Show Taiwan"));
regionMenu->Check(IDM_LISTTAIWAN, SConfig::GetInstance().m_ListTaiwan);
regionMenu->AppendCheckItem(IDM_LIST_UNK, _T("Show unknown"));
regionMenu->Check(IDM_LIST_UNK, SConfig::GetInstance().m_ListUnknown);
viewMenu->AppendCheckItem(IDM_LISTDRIVES, _T("Show Drives"));
viewMenu->Check(IDM_LISTDRIVES, SConfig::GetInstance().m_ListDrives);
viewMenu->AppendSeparator();
viewMenu->Append(IDM_PURGECACHE, _T("Purge Cache"));
m_MenuBar->Append(viewMenu, _T("&View"));
@ -1066,6 +1075,21 @@ void CFrame::GameListChanged(wxCommandEvent& event)
case IDM_LISTUSA:
SConfig::GetInstance().m_ListUsa = event.IsChecked();
break;
case IDM_LISTFRANCE:
SConfig::GetInstance().m_ListFrance = event.IsChecked();
break;
case IDM_LISTITALY:
SConfig::GetInstance().m_ListItaly = event.IsChecked();
break;
case IDM_LISTKOREA:
SConfig::GetInstance().m_ListKorea = event.IsChecked();
break;
case IDM_LISTTAIWAN:
SConfig::GetInstance().m_ListTaiwan = event.IsChecked();
break;
case IDM_LIST_UNK:
SConfig::GetInstance().m_ListUnknown = event.IsChecked();
break;
case IDM_LISTDRIVES:
SConfig::GetInstance().m_ListDrives = event.IsChecked();
break;

View File

@ -106,6 +106,11 @@ enum
IDM_LISTJAP,
IDM_LISTPAL,
IDM_LISTUSA,
IDM_LISTFRANCE,
IDM_LISTITALY,
IDM_LISTKOREA,
IDM_LISTTAIWAN,
IDM_LIST_UNK,
IDM_LISTDRIVES,
IDM_PURGECACHE,

View File

@ -98,7 +98,8 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
{
GCFiles.clear();
pFileSystem = DiscIO::CreateFileSystem(OpenISO);
pFileSystem->GetFileList(GCFiles);
if (pFileSystem)
pFileSystem->GetFileList(GCFiles);
}
}
@ -193,7 +194,8 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
// TODO : Should we add a way to browse the wad file ?
if (!DiscIO::IsVolumeWadFile(OpenISO))
{
CreateDirectoryTree(RootId, GCFiles, 1, GCFiles.at(0)->m_FileSize);
if (!GCFiles.empty())
CreateDirectoryTree(RootId, GCFiles, 1, GCFiles.at(0)->m_FileSize);
}
}
m_Treectrl->Expand(RootId);
@ -212,7 +214,8 @@ CISOProperties::~CISOProperties()
}
else
if (!IsVolumeWadFile(OpenISO))
delete pFileSystem;
if(pFileSystem)
delete pFileSystem;
delete OpenISO;
}
@ -672,9 +675,9 @@ void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolde
// Extraction
for (u32 i = index[0]; i < index[1]; i++)
{
dialog.SetTitle(wxString::Format(_T("%s : %d%%"), (const char *)dialogTitle.mb_str(),
dialog.SetTitle(wxString::Format(_T("%s : %d%%"), dialogTitle.c_str(),
(u32)(((float)(i - index[0]) / (float)(index[1] - index[0])) * 100)));
if (!dialog.Update(i, wxString::Format(_T("Extracting %s"), fst[i]->m_FullPath)))
if (!dialog.Update(i, wxString::Format(_T("Extracting %s"), wxString(fst[i]->m_FullPath, *wxConvCurrent).c_str())))
break;
if (fst[i]->IsDirectory())

View File

@ -114,7 +114,7 @@ void CWiiSaveCrypted::Extract()
sprintf(dir, FULL_WII_USER_DIR "title/%08x/%08x/data/", (u32)(_saveGameTitle>>32), (u32)_saveGameTitle);
if (!PanicYesNo("Warning! it is advised to backup all files in the folder:\n%s\nDo you wish to continue?", dir))
if (!AskYesNo("Warning! it is advised to backup all files in the folder:\n%s\nDo you wish to continue?", dir))
return;
INFO_LOG(CONSOLE, "%s", dir);
@ -141,7 +141,7 @@ void CWiiSaveCrypted::Extract()
File::Copy(path, tmpPath);
//
if (!File::Exists(path) || PanicYesNo("%s already exists, overwrite?", path))
if (!File::Exists(path) || AskYesNo("%s already exists, overwrite?", path))
{
INFO_LOG(CONSOLE, "creating file %s", path);
outFileP = fopen(path, "wb");
@ -199,7 +199,7 @@ void CWiiSaveCrypted::Extract()
sprintf(tmpPath, "%s.bak", path);
File::Copy(path, tmpPath);
//
if (!File::Exists(path) || PanicYesNo("%s already exists, overwrite?", path))
if (!File::Exists(path) || AskYesNo("%s already exists, overwrite?", path))
{
INFO_LOG(CONSOLE, "creating file %s", path);