mirror of
https://github.com/devkitPro/wut.git
synced 2026-08-28 05:45:03 -05:00
nn_idb: move include into libraries
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <cstdio>
|
||||
#include <nn/idb/idb_cpp.h>
|
||||
#include <nn/result.h>
|
||||
#include <string>
|
||||
|
||||
namespace nn::idb {
|
||||
class IDBReader {
|
||||
public:
|
||||
IDBReader() = default;
|
||||
|
||||
~IDBReader();
|
||||
|
||||
nn::Result LoadIconDataFromIdb(uint64_t titleId, nn::idb::IconDataRaw &iconData) const;
|
||||
|
||||
bool SearchFromDataBase(nn::idb::IconDataKey &key, uint32_t &outIndex) const;
|
||||
|
||||
bool LoadIconDataFromDatabase(uint32_t index, nn::idb::IconDataRaw &iconData) const;
|
||||
|
||||
bool LoadIconData(uint64_t titleId, uint32_t u1, nn::idb::IconDataRaw &iconData) const;
|
||||
|
||||
/**
|
||||
* Initializes the IDBReader from a custom path
|
||||
* @param path Path to "BaristaIconDataBase.dat"
|
||||
* @return true on success, false on error
|
||||
*/
|
||||
bool Initialize(const std::string &path);
|
||||
|
||||
/**
|
||||
* Initializes the IDBReader to read icons from the Wii U Menu icon cache
|
||||
* (fs:/vol/storage_mlc01/usr/save/%08X/%08X/user/common/BaristaIconDataBase.dat)
|
||||
* @return true on success, false on error
|
||||
*/
|
||||
bool Initialize();
|
||||
|
||||
void Finalize();
|
||||
|
||||
private:
|
||||
bool InitializeFile();
|
||||
|
||||
void FinalizeFile();
|
||||
|
||||
int LoadFromFile(void *buffer, uint32_t size, uint32_t offset) const;
|
||||
|
||||
std::string mPath = {};
|
||||
FileHeader *mFileHeader = {};
|
||||
FILE *mFile = {};
|
||||
bool mInitDone = false;
|
||||
};
|
||||
} // namespace nn::idb
|
||||
|
||||
#endif
|
||||
@@ -1,56 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <wut.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace nn::idb {
|
||||
struct WUT_PACKED FileHeaderEntry {
|
||||
uint64_t titleId;
|
||||
uint32_t u1;
|
||||
WUT_UNKNOWN_BYTES(0xC);
|
||||
};
|
||||
WUT_CHECK_SIZE(FileHeaderEntry, 0x18);
|
||||
WUT_CHECK_OFFSET(FileHeaderEntry, 0x00, titleId);
|
||||
WUT_CHECK_OFFSET(FileHeaderEntry, 0x08, u1);
|
||||
|
||||
struct WUT_PACKED FileHeader {
|
||||
uint32_t version;
|
||||
FileHeaderEntry entries[300];
|
||||
};
|
||||
WUT_CHECK_SIZE(FileHeader, 0x1c24);
|
||||
WUT_CHECK_OFFSET(FileHeader, 0x00, version);
|
||||
WUT_CHECK_OFFSET(FileHeader, 0x04, entries);
|
||||
|
||||
struct WUT_PACKED IconDataKey {
|
||||
uint64_t titleId;
|
||||
uint32_t u1; // maybe some kind of filter (or version)?
|
||||
};
|
||||
WUT_CHECK_SIZE(IconDataKey, 0xC);
|
||||
WUT_CHECK_OFFSET(IconDataKey, 0x00, titleId);
|
||||
WUT_CHECK_OFFSET(IconDataKey, 0x08, u1);
|
||||
|
||||
struct WUT_PACKED Utf16NameBuffer {
|
||||
char16_t utf16Str[0x100];
|
||||
};
|
||||
WUT_CHECK_SIZE(Utf16NameBuffer, 0x200);
|
||||
WUT_CHECK_OFFSET(Utf16NameBuffer, 0x00, utf16Str);
|
||||
|
||||
struct WUT_PACKED IconDataRaw {
|
||||
uint64_t titleID;
|
||||
WUT_UNKNOWN_BYTES(0xC);
|
||||
char u6[0x10];
|
||||
WUT_UNKNOWN_BYTES(0xC);
|
||||
Utf16NameBuffer names[0xF];
|
||||
WUT_UNKNOWN_BYTES(0x200);
|
||||
uint8_t icon[0x1002c];
|
||||
WUT_UNKNOWN_BYTES(0x4);
|
||||
};
|
||||
WUT_CHECK_SIZE(IconDataRaw, 0x12060);
|
||||
WUT_CHECK_OFFSET(IconDataRaw, 0x00, titleID);
|
||||
WUT_CHECK_OFFSET(IconDataRaw, 0x30, names);
|
||||
WUT_CHECK_OFFSET(IconDataRaw, 0x2030, icon);
|
||||
} // namespace nn::idb
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user