-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.cpp
73 lines (60 loc) · 2.82 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <QCoreApplication>
#include <QDebug>
#include <QFile>
#include <QDir>
#include <QSpecialInteger>
#include <preloader_parser.h>
#include <iostream>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
a.isSetuidAllowed();
a.setApplicationName("MTK Preloader Parser V4.0000.0");
a.setApplicationVersion("4.0000.0");
a.setOrganizationName("Mediatek");
a.setQuitLockEnabled(0);
qInfo("................ MTK Preloader Parser ...............");
qInfo(".....................................................");
if(argc < 2)
qInfo("Drag and drop the preloader/boot_region file here0!");
while (1) {
QByteArray path(0xff, Qt::Uninitialized);
std::cin.get((char*)path.data(), 0xff);
qInfo(".....................................................");
qInfo().noquote() << QString("Reading emi file %0").arg(path.data());
QFile emi_dev(QDir::toNativeSeparators(path));
if (!emi_dev.size())
{
qInfo().noquote() << QString("please input a valid file!.");
std::cin.ignore();
}
if (emi_dev.open(QIODevice::ReadOnly))
{
QVector<mtkPreloader::MTKEMIInfo> emis = {};
EMIParser::PrasePreloader(emi_dev, emis);
emi_dev.close();
qsizetype idx = 0;
for (QVector<mtkPreloader::MTKEMIInfo>::iterator it =
emis.begin(); it != emis.end(); it++)
{
mtkPreloader::MTKEMIInfo emi = *it;
qInfo().noquote() << qstr("EMIInfo{%0}:%1:%2:%3:%4:%5:%6:DRAM:%7:%8").arg(emi.index,
emi.flash_id,
emi.manufacturer_id,
emi.manufacturer,
emi.ProductName,
emi.OEMApplicationId,
emi.CardBGA,
emi.dram_type,
emi.dram_size);
// qInfo().noquote() << qstr("EMIInfo{%0}:version:%1:emi_content:%2").arg(emi.index, qstr::number(emi.m_emi_ver), emi.m_emi_info.toHex().data());
//! see EMIInfoV20
idx++;
}
}
path.clear();
std::cin.ignore();
qInfo("Drag and drop the preloader/boot_region file here!");
}
return a.exec();
}