2010-12-08 08:26:18 +01:00
|
|
|
#ifndef SHAREDCONTENTMAP_H
|
|
|
|
#define SHAREDCONTENTMAP_H
|
|
|
|
|
|
|
|
#include "includes.h"
|
|
|
|
|
2010-12-10 04:50:08 +01:00
|
|
|
//class for handling a content.map from a wii nand
|
2010-12-08 08:26:18 +01:00
|
|
|
class SharedContentMap
|
|
|
|
{
|
|
|
|
public:
|
2010-12-23 17:17:46 +01:00
|
|
|
SharedContentMap( const QByteArray &old = QByteArray() );
|
2010-12-08 08:26:18 +01:00
|
|
|
|
|
|
|
//checks that the content map is sane
|
|
|
|
//size should be correct, contents should be in numerical order
|
|
|
|
//if a path is given, it will check that the hashes in the map match up with the contents in the folder
|
|
|
|
bool Check( const QString &path = QString() );
|
|
|
|
|
2010-12-10 04:50:08 +01:00
|
|
|
//gets a string containing the 8 letter app that matches the given hash.
|
|
|
|
//returns an empty string if the hash is not found in the map
|
2010-12-23 17:17:46 +01:00
|
|
|
QString GetAppFromHash( const QByteArray &hash );
|
2010-12-10 04:50:08 +01:00
|
|
|
|
|
|
|
//gets the first available u32 that is not already in the map and returns it as a string
|
2010-12-08 08:26:18 +01:00
|
|
|
QString GetNextEmptyCid();
|
|
|
|
|
2010-12-10 04:50:08 +01:00
|
|
|
//adds an entry to the end of the map
|
|
|
|
//! this function doesnt check if the entry already exists
|
2010-12-08 08:26:18 +01:00
|
|
|
void AddEntry( const QString &app, const QByteArray &hash );
|
|
|
|
|
2010-12-10 04:50:08 +01:00
|
|
|
//get the entire data ready for writing to a wii nand
|
2011-05-15 19:22:42 +02:00
|
|
|
const QByteArray &Data(){ return data; }
|
2010-12-08 08:26:18 +01:00
|
|
|
|
2010-12-18 22:07:58 +01:00
|
|
|
const QByteArray Hash( quint16 i );
|
|
|
|
const QString Cid( quint16 i );
|
|
|
|
quint16 Count();
|
|
|
|
|
2010-12-08 08:26:18 +01:00
|
|
|
private:
|
|
|
|
QByteArray data;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SHAREDCONTENTMAP_H
|