2013-04-17 21:09:55 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
#include "BannerLoader.h"
|
2013-03-03 15:51:26 -07:00
|
|
|
#include "VolumeGC.h"
|
2013-03-02 21:57:49 -07:00
|
|
|
#include "StringUtil.h"
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
namespace DiscIO
|
|
|
|
{
|
|
|
|
class CBannerLoaderGC
|
|
|
|
: public IBannerLoader
|
|
|
|
{
|
|
|
|
public:
|
2013-03-02 21:57:49 -07:00
|
|
|
CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem, DiscIO::IVolume* volume);
|
2008-12-07 21:46:09 -07:00
|
|
|
virtual ~CBannerLoaderGC();
|
|
|
|
|
|
|
|
virtual bool IsValid();
|
|
|
|
|
2013-09-25 01:05:36 -06:00
|
|
|
virtual std::vector<u32> GetBanner(int* pWidth, int* pHeight);
|
2013-03-02 18:46:55 -07:00
|
|
|
|
|
|
|
virtual std::vector<std::string> GetNames();
|
|
|
|
virtual std::string GetCompany();
|
|
|
|
virtual std::vector<std::string> GetDescriptions();
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
DVD_BANNER_WIDTH = 96,
|
|
|
|
DVD_BANNER_HEIGHT = 32
|
|
|
|
};
|
|
|
|
|
2009-01-22 00:42:17 -07:00
|
|
|
enum BANNER_TYPE
|
|
|
|
{
|
|
|
|
BANNER_UNKNOWN,
|
|
|
|
BANNER_BNR1,
|
|
|
|
BANNER_BNR2,
|
|
|
|
};
|
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
// Banner Comment
|
|
|
|
struct DVDBannerComment
|
|
|
|
{
|
|
|
|
char shortTitle[32]; // Short game title shown in IPL menu
|
|
|
|
char shortMaker[32]; // Short developer, publisher names shown in IPL menu
|
|
|
|
char longTitle[64]; // Long game title shown in IPL game start screen
|
|
|
|
char longMaker[64]; // Long developer, publisher names shown in IPL game start screen
|
|
|
|
char comment[128]; // Game description shown in IPL game start screen in two lines.
|
|
|
|
};
|
|
|
|
|
2013-03-02 18:46:55 -07:00
|
|
|
// "opening.bnr" file format for EU console
|
2008-12-07 21:46:09 -07:00
|
|
|
struct DVDBanner
|
|
|
|
{
|
2013-03-02 18:46:55 -07:00
|
|
|
u32 id; // 'BNR2'
|
2008-12-07 21:46:09 -07:00
|
|
|
u32 padding[7];
|
|
|
|
u16 image[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; // RGB5A3 96x32 texture image
|
2013-03-02 18:46:55 -07:00
|
|
|
DVDBannerComment comment[6]; // Comments in six languages (only 1 for BNR1 type)
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
2013-03-02 18:46:55 -07:00
|
|
|
static const u32 BNR1_SIZE = sizeof(DVDBanner) - sizeof(DVDBannerComment) * 5;
|
|
|
|
static const u32 BNR2_SIZE = sizeof(DVDBanner);
|
|
|
|
|
|
|
|
template <u32 N>
|
|
|
|
std::string GetDecodedString(const char (&data)[N])
|
2008-12-07 21:46:09 -07:00
|
|
|
{
|
2013-03-03 15:51:26 -07:00
|
|
|
auto const string_decoder = CVolumeGC::GetStringDecoder(m_country);
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2013-03-02 21:57:49 -07:00
|
|
|
// strnlen to trim NULLs
|
|
|
|
return string_decoder(std::string(data, strnlen(data, sizeof(data))));
|
2013-03-02 18:46:55 -07:00
|
|
|
}
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
u8* m_pBannerFile;
|
|
|
|
bool m_IsValid;
|
2010-01-10 22:07:56 -07:00
|
|
|
BANNER_TYPE m_BNRType;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2009-01-22 00:42:17 -07:00
|
|
|
BANNER_TYPE getBannerType();
|
2013-10-02 16:18:54 -06:00
|
|
|
|
2013-03-02 21:57:49 -07:00
|
|
|
DiscIO::IVolume::ECountry const m_country;
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
2009-02-22 05:43:25 -07:00
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
} // namespace
|