Incomplete work on extracting banners from Wii images without savefiles. Please finish my work.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3336 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a8dafb8dc5
commit
f004fb17d4
|
@ -23,6 +23,7 @@
|
|||
#include "ColorUtil.h"
|
||||
#include "BannerLoaderWii.h"
|
||||
#include "FileUtil.h"
|
||||
#include "FileHandlerARC.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
@ -42,11 +43,45 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem)
|
|||
|
||||
if (!File::Exists(Filename))
|
||||
{
|
||||
// TODO(XK): Finish the 'commented' code. Turns out the banner.bin
|
||||
// from the savefiles is very different from the banner.bin
|
||||
// inside opening.bnr
|
||||
#if 0
|
||||
char bnrFilename[260], titleFolder[260];
|
||||
|
||||
// Creating title folder
|
||||
sprintf(titleFolder, FULL_WII_USER_DIR "title/%08x/%08x/data/",
|
||||
(u32)(TitleID>>32), (u32)TitleID);
|
||||
if(!File::Exists(titleFolder))
|
||||
File::CreateFullPath(titleFolder);
|
||||
|
||||
// Extracting banner.bin from opening.bnr
|
||||
sprintf(bnrFilename, FULL_WII_USER_DIR "title/%08x/%08x/data/opening.bnr",
|
||||
(u32)(TitleID>>32), (u32)TitleID);
|
||||
|
||||
if(!_rFileSystem.ExportFile("opening.bnr", bnrFilename)) {
|
||||
m_IsValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
CARCFile bnrArc (bnrFilename, 0x600);
|
||||
|
||||
if(!bnrArc.ExportFile("meta/banner.bin", Filename)) {
|
||||
m_IsValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Now we have an LZ77-compressed file with a short IMD5 header
|
||||
// TODO: Finish the job
|
||||
|
||||
File::Delete(bnrFilename);
|
||||
#else
|
||||
m_IsValid = false;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
// load the opening.bnr
|
||||
// load the banner.bin
|
||||
size_t FileSize = (size_t) File::GetSize(Filename);
|
||||
|
||||
if (FileSize > 0)
|
||||
|
|
|
@ -43,6 +43,22 @@ CARCFile::CARCFile(const std::string& _rFilename)
|
|||
}
|
||||
}
|
||||
|
||||
CARCFile::CARCFile(const std::string& _rFilename, u32 offset)
|
||||
: m_pBuffer(NULL)
|
||||
, m_Initialized(false)
|
||||
{
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rFilename.c_str());
|
||||
if (pReader != NULL)
|
||||
{
|
||||
u64 FileSize = pReader->GetDataSize() - offset;
|
||||
m_pBuffer = new u8[(u32)FileSize];
|
||||
pReader->Read(offset, FileSize, m_pBuffer);
|
||||
delete pReader;
|
||||
|
||||
m_Initialized = ParseBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
CARCFile::CARCFile(const u8* _pBuffer, size_t _BufferSize)
|
||||
: m_pBuffer(NULL)
|
||||
, m_Initialized(false)
|
||||
|
@ -156,9 +172,7 @@ CARCFile::ParseBuffer()
|
|||
u32 ID = Common::swap32(*(u32*)(m_pBuffer));
|
||||
|
||||
if (ID != ARC_ID)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
return false;
|
||||
|
||||
// read header
|
||||
u32 FSTOffset = Common::swap32(*(u32*)(m_pBuffer + 0x4));
|
||||
|
|
|
@ -32,6 +32,8 @@ class CARCFile
|
|||
|
||||
CARCFile(const std::string& _rFilename);
|
||||
|
||||
CARCFile(const std::string& _rFilename, u32 offset);
|
||||
|
||||
CARCFile(const u8* _pBuffer, size_t _BufferSize);
|
||||
|
||||
virtual ~CARCFile();
|
||||
|
|
Loading…
Reference in New Issue