Modest cleanups for DSi_NAND (#1714)

* Add a definition for TMD files

* Wrap TitleMetadata in a namespace

* Add a comment

* Remove TitleMetadataCertificate

- melonDS ignores it anyway

* Refactor the use of title metadata

- Move bitwise operations on the title ID into helper methods
- Use TitleMetadata objects instead of pointers to raw data

* Slight cleanup in DSi_NAND

- Replace some constants with sizeof
- Use an NDSHeader object instead of a raw array of bytes

* Add a DSi_NAND::ImportFile overload that loads a file from memory

* Split most of ImportTitle into InitTitleFileStructure

- It will be reused in the next commit

* Add ability to import title from memory

* Fix another potential issue

* Fix broken DSiWare installation

- The bytes of the title ID/category were being swapped in most places, but not all

* Add some logging calls

* Declare array sizes in DSi_TMD in decimal, not hex

* Add a space after the #endif

- To adhere to the style guide

* Assert the size of TitleMetadataContent

* Change the type of SignatureName

* Don't mark the TMD structs as packed

* Remove extraneous comments

* Cut down some newlines
This commit is contained in:
Jesse Talavera-Greenberg
2023-07-08 16:17:30 -04:00
committed by GitHub
parent d1ff103259
commit 0947e941b8
5 changed files with 254 additions and 41 deletions

View File

@ -29,6 +29,8 @@
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include "DSi_TMD.h"
namespace Ui
{
class TitleManagerDialog;
@ -90,7 +92,7 @@ private:
Ui::TitleManagerDialog* ui;
QString importAppPath;
u8 importTmdData[0x208];
DSi_TMD::TitleMetadata importTmdData;
bool importReadOnly;
QAction* actImportTitleData[3];
@ -104,7 +106,7 @@ class TitleImportDialog : public QDialog
Q_OBJECT
public:
explicit TitleImportDialog(QWidget* parent, QString& apppath, u8* tmd, bool& readonly);
explicit TitleImportDialog(QWidget* parent, QString& apppath, const DSi_TMD::TitleMetadata* tmd, bool& readonly);
~TitleImportDialog();
private slots:
@ -124,7 +126,7 @@ private:
QNetworkReply* netreply;
QString& appPath;
u8* tmdData;
const DSi_TMD::TitleMetadata* tmdData;
bool& readOnly;
u32 titleid[2];