mirror of
https://github.com/rvtr/ctr_test_tools.git
synced 2025-10-31 13:41:24 -04:00
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_test_tools@8 6b0af911-cb57-b745-895f-eec5701120e1
110 lines
2.1 KiB
C++
110 lines
2.1 KiB
C++
#ifndef SDACCESSOR_H_
|
|
#define SDACCESSOR_H_
|
|
|
|
#include <nn.h>
|
|
#include <nn/srv.h>
|
|
#include <nn/fs.h>
|
|
#include <nn/am/am_Api.h>
|
|
#include <nn/am/am_Result.h>
|
|
#include <nn/applet.h>
|
|
#include <nn/hid/CTR/hid_ApiWithPrivilege.h>
|
|
#include <nn/hid.h>
|
|
#include <algorithm>
|
|
#include <stdio.h>
|
|
|
|
|
|
#include"demo.h"
|
|
|
|
class SdAccessor {
|
|
public:
|
|
SdAccessor();
|
|
virtual ~SdAccessor(){
|
|
}
|
|
|
|
|
|
enum BinaryState
|
|
{
|
|
IMPORTED_NOT = 0,
|
|
IMPORTED_CLEAR = 1,
|
|
IMPORTED_ERROR = 2
|
|
};
|
|
|
|
struct BinaryType
|
|
{
|
|
nn::fs::DirectoryEntry directoryEntry;
|
|
BinaryState state;
|
|
NN_PADDING3;
|
|
nn::Result result;
|
|
};
|
|
|
|
struct BinaryInfo
|
|
{
|
|
BinaryType binaryType[256];
|
|
u16 size;
|
|
};
|
|
|
|
struct DirectoryInfo
|
|
{
|
|
nn::fs::DirectoryEntry directoryEntry[256];
|
|
u16 size;
|
|
};
|
|
void Initialize(nn::fs::Directory& dir, wchar_t* fileName);
|
|
void DirectoryInitialize(nn::fs::Directory& dir);
|
|
void Add(u16 index);
|
|
wchar_t* GetFileName(void)
|
|
{
|
|
return mFileName;
|
|
}
|
|
void GetPreFileName(void);
|
|
void Import(u16 index,bit8* addrForAm);
|
|
void ImportAll(bit8* addrForAm);
|
|
void Export(u16 index);
|
|
void ExportAll(void);
|
|
void SetIsSdMount(bool t)
|
|
{
|
|
mIsSdMount = t;
|
|
}
|
|
BinaryInfo* GetBinary(void)
|
|
{
|
|
return &mBinary;
|
|
}
|
|
DirectoryInfo* GetDirectory(void)
|
|
{
|
|
return &mDirectory;
|
|
}
|
|
u16 GetImportCount(void)
|
|
{
|
|
return mImportCount;
|
|
}
|
|
u16 GetExportCount(void)
|
|
{
|
|
return mExportCount;
|
|
}
|
|
bool IsImportAll(void)
|
|
{
|
|
return mIsImportAll;
|
|
}
|
|
bool IsSdMount(void)
|
|
{
|
|
return mIsSdMount;
|
|
}
|
|
|
|
private:
|
|
NN_PADDING4;
|
|
wchar_t mFileName[512];
|
|
wchar_t mPreFileName[64][512];
|
|
wchar_t mBinaryName[512];
|
|
wchar_t mEmpty[128];
|
|
|
|
BinaryInfo mBinary;
|
|
DirectoryInfo mDirectory;
|
|
|
|
u16 mEntryMax;
|
|
u16 mImportCount;
|
|
u16 mExportCount;
|
|
bool mIsImportAll;
|
|
bool mIsSdMount;
|
|
};
|
|
|
|
#endif /* SDACCESSOR_H_ */
|