2016-02-29 22:28:18 +01:00
|
|
|
#ifndef HOMEBREW_LOADER_H_
|
|
|
|
#define HOMEBREW_LOADER_H_
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "ProgressWindow.h"
|
|
|
|
#include "system/CThread.h"
|
|
|
|
#include "gui/sigslot.h"
|
|
|
|
|
2019-08-15 10:53:52 +02:00
|
|
|
class HomebrewLoader : public GuiFrame, public CThread {
|
2016-02-29 22:28:18 +01:00
|
|
|
public:
|
2019-08-15 10:53:52 +02:00
|
|
|
enum eLoadResults {
|
2016-02-29 22:28:18 +01:00
|
|
|
SUCCESS = 0,
|
|
|
|
INVALID_INPUT = -1,
|
|
|
|
FILE_OPEN_FAILURE = -2,
|
|
|
|
FILE_READ_ERROR = -3,
|
|
|
|
NOT_ENOUGH_MEMORY = -4,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-11-12 14:04:23 +01:00
|
|
|
static HomebrewLoader * loadToMemoryAsync(const std::string & filepath);
|
2019-08-15 10:53:52 +02:00
|
|
|
static int32_t loadToMemory(const std::string & file);
|
2016-02-29 22:28:18 +01:00
|
|
|
sigslot::signal3<GuiElement *, const std::string &, int> asyncLoadFinished;
|
|
|
|
private:
|
|
|
|
|
2016-11-12 14:04:23 +01:00
|
|
|
HomebrewLoader(const std::string & file)
|
2019-08-15 10:53:52 +02:00
|
|
|
: GuiFrame(1280, 720)
|
2016-02-29 22:28:18 +01:00
|
|
|
, CThread(CThread::eAttributeAffCore0 | CThread::eAttributePinnedAff)
|
|
|
|
, filepath(file)
|
2019-08-15 10:53:52 +02:00
|
|
|
, bgImageColor(1280, 720, (GX2Color) {
|
|
|
|
0, 0, 0, 0
|
|
|
|
}) {
|
|
|
|
append(&bgImageColor);
|
|
|
|
}
|
2016-02-29 22:28:18 +01:00
|
|
|
void executeThread();
|
|
|
|
|
|
|
|
int loadToMemory();
|
|
|
|
|
|
|
|
static void loadCallback(CThread *thread, void *arg);
|
|
|
|
|
|
|
|
const std::string filepath;
|
2019-08-15 10:53:52 +02:00
|
|
|
GuiImage bgImageColor;
|
2016-02-29 22:28:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|