mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-21 23:48:22 +08:00
Include offset in FfsReport
This commit is contained in:
parent
cf01543f06
commit
9ee937a429
@ -21,28 +21,28 @@ std::vector<UString> FfsReport::generate()
|
|||||||
|
|
||||||
// Check model pointer
|
// Check model pointer
|
||||||
if (!model) {
|
if (!model) {
|
||||||
report.push_back(UString("ERROR: Invalid model pointer provided"));
|
report.push_back(usprintf("%s: invalid model pointer provided", __FUNCTION__));
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check root index to be valid
|
// Check root index to be valid
|
||||||
UModelIndex root = model->index(0,0);
|
UModelIndex root = model->index(0,0);
|
||||||
if (!root.isValid()) {
|
if (!root.isValid()) {
|
||||||
report.push_back(UString("ERROR: Model root index is invalid"));
|
report.push_back(usprintf("%s: model root index is invalid", __FUNCTION__));
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate report recursive
|
// Generate report recursive
|
||||||
report.push_back(UString(" Type | Subtype | Size | CRC32 | Name "));
|
report.push_back(UString(" Type | Subtype | Offset | Size | CRC32 | Name "));
|
||||||
USTATUS result = generateRecursive(report, root);
|
USTATUS result = generateRecursive(report, root);
|
||||||
if (result) {
|
if (result) {
|
||||||
report.push_back(UString("ERROR: generateRecursive returned ") + errorCodeToUString(result));
|
report.push_back(usprintf("%s: generateRecursive returned ", __FUNCTION__) + errorCodeToUString(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
USTATUS FfsReport::generateRecursive(std::vector<UString> & report, UModelIndex index, UINT32 level)
|
USTATUS FfsReport::generateRecursive(std::vector<UString> & report, const UModelIndex & index, const UINT32 level)
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return U_SUCCESS; // Nothing to report for invalid index
|
return U_SUCCESS; // Nothing to report for invalid index
|
||||||
@ -53,11 +53,17 @@ USTATUS FfsReport::generateRecursive(std::vector<UString> & report, UModelIndex
|
|||||||
|
|
||||||
// Information on current item
|
// Information on current item
|
||||||
UString text = model->text(index);
|
UString text = model->text(index);
|
||||||
|
UString offset = "| N/A ";
|
||||||
|
if ((!model->compressed(index)) || (index.parent().isValid() && !model->compressed(index.parent()))) {
|
||||||
|
offset = usprintf("| %08X ", model->offset(index));
|
||||||
|
}
|
||||||
|
|
||||||
report.push_back(
|
report.push_back(
|
||||||
UString(" ") + itemTypeToUString(model->type(index)).leftJustified(16)
|
UString(" ") + itemTypeToUString(model->type(index)).leftJustified(16)
|
||||||
+ UString("| ") + itemSubtypeToUString(model->type(index), model->subtype(index)).leftJustified(22)
|
+ UString("| ") + itemSubtypeToUString(model->type(index), model->subtype(index)).leftJustified(22)
|
||||||
|
+ offset
|
||||||
+ usprintf("| %08X | %08X | ", data.size(), crc)
|
+ usprintf("| %08X | %08X | ", data.size(), crc)
|
||||||
+ urepeated('-', level) + UString(" ") + model->name(index) + (text.isEmpty() ? UString("") : UString(" | ") + text)
|
+ urepeated('-', level) + UString(" ") + model->name(index) + (text.isEmpty() ? UString() : UString(" | ") + text)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Information on child items
|
// Information on child items
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
TreeModel* model;
|
TreeModel* model;
|
||||||
|
|
||||||
USTATUS generateRecursive(std::vector<UString> & report, UModelIndex index, UINT32 level = 0);
|
USTATUS generateRecursive(std::vector<UString> & report, const UModelIndex & index, const UINT32 level = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FFSREPORT_H
|
#endif // FFSREPORT_H
|
||||||
|
Loading…
Reference in New Issue
Block a user