mirror of https://github.com/AxioDL/nod.git
* Add Dol Exporting
This commit is contained in:
parent
84ca6a62e3
commit
35759e99a5
|
@ -58,6 +58,19 @@ public:
|
||||||
PART_UPDATE,
|
PART_UPDATE,
|
||||||
PART_CHANNEL
|
PART_CHANNEL
|
||||||
};
|
};
|
||||||
|
struct DOLHeader
|
||||||
|
{
|
||||||
|
uint32_t textOff[7];
|
||||||
|
uint32_t dataOff[11];
|
||||||
|
uint32_t textStarts[7];
|
||||||
|
uint32_t dataStarts[11];
|
||||||
|
uint32_t textSizes[7];
|
||||||
|
uint32_t dataSizes[11];
|
||||||
|
uint32_t bssStart;
|
||||||
|
uint32_t bssSize;
|
||||||
|
uint32_t entryPoint;
|
||||||
|
};
|
||||||
|
|
||||||
class Node
|
class Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -95,6 +95,27 @@ void DiscBase::IPartition::extractToDirectory(const SystemString& path, bool for
|
||||||
ws->write(buf.get(), m_apploaderSz);
|
ws->write(buf.get(), m_apploaderSz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Extract Dol */
|
||||||
|
SystemString dolPath = path + _S("/main.dol");
|
||||||
|
if (force || Stat(dolPath.c_str(), &theStat))
|
||||||
|
{
|
||||||
|
std::unique_ptr<IPartReadStream> rs = beginReadStream(m_dolOff);
|
||||||
|
/* Read Dol header */
|
||||||
|
DOLHeader hdr;
|
||||||
|
rs->read(&hdr, sizeof(DOLHeader));
|
||||||
|
std::unique_ptr<IFileIO::IWriteStream> ws = NewFileIO(dolPath)->beginWriteStream();
|
||||||
|
ws->write(&hdr, sizeof(DOLHeader));
|
||||||
|
/* Calculate Dol size */
|
||||||
|
uint32_t dolSize = SBig(hdr.textOff[0]);
|
||||||
|
for (uint32_t i = 0 ; i < 7 ; i++)
|
||||||
|
dolSize += SBig(hdr.textSizes[i]);
|
||||||
|
for (uint32_t i = 0 ; i < 11 ; i++)
|
||||||
|
dolSize += SBig(hdr.dataSizes[i]);
|
||||||
|
std::unique_ptr<uint8_t[]> buf(new uint8_t[dolSize]);
|
||||||
|
rs->read(buf.get(), dolSize);
|
||||||
|
ws->write(buf.get(), dolSize);
|
||||||
|
}
|
||||||
|
|
||||||
/* Extract Filesystem */
|
/* Extract Filesystem */
|
||||||
m_nodes[0].extractToDirectory(path, force);
|
m_nodes[0].extractToDirectory(path, force);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue